diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/sodium_compat/lib/php72compat.php --- a/wp/wp-includes/sodium_compat/lib/php72compat.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/sodium_compat/lib/php72compat.php Tue Dec 15 13:49:49 2020 +0100 @@ -1,5 +1,7 @@ + * @throws SodiumException + */ + function sodium_crypto_secretstream_xchacha20poly1305_init_push($key) + { + return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_push($key); + } +} +if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_push')) { + /** + * @param string $state + * @param string $msg + * @param string $aad + * @param int $tag + * @return string + * @throws SodiumException + */ + function sodium_crypto_secretstream_xchacha20poly1305_push(&$state, $msg, $aad = '', $tag = 0) + { + return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_push($state, $msg, $aad, $tag); + } +} +if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_init_pull')) { + /** + * @param string $header + * @param string $key + * @return string + * @throws Exception + */ + function sodium_crypto_secretstream_xchacha20poly1305_init_pull($header, $key) + { + return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_pull($header, $key); + } +} +if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_pull')) { + /** + * @param string $state + * @param string $cipher + * @param string $aad + * @return bool|array{0: string, 1: int} + * @throws SodiumException + */ + function sodium_crypto_secretstream_xchacha20poly1305_pull(&$state, $cipher, $aad = '') + { + return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_pull($state, $cipher, $aad); + } +} +if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_rekey')) { + /** + * @param string $state + * @return void + * @throws SodiumException + */ + function sodium_crypto_secretstream_xchacha20poly1305_rekey(&$state) + { + ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_rekey($state); + } +} +if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_keygen')) { + /** + * @return string + * @throws Exception + */ + function sodium_crypto_secretstream_xchacha20poly1305_keygen() + { + return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_keygen(); + } +} if (!is_callable('sodium_crypto_shorthash')) { /** * @see ParagonIE_Sodium_Compat::crypto_shorthash() @@ -739,6 +991,7 @@ /** * @see ParagonIE_Sodium_Compat::crypto_shorthash_keygen() * @return string + * @throws Exception */ function sodium_crypto_shorthash_keygen() { @@ -773,6 +1026,20 @@ return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); } } +if (!is_callable('sodium_crypto_sign_keypair_from_secretkey_and_publickey')) { + /** + * @see ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey() + * @param string $sk + * @param string $pk + * @return string + * @throws SodiumException + * @throws TypeError + */ + function sodium_crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk) + { + return ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk); + } +} if (!is_callable('sodium_crypto_sign_keypair')) { /** * @see ParagonIE_Sodium_Compat::crypto_sign_keypair() @@ -915,6 +1182,7 @@ /** * @see ParagonIE_Sodium_Compat::crypto_stream_keygen() * @return string + * @throws Exception */ function sodium_crypto_stream_keygen() { @@ -1019,6 +1287,34 @@ ParagonIE_Sodium_Compat::memzero($str); } } +if (!is_callable('sodium_pad')) { + /** + * @see ParagonIE_Sodium_Compat::pad() + * @param string $unpadded + * @param int $blockSize + * @return int + * @throws SodiumException + * @throws TypeError + */ + function sodium_pad($unpadded, $blockSize) + { + return ParagonIE_Sodium_Compat::pad($unpadded, $blockSize, true); + } +} +if (!is_callable('sodium_unpad')) { + /** + * @see ParagonIE_Sodium_Compat::pad() + * @param string $padded + * @param int $blockSize + * @return int + * @throws SodiumException + * @throws TypeError + */ + function sodium_unpad($padded, $blockSize) + { + return ParagonIE_Sodium_Compat::unpad($padded, $blockSize, true); + } +} if (!is_callable('sodium_randombytes_buf')) { /** * @see ParagonIE_Sodium_Compat::randombytes_buf() @@ -1049,6 +1345,7 @@ /** * @see ParagonIE_Sodium_Compat::randombytes_random16() * @return int + * @throws Exception */ function sodium_randombytes_random16() {