Skip to content

Commit

Permalink
Upgrade/Install: Update sodium_compat to v1.12.1.
Browse files Browse the repository at this point in the history
This includes a speedup for signature verification on most platforms and bugfixes for 32-bit platforms.

Props paragoninitiativeenterprises, lukaswaudentio.
Fixes #48371.
Built from https://develop.svn.wordpress.org/trunk@46858


git-svn-id: http://core.svn.wordpress.org/trunk@46658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
SergeyBiryukov committed Dec 9, 2019
1 parent dd47d5a commit d4ef90b
Show file tree
Hide file tree
Showing 27 changed files with 3,337 additions and 48 deletions.
4 changes: 2 additions & 2 deletions wp-includes/sodium_compat/LICENSE
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* ISC License
*
* Copyright (c) 2016-2018
* Copyright (c) 2016-2019
* Paragon Initiative Enterprises <security at paragonie dot com>
*
* Copyright (c) 2013-2018
* Copyright (c) 2013-2019
* Frank Denis <j at pureftpd dot org>
*
* Permission to use, copy, modify, and/or distribute this software for any
Expand Down
12 changes: 11 additions & 1 deletion wp-includes/sodium_compat/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,17 @@ function sodiumCompatAutoloader($class)
// unless PHP >= 5.3.0
require_once dirname(__FILE__) . '/lib/namespaced.php';
require_once dirname(__FILE__) . '/lib/sodium_compat.php';
} else {
require_once dirname(__FILE__) . '/src/PHP52/SplFixedArray.php';
}
if (PHP_VERSION_ID < 70200 || !extension_loaded('sodium')) {
require_once dirname(__FILE__) . '/lib/php72compat.php';
if (PHP_VERSION_ID >= 50300 && !defined('SODIUM_CRYPTO_SCALARMULT_BYTES')) {
require_once dirname(__FILE__) . '/lib/php72compat_const.php';
}
if (PHP_VERSION_ID >= 70000) {
assert(class_exists('ParagonIE_Sodium_Compat'), 'Possible filesystem/autoloader bug?');
} else {
assert(class_exists('ParagonIE_Sodium_Compat'));
}
require_once (dirname(__FILE__) . '/lib/php72compat.php');
}
2 changes: 1 addition & 1 deletion wp-includes/sodium_compat/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"paragonie/random_compat": ">=1"
},
"require-dev": {
"phpunit/phpunit": "^3|^4|^5"
"phpunit/phpunit": "^3|^4|^5|^6|^7"
},
"suggest": {
"ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.",
Expand Down
2 changes: 2 additions & 0 deletions wp-includes/sodium_compat/lib/constants.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Sodium;

require_once dirname(dirname(__FILE__)) . '/autoload.php';

use ParagonIE_Sodium_Compat;

const CRYPTO_AEAD_AES256GCM_KEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_AES256GCM_KEYBYTES;
Expand Down
4 changes: 3 additions & 1 deletion wp-includes/sodium_compat/lib/namespaced.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

require_once dirname(dirname(__FILE__)) . '/autoload.php';

if (PHP_VERSION_ID < 50300) {
return;
}
Expand Down Expand Up @@ -36,7 +38,7 @@
// Replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = dirname(__DIR__) . '/namespaced/' . str_replace('\\', '/', $relative_class) . '.php';
$file = dirname(dirname(__FILE__)) . '/namespaced/' . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file)) {
require_once $file;
Expand Down
Loading

0 comments on commit d4ef90b

Please sign in to comment.