mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Merge branch 'PHP-7.2'
* PHP-7.2: ext/sodium: throw exceptions instead of errors
This commit is contained in:
commit
c4347f4f74
@ -1853,11 +1853,13 @@ PHP_FUNCTION(sodium_crypto_pwhash)
|
||||
return;
|
||||
}
|
||||
if (opslimit < crypto_pwhash_OPSLIMIT_MIN) {
|
||||
zend_error(E_ERROR,
|
||||
"number of operations for the password hashing function is too low");
|
||||
zend_throw_exception(sodium_exception_ce,
|
||||
"number of operations for the password hashing function is too low", 0);
|
||||
return;
|
||||
}
|
||||
if (memlimit < crypto_pwhash_MEMLIMIT_MIN) {
|
||||
zend_error(E_ERROR, "maximum memory for the password hashing function is too low");
|
||||
zend_throw_exception(sodium_exception_ce,
|
||||
"maximum memory for the password hashing function is too low", 0);
|
||||
}
|
||||
hash = zend_string_alloc((size_t) hash_len, 0);
|
||||
ret = -1;
|
||||
@ -1916,12 +1918,12 @@ PHP_FUNCTION(sodium_crypto_pwhash_str)
|
||||
zend_error(E_WARNING, "empty password");
|
||||
}
|
||||
if (opslimit < crypto_pwhash_OPSLIMIT_MIN) {
|
||||
zend_error(E_ERROR,
|
||||
"number of operations for the password hashing function is too low");
|
||||
zend_throw_exception(sodium_exception_ce,
|
||||
"number of operations for the password hashing function is too low", 0);
|
||||
}
|
||||
if (memlimit < crypto_pwhash_MEMLIMIT_MIN) {
|
||||
zend_error(E_ERROR,
|
||||
"maximum memory for the password hashing function is too low");
|
||||
zend_throw_exception(sodium_exception_ce,
|
||||
"maximum memory for the password hashing function is too low", 0);
|
||||
}
|
||||
hash_str = zend_string_alloc(crypto_pwhash_STRBYTES - 1, 0);
|
||||
if (crypto_pwhash_str
|
||||
@ -2030,12 +2032,12 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256)
|
||||
return;
|
||||
}
|
||||
if (opslimit < crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE) {
|
||||
zend_error(E_ERROR,
|
||||
"number of operations for the scrypt function is too low");
|
||||
zend_throw_exception(sodium_exception_ce,
|
||||
"number of operations for the scrypt function is too low", 0);
|
||||
}
|
||||
if (memlimit < crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE) {
|
||||
zend_error(E_ERROR,
|
||||
"maximum memory for the scrypt function is too low");
|
||||
zend_throw_exception(sodium_exception_ce,
|
||||
"maximum memory for the scrypt function is too low", 0);
|
||||
}
|
||||
hash = zend_string_alloc((size_t) hash_len, 0);
|
||||
if (crypto_pwhash_scryptsalsa208sha256
|
||||
@ -2077,12 +2079,12 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256_str)
|
||||
zend_error(E_WARNING, "empty password");
|
||||
}
|
||||
if (opslimit < crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE) {
|
||||
zend_error(E_ERROR,
|
||||
"number of operations for the scrypt function is too low");
|
||||
zend_throw_exception(sodium_exception_ce,
|
||||
"number of operations for the scrypt function is too low", 0);
|
||||
}
|
||||
if (memlimit < crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE) {
|
||||
zend_error(E_ERROR,
|
||||
"maximum memory for the scrypt function is too low");
|
||||
zend_throw_exception(sodium_exception_ce,
|
||||
"maximum memory for the scrypt function is too low", 0);
|
||||
}
|
||||
hash_str = zend_string_alloc
|
||||
(crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user