Skip to content

Commit 183d9b4

Browse files
authored
Merge pull request #8509 from kaleb-himes/WCv6.0.0-RC4-CHECKIN
Disable XTS-384 as an allowed use in FIPS mode
2 parents c290907 + 738462a commit 183d9b4

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

fips-check.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ linuxv5|linuxv5.2.1)
240240
)
241241
;;
242242
v6.0.0)
243-
WOLF_REPO_TAG='WCv6.0.0-RC3'
243+
WOLF_REPO_TAG='WCv6.0.0-RC4'
244244
FIPS_REPO_TAG='WCv6.0.0-RC4'
245-
ASM_PICKUPS_TAG='WCv6.0.0-RC3'
245+
ASM_PICKUPS_TAG='WCv6.0.0-RC4'
246246
FIPS_OPTION='v6'
247247
FIPS_FILES=(
248248
"wolfcrypt/src/fips.c:${FIPS_REPO_TAG}"

wolfcrypt/src/aes.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12818,7 +12818,12 @@ int wc_AesXtsSetKeyNoInit(XtsAes* aes, const byte* key, word32 len, int dir)
1281812818
}
1281912819

1282012820
if ((len != (AES_128_KEY_SIZE*2)) &&
12821+
#ifndef HAVE_FIPS
12822+
/* XTS-384 not allowed by FIPS and can not be treated like
12823+
* RSA-4096 bit keys back in the day, can not vendor affirm
12824+
* the use of 2 concatenated 192-bit keys (XTS-384) */
1282112825
(len != (AES_192_KEY_SIZE*2)) &&
12826+
#endif
1282212827
(len != (AES_256_KEY_SIZE*2)))
1282312828
{
1282412829
WOLFSSL_MSG("Unsupported key size");

wolfcrypt/test/test.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11613,6 +11613,8 @@ static wc_test_ret_t aes_xts_128_test(void)
1161311613
}
1161411614
#endif /* WOLFSSL_AES_128 */
1161511615

11616+
#ifndef HAVE_FIPS
11617+
/* FIPS won't allow for XTS-384 (two 192-bit keys) */
1161611618
#ifdef WOLFSSL_AES_192
1161711619
static wc_test_ret_t aes_xts_192_test(void)
1161811620
{
@@ -11703,7 +11705,6 @@ static wc_test_ret_t aes_xts_192_test(void)
1170311705
0x65, 0x37, 0x15, 0x53, 0xf1, 0x98, 0xab, 0xb4
1170411706
};
1170511707

11706-
#ifndef HAVE_FIPS /* FIPS requires different keys for main and tweak. */
1170711708
WOLFSSL_SMALL_STACK_STATIC unsigned char k3[] = {
1170811709
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1170911710
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
@@ -11730,7 +11731,6 @@ static wc_test_ret_t aes_xts_192_test(void)
1173011731
0xe8, 0xc5, 0x99, 0x3d, 0x58, 0x3c, 0xeb, 0xba,
1173111732
0x86, 0xea, 0x2c, 0x7e, 0x1f, 0xba, 0x81, 0xde
1173211733
};
11733-
#endif /* HAVE_FIPS */
1173411734

1173511735
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
1173611736
if ((aes = (XtsAes *)XMALLOC(sizeof *aes, HEAP_HINT, DYNAMIC_TYPE_AES)) == NULL)
@@ -12045,8 +12045,6 @@ static wc_test_ret_t aes_xts_192_test(void)
1204512045
if (XMEMCMP(p2, buf, sizeof(p2)))
1204612046
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
1204712047

12048-
#ifndef HAVE_FIPS
12049-
1205012048
/* Test ciphertext stealing in-place. */
1205112049
XMEMCPY(buf, p3, sizeof(p3));
1205212050
ret = wc_AesXtsSetKeyNoInit(aes, k3, sizeof(k3), AES_ENCRYPTION);
@@ -12130,8 +12128,6 @@ static wc_test_ret_t aes_xts_192_test(void)
1213012128
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
1213112129
#endif /* WOLFSSL_AESXTS_STREAM */
1213212130

12133-
#endif /* !HAVE_FIPS */
12134-
1213512131
#if !defined(BENCH_EMBEDDED) && !defined(HAVE_CAVIUM) && \
1213612132
!defined(WOLFSSL_AFALG)
1213712133
{
@@ -12316,7 +12312,7 @@ static wc_test_ret_t aes_xts_192_test(void)
1231612312
return ret;
1231712313
}
1231812314
#endif /* WOLFSSL_AES_192 */
12319-
12315+
#endif /* HAVE_FIPS */
1232012316

1232112317
#ifdef WOLFSSL_AES_256
1232212318
static wc_test_ret_t aes_xts_256_test(void)
@@ -14665,11 +14661,14 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_xts_test(void)
1466514661
return ret;
1466614662
#endif
1466714663

14664+
/* FIPS won't allow for XTS-384 (two 192-bit keys) */
14665+
#ifndef HAVE_FIPS
1466814666
#ifdef WOLFSSL_AES_192
1466914667
ret = aes_xts_192_test();
1467014668
if (ret != 0)
1467114669
return ret;
1467214670
#endif
14671+
#endif
1467314672

1467414673
#ifdef WOLFSSL_AES_256
1467514674
ret = aes_xts_256_test();

0 commit comments

Comments
 (0)