mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
AES-GCM
1. Updated the wolfCrypt GMAC test to leave out the test case with the 15-byte tag when building for FIPS. 2. Replace tabs with spaces.
This commit is contained in:
@ -30,7 +30,7 @@
|
|||||||
#if !defined(NO_AES)
|
#if !defined(NO_AES)
|
||||||
|
|
||||||
#if defined(HAVE_FIPS) && \
|
#if defined(HAVE_FIPS) && \
|
||||||
defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
|
defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
|
||||||
|
|
||||||
/* set NO_WRAPPERS before headers, use direct internal f()s not wrappers */
|
/* set NO_WRAPPERS before headers, use direct internal f()s not wrappers */
|
||||||
#define FIPS_NO_WRAPPERS
|
#define FIPS_NO_WRAPPERS
|
||||||
@ -188,7 +188,7 @@
|
|||||||
|
|
||||||
/* AES-CCM */
|
/* AES-CCM */
|
||||||
#if defined(HAVE_AESCCM) && \
|
#if defined(HAVE_AESCCM) && \
|
||||||
defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
|
defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
|
||||||
int wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz)
|
int wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz)
|
||||||
{
|
{
|
||||||
return AesCcmSetKey(aes, key, keySz);
|
return AesCcmSetKey(aes, key, keySz);
|
||||||
|
@ -6673,6 +6673,9 @@ int gmac_test(void)
|
|||||||
0xaa, 0x10, 0xf1, 0x6d, 0x22, 0x7d, 0xc4, 0x1b
|
0xaa, 0x10, 0xf1, 0x6d, 0x22, 0x7d, 0xc4, 0x1b
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined(HAVE_FIPS)
|
||||||
|
/* FIPS builds only allow 16-byte auth tags. */
|
||||||
|
/* This sample uses a 15-byte auth tag. */
|
||||||
const byte k2[] =
|
const byte k2[] =
|
||||||
{
|
{
|
||||||
0x40, 0xf7, 0xec, 0xb2, 0x52, 0x6d, 0xaa, 0xd4,
|
0x40, 0xf7, 0xec, 0xb2, 0x52, 0x6d, 0xaa, 0xd4,
|
||||||
@ -6693,6 +6696,7 @@ int gmac_test(void)
|
|||||||
0xc6, 0x81, 0x79, 0x8e, 0x3d, 0xda, 0xb0, 0x9f,
|
0xc6, 0x81, 0x79, 0x8e, 0x3d, 0xda, 0xb0, 0x9f,
|
||||||
0x8d, 0x83, 0xb0, 0xbb, 0x14, 0xb6, 0x91
|
0x8d, 0x83, 0xb0, 0xbb, 0x14, 0xb6, 0x91
|
||||||
};
|
};
|
||||||
|
#endif /* HAVE_FIPS */
|
||||||
|
|
||||||
byte tag[16];
|
byte tag[16];
|
||||||
|
|
||||||
@ -6703,11 +6707,13 @@ int gmac_test(void)
|
|||||||
if (XMEMCMP(t1, tag, sizeof(t1)) != 0)
|
if (XMEMCMP(t1, tag, sizeof(t1)) != 0)
|
||||||
return -4400;
|
return -4400;
|
||||||
|
|
||||||
|
#if !defined(HAVE_FIPS)
|
||||||
XMEMSET(tag, 0, sizeof(tag));
|
XMEMSET(tag, 0, sizeof(tag));
|
||||||
wc_GmacSetKey(&gmac, k2, sizeof(k2));
|
wc_GmacSetKey(&gmac, k2, sizeof(k2));
|
||||||
wc_GmacUpdate(&gmac, iv2, sizeof(iv2), a2, sizeof(a2), tag, sizeof(t2));
|
wc_GmacUpdate(&gmac, iv2, sizeof(iv2), a2, sizeof(a2), tag, sizeof(t2));
|
||||||
if (XMEMCMP(t2, tag, sizeof(t2)) != 0)
|
if (XMEMCMP(t2, tag, sizeof(t2)) != 0)
|
||||||
return -4401;
|
return -4401;
|
||||||
|
#endif /* HAVE_FIPS */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user