diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2021-03-08 19:17:53 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2021-03-18 17:52:37 +1000 |
commit | 1335ca4b0799d1714a2f8e21525cb23edf660e93 (patch) | |
tree | 721491aee8abff6f8e10761bc8a1f3edaf0a3eb7 /providers/implementations | |
parent | 9500c8234d8e99396717b9e43f10cc518e8bf668 (diff) |
Add ossl_rand symbols
Partial fix for #12964
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14473)
Diffstat (limited to 'providers/implementations')
-rw-r--r-- | providers/implementations/include/prov/seeding.h | 11 | ||||
-rw-r--r-- | providers/implementations/rands/seed_src.c | 6 | ||||
-rw-r--r-- | providers/implementations/rands/seeding/rand_cpu_x86.c | 10 | ||||
-rw-r--r-- | providers/implementations/rands/seeding/rand_tsc.c | 6 | ||||
-rw-r--r-- | providers/implementations/rands/seeding/rand_unix.c | 66 | ||||
-rw-r--r-- | providers/implementations/rands/seeding/rand_vms.c | 28 | ||||
-rw-r--r-- | providers/implementations/rands/seeding/rand_vxworks.c | 22 | ||||
-rw-r--r-- | providers/implementations/rands/seeding/rand_win.c | 42 |
8 files changed, 93 insertions, 98 deletions
diff --git a/providers/implementations/include/prov/seeding.h b/providers/implementations/include/prov/seeding.h index 448ff0366b..b7480e7c42 100644 --- a/providers/implementations/include/prov/seeding.h +++ b/providers/implementations/include/prov/seeding.h @@ -11,13 +11,8 @@ #include "crypto/rand_pool.h" /* Hardware-based seeding functions. */ -size_t prov_acquire_entropy_from_tsc(RAND_POOL *pool); -size_t prov_acquire_entropy_from_cpu(RAND_POOL *pool); - -/* DRBG entropy callbacks. */ -size_t prov_drbg_get_additional_data(RAND_POOL *pool, unsigned char **pout); - -void prov_drbg_cleanup_additional_data(RAND_POOL *pool, unsigned char *out); +size_t ossl_prov_acquire_entropy_from_tsc(RAND_POOL *pool); +size_t ossl_prov_acquire_entropy_from_cpu(RAND_POOL *pool); /* * Add some platform specific additional data @@ -28,7 +23,7 @@ void prov_drbg_cleanup_additional_data(RAND_POOL *pool, unsigned char *out); * * Returns 1 on success and 0 on failure. */ -int rand_pool_add_additional_data(RAND_POOL *pool); +int ossl_rand_pool_add_additional_data(RAND_POOL *pool); /* * External seeding functions from the core dispatch table. diff --git a/providers/implementations/rands/seed_src.c b/providers/implementations/rands/seed_src.c index ad315efb9b..173c99ce17 100644 --- a/providers/implementations/rands/seed_src.c +++ b/providers/implementations/rands/seed_src.c @@ -104,7 +104,7 @@ static int seed_src_generate(void *vseed, unsigned char *out, size_t outlen, return 0; } - pool = rand_pool_new(strength, 1, outlen, outlen); + pool = ossl_rand_pool_new(strength, 1, outlen, outlen); if (pool == NULL) { ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE); return 0; @@ -114,9 +114,9 @@ static int seed_src_generate(void *vseed, unsigned char *out, size_t outlen, entropy_available = ossl_pool_acquire_entropy(pool); if (entropy_available > 0) - memcpy(out, rand_pool_buffer(pool), rand_pool_length(pool)); + memcpy(out, ossl_rand_pool_buffer(pool), ossl_rand_pool_length(pool)); - rand_pool_free(pool); + ossl_rand_pool_free(pool); return entropy_available > 0; } diff --git a/providers/implementations/rands/seeding/rand_cpu_x86.c b/providers/implementations/rands/seeding/rand_cpu_x86.c index 0b163571f1..0bdf1c302f 100644 --- a/providers/implementations/rands/seeding/rand_cpu_x86.c +++ b/providers/implementations/rands/seeding/rand_cpu_x86.c @@ -40,20 +40,20 @@ size_t prov_acquire_entropy_from_cpu(RAND_POOL *pool) size_t bytes_needed; unsigned char *buffer; - bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); if (bytes_needed > 0) { - buffer = rand_pool_add_begin(pool, bytes_needed); + buffer = ossl_rand_pool_add_begin(pool, bytes_needed); if (buffer != NULL) { if (get_hardware_random_value(buffer, bytes_needed) == bytes_needed) { - rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed); + ossl_rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed); } else { - rand_pool_add_end(pool, 0, 0); + ossl_rand_pool_add_end(pool, 0, 0); } } } - return rand_pool_entropy_available(pool); + return ossl_rand_pool_entropy_available(pool); } #if defined(OPENSSL_SYS_TANDEM) && defined(_TNS_X_TARGET) diff --git a/providers/implementations/rands/seeding/rand_tsc.c b/providers/implementations/rands/seeding/rand_tsc.c index 2777335469..76311267fc 100644 --- a/providers/implementations/rands/seeding/rand_tsc.c +++ b/providers/implementations/rands/seeding/rand_tsc.c @@ -30,7 +30,7 @@ * Returns the total entropy count, if it exceeds the requested * entropy count. Otherwise, returns an entropy count of 0. */ -size_t prov_acquire_entropy_from_tsc(RAND_POOL *pool) +size_t ossl_prov_acquire_entropy_from_tsc(RAND_POOL *pool) { unsigned char c; int i; @@ -38,10 +38,10 @@ size_t prov_acquire_entropy_from_tsc(RAND_POOL *pool) if ((OPENSSL_ia32cap_P[0] & (1 << 4)) != 0) { for (i = 0; i < TSC_READ_COUNT; i++) { c = (unsigned char)(OPENSSL_rdtsc() & 0xFF); - rand_pool_add(pool, &c, 1, 4); + ossl_rand_pool_add(pool, &c, 1, 4); } } - return rand_pool_entropy_available(pool); + return ossl_rand_pool_entropy_available(pool); } #else NON_EMPTY_TRANSLATION_UNIT diff --git a/providers/implementations/rands/seeding/rand_unix.c b/providers/implementations/rands/seeding/rand_unix.c index ec0e55bec8..fd7373a3e9 100644 --- a/providers/implementations/rands/seeding/rand_unix.c +++ b/providers/implementations/rands/seeding/rand_unix.c @@ -151,7 +151,7 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) extern void s$sleep2(long long *_duration, short int *_code); # endif - bytes_needed = rand_pool_bytes_needed(pool, 4 /*entropy_factor*/); + bytes_needed = ossl_rand_pool_bytes_needed(pool, 4 /*entropy_factor*/); for (i = 0; i < bytes_needed; i++) { /* @@ -174,16 +174,16 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) /* Get wall clock time, take 8 bits. */ clock_gettime(CLOCK_REALTIME, &ts); v = (unsigned char)(ts.tv_nsec & 0xFF); - rand_pool_add(pool, arg, &v, sizeof(v) , 2); + ossl_rand_pool_add(pool, arg, &v, sizeof(v) , 2); } - return rand_pool_entropy_available(pool); + return ossl_rand_pool_entropy_available(pool); } -void rand_pool_cleanup(void) +void ossl_rand_pool_cleanup(void) { } -void rand_pool_keep_random_devices_open(int keep) +void ossl_rand_pool_keep_random_devices_open(int keep) { } @@ -555,7 +555,7 @@ static void close_random_device(size_t n) rd->fd = -1; } -int rand_pool_init(void) +int ossl_rand_pool_init(void) { size_t i; @@ -565,7 +565,7 @@ int rand_pool_init(void) return 1; } -void rand_pool_cleanup(void) +void ossl_rand_pool_cleanup(void) { size_t i; @@ -573,26 +573,26 @@ void rand_pool_cleanup(void) close_random_device(i); } -void rand_pool_keep_random_devices_open(int keep) +void ossl_rand_pool_keep_random_devices_open(int keep) { if (!keep) - rand_pool_cleanup(); + ossl_rand_pool_cleanup(); keep_random_devices_open = keep; } # else /* !defined(OPENSSL_RAND_SEED_DEVRANDOM) */ -int rand_pool_init(void) +int ossl_rand_pool_init(void) { return 1; } -void rand_pool_cleanup(void) +void ossl_rand_pool_cleanup(void) { } -void rand_pool_keep_random_devices_open(int keep) +void ossl_rand_pool_keep_random_devices_open(int keep) { } @@ -618,7 +618,7 @@ void rand_pool_keep_random_devices_open(int keep) size_t ossl_pool_acquire_entropy(RAND_POOL *pool) { # if defined(OPENSSL_RAND_SEED_NONE) - return rand_pool_entropy_available(pool); + return ossl_rand_pool_entropy_available(pool); # else size_t entropy_available = 0; @@ -632,12 +632,12 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) /* Maximum allowed number of consecutive unsuccessful attempts */ int attempts = 3; - bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); while (bytes_needed != 0 && attempts-- > 0) { - buffer = rand_pool_add_begin(pool, bytes_needed); + buffer = ossl_rand_pool_add_begin(pool, bytes_needed); bytes = syscall_random(buffer, bytes_needed); if (bytes > 0) { - rand_pool_add_end(pool, bytes, 8 * bytes); + ossl_rand_pool_add_end(pool, bytes, 8 * bytes); bytes_needed -= bytes; attempts = 3; /* reset counter after successful attempt */ } else if (bytes < 0 && errno != EINTR) { @@ -645,7 +645,7 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) } } } - entropy_available = rand_pool_entropy_available(pool); + entropy_available = ossl_rand_pool_entropy_available(pool); if (entropy_available > 0) return entropy_available; # endif @@ -662,7 +662,7 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) unsigned char *buffer; size_t i; - bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); for (i = 0; bytes_needed > 0 && i < OSSL_NELEM(random_device_paths); i++) { ssize_t bytes = 0; @@ -674,11 +674,11 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) continue; while (bytes_needed != 0 && attempts-- > 0) { - buffer = rand_pool_add_begin(pool, bytes_needed); + buffer = ossl_rand_pool_add_begin(pool, bytes_needed); bytes = read(fd, buffer, bytes_needed); if (bytes > 0) { - rand_pool_add_end(pool, bytes, 8 * bytes); + ossl_rand_pool_add_end(pool, bytes, 8 * bytes); bytes_needed -= bytes; attempts = 3; /* reset counter on successful attempt */ } else if (bytes < 0 && errno != EINTR) { @@ -688,22 +688,22 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) if (bytes < 0 || !keep_random_devices_open) close_random_device(i); - bytes_needed = rand_pool_bytes_needed(pool, 1); + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1); } - entropy_available = rand_pool_entropy_available(pool); + entropy_available = ossl_rand_pool_entropy_available(pool); if (entropy_available > 0) return entropy_available; } # endif # if defined(OPENSSL_RAND_SEED_RDTSC) - entropy_available = prov_acquire_entropy_from_tsc(pool); + entropy_available = ossl_prov_acquire_entropy_from_tsc(pool); if (entropy_available > 0) return entropy_available; # endif # if defined(OPENSSL_RAND_SEED_RDCPU) - entropy_available = prov_acquire_entropy_from_cpu(pool); + entropy_available = ossl_prov_acquire_entropy_from_cpu(pool); if (entropy_available > 0) return entropy_available; # endif @@ -715,27 +715,27 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) unsigned char *buffer; int i; - bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); for (i = 0; bytes_needed > 0 && paths[i] != NULL; i++) { size_t bytes = 0; int num; - buffer = rand_pool_add_begin(pool, bytes_needed); + buffer = ossl_rand_pool_add_begin(pool, bytes_needed); num = RAND_query_egd_bytes(paths[i], buffer, (int)bytes_needed); if (num == (int)bytes_needed) bytes = bytes_needed; - rand_pool_add_end(pool, bytes, 8 * bytes); - bytes_needed = rand_pool_bytes_needed(pool, 1); + ossl_rand_pool_add_end(pool, bytes, 8 * bytes); + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1); } - entropy_available = rand_pool_entropy_available(pool); + entropy_available = ossl_rand_pool_entropy_available(pool); if (entropy_available > 0) return entropy_available; } # endif - return rand_pool_entropy_available(pool); + return ossl_rand_pool_entropy_available(pool); # endif } # endif @@ -763,10 +763,10 @@ int ossl_pool_add_nonce_data(RAND_POOL *pool) data.tid = CRYPTO_THREAD_get_current_id(); data.time = get_time_stamp(); - return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); } -int rand_pool_add_additional_data(RAND_POOL *pool) +int ossl_rand_pool_add_additional_data(RAND_POOL *pool) { struct { int fork_id; @@ -787,7 +787,7 @@ int rand_pool_add_additional_data(RAND_POOL *pool) data.tid = CRYPTO_THREAD_get_current_id(); data.time = get_timer_bits(); - return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); } diff --git a/providers/implementations/rands/seeding/rand_vms.c b/providers/implementations/rands/seeding/rand_vms.c index 3a91d24405..0f8578ca30 100644 --- a/providers/implementations/rands/seeding/rand_vms.c +++ b/providers/implementations/rands/seeding/rand_vms.c @@ -362,8 +362,8 @@ size_t data_collect_method(RAND_POOL *pool) } data; size_t total_elems = 0; size_t total_length = 0; - size_t bytes_needed = rand_pool_bytes_needed(pool, ENTROPY_FACTOR); - size_t bytes_remaining = rand_pool_bytes_remaining(pool); + size_t bytes_needed = ossl_rand_pool_bytes_needed(pool, ENTROPY_FACTOR); + size_t bytes_remaining = ossl_rand_pool_bytes_remaining(pool); /* Take all the 64-bit items first, to ensure proper alignment of data */ total_elems += @@ -469,9 +469,9 @@ size_t data_collect_method(RAND_POOL *pool) total_length = bytes_remaining; /* We give the pessimistic value for the amount of entropy */ - rand_pool_add(pool, (unsigned char *)data.buffer, total_length, - 8 * total_length / ENTROPY_FACTOR); - return rand_pool_entropy_available(pool); + ossl_rand_pool_add(pool, (unsigned char *)data.buffer, total_length, + 8 * total_length / ENTROPY_FACTOR); + return ossl_rand_pool_entropy_available(pool); } int ossl_pool_add_nonce_data(RAND_POOL *pool) @@ -499,7 +499,7 @@ int ossl_pool_add_nonce_data(RAND_POOL *pool) sys$gettim((void*)&data.time); #endif - return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); } /* @@ -536,7 +536,7 @@ size_t get_entropy_method(RAND_POOL *pool) size_t bytes_to_get = 0; uint32_t status; - for (bytes_needed = rand_pool_bytes_needed(pool, 1); + for (bytes_needed = ossl_rand_pool_bytes_needed(pool, 1); bytes_needed > 0; bytes_needed -= bytes_to_get) { bytes_to_get = @@ -555,10 +555,10 @@ size_t get_entropy_method(RAND_POOL *pool) return 0; } - rand_pool_add(pool, buffer, bytes_to_get, 8 * bytes_to_get); + ossl_rand_pool_add(pool, buffer, bytes_to_get, 8 * bytes_to_get); } - return rand_pool_entropy_available(pool); + return ossl_rand_pool_entropy_available(pool); } /* @@ -576,7 +576,7 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) } -int rand_pool_add_additional_data(RAND_POOL *pool) +int ossl_rand_pool_add_additional_data(RAND_POOL *pool) { struct { CRYPTO_THREAD_ID tid; @@ -598,18 +598,18 @@ int rand_pool_add_additional_data(RAND_POOL *pool) sys$gettim((void*)&data.time); #endif - return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); } -int rand_pool_init(void) +int ossl_rand_pool_init(void) { return 1; } -void rand_pool_cleanup(void) +void ossl_rand_pool_cleanup(void) { } -void rand_pool_keep_random_devices_open(int keep) +void ossl_rand_pool_keep_random_devices_open(int keep) { } diff --git a/providers/implementations/rands/seeding/rand_vxworks.c b/providers/implementations/rands/seeding/rand_vxworks.c index 2629346e62..fce05a91fb 100644 --- a/providers/implementations/rands/seeding/rand_vxworks.c +++ b/providers/implementations/rands/seeding/rand_vxworks.c @@ -63,20 +63,20 @@ static uint64_t get_timer_bits(void) * empty implementation * vxworks does not need to init/cleanup or keep open the random lib */ -int rand_pool_init(void) +int ossl_rand_pool_init(void) { return 1; } -void rand_pool_cleanup(void) +void ossl_rand_pool_cleanup(void) { } -void rand_pool_keep_random_devices_open(int keep) +void ossl_rand_pool_keep_random_devices_open(int keep) { } -int rand_pool_add_additional_data(RAND_POOL *pool) +int ossl_rand_pool_add_additional_data(RAND_POOL *pool) { struct { CRYPTO_THREAD_ID tid; @@ -93,7 +93,7 @@ int rand_pool_add_additional_data(RAND_POOL *pool) data.tid = CRYPTO_THREAD_get_current_id(); data.time = get_timer_bits(); - return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); } int ossl_pool_add_nonce_data(RAND_POOL *pool) @@ -115,7 +115,7 @@ int ossl_pool_add_nonce_data(RAND_POOL *pool) data.tid = CRYPTO_THREAD_get_current_id(); data.time = get_time_stamp(); - return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); } size_t ossl_pool_acquire_entropy(RAND_POOL *pool) @@ -124,14 +124,14 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) /* vxRandLib based entropy method */ size_t bytes_needed; - bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); if (bytes_needed > 0) { int retryCount = 0; STATUS result = ERROR; unsigned char *buffer; - buffer = rand_pool_add_begin(pool, bytes_needed); + buffer = ossl_rand_pool_add_begin(pool, bytes_needed); while ((result != OK) && (retryCount < 10)) { RANDOM_NUM_GEN_STATUS status = randStatus(); @@ -139,7 +139,7 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) || (status == RANDOM_NUM_GEN_MAX_ENTROPY) ) { result = randBytes(buffer, bytes_needed); if (result == OK) - rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed); + ossl_rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed); /* * no else here: randStatus said ok, if randBytes failed * it will result in another loop or no entropy @@ -156,12 +156,12 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) retryCount++; } } - return rand_pool_entropy_available(pool); + return ossl_rand_pool_entropy_available(pool); #else /* * SEED_NONE means none, without randlib we dont have entropy and * rely on it being added externally */ - return rand_pool_entropy_available(pool); + return ossl_rand_pool_entropy_available(pool); #endif /* defined(RAND_SEED_VXRANDLIB) */ } diff --git a/providers/implementations/rands/seeding/rand_win.c b/providers/implementations/rands/seeding/rand_win.c index 39b0902e55..178532e02f 100644 --- a/providers/implementations/rands/seeding/rand_win.c +++ b/providers/implementations/rands/seeding/rand_win.c @@ -53,34 +53,34 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) # ifdef OPENSSL_RAND_SEED_RDTSC - entropy_available = prov_acquire_entropy_from_tsc(pool); + entropy_available = ossl_prov_acquire_entropy_from_tsc(pool); if (entropy_available > 0) return entropy_available; # endif # ifdef OPENSSL_RAND_SEED_RDCPU - entropy_available = prov_acquire_entropy_from_cpu(pool); + entropy_available = ossl_prov_acquire_entropy_from_cpu(pool); if (entropy_available > 0) return entropy_available; # endif # ifdef USE_BCRYPTGENRANDOM - bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); - buffer = rand_pool_add_begin(pool, bytes_needed); + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); + buffer = ossl_rand_pool_add_begin(pool, bytes_needed); if (buffer != NULL) { size_t bytes = 0; if (BCryptGenRandom(NULL, buffer, bytes_needed, BCRYPT_USE_SYSTEM_PREFERRED_RNG) == STATUS_SUCCESS) bytes = bytes_needed; - rand_pool_add_end(pool, bytes, 8 * bytes); - entropy_available = rand_pool_entropy_available(pool); + ossl_rand_pool_add_end(pool, bytes, 8 * bytes); + entropy_available = ossl_rand_pool_entropy_available(pool); } if (entropy_available > 0) return entropy_available; # else - bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); - buffer = rand_pool_add_begin(pool, bytes_needed); + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); + buffer = ossl_rand_pool_add_begin(pool, bytes_needed); if (buffer != NULL) { size_t bytes = 0; /* poll the CryptoAPI PRNG */ @@ -92,14 +92,14 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) CryptReleaseContext(hProvider, 0); } - rand_pool_add_end(pool, bytes, 8 * bytes); - entropy_available = rand_pool_entropy_available(pool); + ossl_rand_pool_add_end(pool, bytes, 8 * bytes); + entropy_available = ossl_rand_pool_entropy_available(pool); } if (entropy_available > 0) return entropy_available; - bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); - buffer = rand_pool_add_begin(pool, bytes_needed); + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); + buffer = ossl_rand_pool_add_begin(pool, bytes_needed); if (buffer != NULL) { size_t bytes = 0; /* poll the Pentium PRG with CryptoAPI */ @@ -111,14 +111,14 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) CryptReleaseContext(hProvider, 0); } - rand_pool_add_end(pool, bytes, 8 * bytes); - entropy_available = rand_pool_entropy_available(pool); + ossl_rand_pool_add_end(pool, bytes, 8 * bytes); + entropy_available = ossl_rand_pool_entropy_available(pool); } if (entropy_available > 0) return entropy_available; # endif - return rand_pool_entropy_available(pool); + return ossl_rand_pool_entropy_available(pool); } @@ -142,10 +142,10 @@ int ossl_pool_add_nonce_data(RAND_POOL *pool) data.tid = GetCurrentThreadId(); GetSystemTimeAsFileTime(&data.time); - return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); } -int rand_pool_add_additional_data(RAND_POOL *pool) +int ossl_rand_pool_add_additional_data(RAND_POOL *pool) { struct { DWORD tid; @@ -162,19 +162,19 @@ int rand_pool_add_additional_data(RAND_POOL *pool) */ data.tid = GetCurrentThreadId(); QueryPerformanceCounter(&data.time); - return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); } -int rand_pool_init(void) +int ossl_rand_pool_init(void) { return 1; } -void rand_pool_cleanup(void) +void ossl_rand_pool_cleanup(void) { } -void rand_pool_keep_random_devices_open(int keep) +void ossl_rand_pool_keep_random_devices_open(int keep) { } |