summaryrefslogtreecommitdiff
path: root/ext/standard/php_random.h
diff options
context:
space:
mode:
authorAnthony Ferrara <ircmaxell@gmail.com>2015-12-08 13:12:45 +0100
committerAnatol Belski <ab@php.net>2015-12-08 13:12:45 +0100
commit908f67b1d44521aaac61e725290f3dc8a3fddcc7 (patch)
tree77aadd90da17fa92e01704fc9f04c1850d6d1a1e /ext/standard/php_random.h
parent0495bf5650995cd8f18d6a9909eb4c5dcefde669 (diff)
downloadphp-git-908f67b1d44521aaac61e725290f3dc8a3fddcc7.tar.gz
Expose php_random_bytes as a first-class API within internals
This also defines two macros: php_random_bytes_throw and php_random_bytes_silent depending on use case which will throw exceptions or not respectively
Diffstat (limited to 'ext/standard/php_random.h')
-rw-r--r--ext/standard/php_random.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/standard/php_random.h b/ext/standard/php_random.h
index ecf9c7135b..a07dbf935e 100644
--- a/ext/standard/php_random.h
+++ b/ext/standard/php_random.h
@@ -31,6 +31,11 @@ typedef struct {
int fd;
} php_random_globals;
+#define php_random_bytes_throw(b, s) php_random_bytes((b), (s), 1)
+#define php_random_bytes_silent(b, s) php_random_bytes((b), (s), 0)
+
+PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw);
+
#ifdef ZTS
# define RANDOM_G(v) ZEND_TSRMG(random_globals_id, php_random_globals *, v)
extern PHPAPI int random_globals_id;