aboutsummaryrefslogtreecommitdiff
path: root/src/libcrypto.c
diff options
context:
space:
mode:
authorDirkjan Bussink <d.bussink@gmail.com>2020-12-22 19:32:45 +0100
committerJakub Jelen <jjelen@redhat.com>2021-01-11 10:45:22 +0100
commita1e8c985d1f1da0561a155d46a580b0b732e727c (patch)
tree1add208296d4eb1bc4e504b524ed14a41317c44e /src/libcrypto.c
parentda36ecd6f25027c8767cd1132229450d699bd49f (diff)
downloadlibssh-a1e8c985d1f1da0561a155d46a580b0b732e727c.tar.gz
libssh-a1e8c985d1f1da0561a155d46a580b0b732e727c.tar.xz
libssh-a1e8c985d1f1da0561a155d46a580b0b732e727c.zip
Remove compat reset function
This can be implemented with the init directly when the context is reused. When a new cipher context is allocated, no initialization call is needed either so this moves the logic to one place as well. Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'src/libcrypto.c')
-rw-r--r--src/libcrypto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcrypto.c b/src/libcrypto.c
index a9fecbe4..b2d5fc93 100644
--- a/src/libcrypto.c
+++ b/src/libcrypto.c
@@ -482,6 +482,8 @@ static void evp_cipher_init(struct ssh_cipher_struct *cipher)
{
if (cipher->ctx == NULL) {
cipher->ctx = EVP_CIPHER_CTX_new();
+ } else {
+ EVP_CIPHER_CTX_init(cipher->ctx);
}
switch(cipher->ciphertype){
@@ -548,7 +550,6 @@ static int evp_cipher_set_encrypt_key(struct ssh_cipher_struct *cipher,
int rc;
evp_cipher_init(cipher);
- EVP_CIPHER_CTX_reset(cipher->ctx);
rc = EVP_EncryptInit_ex(cipher->ctx, cipher->cipher, NULL, key, IV);
if (rc != 1){
@@ -581,7 +582,6 @@ static int evp_cipher_set_decrypt_key(struct ssh_cipher_struct *cipher,
int rc;
evp_cipher_init(cipher);
- EVP_CIPHER_CTX_reset(cipher->ctx);
rc = EVP_DecryptInit_ex(cipher->ctx, cipher->cipher, NULL, key, IV);
if (rc != 1){