forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RFC: https://wiki.php.net/rfc/libsodium Licensing: https://web.archive.org/web/20170710161517/https://github.com/jedisct1/libsodium-php/issues/127
- Loading branch information
1 parent
da2583b
commit 5cfa26c
Showing
30 changed files
with
3,848 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ addons: | |
- libpspell-dev | ||
- librecode-dev | ||
- libsasl2-dev | ||
- libsodium-dev | ||
- libxpm-dev | ||
- libt1-dev | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -419,6 +419,12 @@ MAINTENANCE: Maintained | |
STATUS: Working | ||
SINCE: 4.0.2 | ||
------------------------------------------------------------------------------- | ||
EXTENSION: sodium | ||
PRIMARY MAINTAINER: Frank Denis <[email protected]> | ||
MAINTENANCE: Maintained | ||
STATUS: Working | ||
SINCE: 7.2.0 | ||
------------------------------------------------------------------------------- | ||
EXTENSION: spl | ||
PRIMARY MAINTAINER: Marcus Boerger <[email protected]>, Etienne Kneuss <[email protected]> | ||
MAINTENANCE: Maintained | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
;; libsodium | ||
Frank Denis [[email protected]] (lead) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[![Build Status](https://travis-ci.org/jedisct1/libsodium-php.svg?branch=master)](https://travis-ci.org/jedisct1/libsodium-php?branch=master) | ||
|
||
libsodium-php | ||
============= | ||
|
||
A simple, low-level PHP extension for | ||
[libsodium](https://github.com/jedisct1/libsodium). | ||
|
||
Full documentation here: | ||
[Using Libsodium in PHP Projects](https://paragonie.com/book/pecl-libsodium), | ||
a guide to using the libsodium PHP extension for modern, secure, and | ||
fast cryptography. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
dnl $Id$ | ||
dnl config.m4 for extension sodium | ||
|
||
PHP_ARG_WITH(sodium, for sodium support, | ||
[ --with-sodium Include sodium support]) | ||
|
||
PHP_ARG_WITH(libsodium, for libsodium library location, | ||
[ --with-libsodium[[=DIR]] libsodium library location, else rely on pkg-config]) | ||
|
||
if test "$PHP_SODIUM" != "no"; then | ||
SEARCH_PATH="/usr/local /usr" # you might want to change this | ||
SEARCH_FOR="/include/sodium.h" # you most likely want to change this | ||
|
||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | ||
AC_MSG_CHECKING([for libsodium]) | ||
|
||
dnl user provided location | ||
if test -r $PHP_LIBSODIUM/$SEARCH_FOR; then # path given as parameter | ||
LIBSODIUM_DIR=$PHP_LIBSODIUM | ||
AC_MSG_RESULT([found in $PHP_LIBSODIUM]) | ||
|
||
dnl pkg-config output | ||
elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsodium; then | ||
LIBSODIUM_CFLAGS=`$PKG_CONFIG libsodium --cflags` | ||
LIBSODIUM_LIBS=`$PKG_CONFIG libsodium --libs` | ||
LIBSODIUM_VERSION=`$PKG_CONFIG libsodium --modversion` | ||
AC_MSG_RESULT(version $LIBSODIUM_VERSION found using pkg-config) | ||
PHP_EVAL_LIBLINE($LIBSODIUM_LIBS, SODIUM_SHARED_LIBADD) | ||
PHP_EVAL_INCLINE($LIBSODIUM_CFLAGS) | ||
|
||
dnl search default path list | ||
else | ||
for i in $SEARCH_PATH ; do | ||
if test -r $i/$SEARCH_FOR; then | ||
LIBSODIUM_DIR=$i | ||
AC_MSG_RESULT(found in $i) | ||
fi | ||
done | ||
if test -z "$LIBSODIUM_DIR"; then | ||
AC_MSG_ERROR([Please install libsodium - See https://github.com/jedisct1/libsodium]) | ||
fi | ||
fi | ||
|
||
LIBNAME=sodium | ||
LIBSYMBOL=crypto_pwhash_scryptsalsa208sha256 | ||
|
||
if test -n "$LIBSODIUM_DIR"; then | ||
PHP_ADD_INCLUDE($LIBSODIUM_DIR/include) | ||
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $LIBSODIUM_DIR/$PHP_LIBDIR, SODIUM_SHARED_LIBADD) | ||
fi | ||
|
||
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, | ||
[ | ||
AC_DEFINE(HAVE_LIBSODIUMLIB,1,[ ]) | ||
],[ | ||
AC_MSG_ERROR([wrong libsodium lib version or lib not found]) | ||
],[ | ||
]) | ||
PHP_CHECK_LIBRARY($LIBNAME,crypto_aead_aes256gcm_encrypt, | ||
[ | ||
AC_DEFINE(HAVE_CRYPTO_AEAD_AES256GCM,1,[ ]) | ||
],[],[ | ||
]) | ||
|
||
PHP_SUBST(SODIUM_SHARED_LIBADD) | ||
|
||
PHP_NEW_EXTENSION(sodium, libsodium.c, $ext_shared) | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// $Id$ | ||
// vim:ft=javascript | ||
|
||
ARG_WITH("sodium", "for libsodium support", "no"); | ||
|
||
if (PHP_SODIUM != "no") { | ||
if (CHECK_LIB("libsodium.lib", "sodium", PHP_SODIUM) && CHECK_HEADER_ADD_INCLUDE("sodium.h", "CFLAGS_SODIUM")) { | ||
EXTENSION("sodium", "libsodium.c"); | ||
AC_DEFINE('HAVE_LIBSODIUMLIB', 1 , 'Have the Sodium library'); | ||
PHP_INSTALL_HEADERS("ext/sodium/", "php_libsodium.h"); | ||
} else { | ||
WARNING("libsodium not enabled; libraries and headers not found"); | ||
} | ||
} |
Oops, something went wrong.