summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorBenjamin Kaduk <bkaduk@akamai.com>2020-07-02 16:27:03 -0700
committerBenjamin Kaduk <bkaduk@akamai.com>2020-08-11 07:07:58 -0700
commitf43c947dd924cfb1f69c800648f80881bb542027 (patch)
tree01da44bde22ecbb0a4b02d5ed47cd0e38a978101 /crypto/evp
parent2f5c405a1694220cca7be8cd96958c1c1245f0ed (diff)
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 <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/12233)
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/evp_lib.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c
index be20a348f2..c4d41518ef 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);