Fix for Cryptocell tests

This commit is contained in:
Tesfa Mael
2020-12-21 15:27:11 -08:00
committed by Daniel Pouzzner
parent 85d0a71747
commit 56071ac21f
2 changed files with 51 additions and 52 deletions

View File

@@ -4911,16 +4911,15 @@ static int wc_ecc_sign_hash_hw(const byte* in, word32 inlen,
return WC_HW_E; return WC_HW_E;
} }
#elif defined(WOLFSSL_CRYPTOCELL) #elif defined(WOLFSSL_CRYPTOCELL)
/* truncate if hash is longer than key size */
if (msgLenInBytes > keysize) {
msgLenInBytes = keysize;
}
hash_mode = cc310_hashModeECC(msgLenInBytes); hash_mode = cc310_hashModeECC(msgLenInBytes);
if (hash_mode == CRYS_ECPKI_HASH_OpModeLast) { if (hash_mode == CRYS_ECPKI_HASH_OpModeLast) {
hash_mode = cc310_hashModeECC(keysize); hash_mode = cc310_hashModeECC(keysize);
hash_mode = CRYS_ECPKI_HASH_SHA256_mode; hash_mode = CRYS_ECPKI_HASH_SHA256_mode;
}
/* truncate if hash is longer than key size */
if (msgLenInBytes > keysize) {
msgLenInBytes = keysize;
} }
/* create signature from an input buffer using a private key*/ /* create signature from an input buffer using a private key*/
@@ -6390,15 +6389,15 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
return err; return err;
} }
/* truncate if hash is longer than key size */
if (msgLenInBytes > keySz) {
msgLenInBytes = keySz;
}
hash_mode = cc310_hashModeECC(msgLenInBytes); hash_mode = cc310_hashModeECC(msgLenInBytes);
if (hash_mode == CRYS_ECPKI_HASH_OpModeLast) { if (hash_mode == CRYS_ECPKI_HASH_OpModeLast) {
/* hash_mode = */ cc310_hashModeECC(keySz); /* hash_mode = */ cc310_hashModeECC(keySz);
hash_mode = CRYS_ECPKI_HASH_SHA256_mode; hash_mode = CRYS_ECPKI_HASH_SHA256_mode;
} }
/* truncate if hash is longer than key size */
if (msgLenInBytes > keySz) {
msgLenInBytes = keySz;
}
/* verify the signature using the public key */ /* verify the signature using the public key */
err = CRYS_ECDSA_Verify(&sigCtxTemp, err = CRYS_ECDSA_Verify(&sigCtxTemp,

View File

@@ -8009,7 +8009,7 @@ static int aes_cbc_test(void)
byte cipher[AES_BLOCK_SIZE]; byte cipher[AES_BLOCK_SIZE];
byte plain[AES_BLOCK_SIZE]; byte plain[AES_BLOCK_SIZE];
int ret; int ret;
static const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */ const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */
0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74, 0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20, 0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20 0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
@@ -8070,20 +8070,20 @@ static int aes_test(void)
#ifdef HAVE_AES_CBC #ifdef HAVE_AES_CBC
#ifdef WOLFSSL_AES_128 #ifdef WOLFSSL_AES_128
static const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */ const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */
0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74, 0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20, 0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20 0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
}; };
static const byte verify[] = const byte verify[] =
{ {
0x95,0x94,0x92,0x57,0x5f,0x42,0x81,0x53, 0x95,0x94,0x92,0x57,0x5f,0x42,0x81,0x53,
0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb 0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
}; };
static const byte key[] = "0123456789abcdef "; /* align */ const byte key[] = "0123456789abcdef "; /* align */
static const byte iv[] = "1234567890abcdef "; /* align */ const byte iv[] = "1234567890abcdef "; /* align */
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
#if defined(HAVE_AES_CBC) || defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_DIRECT) #if defined(HAVE_AES_CBC) || defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_DIRECT)
@@ -8137,7 +8137,7 @@ static int aes_test(void)
#if defined(WOLFSSL_AESNI) && defined(HAVE_AES_DECRYPT) #if defined(WOLFSSL_AESNI) && defined(HAVE_AES_DECRYPT)
{ {
static const byte bigMsg[] = { const byte bigMsg[] = {
/* "All work and no play makes Jack a dull boy. " */ /* "All work and no play makes Jack a dull boy. " */
0x41,0x6c,0x6c,0x20,0x77,0x6f,0x72,0x6b, 0x41,0x6c,0x6c,0x20,0x77,0x6f,0x72,0x6b,
0x20,0x61,0x6e,0x64,0x20,0x6e,0x6f,0x20, 0x20,0x61,0x6e,0x64,0x20,0x6e,0x6f,0x20,
@@ -8188,7 +8188,7 @@ static int aes_test(void)
0x70,0x6c,0x61,0x79,0x20,0x6d,0x61,0x6b, 0x70,0x6c,0x61,0x79,0x20,0x6d,0x61,0x6b,
0x65,0x73,0x20,0x4a,0x61,0x63,0x6b,0x20 0x65,0x73,0x20,0x4a,0x61,0x63,0x6b,0x20
}; };
static const byte bigKey[] = "0123456789abcdeffedcba9876543210"; const byte bigKey[] = "0123456789abcdeffedcba9876543210";
word32 keySz, msgSz; word32 keySz, msgSz;
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
byte *bigCipher = (byte *)XMALLOC(sizeof(bigMsg), NULL, DYNAMIC_TYPE_TMP_BUFFER); byte *bigCipher = (byte *)XMALLOC(sizeof(bigMsg), NULL, DYNAMIC_TYPE_TMP_BUFFER);
@@ -8268,7 +8268,7 @@ static int aes_test(void)
/* Test Vector from "NIST Special Publication 800-38A, 2001 Edition" /* Test Vector from "NIST Special Publication 800-38A, 2001 Edition"
* https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-38a.pdf * https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-38a.pdf
*/ */
static const byte msg2[] = const byte msg2[] =
{ {
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
@@ -8276,18 +8276,18 @@ static int aes_test(void)
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51
}; };
static const byte verify2[] = const byte verify2[] =
{ {
0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, 0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46,
0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d, 0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d,
0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee, 0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee,
0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2 0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2
}; };
static const byte key2[] = { const byte key2[] = {
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
}; };
static const byte iv2[] = { const byte iv2[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
}; };
@@ -8352,13 +8352,13 @@ static int aes_test(void)
/* test vectors from "Recommendation for Block Cipher Modes of /* test vectors from "Recommendation for Block Cipher Modes of
* Operation" NIST Special Publication 800-38A */ * Operation" NIST Special Publication 800-38A */
static const byte ctrIv[] = const byte ctrIv[] =
{ {
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7, 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,
0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
}; };
static const byte ctrPlain[] = const byte ctrPlain[] =
{ {
0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96, 0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,
0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a, 0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a,
@@ -8371,19 +8371,19 @@ static int aes_test(void)
}; };
#ifdef WOLFSSL_AES_128 #ifdef WOLFSSL_AES_128
static const byte oddCipher[] = const byte oddCipher[] =
{ {
0xb9,0xd7,0xcb,0x08,0xb0,0xe1,0x7b,0xa0, 0xb9,0xd7,0xcb,0x08,0xb0,0xe1,0x7b,0xa0,
0xc2 0xc2
}; };
static const byte ctr128Key[] = const byte ctr128Key[] =
{ {
0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6, 0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,
0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c 0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c
}; };
static const byte ctr128Cipher[] = const byte ctr128Cipher[] =
{ {
0x87,0x4d,0x61,0x91,0xb6,0x20,0xe3,0x26, 0x87,0x4d,0x61,0x91,0xb6,0x20,0xe3,0x26,
0x1b,0xef,0x68,0x64,0x99,0x0d,0xb6,0xce, 0x1b,0xef,0x68,0x64,0x99,0x0d,0xb6,0xce,
@@ -8397,14 +8397,14 @@ static int aes_test(void)
#endif /* WOLFSSL_AES_128 */ #endif /* WOLFSSL_AES_128 */
#ifdef WOLFSSL_AES_192 #ifdef WOLFSSL_AES_192
static const byte ctr192Key[] = const byte ctr192Key[] =
{ {
0x8e,0x73,0xb0,0xf7,0xda,0x0e,0x64,0x52, 0x8e,0x73,0xb0,0xf7,0xda,0x0e,0x64,0x52,
0xc8,0x10,0xf3,0x2b,0x80,0x90,0x79,0xe5, 0xc8,0x10,0xf3,0x2b,0x80,0x90,0x79,0xe5,
0x62,0xf8,0xea,0xd2,0x52,0x2c,0x6b,0x7b 0x62,0xf8,0xea,0xd2,0x52,0x2c,0x6b,0x7b
}; };
static const byte ctr192Cipher[] = const byte ctr192Cipher[] =
{ {
0x1a,0xbc,0x93,0x24,0x17,0x52,0x1c,0xa2, 0x1a,0xbc,0x93,0x24,0x17,0x52,0x1c,0xa2,
0x4f,0x2b,0x04,0x59,0xfe,0x7e,0x6e,0x0b, 0x4f,0x2b,0x04,0x59,0xfe,0x7e,0x6e,0x0b,
@@ -8417,7 +8417,7 @@ static int aes_test(void)
}; };
#endif #endif
#ifdef WOLFSSL_AES_256 #ifdef WOLFSSL_AES_256
static const byte ctr256Key[] = const byte ctr256Key[] =
{ {
0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe, 0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe,
0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81, 0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81,
@@ -8425,7 +8425,7 @@ static int aes_test(void)
0x2d,0x98,0x10,0xa3,0x09,0x14,0xdf,0xf4 0x2d,0x98,0x10,0xa3,0x09,0x14,0xdf,0xf4
}; };
static const byte ctr256Cipher[] = const byte ctr256Cipher[] =
{ {
0x60,0x1e,0xc3,0x13,0x77,0x57,0x89,0xa5, 0x60,0x1e,0xc3,0x13,0x77,0x57,0x89,0xa5,
0xb7,0xa7,0xf5,0x04,0xbb,0xf3,0xd2,0x28, 0xb7,0xa7,0xf5,0x04,0xbb,0xf3,0xd2,0x28,
@@ -8552,19 +8552,19 @@ static int aes_test(void)
#if defined(WOLFSSL_AES_DIRECT) && defined(WOLFSSL_AES_256) #if defined(WOLFSSL_AES_DIRECT) && defined(WOLFSSL_AES_256)
{ {
static const byte niPlain[] = const byte niPlain[] =
{ {
0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96, 0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,
0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a 0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
}; };
static const byte niCipher[] = const byte niCipher[] =
{ {
0xf3,0xee,0xd1,0xbd,0xb5,0xd2,0xa0,0x3c, 0xf3,0xee,0xd1,0xbd,0xb5,0xd2,0xa0,0x3c,
0x06,0x4b,0x5a,0x7e,0x3d,0xb1,0x81,0xf8 0x06,0x4b,0x5a,0x7e,0x3d,0xb1,0x81,0xf8
}; };
static const byte niKey[] = const byte niKey[] =
{ {
0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe, 0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe,
0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81, 0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81,
@@ -8692,12 +8692,12 @@ static int aes192_test(void)
/* Test vectors from NIST Special Publication 800-38A, 2001 Edition /* Test vectors from NIST Special Publication 800-38A, 2001 Edition
* Appendix F.2.3 */ * Appendix F.2.3 */
static const byte msg[] = { const byte msg[] = {
0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96, 0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,
0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a 0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
}; };
static const byte verify[] = const byte verify[] =
{ {
0x4f,0x02,0x1d,0xb2,0x43,0xbc,0x63,0x3d, 0x4f,0x02,0x1d,0xb2,0x43,0xbc,0x63,0x3d,
0x71,0x78,0x18,0x3a,0x9f,0xa0,0x71,0xe8 0x71,0x78,0x18,0x3a,0x9f,0xa0,0x71,0xe8
@@ -8780,12 +8780,12 @@ static int aes256_test(void)
#ifdef HAVE_AES_CBC #ifdef HAVE_AES_CBC
/* Test vectors from NIST Special Publication 800-38A, 2001 Edition, /* Test vectors from NIST Special Publication 800-38A, 2001 Edition,
* Appendix F.2.5 */ * Appendix F.2.5 */
static const byte msg[] = { const byte msg[] = {
0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96, 0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,
0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a 0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
}; };
static const byte verify[] = const byte verify[] =
{ {
0xf5,0x8c,0x4c,0x04,0xd6,0xe5,0xf1,0xba, 0xf5,0x8c,0x4c,0x04,0xd6,0xe5,0xf1,0xba,
0x77,0x9e,0xab,0xfb,0x5f,0x7b,0xfb,0xd6 0x77,0x9e,0xab,0xfb,0x5f,0x7b,0xfb,0xd6
@@ -9037,7 +9037,7 @@ static int aesgcm_test(void)
* Counter Mode of Operation (GCM) by McGrew and * Counter Mode of Operation (GCM) by McGrew and
* Viega. * Viega.
*/ */
static const byte p[] = const byte p[] =
{ {
0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
@@ -9050,7 +9050,7 @@ static int aesgcm_test(void)
}; };
#if defined(WOLFSSL_AES_256) #if defined(WOLFSSL_AES_256)
static const byte a[] = const byte a[] =
{ {
0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
@@ -9059,7 +9059,7 @@ static int aesgcm_test(void)
#endif #endif
#ifdef WOLFSSL_AES_256 #ifdef WOLFSSL_AES_256
static const byte k1[] = const byte k1[] =
{ {
0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
@@ -9067,13 +9067,13 @@ static int aesgcm_test(void)
0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08
}; };
static const byte iv1[] = const byte iv1[] =
{ {
0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
0xde, 0xca, 0xf8, 0x88 0xde, 0xca, 0xf8, 0x88
}; };
static const byte c1[] = const byte c1[] =
{ {
0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07, 0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07,
0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d, 0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d,
@@ -9086,7 +9086,7 @@ static int aesgcm_test(void)
}; };
#endif /* WOLFSSL_AES_256 */ #endif /* WOLFSSL_AES_256 */
static const byte t1[] = const byte t1[] =
{ {
0x76, 0xfc, 0x6e, 0xce, 0x0f, 0x4e, 0x17, 0x68, 0x76, 0xfc, 0x6e, 0xce, 0x0f, 0x4e, 0x17, 0x68,
0xcd, 0xdf, 0x88, 0x53, 0xbb, 0x2d, 0x55, 0x1b 0xcd, 0xdf, 0x88, 0x53, 0xbb, 0x2d, 0x55, 0x1b
@@ -9104,14 +9104,14 @@ static int aesgcm_test(void)
#define ENABLE_NON_12BYTE_IV_TEST #define ENABLE_NON_12BYTE_IV_TEST
#ifdef WOLFSSL_AES_192 #ifdef WOLFSSL_AES_192
/* Test Case 12, uses same plaintext and AAD data. */ /* Test Case 12, uses same plaintext and AAD data. */
static const byte k2[] = const byte k2[] =
{ {
0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c
}; };
static const byte iv2[] = const byte iv2[] =
{ {
0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5, 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5,
0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa, 0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa,
@@ -9123,7 +9123,7 @@ static int aesgcm_test(void)
0xa6, 0x37, 0xb3, 0x9b 0xa6, 0x37, 0xb3, 0x9b
}; };
static const byte c2[] = const byte c2[] =
{ {
0xd2, 0x7e, 0x88, 0x68, 0x1c, 0xe3, 0x24, 0x3c, 0xd2, 0x7e, 0x88, 0x68, 0x1c, 0xe3, 0x24, 0x3c,
0x48, 0x30, 0x16, 0x5a, 0x8f, 0xdc, 0xf9, 0xff, 0x48, 0x30, 0x16, 0x5a, 0x8f, 0xdc, 0xf9, 0xff,
@@ -9135,7 +9135,7 @@ static int aesgcm_test(void)
0xe9, 0xb7, 0x37, 0x3b 0xe9, 0xb7, 0x37, 0x3b
}; };
static const byte t2[] = const byte t2[] =
{ {
0xdc, 0xf5, 0x66, 0xff, 0x29, 0x1c, 0x25, 0xbb, 0xdc, 0xf5, 0x66, 0xff, 0x29, 0x1c, 0x25, 0xbb,
0xb8, 0x56, 0x8f, 0xc3, 0xd3, 0x76, 0xa6, 0xd9 0xb8, 0x56, 0x8f, 0xc3, 0xd3, 0x76, 0xa6, 0xd9
@@ -9144,36 +9144,36 @@ static int aesgcm_test(void)
#ifdef WOLFSSL_AES_128 #ifdef WOLFSSL_AES_128
/* The following is an interesting test case from the example /* The following is an interesting test case from the example
* FIPS test vectors for AES-GCM. IVlen = 1 byte */ * FIPS test vectors for AES-GCM. IVlen = 1 byte */
static const byte p3[] = const byte p3[] =
{ {
0x57, 0xce, 0x45, 0x1f, 0xa5, 0xe2, 0x35, 0xa5, 0x57, 0xce, 0x45, 0x1f, 0xa5, 0xe2, 0x35, 0xa5,
0x8e, 0x1a, 0xa2, 0x3b, 0x77, 0xcb, 0xaf, 0xe2 0x8e, 0x1a, 0xa2, 0x3b, 0x77, 0xcb, 0xaf, 0xe2
}; };
static const byte k3[] = const byte k3[] =
{ {
0xbb, 0x01, 0xd7, 0x03, 0x81, 0x1c, 0x10, 0x1a, 0xbb, 0x01, 0xd7, 0x03, 0x81, 0x1c, 0x10, 0x1a,
0x35, 0xe0, 0xff, 0xd2, 0x91, 0xba, 0xf2, 0x4b 0x35, 0xe0, 0xff, 0xd2, 0x91, 0xba, 0xf2, 0x4b
}; };
static const byte iv3[] = const byte iv3[] =
{ {
0xca 0xca
}; };
static const byte c3[] = const byte c3[] =
{ {
0x6b, 0x5f, 0xb3, 0x9d, 0xc1, 0xc5, 0x7a, 0x4f, 0x6b, 0x5f, 0xb3, 0x9d, 0xc1, 0xc5, 0x7a, 0x4f,
0xf3, 0x51, 0x4d, 0xc2, 0xd5, 0xf0, 0xd0, 0x07 0xf3, 0x51, 0x4d, 0xc2, 0xd5, 0xf0, 0xd0, 0x07
}; };
static const byte a3[] = const byte a3[] =
{ {
0x40, 0xfc, 0xdc, 0xd7, 0x4a, 0xd7, 0x8b, 0xf1, 0x40, 0xfc, 0xdc, 0xd7, 0x4a, 0xd7, 0x8b, 0xf1,
0x3e, 0x7c, 0x60, 0x55, 0x50, 0x51, 0xdd, 0x54 0x3e, 0x7c, 0x60, 0x55, 0x50, 0x51, 0xdd, 0x54
}; };
static const byte t3[] = const byte t3[] =
{ {
0x06, 0x90, 0xed, 0x01, 0x34, 0xdd, 0xc6, 0x95, 0x06, 0x90, 0xed, 0x01, 0x34, 0xdd, 0xc6, 0x95,
0x31, 0x2e, 0x2a, 0xf9, 0x57, 0x7a, 0x1e, 0xa6 0x31, 0x2e, 0x2a, 0xf9, 0x57, 0x7a, 0x1e, 0xa6