@@ -233,19 +233,6 @@ ZEND_END_ARG_INFO()
233
233
# undef crypto_secretstream_xchacha20poly1305_ABYTES
234
234
#endif
235
235
236
- #ifndef crypto_pwhash_OPSLIMIT_MIN
237
- # define crypto_pwhash_OPSLIMIT_MIN crypto_pwhash_OPSLIMIT_INTERACTIVE
238
- #endif
239
- #ifndef crypto_pwhash_MEMLIMIT_MIN
240
- # define crypto_pwhash_MEMLIMIT_MIN crypto_pwhash_MEMLIMIT_INTERACTIVE
241
- #endif
242
- #ifndef crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN
243
- # define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE
244
- #endif
245
- #ifndef crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN
246
- # define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE
247
- #endif
248
-
249
236
const zend_function_entry sodium_functions [] = {
250
237
PHP_FE (sodium_crypto_aead_aes256gcm_is_available , AI_None )
251
238
#ifdef HAVE_AESGCM
@@ -1852,12 +1839,12 @@ PHP_FUNCTION(sodium_crypto_pwhash)
1852
1839
zend_throw_exception (sodium_exception_ce , "salt should be SODIUM_CRYPTO_PWHASH_SALTBYTES bytes" , 0 );
1853
1840
return ;
1854
1841
}
1855
- if (opslimit < crypto_pwhash_OPSLIMIT_MIN ) {
1856
- zend_error (E_ERROR ,
1857
- "number of operations for the password hashing function is too low" );
1842
+ if (opslimit < crypto_pwhash_OPSLIMIT_INTERACTIVE ) {
1843
+ zend_error (E_WARNING ,
1844
+ "number of operations for the password hashing function is low" );
1858
1845
}
1859
- if (memlimit < crypto_pwhash_MEMLIMIT_MIN ) {
1860
- zend_error (E_ERROR , "maximum memory for the password hashing function is too low" );
1846
+ if (memlimit < crypto_pwhash_MEMLIMIT_INTERACTIVE ) {
1847
+ zend_error (E_WARNING , "maximum memory for the password hashing function is low" );
1861
1848
}
1862
1849
hash = zend_string_alloc ((size_t ) hash_len , 0 );
1863
1850
ret = -1 ;
@@ -1915,13 +1902,13 @@ PHP_FUNCTION(sodium_crypto_pwhash_str)
1915
1902
if (passwd_len <= 0 ) {
1916
1903
zend_error (E_WARNING , "empty password" );
1917
1904
}
1918
- if (opslimit < crypto_pwhash_OPSLIMIT_MIN ) {
1919
- zend_error (E_ERROR ,
1920
- "number of operations for the password hashing function is too low" );
1905
+ if (opslimit < crypto_pwhash_OPSLIMIT_INTERACTIVE ) {
1906
+ zend_error (E_WARNING ,
1907
+ "number of operations for the password hashing function is low" );
1921
1908
}
1922
- if (memlimit < crypto_pwhash_MEMLIMIT_MIN ) {
1923
- zend_error (E_ERROR ,
1924
- "maximum memory for the password hashing function is too low" );
1909
+ if (memlimit < crypto_pwhash_MEMLIMIT_INTERACTIVE ) {
1910
+ zend_error (E_WARNING ,
1911
+ "maximum memory for the password hashing function is low" );
1925
1912
}
1926
1913
hash_str = zend_string_alloc (crypto_pwhash_STRBYTES - 1 , 0 );
1927
1914
if (crypto_pwhash_str
@@ -2029,13 +2016,13 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256)
2029
2016
0 );
2030
2017
return ;
2031
2018
}
2032
- if (opslimit < crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE ) {
2033
- zend_error (E_ERROR ,
2034
- "number of operations for the scrypt function is too low" );
2019
+ if (opslimit < crypto_pwhash_scryptsalsa208sha256_opslimit_interactive () ) {
2020
+ zend_error (E_WARNING ,
2021
+ "number of operations for the scrypt function is low" );
2035
2022
}
2036
- if (memlimit < crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE ) {
2037
- zend_error (E_ERROR ,
2038
- "maximum memory for the scrypt function is too low" );
2023
+ if (memlimit < crypto_pwhash_scryptsalsa208sha256_memlimit_interactive () ) {
2024
+ zend_error (E_WARNING ,
2025
+ "maximum memory for the scrypt function is low" );
2039
2026
}
2040
2027
hash = zend_string_alloc ((size_t ) hash_len , 0 );
2041
2028
if (crypto_pwhash_scryptsalsa208sha256
@@ -2076,13 +2063,13 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256_str)
2076
2063
if (passwd_len <= 0 ) {
2077
2064
zend_error (E_WARNING , "empty password" );
2078
2065
}
2079
- if (opslimit < crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE ) {
2080
- zend_error (E_ERROR ,
2081
- "number of operations for the scrypt function is too low" );
2066
+ if (opslimit < crypto_pwhash_scryptsalsa208sha256_opslimit_interactive () ) {
2067
+ zend_error (E_WARNING ,
2068
+ "number of operations for the scrypt function is low" );
2082
2069
}
2083
- if (memlimit < crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE ) {
2084
- zend_error (E_ERROR ,
2085
- "maximum memory for the scrypt function is too low" );
2070
+ if (memlimit < crypto_pwhash_scryptsalsa208sha256_memlimit_interactive () ) {
2071
+ zend_error (E_WARNING ,
2072
+ "maximum memory for the scrypt function is low" );
2086
2073
}
2087
2074
hash_str = zend_string_alloc
2088
2075
(crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1 , 0 );
0 commit comments