com php-src: Compatibility with libargon2 versions 20161029 and 20160821: ext/standard/config.m4 ext/standard/config.w32 ext/standard/password.c
| From: | Sara Golemon | Date: | Sun, 18 Jun 2017 23:19:20 +0000 |
| Subject: | com php-src: Compatibility with libargon2 versions 20161029 and 20160821: ext/standard/config.m4 ext/standard/config.w32 ext/standard/password.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98092@lists.php.net to get a copy of this message | ||
Commit: 498716c2f702ed7623fb26653dd3368ab2b59e7b
Author: Charles R. Portwood II <charlesportwoodii@erianna.com> Sun, 18 Jun 2017
19:17:43 -0400
Committer: Sara Golemon <pollita@php.net> Sun, 18 Jun 2017 19:19:20 -0400
Parents: d3c593a5858959810de6fd398206f18d0fffdf10
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=498716c2f702ed7623fb26653dd3368ab2b59e7b
Log:
Compatibility with libargon2 versions 20161029 and 20160821
libargon2 20161029 introduces the
type parameter to the argon2_encodedlen
function that is not present in 20160821. This change ensures the Argon2
functionality introduced in RFC argon2_password_hash is compatible with
both versions, as the library version that package maintainers package may
differ.
Changed paths:
M ext/standard/config.m4
M ext/standard/config.w32
M ext/standard/password.c
Diff:
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 284e74e..87ee059 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -439,6 +439,13 @@ if test "$PHP_PASSWORD_ARGON2" != "no"; then
], [
AC_MSG_ERROR([Problem with libargon2.(a|so). Please verify that Argon2 header and libaries are
installed])
])
+
+ AC_CHECK_LIB(argon2, argon2id_hash_raw, [
+ LIBS="$LIBS -largon2"
+ AC_DEFINE(HAVE_ARGON2ID, 1, [ Define to 1 if Argon2 library has support for Argon2ID])
+ ], [
+ AC_MSG_RESULT([not found])
+ ])
fi
dnl
diff --git a/ext/standard/config.w32 b/ext/standard/config.w32
index 00b2166..ee1935f 100644
--- a/ext/standard/config.w32
+++ b/ext/standard/config.w32
@@ -7,6 +7,9 @@ if (PHP_PASSWORD_ARGON2 != "no") {
if (CHECK_LIB("argon2_a.lib;argon2.lib", null, PHP_PASSWORD_ARGON2)
&& CHECK_HEADER_ADD_INCLUDE("argon2.h", "CFLAGS")) {
AC_DEFINE('HAVE_ARGON2LIB', 1);
+ if (CHECK_FUNC_IN_HEADER("argon2.h", "argon2id_hash_raw", PHP_PHP_BUILD +
"\\include", "CFLAGS")) {
+ AC_DEFINE('HAVE_ARGON2ID', 1);
+ }
} else {
WARNING("Argon2 not enabled; libaries and headers not found");
}
diff --git a/ext/standard/password.c b/ext/standard/password.c
index 2d04bad..5e1704f 100644
--- a/ext/standard/password.c
+++ b/ext/standard/password.c
@@ -545,6 +545,9 @@ PHP_FUNCTION(password_hash)
threads,
(uint32_t)salt_len,
out_len
+#if HAVE_ARGON2ID
+ , type
+#endif
);
out = emalloc(out_len + 1);