aboutsummaryrefslogtreecommitdiff
path: root/test/validation/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'test/validation/crypto')
-rw-r--r--test/validation/crypto/crypto.h4
-rw-r--r--test/validation/crypto/odp_crypto_test_inp.c235
-rw-r--r--test/validation/crypto/test_vectors.h152
-rw-r--r--test/validation/crypto/test_vectors_len.h7
4 files changed, 371 insertions, 27 deletions
diff --git a/test/validation/crypto/crypto.h b/test/validation/crypto/crypto.h
index 4769fad1f..5224e4763 100644
--- a/test/validation/crypto/crypto.h
+++ b/test/validation/crypto/crypto.h
@@ -18,6 +18,10 @@ void crypto_test_enc_alg_aes128_cbc(void);
void crypto_test_enc_alg_aes128_cbc_ovr_iv(void);
void crypto_test_dec_alg_aes128_cbc(void);
void crypto_test_dec_alg_aes128_cbc_ovr_iv(void);
+void crypto_test_enc_alg_aes128_gcm(void);
+void crypto_test_enc_alg_aes128_gcm_ovr_iv(void);
+void crypto_test_dec_alg_aes128_gcm(void);
+void crypto_test_dec_alg_aes128_gcm_ovr_iv(void);
void crypto_test_alg_hmac_md5(void);
void crypto_test_alg_hmac_sha256(void);
diff --git a/test/validation/crypto/odp_crypto_test_inp.c b/test/validation/crypto/odp_crypto_test_inp.c
index 5295c6329..b6fcb1272 100644
--- a/test/validation/crypto/odp_crypto_test_inp.c
+++ b/test/validation/crypto/odp_crypto_test_inp.c
@@ -35,10 +35,15 @@ static void alg_test(odp_crypto_op_t op,
odp_crypto_key_t cipher_key,
odp_auth_alg_t auth_alg,
odp_crypto_key_t auth_key,
- uint8_t *input_vec,
- unsigned int input_vec_len,
- uint8_t *output_vec,
- unsigned int output_vec_len)
+ odp_crypto_data_range_t *cipher_range,
+ odp_crypto_data_range_t *auth_range,
+ const uint8_t *plaintext,
+ unsigned int plaintext_len,
+ const uint8_t *ciphertext,
+ unsigned int ciphertext_len,
+ const uint8_t *digest,
+ unsigned int digest_len
+ )
{
odp_crypto_session_t session;
int rc;
@@ -69,11 +74,12 @@ static void alg_test(odp_crypto_op_t op,
odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID));
/* Prepare input data */
- odp_packet_t pkt = odp_packet_alloc(suite_context.pool, input_vec_len);
+ odp_packet_t pkt = odp_packet_alloc(suite_context.pool,
+ plaintext_len + digest_len);
CU_ASSERT(pkt != ODP_PACKET_INVALID);
uint8_t *data_addr = odp_packet_data(pkt);
- memcpy(data_addr, input_vec, input_vec_len);
- const int data_off = 0;
+ memcpy(data_addr, plaintext, plaintext_len);
+ int data_off = 0;
/* Prepare input/output params */
odp_crypto_op_params_t op_params;
@@ -82,20 +88,24 @@ static void alg_test(odp_crypto_op_t op,
op_params.pkt = pkt;
op_params.out_pkt = pkt;
op_params.ctx = (void *)0xdeadbeef;
- if (cipher_alg != ODP_CIPHER_ALG_NULL &&
- auth_alg == ODP_AUTH_ALG_NULL) {
+
+ if (cipher_range) {
+ op_params.cipher_range = *cipher_range;
+ data_off = cipher_range->offset;
+ } else {
op_params.cipher_range.offset = data_off;
- op_params.cipher_range.length = input_vec_len;
- if (op_iv_ptr)
- op_params.override_iv_ptr = op_iv_ptr;
- } else if (cipher_alg == ODP_CIPHER_ALG_NULL &&
- auth_alg != ODP_AUTH_ALG_NULL) {
- op_params.auth_range.offset = data_off;
- op_params.auth_range.length = input_vec_len;
- op_params.hash_result_offset = data_off;
+ op_params.cipher_range.length = plaintext_len;
+ }
+ if (auth_range) {
+ op_params.auth_range = *auth_range;
} else {
- CU_FAIL("%s : not implemented for combined alg mode\n");
+ op_params.auth_range.offset = data_off;
+ op_params.auth_range.length = plaintext_len;
}
+ if (op_iv_ptr)
+ op_params.override_iv_ptr = op_iv_ptr;
+
+ op_params.hash_result_offset = plaintext_len;
rc = odp_crypto_operation(&op_params, &posted, &result);
if (rc < 0) {
@@ -119,7 +129,12 @@ static void alg_test(odp_crypto_op_t op,
CU_ASSERT(result.ok);
CU_ASSERT(result.pkt == pkt);
- CU_ASSERT(!memcmp(data_addr, output_vec, output_vec_len));
+ if (cipher_alg != ODP_CIPHER_ALG_NULL)
+ CU_ASSERT(!memcmp(data_addr, ciphertext, ciphertext_len));
+
+ if (op == ODP_CRYPTO_OP_ENCODE && auth_alg != ODP_AUTH_ALG_NULL)
+ CU_ASSERT(!memcmp(data_addr + op_params.hash_result_offset,
+ digest, digest_len));
CU_ASSERT(result.ctx == (void *)0xdeadbeef);
cleanup:
@@ -155,10 +170,11 @@ void crypto_test_enc_alg_3des_cbc(void)
cipher_key,
ODP_AUTH_ALG_NULL,
auth_key,
+ NULL, NULL,
tdes_cbc_reference_plaintext[i],
tdes_cbc_reference_length[i],
tdes_cbc_reference_ciphertext[i],
- tdes_cbc_reference_length[i]);
+ tdes_cbc_reference_length[i], NULL, 0);
}
}
@@ -185,10 +201,11 @@ void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
cipher_key,
ODP_AUTH_ALG_NULL,
auth_key,
+ NULL, NULL,
tdes_cbc_reference_plaintext[i],
tdes_cbc_reference_length[i],
tdes_cbc_reference_ciphertext[i],
- tdes_cbc_reference_length[i]);
+ tdes_cbc_reference_length[i], NULL, 0);
}
}
@@ -220,10 +237,11 @@ void crypto_test_dec_alg_3des_cbc(void)
cipher_key,
ODP_AUTH_ALG_NULL,
auth_key,
+ NULL, NULL,
tdes_cbc_reference_ciphertext[i],
tdes_cbc_reference_length[i],
tdes_cbc_reference_plaintext[i],
- tdes_cbc_reference_length[i]);
+ tdes_cbc_reference_length[i], NULL, 0);
}
}
@@ -252,10 +270,161 @@ void crypto_test_dec_alg_3des_cbc_ovr_iv(void)
cipher_key,
ODP_AUTH_ALG_NULL,
auth_key,
+ NULL, NULL,
tdes_cbc_reference_ciphertext[i],
tdes_cbc_reference_length[i],
tdes_cbc_reference_plaintext[i],
- tdes_cbc_reference_length[i]);
+ tdes_cbc_reference_length[i], NULL, 0);
+ }
+}
+
+/* This test verifies the correctness of encode (plaintext -> ciphertext)
+ * operation for AES128_GCM algorithm. IV for the operation is the session IV.
+ * In addition the test verifies if the implementation can use the
+ * packet buffer as completion event buffer.*/
+void crypto_test_enc_alg_aes128_gcm(void)
+{
+ odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
+ auth_key = { .data = NULL, .length = 0 };
+ odp_crypto_iv_t iv = { .data = NULL, .length = AES128_GCM_IV_LEN };
+ unsigned int test_vec_num = (sizeof(aes128_gcm_reference_length) /
+ sizeof(aes128_gcm_reference_length[0]));
+ unsigned int i;
+
+ for (i = 0; i < test_vec_num; i++) {
+ cipher_key.data = aes128_gcm_reference_key[i];
+ cipher_key.length = sizeof(aes128_gcm_reference_key[i]);
+ iv.data = aes128_gcm_reference_iv[i];
+ iv.length = sizeof(aes128_gcm_reference_iv[i]);
+
+ alg_test(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_AES128_GCM,
+ iv,
+ NULL,
+ cipher_key,
+ ODP_AUTH_ALG_AES128_GCM,
+ auth_key,
+ &aes128_gcm_cipher_range[i],
+ &aes128_gcm_auth_range[i],
+ aes128_gcm_reference_plaintext[i],
+ aes128_gcm_reference_length[i],
+ aes128_gcm_reference_ciphertext[i],
+ aes128_gcm_reference_length[i],
+ aes128_gcm_reference_ciphertext[i] +
+ aes128_gcm_reference_length[i],
+ AES128_GCM_CHECK_LEN);
+ }
+}
+
+/* This test verifies the correctness of encode (plaintext -> ciphertext)
+ * operation for AES128_GCM algorithm. IV for the operation is the session IV.
+ * In addition the test verifies if the implementation can use the
+ * packet buffer as completion event buffer.*/
+void crypto_test_enc_alg_aes128_gcm_ovr_iv(void)
+{
+ odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
+ auth_key = { .data = NULL, .length = 0 };
+ odp_crypto_iv_t iv = { .data = NULL, .length = AES128_GCM_IV_LEN };
+ unsigned int test_vec_num = (sizeof(aes128_gcm_reference_length) /
+ sizeof(aes128_gcm_reference_length[0]));
+ unsigned int i;
+
+ for (i = 0; i < test_vec_num; i++) {
+ cipher_key.data = aes128_gcm_reference_key[i];
+ cipher_key.length = sizeof(aes128_gcm_reference_key[i]);
+
+ alg_test(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_AES128_GCM,
+ iv,
+ aes128_gcm_reference_iv[i],
+ cipher_key,
+ ODP_AUTH_ALG_AES128_GCM,
+ auth_key,
+ &aes128_gcm_cipher_range[i],
+ &aes128_gcm_auth_range[i],
+ aes128_gcm_reference_plaintext[i],
+ aes128_gcm_reference_length[i],
+ aes128_gcm_reference_ciphertext[i],
+ aes128_gcm_reference_length[i],
+ aes128_gcm_reference_ciphertext[i] +
+ aes128_gcm_reference_length[i],
+ AES128_GCM_CHECK_LEN);
+ }
+}
+
+/* This test verifies the correctness of decode (ciphertext -> plaintext)
+ * operation for 3DES_CBC algorithm. IV for the operation is the session IV
+ * In addition the test verifies if the implementation can use the
+ * packet buffer as completion event buffer.
+ * */
+void crypto_test_dec_alg_aes128_gcm(void)
+{
+ odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
+ auth_key = { .data = NULL, .length = 0 };
+ odp_crypto_iv_t iv = { .data = NULL, .length = AES128_GCM_IV_LEN };
+ unsigned int test_vec_num = (sizeof(aes128_gcm_reference_length) /
+ sizeof(aes128_gcm_reference_length[0]));
+ unsigned int i;
+
+ for (i = 0; i < test_vec_num; i++) {
+ cipher_key.data = aes128_gcm_reference_key[i];
+ cipher_key.length = sizeof(aes128_gcm_reference_key[i]);
+ iv.data = aes128_gcm_reference_iv[i];
+ iv.length = sizeof(aes128_gcm_reference_iv[i]);
+
+ alg_test(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_AES128_GCM,
+ iv,
+ NULL,
+ cipher_key,
+ ODP_AUTH_ALG_AES128_GCM,
+ auth_key,
+ &aes128_gcm_cipher_range[i],
+ &aes128_gcm_auth_range[i],
+ aes128_gcm_reference_ciphertext[i],
+ aes128_gcm_reference_length[i] + AES128_GCM_CHECK_LEN,
+ aes128_gcm_reference_plaintext[i],
+ aes128_gcm_reference_length[i],
+ aes128_gcm_reference_ciphertext[i] +
+ aes128_gcm_reference_length[i],
+ AES128_GCM_CHECK_LEN);
+ }
+}
+
+/* This test verifies the correctness of decode (ciphertext -> plaintext)
+ * operation for 3DES_CBC algorithm. IV for the operation is the session IV
+ * In addition the test verifies if the implementation can use the
+ * packet buffer as completion event buffer.
+ * */
+void crypto_test_dec_alg_aes128_gcm_ovr_iv(void)
+{
+ odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
+ auth_key = { .data = NULL, .length = 0 };
+ odp_crypto_iv_t iv = { .data = NULL, .length = AES128_GCM_IV_LEN };
+ unsigned int test_vec_num = (sizeof(aes128_gcm_reference_length) /
+ sizeof(aes128_gcm_reference_length[0]));
+ unsigned int i;
+
+ for (i = 0; i < test_vec_num; i++) {
+ cipher_key.data = aes128_gcm_reference_key[i];
+ cipher_key.length = sizeof(aes128_gcm_reference_key[i]);
+
+ alg_test(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_AES128_GCM,
+ iv,
+ aes128_gcm_reference_iv[i],
+ cipher_key,
+ ODP_AUTH_ALG_AES128_GCM,
+ auth_key,
+ &aes128_gcm_cipher_range[i],
+ &aes128_gcm_auth_range[i],
+ aes128_gcm_reference_ciphertext[i],
+ aes128_gcm_reference_length[i] + AES128_GCM_CHECK_LEN,
+ aes128_gcm_reference_plaintext[i],
+ aes128_gcm_reference_length[i],
+ aes128_gcm_reference_ciphertext[i] +
+ aes128_gcm_reference_length[i],
+ AES128_GCM_CHECK_LEN);
}
}
@@ -285,10 +454,11 @@ void crypto_test_enc_alg_aes128_cbc(void)
cipher_key,
ODP_AUTH_ALG_NULL,
auth_key,
+ NULL, NULL,
aes128_cbc_reference_plaintext[i],
aes128_cbc_reference_length[i],
aes128_cbc_reference_ciphertext[i],
- aes128_cbc_reference_length[i]);
+ aes128_cbc_reference_length[i], NULL, 0);
}
}
@@ -315,10 +485,11 @@ void crypto_test_enc_alg_aes128_cbc_ovr_iv(void)
cipher_key,
ODP_AUTH_ALG_NULL,
auth_key,
+ NULL, NULL,
aes128_cbc_reference_plaintext[i],
aes128_cbc_reference_length[i],
aes128_cbc_reference_ciphertext[i],
- aes128_cbc_reference_length[i]);
+ aes128_cbc_reference_length[i], NULL, 0);
}
}
@@ -349,10 +520,11 @@ void crypto_test_dec_alg_aes128_cbc(void)
cipher_key,
ODP_AUTH_ALG_NULL,
auth_key,
+ NULL, NULL,
aes128_cbc_reference_ciphertext[i],
aes128_cbc_reference_length[i],
aes128_cbc_reference_plaintext[i],
- aes128_cbc_reference_length[i]);
+ aes128_cbc_reference_length[i], NULL, 0);
}
}
@@ -381,10 +553,11 @@ void crypto_test_dec_alg_aes128_cbc_ovr_iv(void)
cipher_key,
ODP_AUTH_ALG_NULL,
auth_key,
+ NULL, NULL,
aes128_cbc_reference_ciphertext[i],
aes128_cbc_reference_length[i],
aes128_cbc_reference_plaintext[i],
- aes128_cbc_reference_length[i]);
+ aes128_cbc_reference_length[i], NULL, 0);
}
}
@@ -417,8 +590,10 @@ void crypto_test_alg_hmac_md5(void)
cipher_key,
ODP_AUTH_ALG_MD5_96,
auth_key,
+ NULL, NULL,
hmac_md5_reference_plaintext[i],
hmac_md5_reference_length[i],
+ NULL, 0,
hmac_md5_reference_digest[i],
HMAC_MD5_96_CHECK_LEN);
}
@@ -453,8 +628,10 @@ void crypto_test_alg_hmac_sha256(void)
cipher_key,
ODP_AUTH_ALG_SHA256_128,
auth_key,
+ NULL, NULL,
hmac_sha256_reference_plaintext[i],
hmac_sha256_reference_length[i],
+ NULL, 0,
hmac_sha256_reference_digest[i],
HMAC_SHA256_128_CHECK_LEN);
}
@@ -493,6 +670,10 @@ odp_testinfo_t crypto_suite[] = {
ODP_TEST_INFO(crypto_test_dec_alg_aes128_cbc),
ODP_TEST_INFO(crypto_test_enc_alg_aes128_cbc_ovr_iv),
ODP_TEST_INFO(crypto_test_dec_alg_aes128_cbc_ovr_iv),
+ ODP_TEST_INFO(crypto_test_enc_alg_aes128_gcm),
+ ODP_TEST_INFO(crypto_test_enc_alg_aes128_gcm_ovr_iv),
+ ODP_TEST_INFO(crypto_test_dec_alg_aes128_gcm),
+ ODP_TEST_INFO(crypto_test_dec_alg_aes128_gcm_ovr_iv),
ODP_TEST_INFO(crypto_test_alg_hmac_md5),
ODP_TEST_INFO(crypto_test_alg_hmac_sha256),
ODP_TEST_INFO_NULL,
diff --git a/test/validation/crypto/test_vectors.h b/test/validation/crypto/test_vectors.h
index 73f54b5b3..1b760a24e 100644
--- a/test/validation/crypto/test_vectors.h
+++ b/test/validation/crypto/test_vectors.h
@@ -112,6 +112,158 @@ aes128_cbc_reference_ciphertext[][AES128_CBC_MAX_DATA_LEN] = {
0x49, 0xa5, 0x3e, 0x87, 0xf4, 0xc3, 0xda, 0x55 }
};
+/* AES-GCM test vectors extracted from
+ * https://tools.ietf.org/html/draft-mcgrew-gcm-test-01#section-2
+ */
+static uint8_t aes128_gcm_reference_key[][AES128_GCM_KEY_LEN] = {
+ { 0x4c, 0x80, 0xcd, 0xef, 0xbb, 0x5d, 0x10, 0xda,
+ 0x90, 0x6a, 0xc7, 0x3c, 0x36, 0x13, 0xa6, 0x34 },
+ { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08 },
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ { 0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49,
+ 0x19, 0x88, 0xd0, 0xc3, 0x60, 0x7e, 0xae, 0x1f }
+};
+
+static uint8_t aes128_gcm_reference_iv[][AES128_GCM_IV_LEN] = {
+ { 0x2e, 0x44, 0x3b, 0x68, 0x49, 0x56, 0xed, 0x7e,
+ 0x3b, 0x24, 0x4c, 0xfe },
+ { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+ 0xde, 0xca, 0xf8, 0x88 },
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00 },
+ { 0x57, 0x69, 0x0e, 0x43, 0x4e, 0x28, 0x00, 0x00,
+ 0xa2, 0xfc, 0xa1, 0xa3 }
+};
+
+static uint32_t aes128_gcm_reference_length[] = { 84, 72, 72, 40};
+
+static odp_crypto_data_range_t aes128_gcm_cipher_range[] = {
+ { .offset = 12, .length = 72 },
+ { .offset = 8, .length = 64 },
+ { .offset = 8, .length = 64 },
+ { .offset = 12, .length = 28 },
+};
+
+static odp_crypto_data_range_t aes128_gcm_auth_range[] = {
+ { .offset = 0, .length = 84 },
+ { .offset = 0, .length = 72 },
+ { .offset = 0, .length = 72 },
+ { .offset = 0, .length = 40 },
+};
+
+static uint8_t
+aes128_gcm_reference_plaintext[][AES128_GCM_MAX_DATA_LEN] = {
+ { /* Aad */
+ 0x00, 0x00, 0x43, 0x21, 0x87, 0x65, 0x43, 0x21,
+ 0x00, 0x00, 0x00, 0x00,
+ /* Plain */
+ 0x45, 0x00, 0x00, 0x48, 0x69, 0x9a, 0x00, 0x00,
+ 0x80, 0x11, 0x4d, 0xb7, 0xc0, 0xa8, 0x01, 0x02,
+ 0xc0, 0xa8, 0x01, 0x01, 0x0a, 0x9b, 0xf1, 0x56,
+ 0x38, 0xd3, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x5f, 0x73, 0x69,
+ 0x70, 0x04, 0x5f, 0x75, 0x64, 0x70, 0x03, 0x73,
+ 0x69, 0x70, 0x09, 0x63, 0x79, 0x62, 0x65, 0x72,
+ 0x63, 0x69, 0x74, 0x79, 0x02, 0x64, 0x6b, 0x00,
+ 0x00, 0x21, 0x00, 0x01, 0x01, 0x02, 0x02, 0x01 },
+
+ { /* Aad */
+ 0x00, 0x00, 0xa5, 0xf8, 0x00, 0x00, 0x00, 0x0a,
+ /* Plain */
+ 0x45, 0x00, 0x00, 0x3e, 0x69, 0x8f, 0x00, 0x00,
+ 0x80, 0x11, 0x4d, 0xcc, 0xc0, 0xa8, 0x01, 0x02,
+ 0xc0, 0xa8, 0x01, 0x01, 0x0a, 0x98, 0x00, 0x35,
+ 0x00, 0x2a, 0x23, 0x43, 0xb2, 0xd0, 0x01, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x73, 0x69, 0x70, 0x09, 0x63, 0x79, 0x62,
+ 0x65, 0x72, 0x63, 0x69, 0x74, 0x79, 0x02, 0x64,
+ 0x6b, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01 },
+
+ { /* Aad */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ /* Plain */
+ 0x45, 0x00, 0x00, 0x3c, 0x99, 0xc5, 0x00, 0x00,
+ 0x80, 0x01, 0xcb, 0x7a, 0x40, 0x67, 0x93, 0x18,
+ 0x01, 0x01, 0x01, 0x01, 0x08, 0x00, 0x07, 0x5c,
+ 0x02, 0x00, 0x44, 0x00, 0x61, 0x62, 0x63, 0x64,
+ 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
+ 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
+ 0x75, 0x76, 0x77, 0x61, 0x62, 0x63, 0x64, 0x65,
+ 0x66, 0x67, 0x68, 0x69, 0x01, 0x02, 0x02, 0x01 },
+
+ { /* Aad */
+ 0x42, 0xf6, 0x7e, 0x3f, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10,
+ /* Plain */
+ 0x45, 0x00, 0x00, 0x1c, 0x42, 0xa2, 0x00, 0x00,
+ 0x80, 0x01, 0x44, 0x1f, 0x40, 0x67, 0x93, 0xb6,
+ 0xe0, 0x00, 0x00, 0x02, 0x0a, 0x00, 0xf5, 0xff,
+ 0x01, 0x02, 0x02, 0x01 }
+};
+
+static uint8_t
+aes128_gcm_reference_ciphertext[][AES128_GCM_MAX_DATA_LEN] = {
+ { /* Aad */
+ 0x00, 0x00, 0x43, 0x21, 0x87, 0x65, 0x43, 0x21,
+ 0x00, 0x00, 0x00, 0x00,
+ /* Plain */
+ 0xfe, 0xcf, 0x53, 0x7e, 0x72, 0x9d, 0x5b, 0x07,
+ 0xdc, 0x30, 0xdf, 0x52, 0x8d, 0xd2, 0x2b, 0x76,
+ 0x8d, 0x1b, 0x98, 0x73, 0x66, 0x96, 0xa6, 0xfd,
+ 0x34, 0x85, 0x09, 0xfa, 0x13, 0xce, 0xac, 0x34,
+ 0xcf, 0xa2, 0x43, 0x6f, 0x14, 0xa3, 0xf3, 0xcf,
+ 0x65, 0x92, 0x5b, 0xf1, 0xf4, 0xa1, 0x3c, 0x5d,
+ 0x15, 0xb2, 0x1e, 0x18, 0x84, 0xf5, 0xff, 0x62,
+ 0x47, 0xae, 0xab, 0xb7, 0x86, 0xb9, 0x3b, 0xce,
+ 0x61, 0xbc, 0x17, 0xd7, 0x68, 0xfd, 0x97, 0x32,
+ /* Digest */
+ 0x45, 0x90, 0x18, 0x14, 0x8f, 0x6c, 0xbe, 0x72,
+ 0x2f, 0xd0, 0x47, 0x96, 0x56, 0x2d, 0xfd, 0xb4 },
+
+ { /* Aad */
+ 0x00, 0x00, 0xa5, 0xf8, 0x00, 0x00, 0x00, 0x0a,
+ /* Plain */
+ 0xde, 0xb2, 0x2c, 0xd9, 0xb0, 0x7c, 0x72, 0xc1,
+ 0x6e, 0x3a, 0x65, 0xbe, 0xeb, 0x8d, 0xf3, 0x04,
+ 0xa5, 0xa5, 0x89, 0x7d, 0x33, 0xae, 0x53, 0x0f,
+ 0x1b, 0xa7, 0x6d, 0x5d, 0x11, 0x4d, 0x2a, 0x5c,
+ 0x3d, 0xe8, 0x18, 0x27, 0xc1, 0x0e, 0x9a, 0x4f,
+ 0x51, 0x33, 0x0d, 0x0e, 0xec, 0x41, 0x66, 0x42,
+ 0xcf, 0xbb, 0x85, 0xa5, 0xb4, 0x7e, 0x48, 0xa4,
+ 0xec, 0x3b, 0x9b, 0xa9, 0x5d, 0x91, 0x8b, 0xd1,
+ /* Digest */
+ 0x83, 0xb7, 0x0d, 0x3a, 0xa8, 0xbc, 0x6e, 0xe4,
+ 0xc3, 0x09, 0xe9, 0xd8, 0x5a, 0x41, 0xad, 0x4a },
+ { /* Aad */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ /* Plain */
+ 0x46, 0x88, 0xda, 0xf2, 0xf9, 0x73, 0xa3, 0x92,
+ 0x73, 0x29, 0x09, 0xc3, 0x31, 0xd5, 0x6d, 0x60,
+ 0xf6, 0x94, 0xab, 0xaa, 0x41, 0x4b, 0x5e, 0x7f,
+ 0xf5, 0xfd, 0xcd, 0xff, 0xf5, 0xe9, 0xa2, 0x84,
+ 0x45, 0x64, 0x76, 0x49, 0x27, 0x19, 0xff, 0xb6,
+ 0x4d, 0xe7, 0xd9, 0xdc, 0xa1, 0xe1, 0xd8, 0x94,
+ 0xbc, 0x3b, 0xd5, 0x78, 0x73, 0xed, 0x4d, 0x18,
+ 0x1d, 0x19, 0xd4, 0xd5, 0xc8, 0xc1, 0x8a, 0xf3,
+ /* Digest */
+ 0xf8, 0x21, 0xd4, 0x96, 0xee, 0xb0, 0x96, 0xe9,
+ 0x8a, 0xd2, 0xb6, 0x9e, 0x47, 0x99, 0xc7, 0x1d },
+
+ { /* Aad */
+ 0x42, 0xf6, 0x7e, 0x3f, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10,
+ /* Plain */
+ 0xfb, 0xa2, 0xca, 0x84, 0x5e, 0x5d, 0xf9, 0xf0,
+ 0xf2, 0x2c, 0x3e, 0x6e, 0x86, 0xdd, 0x83, 0x1e,
+ 0x1f, 0xc6, 0x57, 0x92, 0xcd, 0x1a, 0xf9, 0x13,
+ 0x0e, 0x13, 0x79, 0xed,
+ /* Digest */
+ 0x36, 0x9f, 0x07, 0x1f, 0x35, 0xe0, 0x34, 0xbe,
+ 0x95, 0xf1, 0x12, 0xe4, 0xe7, 0xd0, 0x5d, 0x35 }
+};
+
static uint8_t hmac_md5_reference_key[][HMAC_MD5_KEY_LEN] = {
{ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b } ,
diff --git a/test/validation/crypto/test_vectors_len.h b/test/validation/crypto/test_vectors_len.h
index 5bc6f4b50..4fbb5cd70 100644
--- a/test/validation/crypto/test_vectors_len.h
+++ b/test/validation/crypto/test_vectors_len.h
@@ -16,6 +16,13 @@
#define AES128_CBC_IV_LEN 16
#define AES128_CBC_MAX_DATA_LEN 64
+/* AES128-CBC */
+#define AES128_GCM_KEY_LEN 16
+#define AES128_GCM_IV_LEN 12
+#define AES128_GCM_MAX_DATA_LEN 106
+#define AES128_GCM_DIGEST_LEN 16
+#define AES128_GCM_CHECK_LEN 16
+
/* HMAC-MD5 */
#define HMAC_MD5_KEY_LEN 16
#define HMAC_MD5_MAX_DATA_LEN 128