summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
authorRimvydas Zilinskas <rimvydas@loftdigital.com>2019-08-10 18:16:13 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-08-10 22:19:16 +0200
commit31d7f9763b4825e667eb34437f2bd7fbef5067e6 (patch)
tree84f3ab2f3e65d9d002a0f36e5b7e2fbde2fbc087 /ext/openssl
parent4799b76f39a46fdb9d96f0803bd1b935d607409e (diff)
downloadphp-git-31d7f9763b4825e667eb34437f2bd7fbef5067e6.tar.gz
Add partial openssl stubs
Closes GH-4509.
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/openssl.c49
-rw-r--r--ext/openssl/openssl.stub.php24
-rw-r--r--ext/openssl/openssl_arginfo.h49
3 files changed, 74 insertions, 48 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 5e9528afd5..caff996573 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -27,6 +27,7 @@
#include "php.h"
#include "php_ini.h"
+#include "openssl_arginfo.h"
#include "php_openssl.h"
#include "zend_exceptions.h"
@@ -131,54 +132,6 @@ PHP_FUNCTION(openssl_pkey_derive);
PHP_FUNCTION(openssl_random_pseudo_bytes);
/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 0, 2)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(0, outfilename)
- ZEND_ARG_INFO(0, notext)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export, 0, 0, 2)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(1, out)
- ZEND_ARG_INFO(0, notext)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_fingerprint, 0, 0, 1)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_check_private_key, 0)
- ZEND_ARG_INFO(0, cert)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_verify, 0)
- ZEND_ARG_INFO(0, cert)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_parse, 0, 0, 1)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(0, shortname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_checkpurpose, 0, 0, 2)
- ZEND_ARG_INFO(0, x509cert)
- ZEND_ARG_INFO(0, purpose)
- ZEND_ARG_INFO(0, cainfo) /* array */
- ZEND_ARG_INFO(0, untrustedfile)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_read, 0)
- ZEND_ARG_INFO(0, cert)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_free, 0)
- ZEND_ARG_INFO(0, x509)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs12_export_to_file, 0, 0, 4)
ZEND_ARG_INFO(0, x509)
ZEND_ARG_INFO(0, filename)
diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php
new file mode 100644
index 0000000000..23acc5f47c
--- /dev/null
+++ b/ext/openssl/openssl.stub.php
@@ -0,0 +1,24 @@
+<?php
+
+function openssl_x509_export_to_file($x509, string $outfilename, bool $notext = true): bool {}
+
+function openssl_x509_export($x509 , &$out, bool $notext = true): bool {}
+
+/** @return string|false */
+function openssl_x509_fingerprint($x509, string $method = 'sha1', bool $raw_output = false) {}
+
+function openssl_x509_check_private_key($cert, $key): bool {}
+
+function openssl_x509_verify($cert, $key): int {}
+
+/** @return array|false */
+function openssl_x509_parse($x509, bool $shortname = true) {}
+
+/** @return bool|int */
+function openssl_x509_checkpurpose($x509cert, int $purpose, ?array $cainfo = [], string $untrustedfile = UNKNOWN) {}
+
+/** @return resource|false */
+function openssl_x509_read($cert) {}
+
+/** @return false|void */
+function openssl_x509_free($x509) {}
diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h
new file mode 100644
index 0000000000..ed104a2ffa
--- /dev/null
+++ b/ext/openssl/openssl_arginfo.h
@@ -0,0 +1,49 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, notext, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_INFO(1, out)
+ ZEND_ARG_TYPE_INFO(0, notext, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_fingerprint, 0, 0, 1)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_check_private_key, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, cert)
+ ZEND_ARG_INFO(0, key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_verify, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, cert)
+ ZEND_ARG_INFO(0, key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_parse, 0, 0, 1)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_TYPE_INFO(0, shortname, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_checkpurpose, 0, 0, 2)
+ ZEND_ARG_INFO(0, x509cert)
+ ZEND_ARG_TYPE_INFO(0, purpose, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cainfo, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, untrustedfile, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_read, 0, 0, 1)
+ ZEND_ARG_INFO(0, cert)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_free, 0, 0, 1)
+ ZEND_ARG_INFO(0, x509)
+ZEND_END_ARG_INFO()