Skip to content

Compatibility with libargon2 versions 20161029 and 20160821 #2582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ext/standard/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,21 @@ if test "$PHP_PASSWORD_ARGON2" != "no"; then
PHP_ADD_LIBRARY_WITH_PATH(argon2, $ARGON2_DIR/$PHP_LIBDIR)
PHP_ADD_INCLUDE($ARGON2_DIR/include)

AC_MSG_CHECKING([for argon2_hash function])
AC_CHECK_LIB(argon2, argon2_hash, [
LIBS="$LIBS -largon2"
AC_DEFINE(HAVE_ARGON2LIB, 1, [ Define to 1 if you have the <argon2.h> header file ])
], [
AC_MSG_ERROR([Problem with libargon2.(a|so). Please verify that Argon2 header and libaries are installed])
])

AC_MSG_CHECKING([for argon2id_hash_raw function])
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
Expand Down
3 changes: 3 additions & 0 deletions ext/standard/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
3 changes: 3 additions & 0 deletions ext/standard/password.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down