[PATCH 4/4] Add AES bulk CBC decryption selftest
Jussi Kivilinna
jussi.kivilinna at iki.fi
Sun May 5 16:37:06 CEST 2013
* cipher/rinjdael.c (selftest_cbc_128): New.
(selftest): Call selftest_cbc_128.
--
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
cipher/rijndael.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/cipher/rijndael.c b/cipher/rijndael.c
index b8fb3ab..4564258 100644
--- a/cipher/rijndael.c
+++ b/cipher/rijndael.c
@@ -2020,6 +2020,21 @@ selftest_ctr_128 (void)
}
+/* Run the self-tests for AES-CBC-128, tests bulk CBC decryption.
+ Returns NULL on success. */
+static const char*
+selftest_cbc_128 (void)
+{
+ const int nblocks = 8+2;
+ const int blocksize = BLOCKSIZE;
+ const int context_size = sizeof(RIJNDAEL_context);
+
+ return _gcry_selftest_helper_cbc_128("AES", &rijndael_setkey,
+ &rijndael_encrypt, &_gcry_aes_cbc_dec, nblocks, blocksize,
+ context_size);
+}
+
+
/* Run all the self-tests and return NULL on success. This function
is used for the on-the-fly self-tests. */
static const char *
@@ -2035,6 +2050,9 @@ selftest (void)
if ( (r = selftest_ctr_128 ()) )
return r;
+ if ( (r = selftest_cbc_128 ()) )
+ return r;
+
return r;
}
More information about the Gcrypt-devel
mailing list