summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-07-08 20:36:29 +0200
committerRichard Levitte <levitte@openssl.org>2019-07-11 07:27:02 +0200
commit48ebde226d4bd66556f25d0c4b3679478890974d (patch)
treeedeea69404ea9e3ab177c30504361598f7e022ab /test
parent7a228c391e0a35e1dc1223e3af3371968376857b (diff)
test/evp_test.c: [ciphers] Test that we get back the same IV we gave
Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9328)
Diffstat (limited to 'test')
-rw-r--r--test/evp_test.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index 0489bbe093..f76929d539 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -661,6 +661,14 @@ static int cipher_test_enc(EVP_TEST *t, int enc,
t->err = "KEY_SET_ERROR";
goto err;
}
+ /* Check that we get the same IV back */
+ if (expected->iv != NULL
+ && (EVP_CIPHER_flags(expected->cipher) & EVP_CIPH_CUSTOM_IV) == 0
+ && !TEST_mem_eq(expected->iv, expected->iv_len,
+ EVP_CIPHER_CTX_iv(ctx), expected->iv_len)) {
+ t->err = "INVALID_IV";
+ goto err;
+ }
if (expected->aead == EVP_CIPH_CCM_MODE) {
if (!EVP_CipherUpdate(ctx, NULL, &tmplen, NULL, out_len)) {