1
1
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>
Этот коммит содержится в:
Dirkjan Bussink 2020-12-22 19:32:45 +01:00 коммит произвёл Jakub Jelen
родитель da36ecd6f2
Коммит a1e8c985d1
3 изменённых файлов: 2 добавлений и 10 удалений

Просмотреть файл

@ -236,12 +236,6 @@ void EVP_MD_CTX_free(EVP_MD_CTX *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
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
{

Просмотреть файл

@ -33,8 +33,6 @@ int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);
EVP_MD_CTX *EVP_MD_CTX_new(void);
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,
const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);

Просмотреть файл

@ -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){