From 9f36eae4e813209d5c70c560b9d79ce125b1d656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Wed, 17 Aug 2022 15:59:13 +0200 Subject: [PATCH] Add stubs --- package.xml | 3 +++ php_scrypt.c | 39 ++++++------------------------------- php_scrypt.h | 3 --- php_scrypt.stub.php | 10 ++++++++++ php_scrypt_arginfo.h | 29 +++++++++++++++++++++++++++ php_scrypt_legacy_arginfo.h | 29 +++++++++++++++++++++++++++ 6 files changed, 77 insertions(+), 36 deletions(-) create mode 100644 php_scrypt.stub.php create mode 100644 php_scrypt_arginfo.h create mode 100644 php_scrypt_legacy_arginfo.h diff --git a/package.xml b/package.xml index 7b4ab8f..6339bf9 100644 --- a/package.xml +++ b/package.xml @@ -44,6 +44,9 @@ http://pear.php.net/dtd/package-2.0.xsd"> + + + diff --git a/php_scrypt.c b/php_scrypt.c index 2622349..f9a984a 100644 --- a/php_scrypt.c +++ b/php_scrypt.c @@ -40,45 +40,18 @@ #include "php_scrypt.h" #include "crypto/crypto_scrypt.h" #include "crypto/params.h" - +#if PHP_MAJOR_VERSION >= 8 +#include "php_scrypt_arginfo.h" +#else +#include "php_scrypt_legacy_arginfo.h" +#endif #include "math.h" typedef size_t strsize_t; -/* {{{ arginfo */ -ZEND_BEGIN_ARG_INFO_EX(scrypt_arginfo, 0, 0, 6) - ZEND_ARG_INFO(0, password) - ZEND_ARG_INFO(0, salt) - ZEND_ARG_INFO(0, N) - ZEND_ARG_INFO(0, r) - ZEND_ARG_INFO(0, p) - ZEND_ARG_INFO(0, keyLength) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(scrypt_pickparams_arginfo, 0, 0, 3) - ZEND_ARG_INFO(0, maxMemory) - ZEND_ARG_INFO(0, memFraction) - ZEND_ARG_INFO(0, maxTime) -ZEND_END_ARG_INFO() -/* }}} */ - -static zend_function_entry scrypt_functions[] = { - PHP_FE(scrypt, scrypt_arginfo) - PHP_FE(scrypt_pickparams, scrypt_pickparams_arginfo) -#ifdef PHP_FE_END - PHP_FE_END -#else - {NULL, NULL, NULL} -#endif -}; - static const zend_module_dep scrypt_deps[] = { ZEND_MOD_REQUIRED("hash") -#ifdef ZEND_MOD_END ZEND_MOD_END -#else - {NULL, NULL, NULL} -#endif }; zend_module_entry scrypt_module_entry = { @@ -86,7 +59,7 @@ zend_module_entry scrypt_module_entry = { NULL, scrypt_deps, PHP_SCRYPT_EXTNAME, - scrypt_functions, + ext_functions, NULL, NULL, NULL, diff --git a/php_scrypt.h b/php_scrypt.h index 2b826b1..d0e6144 100644 --- a/php_scrypt.h +++ b/php_scrypt.h @@ -29,9 +29,6 @@ #define PHP_SCRYPT_VERSION "2.0.0-dev" #define PHP_SCRYPT_EXTNAME "scrypt" -PHP_FUNCTION(scrypt); -PHP_FUNCTION(scrypt_pickparams); - extern zend_module_entry scrypt_module_entry; #define phpext_scrypt_ptr &scrypt_module_entry diff --git a/php_scrypt.stub.php b/php_scrypt.stub.php new file mode 100644 index 0000000..e381174 --- /dev/null +++ b/php_scrypt.stub.php @@ -0,0 +1,10 @@ +