Skip to content

Commit 6879173

Browse files
[Security/Core] require libsodium >= 1.0.14
1 parent f956b24 commit 6879173

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

Encoder/NativePasswordEncoder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function __construct(int $opsLimit = null, int $memLimit = null, int $cos
3333
$opsLimit = $opsLimit ?? max(6, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE : 6);
3434
$memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 1024);
3535

36-
if (2 > $opsLimit) {
37-
throw new \InvalidArgumentException('$opsLimit must be 2 or greater.');
36+
if (3 > $opsLimit) {
37+
throw new \InvalidArgumentException('$opsLimit must be 3 or greater.');
3838
}
3939

4040
if (10 * 1024 > $memLimit) {

Encoder/SodiumPasswordEncoder.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public function __construct(int $opsLimit = null, int $memLimit = null)
3737
$this->opsLimit = $opsLimit ?? max(6, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE : 6);
3838
$this->memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 2014);
3939

40-
if (2 > $this->opsLimit) {
41-
throw new \InvalidArgumentException('$opsLimit must be 2 or greater.');
40+
if (3 > $this->opsLimit) {
41+
throw new \InvalidArgumentException('$opsLimit must be 3 or greater.');
4242
}
4343

4444
if (10 * 1024 > $this->memLimit) {
@@ -48,11 +48,7 @@ public function __construct(int $opsLimit = null, int $memLimit = null)
4848

4949
public static function isSupported(): bool
5050
{
51-
if (class_exists('ParagonIE_Sodium_Compat') && method_exists('ParagonIE_Sodium_Compat', 'crypto_pwhash_is_available')) {
52-
return \ParagonIE_Sodium_Compat::crypto_pwhash_is_available();
53-
}
54-
55-
return \function_exists('sodium_crypto_pwhash_str') || \extension_loaded('libsodium');
51+
return \function_exists('sodium_crypto_pwhash_str_needs_rehash') || \function_exists('Sodium\crypto_pwhash_str_needs_rehash');
5652
}
5753

5854
/**

0 commit comments

Comments
 (0)