Skip to content
Permalink
Browse files

Upgrade/Install: Update `sodium_compat` to v1.10.0.

This adds a `runtime_speed_test()` method for estimating if the 32-bit implementation is fast enough for expensive computations.

Merges [45344] to the 5.2 branch.

Props paragoninitiativeenterprises, tellyworth.
See #47186.

git-svn-id: https://develop.svn.wordpress.org/branches/5.2@45355 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
desrosj committed May 17, 2019
1 parent 7a72195 commit 8005232bd61e1eaaa6ea019575db9665b03f8edb
@@ -1,10 +1,10 @@
/*
* ISC License
*
* Copyright (c) 2016-2019
* Copyright (c) 2016-2018
* Paragon Initiative Enterprises <security at paragonie dot com>
*
* Copyright (c) 2013-2019
* Copyright (c) 2013-2018
* Frank Denis <j at pureftpd dot org>
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -50,7 +50,7 @@
"files": ["autoload.php"]
},
"require": {
"php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7",
"php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8",
"paragonie/random_compat": ">=1"
},
"require-dev": {
@@ -107,7 +107,7 @@ function sodium_compare($a, $b)
* @param string $assocData
* @param string $nonce
* @param string $key
* @return string
* @return string|bool
*/
function sodium_crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key)
{
@@ -153,7 +153,7 @@ function sodium_crypto_aead_aes256gcm_is_available()
* @param string $assocData
* @param string $nonce
* @param string $key
* @return string
* @return string|bool
*/
function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key)
{
@@ -199,7 +199,7 @@ function sodium_crypto_aead_chacha20poly1305_keygen()
* @param string $assocData
* @param string $nonce
* @param string $key
* @return string
* @return string|bool
*/
function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key)
{
@@ -245,12 +245,12 @@ function sodium_crypto_aead_chacha20poly1305_ietf_keygen()
* @param string $assocData
* @param string $nonce
* @param string $key
* @return string
* @return string|bool
*/
function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key)
{
try {
return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key);
return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key, true);
} catch (Error $ex) {
return false;
} catch (Exception $ex) {
@@ -271,7 +271,7 @@ function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData,
*/
function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key)
{
return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key);
return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key, true);
}
}
if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_keygen')) {
@@ -952,7 +952,7 @@ function sodium_hex2bin($string)
if (!is_callable('sodium_increment')) {
/**
* @see ParagonIE_Sodium_Compat::increment()
* @param &string $string
* @param string $string
* @return void
* @throws SodiumException
* @throws TypeError
@@ -1009,7 +1009,7 @@ function sodium_memcmp($a, $b)
if (!is_callable('sodium_memzero')) {
/**
* @see ParagonIE_Sodium_Compat::memzero()
* @param string &$str
* @param string $str
* @return void
* @throws SodiumException
* @throws TypeError
@@ -45,16 +45,14 @@ function compare($a, $b)
* @param string $nonce
* @param string $key
* @return string|bool
* @throws \SodiumException
* @throws \TypeError
*/
function crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key)
{
try {
return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key);
} catch (Error $ex) {
} catch (\TypeError $ex) {
return false;
} catch (Exception $ex) {
} catch (\SodiumException $ex) {
return false;
}
}
@@ -93,16 +91,14 @@ function crypto_aead_aes256gcm_is_available()
* @param string $nonce
* @param string $key
* @return string|bool
* @throws \SodiumException
* @throws \TypeError
*/
function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key)
{
try {
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key);
} catch (Error $ex) {
} catch (\TypeError $ex) {
return false;
} catch (Exception $ex) {
} catch (\SodiumException $ex) {
return false;
}
}
@@ -131,16 +127,14 @@ function crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key
* @param string $nonce
* @param string $key
* @return string|bool
* @throws \SodiumException
* @throws \TypeError
*/
function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key)
{
try {
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key);
} catch (Error $ex) {
} catch (\TypeError $ex) {
return false;
} catch (Exception $ex) {
} catch (\SodiumException $ex) {
return false;
}
}
@@ -238,16 +232,14 @@ function crypto_box_keypair_from_secretkey_and_publickey($sk, $pk)
* @param string $nonce
* @param string $kp
* @return string|bool
* @throws \SodiumException
* @throws \TypeError
*/
function crypto_box_open($message, $nonce, $kp)
{
try {
return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp);
} catch (Error $ex) {
} catch (\TypeError $ex) {
return false;
} catch (Exception $ex) {
} catch (\SodiumException $ex) {
return false;
}
}
@@ -298,15 +290,14 @@ function crypto_box_seal($message, $publicKey)
* @param string $message
* @param string $kp
* @return string|bool
* @throws \TypeError
*/
function crypto_box_seal_open($message, $kp)
{
try {
return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp);
} catch (\Error $ex) {
} catch (\TypeError $ex) {
return false;
} catch (\Exception $ex) {
} catch (\SodiumException $ex) {
return false;
}
}
@@ -543,16 +534,14 @@ function crypto_secretbox($message, $nonce, $key)
* @param string $nonce
* @param string $key
* @return string|bool
* @throws \SodiumException
* @throws \TypeError
*/
function crypto_secretbox_open($message, $nonce, $key)
{
try {
return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key);
} catch (Error $ex) {
} catch (\TypeError $ex) {
return false;
} catch (Exception $ex) {
} catch (\SodiumException $ex) {
return false;
}
}
@@ -622,9 +611,9 @@ function crypto_sign_open($signedMessage, $pk)
{
try {
return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk);
} catch (\Error $ex) {
} catch (\TypeError $ex) {
return false;
} catch (\Exception $ex) {
} catch (\SodiumException $ex) {
return false;
}
}
@@ -810,7 +799,7 @@ function randombytes_buf($amount)
* @see ParagonIE_Sodium_Compat::randombytes_uniform()
* @param int $upperLimit
* @return int
* @throws \Exception
* @throws \SodiumException
* @throws \Error
*/
function randombytes_uniform($upperLimit)
@@ -1,7 +1,7 @@
<?php
namespace ParagonIE\Sodium\Core;
class SipHash extends \ParagonIE_Sodium_Core_Salsa20
class Salsa20 extends \ParagonIE_Sodium_Core_Salsa20
{
}
}
@@ -1,7 +1,7 @@
<?php
namespace ParagonIE\Sodium\Core;
class Xsalsa20 extends \ParagonIE_Sodium_Core_Xsalsa20
class Xsalsa20 extends \ParagonIE_Sodium_Core_XSalsa20
{
}

0 comments on commit 8005232

Please sign in to comment.
You can’t perform that action at this time.