<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[52988] trunk/src/wp-includes/sodium_compat/src: Upgrade/Install: Update sodium_compat to v1.17.1.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/52988">52988</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/52988","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-03-24 15:18:31 +0000 (Thu, 24 Mar 2022)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Upgrade/Install: Update sodium_compat to v1.17.1.
The latest version of sodium_compat includes further improvements for PHP 8.1 compatibility.
Release notes:
https://github.com/paragonie/sodium_compat/releases/tag/v1.17.1
A full list of changes in this update can be found on GitHub:
https://github.com/paragonie/sodium_compat/compare/v1.17.0...v1.17.1
Follow-up to <a href="https://core.trac.wordpress.org/changeset/49741">[49741]</a>, <a href="https://core.trac.wordpress.org/changeset/51002">[51002]</a>, <a href="https://core.trac.wordpress.org/changeset/51591">[51591]</a>.
Props jrf, paragoninitiativeenterprises.
Fixes <a href="https://core.trac.wordpress.org/ticket/55453">#55453</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludessodium_compatsrcCompatphp">trunk/src/wp-includes/sodium_compat/src/Compat.php</a></li>
<li><a href="#trunksrcwpincludessodium_compatsrcCoreBLAKE2bphp">trunk/src/wp-includes/sodium_compat/src/Core/BLAKE2b.php</a></li>
<li><a href="#trunksrcwpincludessodium_compatsrcCoreCurve25519php">trunk/src/wp-includes/sodium_compat/src/Core/Curve25519.php</a></li>
<li><a href="#trunksrcwpincludessodium_compatsrcCoreUtilphp">trunk/src/wp-includes/sodium_compat/src/Core/Util.php</a></li>
<li><a href="#trunksrcwpincludessodium_compatsrcCore32Curve25519Fephp">trunk/src/wp-includes/sodium_compat/src/Core32/Curve25519/Fe.php</a></li>
<li><a href="#trunksrcwpincludessodium_compatsrcCore32Curve25519php">trunk/src/wp-includes/sodium_compat/src/Core32/Curve25519.php</a></li>
<li><a href="#trunksrcwpincludessodium_compatsrcCore32Int32php">trunk/src/wp-includes/sodium_compat/src/Core32/Int32.php</a></li>
<li><a href="#trunksrcwpincludessodium_compatsrcCore32Int64php">trunk/src/wp-includes/sodium_compat/src/Core32/Int64.php</a></li>
<li><a href="#trunksrcwpincludessodium_compatsrcCore32Poly1305Statephp">trunk/src/wp-includes/sodium_compat/src/Core32/Poly1305/State.php</a></li>
<li><a href="#trunksrcwpincludessodium_compatsrcCore32XChaCha20php">trunk/src/wp-includes/sodium_compat/src/Core32/XChaCha20.php</a></li>
<li><a href="#trunksrcwpincludessodium_compatsrcFilephp">trunk/src/wp-includes/sodium_compat/src/File.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludessodium_compatsrcCompatphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/sodium_compat/src/Compat.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/sodium_compat/src/Compat.php 2022-03-24 10:24:52 UTC (rev 52987)
+++ trunk/src/wp-includes/sodium_compat/src/Compat.php 2022-03-24 15:18:31 UTC (rev 52988)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3533,9 +3533,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @var positive-int $numBytes */
</ins><span class="cx" style="display: block; padding: 0 10px"> if (self::use_fallback('randombytes_buf')) {
</span><span class="cx" style="display: block; padding: 0 10px"> return (string) call_user_func('\\Sodium\\randombytes_buf', $numBytes);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($numBytes < 0) {
+ throw new SodiumException("Number of bytes must be a positive integer");
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return random_bytes($numBytes);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludessodium_compatsrcCoreBLAKE2bphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/sodium_compat/src/Core/BLAKE2b.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/sodium_compat/src/Core/BLAKE2b.php 2022-03-24 10:24:52 UTC (rev 52987)
+++ trunk/src/wp-includes/sodium_compat/src/Core/BLAKE2b.php 2022-03-24 15:18:31 UTC (rev 52988)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -50,6 +50,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function new64($high, $low)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (PHP_INT_SIZE === 4) {
+ throw new SodiumException("Error, use 32-bit");
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> $i64 = new SplFixedArray(2);
</span><span class="cx" style="display: block; padding: 0 10px"> $i64[0] = $high & 0xffffffff;
</span><span class="cx" style="display: block; padding: 0 10px"> $i64[1] = $low & 0xffffffff;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -86,6 +89,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected static function add64($x, $y)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (PHP_INT_SIZE === 4) {
+ throw new SodiumException("Error, use 32-bit");
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> $l = ($x[1] + $y[1]) & 0xffffffff;
</span><span class="cx" style="display: block; padding: 0 10px"> return self::new64(
</span><span class="cx" style="display: block; padding: 0 10px"> (int) ($x[0] + $y[0] + (
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -119,6 +125,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected static function xor64(SplFixedArray $x, SplFixedArray $y)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (PHP_INT_SIZE === 4) {
+ throw new SodiumException("Error, use 32-bit");
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> if (!is_numeric($x[0])) {
</span><span class="cx" style="display: block; padding: 0 10px"> throw new SodiumException('x[0] is not an integer');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -147,6 +156,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function rotr64($x, $c)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (PHP_INT_SIZE === 4) {
+ throw new SodiumException("Error, use 32-bit");
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> if ($c >= 64) {
</span><span class="cx" style="display: block; padding: 0 10px"> $c %= 64;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -164,8 +176,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $l0 = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> $c = 64 - $c;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @var int $c */
</ins><span class="cx" style="display: block; padding: 0 10px"> if ($c < 32) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h0 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h0 = ((int) ($x[0]) << $c) | (
</span><span class="cx" style="display: block; padding: 0 10px"> (
</span><span class="cx" style="display: block; padding: 0 10px"> (int) ($x[1]) & ((1 << $c) - 1)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -173,10 +185,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (32 - $c)
</span><span class="cx" style="display: block; padding: 0 10px"> ) >> (32 - $c)
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $l0 */
</del><span class="cx" style="display: block; padding: 0 10px"> $l0 = (int) ($x[1]) << $c;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h0 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h0 = (int) ($x[1]) << ($c - 32);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -184,12 +194,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $c1 = 64 - $c;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ($c1 < 32) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h1 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h1 = (int) ($x[0]) >> $c1;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $l1 */
</del><span class="cx" style="display: block; padding: 0 10px"> $l1 = ((int) ($x[1]) >> $c1) | ((int) ($x[0]) & ((1 << $c1) - 1)) << (32 - $c1);
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $l1 */
</del><span class="cx" style="display: block; padding: 0 10px"> $l1 = (int) ($x[0]) >> ($c1 - 32);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludessodium_compatsrcCoreCurve25519php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/sodium_compat/src/Core/Curve25519.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/sodium_compat/src/Core/Curve25519.php 2022-03-24 10:24:52 UTC (rev 52987)
+++ trunk/src/wp-includes/sodium_compat/src/Core/Curve25519.php 2022-03-24 15:18:31 UTC (rev 52988)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -342,6 +342,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core_Curve25519_Fe $f,
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core_Curve25519_Fe $g
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Ensure limbs aren't oversized.
+ $f = self::fe_normalize($f);
+ $g = self::fe_normalize($g);
</ins><span class="cx" style="display: block; padding: 0 10px"> $f0 = $f[0];
</span><span class="cx" style="display: block; padding: 0 10px"> $f1 = $f[1];
</span><span class="cx" style="display: block; padding: 0 10px"> $f2 = $f[2];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -476,6 +479,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $f9g7_38 = self::mul($g7_19, $f9_2, 26);
</span><span class="cx" style="display: block; padding: 0 10px"> $f9g8_19 = self::mul($g8_19, $f9, 25);
</span><span class="cx" style="display: block; padding: 0 10px"> $f9g9_38 = self::mul($g9_19, $f9_2, 26);
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $h0 = $f0g0 + $f1g9_38 + $f2g8_19 + $f3g7_38 + $f4g6_19 + $f5g5_38 + $f6g4_19 + $f7g3_38 + $f8g2_19 + $f9g1_38;
</span><span class="cx" style="display: block; padding: 0 10px"> $h1 = $f0g1 + $f1g0 + $f2g9_19 + $f3g8_19 + $f4g7_19 + $f5g6_19 + $f6g5_19 + $f7g4_19 + $f8g3_19 + $f9g2_19;
</span><span class="cx" style="display: block; padding: 0 10px"> $h2 = $f0g2 + $f1g1_2 + $f2g0 + $f3g9_38 + $f4g8_19 + $f5g7_38 + $f6g6_19 + $f7g5_38 + $f8g4_19 + $f9g3_38;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -530,18 +534,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $h1 += $carry0;
</span><span class="cx" style="display: block; padding: 0 10px"> $h0 -= $carry0 << 26;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
- array(
- (int) $h0,
- (int) $h1,
- (int) $h2,
- (int) $h3,
- (int) $h4,
- (int) $h5,
- (int) $h6,
- (int) $h7,
- (int) $h8,
- (int) $h9
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self::fe_normalize(
+ ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
+ array(
+ (int) $h0,
+ (int) $h1,
+ (int) $h2,
+ (int) $h3,
+ (int) $h4,
+ (int) $h5,
+ (int) $h6,
+ (int) $h7,
+ (int) $h8,
+ (int) $h9
+ )
</ins><span class="cx" style="display: block; padding: 0 10px"> )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -563,7 +569,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> for ($i = 0; $i < 10; ++$i) {
</span><span class="cx" style="display: block; padding: 0 10px"> $h[$i] = -$f[$i];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $h;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self::fe_normalize($h);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -578,6 +584,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function fe_sq(ParagonIE_Sodium_Core_Curve25519_Fe $f)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $f = self::fe_normalize($f);
</ins><span class="cx" style="display: block; padding: 0 10px"> $f0 = (int) $f[0];
</span><span class="cx" style="display: block; padding: 0 10px"> $f1 = (int) $f[1];
</span><span class="cx" style="display: block; padding: 0 10px"> $f2 = (int) $f[2];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -711,18 +718,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $h1 += $carry0;
</span><span class="cx" style="display: block; padding: 0 10px"> $h0 -= $carry0 << 26;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
- array(
- (int) $h0,
- (int) $h1,
- (int) $h2,
- (int) $h3,
- (int) $h4,
- (int) $h5,
- (int) $h6,
- (int) $h7,
- (int) $h8,
- (int) $h9
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self::fe_normalize(
+ ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
+ array(
+ (int) $h0,
+ (int) $h1,
+ (int) $h2,
+ (int) $h3,
+ (int) $h4,
+ (int) $h5,
+ (int) $h6,
+ (int) $h7,
+ (int) $h8,
+ (int) $h9
+ )
</ins><span class="cx" style="display: block; padding: 0 10px"> )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -740,6 +749,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function fe_sq2(ParagonIE_Sodium_Core_Curve25519_Fe $f)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $f = self::fe_normalize($f);
</ins><span class="cx" style="display: block; padding: 0 10px"> $f0 = (int) $f[0];
</span><span class="cx" style="display: block; padding: 0 10px"> $f1 = (int) $f[1];
</span><span class="cx" style="display: block; padding: 0 10px"> $f2 = (int) $f[2];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -874,18 +884,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $h1 += $carry0;
</span><span class="cx" style="display: block; padding: 0 10px"> $h0 -= $carry0 << 26;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
- array(
- (int) $h0,
- (int) $h1,
- (int) $h2,
- (int) $h3,
- (int) $h4,
- (int) $h5,
- (int) $h6,
- (int) $h7,
- (int) $h8,
- (int) $h9
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self::fe_normalize(
+ ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
+ array(
+ (int) $h0,
+ (int) $h1,
+ (int) $h2,
+ (int) $h3,
+ (int) $h4,
+ (int) $h5,
+ (int) $h6,
+ (int) $h7,
+ (int) $h8,
+ (int) $h9
+ )
</ins><span class="cx" style="display: block; padding: 0 10px"> )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -958,6 +970,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function fe_pow22523(ParagonIE_Sodium_Core_Curve25519_Fe $z)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $z = self::fe_normalize($z);
</ins><span class="cx" style="display: block; padding: 0 10px"> # fe_sq(t0, z);
</span><span class="cx" style="display: block; padding: 0 10px"> # fe_sq(t1, t0);
</span><span class="cx" style="display: block; padding: 0 10px"> # fe_sq(t1, t1);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1085,18 +1098,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function fe_sub(ParagonIE_Sodium_Core_Curve25519_Fe $f, ParagonIE_Sodium_Core_Curve25519_Fe $g)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
- array(
- (int) ($f[0] - $g[0]),
- (int) ($f[1] - $g[1]),
- (int) ($f[2] - $g[2]),
- (int) ($f[3] - $g[3]),
- (int) ($f[4] - $g[4]),
- (int) ($f[5] - $g[5]),
- (int) ($f[6] - $g[6]),
- (int) ($f[7] - $g[7]),
- (int) ($f[8] - $g[8]),
- (int) ($f[9] - $g[9])
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self::fe_normalize(
+ ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
+ array(
+ (int) ($f[0] - $g[0]),
+ (int) ($f[1] - $g[1]),
+ (int) ($f[2] - $g[2]),
+ (int) ($f[3] - $g[3]),
+ (int) ($f[4] - $g[4]),
+ (int) ($f[5] - $g[5]),
+ (int) ($f[6] - $g[6]),
+ (int) ($f[7] - $g[7]),
+ (int) ($f[8] - $g[8]),
+ (int) ($f[9] - $g[9])
+ )
</ins><span class="cx" style="display: block; padding: 0 10px"> )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2535,7 +2550,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $s20 = 2097151 & (self::load_4(self::substr($s, 52, 4)) >> 4);
</span><span class="cx" style="display: block; padding: 0 10px"> $s21 = 2097151 & (self::load_3(self::substr($s, 55, 3)) >> 1);
</span><span class="cx" style="display: block; padding: 0 10px"> $s22 = 2097151 & (self::load_4(self::substr($s, 57, 4)) >> 6);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $s23 = (self::load_4(self::substr($s, 60, 4)) >> 3);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $s23 = 0x1fffffff & (self::load_4(self::substr($s, 60, 4)) >> 3);
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $s11 += self::mul($s23, 666643, 20);
</span><span class="cx" style="display: block; padding: 0 10px"> $s12 += self::mul($s23, 470296, 19);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3782,4 +3797,40 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $s_[31] &= 128;
</span><span class="cx" style="display: block; padding: 0 10px"> return self::intArrayToString($s_);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Ensure limbs are less than 28 bits long to prevent float promotion.
+ *
+ * This uses a constant-time conditional swap under the hood.
+ *
+ * @param ParagonIE_Sodium_Core_Curve25519_Fe $f
+ * @return ParagonIE_Sodium_Core_Curve25519_Fe
+ */
+ public static function fe_normalize(ParagonIE_Sodium_Core_Curve25519_Fe $f)
+ {
+ $x = (PHP_INT_SIZE << 3) - 1; // 31 or 63
+
+ $g = self::fe_copy($f);
+ for ($i = 0; $i < 10; ++$i) {
+ $mask = -(($g[$i] >> $x) & 1);
+
+ /*
+ * Get two candidate normalized values for $g[$i], depending on the sign of $g[$i]:
+ */
+ $a = $g[$i] & 0x7ffffff;
+ $b = -((-$g[$i]) & 0x7ffffff);
+
+ /*
+ * Return the appropriate candidate value, based on the sign of the original input:
+ *
+ * The following is equivalent to this ternary:
+ *
+ * $g[$i] = (($g[$i] >> $x) & 1) ? $a : $b;
+ *
+ * Except what's written doesn't contain timing leaks.
+ */
+ $g[$i] = ($a ^ (($a ^ $b) & $mask));
+ }
+ return $g;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludessodium_compatsrcCoreUtilphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/sodium_compat/src/Core/Util.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/sodium_compat/src/Core/Util.php 2022-03-24 10:24:52 UTC (rev 52987)
+++ trunk/src/wp-includes/sodium_compat/src/Core/Util.php 2022-03-24 15:18:31 UTC (rev 52988)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -458,7 +458,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var array<int, int> $unpacked */
</span><span class="cx" style="display: block; padding: 0 10px"> $unpacked = unpack('V', $string);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return (int) ($unpacked[1] & 0xffffffff);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return (int) $unpacked[1];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -613,7 +613,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> $high = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var int $low */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $low = $num & 0xffffffff;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (PHP_INT_SIZE === 4) {
+ $low = (int) $num;
+ } else {
+ $low = $num & 0xffffffff;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ((+(abs($num))) >= 1) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ($num > 0) {
</span></span></pre></div>
<a id="trunksrcwpincludessodium_compatsrcCore32Curve25519Fephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/sodium_compat/src/Core32/Curve25519/Fe.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/sodium_compat/src/Core32/Curve25519/Fe.php 2022-03-24 10:24:52 UTC (rev 52987)
+++ trunk/src/wp-includes/sodium_compat/src/Core32/Curve25519/Fe.php 2022-03-24 15:18:31 UTC (rev 52988)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -48,6 +48,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> for ($i = 0; $i < $count; ++$i) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!($array[$i] instanceof ParagonIE_Sodium_Core32_Int32)) {
+ throw new TypeError('Expected ParagonIE_Sodium_Core32_Int32');
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> $array[$i]->overflow = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> $obj->offsetSet($i, $array[$i]);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludessodium_compatsrcCore32Curve25519php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/sodium_compat/src/Core32/Curve25519.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/sodium_compat/src/Core32/Curve25519.php 2022-03-24 10:24:52 UTC (rev 52987)
+++ trunk/src/wp-includes/sodium_compat/src/Core32/Curve25519.php 2022-03-24 15:18:31 UTC (rev 52988)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -325,25 +325,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $carry9 = $f[9]->shiftRight(25);
</span><span class="cx" style="display: block; padding: 0 10px"> $f[9] = $f[9]->subInt64($carry9->shiftLeft(25));
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h0 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h0 = $f[0]->toInt32()->toInt();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h1 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h1 = $f[1]->toInt32()->toInt();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h2 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h2 = $f[2]->toInt32()->toInt();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h3 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h3 = $f[3]->toInt32()->toInt();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h4 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h4 = $f[4]->toInt32()->toInt();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h5 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h5 = $f[5]->toInt32()->toInt();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h6 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h6 = $f[6]->toInt32()->toInt();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h7 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h7 = $f[7]->toInt32()->toInt();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h8 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h8 = $f[8]->toInt32()->toInt();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $h9 */
</del><span class="cx" style="display: block; padding: 0 10px"> $h9 = $f[9]->toInt32()->toInt();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -418,7 +408,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ($zero === null) {
</span><span class="cx" style="display: block; padding: 0 10px"> $zero = str_repeat("\x00", 32);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var string $str */
</del><span class="cx" style="display: block; padding: 0 10px"> $str = self::fe_tobytes($f);
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var string $zero */
</span><span class="cx" style="display: block; padding: 0 10px"> return !self::verify_32($str, $zero);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -497,15 +486,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $g7_19 = $g7->mulInt(19, 5);
</span><span class="cx" style="display: block; padding: 0 10px"> $g8_19 = $g8->mulInt(19, 5);
</span><span class="cx" style="display: block; padding: 0 10px"> $g9_19 = $g9->mulInt(19, 5);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f1_2 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f1_2 = $f1->shiftLeft(1);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f3_2 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f3_2 = $f3->shiftLeft(1);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f5_2 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f5_2 = $f5->shiftLeft(1);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f7_2 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f7_2 = $f7->shiftLeft(1);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f9_2 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f9_2 = $f9->shiftLeft(1);
</span><span class="cx" style="display: block; padding: 0 10px"> $f0g0 = $f0->mulInt64($g0, 27);
</span><span class="cx" style="display: block; padding: 0 10px"> $f0g1 = $f0->mulInt64($g1, 27);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -775,28 +759,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function fe_sq(ParagonIE_Sodium_Core32_Curve25519_Fe $f)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f0 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f0 = $f[0]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f1 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f1 = $f[1]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f2 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f2 = $f[2]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f3 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f3 = $f[3]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f4 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f4 = $f[4]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f5 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f5 = $f[5]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f6 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f6 = $f[6]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f7 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f7 = $f[7]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f8 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f8 = $f[8]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f9 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f9 = $f[9]->toInt64();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f0_2 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f0_2 = $f0->shiftLeft(1);
</span><span class="cx" style="display: block; padding: 0 10px"> $f1_2 = $f1->shiftLeft(1);
</span><span class="cx" style="display: block; padding: 0 10px"> $f2_2 = $f2->shiftLeft(1);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -810,7 +783,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $f7_38 = $f7->mulInt(38, 6);
</span><span class="cx" style="display: block; padding: 0 10px"> $f8_19 = $f8->mulInt(19, 5);
</span><span class="cx" style="display: block; padding: 0 10px"> $f9_38 = $f9->mulInt(38, 6);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f0f0*/
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $f0f0 = $f0->mulInt64($f0, 28);
</span><span class="cx" style="display: block; padding: 0 10px"> $f0f1_2 = $f0_2->mulInt64($f1, 28);
</span><span class="cx" style="display: block; padding: 0 10px"> $f0f2_2 = $f0_2->mulInt64($f2, 28);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -979,25 +952,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function fe_sq2(ParagonIE_Sodium_Core32_Curve25519_Fe $f)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f0 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f0 = $f[0]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f1 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f1 = $f[1]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f2 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f2 = $f[2]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f3 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f3 = $f[3]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f4 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f4 = $f[4]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f5 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f5 = $f[5]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f6 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f6 = $f[6]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f7 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f7 = $f[7]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f8 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f8 = $f[8]->toInt64();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Int64 $f9 */
</del><span class="cx" style="display: block; padding: 0 10px"> $f9 = $f[9]->toInt64();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $f0_2 = $f0->shiftLeft(1);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1479,7 +1442,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> static $d = null;
</span><span class="cx" style="display: block; padding: 0 10px"> if (!$d) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var ParagonIE_Sodium_Core32_Curve25519_Fe $d */
</del><span class="cx" style="display: block; padding: 0 10px"> $d = ParagonIE_Sodium_Core32_Curve25519_Fe::fromArray(
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core32_Int32::fromInt(self::$d[0]),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1495,6 +1457,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @var ParagonIE_Sodium_Core32_Curve25519_Fe $d */
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> # fe_frombytes(h->Y,s);
</span><span class="cx" style="display: block; padding: 0 10px"> # fe_1(h->Z);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1833,7 +1796,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function equal($b, $c)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return (int) ((($b ^ $c) - 1 & 0xffffffff) >> 31);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $b0 = $b & 0xffff;
+ $b1 = ($b >> 16) & 0xffff;
+ $c0 = $c & 0xffff;
+ $c1 = ($c >> 16) & 0xffff;
+
+ $d0 = (($b0 ^ $c0) - 1) >> 31;
+ $d1 = (($b1 ^ $c1) - 1) >> 31;
+ return ($d0 & $d1) & 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1850,7 +1820,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $char < 0 ? 1 : 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var string $char */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $x */
</del><span class="cx" style="display: block; padding: 0 10px"> $x = self::chrToInt(self::substr($char, 0, 1));
</span><span class="cx" style="display: block; padding: 0 10px"> return (int) ($x >> 31);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1956,7 +1925,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $bnegative = self::negative($b);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $babs */
</del><span class="cx" style="display: block; padding: 0 10px"> $babs = $b - (((-$bnegative) & $b) << 1);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $t = self::ge_precomp_0();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1964,7 +1932,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $t = self::cmov(
</span><span class="cx" style="display: block; padding: 0 10px"> $t,
</span><span class="cx" style="display: block; padding: 0 10px"> $base[$pos][$i],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self::equal($babs, $i + 1)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -self::equal($babs, $i + 1)
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $minusT = new ParagonIE_Sodium_Core32_Curve25519_Ge_Precomp(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2230,9 +2198,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $carry = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> for ($i = 0; $i < 63; ++$i) {
</span><span class="cx" style="display: block; padding: 0 10px"> $e[$i] += $carry;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $carry */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry = $e[$i] + 8;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $carry */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry >>= 4;
</span><span class="cx" style="display: block; padding: 0 10px"> $e[$i] -= $carry << 4;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3140,7 +3106,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function ge_mul_l(ParagonIE_Sodium_Core32_Curve25519_Ge_P3 $A)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var array<int, int> $aslide */
</del><span class="cx" style="display: block; padding: 0 10px"> $aslide = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 13, 0, 0, 0, 0, -1, 0, 0, 0, 0, -11, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0,
</span><span class="cx" style="display: block; padding: 0 10px"> 0, 0, 0, -3, 0, 0, 0, 0, -13, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 3, 0,
</span></span></pre></div>
<a id="trunksrcwpincludessodium_compatsrcCore32Int32php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/sodium_compat/src/Core32/Int32.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/sodium_compat/src/Core32/Int32.php 2022-03-24 10:24:52 UTC (rev 52987)
+++ trunk/src/wp-includes/sodium_compat/src/Core32/Int32.php 2022-03-24 15:18:31 UTC (rev 52988)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -138,9 +138,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function mask($m = 0)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var int $hi */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $hi = ($m >> 16) & 0xffff;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $hi = ((int) $m >> 16);
+ $hi &= 0xffff;
</ins><span class="cx" style="display: block; padding: 0 10px"> /** @var int $lo */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $lo = ($m & 0xffff);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $lo = ((int) $m) & 0xffff;
</ins><span class="cx" style="display: block; padding: 0 10px"> return new ParagonIE_Sodium_Core32_Int32(
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> (int) ($this->limbs[0] & $hi),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -168,8 +169,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> for ($j = 0; $j < $a_l; ++$j) {
</span><span class="cx" style="display: block; padding: 0 10px"> $b_j = $b[$j];
</span><span class="cx" style="display: block; padding: 0 10px"> $product = ($a_i * $b_j) + $r[$i + $j];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $carry = ($product >> $baseLog2 & 0xffff);
- $r[$i + $j] = ($product - (int) ($carry * $base)) & 0xffff;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $carry = ((int) $product >> $baseLog2 & 0xffff);
+ $r[$i + $j] = ((int) $product - (int) ($carry * $base)) & 0xffff;
</ins><span class="cx" style="display: block; padding: 0 10px"> $r[$i + $j + 1] += $carry;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludessodium_compatsrcCore32Int64php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/sodium_compat/src/Core32/Int64.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/sodium_compat/src/Core32/Int64.php 2022-03-24 10:24:52 UTC (rev 52987)
+++ trunk/src/wp-includes/sodium_compat/src/Core32/Int64.php 2022-03-24 15:18:31 UTC (rev 52988)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -337,9 +337,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $a_i = $a[$i];
</span><span class="cx" style="display: block; padding: 0 10px"> for ($j = 0; $j < $a_l; ++$j) {
</span><span class="cx" style="display: block; padding: 0 10px"> $b_j = $b[$j];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $product = ($a_i * $b_j) + $r[$i + $j];
- $carry = ($product >> $baseLog2 & 0xffff);
- $r[$i + $j] = ($product - (int) ($carry * $base)) & 0xffff;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $product = (($a_i * $b_j) + $r[$i + $j]);
+ $carry = (((int) $product >> $baseLog2) & 0xffff);
+ $r[$i + $j] = ((int) $product - (int) ($carry * $base)) & 0xffff;
</ins><span class="cx" style="display: block; padding: 0 10px"> $r[$i + $j + 1] += $carry;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludessodium_compatsrcCore32Poly1305Statephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/sodium_compat/src/Core32/Poly1305/State.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/sodium_compat/src/Core32/Poly1305/State.php 2022-03-24 10:24:52 UTC (rev 52987)
+++ trunk/src/wp-includes/sodium_compat/src/Core32/Poly1305/State.php 2022-03-24 15:18:31 UTC (rev 52988)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -419,7 +419,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $g4 = $g4->mask($mask);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var int $mask */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $mask = (~$mask) & 0xffffffff;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $mask = ~$mask;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $h0 = $h0->mask($mask)->orInt32($g0);
</span><span class="cx" style="display: block; padding: 0 10px"> $h1 = $h1->mask($mask)->orInt32($g1);
</span></span></pre></div>
<a id="trunksrcwpincludessodium_compatsrcCore32XChaCha20php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/sodium_compat/src/Core32/XChaCha20.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/sodium_compat/src/Core32/XChaCha20.php 2022-03-24 10:24:52 UTC (rev 52987)
+++ trunk/src/wp-includes/sodium_compat/src/Core32/XChaCha20.php 2022-03-24 15:18:31 UTC (rev 52988)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -61,4 +61,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $message
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @internal You should not use this directly from another application
+ *
+ * @param string $message
+ * @param string $nonce
+ * @param string $key
+ * @param string $ic
+ * @return string
+ * @throws SodiumException
+ * @throws TypeError
+ */
+ public static function ietfStreamXorIc($message, $nonce = '', $key = '', $ic = '')
+ {
+ return self::encryptBytes(
+ new ParagonIE_Sodium_Core32_ChaCha20_IetfCtx(
+ self::hChaCha20(self::substr($nonce, 0, 16), $key),
+ "\x00\x00\x00\x00" . self::substr($nonce, 16, 8),
+ $ic
+ ),
+ $message
+ );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludessodium_compatsrcFilephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/sodium_compat/src/File.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/sodium_compat/src/File.php 2022-03-24 10:24:52 UTC (rev 52987)
+++ trunk/src/wp-includes/sodium_compat/src/File.php 2022-03-24 15:18:31 UTC (rev 52988)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1154,19 +1154,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private static function sign_core32($filePath, $secretKey)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int|bool $size */
</del><span class="cx" style="display: block; padding: 0 10px"> $size = filesize($filePath);
</span><span class="cx" style="display: block; padding: 0 10px"> if (!is_int($size)) {
</span><span class="cx" style="display: block; padding: 0 10px"> throw new SodiumException('Could not obtain the file size');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $size */
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var resource|bool $fp */
</del><span class="cx" style="display: block; padding: 0 10px"> $fp = fopen($filePath, 'rb');
</span><span class="cx" style="display: block; padding: 0 10px"> if (!is_resource($fp)) {
</span><span class="cx" style="display: block; padding: 0 10px"> throw new SodiumException('Could not open input file for reading');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var resource $fp */
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var string $az */
</span><span class="cx" style="display: block; padding: 0 10px"> $az = hash('sha512', self::substr($secretKey, 0, 32), true);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1179,16 +1175,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var resource $hs */
</span><span class="cx" style="display: block; padding: 0 10px"> $hs = self::updateHashWithFile($hs, $fp, $size);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var string $nonceHash */
</del><span class="cx" style="display: block; padding: 0 10px"> $nonceHash = hash_final($hs, true);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /** @var string $pk */
</del><span class="cx" style="display: block; padding: 0 10px"> $pk = self::substr($secretKey, 32, 32);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /** @var string $nonce */
</del><span class="cx" style="display: block; padding: 0 10px"> $nonce = ParagonIE_Sodium_Core32_Ed25519::sc_reduce($nonceHash) . self::substr($nonceHash, 32);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /** @var string $sig */
</del><span class="cx" style="display: block; padding: 0 10px"> $sig = ParagonIE_Sodium_Core32_Ed25519::ge_p3_tobytes(
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core32_Ed25519::ge_scalarmult_base($nonce)
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1199,13 +1188,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var resource $hs */
</span><span class="cx" style="display: block; padding: 0 10px"> $hs = self::updateHashWithFile($hs, $fp, $size);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var string $hramHash */
</del><span class="cx" style="display: block; padding: 0 10px"> $hramHash = hash_final($hs, true);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var string $hram */
</del><span class="cx" style="display: block; padding: 0 10px"> $hram = ParagonIE_Sodium_Core32_Ed25519::sc_reduce($hramHash);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var string $sigAfter */
</del><span class="cx" style="display: block; padding: 0 10px"> $sigAfter = ParagonIE_Sodium_Core32_Ed25519::sc_muladd($hram, $az, $nonce);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var string $sig */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1243,6 +1229,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (ParagonIE_Sodium_Core32_Ed25519::small_order($sig)) {
</span><span class="cx" style="display: block; padding: 0 10px"> throw new SodiumException('Signature is on too small of an order');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ((self::chrToInt($sig[63]) & 224) !== 0) {
</span><span class="cx" style="display: block; padding: 0 10px"> throw new SodiumException('Invalid signature');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>