From a8390f5f7c8e93a8702484838e03dee5028b0e3d Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 30 Apr 2023 14:08:23 +0000 Subject: [PATCH] Upgrade/Install: Update sodium_compat to v1.20.0. The latest version of sodium_compat includes a fix for the Poly1305 implementation. References: * [https://github.com/paragonie/sodium_compat/releases/tag/v1.20.0 sodium_compat 1.20.0 release notes] * [https://github.com/paragonie/sodium_compat/compare/v1.19.0...v1.20.0 Full list of changes in sodium_compat 1.20.0] Follow-up to [49741], [51002], [51591], [52988], [54150], [54310]. Props jrf, costdev, paragoninitiativeenterprises, mukesh27. Fixes #58224. Built from https://develop.svn.wordpress.org/trunk@55699 git-svn-id: http://core.svn.wordpress.org/trunk@55211 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/sodium_compat/LICENSE | 2 +- wp-includes/sodium_compat/lib/php72compat.php | 2 + .../sodium_compat/src/Core/Poly1305/State.php | 50 +++++++++---------- .../src/Core32/Poly1305/State.php | 50 +++++++++---------- wp-includes/version.php | 2 +- 5 files changed, 54 insertions(+), 52 deletions(-) diff --git a/wp-includes/sodium_compat/LICENSE b/wp-includes/sodium_compat/LICENSE index 84b3e00ff9..af760a7b73 100644 --- a/wp-includes/sodium_compat/LICENSE +++ b/wp-includes/sodium_compat/LICENSE @@ -1,6 +1,6 @@ ISC License -Copyright (c) 2016-2022, Paragon Initiative Enterprises +Copyright (c) 2016-2023, Paragon Initiative Enterprises Copyright (c) 2013-2019, Frank Denis Permission to use, copy, modify, and/or distribute this software for any diff --git a/wp-includes/sodium_compat/lib/php72compat.php b/wp-includes/sodium_compat/lib/php72compat.php index bf1e05ebad..e949dbdc68 100644 --- a/wp-includes/sodium_compat/lib/php72compat.php +++ b/wp-includes/sodium_compat/lib/php72compat.php @@ -1360,6 +1360,8 @@ if (!is_callable('sodium_memzero')) { * @return void * @throws SodiumException * @throws TypeError + * + * @psalm-suppress ReferenceConstraintViolation */ function sodium_memzero(&$string) { diff --git a/wp-includes/sodium_compat/src/Core/Poly1305/State.php b/wp-includes/sodium_compat/src/Core/Poly1305/State.php index 4b64e04078..cfaeb0b1ed 100644 --- a/wp-includes/sodium_compat/src/Core/Poly1305/State.php +++ b/wp-includes/sodium_compat/src/Core/Poly1305/State.php @@ -210,43 +210,43 @@ class ParagonIE_Sodium_Core_Poly1305_State extends ParagonIE_Sodium_Core_Util /* h *= r */ $d0 = ( - self::mul($h0, $r0, 25) + - self::mul($s4, $h1, 26) + - self::mul($s3, $h2, 26) + - self::mul($s2, $h3, 26) + - self::mul($s1, $h4, 26) + self::mul($h0, $r0, 27) + + self::mul($s4, $h1, 27) + + self::mul($s3, $h2, 27) + + self::mul($s2, $h3, 27) + + self::mul($s1, $h4, 27) ); $d1 = ( - self::mul($h0, $r1, 25) + - self::mul($h1, $r0, 25) + - self::mul($s4, $h2, 26) + - self::mul($s3, $h3, 26) + - self::mul($s2, $h4, 26) + self::mul($h0, $r1, 27) + + self::mul($h1, $r0, 27) + + self::mul($s4, $h2, 27) + + self::mul($s3, $h3, 27) + + self::mul($s2, $h4, 27) ); $d2 = ( - self::mul($h0, $r2, 25) + - self::mul($h1, $r1, 25) + - self::mul($h2, $r0, 25) + - self::mul($s4, $h3, 26) + - self::mul($s3, $h4, 26) + self::mul($h0, $r2, 27) + + self::mul($h1, $r1, 27) + + self::mul($h2, $r0, 27) + + self::mul($s4, $h3, 27) + + self::mul($s3, $h4, 27) ); $d3 = ( - self::mul($h0, $r3, 25) + - self::mul($h1, $r2, 25) + - self::mul($h2, $r1, 25) + - self::mul($h3, $r0, 25) + - self::mul($s4, $h4, 26) + self::mul($h0, $r3, 27) + + self::mul($h1, $r2, 27) + + self::mul($h2, $r1, 27) + + self::mul($h3, $r0, 27) + + self::mul($s4, $h4, 27) ); $d4 = ( - self::mul($h0, $r4, 25) + - self::mul($h1, $r3, 25) + - self::mul($h2, $r2, 25) + - self::mul($h3, $r1, 25) + - self::mul($h4, $r0, 25) + self::mul($h0, $r4, 27) + + self::mul($h1, $r3, 27) + + self::mul($h2, $r2, 27) + + self::mul($h3, $r1, 27) + + self::mul($h4, $r0, 27) ); /* (partial) h %= p */ diff --git a/wp-includes/sodium_compat/src/Core32/Poly1305/State.php b/wp-includes/sodium_compat/src/Core32/Poly1305/State.php index e77a8f42ee..90d036276e 100644 --- a/wp-includes/sodium_compat/src/Core32/Poly1305/State.php +++ b/wp-includes/sodium_compat/src/Core32/Poly1305/State.php @@ -255,39 +255,39 @@ class ParagonIE_Sodium_Core32_Poly1305_State extends ParagonIE_Sodium_Core32_Uti /* h *= r */ $d0 = $zero - ->addInt64($h0->mulInt64($r0, 25)) - ->addInt64($s4->mulInt64($h1, 26)) - ->addInt64($s3->mulInt64($h2, 26)) - ->addInt64($s2->mulInt64($h3, 26)) - ->addInt64($s1->mulInt64($h4, 26)); + ->addInt64($h0->mulInt64($r0, 27)) + ->addInt64($s4->mulInt64($h1, 27)) + ->addInt64($s3->mulInt64($h2, 27)) + ->addInt64($s2->mulInt64($h3, 27)) + ->addInt64($s1->mulInt64($h4, 27)); $d1 = $zero - ->addInt64($h0->mulInt64($r1, 25)) - ->addInt64($h1->mulInt64($r0, 25)) - ->addInt64($s4->mulInt64($h2, 26)) - ->addInt64($s3->mulInt64($h3, 26)) - ->addInt64($s2->mulInt64($h4, 26)); + ->addInt64($h0->mulInt64($r1, 27)) + ->addInt64($h1->mulInt64($r0, 27)) + ->addInt64($s4->mulInt64($h2, 27)) + ->addInt64($s3->mulInt64($h3, 27)) + ->addInt64($s2->mulInt64($h4, 27)); $d2 = $zero - ->addInt64($h0->mulInt64($r2, 25)) - ->addInt64($h1->mulInt64($r1, 25)) - ->addInt64($h2->mulInt64($r0, 25)) - ->addInt64($s4->mulInt64($h3, 26)) - ->addInt64($s3->mulInt64($h4, 26)); + ->addInt64($h0->mulInt64($r2, 27)) + ->addInt64($h1->mulInt64($r1, 27)) + ->addInt64($h2->mulInt64($r0, 27)) + ->addInt64($s4->mulInt64($h3, 27)) + ->addInt64($s3->mulInt64($h4, 27)); $d3 = $zero - ->addInt64($h0->mulInt64($r3, 25)) - ->addInt64($h1->mulInt64($r2, 25)) - ->addInt64($h2->mulInt64($r1, 25)) - ->addInt64($h3->mulInt64($r0, 25)) - ->addInt64($s4->mulInt64($h4, 26)); + ->addInt64($h0->mulInt64($r3, 27)) + ->addInt64($h1->mulInt64($r2, 27)) + ->addInt64($h2->mulInt64($r1, 27)) + ->addInt64($h3->mulInt64($r0, 27)) + ->addInt64($s4->mulInt64($h4, 27)); $d4 = $zero - ->addInt64($h0->mulInt64($r4, 25)) - ->addInt64($h1->mulInt64($r3, 25)) - ->addInt64($h2->mulInt64($r2, 25)) - ->addInt64($h3->mulInt64($r1, 25)) - ->addInt64($h4->mulInt64($r0, 25)); + ->addInt64($h0->mulInt64($r4, 27)) + ->addInt64($h1->mulInt64($r3, 27)) + ->addInt64($h2->mulInt64($r2, 27)) + ->addInt64($h3->mulInt64($r1, 27)) + ->addInt64($h4->mulInt64($r0, 27)); /* (partial) h %= p */ $c = $d0->shiftRight(26); diff --git a/wp-includes/version.php b/wp-includes/version.php index 081c28ffb6..5998d037f3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-55698'; +$wp_version = '6.3-alpha-55699'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.