mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
Merge pull request #8898 from cconlon/getpidOptionsH
Add HAVE_GETPID to options.h if getpid detected
This commit is contained in:
@ -160,6 +160,9 @@ fi
|
|||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_CTYPE_H
|
#ifdef HAVE_CTYPE_H
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#endif
|
#endif
|
||||||
@ -10524,6 +10527,12 @@ then
|
|||||||
AM_CFLAGS="$AM_CFLAGS -DHAVE___UINT128_T=1"
|
AM_CFLAGS="$AM_CFLAGS -DHAVE___UINT128_T=1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Add HAVE_GETPID to AM_CFLAGS for inclusion in options.h
|
||||||
|
if test "$ac_cv_func_getpid" = "yes"
|
||||||
|
then
|
||||||
|
AM_CFLAGS="$AM_CFLAGS -DHAVE_GETPID=1"
|
||||||
|
fi
|
||||||
|
|
||||||
LIB_SOCKET_NSL
|
LIB_SOCKET_NSL
|
||||||
AX_HARDEN_CC_COMPILER_FLAGS
|
AX_HARDEN_CC_COMPILER_FLAGS
|
||||||
|
|
||||||
|
@ -25515,7 +25515,7 @@ static int wolfSSL_RAND_InitMutex(void)
|
|||||||
#ifdef OPENSSL_EXTRA
|
#ifdef OPENSSL_EXTRA
|
||||||
|
|
||||||
#if defined(HAVE_GETPID) && !defined(WOLFSSL_NO_GETPID) && \
|
#if defined(HAVE_GETPID) && !defined(WOLFSSL_NO_GETPID) && \
|
||||||
defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0)
|
((defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0)) || defined(HAVE_SELFTEST))
|
||||||
/* In older FIPS bundles add check for reseed here since it does not exist in
|
/* In older FIPS bundles add check for reseed here since it does not exist in
|
||||||
* the older random.c certified files. */
|
* the older random.c certified files. */
|
||||||
static pid_t currentRandPid = 0;
|
static pid_t currentRandPid = 0;
|
||||||
@ -25534,7 +25534,9 @@ int wolfSSL_RAND_Init(void)
|
|||||||
ret = wc_InitRng(&globalRNG);
|
ret = wc_InitRng(&globalRNG);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
#if defined(HAVE_GETPID) && !defined(WOLFSSL_NO_GETPID) && \
|
#if defined(HAVE_GETPID) && !defined(WOLFSSL_NO_GETPID) && \
|
||||||
defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0)
|
((defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0)) || \
|
||||||
|
defined(HAVE_SELFTEST))
|
||||||
|
|
||||||
currentRandPid = getpid();
|
currentRandPid = getpid();
|
||||||
#endif
|
#endif
|
||||||
initGlobalRNG = 1;
|
initGlobalRNG = 1;
|
||||||
@ -26015,7 +26017,8 @@ int wolfSSL_RAND_bytes(unsigned char* buf, int num)
|
|||||||
*/
|
*/
|
||||||
if (initGlobalRNG) {
|
if (initGlobalRNG) {
|
||||||
#if defined(HAVE_GETPID) && !defined(WOLFSSL_NO_GETPID) && \
|
#if defined(HAVE_GETPID) && !defined(WOLFSSL_NO_GETPID) && \
|
||||||
defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0)
|
((defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0)) || \
|
||||||
|
defined(HAVE_SELFTEST))
|
||||||
pid_t p;
|
pid_t p;
|
||||||
|
|
||||||
p = getpid();
|
p = getpid();
|
||||||
|
@ -33212,7 +33212,7 @@ static int test_wolfSSL_RAND_bytes(void)
|
|||||||
|
|
||||||
max_bufsize = size4;
|
max_bufsize = size4;
|
||||||
|
|
||||||
ExpectNotNull(my_buf = (byte*)XMALLOC(max_bufsize * sizeof(byte), NULL,
|
ExpectNotNull(my_buf = (byte*)XMALLOC(max_bufsize * sizeof(byte), HEAP_HINT,
|
||||||
DYNAMIC_TYPE_TMP_BUFFER));
|
DYNAMIC_TYPE_TMP_BUFFER));
|
||||||
|
|
||||||
ExpectIntEQ(RAND_bytes(my_buf, 0), 1);
|
ExpectIntEQ(RAND_bytes(my_buf, 0), 1);
|
||||||
@ -33223,6 +33223,7 @@ static int test_wolfSSL_RAND_bytes(void)
|
|||||||
ExpectIntEQ(RAND_bytes(my_buf, size2), 1);
|
ExpectIntEQ(RAND_bytes(my_buf, size2), 1);
|
||||||
ExpectIntEQ(RAND_bytes(my_buf, size3), 1);
|
ExpectIntEQ(RAND_bytes(my_buf, size3), 1);
|
||||||
ExpectIntEQ(RAND_bytes(my_buf, size4), 1);
|
ExpectIntEQ(RAND_bytes(my_buf, size4), 1);
|
||||||
|
XFREE(my_buf, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
|
|
||||||
#if defined(OPENSSL_EXTRA) && defined(HAVE_GETPID)
|
#if defined(OPENSSL_EXTRA) && defined(HAVE_GETPID)
|
||||||
XMEMSET(seed, 0, sizeof(seed));
|
XMEMSET(seed, 0, sizeof(seed));
|
||||||
@ -33263,8 +33264,6 @@ static int test_wolfSSL_RAND_bytes(void)
|
|||||||
}
|
}
|
||||||
RAND_cleanup();
|
RAND_cleanup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XFREE(my_buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
|
||||||
#endif
|
#endif
|
||||||
return EXPECT_RESULT();
|
return EXPECT_RESULT();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user