Skip to content

Commit 1c9555c

Browse files
authored
Merge pull request wolfSSL#10324 from douzzer/20260426-fixes
20260426-fixes
2 parents 3181e2b + 66ea4da commit 1c9555c

7 files changed

Lines changed: 162 additions & 22 deletions

File tree

.wolfssl_known_macro_extras

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ WC_RSA_NONBLOCK_TIME
670670
WC_RSA_NO_FERMAT_CHECK
671671
WC_RWLOCK_OPS_INLINE
672672
WC_SKIP_INCLUDED_C_FILES
673+
WC_SLHDSA_VERBOSE_DEBUG
673674
WC_SSIZE_TYPE
674675
WC_STRICT_SIG
675676
WC_USE_PIE_FENCEPOSTS_FOR_FIPS
@@ -1018,9 +1019,11 @@ __ATOMIC_CONSUME
10181019
__ATOMIC_RELAXED
10191020
__AVR_ARCH__
10201021
__AVR__
1022+
__AVX512F__
10211023
__BCPLUSPLUS__
10221024
__BIG_ENDIAN__
10231025
__BORLANDC__
1026+
__BSD_VISIBLE
10241027
__CCRX__
10251028
__CC_ARM
10261029
__COMPILER_VER__

wolfcrypt/benchmark/benchmark.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3339,6 +3339,12 @@ static void bench_stats_ops_finish(const char* algo, int strength,
33393339

33403340
(void)ret;
33413341

3342+
#if defined(WOLFSSL_USE_SAVE_VECTOR_REGISTERS)
3343+
RESTORE_VECTOR_REGISTERS();
3344+
#elif defined(WOLFSSL_LINUXKM)
3345+
kernel_fpu_end();
3346+
#endif
3347+
33423348
bench_stats_prepare();
33433349
TEST_SLEEP();
33443350
} /* bench_stats_ops_finish */

wolfcrypt/src/random.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,8 +1058,16 @@ static int Hash512_df(DRBG_SHA512_internal* drbg, byte* out, word32 outSz,
10581058
byte* digest = drbg->digest_scratch;
10591059
#elif defined(WOLFSSL_SMALL_STACK)
10601060
byte* digest;
1061+
#else
1062+
#if defined(__GNUC__) && !defined(__clang__) && defined(__AVX512F__)
1063+
/* Use a jumbo alignment to work around a gcc compiler/optimizer bug that
1064+
* assumes AVX512 alignment in an object sized correctly for AVX512 passed
1065+
* to builtin memcpy(), which promptly crashes if not thus aligned.
1066+
*/
1067+
byte digest[WC_SHA512_DIGEST_SIZE] WOLFSSL_ALIGN(WC_SHA512_DIGEST_SIZE);
10611068
#else
10621069
byte digest[WC_SHA512_DIGEST_SIZE];
1070+
#endif
10631071
#endif
10641072

10651073
if (drbg == NULL) {
@@ -1135,6 +1143,12 @@ static int Hash512_df(DRBG_SHA512_internal* drbg, byte* out, word32 outSz,
11351143
XFREE(digest, drbg->heap, DYNAMIC_TYPE_DIGEST);
11361144
#endif
11371145

1146+
#ifdef WC_VERBOSE_RNG
1147+
if (ret != 0)
1148+
WOLFSSL_DEBUG_PRINTF("ERROR: %s failed with err = %d", __FUNCTION__,
1149+
ret);
1150+
#endif
1151+
11381152
return (ret == 0) ? DRBG_SUCCESS : DRBG_FAILURE;
11391153
}
11401154

wolfcrypt/src/wc_lms.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ static const wc_LmsParamsMap wc_lms_map[] = {
521521
#endif
522522
#endif /* !WOLFSSL_NO_LMS_SHAKE256_256 */
523523

524-
#ifdef WOLFSSL_LMS_SHAKE256
525524
/* SHAKE256/192 L1 H5 */
526525
{ WC_LMS_PARM_SHAKE192_L1_H5_W1 , "LMS/HSS_SHAKE256/192_L1_H5_W1",
527526
LMS_PARAMS(1, 5, 1, 2, LMS_SHAKE_M24_H5 , LMOTS_SHAKE_N24_W1,
@@ -595,7 +594,6 @@ static const wc_LmsParamsMap wc_lms_map[] = {
595594
LMS_PARAMS(1, 25, 8, 4, LMS_SHAKE_M24_H25, LMOTS_SHAKE_N24_W8,
596595
WC_SHA256_192_DIGEST_SIZE) },
597596
#endif
598-
#endif /* WOLFSSL_LMS_SHAKE256 (M24 entries) */
599597
#endif /* WOLFSSL_LMS_SHAKE256 */
600598
};
601599
/* Number of parameter sets supported. */

wolfcrypt/src/wc_port.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
!defined(WOLFSSL_LINUXKM) && !defined(WOLFSSL_ZEPHYR) && \
2424
!defined(_GNU_SOURCE)
2525
#define _GNU_SOURCE 1
26+
#elif defined(__FreeBSD__)
27+
/* for __FreeBSD_version */
28+
#include <sys/param.h>
2629
#endif
2730

2831
/*
@@ -5210,7 +5213,9 @@ int wc_socket_cloexec(int domain, int type, int protocol)
52105213
int wc_accept_cloexec(int sockfd, void* addr, void* addrlen)
52115214
{
52125215
int fd;
5213-
#if defined(__linux__) || defined(__ANDROID__)
5216+
#if (defined(__USE_GNU) && (defined(__linux__) || defined(__ANDROID__))) || \
5217+
(defined(__FreeBSD__) && defined(__BSD_VISIBLE) && __BSD_VISIBLE && \
5218+
(__FreeBSD_version >= 1000000))
52145219
fd = accept4(sockfd, (struct sockaddr*)addr, (socklen_t*)addrlen,
52155220
SOCK_CLOEXEC);
52165221
if (fd >= 0)

0 commit comments

Comments
 (0)