From b9643f1afd87d0014dcbf4d9d100ab1bd13a80e7 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Mon, 20 Apr 2020 07:51:26 +0200 Subject: [PATCH] Refer to libsodium constants and functions --- src/Protocol/Version2.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Protocol/Version2.php b/src/Protocol/Version2.php index 98a1aa74..a725666f 100644 --- a/src/Protocol/Version2.php +++ b/src/Protocol/Version2.php @@ -284,15 +284,15 @@ public static function aeadEncrypt( $nonce = $nonceForUnitTesting; } else { $nonce = \random_bytes( - \ParagonIE_Sodium_Compat::CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES + \SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES ); } $nonce = \sodium_crypto_generichash( $plaintext, $nonce, - \ParagonIE_Sodium_Compat::CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES + \SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES ); - $ciphertext = \ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt( + $ciphertext = \sodium_crypto_aead_xchacha20poly1305_ietf_encrypt( $plaintext, Util::preAuthEncode($header, $nonce, $footer), $nonce, @@ -340,14 +340,14 @@ public static function aeadDecrypt( $nonce = Binary::safeSubstr( $decoded, 0, - \ParagonIE_Sodium_Compat::CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES + \SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES ); $ciphertext = Binary::safeSubstr( $decoded, - \ParagonIE_Sodium_Compat::CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES, - $len - \ParagonIE_Sodium_Compat::CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES + \SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES, + $len - \SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES ); - return \ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt( + return \sodium_crypto_aead_xchacha20poly1305_ietf_decrypt( $ciphertext, Util::preAuthEncode($header, $nonce, $footer), $nonce,