Set cipher IV as octet string and pointer from providers
authorBenjamin Kaduk <bkaduk@akamai.com>
Mon, 1 Jun 2020 21:33:54 +0000 (14:33 -0700)
committerBenjamin Kaduk <kaduk@mit.edu>
Sat, 20 Jun 2020 16:46:30 +0000 (09:46 -0700)
commit320d96a32c16de1adbf11f76819fe738f24665b1
tree8dcb27a64081fa424b5a9da031312249c0af0ed5
parent5797e309fce89b5aa9f690ad82f272552b4c7987
Set cipher IV as octet string and pointer from providers

OSSL_CIPHER_PARAM_IV can be accessed both as an octet string and as
an octet pointer (for routines like EVP_CIPHER_CTX_iv() that are
in a nebulous undocumented-and-might-go-away-eventually state),
the latter for when there is need to modify the actual value in
the provider.

Make sure that we consistently try to set it as both the string and pointer
forms (not just octet string) and only fail if neither version succeeds.  The
generic cipher get_ctx_params routine was already doing so, but the
AES-variant-, GCM-, and CCM-specific ones were not.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12039)
providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c
providers/implementations/ciphers/cipher_aes_ocb.c
providers/implementations/ciphers/ciphercommon_ccm.c
providers/implementations/ciphers/ciphercommon_gcm.c