diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2019-10-08 01:19:10 +0200 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2019-10-08 01:19:10 +0200 |
commit | 089cb623be76b88a1eea6fcd135101037661bbc3 (patch) | |
tree | c44618bc24f5def6e4d35342103855702f030134 /crypto/evp/evp_lib.c | |
parent | Add documentation for PEM_{read,write}_bio_Parameters() (diff) | |
download | openssl-089cb623be76b88a1eea6fcd135101037661bbc3.tar.xz openssl-089cb623be76b88a1eea6fcd135101037661bbc3.zip |
Move cipher ctx 'original iv' parameter into the provider
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10026)
Diffstat (limited to 'crypto/evp/evp_lib.c')
-rw-r--r-- | crypto/evp/evp_lib.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index 3abea33d19..3a3eec615f 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -194,11 +194,13 @@ int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) { int i = 0; unsigned int j; + unsigned char *oiv = NULL; if (type != NULL) { + oiv = (unsigned char *)EVP_CIPHER_CTX_original_iv(c); j = EVP_CIPHER_CTX_iv_length(c); OPENSSL_assert(j <= sizeof(c->iv)); - i = ASN1_TYPE_set_octetstring(type, c->oiv, j); + i = ASN1_TYPE_set_octetstring(type, oiv, j); } return i; } @@ -403,7 +405,16 @@ int EVP_CIPHER_CTX_tag_length(const EVP_CIPHER_CTX *ctx) const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx) { - return ctx->oiv; + int ok; + const unsigned char *v = ctx->oiv; + OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END }; + + params[0] = + OSSL_PARAM_construct_octet_ptr(OSSL_CIPHER_PARAM_IV, + (void **)&v, sizeof(ctx->oiv)); + ok = evp_do_ciph_ctx_getparams(ctx->cipher, ctx->provctx, params); + + return ok != 0 ? v : NULL; } /* |