diff options
author | Joy Latten <latten@austin.ibm.com> | 2007-12-12 07:24:22 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-01-10 16:16:53 -0500 |
commit | 93cc74e078eed8735585e5687903727bcfbcc8b4 (patch) | |
tree | 6251899d3f904ab7a8498a23aed4086b5fb12261 | |
parent | 4a49b499dfa0c9e42be6d6fdd771f3434c776278 (diff) |
[CRYPTO] tcrypt: Add CCM vectors
This patch adds 7 test vectors to tcrypt for CCM.
The test vectors are from rfc 3610.
There are about 10 more test vectors in RFC 3610
and 4 or 5 more in NIST. I can add these as time permits.
I also needed to set authsize. CCM has a prerequisite of
authsize.
Signed-off-by: Joy Latten <latten@austin.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/tcrypt.c | 31 | ||||
-rw-r--r-- | crypto/tcrypt.h | 260 |
2 files changed, 289 insertions, 2 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 1142b4998c84..2b52df7bf833 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -266,8 +266,6 @@ static void test_aead(char *algo, int enc, struct aead_testvec *template, | |||
266 | return; | 266 | return; |
267 | } | 267 | } |
268 | 268 | ||
269 | authsize = crypto_aead_authsize(tfm); | ||
270 | |||
271 | req = aead_request_alloc(tfm, GFP_KERNEL); | 269 | req = aead_request_alloc(tfm, GFP_KERNEL); |
272 | if (!req) { | 270 | if (!req) { |
273 | printk(KERN_INFO "failed to allocate request for %s\n", algo); | 271 | printk(KERN_INFO "failed to allocate request for %s\n", algo); |
@@ -298,6 +296,15 @@ static void test_aead(char *algo, int enc, struct aead_testvec *template, | |||
298 | goto out; | 296 | goto out; |
299 | } | 297 | } |
300 | 298 | ||
299 | authsize = abs(aead_tv[i].rlen - aead_tv[i].ilen); | ||
300 | ret = crypto_aead_setauthsize(tfm, authsize); | ||
301 | if (ret) { | ||
302 | printk(KERN_INFO | ||
303 | "failed to set authsize = %u\n", | ||
304 | authsize); | ||
305 | goto out; | ||
306 | } | ||
307 | |||
301 | sg_init_one(&sg[0], aead_tv[i].input, | 308 | sg_init_one(&sg[0], aead_tv[i].input, |
302 | aead_tv[i].ilen + (enc ? authsize : 0)); | 309 | aead_tv[i].ilen + (enc ? authsize : 0)); |
303 | 310 | ||
@@ -374,6 +381,15 @@ static void test_aead(char *algo, int enc, struct aead_testvec *template, | |||
374 | aead_tv[i].tap[k]); | 381 | aead_tv[i].tap[k]); |
375 | } | 382 | } |
376 | 383 | ||
384 | authsize = abs(aead_tv[i].rlen - aead_tv[i].ilen); | ||
385 | ret = crypto_aead_setauthsize(tfm, authsize); | ||
386 | if (ret) { | ||
387 | printk(KERN_INFO | ||
388 | "failed to set authsize = %u\n", | ||
389 | authsize); | ||
390 | goto out; | ||
391 | } | ||
392 | |||
377 | if (enc) | 393 | if (enc) |
378 | sg[k - 1].length += authsize; | 394 | sg[k - 1].length += authsize; |
379 | 395 | ||
@@ -1201,6 +1217,10 @@ static void do_test(void) | |||
1201 | AES_GCM_ENC_TEST_VECTORS); | 1217 | AES_GCM_ENC_TEST_VECTORS); |
1202 | test_aead("gcm(aes)", DECRYPT, aes_gcm_dec_tv_template, | 1218 | test_aead("gcm(aes)", DECRYPT, aes_gcm_dec_tv_template, |
1203 | AES_GCM_DEC_TEST_VECTORS); | 1219 | AES_GCM_DEC_TEST_VECTORS); |
1220 | test_aead("ccm(aes)", ENCRYPT, aes_ccm_enc_tv_template, | ||
1221 | AES_CCM_ENC_TEST_VECTORS); | ||
1222 | test_aead("ccm(aes)", DECRYPT, aes_ccm_dec_tv_template, | ||
1223 | AES_CCM_DEC_TEST_VECTORS); | ||
1204 | 1224 | ||
1205 | //CAST5 | 1225 | //CAST5 |
1206 | test_cipher("ecb(cast5)", ENCRYPT, cast5_enc_tv_template, | 1226 | test_cipher("ecb(cast5)", ENCRYPT, cast5_enc_tv_template, |
@@ -1557,6 +1577,13 @@ static void do_test(void) | |||
1557 | LZO_COMP_TEST_VECTORS, LZO_DECOMP_TEST_VECTORS); | 1577 | LZO_COMP_TEST_VECTORS, LZO_DECOMP_TEST_VECTORS); |
1558 | break; | 1578 | break; |
1559 | 1579 | ||
1580 | case 37: | ||
1581 | test_aead("ccm(aes)", ENCRYPT, aes_ccm_enc_tv_template, | ||
1582 | AES_CCM_ENC_TEST_VECTORS); | ||
1583 | test_aead("ccm(aes)", DECRYPT, aes_ccm_dec_tv_template, | ||
1584 | AES_CCM_DEC_TEST_VECTORS); | ||
1585 | break; | ||
1586 | |||
1560 | case 100: | 1587 | case 100: |
1561 | test_hash("hmac(md5)", hmac_md5_tv_template, | 1588 | test_hash("hmac(md5)", hmac_md5_tv_template, |
1562 | HMAC_MD5_TEST_VECTORS); | 1589 | HMAC_MD5_TEST_VECTORS); |
diff --git a/crypto/tcrypt.h b/crypto/tcrypt.h index 5b865092151d..f785e5618e11 100644 --- a/crypto/tcrypt.h +++ b/crypto/tcrypt.h | |||
@@ -2313,6 +2313,8 @@ static struct cipher_testvec cast6_dec_tv_template[] = { | |||
2313 | #define AES_CTR_DEC_TEST_VECTORS 6 | 2313 | #define AES_CTR_DEC_TEST_VECTORS 6 |
2314 | #define AES_GCM_ENC_TEST_VECTORS 9 | 2314 | #define AES_GCM_ENC_TEST_VECTORS 9 |
2315 | #define AES_GCM_DEC_TEST_VECTORS 8 | 2315 | #define AES_GCM_DEC_TEST_VECTORS 8 |
2316 | #define AES_CCM_ENC_TEST_VECTORS 7 | ||
2317 | #define AES_CCM_DEC_TEST_VECTORS 7 | ||
2316 | 2318 | ||
2317 | static struct cipher_testvec aes_enc_tv_template[] = { | 2319 | static struct cipher_testvec aes_enc_tv_template[] = { |
2318 | { /* From FIPS-197 */ | 2320 | { /* From FIPS-197 */ |
@@ -5028,6 +5030,264 @@ static struct aead_testvec aes_gcm_dec_tv_template[] = { | |||
5028 | } | 5030 | } |
5029 | }; | 5031 | }; |
5030 | 5032 | ||
5033 | static struct aead_testvec aes_ccm_enc_tv_template[] = { | ||
5034 | { /* From RFC 3610 */ | ||
5035 | .key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
5036 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf }, | ||
5037 | .klen = 16, | ||
5038 | .iv = { 0x01, 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, | ||
5039 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00 }, | ||
5040 | .assoc = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }, | ||
5041 | .alen = 8, | ||
5042 | .input = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | ||
5043 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, | ||
5044 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e }, | ||
5045 | .ilen = 23, | ||
5046 | .result = { 0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2, | ||
5047 | 0xf0, 0x66, 0xd0, 0xc2, 0xc0, 0xf9, 0x89, 0x80, | ||
5048 | 0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84, 0x17, | ||
5049 | 0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0 }, | ||
5050 | .rlen = 31, | ||
5051 | }, { | ||
5052 | .key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
5053 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf }, | ||
5054 | .klen = 16, | ||
5055 | .iv = { 0x01, 0x00, 0x00, 0x00, 0x07, 0x06, 0x05, 0x04, | ||
5056 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00 }, | ||
5057 | .assoc = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | ||
5058 | 0x08, 0x09, 0x0a, 0x0b }, | ||
5059 | .alen = 12, | ||
5060 | .input = { 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, | ||
5061 | 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, | ||
5062 | 0x1c, 0x1d, 0x1e, 0x1f }, | ||
5063 | .ilen = 20, | ||
5064 | .result = { 0xdc, 0xf1, 0xfb, 0x7b, 0x5d, 0x9e, 0x23, 0xfb, | ||
5065 | 0x9d, 0x4e, 0x13, 0x12, 0x53, 0x65, 0x8a, 0xd8, | ||
5066 | 0x6e, 0xbd, 0xca, 0x3e, 0x51, 0xe8, 0x3f, 0x07, | ||
5067 | 0x7d, 0x9c, 0x2d, 0x93 }, | ||
5068 | .rlen = 28, | ||
5069 | }, { | ||
5070 | .key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
5071 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf }, | ||
5072 | .klen = 16, | ||
5073 | .iv = { 0x01, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x09, 0x08, | ||
5074 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00 }, | ||
5075 | .assoc = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }, | ||
5076 | .alen = 8, | ||
5077 | .input = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | ||
5078 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, | ||
5079 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | ||
5080 | 0x20 }, | ||
5081 | .ilen = 25, | ||
5082 | .result = { 0x82, 0x53, 0x1a, 0x60, 0xcc, 0x24, 0x94, 0x5a, | ||
5083 | 0x4b, 0x82, 0x79, 0x18, 0x1a, 0xb5, 0xc8, 0x4d, | ||
5084 | 0xf2, 0x1c, 0xe7, 0xf9, 0xb7, 0x3f, 0x42, 0xe1, | ||
5085 | 0x97, 0xea, 0x9c, 0x07, 0xe5, 0x6b, 0x5e, 0xb1, | ||
5086 | 0x7e, 0x5f, 0x4e }, | ||
5087 | .rlen = 35, | ||
5088 | }, { | ||
5089 | .key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
5090 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf }, | ||
5091 | .klen = 16, | ||
5092 | .iv = { 0x01, 0x00, 0x00, 0x00, 0x0c, 0x0b, 0x0a, 0x09, | ||
5093 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00 }, | ||
5094 | .assoc = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | ||
5095 | 0x08, 0x09, 0x0a, 0x0b }, | ||
5096 | .alen = 12, | ||
5097 | .input = { 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, | ||
5098 | 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, | ||
5099 | 0x1c, 0x1d, 0x1e }, | ||
5100 | .ilen = 19, | ||
5101 | .result = { 0x07, 0x34, 0x25, 0x94, 0x15, 0x77, 0x85, 0x15, | ||
5102 | 0x2b, 0x07, 0x40, 0x98, 0x33, 0x0a, 0xbb, 0x14, | ||
5103 | 0x1b, 0x94, 0x7b, 0x56, 0x6a, 0xa9, 0x40, 0x6b, | ||
5104 | 0x4d, 0x99, 0x99, 0x88, 0xdd }, | ||
5105 | .rlen = 29, | ||
5106 | }, { | ||
5107 | .key = { 0xd7, 0x82, 0x8d, 0x13, 0xb2, 0xb0, 0xbd, 0xc3, | ||
5108 | 0x25, 0xa7, 0x62, 0x36, 0xdf, 0x93, 0xcc, 0x6b }, | ||
5109 | .klen = 16, | ||
5110 | .iv = { 0x01, 0x00, 0x33, 0x56, 0x8e, 0xf7, 0xb2, 0x63, | ||
5111 | 0x3c, 0x96, 0x96, 0x76, 0x6c, 0xfa, 0x00, 0x00 }, | ||
5112 | .assoc = { 0x63, 0x01, 0x8f, 0x76, 0xdc, 0x8a, 0x1b, 0xcb }, | ||
5113 | .alen = 8, | ||
5114 | .input = { 0x90, 0x20, 0xea, 0x6f, 0x91, 0xbd, 0xd8, 0x5a, | ||
5115 | 0xfa, 0x00, 0x39, 0xba, 0x4b, 0xaf, 0xf9, 0xbf, | ||
5116 | 0xb7, 0x9c, 0x70, 0x28, 0x94, 0x9c, 0xd0, 0xec }, | ||
5117 | .ilen = 24, | ||
5118 | .result = { 0x4c, 0xcb, 0x1e, 0x7c, 0xa9, 0x81, 0xbe, 0xfa, | ||
5119 | 0xa0, 0x72, 0x6c, 0x55, 0xd3, 0x78, 0x06, 0x12, | ||
5120 | 0x98, 0xc8, 0x5c, 0x92, 0x81, 0x4a, 0xbc, 0x33, | ||
5121 | 0xc5, 0x2e, 0xe8, 0x1d, 0x7d, 0x77, 0xc0, 0x8a }, | ||
5122 | .rlen = 32, | ||
5123 | }, { | ||
5124 | .key = { 0xd7, 0x82, 0x8d, 0x13, 0xb2, 0xb0, 0xbd, 0xc3, | ||
5125 | 0x25, 0xa7, 0x62, 0x36, 0xdf, 0x93, 0xcc, 0x6b }, | ||
5126 | .klen = 16, | ||
5127 | .iv = { 0x01, 0x00, 0xd5, 0x60, 0x91, 0x2d, 0x3f, 0x70, | ||
5128 | 0x3c, 0x96, 0x96, 0x76, 0x6c, 0xfa, 0x00, 0x00 }, | ||
5129 | .assoc = { 0xcd, 0x90, 0x44, 0xd2, 0xb7, 0x1f, 0xdb, 0x81, | ||
5130 | 0x20, 0xea, 0x60, 0xc0 }, | ||
5131 | .alen = 12, | ||
5132 | .input = { 0x64, 0x35, 0xac, 0xba, 0xfb, 0x11, 0xa8, 0x2e, | ||
5133 | 0x2f, 0x07, 0x1d, 0x7c, 0xa4, 0xa5, 0xeb, 0xd9, | ||
5134 | 0x3a, 0x80, 0x3b, 0xa8, 0x7f }, | ||
5135 | .ilen = 21, | ||
5136 | .result = { 0x00, 0x97, 0x69, 0xec, 0xab, 0xdf, 0x48, 0x62, | ||
5137 | 0x55, 0x94, 0xc5, 0x92, 0x51, 0xe6, 0x03, 0x57, | ||
5138 | 0x22, 0x67, 0x5e, 0x04, 0xc8, 0x47, 0x09, 0x9e, | ||
5139 | 0x5a, 0xe0, 0x70, 0x45, 0x51 }, | ||
5140 | .rlen = 29, | ||
5141 | }, { | ||
5142 | .key = { 0xd7, 0x82, 0x8d, 0x13, 0xb2, 0xb0, 0xbd, 0xc3, | ||
5143 | 0x25, 0xa7, 0x62, 0x36, 0xdf, 0x93, 0xcc, 0x6b }, | ||
5144 | .klen = 16, | ||
5145 | .iv = { 0x01, 0x00, 0x42, 0xff, 0xf8, 0xf1, 0x95, 0x1c, | ||
5146 | 0x3c, 0x96, 0x96, 0x76, 0x6c, 0xfa, 0x00, 0x00 }, | ||
5147 | .assoc = { 0xd8, 0x5b, 0xc7, 0xe6, 0x9f, 0x94, 0x4f, 0xb8 }, | ||
5148 | .alen = 8, | ||
5149 | .input = { 0x8a, 0x19, 0xb9, 0x50, 0xbc, 0xf7, 0x1a, 0x01, | ||
5150 | 0x8e, 0x5e, 0x67, 0x01, 0xc9, 0x17, 0x87, 0x65, | ||
5151 | 0x98, 0x09, 0xd6, 0x7d, 0xbe, 0xdd, 0x18 }, | ||
5152 | .ilen = 23, | ||
5153 | .result = { 0xbc, 0x21, 0x8d, 0xaa, 0x94, 0x74, 0x27, 0xb6, | ||
5154 | 0xdb, 0x38, 0x6a, 0x99, 0xac, 0x1a, 0xef, 0x23, | ||
5155 | 0xad, 0xe0, 0xb5, 0x29, 0x39, 0xcb, 0x6a, 0x63, | ||
5156 | 0x7c, 0xf9, 0xbe, 0xc2, 0x40, 0x88, 0x97, 0xc6, | ||
5157 | 0xba }, | ||
5158 | .rlen = 33, | ||
5159 | }, | ||
5160 | }; | ||
5161 | |||
5162 | static struct aead_testvec aes_ccm_dec_tv_template[] = { | ||
5163 | { /* From RFC 3610 */ | ||
5164 | .key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
5165 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf }, | ||
5166 | .klen = 16, | ||
5167 | .iv = { 0x01, 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, | ||
5168 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00 }, | ||
5169 | .assoc = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }, | ||
5170 | .alen = 8, | ||
5171 | .input = { 0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2, | ||
5172 | 0xf0, 0x66, 0xd0, 0xc2, 0xc0, 0xf9, 0x89, 0x80, | ||
5173 | 0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84, 0x17, | ||
5174 | 0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0 }, | ||
5175 | .ilen = 31, | ||
5176 | .result = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | ||
5177 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, | ||
5178 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e }, | ||
5179 | .rlen = 23, | ||
5180 | }, { | ||
5181 | .key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
5182 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf }, | ||
5183 | .klen = 16, | ||
5184 | .iv = { 0x01, 0x00, 0x00, 0x00, 0x07, 0x06, 0x05, 0x04, | ||
5185 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00 }, | ||
5186 | .assoc = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | ||
5187 | 0x08, 0x09, 0x0a, 0x0b }, | ||
5188 | .alen = 12, | ||
5189 | .input = { 0xdc, 0xf1, 0xfb, 0x7b, 0x5d, 0x9e, 0x23, 0xfb, | ||
5190 | 0x9d, 0x4e, 0x13, 0x12, 0x53, 0x65, 0x8a, 0xd8, | ||
5191 | 0x6e, 0xbd, 0xca, 0x3e, 0x51, 0xe8, 0x3f, 0x07, | ||
5192 | 0x7d, 0x9c, 0x2d, 0x93 }, | ||
5193 | .ilen = 28, | ||
5194 | .result = { 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, | ||
5195 | 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, | ||
5196 | 0x1c, 0x1d, 0x1e, 0x1f }, | ||
5197 | .rlen = 20, | ||
5198 | }, { | ||
5199 | .key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
5200 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf }, | ||
5201 | .klen = 16, | ||
5202 | .iv = { 0x01, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x09, 0x08, | ||
5203 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00 }, | ||
5204 | .assoc = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }, | ||
5205 | .alen = 8, | ||
5206 | .input = { 0x82, 0x53, 0x1a, 0x60, 0xcc, 0x24, 0x94, 0x5a, | ||
5207 | 0x4b, 0x82, 0x79, 0x18, 0x1a, 0xb5, 0xc8, 0x4d, | ||
5208 | 0xf2, 0x1c, 0xe7, 0xf9, 0xb7, 0x3f, 0x42, 0xe1, | ||
5209 | 0x97, 0xea, 0x9c, 0x07, 0xe5, 0x6b, 0x5e, 0xb1, | ||
5210 | 0x7e, 0x5f, 0x4e }, | ||
5211 | .ilen = 35, | ||
5212 | .result = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | ||
5213 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, | ||
5214 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | ||
5215 | 0x20 }, | ||
5216 | .rlen = 25, | ||
5217 | }, { | ||
5218 | .key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
5219 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf }, | ||
5220 | .klen = 16, | ||
5221 | .iv = { 0x01, 0x00, 0x00, 0x00, 0x0c, 0x0b, 0x0a, 0x09, | ||
5222 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00 }, | ||
5223 | .assoc = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | ||
5224 | 0x08, 0x09, 0x0a, 0x0b }, | ||
5225 | .alen = 12, | ||
5226 | .input = { 0x07, 0x34, 0x25, 0x94, 0x15, 0x77, 0x85, 0x15, | ||
5227 | 0x2b, 0x07, 0x40, 0x98, 0x33, 0x0a, 0xbb, 0x14, | ||
5228 | 0x1b, 0x94, 0x7b, 0x56, 0x6a, 0xa9, 0x40, 0x6b, | ||
5229 | 0x4d, 0x99, 0x99, 0x88, 0xdd }, | ||
5230 | .ilen = 29, | ||
5231 | .result = { 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, | ||
5232 | 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, | ||
5233 | 0x1c, 0x1d, 0x1e }, | ||
5234 | .rlen = 19, | ||
5235 | }, { | ||
5236 | .key = { 0xd7, 0x82, 0x8d, 0x13, 0xb2, 0xb0, 0xbd, 0xc3, | ||
5237 | 0x25, 0xa7, 0x62, 0x36, 0xdf, 0x93, 0xcc, 0x6b }, | ||
5238 | .klen = 16, | ||
5239 | .iv = { 0x01, 0x00, 0x33, 0x56, 0x8e, 0xf7, 0xb2, 0x63, | ||
5240 | 0x3c, 0x96, 0x96, 0x76, 0x6c, 0xfa, 0x00, 0x00 }, | ||
5241 | .assoc = { 0x63, 0x01, 0x8f, 0x76, 0xdc, 0x8a, 0x1b, 0xcb }, | ||
5242 | .alen = 8, | ||
5243 | .input = { 0x4c, 0xcb, 0x1e, 0x7c, 0xa9, 0x81, 0xbe, 0xfa, | ||
5244 | 0xa0, 0x72, 0x6c, 0x55, 0xd3, 0x78, 0x06, 0x12, | ||
5245 | 0x98, 0xc8, 0x5c, 0x92, 0x81, 0x4a, 0xbc, 0x33, | ||
5246 | 0xc5, 0x2e, 0xe8, 0x1d, 0x7d, 0x77, 0xc0, 0x8a }, | ||
5247 | .ilen = 32, | ||
5248 | .result = { 0x90, 0x20, 0xea, 0x6f, 0x91, 0xbd, 0xd8, 0x5a, | ||
5249 | 0xfa, 0x00, 0x39, 0xba, 0x4b, 0xaf, 0xf9, 0xbf, | ||
5250 | 0xb7, 0x9c, 0x70, 0x28, 0x94, 0x9c, 0xd0, 0xec }, | ||
5251 | .rlen = 24, | ||
5252 | }, { | ||
5253 | .key = { 0xd7, 0x82, 0x8d, 0x13, 0xb2, 0xb0, 0xbd, 0xc3, | ||
5254 | 0x25, 0xa7, 0x62, 0x36, 0xdf, 0x93, 0xcc, 0x6b }, | ||
5255 | .klen = 16, | ||
5256 | .iv = { 0x01, 0x00, 0xd5, 0x60, 0x91, 0x2d, 0x3f, 0x70, | ||
5257 | 0x3c, 0x96, 0x96, 0x76, 0x6c, 0xfa, 0x00, 0x00 }, | ||
5258 | .assoc = { 0xcd, 0x90, 0x44, 0xd2, 0xb7, 0x1f, 0xdb, 0x81, | ||
5259 | 0x20, 0xea, 0x60, 0xc0 }, | ||
5260 | .alen = 12, | ||
5261 | .input = { 0x00, 0x97, 0x69, 0xec, 0xab, 0xdf, 0x48, 0x62, | ||
5262 | 0x55, 0x94, 0xc5, 0x92, 0x51, 0xe6, 0x03, 0x57, | ||
5263 | 0x22, 0x67, 0x5e, 0x04, 0xc8, 0x47, 0x09, 0x9e, | ||
5264 | 0x5a, 0xe0, 0x70, 0x45, 0x51 }, | ||
5265 | .ilen = 29, | ||
5266 | .result = { 0x64, 0x35, 0xac, 0xba, 0xfb, 0x11, 0xa8, 0x2e, | ||
5267 | 0x2f, 0x07, 0x1d, 0x7c, 0xa4, 0xa5, 0xeb, 0xd9, | ||
5268 | 0x3a, 0x80, 0x3b, 0xa8, 0x7f }, | ||
5269 | .rlen = 21, | ||
5270 | }, { | ||
5271 | .key = { 0xd7, 0x82, 0x8d, 0x13, 0xb2, 0xb0, 0xbd, 0xc3, | ||
5272 | 0x25, 0xa7, 0x62, 0x36, 0xdf, 0x93, 0xcc, 0x6b }, | ||
5273 | .klen = 16, | ||
5274 | .iv = { 0x01, 0x00, 0x42, 0xff, 0xf8, 0xf1, 0x95, 0x1c, | ||
5275 | 0x3c, 0x96, 0x96, 0x76, 0x6c, 0xfa, 0x00, 0x00 }, | ||
5276 | .assoc = { 0xd8, 0x5b, 0xc7, 0xe6, 0x9f, 0x94, 0x4f, 0xb8 }, | ||
5277 | .alen = 8, | ||
5278 | .input = { 0xbc, 0x21, 0x8d, 0xaa, 0x94, 0x74, 0x27, 0xb6, | ||
5279 | 0xdb, 0x38, 0x6a, 0x99, 0xac, 0x1a, 0xef, 0x23, | ||
5280 | 0xad, 0xe0, 0xb5, 0x29, 0x39, 0xcb, 0x6a, 0x63, | ||
5281 | 0x7c, 0xf9, 0xbe, 0xc2, 0x40, 0x88, 0x97, 0xc6, | ||
5282 | 0xba }, | ||
5283 | .ilen = 33, | ||
5284 | .result = { 0x8a, 0x19, 0xb9, 0x50, 0xbc, 0xf7, 0x1a, 0x01, | ||
5285 | 0x8e, 0x5e, 0x67, 0x01, 0xc9, 0x17, 0x87, 0x65, | ||
5286 | 0x98, 0x09, 0xd6, 0x7d, 0xbe, 0xdd, 0x18 }, | ||
5287 | .rlen = 23, | ||
5288 | }, | ||
5289 | }; | ||
5290 | |||
5031 | /* Cast5 test vectors from RFC 2144 */ | 5291 | /* Cast5 test vectors from RFC 2144 */ |
5032 | #define CAST5_ENC_TEST_VECTORS 3 | 5292 | #define CAST5_ENC_TEST_VECTORS 3 |
5033 | #define CAST5_DEC_TEST_VECTORS 3 | 5293 | #define CAST5_DEC_TEST_VECTORS 3 |