summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-11-15 21:40:40 +0100
committerMiloslav Trmač <mitr@redhat.com>2010-11-15 21:40:40 +0100
commit1116a18a552c849e4fa4e9002f2964656f66cc09 (patch)
tree46e32b995032aeaa66b5ea22666bed6f43c6e643
parent867c1257c40d8b6c2a887576f8c367bcf3df3c79 (diff)
downloadncrypto-1116a18a552c849e4fa4e9002f2964656f66cc09.tar.gz
ncrypto-1116a18a552c849e4fa4e9002f2964656f66cc09.tar.xz
ncrypto-1116a18a552c849e4fa4e9002f2964656f66cc09.zip
Change "original IV" in the OpenSSL context as well.
We don't use the "original IV" in libncrypt, this is just for consistency.
-rw-r--r--lib/ncrypto_local.c4
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;
}