5 #ifndef OPENTITAN_SW_DEVICE_TESTS_CRYPTO_AES_GCM_TESTVECTORS_H_
6 #define OPENTITAN_SW_DEVICE_TESTS_CRYPTO_AES_GCM_TESTVECTORS_H_
9 #include "sw/device/lib/crypto/drivers/aes.h"
10 #include "sw/device/tests/crypto/aes_gcm_testutils.h"
19 static const uint32_t kKey128[4] = {
21 0x676e0af8, 0x37871c21, 0x899da993, 0xe7c2319c};
26 static const uint32_t kKey256[8] = {
28 0x90275976, 0x0e63f6ea, 0x78e50c67, 0x183af24f,
29 0x76eaa106, 0x157b97b0, 0x69473742, 0xcec47c24};
34 static uint8_t kAad[18] = {
37 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63,
38 0x61, 0x74, 0x65, 0x64, 0x20, 0x64, 0x61, 0x74, 0x61};
43 static uint8_t kPlaintext[32] = {
47 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
48 0x65, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x65, 0x6e, 0x63, 0x72,
49 0x79, 0x70, 0x74, 0x65, 0x64, 0x20, 0x64, 0x61, 0x74, 0x61};
54 static uint8_t kCiphertext256[32] = {
57 0x4e, 0x6d, 0x3a, 0x96, 0x3b, 0x07, 0x6b, 0xa0, 0x94, 0x5d, 0x29,
58 0xaa, 0x83, 0x6f, 0x29, 0xb0, 0xfa, 0x06, 0xcd, 0xd5, 0x75, 0xaa,
59 0xb8, 0x23, 0x3f, 0x1d, 0xf9, 0x3e, 0x80, 0x16, 0x33, 0x71};
76 static const uint32_t kMVTestCase3Key[] = {0x92e9fffe, 0x1c736586, 0x948f6a6d,
78 static uint8_t kMVTestCase3Plaintext[] = {
79 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xa5, 0x59, 0x09,
80 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34,
81 0xf7, 0xda, 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 0x1c,
82 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 0x2f, 0xcf, 0x0e, 0x24,
83 0x49, 0xa6, 0xb5, 0x25, 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6,
84 0x57, 0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55};
85 static uint8_t kMVTestCase3Ciphertext[] = {
86 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24, 0x4b, 0x72, 0x21,
87 0xb7, 0x84, 0xd0, 0xd4, 0x9c, 0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02,
88 0xa4, 0xe0, 0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e, 0x21,
89 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c, 0x7d, 0x8f, 0x6a, 0x5a,
90 0xac, 0x84, 0xaa, 0x05, 0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac,
91 0x97, 0x3d, 0x58, 0xe0, 0x91, 0x47, 0x3f, 0x59, 0x85};
108 static const uint32_t kMVTestCase10Key[] = {0x92e9fffe, 0x1c736586, 0x948f6a6d,
109 0x08833067, 0x92e9fffe, 0x1c736586};
110 static uint8_t kMVTestCase10Aad[] = {0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe,
111 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad,
112 0xbe, 0xef, 0xab, 0xad, 0xda, 0xd2};
113 static uint8_t kMVTestCase10Plaintext[] = {
114 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xa5, 0x59, 0x09, 0xc5,
115 0xaf, 0xf5, 0x26, 0x9a, 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
116 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 0x1c, 0x3c, 0x0c, 0x95,
117 0x95, 0x68, 0x09, 0x53, 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
118 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 0xba, 0x63, 0x7b, 0x39};
119 static uint8_t kMVTestCase10Ciphertext[] = {
120 0x39, 0x80, 0xca, 0x0b, 0x3c, 0x00, 0xe8, 0x41, 0xeb, 0x06, 0xfa, 0xc4,
121 0x87, 0x2a, 0x27, 0x57, 0x85, 0x9e, 0x1c, 0xea, 0xa6, 0xef, 0xd9, 0x84,
122 0x62, 0x85, 0x93, 0xb4, 0x0c, 0xa1, 0xe1, 0x9c, 0x7d, 0x77, 0x3d, 0x00,
123 0xc1, 0x44, 0xc5, 0x25, 0xac, 0x61, 0x9d, 0x18, 0xc8, 0x4a, 0x3f, 0x47,
124 0x18, 0xe2, 0x44, 0x8b, 0x2f, 0xe3, 0x24, 0xd9, 0xcc, 0xda, 0x27, 0x10};
134 0x22, 0x29, 0x4c, 0xae, 0x82, 0xd8, 0x2e, 0x44, 0x42, 0x7d, 0xfc,
144 0xb7, 0xaa, 0x22, 0x3a, 0x6c, 0x75, 0xa0, 0x97, 0x66, 0x33, 0xce,
145 0x79, 0xd9, 0xfd, 0xdf, 0x06},
155 0x22, 0x29, 0x4c, 0xae, 0x82, 0xd8, 0x2e, 0x44, 0x42, 0x7d, 0xfc,
156 0xc3, 0x3b, 0xac, 0xdb, 0xec},
165 0x4c, 0x59, 0xf0, 0xd4, 0x20, 0xd9, 0xeb, 0x86, 0x69, 0xc4, 0x0a,
166 0xd2, 0x3b, 0x54, 0x19, 0xba},
176 0xc5, 0x8a, 0xde, 0xd2, 0xe1, 0xbb, 0xec, 0xba, 0x8b, 0x16, 0xa5,
177 0x75, 0x7e, 0x54, 0x75, 0xbd},
178 .plaintext_len =
sizeof(kPlaintext),
179 .plaintext = kPlaintext,
180 .aad_len =
sizeof(kAad),
182 .ciphertext = kCiphertext256,
186 0x32, 0x48, 0x95, 0xb3, 0xd2, 0xf6, 0x56, 0xe4, 0xfa, 0x2f, 0x8c,
187 0xe0, 0x56, 0x13, 0x70, 0x61},
197 0xc5, 0x8a, 0xde, 0xd2, 0xe1, 0xbb, 0xec, 0xba, 0x8b, 0x16, 0xa5,
198 0x75, 0x7e, 0x54, 0x75, 0xbd},
199 .plaintext_len =
sizeof(kPlaintext),
200 .plaintext = kPlaintext,
201 .aad_len =
sizeof(kAad),
203 .ciphertext = kCiphertext256,
207 0x32, 0x48, 0x95, 0xb3, 0xd2, 0xf6, 0x56, 0xe4, 0xfa, 0x2f, 0x8c,
214 .key = kMVTestCase3Key,
216 .iv = {0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8,
218 .plaintext_len =
sizeof(kMVTestCase3Plaintext),
219 .plaintext = kMVTestCase3Plaintext,
222 .ciphertext = kMVTestCase3Ciphertext,
224 .tag = {0x4d, 0x5c, 0x2a, 0xf3, 0x27, 0xcd, 0x64, 0xa6, 0x2c, 0xf3,
225 0x5a, 0xbd, 0x2b, 0xa6, 0xfa, 0xb4},
231 .key = kMVTestCase10Key,
233 .iv = {0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8,
235 .plaintext_len =
sizeof(kMVTestCase10Plaintext),
236 .plaintext = kMVTestCase10Plaintext,
237 .aad_len =
sizeof(kMVTestCase10Aad),
238 .aad = kMVTestCase10Aad,
239 .ciphertext = kMVTestCase10Ciphertext,
241 .tag = {0x25, 0x19, 0x49, 0x8e, 0x80, 0xf1, 0x47, 0x8f, 0x37, 0xba,
242 0x55, 0xbd, 0x6d, 0x27, 0x61, 0x8c},