diff options
| author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-04-07 09:43:51 -0400 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-04-25 09:01:47 -0400 |
| commit | e9b7441a9926b8091c01431f10231c9ceac52c8f (patch) | |
| tree | 67a2e0e634fc932d3b6cb032477f729172c8e5a3 | |
| parent | d733ac90f9fe8ac284e523f9920b507555b12f6d (diff) | |
crypto: testmgr - add AES GMAC test vectors
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
| -rw-r--r-- | crypto/tcrypt.c | 4 | ||||
| -rw-r--r-- | crypto/testmgr.c | 17 | ||||
| -rw-r--r-- | crypto/testmgr.h | 89 |
3 files changed, 108 insertions, 2 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 87ef7d66bc20..6b911ef8df8b 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
| @@ -1225,6 +1225,10 @@ static int do_test(int m) | |||
| 1225 | ret += tcrypt_test("rfc4106(gcm(aes))"); | 1225 | ret += tcrypt_test("rfc4106(gcm(aes))"); |
| 1226 | break; | 1226 | break; |
| 1227 | 1227 | ||
| 1228 | case 152: | ||
| 1229 | ret += tcrypt_test("rfc4543(gcm(aes))"); | ||
| 1230 | break; | ||
| 1231 | |||
| 1228 | case 200: | 1232 | case 200: |
| 1229 | test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, | 1233 | test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, |
| 1230 | speed_template_16_24_32); | 1234 | speed_template_16_24_32); |
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index efd8b20e13dc..442ddb46bbe5 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
| @@ -2696,8 +2696,6 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2696 | } | 2696 | } |
| 2697 | } | 2697 | } |
| 2698 | }, { | 2698 | }, { |
| 2699 | |||
| 2700 | |||
| 2701 | .alg = "rfc4309(ccm(aes))", | 2699 | .alg = "rfc4309(ccm(aes))", |
| 2702 | .test = alg_test_aead, | 2700 | .test = alg_test_aead, |
| 2703 | .fips_allowed = 1, | 2701 | .fips_allowed = 1, |
| @@ -2714,6 +2712,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2714 | } | 2712 | } |
| 2715 | } | 2713 | } |
| 2716 | }, { | 2714 | }, { |
| 2715 | .alg = "rfc4543(gcm(aes))", | ||
| 2716 | .test = alg_test_aead, | ||
| 2717 | .suite = { | ||
| 2718 | .aead = { | ||
| 2719 | .enc = { | ||
| 2720 | .vecs = aes_gcm_rfc4543_enc_tv_template, | ||
| 2721 | .count = AES_GCM_4543_ENC_TEST_VECTORS | ||
| 2722 | }, | ||
| 2723 | .dec = { | ||
| 2724 | .vecs = aes_gcm_rfc4543_dec_tv_template, | ||
| 2725 | .count = AES_GCM_4543_DEC_TEST_VECTORS | ||
| 2726 | }, | ||
| 2727 | } | ||
| 2728 | } | ||
| 2729 | }, { | ||
| 2717 | .alg = "rmd128", | 2730 | .alg = "rmd128", |
| 2718 | .test = alg_test_hash, | 2731 | .test = alg_test_hash, |
| 2719 | .suite = { | 2732 | .suite = { |
diff --git a/crypto/testmgr.h b/crypto/testmgr.h index b5721e0b979c..92db37dda757 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h | |||
| @@ -12680,6 +12680,8 @@ static struct cipher_testvec cast6_xts_dec_tv_template[] = { | |||
| 12680 | #define AES_GCM_DEC_TEST_VECTORS 8 | 12680 | #define AES_GCM_DEC_TEST_VECTORS 8 |
| 12681 | #define AES_GCM_4106_ENC_TEST_VECTORS 7 | 12681 | #define AES_GCM_4106_ENC_TEST_VECTORS 7 |
| 12682 | #define AES_GCM_4106_DEC_TEST_VECTORS 7 | 12682 | #define AES_GCM_4106_DEC_TEST_VECTORS 7 |
| 12683 | #define AES_GCM_4543_ENC_TEST_VECTORS 1 | ||
| 12684 | #define AES_GCM_4543_DEC_TEST_VECTORS 2 | ||
| 12683 | #define AES_CCM_ENC_TEST_VECTORS 7 | 12685 | #define AES_CCM_ENC_TEST_VECTORS 7 |
| 12684 | #define AES_CCM_DEC_TEST_VECTORS 7 | 12686 | #define AES_CCM_DEC_TEST_VECTORS 7 |
| 12685 | #define AES_CCM_4309_ENC_TEST_VECTORS 7 | 12687 | #define AES_CCM_4309_ENC_TEST_VECTORS 7 |
| @@ -18193,6 +18195,93 @@ static struct aead_testvec aes_gcm_rfc4106_dec_tv_template[] = { | |||
| 18193 | } | 18195 | } |
| 18194 | }; | 18196 | }; |
| 18195 | 18197 | ||
| 18198 | static struct aead_testvec aes_gcm_rfc4543_enc_tv_template[] = { | ||
| 18199 | { /* From draft-mcgrew-gcm-test-01 */ | ||
| 18200 | .key = "\x4c\x80\xcd\xef\xbb\x5d\x10\xda" | ||
| 18201 | "\x90\x6a\xc7\x3c\x36\x13\xa6\x34" | ||
| 18202 | "\x22\x43\x3c\x64", | ||
| 18203 | .klen = 20, | ||
| 18204 | .iv = zeroed_string, | ||
| 18205 | .assoc = "\x00\x00\x43\x21\x00\x00\x00\x07", | ||
| 18206 | .alen = 8, | ||
| 18207 | .input = "\x45\x00\x00\x30\xda\x3a\x00\x00" | ||
| 18208 | "\x80\x01\xdf\x3b\xc0\xa8\x00\x05" | ||
| 18209 | "\xc0\xa8\x00\x01\x08\x00\xc6\xcd" | ||
| 18210 | "\x02\x00\x07\x00\x61\x62\x63\x64" | ||
| 18211 | "\x65\x66\x67\x68\x69\x6a\x6b\x6c" | ||
| 18212 | "\x6d\x6e\x6f\x70\x71\x72\x73\x74" | ||
| 18213 | "\x01\x02\x02\x01", | ||
| 18214 | .ilen = 52, | ||
| 18215 | .result = "\x45\x00\x00\x30\xda\x3a\x00\x00" | ||
| 18216 | "\x80\x01\xdf\x3b\xc0\xa8\x00\x05" | ||
| 18217 | "\xc0\xa8\x00\x01\x08\x00\xc6\xcd" | ||
| 18218 | "\x02\x00\x07\x00\x61\x62\x63\x64" | ||
| 18219 | "\x65\x66\x67\x68\x69\x6a\x6b\x6c" | ||
| 18220 | "\x6d\x6e\x6f\x70\x71\x72\x73\x74" | ||
| 18221 | "\x01\x02\x02\x01\xf2\xa9\xa8\x36" | ||
| 18222 | "\xe1\x55\x10\x6a\xa8\xdc\xd6\x18" | ||
| 18223 | "\xe4\x09\x9a\xaa", | ||
| 18224 | .rlen = 68, | ||
| 18225 | } | ||
| 18226 | }; | ||
| 18227 | |||
| 18228 | static struct aead_testvec aes_gcm_rfc4543_dec_tv_template[] = { | ||
| 18229 | { /* From draft-mcgrew-gcm-test-01 */ | ||
| 18230 | .key = "\x4c\x80\xcd\xef\xbb\x5d\x10\xda" | ||
| 18231 | "\x90\x6a\xc7\x3c\x36\x13\xa6\x34" | ||
| 18232 | "\x22\x43\x3c\x64", | ||
| 18233 | .klen = 20, | ||
| 18234 | .iv = zeroed_string, | ||
| 18235 | .assoc = "\x00\x00\x43\x21\x00\x00\x00\x07", | ||
| 18236 | .alen = 8, | ||
| 18237 | .input = "\x45\x00\x00\x30\xda\x3a\x00\x00" | ||
| 18238 | "\x80\x01\xdf\x3b\xc0\xa8\x00\x05" | ||
| 18239 | "\xc0\xa8\x00\x01\x08\x00\xc6\xcd" | ||
| 18240 | "\x02\x00\x07\x00\x61\x62\x63\x64" | ||
| 18241 | "\x65\x66\x67\x68\x69\x6a\x6b\x6c" | ||
| 18242 | "\x6d\x6e\x6f\x70\x71\x72\x73\x74" | ||
| 18243 | "\x01\x02\x02\x01\xf2\xa9\xa8\x36" | ||
| 18244 | "\xe1\x55\x10\x6a\xa8\xdc\xd6\x18" | ||
| 18245 | "\xe4\x09\x9a\xaa", | ||
| 18246 | .ilen = 68, | ||
| 18247 | .result = "\x45\x00\x00\x30\xda\x3a\x00\x00" | ||
| 18248 | "\x80\x01\xdf\x3b\xc0\xa8\x00\x05" | ||
| 18249 | "\xc0\xa8\x00\x01\x08\x00\xc6\xcd" | ||
| 18250 | "\x02\x00\x07\x00\x61\x62\x63\x64" | ||
| 18251 | "\x65\x66\x67\x68\x69\x6a\x6b\x6c" | ||
| 18252 | "\x6d\x6e\x6f\x70\x71\x72\x73\x74" | ||
| 18253 | "\x01\x02\x02\x01", | ||
| 18254 | .rlen = 52, | ||
| 18255 | }, { /* nearly same as previous, but should fail */ | ||
| 18256 | .key = "\x4c\x80\xcd\xef\xbb\x5d\x10\xda" | ||
| 18257 | "\x90\x6a\xc7\x3c\x36\x13\xa6\x34" | ||
| 18258 | "\x22\x43\x3c\x64", | ||
| 18259 | .klen = 20, | ||
| 18260 | .iv = zeroed_string, | ||
| 18261 | .assoc = "\x00\x00\x43\x21\x00\x00\x00\x07", | ||
| 18262 | .alen = 8, | ||
| 18263 | .input = "\x45\x00\x00\x30\xda\x3a\x00\x00" | ||
| 18264 | "\x80\x01\xdf\x3b\xc0\xa8\x00\x05" | ||
| 18265 | "\xc0\xa8\x00\x01\x08\x00\xc6\xcd" | ||
| 18266 | "\x02\x00\x07\x00\x61\x62\x63\x64" | ||
| 18267 | "\x65\x66\x67\x68\x69\x6a\x6b\x6c" | ||
| 18268 | "\x6d\x6e\x6f\x70\x71\x72\x73\x74" | ||
| 18269 | "\x01\x02\x02\x01\xf2\xa9\xa8\x36" | ||
| 18270 | "\xe1\x55\x10\x6a\xa8\xdc\xd6\x18" | ||
| 18271 | "\x00\x00\x00\x00", | ||
| 18272 | .ilen = 68, | ||
| 18273 | .novrfy = 1, | ||
| 18274 | .result = "\x45\x00\x00\x30\xda\x3a\x00\x00" | ||
| 18275 | "\x80\x01\xdf\x3b\xc0\xa8\x00\x05" | ||
| 18276 | "\xc0\xa8\x00\x01\x08\x00\xc6\xcd" | ||
| 18277 | "\x02\x00\x07\x00\x61\x62\x63\x64" | ||
| 18278 | "\x65\x66\x67\x68\x69\x6a\x6b\x6c" | ||
| 18279 | "\x6d\x6e\x6f\x70\x71\x72\x73\x74" | ||
| 18280 | "\x01\x02\x02\x01", | ||
| 18281 | .rlen = 52, | ||
| 18282 | }, | ||
| 18283 | }; | ||
| 18284 | |||
| 18196 | static struct aead_testvec aes_ccm_enc_tv_template[] = { | 18285 | static struct aead_testvec aes_ccm_enc_tv_template[] = { |
| 18197 | { /* From RFC 3610 */ | 18286 | { /* From RFC 3610 */ |
| 18198 | .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | 18287 | .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" |
