aboutsummaryrefslogtreecommitdiff
path: root/providers/implementations/ciphers/cipher_aes_ocb.c
diff options
context:
space:
mode:
Diffstat (limited to 'providers/implementations/ciphers/cipher_aes_ocb.c')
-rw-r--r--providers/implementations/ciphers/cipher_aes_ocb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/providers/implementations/ciphers/cipher_aes_ocb.c b/providers/implementations/ciphers/cipher_aes_ocb.c
index ce377ad57409..eab315453ef1 100644
--- a/providers/implementations/ciphers/cipher_aes_ocb.c
+++ b/providers/implementations/ciphers/cipher_aes_ocb.c
@@ -387,7 +387,10 @@ static int aes_ocb_set_ctx_params(void *vctx, const OSSL_PARAM params[])
/* IV len must be 1 to 15 */
if (sz < OCB_MIN_IV_LEN || sz > OCB_MAX_IV_LEN)
return 0;
- ctx->base.ivlen = sz;
+ if (ctx->base.ivlen != sz) {
+ ctx->base.ivlen = sz;
+ ctx->iv_state = IV_STATE_UNINITIALISED;
+ }
}
p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN);
if (p != NULL) {