summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2022-10-27 15:54:45 +0200
committerRemi Collet <remi@php.net>2022-10-27 15:54:45 +0200
commit0c7478d8f1b5871808a6c90198b0152f43b43700 (patch)
tree844c48f892c1e65f0fa578e024c938e650bae407
initial package
-rw-r--r--.gitignore9
-rw-r--r--Makefile4
-rw-r--r--PHPINFO4
-rw-r--r--REFLECTION337
-rw-r--r--php-pecl-rnp.spec190
5 files changed, 544 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f0400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+clog
+package-*.xml
+*.tgz
+*.tar.bz2
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..13af741
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../../common/Makefile
+
diff --git a/PHPINFO b/PHPINFO
new file mode 100644
index 0000000..c859cc9
--- /dev/null
+++ b/PHPINFO
@@ -0,0 +1,4 @@
+
+rnp
+
+rnp support => enabled
diff --git a/REFLECTION b/REFLECTION
new file mode 100644
index 0000000..8671b61
--- /dev/null
+++ b/REFLECTION
@@ -0,0 +1,337 @@
+Extension [ <persistent> extension #97 rnp version 0.1.1 ] {
+
+ - Constants [30] {
+ Constant [ int RNP_LOAD_SAVE_PUBLIC_KEYS ] { 1 }
+ Constant [ int RNP_LOAD_SAVE_SECRET_KEYS ] { 2 }
+ Constant [ int RNP_LOAD_SAVE_PERMISSIVE ] { 256 }
+ Constant [ int RNP_LOAD_SAVE_SINGLE ] { 512 }
+ Constant [ int RNP_LOAD_SAVE_BASE64 ] { 1024 }
+ Constant [ string RNP_FEATURE_SYMM_ALG ] { symmetric algorithm }
+ Constant [ string RNP_FEATURE_AEAD_ALG ] { aead algorithm }
+ Constant [ string RNP_FEATURE_PROT_MODE ] { protection mode }
+ Constant [ string RNP_FEATURE_PK_ALG ] { public key algorithm }
+ Constant [ string RNP_FEATURE_HASH_ALG ] { hash algorithm }
+ Constant [ string RNP_FEATURE_COMP_ALG ] { compression algorithm }
+ Constant [ string RNP_FEATURE_CURVE ] { elliptic curve }
+ Constant [ int RNP_DUMP_MPI ] { 1 }
+ Constant [ int RNP_DUMP_RAW ] { 2 }
+ Constant [ int RNP_DUMP_GRIP ] { 4 }
+ Constant [ int RNP_JSON_DUMP_MPI ] { 1 }
+ Constant [ int RNP_JSON_DUMP_RAW ] { 2 }
+ Constant [ int RNP_JSON_DUMP_GRIP ] { 4 }
+ Constant [ int RNP_ENCRYPT_NOWRAP ] { 1 }
+ Constant [ string RNP_KEYSTORE_GPG ] { GPG }
+ Constant [ string RNP_KEYSTORE_KBX ] { KBX }
+ Constant [ string RNP_KEYSTORE_G10 ] { G10 }
+ Constant [ int RNP_KEY_EXPORT_ARMORED ] { 1 }
+ Constant [ int RNP_KEY_EXPORT_PUBLIC ] { 2 }
+ Constant [ int RNP_KEY_EXPORT_SECRET ] { 4 }
+ Constant [ int RNP_KEY_EXPORT_SUBKEYS ] { 8 }
+ Constant [ int RNP_KEY_EXPORT_BASE64 ] { 512 }
+ Constant [ int RNP_KEY_REMOVE_PUBLIC ] { 1 }
+ Constant [ int RNP_KEY_REMOVE_SECRET ] { 2 }
+ Constant [ int RNP_KEY_REMOVE_SUBKEYS ] { 4 }
+ }
+
+ - Functions {
+ Function [ <internal:rnp> function rnp_backend_string ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
+ }
+ Function [ <internal:rnp> function rnp_backend_version ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
+ }
+ Function [ <internal:rnp> function rnp_supported_features ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> string $type ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_version_string ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
+ }
+ Function [ <internal:rnp> function rnp_version_string_full ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
+ }
+ Function [ <internal:rnp> function rnp_ffi_create ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> string $pub_format ]
+ Parameter #1 [ <required> string $sec_format ]
+ }
+ - Return [ RnpFFI|false ]
+ }
+ Function [ <internal:rnp> function rnp_ffi_destroy ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ }
+ - Return [ void ]
+ }
+ Function [ <internal:rnp> function rnp_load_keys ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $format ]
+ Parameter #2 [ <required> string $input ]
+ Parameter #3 [ <required> int $flags ]
+ }
+ - Return [ bool ]
+ }
+ Function [ <internal:rnp> function rnp_load_keys_from_path ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $format ]
+ Parameter #2 [ <required> string $input_path ]
+ Parameter #3 [ <required> int $flags ]
+ }
+ - Return [ bool ]
+ }
+ Function [ <internal:rnp> function rnp_save_keys ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $format ]
+ Parameter #2 [ <required> string &$output ]
+ Parameter #3 [ <required> int $flags ]
+ }
+ - Return [ bool ]
+ }
+ Function [ <internal:rnp> function rnp_save_keys_to_path ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $format ]
+ Parameter #2 [ <required> string $output_path ]
+ Parameter #3 [ <required> int $flags ]
+ }
+ - Return [ bool ]
+ }
+ Function [ <internal:rnp> function rnp_dump_packets ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> string $input ]
+ Parameter #1 [ <required> int $flags ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_dump_packets_to_json ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> string $input ]
+ Parameter #1 [ <required> int $flags ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_op_generate_key ] {
+
+ - Parameters [5] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $userid ]
+ Parameter #2 [ <required> string $key_alg ]
+ Parameter #3 [ <optional> string $sub_alg = null ]
+ Parameter #4 [ <optional> array $options = [] ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_ffi_set_pass_provider ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> callable $password_callback ]
+ }
+ - Return [ bool ]
+ }
+ Function [ <internal:rnp> function rnp_op_sign ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $data ]
+ Parameter #2 [ <required> array $keys_fp ]
+ Parameter #3 [ <optional> array $options = [] ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_op_sign_cleartext ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $data ]
+ Parameter #2 [ <required> array $keys_fp ]
+ Parameter #3 [ <optional> array $options = [] ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_op_sign_detached ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $data ]
+ Parameter #2 [ <required> array $keys_fp ]
+ Parameter #3 [ <optional> array $options = [] ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_op_verify ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $data ]
+ }
+ - Return [ array|false ]
+ }
+ Function [ <internal:rnp> function rnp_op_verify_detached ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $data ]
+ Parameter #2 [ <required> string $signature ]
+ }
+ - Return [ array|false ]
+ }
+ Function [ <internal:rnp> function rnp_op_encrypt ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $message ]
+ Parameter #2 [ <required> array $recipient_keys_fp ]
+ Parameter #3 [ <optional> array $options = [] ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_decrypt ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $input ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_locate_key ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $identifier_type ]
+ Parameter #2 [ <required> string $identifier ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_list_keys ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $identifier_type ]
+ }
+ - Return [ array|false ]
+ }
+ Function [ <internal:rnp> function rnp_key_get_info ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $key_fp ]
+ }
+ - Return [ array|false ]
+ }
+ Function [ <internal:rnp> function rnp_key_export ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $key_fp ]
+ Parameter #2 [ <required> int $flags ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_key_export_autocrypt ] {
+
+ - Parameters [5] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $key_fp ]
+ Parameter #2 [ <required> string $subkey_fp ]
+ Parameter #3 [ <required> string $uid ]
+ Parameter #4 [ <required> int $flags ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_import_keys ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $input ]
+ Parameter #2 [ <required> int $flags ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_key_remove ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $key_fp ]
+ Parameter #2 [ <required> int $flags ]
+ }
+ - Return [ bool ]
+ }
+ Function [ <internal:rnp> function rnp_key_revoke ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $key_fp ]
+ Parameter #2 [ <required> int $flags ]
+ Parameter #3 [ <optional> array $options = [] ]
+ }
+ - Return [ bool ]
+ }
+ Function [ <internal:rnp> function rnp_key_export_revocation ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $key_fp ]
+ Parameter #2 [ <required> int $flags ]
+ Parameter #3 [ <optional> array $options = [] ]
+ }
+ - Return [ string|false ]
+ }
+ Function [ <internal:rnp> function rnp_import_signatures ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> RnpFFI $ffi ]
+ Parameter #1 [ <required> string $input ]
+ Parameter #2 [ <required> int $flags ]
+ }
+ - Return [ string|false ]
+ }
+ }
+
+ - Classes [1] {
+ Class [ <internal:rnp> final class RnpFFI ] {
+
+ - Constants [0] {
+ }
+
+ - Static properties [0] {
+ }
+
+ - Static methods [0] {
+ }
+
+ - Properties [0] {
+ }
+
+ - Methods [0] {
+ }
+ }
+ }
+}
+
diff --git a/php-pecl-rnp.spec b/php-pecl-rnp.spec
new file mode 100644
index 0000000..a112883
--- /dev/null
+++ b/php-pecl-rnp.spec
@@ -0,0 +1,190 @@
+# remirepo spec file for php-pecl-rnp
+#
+# Copyright (c) 2022 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+
+# we don't want -z defs linker flag
+%undefine _strict_symbol_defs_build
+
+%if 0%{?scl:1}
+%scl_package php-pecl-rnp
+%endif
+
+%bcond_without tests
+%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
+%global pecl_name rnp
+%global ini_name 40-%{pecl_name}.ini
+
+%global upstream_version 0.1.1
+#global upstream_prever a1
+
+Summary: wrapper around the RNP library
+Name: %{?scl_prefix}php-pecl-%{pecl_name}
+Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
+Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+
+License: BSD 2-Clause
+URL: https://pecl.php.net/package/%{pecl_name}
+Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz
+
+BuildRequires: make
+BuildRequires: %{?dtsprefix}gcc
+BuildRequires: %{?scl_prefix}php-devel >= 8.0
+BuildRequires: %{?scl_prefix}php-pear
+BuildRequires: librnp-devel
+
+Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
+Requires: %{?scl_prefix}php(api) = %{php_core_api}
+%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
+
+Provides: %{?scl_prefix}php-%{pecl_name} = %{version}
+Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}
+Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version}
+Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
+
+
+%description
+PHP extension for RNP - high performance OpenPGP implementation.
+
+Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}.
+
+
+%prep
+%setup -qc
+mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS
+
+# Don't install/register tests
+sed -e 's/role="test"/role="src"/' \
+ %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \
+ -i package.xml
+
+cd NTS
+
+# Check version as upstream often forget to update this
+extver=$(sed -n '/define PHP_RNP_VERSION/{s/.* "//;s/".*$//;p}' php_rnp.h)
+if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}%{?gh_date:-dev}"; then
+ : Error: Upstream version is ${extver}, expecting %{upstream_version}%{?upstream_prever}%{?gh_date:-dev}.
+ exit 1
+fi
+cd ..
+
+
+%if %{with_zts}
+# duplicate for ZTS build
+cp -pr NTS ZTS
+%endif
+
+# Create configuration file
+cat > %{ini_name} << 'EOF'
+; Enable %{pecl_name} extension module
+extension=%{pecl_name}.so
+EOF
+
+
+%build
+%{?dtsenable}
+
+peclconf() {
+%configure \
+ -with-rnp \
+ --with-php-config=$1
+}
+
+cd NTS
+%{_bindir}/phpize
+peclconf %{_bindir}/php-config
+make %{?_smp_mflags}
+
+%if %{with_zts}
+cd ../ZTS
+%{_bindir}/zts-phpize
+peclconf %{_bindir}/zts-php-config
+make %{?_smp_mflags}
+%endif
+
+
+%install
+%{?dtsenable}
+
+# Install the NTS stuff
+make -C NTS install INSTALL_ROOT=%{buildroot}
+install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
+
+# Install XML package description
+install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
+
+# Install the ZTS stuff
+%if %{with_zts}
+make -C ZTS install INSTALL_ROOT=%{buildroot}
+install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
+%endif
+
+# Documentation
+for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
+do [ -f NTS/$i ] && install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
+done
+
+
+%check
+: Minimal load test for NTS extension
+%{_bindir}/php --no-php-ini \
+ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
+ --modules | grep '^%{pecl_name}$'
+
+%if %{with_zts}
+: Minimal load test for ZTS extension
+%{__ztsphp} --no-php-ini \
+ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
+ --modules | grep '^%{pecl_name}$'
+
+%endif
+
+%if %{with tests}
+cd NTS
+: Run upstream test suite
+TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \
+%{__php} -n run-tests.php -q --show-diff %{?_smp_mflags}
+%endif
+
+
+%if 0%{?fedora} < 24 && 0%{?rhel} < 8
+# when pear installed alone, after us
+%triggerin -- %{?scl_prefix}php-pear
+if [ -x %{__pecl} ] ; then
+ %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
+fi
+
+# posttrans as pear can be installed after us
+%posttrans
+if [ -x %{__pecl} ] ; then
+ %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
+fi
+
+%postun
+if [ $1 -eq 0 -a -x %{__pecl} ] ; then
+ %{pecl_uninstall} %{pecl_name} >/dev/null || :
+fi
+%endif
+
+
+%files
+%{?_licensedir:%license NTS/LICENSE}
+%doc %{pecl_docdir}/%{pecl_name}
+%{pecl_xmldir}/%{name}.xml
+
+%config(noreplace) %{php_inidir}/%{ini_name}
+%{php_extdir}/%{pecl_name}.so
+
+%if %{with_zts}
+%{php_ztsextdir}/%{pecl_name}.so
+%config(noreplace) %{php_ztsinidir}/%{ini_name}
+%endif
+
+
+%changelog
+* Thu Oct 27 2022 Remi Collet <remi@remirepo.net> - 1.2.8-1
+- initial package