}
ZVAL_DEREF(buf_zv);
if (Z_TYPE_P(buf_zv) != IS_STRING) {
- zend_throw_exception(sodium_exception_ce, "memzero: a PHP string is required", 0);
+ zend_throw_exception(sodium_exception_ce, "a PHP string is required", 0);
return;
}
if (Z_REFCOUNTED_P(buf_zv) && Z_REFCOUNT_P(buf_zv) == 1) {
}
ZVAL_DEREF(val_zv);
if (Z_TYPE_P(val_zv) != IS_STRING) {
- zend_throw_exception(sodium_exception_ce, "increment(): a PHP string is required", 0);
+ zend_throw_exception(sodium_exception_ce, "a PHP string is required", 0);
return;
}
}
ZVAL_DEREF(val_zv);
if (Z_TYPE_P(val_zv) != IS_STRING) {
- zend_throw_exception(sodium_exception_ce, "add(): PHP strings are required", 0);
+ zend_throw_exception(sodium_exception_ce, "PHP strings are required", 0);
return;
}
val = (unsigned char *) Z_STRVAL(*val_zv);
val_len = Z_STRLEN(*val_zv);
if (val_len != addv_len) {
- zend_throw_exception(sodium_exception_ce, "add(): values must have the same length", 0);
+ zend_throw_exception(sodium_exception_ce, "values must have the same length", 0);
return;
}
c = 0U;
return;
}
if (len1 != len2) {
- zend_throw_exception(sodium_exception_ce, "memcmp(): arguments have different sizes", 0);
+ zend_throw_exception(sodium_exception_ce, "arguments have different sizes", 0);
} else {
RETURN_LONG(sodium_memcmp(buf1, buf2, len1));
}
}
if (key_len != crypto_shorthash_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_shorthash(): key size should be "
- "CRYPTO_SHORTHASH_KEYBYTES bytes",
+ "key size should be CRYPTO_SHORTHASH_KEYBYTES bytes",
0);
return;
}
if (crypto_shorthash((unsigned char *) ZSTR_VAL(hash), msg,
(unsigned long long) msg_len, key) != 0) {
zend_string_free(hash);
- zend_throw_exception(sodium_exception_ce, "crypto_shorthash(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(hash)[crypto_shorthash_BYTES] = 0;
}
if (nonce_len != crypto_secretbox_NONCEBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_secretbox(): nonce size should be "
- "CRYPTO_SECRETBOX_NONCEBYTES bytes",
+ "nonce size should be CRYPTO_SECRETBOX_NONCEBYTES bytes",
0);
return;
}
if (key_len != crypto_secretbox_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_secretbox(): key size should be "
- "CRYPTO_SECRETBOX_KEYBYTES bytes",
+ "key size should be CRYPTO_SECRETBOX_KEYBYTES bytes",
0);
return;
}
msg, (unsigned long long) msg_len,
nonce, key) != 0) {
zend_string_free(ciphertext);
- zend_throw_exception(sodium_exception_ce, "crypto_secretbox(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(ciphertext)[msg_len + crypto_secretbox_MACBYTES] = 0;
}
if (nonce_len != crypto_secretbox_NONCEBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_secretbox_open(): nonce size should be "
- "CRYPTO_SECRETBOX_NONCEBYTES bytes",
+ "nonce size should be CRYPTO_SECRETBOX_NONCEBYTES bytes",
0);
return;
}
if (key_len != crypto_secretbox_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_secretbox_open(): key size should be "
- "CRYPTO_SECRETBOX_KEYBYTES bytes",
+ "key size should be CRYPTO_SECRETBOX_KEYBYTES bytes",
0);
return;
}
}
if (hash_len < crypto_generichash_BYTES_MIN ||
hash_len > crypto_generichash_BYTES_MAX) {
- zend_throw_exception(sodium_exception_ce, "crypto_generichash(): unsupported output length", 0);
+ zend_throw_exception(sodium_exception_ce, "unsupported output length", 0);
return;
}
if (key_len != 0 &&
(key_len < crypto_generichash_KEYBYTES_MIN ||
key_len > crypto_generichash_KEYBYTES_MAX)) {
- zend_throw_exception(sodium_exception_ce, "crypto_generichash(): unsupported key length", 0);
+ zend_throw_exception(sodium_exception_ce, "unsupported key length", 0);
return;
}
hash = zend_string_alloc(hash_len, 0);
msg, (unsigned long long) msg_len,
key, (size_t) key_len) != 0) {
zend_string_free(hash);
- zend_throw_exception(sodium_exception_ce, "crypto_generichash(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(hash)[hash_len] = 0;
}
if (hash_len < crypto_generichash_BYTES_MIN ||
hash_len > crypto_generichash_BYTES_MAX) {
- zend_throw_exception(sodium_exception_ce, "crypto_generichash_init(): unsupported output length", 0);
+ zend_throw_exception(sodium_exception_ce, "unsupported output length", 0);
return;
}
if (key_len != 0 &&
(key_len < crypto_generichash_KEYBYTES_MIN ||
key_len > crypto_generichash_KEYBYTES_MAX)) {
- zend_throw_exception(sodium_exception_ce, "crypto_generichash_init(): unsupported key length", 0);
+ zend_throw_exception(sodium_exception_ce, "unsupported key length", 0);
return;
}
if (crypto_generichash_init((void *) &state_tmp, key, (size_t) key_len,
(size_t) hash_len) != 0) {
- zend_throw_exception(sodium_exception_ce, "crypto_generichash_init(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
state = zend_string_alloc(state_len, 0);
}
ZVAL_DEREF(state_zv);
if (Z_TYPE_P(state_zv) != IS_STRING) {
- zend_throw_exception(sodium_exception_ce, "crypto_generichash_update: a reference to a state is required", 0);
+ zend_throw_exception(sodium_exception_ce, "a reference to a state is required", 0);
return;
}
sodium_separate_string(state_zv);
state = (unsigned char *) Z_STRVAL(*state_zv);
state_len = Z_STRLEN(*state_zv);
if (state_len != sizeof (crypto_generichash_state)) {
- zend_throw_exception(sodium_exception_ce, "crypto_generichash_update(): incorrect state length", 0);
+ zend_throw_exception(sodium_exception_ce, "incorrect state length", 0);
return;
}
memcpy(&state_tmp, state, sizeof state_tmp);
if (crypto_generichash_update((void *) &state_tmp, msg,
(unsigned long long) msg_len) != 0) {
- zend_throw_exception(sodium_exception_ce, "crypto_generichash_update(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
memcpy(state, &state_tmp, state_len);
}
ZVAL_DEREF(state_zv);
if (Z_TYPE_P(state_zv) != IS_STRING) {
- zend_throw_exception(sodium_exception_ce, "crypto_generichash_final: a reference to a state is required", 0);
+ zend_throw_exception(sodium_exception_ce, "a reference to a state is required", 0);
return;
}
sodium_separate_string(state_zv);
state = (unsigned char *) Z_STRVAL(*state_zv);
state_len = Z_STRLEN(*state_zv);
if (state_len != sizeof (crypto_generichash_state)) {
- zend_throw_exception(sodium_exception_ce, "crypto_generichash_final(): incorrect state length", 0);
+ zend_throw_exception(sodium_exception_ce, "incorrect state length", 0);
return;
}
if (hash_len < crypto_generichash_BYTES_MIN ||
hash_len > crypto_generichash_BYTES_MAX) {
- zend_throw_exception(sodium_exception_ce, "crypto_generichash_final(): unsupported output length", 0);
+ zend_throw_exception(sodium_exception_ce, "unsupported output length", 0);
return;
}
hash = zend_string_alloc(hash_len, 0);
(unsigned char *) ZSTR_VAL(hash),
(size_t) hash_len) != 0) {
zend_string_free(hash);
- zend_throw_exception(sodium_exception_ce, "crypto_generichash_final(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
sodium_memzero(state, state_len);
crypto_box_SECRETKEYBYTES,
(unsigned char *) ZSTR_VAL(keypair)) != 0) {
zend_string_free(keypair);
- zend_throw_exception(sodium_exception_ce, "crypto_box_keypair(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(keypair)[keypair_len] = 0;
}
if (seed_len != crypto_box_SEEDBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box_seed_keypair(): "
"seed should be CRYPTO_BOX_SEEDBYTES bytes",
0);
return;
(unsigned char *) ZSTR_VAL(keypair),
seed) != 0) {
zend_string_free(keypair);
- zend_throw_exception(sodium_exception_ce, "crypto_box_seed_keypair(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(keypair)[keypair_len] = 0;
}
if (secretkey_len != crypto_box_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box_keypair_from_secretkey_and_publickey(): "
"secretkey should be CRYPTO_BOX_SECRETKEYBYTES bytes",
0);
return;
}
if (publickey_len != crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box_keypair_from_secretkey_and_publickey(): "
"publickey should be CRYPTO_BOX_PUBLICKEYBYTES bytes",
0);
return;
if (keypair_len !=
crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box_secretkey(): keypair should be "
- "CRYPTO_BOX_KEYPAIRBYTES bytes",
+ "keypair should be CRYPTO_BOX_KEYPAIRBYTES bytes",
0);
return;
}
if (keypair_len !=
crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box_publickey(): keypair should be "
- "CRYPTO_BOX_KEYPAIRBYTES bytes",
+ "keypair should be CRYPTO_BOX_KEYPAIRBYTES bytes",
0);
return;
}
}
if (secretkey_len != crypto_box_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box_publickey_from_secretkey(): key should be "
- "CRYPTO_BOX_SECRETKEYBYTES bytes",
+ "key should be CRYPTO_BOX_SECRETKEYBYTES bytes",
0);
return;
}
}
if (nonce_len != crypto_box_NONCEBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box(): nonce size should be "
- "CRYPTO_BOX_NONCEBYTES bytes",
+ "nonce size should be CRYPTO_BOX_NONCEBYTES bytes",
0);
return;
}
if (keypair_len != crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box(): keypair size should be "
- "CRYPTO_BOX_KEYPAIRBYTES bytes",
+ "keypair size should be CRYPTO_BOX_KEYPAIRBYTES bytes",
0);
return;
}
(unsigned long long) msg_len,
nonce, publickey, secretkey) != 0) {
zend_string_free(ciphertext);
- zend_throw_exception(sodium_exception_ce, "crypto_box(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(ciphertext)[msg_len + crypto_box_MACBYTES] = 0;
}
if (nonce_len != crypto_box_NONCEBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box_open(): nonce size should be "
- "CRYPTO_BOX_NONCEBYTES bytes",
+ "nonce size should be CRYPTO_BOX_NONCEBYTES bytes",
0);
return;
}
if (keypair_len != crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box_open(): keypair size should be "
- "CRYPTO_BOX_KEYBYTES bytes",
+ "keypair size should be CRYPTO_BOX_KEYBYTES bytes",
0);
return;
}
}
if (publickey_len != crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box_seal(): public key size should be "
- "CRYPTO_BOX_PUBLICKEYBYTES bytes",
+ "public key size should be CRYPTO_BOX_PUBLICKEYBYTES bytes",
0);
return;
}
if (crypto_box_seal((unsigned char *) ZSTR_VAL(ciphertext), msg,
(unsigned long long) msg_len, publickey) != 0) {
zend_string_free(ciphertext);
- zend_throw_exception(sodium_exception_ce, "crypto_box_seal(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(ciphertext)[msg_len + crypto_box_SEALBYTES] = 0;
}
if (keypair_len != crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_box_seal_open(): keypair size should be "
- "CRYPTO_BOX_KEYBYTES bytes",
+ "keypair size should be CRYPTO_BOX_KEYBYTES bytes",
0);
return;
}
crypto_sign_SECRETKEYBYTES,
(unsigned char *) ZSTR_VAL(keypair)) != 0) {
zend_string_free(keypair);
- zend_throw_exception(sodium_exception_ce, "crypto_sign_keypair(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(keypair)[keypair_len] = 0;
}
if (seed_len != crypto_sign_SEEDBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_seed_keypair(): "
"seed should be CRYPTO_SIGN_SEEDBYTES bytes",
0);
return;
(unsigned char *) ZSTR_VAL(keypair),
seed) != 0) {
zend_string_free(keypair);
- zend_throw_exception(sodium_exception_ce, "crypto_sign_seed_keypair(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(keypair)[keypair_len] = 0;
}
if (secretkey_len != crypto_sign_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_keypair_from_secretkey_and_publickey(): "
"secretkey should be CRYPTO_SIGN_SECRETKEYBYTES bytes",
0);
return;
}
if (publickey_len != crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_keypair_from_secretkey_and_publickey(): "
"publickey should be CRYPTO_SIGN_PUBLICKEYBYTES bytes",
0);
return;
}
if (secretkey_len != crypto_sign_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_publickey_from_secretkey(): "
"secretkey should be CRYPTO_SIGN_SECRETKEYBYTES bytes",
0);
return;
if (crypto_sign_ed25519_sk_to_pk((unsigned char *) ZSTR_VAL(publickey),
(const unsigned char *) secretkey) != 0) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_publickey_from_secretkey(): internal error", 0);
+ "internal error", 0);
return;
}
ZSTR_VAL(publickey)[crypto_sign_PUBLICKEYBYTES] = 0;
if (keypair_len !=
crypto_sign_SECRETKEYBYTES + crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_secretkey(): keypair should be "
- "CRYPTO_SIGN_KEYPAIRBYTES bytes",
+ "keypair should be CRYPTO_SIGN_KEYPAIRBYTES bytes",
0);
return;
}
if (keypair_len !=
crypto_sign_SECRETKEYBYTES + crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_publickey(): keypair should be "
- "CRYPTO_SIGN_KEYPAIRBYTES bytes",
+ "keypair should be CRYPTO_SIGN_KEYPAIRBYTES bytes",
0);
return;
}
}
if (secretkey_len != crypto_sign_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign(): secret key size should be "
- "CRYPTO_SIGN_SECRETKEYBYTES bytes",
+ "secret key size should be CRYPTO_SIGN_SECRETKEYBYTES bytes",
0);
return;
}
&msg_signed_real_len, msg,
(unsigned long long) msg_len, secretkey) != 0) {
zend_string_free(msg_signed);
- zend_throw_exception(sodium_exception_ce, "crypto_sign(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
if (msg_signed_real_len <= 0U || msg_signed_real_len >= SIZE_MAX ||
}
if (publickey_len != crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_open(): public key size should be "
- "CRYPTO_SIGN_PUBLICKEYBYTES bytes",
+ "public key size should be CRYPTO_SIGN_PUBLICKEYBYTES bytes",
0);
return;
}
}
if (secretkey_len != crypto_sign_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_detached(): secret key size should be "
- "CRYPTO_SIGN_SECRETKEYBYTES bytes",
+ "secret key size should be CRYPTO_SIGN_SECRETKEYBYTES bytes",
0);
return;
}
&signature_real_len, msg,
(unsigned long long) msg_len, secretkey) != 0) {
zend_string_free(signature);
- zend_throw_exception(sodium_exception_ce, "crypto_sign_detached()", 0);
+ zend_throw_exception(sodium_exception_ce, "signature creation failed", 0);
return;
}
if (signature_real_len <= 0U || signature_real_len > crypto_sign_BYTES) {
}
if (signature_len != crypto_sign_BYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_verify_detached(): signature size should be "
- "CRYPTO_SIGN_BYTES bytes",
+ "signature size should be CRYPTO_SIGN_BYTES bytes",
0);
return;
}
if (publickey_len != crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_verify_detached(): public key size should be "
- "CRYPTO_SIGN_PUBLICKEYBYTES bytes",
+ "public key size should be CRYPTO_SIGN_PUBLICKEYBYTES bytes",
0);
return;
}
return;
}
if (ciphertext_len <= 0 || ciphertext_len >= SIZE_MAX) {
- zend_throw_exception(sodium_exception_ce, "crypto_stream(): invalid length", 0);
+ zend_throw_exception(sodium_exception_ce, "invalid length", 0);
return;
}
if (nonce_len != crypto_stream_NONCEBYTES) {
if (crypto_stream((unsigned char *) ZSTR_VAL(ciphertext),
(unsigned long long) ciphertext_len, nonce, key) != 0) {
zend_string_free(ciphertext);
- zend_throw_exception(sodium_exception_ce, "crypto_stream(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(ciphertext)[ciphertext_len] = 0;
if (crypto_stream_xor((unsigned char *) ZSTR_VAL(ciphertext), msg,
(unsigned long long) msg_len, nonce, key) != 0) {
zend_string_free(ciphertext);
- zend_throw_exception(sodium_exception_ce, "crypto_stream_xor(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(ciphertext)[ciphertext_len] = 0;
&opslimit, &memlimit) == FAILURE ||
hash_len <= 0 || hash_len >= SIZE_MAX ||
opslimit <= 0 || memlimit <= 0 || memlimit > SIZE_MAX) {
- zend_throw_exception(sodium_exception_ce, "crypto_pwhash_scryptsalsa208sha256(): invalid parameters", 0);
+ zend_throw_exception(sodium_exception_ce, "invalid parameters", 0);
return;
}
if (passwd_len <= 0) {
passwd, (unsigned long long) passwd_len, salt,
(unsigned long long) opslimit, (size_t) memlimit) != 0) {
zend_string_free(hash);
- zend_throw_exception(sodium_exception_ce, "crypto_pwhash_scryptsalsa208sha256(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(hash)[hash_len] = 0;
&opslimit, &memlimit) == FAILURE ||
opslimit <= 0 || memlimit <= 0 || memlimit > SIZE_MAX) {
zend_throw_exception(sodium_exception_ce,
- "crypto_pwhash_scryptsalsa208sha256_str(): invalid parameters",
+ "invalid parameters",
0);
return;
}
(ZSTR_VAL(hash_str), passwd, (unsigned long long) passwd_len,
(unsigned long long) opslimit, (size_t) memlimit) != 0) {
zend_string_free(hash_str);
- zend_throw_exception(sodium_exception_ce, "crypto_pwhash_scryptsalsa208sha256_str(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(hash_str)[crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1] = 0;
&hash_str, &hash_str_len,
&passwd, &passwd_len) == FAILURE) {
zend_throw_exception(sodium_exception_ce,
- "crypto_pwhash_scryptsalsa208sha256_str_verify(): invalid parameters",
+ "invalid parameters",
0);
return;
}
&opslimit, &memlimit) == FAILURE ||
hash_len <= 0 || hash_len >= SIZE_MAX ||
opslimit <= 0 || memlimit <= 0 || memlimit > SIZE_MAX) {
- zend_throw_exception(sodium_exception_ce, "crypto_pwhash(): invalid parameters", 0);
+ zend_throw_exception(sodium_exception_ce, "invalid parameters", 0);
return;
}
if (passwd_len <= 0) {
(unsigned long long) opslimit, (size_t) memlimit,
crypto_pwhash_alg_default()) != 0) {
zend_string_free(hash);
- zend_throw_exception(sodium_exception_ce, "crypto_pwhash(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(hash)[hash_len] = 0;
&opslimit, &memlimit) == FAILURE ||
opslimit <= 0 || memlimit <= 0 || memlimit > SIZE_MAX) {
zend_throw_exception(sodium_exception_ce,
- "crypto_pwhash_str(): invalid parameters",
+ "invalid parameters",
0);
return;
}
(ZSTR_VAL(hash_str), passwd, (unsigned long long) passwd_len,
(unsigned long long) opslimit, (size_t) memlimit) != 0) {
zend_string_free(hash_str);
- zend_throw_exception(sodium_exception_ce, "crypto_pwhash_str(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(hash_str)[crypto_pwhash_STRBYTES - 1] = 0;
&hash_str, &hash_str_len,
&passwd, &passwd_len) == FAILURE) {
zend_throw_exception(sodium_exception_ce,
- "crypto_pwhash_str_verify(): invalid parameters",
+ "invalid parameters",
0);
return;
}
}
if (npub_len != crypto_aead_aes256gcm_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_aes256gcm_encrypt(): "
"public nonce size should be "
"CRYPTO_AEAD_AES256GCM_NPUBBYTES bytes",
0);
}
if (secretkey_len != crypto_aead_aes256gcm_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_aes256gcm_encrypt(): "
"secret key size should be "
"CRYPTO_AEAD_AES256GCM_KEYBYTES bytes",
0);
(unsigned long long) msg_len,
ad, (unsigned long long) ad_len, NULL, npub, secretkey) != 0) {
zend_string_free(ciphertext);
- zend_throw_exception(sodium_exception_ce, "crypto_aead_aes256gcm_encrypt(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
if (ciphertext_real_len <= 0U || ciphertext_real_len >= SIZE_MAX ||
}
if (npub_len != crypto_aead_aes256gcm_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_aes256gcm_decrypt(): "
"public nonce size should be "
"CRYPTO_AEAD_AES256GCM_NPUBBYTES bytes",
0);
}
if (secretkey_len != crypto_aead_aes256gcm_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_aes256gcm_decrypt(): "
"secret key size should be "
"CRYPTO_AEAD_AES256GCM_KEYBYTES bytes",
0);
}
if (npub_len != crypto_aead_chacha20poly1305_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_chacha20poly1305_encrypt(): "
"public nonce size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES bytes",
0);
}
if (secretkey_len != crypto_aead_chacha20poly1305_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_chacha20poly1305_encrypt(): "
"secret key size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES bytes",
0);
(unsigned long long) msg_len,
ad, (unsigned long long) ad_len, NULL, npub, secretkey) != 0) {
zend_string_free(ciphertext);
- zend_throw_exception(sodium_exception_ce, "crypto_aead_chacha20poly1305_encrypt(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
if (ciphertext_real_len <= 0U || ciphertext_real_len >= SIZE_MAX ||
}
if (npub_len != crypto_aead_chacha20poly1305_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_chacha20poly1305_decrypt(): "
"public nonce size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES bytes",
0);
}
if (secretkey_len != crypto_aead_chacha20poly1305_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_chacha20poly1305_decrypt(): "
"secret key size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES bytes",
0);
}
if (npub_len != crypto_aead_chacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_chacha20poly1305_ietf_encrypt(): "
"public nonce size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
}
if (secretkey_len != crypto_aead_chacha20poly1305_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_chacha20poly1305_ietf_encrypt(): "
"secret key size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
(unsigned long long) msg_len,
ad, (unsigned long long) ad_len, NULL, npub, secretkey) != 0) {
zend_string_free(ciphertext);
- zend_throw_exception(sodium_exception_ce, "crypto_aead_chacha20poly1305_ietf_encrypt(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
if (ciphertext_real_len <= 0U || ciphertext_real_len >= SIZE_MAX ||
}
if (npub_len != crypto_aead_chacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_chacha20poly1305_ietf_decrypt(): "
"public nonce size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
}
if (secretkey_len != crypto_aead_chacha20poly1305_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_chacha20poly1305_ietf_decrypt(): "
"secret key size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
}
if (npub_len != crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_xchacha20poly1305_ietf_encrypt(): "
"public nonce size should be "
"CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
}
if (secretkey_len != crypto_aead_xchacha20poly1305_IETF_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_xchacha20poly1305_ietf_encrypt(): "
"secret key size should be "
"CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
(unsigned long long) msg_len,
ad, (unsigned long long) ad_len, NULL, npub, secretkey) != 0) {
zend_string_free(ciphertext);
- zend_throw_exception(sodium_exception_ce, "crypto_aead_xchacha20poly1305_ietf_encrypt(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
if (ciphertext_real_len <= 0U || ciphertext_real_len >= SIZE_MAX ||
}
if (npub_len != crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_xchacha20poly1305_ietf_decrypt(): "
"public nonce size should be "
"CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
}
if (secretkey_len != crypto_aead_xchacha20poly1305_IETF_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_aead_xchacha20poly1305_ietf_decrypt(): "
"secret key size should be "
"CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
}
if (n_len != crypto_scalarmult_SCALARBYTES ||
p_len != crypto_scalarmult_SCALARBYTES) {
- zend_throw_exception(sodium_exception_ce, "crypto_scalarmult(): scalar and point must be "
+ zend_throw_exception(sodium_exception_ce, "scalar and point must be "
"CRYPTO_SCALARMULT_SCALARBYTES bytes",
0);
return;
q = zend_string_alloc(crypto_scalarmult_BYTES, 0);
if (crypto_scalarmult((unsigned char *) ZSTR_VAL(q), n, p) != 0) {
zend_string_free(q);
- zend_throw_exception(sodium_exception_ce, "crypto_scalarmult(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(q)[crypto_scalarmult_BYTES] = 0;
return;
}
if (key_len != crypto_auth_KEYBYTES) {
- zend_throw_exception(sodium_exception_ce, "crypto_auth(): key must be CRYPTO_AUTH_KEYBYTES bytes", 0);
+ zend_throw_exception(sodium_exception_ce, "key must be CRYPTO_AUTH_KEYBYTES bytes", 0);
return;
}
mac = zend_string_alloc(crypto_auth_BYTES, 0);
if (crypto_auth((unsigned char *) ZSTR_VAL(mac),
(const unsigned char *) msg, msg_len,
(const unsigned char *) key) != 0) {
- zend_throw_exception(sodium_exception_ce, "crypto_auth(): internal error", 0);
+ zend_throw_exception(sodium_exception_ce, "internal error", 0);
return;
}
ZSTR_VAL(mac)[crypto_auth_BYTES] = 0;
return;
}
if (key_len != crypto_auth_KEYBYTES) {
- zend_throw_exception(sodium_exception_ce, "crypto_auth_verify(): key must be CRYPTO_AUTH_KEYBYTES bytes", 0);
+ zend_throw_exception(sodium_exception_ce, "key must be CRYPTO_AUTH_KEYBYTES bytes", 0);
return;
}
if (mac_len != crypto_auth_BYTES) {
- zend_throw_exception(sodium_exception_ce, "crypto_auth_verify(): authentication tag must be CRYPTO_AUTH_BYTES bytes", 0);
+ zend_throw_exception(sodium_exception_ce, "authentication tag must be CRYPTO_AUTH_BYTES bytes", 0);
return;
}
if (crypto_auth_verify((const unsigned char *) mac,
}
if (eddsakey_len != crypto_sign_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_ed25519_sk_to_curve25519(): "
"Ed25519 key should be CRYPTO_SIGN_SECRETKEYBYTES bytes",
0);
return;
if (crypto_sign_ed25519_sk_to_curve25519((unsigned char *) ZSTR_VAL(ecdhkey),
(const unsigned char *) eddsakey) != 0) {
- zend_throw_exception(sodium_exception_ce, "crypto_sign_ed25519_sk_to_curve25519()", 0);
+ zend_throw_exception(sodium_exception_ce, "conversion failed", 0);
return;
}
ZSTR_VAL(ecdhkey)[crypto_box_SECRETKEYBYTES] = 0;
}
if (eddsakey_len != crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
- "crypto_sign_ed25519_pk_to_curve25519(): "
"Ed25519 key should be CRYPTO_SIGN_PUBLICKEYBYTES bytes",
0);
return;
if (crypto_sign_ed25519_pk_to_curve25519((unsigned char *) ZSTR_VAL(ecdhkey),
(const unsigned char *) eddsakey) != 0) {
- zend_throw_exception(sodium_exception_ce, "crypto_sign_ed25519_pk_to_curve25519()", 0);
+ zend_throw_exception(sodium_exception_ce, "conversion failed", 0);
return;
}
ZSTR_VAL(ecdhkey)[crypto_box_PUBLICKEYBYTES] = 0;
return;
}
if (len1 != len2) {
- zend_throw_exception(sodium_exception_ce, "compare(): arguments have different sizes", 0);
+ zend_throw_exception(sodium_exception_ce, "arguments have different sizes", 0);
} else {
RETURN_LONG(sodium_compare((const unsigned char *) buf1,
(const unsigned char *) buf2, (size_t) len1));