Skip to content

Commit

Permalink
Fix constant references in error messages in ext/sodium
Browse files Browse the repository at this point in the history
  • Loading branch information
SammyK authored and sgolemon committed Aug 29, 2017
1 parent c22cda5 commit 56a9998
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions ext/sodium/libsodium.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ PHP_FUNCTION(sodium_crypto_box_open)
}
if (keypair_len != crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"keypair size should be SODIUM_CRYPTO_BOX_KEYBYTES bytes",
"keypair size should be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes",
0);
return;
}
Expand Down Expand Up @@ -1259,7 +1259,7 @@ PHP_FUNCTION(sodium_crypto_box_seal_open)
}
if (keypair_len != crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"keypair size should be SODIUM_CRYPTO_BOX_KEYBYTES bytes",
"keypair size should be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes",
0);
return;
}
Expand Down Expand Up @@ -2007,14 +2007,14 @@ PHP_FUNCTION(sodium_crypto_aead_aes256gcm_encrypt)
if (npub_len != crypto_aead_aes256gcm_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"CRYPTO_AEAD_AES256GCM_NPUBBYTES bytes",
"SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES bytes",
0);
return;
}
if (secretkey_len != crypto_aead_aes256gcm_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"CRYPTO_AEAD_AES256GCM_KEYBYTES bytes",
"SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES bytes",
0);
return;
}
Expand Down Expand Up @@ -2073,14 +2073,14 @@ PHP_FUNCTION(sodium_crypto_aead_aes256gcm_decrypt)
if (npub_len != crypto_aead_aes256gcm_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"CRYPTO_AEAD_AES256GCM_NPUBBYTES bytes",
"SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES bytes",
0);
return;
}
if (secretkey_len != crypto_aead_aes256gcm_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"CRYPTO_AEAD_AES256GCM_KEYBYTES bytes",
"SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES bytes",
0);
return;
}
Expand Down Expand Up @@ -2141,14 +2141,14 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_encrypt)
if (npub_len != crypto_aead_chacha20poly1305_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES bytes",
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES bytes",
0);
return;
}
if (secretkey_len != crypto_aead_chacha20poly1305_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES bytes",
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES bytes",
0);
return;
}
Expand Down Expand Up @@ -2203,14 +2203,14 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_decrypt)
if (npub_len != crypto_aead_chacha20poly1305_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES bytes",
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES bytes",
0);
return;
}
if (secretkey_len != crypto_aead_chacha20poly1305_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES bytes",
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES bytes",
0);
return;
}
Expand Down Expand Up @@ -2266,14 +2266,14 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_ietf_encrypt)
if (npub_len != crypto_aead_chacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES bytes",
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
return;
}
if (secretkey_len != crypto_aead_chacha20poly1305_IETF_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES bytes",
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
return;
}
Expand Down Expand Up @@ -2332,14 +2332,14 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_ietf_decrypt)
if (npub_len != crypto_aead_chacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES bytes",
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
return;
}
if (secretkey_len != crypto_aead_chacha20poly1305_IETF_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES bytes",
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
return;
}
Expand Down Expand Up @@ -2401,14 +2401,14 @@ PHP_FUNCTION(sodium_crypto_aead_xchacha20poly1305_ietf_encrypt)
if (npub_len != crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES bytes",
"SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
return;
}
if (secretkey_len != crypto_aead_xchacha20poly1305_IETF_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES bytes",
"SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
return;
}
Expand Down Expand Up @@ -2463,14 +2463,14 @@ PHP_FUNCTION(sodium_crypto_aead_xchacha20poly1305_ietf_decrypt)
if (npub_len != crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES bytes",
"SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
return;
}
if (secretkey_len != crypto_aead_xchacha20poly1305_IETF_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES bytes",
"SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
return;
}
Expand Down Expand Up @@ -2578,7 +2578,7 @@ PHP_FUNCTION(sodium_crypto_scalarmult)
if (n_len != crypto_scalarmult_SCALARBYTES ||
p_len != crypto_scalarmult_BYTES) {
zend_throw_exception(sodium_exception_ce, "scalar and point must be "
"CRYPTO_SCALARMULT_SCALARBYTES bytes",
"SODIUM_CRYPTO_SCALARMULT_SCALARBYTES bytes",
0);
return;
}
Expand Down

0 comments on commit 56a9998

Please sign in to comment.