php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81476 "with-password-argon2" does build but not work
Submitted: 2021-09-24 17:45 UTC Modified: 2021-10-10 07:52 UTC
Votes:2
Avg. Score:2.0 ± 1.0
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: s dot grindau at smart-media-gmbh dot de Assigned:
Status: Duplicate Package: *Compile Issues
PHP Version: 8.1.0RC2 OS: Arch Linux X64
Private report: No CVE-ID: None
 [2021-09-24 17:45 UTC] 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. 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-24 18:46 UTC] 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-25 13:19 UTC] Danack at basereality dot com
> 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
 [2021-09-27 10:31 UTC] cmb@php.net
-Status: Open +Status: Feedback
 [2021-09-27 19:06 UTC] s dot grindau at smart-media-gmbh dot de
i could of course check for 
definition of the constant "PASSWORD_ARGON2_DEFAULT_THREADS".
but this does not solve the solution of the compilation process.

latest 8.0 builds fine, i tried adding libargon to configure with no success.
configure should fail imho if its unable to find it.

so this new "feature" is buggy at lease on my Arch machine.
 [2021-10-10 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2021-10-10 07:52 UTC] nikic@php.net
-Status: No Feedback +Status: Duplicate
 [2021-10-10 07:52 UTC] nikic@php.net
This is the same issue as bug #81491, which has been fixed in the meantime.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC