aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Grindal Bakken <henribak@cisco.com>2019-06-26 14:44:37 +0200
committerHenrik Grindal Bakken <henribak@cisco.com>2019-06-27 12:20:43 +0200
commit20cd0d4e54ab1174814a09351579d50e71b409b7 (patch)
treef0b97f9bdee34852191d34c5a6aeb6b5e9055831
parentb0f48a71abdfc1cbfdc367d7c57c1107355a50a2 (diff)
downloadplatform_external_libsrtp2-20cd0d4e54ab1174814a09351579d50e71b409b7.tar.gz
platform_external_libsrtp2-20cd0d4e54ab1174814a09351579d50e71b409b7.tar.bz2
platform_external_libsrtp2-20cd0d4e54ab1174814a09351579d50e71b409b7.zip
crypto/cipher: Reset the EVP_CIPHER_CTX structure before each test
Reusing a EVP_CIPHER_CTX between EVP_*Init_ex() calls is not allowed unless one calls EVP_CIPHER_CTX_init() first. EVP_EncryptInit_ex() expects the cipher context to be initialized, which isn't done by EVP_CIPHER_CTX_new() in OpenSSL-1.1.x.
-rw-r--r--crypto/cipher/aes_gcm_ossl.c1
-rw-r--r--crypto/cipher/aes_icm_ossl.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/crypto/cipher/aes_gcm_ossl.c b/crypto/cipher/aes_gcm_ossl.c
index 578cad5..0be37eb 100644
--- a/crypto/cipher/aes_gcm_ossl.c
+++ b/crypto/cipher/aes_gcm_ossl.c
@@ -192,6 +192,7 @@ static srtp_err_status_t srtp_aes_gcm_openssl_context_init(void *cv,
break;
}
+ EVP_CIPHER_CTX_init(c->ctx);
if (!EVP_CipherInit_ex(c->ctx, evp, NULL, key, NULL, 0)) {
return (srtp_err_status_init_fail);
}
diff --git a/crypto/cipher/aes_icm_ossl.c b/crypto/cipher/aes_icm_ossl.c
index 0815247..8f85105 100644
--- a/crypto/cipher/aes_icm_ossl.c
+++ b/crypto/cipher/aes_icm_ossl.c
@@ -248,6 +248,7 @@ static srtp_err_status_t srtp_aes_icm_openssl_context_init(void *cv,
break;
}
+ EVP_CIPHER_CTX_init(c->ctx);
if (!EVP_EncryptInit_ex(c->ctx, evp, NULL, key, NULL)) {
return srtp_err_status_fail;
} else {