summaryrefslogtreecommitdiff
path: root/ext/sodium
diff options
context:
space:
mode:
authorMáté Kocsis <kocsismate@woohoolabs.com>2019-11-20 02:21:06 +0100
committerMáté Kocsis <kocsismate@woohoolabs.com>2019-12-12 12:14:53 +0100
commit37c1171451d003a726eab0c51eb70343ad231585 (patch)
treee91ccf42dbd372af5fef28db4710a501fd29a8eb /ext/sodium
parentd56768817b6c8df0f8966bd1ee1d121741631ac2 (diff)
downloadphp-git-37c1171451d003a726eab0c51eb70343ad231585.tar.gz
Promote warnings to exceptions in password_*() functions
Diffstat (limited to 'ext/sodium')
-rw-r--r--ext/sodium/sodium_pwhash.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/sodium/sodium_pwhash.c b/ext/sodium/sodium_pwhash.c
index 3ff304c452..e58a9514cc 100644
--- a/ext/sodium/sodium_pwhash.c
+++ b/ext/sodium/sodium_pwhash.c
@@ -50,7 +50,7 @@ static inline int get_options(zend_array *options, size_t *memlimit, size_t *ops
zend_long smemlimit = zval_get_long(opt);
if ((smemlimit < 0) || (smemlimit < crypto_pwhash_MEMLIMIT_MIN >> 10) || (smemlimit > (crypto_pwhash_MEMLIMIT_MAX >> 10))) {
- php_error_docref(NULL, E_WARNING, "Memory cost is outside of allowed memory range");
+ zend_value_error("Memory cost is outside of allowed memory range");
return FAILURE;
}
*memlimit = smemlimit << 10;
@@ -58,12 +58,12 @@ static inline int get_options(zend_array *options, size_t *memlimit, size_t *ops
if ((opt = zend_hash_str_find(options, "time_cost", strlen("time_cost")))) {
*opslimit = zval_get_long(opt);
if ((*opslimit < crypto_pwhash_OPSLIMIT_MIN) || (*opslimit > crypto_pwhash_OPSLIMIT_MAX)) {
- php_error_docref(NULL, E_WARNING, "Time cost is outside of allowed time range");
+ zend_value_error("Time cost is outside of allowed time range");
return FAILURE;
}
}
if ((opt = zend_hash_str_find(options, "threads", strlen("threads"))) && (zval_get_long(opt) != 1)) {
- php_error_docref(NULL, E_WARNING, "A thread value other than 1 is not supported by this implementation");
+ zend_value_error("A thread value other than 1 is not supported by this implementation");
return FAILURE;
}
return SUCCESS;
@@ -74,7 +74,7 @@ static zend_string *php_sodium_argon2_hash(const zend_string *password, zend_arr
zend_string *ret;
if ((ZSTR_LEN(password) >= 0xffffffff)) {
- php_error_docref(NULL, E_WARNING, "Password is too long");
+ zend_value_error("Password is too long");
return NULL;
}
@@ -84,7 +84,7 @@ static zend_string *php_sodium_argon2_hash(const zend_string *password, zend_arr
ret = zend_string_alloc(crypto_pwhash_STRBYTES - 1, 0);
if (crypto_pwhash_str_alg(ZSTR_VAL(ret), ZSTR_VAL(password), ZSTR_LEN(password), opslimit, memlimit, alg)) {
- php_error_docref(NULL, E_WARNING, "Unexpected failure hashing password");
+ zend_value_error("Unexpected failure hashing password");
zend_string_release(ret);
return NULL;
}