diff options
-rw-r--r-- | lib/ncrypto_local.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ncrypto_local.c b/lib/ncrypto_local.c index 537aaac..59d74a4 100644 --- a/lib/ncrypto_local.c +++ b/lib/ncrypto_local.c @@ -514,8 +514,10 @@ ncr_symm_cipher_change_iv (struct ncr_symm_cipher_session *sess, const void *iv, g_return_val_if_fail (iv_size == (unsigned)EVP_CIPHER_CTX_iv_length (&sess->ctx), CKR_MECHANISM_PARAM_INVALID); - g_assert (iv_size <= sizeof (sess->ctx.iv)); + g_assert (iv_size <= sizeof (sess->ctx.oiv) + && iv_size <= sizeof (sess->ctx.iv)); + memcpy (sess->ctx.oiv, iv, iv_size); memcpy (sess->ctx.iv, iv, iv_size); return CKR_OK; } |