aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorAndrew Donofrio <linuxbugzilla@kriptik.org>2006-12-09 20:10:20 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2007-02-06 17:20:58 -0500
commita28091ae170cd06695bf461905c5b97a165633ba (patch)
tree803dc9a817188d82c33c14b338da6a531ba30299 /crypto
parentfb469840b8c34b2f95b40a64b271f245cc1075b7 (diff)
[CRYPTO] tcrypt: Added test vectors for sha384/sha512
This patch adds tests for SHA384 HMAC and SHA512 HMAC to the tcrypt module. Test data was taken from RFC4231. This patch is a follow-up to the discovery (bug 7646) that the kernel SHA384 HMAC implementation was not generating proper SHA384 HMACs. Signed-off-by: Andrew Donofrio <linuxbugzilla@kriptik.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/tcrypt.c15
-rw-r--r--crypto/tcrypt.h245
2 files changed, 259 insertions, 1 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index d671e8942b1f..ff489423b2cf 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -12,6 +12,7 @@
12 * Software Foundation; either version 2 of the License, or (at your option) 12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version. 13 * any later version.
14 * 14 *
15 * 2006-12-07 Added SHA384 HMAC and SHA512 HMAC tests
15 * 2004-08-09 Added cipher speed tests (Reyk Floeter <reyk@vantronix.net>) 16 * 2004-08-09 Added cipher speed tests (Reyk Floeter <reyk@vantronix.net>)
16 * 2003-09-14 Rewritten by Kartikey Mahendra Bhatt 17 * 2003-09-14 Rewritten by Kartikey Mahendra Bhatt
17 * 18 *
@@ -980,6 +981,10 @@ static void do_test(void)
980 HMAC_SHA1_TEST_VECTORS); 981 HMAC_SHA1_TEST_VECTORS);
981 test_hash("hmac(sha256)", hmac_sha256_tv_template, 982 test_hash("hmac(sha256)", hmac_sha256_tv_template,
982 HMAC_SHA256_TEST_VECTORS); 983 HMAC_SHA256_TEST_VECTORS);
984 test_hash("hmac(sha384)", hmac_sha384_tv_template,
985 HMAC_SHA384_TEST_VECTORS);
986 test_hash("hmac(sha512)", hmac_sha512_tv_template,
987 HMAC_SHA512_TEST_VECTORS);
983 988
984 test_hash("xcbc(aes)", aes_xcbc128_tv_template, 989 test_hash("xcbc(aes)", aes_xcbc128_tv_template,
985 XCBC_AES_TEST_VECTORS); 990 XCBC_AES_TEST_VECTORS);
@@ -1192,6 +1197,16 @@ static void do_test(void)
1192 HMAC_SHA256_TEST_VECTORS); 1197 HMAC_SHA256_TEST_VECTORS);
1193 break; 1198 break;
1194 1199
1200 case 103:
1201 test_hash("hmac(sha384)", hmac_sha384_tv_template,
1202 HMAC_SHA384_TEST_VECTORS);
1203 break;
1204
1205 case 104:
1206 test_hash("hmac(sha512)", hmac_sha512_tv_template,
1207 HMAC_SHA512_TEST_VECTORS);
1208 break;
1209
1195 1210
1196 case 200: 1211 case 200:
1197 test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, 1212 test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0,
diff --git a/crypto/tcrypt.h b/crypto/tcrypt.h
index 48a81362cb85..6c7b7a1e73f4 100644
--- a/crypto/tcrypt.h
+++ b/crypto/tcrypt.h
@@ -12,6 +12,7 @@
12 * Software Foundation; either version 2 of the License, or (at your option) 12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version. 13 * any later version.
14 * 14 *
15 * 2006-12-07 Added SHA384 HMAC and SHA512 HMAC tests
15 * 2004-08-09 Cipher speed tests by Reyk Floeter <reyk@vantronix.net> 16 * 2004-08-09 Cipher speed tests by Reyk Floeter <reyk@vantronix.net>
16 * 2003-09-14 Changes by Kartikey Mahendra Bhatt 17 * 2003-09-14 Changes by Kartikey Mahendra Bhatt
17 * 18 *
@@ -27,7 +28,7 @@
27 28
28struct hash_testvec { 29struct hash_testvec {
29 /* only used with keyed hash algorithms */ 30 /* only used with keyed hash algorithms */
30 char key[128] __attribute__ ((__aligned__(4))); 31 char key[132] __attribute__ ((__aligned__(4)));
31 char plaintext[240]; 32 char plaintext[240];
32 char digest[MAX_DIGEST_SIZE]; 33 char digest[MAX_DIGEST_SIZE];
33 unsigned char tap[MAX_TAP]; 34 unsigned char tap[MAX_TAP];
@@ -1002,6 +1003,248 @@ static struct hash_testvec aes_xcbc128_tv_template[] = {
1002}; 1003};
1003 1004
1004/* 1005/*
1006 * SHA384 HMAC test vectors from RFC4231
1007 */
1008
1009#define HMAC_SHA384_TEST_VECTORS 4
1010
1011static struct hash_testvec hmac_sha384_tv_template[] = {
1012 {
1013 .key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
1014 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
1015 0x0b, 0x0b, 0x0b, 0x0b }, // (20 bytes)
1016 .ksize = 20,
1017 .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 }, // ("Hi There")
1018 .psize = 8,
1019 .digest = { 0xaf, 0xd0, 0x39, 0x44, 0xd8, 0x48, 0x95, 0x62,
1020 0x6b, 0x08, 0x25, 0xf4, 0xab, 0x46, 0x90, 0x7f,
1021 0x15, 0xf9, 0xda, 0xdb, 0xe4, 0x10, 0x1e, 0xc6,
1022 0x82, 0xaa, 0x03, 0x4c, 0x7c, 0xeb, 0xc5, 0x9c,
1023 0xfa, 0xea, 0x9e, 0xa9, 0x07, 0x6e, 0xde, 0x7f,
1024 0x4a, 0xf1, 0x52, 0xe8, 0xb2, 0xfa, 0x9c, 0xb6 },
1025 }, {
1026 .key = { 0x4a, 0x65, 0x66, 0x65 }, // ("Jefe")
1027 .ksize = 4,
1028 .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
1029 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, // ("what do ya want ")
1030 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
1031 0x69, 0x6e, 0x67, 0x3f }, // ("for nothing?")
1032 .psize = 28,
1033 .digest = { 0xaf, 0x45, 0xd2, 0xe3, 0x76, 0x48, 0x40, 0x31,
1034 0x61, 0x7f, 0x78, 0xd2, 0xb5, 0x8a, 0x6b, 0x1b,
1035 0x9c, 0x7e, 0xf4, 0x64, 0xf5, 0xa0, 0x1b, 0x47,
1036 0xe4, 0x2e, 0xc3, 0x73, 0x63, 0x22, 0x44, 0x5e,
1037 0x8e, 0x22, 0x40, 0xca, 0x5e, 0x69, 0xe2, 0xc7,
1038 0x8b, 0x32, 0x39, 0xec, 0xfa, 0xb2, 0x16, 0x49 },
1039 .np = 4,
1040 .tap = { 7, 7, 7, 7 }
1041 }, {
1042 .key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1043 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1044 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1045 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1046 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1047 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1048 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1049 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1050 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1051 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1052 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1053 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1054 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1055 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1056 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1057 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1058 0xaa, 0xaa, 0xaa }, // (131 bytes)
1059 .ksize = 131,
1060 .plaintext = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x55, 0x73, 0x69,
1061 0x6e, 0x67, 0x20, 0x4c, 0x61, 0x72, 0x67, 0x65, // ("Test Using Large")
1062 0x72, 0x20, 0x54, 0x68, 0x61, 0x6e, 0x20, 0x42,
1063 0x6c, 0x6f, 0x63, 0x6b, 0x2d, 0x53, 0x69, 0x7a, // ("r Than Block-Siz")
1064 0x65, 0x20, 0x4b, 0x65, 0x79, 0x20, 0x2d, 0x20,
1065 0x48, 0x61, 0x73, 0x68, 0x20, 0x4b, 0x65, 0x79, // ("e Key - Hash Key")
1066 0x20, 0x46, 0x69, 0x72, 0x73, 0x74 }, // (" First")
1067 .psize = 54,
1068 .digest = { 0x4e, 0xce, 0x08, 0x44, 0x85, 0x81, 0x3e, 0x90,
1069 0x88, 0xd2, 0xc6, 0x3a, 0x04, 0x1b, 0xc5, 0xb4,
1070 0x4f, 0x9e, 0xf1, 0x01, 0x2a, 0x2b, 0x58, 0x8f,
1071 0x3c, 0xd1, 0x1f, 0x05, 0x03, 0x3a, 0xc4, 0xc6,
1072 0x0c, 0x2e, 0xf6, 0xab, 0x40, 0x30, 0xfe, 0x82,
1073 0x96, 0x24, 0x8d, 0xf1, 0x63, 0xf4, 0x49, 0x52 },
1074 }, {
1075 .key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1076 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1077 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1078 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1079 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1080 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1081 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1082 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1083 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1084 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1085 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1086 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1087 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1088 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1089 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1090 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1091 0xaa, 0xaa, 0xaa }, // (131 bytes)
1092 .ksize = 131,
1093 .plaintext = { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
1094 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x75, // ("This is a test u")
1095 0x73, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x6c,
1096 0x61, 0x72, 0x67, 0x65, 0x72, 0x20, 0x74, 0x68, // ("sing a larger th")
1097 0x61, 0x6e, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
1098 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x6b, 0x65, // ("an block-size ke")
1099 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x20,
1100 0x6c, 0x61, 0x72, 0x67, 0x65, 0x72, 0x20, 0x74, // ("y and a larger t")
1101 0x68, 0x61, 0x6e, 0x20, 0x62, 0x6c, 0x6f, 0x63,
1102 0x6b, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x64, // ("han block-size d")
1103 0x61, 0x74, 0x61, 0x2e, 0x20, 0x54, 0x68, 0x65,
1104 0x20, 0x6b, 0x65, 0x79, 0x20, 0x6e, 0x65, 0x65, // ("ata. The key nee")
1105 0x64, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65,
1106 0x20, 0x68, 0x61, 0x73, 0x68, 0x65, 0x64, 0x20, // ("ds to be hashed ")
1107 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x62,
1108 0x65, 0x69, 0x6e, 0x67, 0x20, 0x75, 0x73, 0x65, // ("before being use")
1109 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65,
1110 0x20, 0x48, 0x4d, 0x41, 0x43, 0x20, 0x61, 0x6c, // ("d by the HMAC al")
1111 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x2e }, // ("gorithm.")
1112 .psize = 152,
1113 .digest = { 0x66, 0x17, 0x17, 0x8e, 0x94, 0x1f, 0x02, 0x0d,
1114 0x35, 0x1e, 0x2f, 0x25, 0x4e, 0x8f, 0xd3, 0x2c,
1115 0x60, 0x24, 0x20, 0xfe, 0xb0, 0xb8, 0xfb, 0x9a,
1116 0xdc, 0xce, 0xbb, 0x82, 0x46, 0x1e, 0x99, 0xc5,
1117 0xa6, 0x78, 0xcc, 0x31, 0xe7, 0x99, 0x17, 0x6d,
1118 0x38, 0x60, 0xe6, 0x11, 0x0c, 0x46, 0x52, 0x3e },
1119 },
1120};
1121
1122/*
1123 * SHA512 HMAC test vectors from RFC4231
1124 */
1125
1126#define HMAC_SHA512_TEST_VECTORS 4
1127
1128static struct hash_testvec hmac_sha512_tv_template[] = {
1129 {
1130 .key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
1131 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
1132 0x0b, 0x0b, 0x0b, 0x0b }, // (20 bytes)
1133 .ksize = 20,
1134 .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 }, // ("Hi There")
1135 .psize = 8,
1136 .digest = { 0x87, 0xaa, 0x7c, 0xde, 0xa5, 0xef, 0x61, 0x9d,
1137 0x4f, 0xf0, 0xb4, 0x24, 0x1a, 0x1d, 0x6c, 0xb0,
1138 0x23, 0x79, 0xf4, 0xe2, 0xce, 0x4e, 0xc2, 0x78,
1139 0x7a, 0xd0, 0xb3, 0x05, 0x45, 0xe1, 0x7c, 0xde,
1140 0xda, 0xa8, 0x33, 0xb7, 0xd6, 0xb8, 0xa7, 0x02,
1141 0x03, 0x8b, 0x27, 0x4e, 0xae, 0xa3, 0xf4, 0xe4,
1142 0xbe, 0x9d, 0x91, 0x4e, 0xeb, 0x61, 0xf1, 0x70,
1143 0x2e, 0x69, 0x6c, 0x20, 0x3a, 0x12, 0x68, 0x54 },
1144 }, {
1145 .key = { 0x4a, 0x65, 0x66, 0x65 }, // ("Jefe")
1146 .ksize = 4,
1147 .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
1148 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, // ("what do ya want ")
1149 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
1150 0x69, 0x6e, 0x67, 0x3f }, // ("for nothing?")
1151 .psize = 28,
1152 .digest = { 0x16, 0x4b, 0x7a, 0x7b, 0xfc, 0xf8, 0x19, 0xe2,
1153 0xe3, 0x95, 0xfb, 0xe7, 0x3b, 0x56, 0xe0, 0xa3,
1154 0x87, 0xbd, 0x64, 0x22, 0x2e, 0x83, 0x1f, 0xd6,
1155 0x10, 0x27, 0x0c, 0xd7, 0xea, 0x25, 0x05, 0x54,
1156 0x97, 0x58, 0xbf, 0x75, 0xc0, 0x5a, 0x99, 0x4a,
1157 0x6d, 0x03, 0x4f, 0x65, 0xf8, 0xf0, 0xe6, 0xfd,
1158 0xca, 0xea, 0xb1, 0xa3, 0x4d, 0x4a, 0x6b, 0x4b,
1159 0x63, 0x6e, 0x07, 0x0a, 0x38, 0xbc, 0xe7, 0x37 },
1160 .np = 4,
1161 .tap = { 7, 7, 7, 7 }
1162 }, {
1163 .key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1164 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1165 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1166 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1167 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1168 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1169 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1170 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1171 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1172 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1173 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1174 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1175 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1176 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1177 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1178 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1179 0xaa, 0xaa, 0xaa }, // (131 bytes)
1180 .ksize = 131,
1181 .plaintext = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x55, 0x73, 0x69,
1182 0x6e, 0x67, 0x20, 0x4c, 0x61, 0x72, 0x67, 0x65, // ("Test Using Large")
1183 0x72, 0x20, 0x54, 0x68, 0x61, 0x6e, 0x20, 0x42,
1184 0x6c, 0x6f, 0x63, 0x6b, 0x2d, 0x53, 0x69, 0x7a, // ("r Than Block-Siz")
1185 0x65, 0x20, 0x4b, 0x65, 0x79, 0x20, 0x2d, 0x20,
1186 0x48, 0x61, 0x73, 0x68, 0x20, 0x4b, 0x65, 0x79, // ("e Key - Hash Key")
1187 0x20, 0x46, 0x69, 0x72, 0x73, 0x74 }, // (" First")
1188 .psize = 54,
1189 .digest = { 0x80, 0xb2, 0x42, 0x63, 0xc7, 0xc1, 0xa3, 0xeb,
1190 0xb7, 0x14, 0x93, 0xc1, 0xdd, 0x7b, 0xe8, 0xb4,
1191 0x9b, 0x46, 0xd1, 0xf4, 0x1b, 0x4a, 0xee, 0xc1,
1192 0x12, 0x1b, 0x01, 0x37, 0x83, 0xf8, 0xf3, 0x52,
1193 0x6b, 0x56, 0xd0, 0x37, 0xe0, 0x5f, 0x25, 0x98,
1194 0xbd, 0x0f, 0xd2, 0x21, 0x5d, 0x6a, 0x1e, 0x52,
1195 0x95, 0xe6, 0x4f, 0x73, 0xf6, 0x3f, 0x0a, 0xec,
1196 0x8b, 0x91, 0x5a, 0x98, 0x5d, 0x78, 0x65, 0x98 },
1197 }, {
1198 .key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1199 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1200 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1201 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1202 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1203 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1204 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1205 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1206 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1207 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1208 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1209 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1210 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1211 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1212 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1213 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1214 0xaa, 0xaa, 0xaa }, // (131 bytes)
1215 .ksize = 131,
1216 .plaintext = { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
1217 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x75, // ("This is a test u")
1218 0x73, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x6c,
1219 0x61, 0x72, 0x67, 0x65, 0x72, 0x20, 0x74, 0x68, // ("sing a larger th")
1220 0x61, 0x6e, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
1221 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x6b, 0x65, // ("an block-size ke")
1222 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x20,
1223 0x6c, 0x61, 0x72, 0x67, 0x65, 0x72, 0x20, 0x74, // ("y and a larger t")
1224 0x68, 0x61, 0x6e, 0x20, 0x62, 0x6c, 0x6f, 0x63,
1225 0x6b, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x64, // ("han block-size d")
1226 0x61, 0x74, 0x61, 0x2e, 0x20, 0x54, 0x68, 0x65,
1227 0x20, 0x6b, 0x65, 0x79, 0x20, 0x6e, 0x65, 0x65, // ("ata. The key nee")
1228 0x64, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65,
1229 0x20, 0x68, 0x61, 0x73, 0x68, 0x65, 0x64, 0x20, // ("ds to be hashed ")
1230 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x62,
1231 0x65, 0x69, 0x6e, 0x67, 0x20, 0x75, 0x73, 0x65, // ("before being use")
1232 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65,
1233 0x20, 0x48, 0x4d, 0x41, 0x43, 0x20, 0x61, 0x6c, // ("d by the HMAC al")
1234 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x2e }, // ("gorithm.")
1235 .psize = 152,
1236 .digest = { 0xe3, 0x7b, 0x6a, 0x77, 0x5d, 0xc8, 0x7d, 0xba,
1237 0xa4, 0xdf, 0xa9, 0xf9, 0x6e, 0x5e, 0x3f, 0xfd,
1238 0xde, 0xbd, 0x71, 0xf8, 0x86, 0x72, 0x89, 0x86,
1239 0x5d, 0xf5, 0xa3, 0x2d, 0x20, 0xcd, 0xc9, 0x44,
1240 0xb6, 0x02, 0x2c, 0xac, 0x3c, 0x49, 0x82, 0xb1,
1241 0x0d, 0x5e, 0xeb, 0x55, 0xc3, 0xe4, 0xde, 0x15,
1242 0x13, 0x46, 0x76, 0xfb, 0x6d, 0xe0, 0x44, 0x60,
1243 0x65, 0xc9, 0x74, 0x40, 0xfa, 0x8c, 0x6a, 0x58 },
1244 },
1245};
1246
1247/*
1005 * DES test vectors. 1248 * DES test vectors.
1006 */ 1249 */
1007#define DES_ENC_TEST_VECTORS 10 1250#define DES_ENC_TEST_VECTORS 10