aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/tcrypt.c
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2008-06-03 06:00:16 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2008-07-10 08:35:16 -0400
commitd729de23e86bbbb28adf6c3ded3651ea4ad8c539 (patch)
tree846b5998d403435621335ab44389d333c63196ff /crypto/tcrypt.c
parent5cdcc22f25b0766fe16d5dd8e3b2efc91fa4da6e (diff)
[CRYPTO] tcrypt: Add self test for des3_ebe cipher operating in cbc mode
Patch to add checking of DES3 test vectors using CBC mode. FIPS-140-2 compliance mandates that any supported mode of operation must include a self test. This satisfies that requirement for cbc(des3_ede). The included test vector was generated by me using openssl. Key/IV was generated with the following command: openssl enc -des_ede_cbc -P input and output values were generated by repeating the string "Too many secrets" a few times over, truncating it to 128 bytes, and encrypting it with openssl using the aformentioned key. Tested successfully by myself Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Adrian-Ken Rueegsegger <rueegsegger@swiss-it.ch> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/tcrypt.c')
-rw-r--r--crypto/tcrypt.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index e99cb4bc5463..ffc1ec6d279e 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -1220,6 +1220,14 @@ static void do_test(void)
1220 test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template, 1220 test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template,
1221 DES3_EDE_DEC_TEST_VECTORS); 1221 DES3_EDE_DEC_TEST_VECTORS);
1222 1222
1223 test_cipher("cbc(des3_ede)", ENCRYPT,
1224 des3_ede_cbc_enc_tv_template,
1225 DES3_EDE_CBC_ENC_TEST_VECTORS);
1226
1227 test_cipher("cbc(des3_ede)", DECRYPT,
1228 des3_ede_cbc_dec_tv_template,
1229 DES3_EDE_CBC_DEC_TEST_VECTORS);
1230
1223 test_hash("md4", md4_tv_template, MD4_TEST_VECTORS); 1231 test_hash("md4", md4_tv_template, MD4_TEST_VECTORS);
1224 1232
1225 test_hash("sha224", sha224_tv_template, SHA224_TEST_VECTORS); 1233 test_hash("sha224", sha224_tv_template, SHA224_TEST_VECTORS);
@@ -1430,6 +1438,14 @@ static void do_test(void)
1430 DES3_EDE_ENC_TEST_VECTORS); 1438 DES3_EDE_ENC_TEST_VECTORS);
1431 test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template, 1439 test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template,
1432 DES3_EDE_DEC_TEST_VECTORS); 1440 DES3_EDE_DEC_TEST_VECTORS);
1441
1442 test_cipher("cbc(des3_ede)", ENCRYPT,
1443 des3_ede_cbc_enc_tv_template,
1444 DES3_EDE_CBC_ENC_TEST_VECTORS);
1445
1446 test_cipher("cbc(des3_ede)", DECRYPT,
1447 des3_ede_cbc_dec_tv_template,
1448 DES3_EDE_CBC_DEC_TEST_VECTORS);
1433 break; 1449 break;
1434 1450
1435 case 5: 1451 case 5: