Bug #81476 [Com]: "with-password-argon2" does build but not work
Edit report at https://bugs.php.net/bug.php?id=81476&edit=1
ID: 81476
Comment by: Danack at basereality dot com
Reported by: s dot grindau at smart-media-gmbh dot de
Summary: "with-password-argon2" does build but not work
Status: Open
Type: Bug
Package: *Compile Issues
Operating System: Arch Linux X64
PHP Version: 8.1.0RC2
Block user comment: N
Private report: N
New Comment:
> but crashed because of the $options['threads' => 8 ]
Apparently you should be checking for whether the PASSWORD_ARGON2_DEFAULT_THREADS constant is
defined, to know if the options for that function supports a 'threads' setting, and only
set it if it's available:
if(defined('PASSWORD_ARGON2_DEFAULT_THREADS'))
{
// Set the number of threads
...
}
https://stackoverflow.com/a/69326446/778719
Previous Comments:
------------------------------------------------------------------------
[2021-09-24 18:46:49] Danack at basereality dot com
There was a change in how the location of libargon2 was detected: https://github.com/php/php-src/blob/bec1d2f290b153061fe1be6972ac59c3afc4e253/UPGRADING#L593-L596
"--with-password-argon2 now uses pkg-config to detect libargon2. As such,
an alternative libargon2 location should now be specified using
PKG_CONFIG_PATH."
If configure doesn't find where it is, you may need to tell configure the path that it is
installed on.
Possibly related https://bugs.php.net/bug.php?id=80407
There should be info in the config.log about how libargon2 wasn't found...which might say what
package config is returning.
------------------------------------------------------------------------
[2021-09-24 17:45:40] s dot grindau at smart-media-gmbh dot de
Description:
------------
compiling from source with "with-password-argon2" results in argon2 not beeing available.
after compiling 8.0.11
php -r 'print_r(get_defined_constants());' | grep -i argon
[PASSWORD_ARGON2I] => argon2i
[PASSWORD_ARGON2ID] => argon2id
[PASSWORD_ARGON2_DEFAULT_MEMORY_COST] => 65536
[PASSWORD_ARGON2_DEFAULT_TIME_COST] => 4
[PASSWORD_ARGON2_DEFAULT_THREADS] => 1
[PASSWORD_ARGON2_PROVIDER] => standard
after compiling 8.1.0RC1 OR 8.1.0RC2
php -r 'print_r(get_defined_constants());' | grep -i argon
-> nothing!
i tried one build with sodium, which then showed argon2 because i found a hint on stackoverflow
which then had the constants available but crashed because of the $options['threads' =>
8 ], because it supports only one thread.
However i wanted to use it like before without sodium, etc.
I have to say that i am not THAT experienced in building php from source. However other builds from
the stable releases work with the same configure options and i havent a bugreport about this (yet).
Thank you.
Test script:
---------------
./configure \
--disable-all \
--with-password-argon2 \
...
make -j32
sudo make install
Expected result:
----------------
I expected the argon2id constants to be available and the password_hash() function to work like it
ever did.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81476&edit=1
Thread (7 messages)