目录
Cipher MAC AES128
Cipher MAC AES192
Cipher MAC AES256
//分组密码算法的测试向量, 如CBC, CMAC等
typedef struct block_cipher_test_vector_st
{
char * inf; //测试向量的附加信息说明
int alg; //密码算法
int mod; //工作模式
int klen; //密钥字节长度
char * key; //密钥
int ivlen; // IV 字节长度
char * iv; // IV
int ptlen; //明文字节长度
char * pt; //明文
int ctlen; //密文字节长度
char * ct; //密文
int maclen; //MAC 字节长度
char * mac; //MAC
}BCTV;//分组密码算法的测试向量
Cipher MAC AES128
BCTV aes128mactv[] =
{
{/*测试向量0 */
/*inf*/ (char*)"NIST SP800-38B Example 1", AES128, CMAC,
/*Key*/ 16, (char*)"2b7e1516 28aed2a6 abf71588 09cf4f3c",
/*IV */ 0, (char*)NULL,
/*pt */ 0, (char*)NULL,
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"bb1d6929 e9593728 7fa37d12 9b756746",
},
{/*测试向量1 */
/*inf*/ (char*)"NIST SP800-38B Example 2", AES128, CMAC,
/*Key*/ 16, (char*)"2b7e1516 28aed2a6 abf71588 09cf4f3c",
/*IV */ 0, (char*)NULL,
/*pt */ 16, (char*)"6bc1bee2 2e409f96 e93d7e11 7393172a",
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"070a16b4 6b4d4144 f79bdd9d d04a287c",
},
{/*测试向量2 */
/*inf*/ (char*)"NIST SP800-38B Example 3", AES128, CMAC,
/*Key*/ 16, (char*)"2b7e1516 28aed2a6 abf71588 09cf4f3c",
/*IV */ 0, (char*)NULL,
/*pt */ 40, (char*)"6bc1bee2 2e409f96 e93d7e11 7393172a"
/* */ "ae2d8a57 1e03ac9c 9eb76fac 45af8e51"
/* */ "30c81c46 a35ce411",
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"dfa66747 de9ae630 30ca3261 1497c827",
},
{/*测试向量3 */
/*inf*/ (char*)"NIST SP800-38B Example 4", AES128, CMAC,
/*Key*/ 16, (char*)"2b7e1516 28aed2a6 abf71588 09cf4f3c",
/*IV */ 0, (char*)NULL,
/*pt */ 64, (char*)"6bc1bee2 2e409f96 e93d7e11 7393172a"
/* */ "ae2d8a57 1e03ac9c 9eb76fac 45af8e51"
/* */ "30c81c46 a35ce411 e5fbc119 1a0a52ef"
/* */ "f69f2445 df4f9b17 ad2b417b e66c3710",
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"51f0bebf 7e3b9d92 fc497417 79363cfe",
},
};
Cipher MAC AES192
BCTV aes192mactv[] =
{
{/*测试向量4 */
/*inf*/ (char*)"NIST SP800-38B Example 5", AES192, CMAC,
/*Key*/ 24, (char*)"8e73b0f7 da0e6452 c810f32b 809079e5 62f8ead2 522c6b7b",
/*IV */ 0, (char*)NULL,
/*pt */ 0, (char*)NULL,
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"d17ddf46 adaacde5 31cac483 de7a9367",
},
{/*测试向量5 */
/*inf*/ (char*)"NIST SP800-38B Example 6", AES192, CMAC,
/*Key*/ 24, (char*)"8e73b0f7 da0e6452 c810f32b 809079e5 62f8ead2 522c6b7b",
/*IV */ 0, (char*)NULL,
/*pt */ 16, (char*)"6bc1bee2 2e409f96 e93d7e11 7393172a",
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"9e99a7bf 31e71090 0662f65e 617c5184",
},
{/*测试向量6 */
/*inf*/ (char*)"NIST SP800-38B Example 7", AES192, CMAC,
/*Key*/ 24, (char*)"8e73b0f7 da0e6452 c810f32b 809079e5 62f8ead2 522c6b7b",
/*IV */ 0, (char*)NULL,
/*pt */ 40, (char*)"6bc1bee2 2e409f96 e93d7e11 7393172a"
/* */ "ae2d8a57 1e03ac9c 9eb76fac 45af8e51"
/* */ "30c81c46 a35ce411",
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"8a1de5be 2eb31aad 089a82e6 ee908b0e",
},
{/*测试向量7 */
/*inf*/ (char*)"NIST SP800-38B Example 8", AES192, CMAC,
/*Key*/ 24, (char*)"8e73b0f7 da0e6452 c810f32b 809079e5 62f8ead2 522c6b7b",
/*IV */ 0, (char*)NULL,
/*pt */ 64, (char*)"6bc1bee2 2e409f96 e93d7e11 7393172a"
/* */ "ae2d8a57 1e03ac9c 9eb76fac 45af8e51"
/* */ "30c81c46 a35ce411 e5fbc119 1a0a52ef"
/* */ "f69f2445 df4f9b17 ad2b417b e66c3710",
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"a1d5df0e ed790f79 4d775896 59f39a11",
},
};
Cipher MAC AES256
BCTV aes256mactv[] =
{
{/*测试向量8 */
/*inf*/ (char*)"NIST SP800-38B Example 9", AES256, CMAC,
/*Key*/ 32, (char*)"603deb10 15ca71be 2b73aef0 857d7781"
/* */ "1f352c07 3b6108d7 2d9810a3 0914dff4",
/*IV */ 0, (char*)NULL,
/*pt */ 0, (char*)NULL,
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"028962f6 1b7bf89e fc6b551f 4667d983",
},
{/*测试向量9 */
/*inf*/ (char*)"NIST SP800-38B Example 10", AES256, CMAC,
/*Key*/ 32, (char*)"603deb10 15ca71be 2b73aef0 857d7781"
/* */ "1f352c07 3b6108d7 2d9810a3 0914dff4",
/*IV */ 0, (char*)NULL,
/*pt */ 16, (char*)"6bc1bee2 2e409f96 e93d7e11 7393172a",
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"28a7023f 452e8f82 bd4bf28d 8c37c35c",
},
{/*测试向量10 */
/*inf*/ (char*)"NIST SP800-38B Example 11", AES256, CMAC,
/*Key*/ 32, (char*)"603deb10 15ca71be 2b73aef0 857d7781"
/* */ "1f352c07 3b6108d7 2d9810a3 0914dff4",
/*IV */ 0, (char*)NULL,
/*pt */ 40, (char*)"6bc1bee2 2e409f96 e93d7e11 7393172a"
/* */ "ae2d8a57 1e03ac9c 9eb76fac 45af8e51"
/* */ "30c81c46 a35ce411",
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"aaf3d8f1 de5640c2 32f5b169 b9c911e6",
},
{/*测试向量11 */
/*inf*/ (char*)"NIST SP800-38B Example 12", AES256, CMAC,
/*Key*/ 32, (char*)"603deb10 15ca71be 2b73aef0 857d7781"
/* */ "1f352c07 3b6108d7 2d9810a3 0914dff4",
/*IV */ 0, (char*)NULL,
/*pt */ 64, (char*)"6bc1bee2 2e409f96 e93d7e11 7393172a"
/* */ "ae2d8a57 1e03ac9c 9eb76fac 45af8e51"
/* */ "30c81c46 a35ce411 e5fbc119 1a0a52ef"
/* */ "f69f2445 df4f9b17 ad2b417b e66c3710",
/*ct */ 0, (char*)NULL,
/*mac*/ 16, (char*)"e1992190 549f6ed5 696a2c05 6c315410",
},
};