Go to the documentation of this file.
19 #include <gtest/gtest.h>
24 #include "../fipsmodule/rand/fork_detect.h"
25 #include "../fipsmodule/rand/internal.h"
26 #include "../test/abi_test.h"
27 #include "../test/test_util.h"
29 #if defined(OPENSSL_THREADS)
35 #if !defined(OPENSSL_WINDOWS)
37 #include <sys/types.h>
46 TEST(RandTest, NotObviouslyBroken) {
47 static const uint8_t kZeros[256] = {0};
58 #if !defined(OPENSSL_WINDOWS) && !defined(OPENSSL_IOS) && \
59 !defined(OPENSSL_FUCHSIA) && !defined(BORINGSSL_UNSAFE_DETERMINISTIC_MODE)
62 if (pipe(pipefds) < 0) {
81 while (!
out.empty()) {
90 out =
out.subspan(
static_cast<size_t>(
ret));
97 while (!
out.empty()) {
101 fprintf(
stderr,
"Unexpected EOF from child.\n");
103 if (errno == EINTR) {
111 out =
out.subspan(
static_cast<size_t>(
ret));
122 fprintf(
stderr,
"Child did not exit cleanly.\n");
130 static const uint8_t kZeros[16] = {0};
153 #endif // !OPENSSL_WINDOWS && !OPENSSL_IOS &&
156 #if defined(OPENSSL_THREADS)
157 static void RunConcurrentRands(
size_t num_threads) {
158 static const uint8_t kZeros[256] = {0};
180 TEST(RandTest, Threads) {
181 constexpr
size_t kFewerThreads = 10;
182 constexpr
size_t kMoreThreads = 20;
185 RunConcurrentRands(kFewerThreads);
187 RunConcurrentRands(kMoreThreads);
189 RunConcurrentRands(kFewerThreads);
191 #endif // OPENSSL_THREADS
193 #if defined(OPENSSL_X86_64) && defined(SUPPORTS_ABI_TEST)
194 TEST(RandTest, RdrandABI) {
196 fprintf(
stderr,
"rdrand not supported. Skipping.\n");
208 #endif // OPENSSL_X86_64 && SUPPORTS_ABI_TEST
static uv_thread_t * threads
#define CRYPTO_rdrand_multiple8_buf
#define EXPECT_NE(val1, val2)
TEST(RandTest, NotObviouslyBroken)
OPENSSL_INLINE int have_rdrand(void)
#define CHECK_ABI_SEH(...)
int read(izstream &zs, T *x, Items items)
UniquePtr< SSL_SESSION > ret
static volatile int num_threads
#define ASSERT_TRUE(condition)
static bool ForkAndRand(bssl::Span< uint8_t > out)
static uv_thread_t thread
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:59