diff options
author | Anatol Belski <ab@php.net> | 2017-02-12 17:15:50 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2017-02-12 17:47:14 +0100 |
commit | d53d0a5dc43869a29f8908687e4790d7f2847830 (patch) | |
tree | d529501ae010a6cf9186eddde2dd9e414e7e4db1 /win32/winutil.h | |
parent | 963981df5898ceb2626d454e2825270c4c977718 (diff) | |
download | php-git-d53d0a5dc43869a29f8908687e4790d7f2847830.tar.gz |
refactor php_win32_get_random_bytes(), take 2
As in previous variant, locking is removed and the initialization
is done only once at process start. The CNG API turns out to be
faster, also the initialization is less resources hungry. The
initialization part could need to be improved, if too much startup
failures are sighted in the real world usage. Though that would mean
having locking back.
The usage of CNG was already pointed out and requested in several
reports, with the further refactoring it appears to make sense and
simplify things a backward compatible way.
Diffstat (limited to 'win32/winutil.h')
-rw-r--r-- | win32/winutil.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/win32/winutil.h b/win32/winutil.h index 2898aad8b8..ebd57f10a6 100644 --- a/win32/winutil.h +++ b/win32/winutil.h @@ -27,13 +27,9 @@ PHP_WINUTIL_API char *php_win32_error_to_msg(HRESULT error); #define php_win_err() php_win32_error_to_msg(GetLastError()) int php_win32_check_trailing_space(const char * path, const int path_len); PHP_WINUTIL_API int php_win32_get_random_bytes(unsigned char *buf, size_t size); - -#ifdef ZTS -void php_win32_init_rng_lock(); -void php_win32_free_rng_lock(); -#else -#define php_win32_init_rng_lock(); -#define php_win32_free_rng_lock(); +#ifdef PHP_EXPORTS +BOOL php_win32_init_random_bytes(void); +BOOL php_win32_shutdown_random_bytes(void); #endif #if !defined(ECURDIR) |