Skip to content

Commit

Permalink
Behavior compatibility with ext/sodium
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Apr 14, 2021
1 parent 8fb0f27 commit 69ac835
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,8 @@ public static function crypto_aead_xchacha20poly1305_ietf_decrypt(
ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1);
if (!is_null($assocData)) {
ParagonIE_Sodium_Core_Util::declareScalarType($assocData, 'string', 2);
} else {
$assocData = '';
}
ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 3);
ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 4);
Expand Down Expand Up @@ -891,7 +893,11 @@ public static function crypto_aead_xchacha20poly1305_ietf_encrypt(
) {
/* Type checks: */
ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1);
ParagonIE_Sodium_Core_Util::declareScalarType($assocData, 'string', 2);
if (!is_null($assocData)) {
ParagonIE_Sodium_Core_Util::declareScalarType($assocData, 'string', 2);
} else {
$assocData = '';
}
ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 3);
ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 4);

Expand Down

0 comments on commit 69ac835

Please sign in to comment.