1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-13 04:42:23 +03:00

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>
This commit is contained in:
Dirkjan Bussink
2020-12-22 19:32:45 +01:00
committed by Jakub Jelen
parent da36ecd6f2
commit a1e8c985d1
3 changed files with 2 additions and 10 deletions

View File

@@ -236,12 +236,6 @@ void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
OPENSSL_free(ctx); OPENSSL_free(ctx);
} }
int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *ctx)
{
EVP_CIPHER_CTX_init(ctx);
return 1;
}
#ifndef HAVE_OPENSSL_EVP_CIPHER_CTX_NEW #ifndef HAVE_OPENSSL_EVP_CIPHER_CTX_NEW
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
{ {

View File

@@ -33,8 +33,6 @@ int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);
EVP_MD_CTX *EVP_MD_CTX_new(void); EVP_MD_CTX *EVP_MD_CTX_new(void);
void EVP_MD_CTX_free(EVP_MD_CTX *ctx); void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *ctx);
void DH_get0_pqg(const DH *dh, void DH_get0_pqg(const DH *dh,
const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);

View File

@@ -482,6 +482,8 @@ static void evp_cipher_init(struct ssh_cipher_struct *cipher)
{ {
if (cipher->ctx == NULL) { if (cipher->ctx == NULL) {
cipher->ctx = EVP_CIPHER_CTX_new(); cipher->ctx = EVP_CIPHER_CTX_new();
} else {
EVP_CIPHER_CTX_init(cipher->ctx);
} }
switch(cipher->ciphertype){ switch(cipher->ciphertype){
@@ -548,7 +550,6 @@ static int evp_cipher_set_encrypt_key(struct ssh_cipher_struct *cipher,
int rc; int rc;
evp_cipher_init(cipher); evp_cipher_init(cipher);
EVP_CIPHER_CTX_reset(cipher->ctx);
rc = EVP_EncryptInit_ex(cipher->ctx, cipher->cipher, NULL, key, IV); rc = EVP_EncryptInit_ex(cipher->ctx, cipher->cipher, NULL, key, IV);
if (rc != 1){ if (rc != 1){
@@ -581,7 +582,6 @@ static int evp_cipher_set_decrypt_key(struct ssh_cipher_struct *cipher,
int rc; int rc;
evp_cipher_init(cipher); evp_cipher_init(cipher);
EVP_CIPHER_CTX_reset(cipher->ctx);
rc = EVP_DecryptInit_ex(cipher->ctx, cipher->cipher, NULL, key, IV); rc = EVP_DecryptInit_ex(cipher->ctx, cipher->cipher, NULL, key, IV);
if (rc != 1){ if (rc != 1){