summaryrefslogtreecommitdiff
path: root/win32/winutil.h
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-02-12 17:15:50 +0100
committerAnatol Belski <ab@php.net>2017-02-12 17:47:14 +0100
commitd53d0a5dc43869a29f8908687e4790d7f2847830 (patch)
treed529501ae010a6cf9186eddde2dd9e414e7e4db1 /win32/winutil.h
parent963981df5898ceb2626d454e2825270c4c977718 (diff)
downloadphp-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.h10
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)