diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | REFLECTION | 268 | ||||
-rw-r--r-- | php-pecl-libsodium.spec | 216 |
3 files changed, 488 insertions, 0 deletions
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/REFLECTION b/REFLECTION new file mode 100644 index 0000000..a26f4d3 --- /dev/null +++ b/REFLECTION @@ -0,0 +1,268 @@ +Extension [ <persistent> extension #105 libsodium version 0.1.1 ] { + + - Classes [1] { + Class [ <internal:libsodium> class Sodium ] { + + - Constants [25] { + Constant [ integer CRYPTO_SHORTHASH_BYTES ] { 8 } + Constant [ integer CRYPTO_SHORTHASH_KEYBYTES ] { 16 } + Constant [ integer CRYPTO_SECRETBOX_KEYBYTES ] { 32 } + Constant [ integer CRYPTO_SECRETBOX_NONCEBYTES ] { 24 } + Constant [ integer CRYPTO_GENERICHASH_BYTES ] { 32 } + Constant [ integer CRYPTO_GENERICHASH_BYTES_MIN ] { 16 } + Constant [ integer CRYPTO_GENERICHASH_BYTES_MAX ] { 64 } + Constant [ integer CRYPTO_GENERICHASH_KEYBYTES ] { 32 } + Constant [ integer CRYPTO_GENERICHASH_KEYBYTES_MIN ] { 16 } + Constant [ integer CRYPTO_GENERICHASH_KEYBYTES_MAX ] { 64 } + Constant [ integer CRYPTO_BOX_SECRETKEYBYTES ] { 32 } + Constant [ integer CRYPTO_BOX_PUBLICKEYBYTES ] { 32 } + Constant [ integer CRYPTO_BOX_KEYPAIRBYTES ] { 64 } + Constant [ integer CRYPTO_BOX_NONCEBYTES ] { 24 } + Constant [ integer CRYPTO_SIGN_BYTES ] { 64 } + Constant [ integer CRYPTO_SIGN_SEEDBYTES ] { 32 } + Constant [ integer CRYPTO_SIGN_PUBLICKEYBYTES ] { 32 } + Constant [ integer CRYPTO_SIGN_SECRETKEYBYTES ] { 64 } + Constant [ integer CRYPTO_SIGN_KEYPAIRBYTES ] { 96 } + Constant [ integer CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES ] { 32 } + Constant [ string CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX ] { $7$ } + Constant [ integer CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE ] { 524288 } + Constant [ integer CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE ] { 16777216 } + Constant [ integer CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE ] { 33554432 } + Constant [ integer CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE ] { 1073741824 } + } + + - Static properties [0] { + } + + - Static methods [29] { + Method [ <internal:libsodium> static public method sodium_version_string ] { + + - Parameters [0] { + } + } + + Method [ <internal:libsodium> static public method sodium_library_version_major ] { + + - Parameters [0] { + } + } + + Method [ <internal:libsodium> static public method sodium_library_version_minor ] { + + - Parameters [0] { + } + } + + Method [ <internal:libsodium> static public method sodium_memzero ] { + + - Parameters [2] { + Parameter #0 [ <required> &$reference ] + Parameter #1 [ <required> $length ] + } + } + + Method [ <internal:libsodium> static public method sodium_memcmp ] { + + - Parameters [2] { + Parameter #0 [ <required> $string_1 ] + Parameter #1 [ <required> $string_2 ] + } + } + + Method [ <internal:libsodium> static public method randombytes_buf ] { + + - Parameters [1] { + Parameter #0 [ <required> $length ] + } + } + + Method [ <internal:libsodium> static public method randombytes_random16 ] { + + - Parameters [0] { + } + } + + Method [ <internal:libsodium> static public method randombytes_uniform ] { + + - Parameters [1] { + Parameter #0 [ <required> $integer ] + } + } + + Method [ <internal:libsodium> static public method crypto_shorthash ] { + + - Parameters [2] { + Parameter #0 [ <required> $string ] + Parameter #1 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_secretbox ] { + + - Parameters [3] { + Parameter #0 [ <required> $string ] + Parameter #1 [ <required> $nonce ] + Parameter #2 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_secretbox_open ] { + + - Parameters [3] { + Parameter #0 [ <required> $string ] + Parameter #1 [ <required> $nonce ] + Parameter #2 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_generichash ] { + + - Parameters [3] { + Parameter #0 [ <required> $string ] + Parameter #1 [ <optional> $key ] + Parameter #2 [ <optional> $length ] + } + } + + Method [ <internal:libsodium> static public method crypto_box_keypair ] { + + - Parameters [0] { + } + } + + Method [ <internal:libsodium> static public method crypto_box_keypair_from_secretkey_and_publickey ] { + + - Parameters [2] { + Parameter #0 [ <required> $secret_key ] + Parameter #1 [ <required> $public_key ] + } + } + + Method [ <internal:libsodium> static public method crypto_box_secretkey ] { + + - Parameters [1] { + Parameter #0 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_box_publickey ] { + + - Parameters [1] { + Parameter #0 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_box_publickey_from_secretkey ] { + + - Parameters [1] { + Parameter #0 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_box ] { + + - Parameters [3] { + Parameter #0 [ <required> $string ] + Parameter #1 [ <required> $nonce ] + Parameter #2 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_box_open ] { + + - Parameters [3] { + Parameter #0 [ <required> $string ] + Parameter #1 [ <required> $nonce ] + Parameter #2 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_sign_keypair ] { + + - Parameters [0] { + } + } + + Method [ <internal:libsodium> static public method crypto_sign_seed_keypair ] { + + - Parameters [1] { + Parameter #0 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_sign_keypair_from_secretkey_and_publickey ] { + + - Parameters [2] { + Parameter #0 [ <required> $secret_key ] + Parameter #1 [ <required> $public_key ] + } + } + + Method [ <internal:libsodium> static public method crypto_sign_secretkey ] { + + - Parameters [1] { + Parameter #0 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_sign_publickey ] { + + - Parameters [1] { + Parameter #0 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_sign ] { + + - Parameters [2] { + Parameter #0 [ <required> $string ] + Parameter #1 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_sign_open ] { + + - Parameters [2] { + Parameter #0 [ <required> $string ] + Parameter #1 [ <required> $key ] + } + } + + Method [ <internal:libsodium> static public method crypto_pwhash_scryptsalsa208sha256 ] { + + - Parameters [5] { + Parameter #0 [ <required> $length ] + Parameter #1 [ <required> $password ] + Parameter #2 [ <required> $salt ] + Parameter #3 [ <required> $opslimit ] + Parameter #4 [ <required> $memlimit ] + } + } + + Method [ <internal:libsodium> static public method crypto_pwhash_scryptsalsa208sha256_str ] { + + - Parameters [3] { + Parameter #0 [ <required> $password ] + Parameter #1 [ <required> $opslimit ] + Parameter #2 [ <required> $memlimit ] + } + } + + Method [ <internal:libsodium> static public method crypto_pwhash_scryptsalsa208sha256_str_verify ] { + + - Parameters [2] { + Parameter #0 [ <required> $hash ] + Parameter #1 [ <required> $password ] + } + } + } + + - Properties [0] { + } + + - Methods [0] { + } + } + } +} + diff --git a/php-pecl-libsodium.spec b/php-pecl-libsodium.spec new file mode 100644 index 0000000..3b9f9fb --- /dev/null +++ b/php-pecl-libsodium.spec @@ -0,0 +1,216 @@ +# spec file for php-pecl-libsodium +# +# Copyright (c) 2014 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/3.0/ +# +# Please, preserve the changelog entries +# +%{?scl: %scl_package php-pecl-libsodium} +%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d} +%{!?__pecl: %global __pecl %{_bindir}/pecl} +%{!?__php: %global __php %{_bindir}/php} + +%global with_zts 0%{?__ztsphp:1} +%global pecl_name libsodium +%global with_tests %{?_without_tests:0}%{!?_without_tests:1} +%if "%{php_version}" < "5.6" +%global ini_name %{pecl_name}.ini +%else +%global ini_name 40-%{pecl_name}.ini +%endif + +Summary: Wrapper for the Sodium cryptographic library +Name: %{?scl_prefix}php-pecl-%{pecl_name} +Version: 0.1.1 +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +License: PHP +Group: Development/Languages +URL: http://pecl.php.net/package/%{pecl_name} +Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +%if "%{?vendor}" == "Remi Collet" +# Ensure libsodium-last is used +BuildRequires: libsodium-devel >= 1.0.0 +%else +# Per upstream documentation +BuildRequires: libsodium-devel >= 0.6.0 +%endif +BuildRequires: %{?scl_prefix}php-devel > 5.2 +BuildRequires: %{?scl_prefix}php-pear + +Requires(post): %{__pecl} +Requires(postun): %{__pecl} +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} + +%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} +# Other third party repo stuff +Obsoletes: php53-pecl-%{pecl_name} +Obsoletes: php53u-pecl-%{pecl_name} +Obsoletes: php54-pecl-%{pecl_name} +Obsoletes: php54w-pecl-%{pecl_name} +%if "%{php_version}" > "5.5" +Obsoletes: php55u-pecl-%{pecl_name} +Obsoletes: php55w-pecl-%{pecl_name} +%endif +%if "%{php_version}" > "5.6" +Obsoletes: php56u-pecl-%{pecl_name} +Obsoletes: php56w-pecl-%{pecl_name} +%endif +%endif + +%if 0%{?fedora} < 20 && 0%{?rhel} < 7 +# Filter shared private +%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} +%{?filter_setup} +%endif + + +%description +A simple, low-level PHP extension for libsodium. + +Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection}. + + +%prep +%setup -q -c +mv %{pecl_name}-%{version} NTS + +# Don't install tests +sed -e '/role="test"/d' -i package2.xml + +cd NTS +# Sanity check, really often broken +extver=$(sed -n '/#define PHP_LIBSODIUM_VERSION/{s/.* "//;s/".*$//;p}' php_libsodium.h) +if test "x${extver}" != "x%{version}"; then + : Error: Upstream extension version is ${extver}, expecting %{version}. + exit 1 +fi +cd .. + +%if %{with_zts} +# Duplicate source tree for NTS / 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 +cd NTS +%{_bindir}/phpize +%configure \ + --with-php-config=%{_bindir}/php-config +make %{?_smp_mflags} + +%if %{with_zts} +cd ../ZTS +%{_bindir}/zts-phpize +%configure \ + --with-php-config=%{_bindir}/zts-php-config +make %{?_smp_mflags} +%endif + + +%install +rm -rf %{buildroot} + +make -C NTS install INSTALL_ROOT=%{buildroot} + +# install config file +install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} + +# Install XML package description +install -D -m 644 package2.xml %{buildroot}%{pecl_xmldir}/%{name}.xml + +%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"' package2.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + + +%post +%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : + + +%postun +if [ $1 -eq 0 ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi + + +%check +cd NTS +: Minimal load test for NTS extension +%{__php} --no-php-ini \ + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} + +%if %{with_tests} +: Upstream test suite for NTS extension +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{__php} -n run-tests.php --show-diff +%endif + +%if %{with_zts} +cd ../ZTS +: Minimal load test for ZTS extension +%{__ztsphp} --no-php-ini \ + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} + +%if %{with_tests} +: Upstream test suite for ZTS extension +TEST_PHP_EXECUTABLE=%{_bindir}/zts-php \ +TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{_bindir}/zts-php -n run-tests.php --show-diff +%endif +%endif + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%doc %{pecl_docdir}/%{pecl_name} +%{?_licensedir:%license NTS/LICENSE} + +%{pecl_xmldir}/%{name}.xml +%config(noreplace) %{php_inidir}/%{ini_name} +%{php_extdir}/%{pecl_name}.so + +%if %{with_zts} +%config(noreplace) %{php_ztsinidir}/%{ini_name} +%{php_ztsextdir}/%{pecl_name}.so +%endif + + +%changelog +* Sun Sep 28 2014 Remi Collet <rcollet@redhat.com> - 0.1.1-1 +- initial package, version 0.1.1 (beta) +- open https://github.com/jedisct1/libsodium-php/pull/14
\ No newline at end of file |