From: Benjamin Kaduk Date: Thu, 2 Jul 2020 23:27:03 +0000 (-0700) Subject: Avoid deprecated function in evp_lib.c X-Git-Tag: openssl-3.0.0-alpha7~584 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f43c947dd924cfb1f69c800648f80881bb542027;p=thirdparty%2Fopenssl.git Avoid deprecated function in evp_lib.c Use EVP_CIPHER_CTX_get_iv() to implement EVP_CIPHER_set_asn1_iv(), rather than the deprecated EVP_CIPHER_CTX_original_iv(). Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/12233) --- diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index be20a348f25..c4d41518ef0 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -203,10 +203,9 @@ int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) { int i = 0; unsigned int j; - unsigned char *oiv = NULL; + unsigned char oiv[EVP_MAX_IV_LENGTH]; - if (type != NULL) { - oiv = (unsigned char *)EVP_CIPHER_CTX_original_iv(c); + if (type != NULL && EVP_CIPHER_CTX_get_iv(c, oiv, sizeof(oiv))) { j = EVP_CIPHER_CTX_iv_length(c); OPENSSL_assert(j <= sizeof(c->iv)); i = ASN1_TYPE_set_octetstring(type, oiv, j);