Skip to content

Commit 9686620

Browse files
Merge remote-tracking branch 'upstream/master' into zd20936
2 parents 2d4e589 + 52ee001 commit 9686620

File tree

18 files changed

+315
-45
lines changed

18 files changed

+315
-45
lines changed

ChangeLog.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ PR stands for Pull Request, and PR <NUMBER> references a GitHub pull request num
2929

3030
* [Low CVE-2025-12889] With TLS 1.2 connections a client can use any digest, specifically a weaker digest, rather than those in the CertificateRequest. Thanks to Jaehun Lee from Pohang University of Science and Technology (POSTECH) for the report. Fixed in PR 9395
3131

32+
* [Low CVE-2025-13912] When using the Clang compiler, various optimization levels or flags could result in non-constant-time compiled code. Assembly implementations of the functions in wolfSSL were not affected. The report was done specifically with Clang version 18 but there was shown to be similarities in timing variations when using the optimization levels with Clang 14 and Clang 20.
33+
34+
On the following architectures, the expected constant-time functions were found to have potential timing variations when specific compiler flags or optimization levels were used.
35+
36+
AArch64: Using O3, Ofast, or --enable-nontrivial-unswitch with O1/O2 flags leads to possible timing variations with the software implementations of sp_read_radix, sp_div_2_mod_ct, and sp_addmod_ct. Using O3, O2, Ofast, Os, or Oz with --unroll-force-peel-count=50 leads to possible timing variations with wc_AesGcmDecrypt.
37+
38+
RISC-V: TLS HMAC update/final operations, RSA unpad operations, and DH key pair generation with O1, O2, O3, Ofast, Oz, or Os. wc_AesGcmDecrypt and wc_Chacha_Process with O1, O2, O3, Os, or Ofast. Also SP software operations sp_div_2_mod_ct and sp_addmod_ct using O3 or Ofast.
39+
40+
41+
X86_64: TLS HMAC update/final operations and TimingVerifyPad used with verifying the TLS MAC with --fast-isel or --x86-cmov-converter-force-all compile flags. RSA unpad operations, ECC mulmod, and wc_Chacha_Process with the --x86-cmov-converter-force-all flag. DH key agreement, sp_div_2_mod_ct and sp_addmod_ct with O1, O2, O3, Os, or Ofast. wc_AesGcmDecrypt with the compiler flags O2, O3, Os, Ofast, Oz --x86-cmov-converter-force-all | --unroll-force-peel-count=50, or O1 --x86-cmov-converter-force-all.
42+
43+
Thanks to Jing Liu, Zhiyuan Zhang, LUCÍA MARTÍNEZ GAVIER, Gilles Barthe, Marcel Böhme from Max Planck Institute for Security and Privacy (MPI-SP) for the report. Fixed in PR 9148.
44+
3245
## New Features
3346
* New ML-KEM / ML-DSA APIs and seed/import PKCS8 support; added _new/_delete APIs for ML-KEM/ML-DSA. (PR 9039, 9000, 9049)
3447
* Initial wolfCrypt FreeBSD kernel module support (PR 9392)

README

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ PR stands for Pull Request, and PR <NUMBER> references a GitHub pull request num
106106

107107
* [Low CVE-2025-12889] With TLS 1.2 connections a client can use any digest, specifically a weaker digest, rather than those in the CertificateRequest. Thanks to Jaehun Lee from Pohang University of Science and Technology (POSTECH) for the report. Fixed in PR 9395
108108

109+
* [Low CVE-2025-13912] When using the Clang compiler, various optimization levels or flags could result in non-constant-time compiled code. Assembly implementations of the functions in wolfSSL were not affected. The report was done specifically with Clang version 18 but there was shown to be similarities in timing variations when using the optimization levels with Clang 14 and Clang 20.
110+
111+
On the following architectures, the expected constant-time functions were found to have potential timing variations when specific compiler flags or optimization levels were used.
112+
113+
AArch64: Using O3, Ofast, or --enable-nontrivial-unswitch with O1/O2 flags leads to possible timing variations with the software implementations of sp_read_radix, sp_div_2_mod_ct, and sp_addmod_ct. Using O3, O2, Ofast, Os, or Oz with --unroll-force-peel-count=50 leads to possible timing variations with wc_AesGcmDecrypt.
114+
115+
RISC-V: TLS HMAC update/final operations, RSA unpad operations, and DH key pair generation with O1, O2, O3, Ofast, Oz, or Os. wc_AesGcmDecrypt and wc_Chacha_Process with O1, O2, O3, Os, or Ofast. Also SP software operations sp_div_2_mod_ct and sp_addmod_ct using O3 or Ofast.
116+
117+
118+
X86_64: TLS HMAC update/final operations and TimingVerifyPad used with verifying the TLS MAC with --fast-isel or --x86-cmov-converter-force-all compile flags. RSA unpad operations, ECC mulmod, and wc_Chacha_Process with the --x86-cmov-converter-force-all flag. DH key agreement, sp_div_2_mod_ct and sp_addmod_ct with O1, O2, O3, Os, or Ofast. wc_AesGcmDecrypt with the compiler flags O2, O3, Os, Ofast, Oz --x86-cmov-converter-force-all | --unroll-force-peel-count=50, or O1 --x86-cmov-converter-force-all.
119+
120+
Thanks to Jing Liu, Zhiyuan Zhang, LUCÍA MARTÍNEZ GAVIER, Gilles Barthe, Marcel Böhme from Max Planck Institute for Security and Privacy (MPI-SP) for the report. Fixed in PR 9148.
121+
109122
## New Features
110123
* New ML-KEM / ML-DSA APIs and seed/import PKCS8 support; added _new/_delete APIs for ML-KEM/ML-DSA. (PR 9039, 9000, 9049)
111124
* Initial wolfCrypt FreeBSD kernel module support (PR 9392)

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ PR stands for Pull Request, and PR <NUMBER> references a GitHub pull request num
111111
112112
* [Low CVE-2025-12889] With TLS 1.2 connections a client can use any digest, specifically a weaker digest, rather than those in the CertificateRequest. Thanks to Jaehun Lee from Pohang University of Science and Technology (POSTECH) for the report. Fixed in PR 9395
113113
114+
* [Low CVE-2025-13912] When using the Clang compiler, various optimization levels or flags could result in non-constant-time compiled code. Assembly implementations of the functions in wolfSSL were not affected. The report was done specifically with Clang version 18 but there was shown to be similarities in timing variations when using the optimization levels with Clang 14 and Clang 20.
115+
116+
On the following architectures, the expected constant-time functions were found to have potential timing variations when specific compiler flags or optimization levels were used.
117+
118+
AArch64: Using O3, Ofast, or --enable-nontrivial-unswitch with O1/O2 flags leads to possible timing variations with the software implementations of sp_read_radix, sp_div_2_mod_ct, and sp_addmod_ct. Using O3, O2, Ofast, Os, or Oz with --unroll-force-peel-count=50 leads to possible timing variations with wc_AesGcmDecrypt.
119+
120+
RISC-V: TLS HMAC update/final operations, RSA unpad operations, and DH key pair generation with O1, O2, O3, Ofast, Oz, or Os. wc_AesGcmDecrypt and wc_Chacha_Process with O1, O2, O3, Os, or Ofast. Also SP software operations sp_div_2_mod_ct and sp_addmod_ct using O3 or Ofast.
121+
122+
123+
X86_64: TLS HMAC update/final operations and TimingVerifyPad used with verifying the TLS MAC with --fast-isel or --x86-cmov-converter-force-all compile flags. RSA unpad operations, ECC mulmod, and wc_Chacha_Process with the --x86-cmov-converter-force-all flag. DH key agreement, sp_div_2_mod_ct and sp_addmod_ct with O1, O2, O3, Os, or Ofast. wc_AesGcmDecrypt with the compiler flags O2, O3, Os, Ofast, Oz --x86-cmov-converter-force-all | --unroll-force-peel-count=50, or O1 --x86-cmov-converter-force-all.
124+
125+
Thanks to Jing Liu, Zhiyuan Zhang, LUCÍA MARTÍNEZ GAVIER, Gilles Barthe, Marcel Böhme from Max Planck Institute for Security and Privacy (MPI-SP) for the report. Fixed in PR 9148.
126+
114127
## New Features
115128
* New ML-KEM / ML-DSA APIs and seed/import PKCS8 support; added _new/_delete APIs for ML-KEM/ML-DSA. (PR 9039, 9000, 9049)
116129
* Initial wolfCrypt FreeBSD kernel module support (PR 9392)

doc/dox_comments/header_files-ja/ssl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3796,7 +3796,6 @@ int wolfSSL_BIO_ctrl_reset_read_request(WOLFSSL_BIO *bio);
37963796
\endcode
37973797

37983798
\sa wolfSSL_BIO_new
3799-
\sa wolfSSL_BIO_nwrite0
38003799
*/
38013800
int wolfSSL_BIO_nread0(WOLFSSL_BIO *bio, char **buf);
38023801

doc/dox_comments/header_files/srp.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ int wc_SrpSetPrivate(Srp* srp, const byte* priv, word32 size);
340340
This function MUST be called after wc_SrpSetPassword or wc_SrpSetVerifier.
341341
The function wc_SrpSetPrivate may be called before wc_SrpGetPublic.
342342
343+
Caller must observe value of size upon return to know the actual size.
344+
343345
\return 0 Success
344346
\return BAD_FUNC_ARG Returned if srp, pub, or size is null.
345347
\return SRP_CALL_ORDER_E Returned if wc_SrpGetPublic is called out
@@ -349,8 +351,8 @@ int wc_SrpSetPrivate(Srp* srp, const byte* priv, word32 size);
349351
350352
\param srp the Srp structure.
351353
\param pub the buffer to write the public ephemeral value.
352-
\param size the the buffer size in bytes. Will be updated with
353-
the ephemeral value size.
354+
\param size IN: the buffer size in bytes.
355+
OUT: Will be updated with the ephemeral value size.
354356
355357
_Example_
356358
\code
@@ -369,7 +371,7 @@ int wc_SrpSetPrivate(Srp* srp, const byte* priv, word32 size);
369371
wc_SrpSetPassword(&srp, password, passwordSize)
370372
371373
byte public[64];
372-
word32 publicSz = 0;
374+
word32 publicSz = sizeof(public);
373375
374376
if( wc_SrpGetPublic(&srp, public, &publicSz) != 0)
375377
{

doc/dox_comments/header_files/ssl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4671,7 +4671,6 @@ int wolfSSL_BIO_ctrl_reset_read_request(WOLFSSL_BIO *b);
46714671
\endcode
46724672
46734673
\sa wolfSSL_BIO_new
4674-
\sa wolfSSL_BIO_nwrite0
46754674
*/
46764675
int wolfSSL_BIO_nread0(WOLFSSL_BIO *bio, char **buf);
46774676

fips-check.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@ Usage() {
3131
cat <<usageText
3232
Usage: $0 [flavor] [keep] [nomakecheck] [nodoconfigure] [noautogen]
3333
Flavor is one of:
34-
linuxv2 (FIPSv2, use for Win10)
35-
fipsv2-OE-ready (ready FIPSv2)
34+
linuxv2 (FIPSv2, use for Win10)
35+
fipsv2-OE-ready (ready FIPSv2)
3636
solaris
3737
netbsd-selftest
3838
marvell-linux-selftest
39-
linuxv5 (current FIPS 140-3)
40-
fips-ready (ready FIPS 140-3)
41-
fips-dev (dev FIPS 140-3)
39+
linuxv5 (current FIPS 140-3 [v5.2.1])
40+
linuxv5-RC12 (current FIPS 140-3 [v5.2.0.1])
41+
fips-ready (ready FIPS 140-3)
42+
fips-dev (dev FIPS 140-3)
4243
wolfrand
4344
wolfentropy
44-
v6.0.0
45+
v6.0.0 (pending FIPS 140-3 [v6.0.0])
46+
4547
keep: (default off) retains the temp dir $TEST_DIR for inspection.
4648
nomakecheck: (default off) don't run make check
4749
nodoconfigure: (default off) don't run configure
@@ -670,10 +672,12 @@ if [ "$DOCONFIGURE" = "yes" ]; then
670672
fi
671673

672674
if [ -s wolfcrypt/src/fips_test.c ]; then
673-
NEWHASH=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
675+
OUT=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
676+
NEWHASH=$(echo "$OUT" | cut -c1-64)
674677
if [ -n "$NEWHASH" ]; then
675678
cp wolfcrypt/src/fips_test.c wolfcrypt/src/fips_test.c.bak
676-
sed "s/^\".*\";/\"${NEWHASH}\";/" wolfcrypt/src/fips_test.c.bak >wolfcrypt/src/fips_test.c
679+
sed "s/^\".*\";/\"${NEWHASH}\";/" wolfcrypt/src/fips_test.c.bak > \
680+
wolfcrypt/src/fips_test.c
677681
make clean
678682
fi
679683
fi

fips-hash.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ then
1212
exit 1
1313
fi
1414

15-
NEWHASH=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
15+
OUT=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
16+
NEWHASH=$(echo "$OUT" | cut -c1-64)
1617
if test -n "$NEWHASH"
1718
then
1819
cp wolfcrypt/src/fips_test.c wolfcrypt/src/fips_test.c.bak

src/internal.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13204,6 +13204,10 @@ int CheckHostName(DecodedCert* dCert, const char *domainName,
1320413204
int checkCN;
1320513205
int ret = WC_NO_ERR_TRACE(DOMAIN_NAME_MISMATCH);
1320613206

13207+
if (dCert == NULL) {
13208+
return BAD_FUNC_ARG;
13209+
}
13210+
1320713211
if (CheckForAltNames(dCert, domainName, (word32)domainNameLen,
1320813212
&checkCN, flags, isIP) != 1) {
1320913213
ret = DOMAIN_NAME_MISMATCH;

src/tls.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16567,15 +16567,18 @@ int TLSX_Parse(WOLFSSL* ssl, const byte* input, word16 length, byte msgType,
1656716567
* contain SupportedGroups and vice-versa. */
1656816568
if (IsAtLeastTLSv1_3(ssl->version) && msgType == client_hello && isRequest) {
1656916569
int hasKeyShare = !IS_OFF(seenType, TLSX_ToSemaphore(TLSX_KEY_SHARE));
16570-
int hasSupportedGroups = !IS_OFF(seenType, TLSX_ToSemaphore(TLSX_SUPPORTED_GROUPS));
16570+
int hasSupportedGroups = !IS_OFF(seenType,
16571+
TLSX_ToSemaphore(TLSX_SUPPORTED_GROUPS));
1657116572

1657216573
if (hasKeyShare && !hasSupportedGroups) {
16573-
WOLFSSL_MSG("ClientHello with KeyShare extension missing required SupportedGroups extension");
16574-
return MISSING_HANDSHAKE_DATA;
16574+
WOLFSSL_MSG("ClientHello with KeyShare extension missing required "
16575+
"SupportedGroups extension");
16576+
return INCOMPLETE_DATA;
1657516577
}
1657616578
if (hasSupportedGroups && !hasKeyShare) {
16577-
WOLFSSL_MSG("ClientHello with SupportedGroups extension missing required KeyShare extension");
16578-
return MISSING_HANDSHAKE_DATA;
16579+
WOLFSSL_MSG("ClientHello with SupportedGroups extension missing "
16580+
"required KeyShare extension");
16581+
return INCOMPLETE_DATA;
1657916582
}
1658016583
}
1658116584
#endif

0 commit comments

Comments
 (0)