<!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>[45355] branches/5.2/src/wp-includes/sodium_compat: Upgrade/Install: Update `sodium_compat` to v1.10.0.</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/45355">45355</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/45355","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>desrosj</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-05-17 17:19:21 +0000 (Fri, 17 May 2019)</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.10.0.
This adds a `runtime_speed_test()` method for estimating if the 32-bit implementation is fast enough for expensive computations.
Merges <a href="https://core.trac.wordpress.org/changeset/45344">[45344]</a> to the 5.2 branch.
Props paragoninitiativeenterprises, tellyworth.
See <a href="https://core.trac.wordpress.org/ticket/47186">#47186</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches52srcwpincludessodium_compatLICENSE">branches/5.2/src/wp-includes/sodium_compat/LICENSE</a></li>
<li><a href="#branches52srcwpincludessodium_compatcomposerjson">branches/5.2/src/wp-includes/sodium_compat/composer.json</a></li>
<li><a href="#branches52srcwpincludessodium_compatlibphp72compatphp">branches/5.2/src/wp-includes/sodium_compat/lib/php72compat.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatlibsodium_compatphp">branches/5.2/src/wp-includes/sodium_compat/lib/sodium_compat.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatnamespacedCoreSalsa20php">branches/5.2/src/wp-includes/sodium_compat/namespaced/Core/Salsa20.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatnamespacedCoreXsalsa20php">branches/5.2/src/wp-includes/sodium_compat/namespaced/Core/Xsalsa20.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcCompatphp">branches/5.2/src/wp-includes/sodium_compat/src/Compat.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcCoreBLAKE2bphp">branches/5.2/src/wp-includes/sodium_compat/src/Core/BLAKE2b.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcCoreChaCha20Ctxphp">branches/5.2/src/wp-includes/sodium_compat/src/Core/ChaCha20/Ctx.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcCoreCurve25519Fephp">branches/5.2/src/wp-includes/sodium_compat/src/Core/Curve25519/Fe.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcCoreUtilphp">branches/5.2/src/wp-includes/sodium_compat/src/Core/Util.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcCore32BLAKE2bphp">branches/5.2/src/wp-includes/sodium_compat/src/Core32/BLAKE2b.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcCore32ChaCha20Ctxphp">branches/5.2/src/wp-includes/sodium_compat/src/Core32/ChaCha20/Ctx.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcCore32Int32php">branches/5.2/src/wp-includes/sodium_compat/src/Core32/Int32.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcCore32Int64php">branches/5.2/src/wp-includes/sodium_compat/src/Core32/Int64.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcCore32X25519php">branches/5.2/src/wp-includes/sodium_compat/src/Core32/X25519.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcCryptophp">branches/5.2/src/wp-includes/sodium_compat/src/Crypto.php</a></li>
<li><a href="#branches52srcwpincludessodium_compatsrcFilephp">branches/5.2/src/wp-includes/sodium_compat/src/File.php</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#branches52">branches/5.2/</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/5.2
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- branches/5.2 2019-05-17 17:07:41 UTC (rev 45354)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/5.2 2019-05-17 17:19:21 UTC (rev 45355)
</ins><a id="branches52"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/5.2</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/3.4:21757
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/4.9:43557,43622
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43747,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43785,43790-43806,43808-43821,43825,43828,43830-43834,43836-43843,43846-43863,43867-43889,43891-43894,43897-43905,43908-43909,43911-43929,43931-43942,43946-43947,43949-43956,43959-43964,43967-43969,43988,43994,44014,44017,44047,44183,44185,44187-44206,44208-44213,44231-44232,44235,44248,44284,44287-44288
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/trunk:45285,45287,45289,45292,45296,45300-45301,45308-45311,45316,45319,45322,45324,45326,45328,45331,45334,45336,45338,45340,45342,45346,45348,45350,45352
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/trunk:45285,45287,45289,45292,45296,45300-45301,45308-45311,45316,45319,45322,45324,45326,45328,45331,45334,45336,45338,45340,45342,45344,45346,45348,45350,45352
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches52srcwpincludessodium_compatLICENSE"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/LICENSE</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/LICENSE 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/LICENSE 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,10 +1,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * ISC License
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Copyright (c) 2016-2019
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Copyright (c) 2016-2018
</ins><span class="cx" style="display: block; padding: 0 10px"> * Paragon Initiative Enterprises <security at paragonie dot com>
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Copyright (c) 2013-2019
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Copyright (c) 2013-2018
</ins><span class="cx" style="display: block; padding: 0 10px"> * Frank Denis <j at pureftpd dot org>
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Permission to use, copy, modify, and/or distribute this software for any
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatcomposerjson"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/composer.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/composer.json 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/composer.json 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -50,7 +50,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "files": ["autoload.php"]
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> "require": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8",
</ins><span class="cx" style="display: block; padding: 0 10px"> "paragonie/random_compat": ">=1"
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> "require-dev": {
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatlibphp72compatphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/lib/php72compat.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/lib/php72compat.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/lib/php72compat.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -107,7 +107,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $assocData
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $nonce
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $key
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string|bool
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function sodium_crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -153,7 +153,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $assocData
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $nonce
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $key
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string|bool
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -199,7 +199,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $assocData
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $nonce
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $key
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string|bool
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -245,12 +245,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $assocData
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $nonce
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $key
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string|bool
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> } catch (Error $ex) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> } catch (Exception $ex) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -271,7 +271,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key)
</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_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key, true);
</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"> if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_keygen')) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -952,7 +952,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (!is_callable('sodium_increment')) {
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @see ParagonIE_Sodium_Compat::increment()
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param &string $string
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $string
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws SodiumException
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws TypeError
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1009,7 +1009,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (!is_callable('sodium_memzero')) {
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @see ParagonIE_Sodium_Compat::memzero()
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string &$str
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $str
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws SodiumException
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws TypeError
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatlibsodium_compatphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/lib/sodium_compat.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/lib/sodium_compat.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/lib/sodium_compat.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -45,16 +45,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $nonce
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $key
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string|bool
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @throws \SodiumException
- * @throws \TypeError
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="cx" style="display: block; padding: 0 10px"> return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (Error $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\TypeError $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (Exception $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\SodiumException $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</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">@@ -93,16 +91,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $nonce
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $key
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string|bool
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @throws \SodiumException
- * @throws \TypeError
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="cx" style="display: block; padding: 0 10px"> return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (Error $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\TypeError $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (Exception $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\SodiumException $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</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">@@ -131,16 +127,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $nonce
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $key
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string|bool
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @throws \SodiumException
- * @throws \TypeError
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="cx" style="display: block; padding: 0 10px"> return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (Error $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\TypeError $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (Exception $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\SodiumException $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</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">@@ -238,16 +232,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $nonce
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $kp
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string|bool
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @throws \SodiumException
- * @throws \TypeError
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function crypto_box_open($message, $nonce, $kp)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="cx" style="display: block; padding: 0 10px"> return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (Error $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\TypeError $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (Exception $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\SodiumException $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</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">@@ -298,15 +290,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $message
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $kp
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string|bool
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @throws \TypeError
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function crypto_box_seal_open($message, $kp)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="cx" style="display: block; padding: 0 10px"> return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (\Error $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\TypeError $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (\Exception $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\SodiumException $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</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">@@ -543,16 +534,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $nonce
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $key
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string|bool
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @throws \SodiumException
- * @throws \TypeError
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function crypto_secretbox_open($message, $nonce, $key)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="cx" style="display: block; padding: 0 10px"> return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (Error $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\TypeError $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (Exception $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\SodiumException $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</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">@@ -622,9 +611,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="cx" style="display: block; padding: 0 10px"> return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (\Error $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\TypeError $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (\Exception $ex) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (\SodiumException $ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</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">@@ -810,7 +799,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @see ParagonIE_Sodium_Compat::randombytes_uniform()
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $upperLimit
</span><span class="cx" style="display: block; padding: 0 10px"> * @return int
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @throws \Exception
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @throws \SodiumException
</ins><span class="cx" style="display: block; padding: 0 10px"> * @throws \Error
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function randombytes_uniform($upperLimit)
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatnamespacedCoreSalsa20php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/namespaced/Core/Salsa20.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/namespaced/Core/Salsa20.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/namespaced/Core/Salsa20.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,7 +1,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> namespace ParagonIE\Sodium\Core;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class SipHash extends \ParagonIE_Sodium_Core_Salsa20
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Salsa20 extends \ParagonIE_Sodium_Core_Salsa20
</ins><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}
</ins></span></pre></div>
<a id="branches52srcwpincludessodium_compatnamespacedCoreXsalsa20php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/namespaced/Core/Xsalsa20.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/namespaced/Core/Xsalsa20.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/namespaced/Core/Xsalsa20.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,7 +1,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> namespace ParagonIE\Sodium\Core;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Xsalsa20 extends \ParagonIE_Sodium_Core_Xsalsa20
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Xsalsa20 extends \ParagonIE_Sodium_Core_XSalsa20
</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></pre></div>
<a id="branches52srcwpincludessodium_compatsrcCompatphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/src/Compat.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/src/Compat.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/Compat.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -144,9 +144,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $left The left operand; must be a string
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $right The right operand; must be a string
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return int < 0 if the left operand is less than the right
- * = 0 if both strings are equal
- * > 0 if the right operand is less than the left
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return int If < 0 if the left operand is less than the right
+ * If = 0 if both strings are equal
+ * If > 0 if the right operand is less than the left
</ins><span class="cx" style="display: block; padding: 0 10px"> * @throws SodiumException
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws TypeError
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArgument
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -669,12 +669,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * This mode uses a 64-bit random nonce with a 64-bit counter.
</span><span class="cx" style="display: block; padding: 0 10px"> * IETF mode uses a 96-bit random nonce with a 32-bit counter.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $ciphertext Encrypted message (with Poly1305 MAC appended)
- * @param string $assocData Authenticated Associated Data (unencrypted)
- * @param string $nonce Number to be used only Once; must be 8 bytes
- * @param string $key Encryption key
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $ciphertext Encrypted message (with Poly1305 MAC appended)
+ * @param string $assocData Authenticated Associated Data (unencrypted)
+ * @param string $nonce Number to be used only Once; must be 8 bytes
+ * @param string $key Encryption key
+ * @param bool $dontFallback Don't fallback to ext/sodium
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string The original plaintext message
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string|bool The original plaintext message
</ins><span class="cx" style="display: block; padding: 0 10px"> * @throws SodiumException
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws TypeError
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArgument
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -683,7 +684,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $ciphertext = '',
</span><span class="cx" style="display: block; padding: 0 10px"> $assocData = '',
</span><span class="cx" style="display: block; padding: 0 10px"> $nonce = '',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $key = ''
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $key = '',
+ $dontFallback = false
</ins><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* Type checks: */
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -701,6 +703,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (ParagonIE_Sodium_Core_Util::strlen($ciphertext) < self::CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES) {
</span><span class="cx" style="display: block; padding: 0 10px"> throw new SodiumException('Message must be at least CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES long');
</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 (self::useNewSodiumAPI() && !$dontFallback) {
+ if (is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_decrypt')) {
+ return sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(
+ $ciphertext,
+ $assocData,
+ $nonce,
+ $key
+ );
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (PHP_INT_SIZE === 4) {
</span><span class="cx" style="display: block; padding: 0 10px"> return ParagonIE_Sodium_Crypto32::aead_xchacha20poly1305_ietf_decrypt(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -727,10 +739,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * This mode uses a 64-bit random nonce with a 64-bit counter.
</span><span class="cx" style="display: block; padding: 0 10px"> * IETF mode uses a 96-bit random nonce with a 32-bit counter.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $plaintext Message to be encrypted
- * @param string $assocData Authenticated Associated Data (unencrypted)
- * @param string $nonce Number to be used only Once; must be 8 bytes
- * @param string $key Encryption key
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $plaintext Message to be encrypted
+ * @param string $assocData Authenticated Associated Data (unencrypted)
+ * @param string $nonce Number to be used only Once; must be 8 bytes
+ * @param string $key Encryption key
+ * @param bool $dontFallback Don't fallback to ext/sodium
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Ciphertext with a 16-byte Poly1305 message
</span><span class="cx" style="display: block; padding: 0 10px"> * authentication code appended
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -742,7 +755,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $plaintext = '',
</span><span class="cx" style="display: block; padding: 0 10px"> $assocData = '',
</span><span class="cx" style="display: block; padding: 0 10px"> $nonce = '',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $key = ''
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $key = '',
+ $dontFallback = false
</ins><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* Type checks: */
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -757,6 +771,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (ParagonIE_Sodium_Core_Util::strlen($key) !== self::CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES) {
</span><span class="cx" style="display: block; padding: 0 10px"> throw new SodiumException('Key must be CRYPTO_AEAD_XCHACHA20POLY1305_KEYBYTES long');
</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 (self::useNewSodiumAPI() && !$dontFallback) {
+ if (is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_encrypt')) {
+ return sodium_crypto_aead_xchacha20poly1305_ietf_encrypt(
+ $plaintext,
+ $assocData,
+ $nonce,
+ $key
+ );
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (PHP_INT_SIZE === 4) {
</span><span class="cx" style="display: block; padding: 0 10px"> return ParagonIE_Sodium_Crypto32::aead_xchacha20poly1305_ietf_encrypt(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1279,12 +1303,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Get the final BLAKE2b hash output for a given context.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string &$ctx BLAKE2 hashing context. Generated by crypto_generichash_init().
- * @param int $length Hash output size.
- * @return string Final BLAKE2b hash.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $ctx BLAKE2 hashing context. Generated by crypto_generichash_init().
+ * @param int $length Hash output size.
+ * @return string Final BLAKE2b hash.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @throws SodiumException
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws TypeError
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArgument
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @psalm-suppress ReferenceConstraintViolation
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function crypto_generichash_final(&$ctx, $length = self::CRYPTO_GENERICHASH_BYTES)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1357,13 +1382,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Update a BLAKE2b hashing context with additional data.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string &$ctx BLAKE2 hashing context. Generated by crypto_generichash_init().
- * $ctx is passed by reference and gets updated in-place.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $ctx BLAKE2 hashing context. Generated by crypto_generichash_init().
+ * $ctx is passed by reference and gets updated in-place.
+ * @param-out string $ctx
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $message The message to append to the existing hash state.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws SodiumException
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws TypeError
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArgument
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @psalm-suppress ReferenceConstraintViolation
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function crypto_generichash_update(&$ctx, $message)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2610,6 +2637,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * native library for that.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string|null $var
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param-out string|null $var
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws SodiumException (Unless libsodium is installed)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2622,6 +2650,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core_Util::declareScalarType($var, 'string', 1);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (self::useNewSodiumAPI()) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @psalm-suppress MixedArgument */
</ins><span class="cx" style="display: block; padding: 0 10px"> sodium_memzero($var);
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2726,6 +2755,42 @@
</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">+ * Runtime testing method for 32-bit platforms.
+ *
+ * Usage: If runtime_speed_test() returns FALSE, then our 32-bit
+ * implementation is to slow to use safely without risking timeouts.
+ * If this happens, install sodium from PECL to get acceptable
+ * performance.
+ *
+ * @param int $iterations Number of multiplications to attempt
+ * @param int $maxTimeout Milliseconds
+ * @return bool TRUE if we're fast enough, FALSE is not
+ * @throws SodiumException
+ */
+ public static function runtime_speed_test($iterations, $maxTimeout)
+ {
+ if (self::polyfill_is_fast()) {
+ return true;
+ }
+ /** @var float $end */
+ $end = 0.0;
+ /** @var float $start */
+ $start = microtime(true);
+ /** @var ParagonIE_Sodium_Core32_Int64 $a */
+ $a = ParagonIE_Sodium_Core32_Int64::fromInt(random_int(3, 1 << 16));
+ for ($i = 0; $i < $iterations; ++$i) {
+ /** @var ParagonIE_Sodium_Core32_Int64 $b */
+ $b = ParagonIE_Sodium_Core32_Int64::fromInt(random_int(3, 1 << 16));
+ $a->mulInt64($b);
+ }
+ /** @var float $end */
+ $end = microtime(true);
+ /** @var int $diff */
+ $diff = (int) ceil(($end - $start) * 1000);
+ return $diff < $maxTimeout;
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * This emulates libsodium's version_string() function, except ours is
</span><span class="cx" style="display: block; padding: 0 10px"> * prefixed with 'polyfill-'.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatsrcCoreBLAKE2bphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/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">--- branches/5.2/src/wp-includes/sodium_compat/src/Core/BLAKE2b.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/Core/BLAKE2b.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -256,6 +256,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (++$i > $maxLength) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @psalm-suppress MixedOperand */
</ins><span class="cx" style="display: block; padding: 0 10px"> $u[$uIdx] >>= 8;
</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">@@ -642,7 +643,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param SplFixedArray[SplFixedArray] $ctx
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param SplFixedArray $ctx
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws TypeError
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArgument
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatsrcCoreChaCha20Ctxphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/src/Core/ChaCha20/Ctx.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/src/Core/ChaCha20/Ctx.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/Core/ChaCha20/Ctx.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -83,9 +83,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $offset
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $offset
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @psalm-suppress MixedArrayOffset
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function offsetExists($offset)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -95,7 +94,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $offset
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $offset
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArrayOffset
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -107,7 +106,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $offset
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $offset
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return mixed|null
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArrayOffset
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatsrcCoreCurve25519Fephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/src/Core/Curve25519/Fe.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/src/Core/Curve25519/Fe.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/Core/Curve25519/Fe.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -12,7 +12,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class ParagonIE_Sodium_Core_Curve25519_Fe implements ArrayAccess
</span><span class="cx" style="display: block; padding: 0 10px"> {
</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
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @var array<int, int>
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected $container = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -24,7 +24,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $array
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array<int, int> $array
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param bool $save_indexes
</span><span class="cx" style="display: block; padding: 0 10px"> * @return self
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -37,6 +37,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $keys = range(0, $count - 1);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $array = array_values($array);
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @var array<int, int> $keys */
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $obj = new ParagonIE_Sodium_Core_Curve25519_Fe();
</span><span class="cx" style="display: block; padding: 0 10px"> if ($save_indexes) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -54,8 +55,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $offset
- * @param mixed $value
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int|null $offset
+ * @param int $value
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArrayOffset
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -74,7 +75,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $offset
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $offset
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArrayOffset
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -86,7 +87,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $offset
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $offset
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArrayOffset
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -98,15 +99,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $offset
- * @return mixed|null
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $offset
+ * @return int
</ins><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArrayOffset
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function offsetGet($offset)
</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 isset($this->container[$offset])
- ? $this->container[$offset]
- : null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!isset($this->container[$offset])) {
+ $this->container[$offset] = 0;
+ }
+ return (int) ($this->container[$offset]);
</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></pre></div>
<a id="branches52srcwpincludessodium_compatsrcCoreUtilphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/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">--- branches/5.2/src/wp-includes/sodium_compat/src/Core/Util.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/Core/Util.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -817,7 +817,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $sub = (string) substr($str, $start, $length);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (isset($sub)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($sub !== '') {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $sub;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> return '';
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatsrcCore32BLAKE2bphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/src/Core32/BLAKE2b.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/src/Core32/BLAKE2b.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/Core32/BLAKE2b.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -574,7 +574,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param SplFixedArray[SplFixedArray] $ctx
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param SplFixedArray $ctx
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws TypeError
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArgument
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatsrcCore32ChaCha20Ctxphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/src/Core32/ChaCha20/Ctx.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/src/Core32/ChaCha20/Ctx.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/Core32/ChaCha20/Ctx.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -89,7 +89,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $offset
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $offset
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArrayOffset
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -101,7 +101,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $offset
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $offset
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArrayOffset
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -113,7 +113,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @internal You should not use this directly from another application
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $offset
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $offset
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return mixed|null
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress MixedArrayOffset
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatsrcCore32Int32php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/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">--- branches/5.2/src/wp-includes/sodium_compat/src/Core32/Int32.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/Core32/Int32.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -151,7 +151,137 @@
</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">+ * @param array<int, int> $a
+ * @param array<int, int> $b
+ * @param int $baseLog2
+ * @return array<int, int>
+ */
+ public function multiplyLong(array $a, array $b, $baseLog2 = 16)
+ {
+ $a_l = count($a);
+ $b_l = count($b);
+ /** @var array<int, int> $r */
+ $r = array_fill(0, $a_l + $b_l + 1, 0);
+ $base = 1 << $baseLog2;
+ for ($i = 0; $i < $a_l; ++$i) {
+ $a_i = $a[$i];
+ for ($j = 0; $j < $a_l; ++$j) {
+ $b_j = $b[$j];
+ $product = ($a_i * $b_j) + $r[$i + $j];
+ $carry = ($product >> $baseLog2 & 0xffff);
+ $r[$i + $j] = ($product - (int) ($carry * $base)) & 0xffff;
+ $r[$i + $j + 1] += $carry;
+ }
+ }
+ return array_slice($r, 0, 5);
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $int
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return ParagonIE_Sodium_Core32_Int32
+ */
+ public function mulIntFast($int)
+ {
+ // Handle negative numbers
+ $aNeg = ($this->limbs[0] >> 15) & 1;
+ $bNeg = ($int >> 31) & 1;
+ $a = array_reverse($this->limbs);
+ $b = array(
+ $int & 0xffff,
+ ($int >> 16) & 0xffff
+ );
+ if ($aNeg) {
+ for ($i = 0; $i < 2; ++$i) {
+ $a[$i] = ($a[$i] ^ 0xffff) & 0xffff;
+ }
+ ++$a[0];
+ }
+ if ($bNeg) {
+ for ($i = 0; $i < 2; ++$i) {
+ $b[$i] = ($b[$i] ^ 0xffff) & 0xffff;
+ }
+ ++$b[0];
+ }
+ // Multiply
+ $res = $this->multiplyLong($a, $b);
+
+ // Re-apply negation to results
+ if ($aNeg !== $bNeg) {
+ for ($i = 0; $i < 2; ++$i) {
+ $res[$i] = (0xffff ^ $res[$i]) & 0xffff;
+ }
+ // Handle integer overflow
+ $c = 1;
+ for ($i = 0; $i < 2; ++$i) {
+ $res[$i] += $c;
+ $c = $res[$i] >> 16;
+ $res[$i] &= 0xffff;
+ }
+ }
+
+ // Return our values
+ $return = new ParagonIE_Sodium_Core32_Int32();
+ $return->limbs = array(
+ $res[1] & 0xffff,
+ $res[0] & 0xffff
+ );
+ if (count($res) > 2) {
+ $return->overflow = $res[2] & 0xffff;
+ }
+ $return->unsignedInt = $this->unsignedInt;
+ return $return;
+ }
+
+ /**
+ * @param ParagonIE_Sodium_Core32_Int32 $right
+ * @return ParagonIE_Sodium_Core32_Int32
+ */
+ public function mulInt32Fast(ParagonIE_Sodium_Core32_Int32 $right)
+ {
+ $aNeg = ($this->limbs[0] >> 15) & 1;
+ $bNeg = ($right->limbs[0] >> 15) & 1;
+
+ $a = array_reverse($this->limbs);
+ $b = array_reverse($right->limbs);
+ if ($aNeg) {
+ for ($i = 0; $i < 2; ++$i) {
+ $a[$i] = ($a[$i] ^ 0xffff) & 0xffff;
+ }
+ ++$a[0];
+ }
+ if ($bNeg) {
+ for ($i = 0; $i < 2; ++$i) {
+ $b[$i] = ($b[$i] ^ 0xffff) & 0xffff;
+ }
+ ++$b[0];
+ }
+ $res = $this->multiplyLong($a, $b);
+ if ($aNeg !== $bNeg) {
+ if ($aNeg !== $bNeg) {
+ for ($i = 0; $i < 2; ++$i) {
+ $res[$i] = ($res[$i] ^ 0xffff) & 0xffff;
+ }
+ $c = 1;
+ for ($i = 0; $i < 2; ++$i) {
+ $res[$i] += $c;
+ $c = $res[$i] >> 16;
+ $res[$i] &= 0xffff;
+ }
+ }
+ }
+ $return = new ParagonIE_Sodium_Core32_Int32();
+ $return->limbs = array(
+ $res[1] & 0xffff,
+ $res[0] & 0xffff
+ );
+ if (count($res) > 2) {
+ $return->overflow = $res[2];
+ }
+ return $return;
+ }
+
+ /**
+ * @param int $int
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $size
</span><span class="cx" style="display: block; padding: 0 10px"> * @return ParagonIE_Sodium_Core32_Int32
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws SodiumException
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -161,6 +291,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core32_Util::declareScalarType($int, 'int', 1);
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core32_Util::declareScalarType($size, 'int', 2);
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (ParagonIE_Sodium_Compat::$fastMult) {
+ return $this->mulIntFast((int) $int);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> /** @var int $int */
</span><span class="cx" style="display: block; padding: 0 10px"> $int = (int) $int;
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var int $size */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -218,6 +351,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function mulInt32(ParagonIE_Sodium_Core32_Int32 $int, $size = 0)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core32_Util::declareScalarType($size, 'int', 2);
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (ParagonIE_Sodium_Compat::$fastMult) {
+ return $this->mulInt32Fast($int);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> if (!$size) {
</span><span class="cx" style="display: block; padding: 0 10px"> $size = 31;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -491,7 +627,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var int $c */
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->shiftLeft(-$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">- if (is_null($c)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!is_int($c)) {
</ins><span class="cx" style="display: block; padding: 0 10px"> throw new TypeError();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var int $c */
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatsrcCore32Int64php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/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">--- branches/5.2/src/wp-includes/sodium_compat/src/Core32/Int64.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/Core32/Int64.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -205,6 +205,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function mulInt($int = 0, $size = 0)
</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 (ParagonIE_Sodium_Compat::$fastMult) {
+ return $this->mulIntFast($int);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core32_Util::declareScalarType($int, 'int', 1);
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core32_Util::declareScalarType($size, 'int', 2);
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var int $int */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -268,11 +271,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $a3 &= 0xffff;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $int >>= 1;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $return->limbs[0] = $ret0;
- $return->limbs[1] = $ret1;
- $return->limbs[2] = $ret2;
- $return->limbs[3] = $ret3;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $return->limbs[0] = $ret0;
+ $return->limbs[1] = $ret1;
+ $return->limbs[2] = $ret2;
+ $return->limbs[3] = $ret3;
</ins><span class="cx" style="display: block; padding: 0 10px"> return $return;
</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">@@ -318,6 +321,142 @@
</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">+ * @param array<int, int> $a
+ * @param array<int, int> $b
+ * @param int $baseLog2
+ * @return array<int, int>
+ */
+ public function multiplyLong(array $a, array $b, $baseLog2 = 16)
+ {
+ $a_l = count($a);
+ $b_l = count($b);
+ /** @var array<int, int> $r */
+ $r = array_fill(0, $a_l + $b_l + 1, 0);
+ $base = 1 << $baseLog2;
+ for ($i = 0; $i < $a_l; ++$i) {
+ $a_i = $a[$i];
+ for ($j = 0; $j < $a_l; ++$j) {
+ $b_j = $b[$j];
+ $product = ($a_i * $b_j) + $r[$i + $j];
+ $carry = ($product >> $baseLog2 & 0xffff);
+ $r[$i + $j] = ($product - (int) ($carry * $base)) & 0xffff;
+ $r[$i + $j + 1] += $carry;
+ }
+ }
+ return array_slice($r, 0, 5);
+ }
+
+ /**
+ * @param int $int
+ * @return ParagonIE_Sodium_Core32_Int64
+ */
+ public function mulIntFast($int)
+ {
+ // Handle negative numbers
+ $aNeg = ($this->limbs[0] >> 15) & 1;
+ $bNeg = ($int >> 31) & 1;
+ $a = array_reverse($this->limbs);
+ $b = array(
+ $int & 0xffff,
+ ($int >> 16) & 0xffff,
+ -$bNeg & 0xffff,
+ -$bNeg & 0xffff
+ );
+ if ($aNeg) {
+ for ($i = 0; $i < 4; ++$i) {
+ $a[$i] = ($a[$i] ^ 0xffff) & 0xffff;
+ }
+ ++$a[0];
+ }
+ if ($bNeg) {
+ for ($i = 0; $i < 4; ++$i) {
+ $b[$i] = ($b[$i] ^ 0xffff) & 0xffff;
+ }
+ ++$b[0];
+ }
+ // Multiply
+ $res = $this->multiplyLong($a, $b);
+
+ // Re-apply negation to results
+ if ($aNeg !== $bNeg) {
+ for ($i = 0; $i < 4; ++$i) {
+ $res[$i] = (0xffff ^ $res[$i]) & 0xffff;
+ }
+ // Handle integer overflow
+ $c = 1;
+ for ($i = 0; $i < 4; ++$i) {
+ $res[$i] += $c;
+ $c = $res[$i] >> 16;
+ $res[$i] &= 0xffff;
+ }
+ }
+
+ // Return our values
+ $return = new ParagonIE_Sodium_Core32_Int64();
+ $return->limbs = array(
+ $res[3] & 0xffff,
+ $res[2] & 0xffff,
+ $res[1] & 0xffff,
+ $res[0] & 0xffff
+ );
+ if (count($res) > 4) {
+ $return->overflow = $res[4] & 0xffff;
+ }
+ $return->unsignedInt = $this->unsignedInt;
+ return $return;
+ }
+
+ /**
+ * @param ParagonIE_Sodium_Core32_Int64 $right
+ * @return ParagonIE_Sodium_Core32_Int64
+ */
+ public function mulInt64Fast(ParagonIE_Sodium_Core32_Int64 $right)
+ {
+ $aNeg = ($this->limbs[0] >> 15) & 1;
+ $bNeg = ($right->limbs[0] >> 15) & 1;
+
+ $a = array_reverse($this->limbs);
+ $b = array_reverse($right->limbs);
+ if ($aNeg) {
+ for ($i = 0; $i < 4; ++$i) {
+ $a[$i] = ($a[$i] ^ 0xffff) & 0xffff;
+ }
+ ++$a[0];
+ }
+ if ($bNeg) {
+ for ($i = 0; $i < 4; ++$i) {
+ $b[$i] = ($b[$i] ^ 0xffff) & 0xffff;
+ }
+ ++$b[0];
+ }
+ $res = $this->multiplyLong($a, $b);
+ if ($aNeg !== $bNeg) {
+ if ($aNeg !== $bNeg) {
+ for ($i = 0; $i < 4; ++$i) {
+ $res[$i] = ($res[$i] ^ 0xffff) & 0xffff;
+ }
+ $c = 1;
+ for ($i = 0; $i < 4; ++$i) {
+ $res[$i] += $c;
+ $c = $res[$i] >> 16;
+ $res[$i] &= 0xffff;
+ }
+ }
+ }
+ $return = new ParagonIE_Sodium_Core32_Int64();
+ $return->limbs = array(
+ $res[3] & 0xffff,
+ $res[2] & 0xffff,
+ $res[1] & 0xffff,
+ $res[0] & 0xffff
+ );
+ if (count($res) > 4) {
+ $return->overflow = $res[4];
+ }
+ return $return;
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param ParagonIE_Sodium_Core32_Int64 $int
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $size
</span><span class="cx" style="display: block; padding: 0 10px"> * @return ParagonIE_Sodium_Core32_Int64
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -327,6 +466,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function mulInt64(ParagonIE_Sodium_Core32_Int64 $int, $size = 0)
</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 (ParagonIE_Sodium_Compat::$fastMult) {
+ return $this->mulInt64Fast($int);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core32_Util::declareScalarType($size, 'int', 2);
</span><span class="cx" style="display: block; padding: 0 10px"> if (!$size) {
</span><span class="cx" style="display: block; padding: 0 10px"> $size = 63;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -566,7 +708,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var int $c */
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->shiftRight(-$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">- if (is_null($c)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!is_int($c)) {
</ins><span class="cx" style="display: block; padding: 0 10px"> throw new TypeError();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var int $carry */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -591,10 +733,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function shiftRight($c = 0)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core32_Util::declareScalarType($c, 'int', 1);
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $c = (int) $c;
+ /** @var int $c */
</ins><span class="cx" style="display: block; padding: 0 10px"> $return = new ParagonIE_Sodium_Core32_Int64();
</span><span class="cx" style="display: block; padding: 0 10px"> $return->unsignedInt = $this->unsignedInt;
</span><span class="cx" style="display: block; padding: 0 10px"> $c &= 63;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var int $c */
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $negative = -(($this->limbs[0] >> 15) & 1);
</span><span class="cx" style="display: block; padding: 0 10px"> if ($c >= 16) {
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatsrcCore32X25519php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/src/Core32/X25519.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/src/Core32/X25519.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/Core32/X25519.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -102,58 +102,48 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function fe_mul121666(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 array<int, ParagonIE_Sodium_Core32_Int32> $h */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @var array<int, ParagonIE_Sodium_Core32_Int64> $h */
</ins><span class="cx" style="display: block; padding: 0 10px"> $h = array();
</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]->toInt64()->mulInt(121666, 17);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</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_Int32 $carry9 */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry9 = $h[9]->addInt(1 << 24)->shiftRight(25);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[0] = $h[0]->addInt64($carry9->mulInt(19, 5));
</span><span class="cx" style="display: block; padding: 0 10px"> $h[9] = $h[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 ParagonIE_Sodium_Core32_Int32 $carry1 */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry1 = $h[1]->addInt(1 << 24)->shiftRight(25);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[2] = $h[2]->addInt64($carry1);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[1] = $h[1]->subInt64($carry1->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 ParagonIE_Sodium_Core32_Int32 $carry3 */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry3 = $h[3]->addInt(1 << 24)->shiftRight(25);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[4] = $h[4]->addInt64($carry3);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[3] = $h[3]->subInt64($carry3->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 ParagonIE_Sodium_Core32_Int32 $carry5 */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry5 = $h[5]->addInt(1 << 24)->shiftRight(25);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[6] = $h[6]->addInt64($carry5);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[5] = $h[5]->subInt64($carry5->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 ParagonIE_Sodium_Core32_Int32 $carry7 */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry7 = $h[7]->addInt(1 << 24)->shiftRight(25);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[8] = $h[8]->addInt64($carry7);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[7] = $h[7]->subInt64($carry7->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 ParagonIE_Sodium_Core32_Int32 $carry0 */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry0 = $h[0]->addInt(1 << 25)->shiftRight(26);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[1] = $h[1]->addInt64($carry0);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[0] = $h[0]->subInt64($carry0->shiftLeft(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">- /** @var ParagonIE_Sodium_Core32_Int32 $carry2 */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry2 = $h[2]->addInt(1 << 25)->shiftRight(26);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[3] = $h[3]->addInt64($carry2);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[2] = $h[2]->subInt64($carry2->shiftLeft(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">- /** @var ParagonIE_Sodium_Core32_Int32 $carry4 */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry4 = $h[4]->addInt(1 << 25)->shiftRight(26);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[5] = $h[5]->addInt64($carry4);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[4] = $h[4]->subInt64($carry4->shiftLeft(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">- /** @var ParagonIE_Sodium_Core32_Int32 $carry6 */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry6 = $h[6]->addInt(1 << 25)->shiftRight(26);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[7] = $h[7]->addInt64($carry6);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[6] = $h[6]->subInt64($carry6->shiftLeft(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">- /** @var ParagonIE_Sodium_Core32_Int32 $carry8 */
</del><span class="cx" style="display: block; padding: 0 10px"> $carry8 = $h[8]->addInt(1 << 25)->shiftRight(26);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[9] = $h[9]->addInt64($carry8);
</span><span class="cx" style="display: block; padding: 0 10px"> $h[8] = $h[8]->subInt64($carry8->shiftLeft(26));
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatsrcCryptophp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/src/Crypto.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/src/Crypto.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/Crypto.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -819,8 +819,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function keyExchange($my_sk, $their_pk, $client_pk, $server_pk)
</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 self::generichash(
- self::scalarmult($my_sk, $their_pk) .
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return ParagonIE_Sodium_Compat::crypto_generichash(
+ ParagonIE_Sodium_Compat::crypto_scalarmult($my_sk, $their_pk) .
</ins><span class="cx" style="display: block; padding: 0 10px"> $client_pk .
</span><span class="cx" style="display: block; padding: 0 10px"> $server_pk
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span></span></pre></div>
<a id="branches52srcwpincludessodium_compatsrcFilephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.2/src/wp-includes/sodium_compat/src/File.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.2/src/wp-includes/sodium_compat/src/File.php 2019-05-17 17:07:41 UTC (rev 45354)
+++ branches/5.2/src/wp-includes/sodium_compat/src/File.php 2019-05-17 17:19:21 UTC (rev 45355)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -590,7 +590,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $az[0] = self::intToChr(self::chrToInt($az[0]) & 248);
</span><span class="cx" style="display: block; padding: 0 10px"> $az[31] = self::intToChr((self::chrToInt($az[31]) & 63) | 64);
</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 $hs */
</del><span class="cx" style="display: block; padding: 0 10px"> $hs = hash_init('sha512');
</span><span class="cx" style="display: block; padding: 0 10px"> hash_update($hs, self::substr($az, 32, 32));
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var resource $hs */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -610,7 +609,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ParagonIE_Sodium_Core_Ed25519::ge_scalarmult_base($nonce)
</span><span class="cx" style="display: block; padding: 0 10px"> );
</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 $hs */
</del><span class="cx" style="display: block; padding: 0 10px"> $hs = hash_init('sha512');
</span><span class="cx" style="display: block; padding: 0 10px"> hash_update($hs, self::substr($sig, 0, 32));
</span><span class="cx" style="display: block; padding: 0 10px"> hash_update($hs, self::substr($pk, 0, 32));
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -719,7 +717,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A */
</span><span class="cx" style="display: block; padding: 0 10px"> $A = ParagonIE_Sodium_Core_Ed25519::ge_frombytes_negate_vartime($publicKey);
</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 $hs */
</del><span class="cx" style="display: block; padding: 0 10px"> $hs = hash_init('sha512');
</span><span class="cx" style="display: block; padding: 0 10px"> hash_update($hs, self::substr($sig, 0, 32));
</span><span class="cx" style="display: block; padding: 0 10px"> hash_update($hs, self::substr($publicKey, 0, 32));
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1079,7 +1076,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param resource|object $hash
</span><span class="cx" style="display: block; padding: 0 10px"> * @param resource $fp
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $size
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return mixed (resource on PHP < 7.2, object on PHP >= 7.2)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return resource|object Resource on PHP < 7.2, HashContext object on PHP >= 7.2
</ins><span class="cx" style="display: block; padding: 0 10px"> * @throws SodiumException
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws TypeError
</span><span class="cx" style="display: block; padding: 0 10px"> * @psalm-suppress PossiblyInvalidArgument
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1095,12 +1092,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (!is_resource($hash)) {
</span><span class="cx" style="display: block; padding: 0 10px"> throw new TypeError('Argument 1 must be a resource, ' . gettype($hash) . ' given.');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> if (!is_object($hash)) {
</span><span class="cx" style="display: block; padding: 0 10px"> throw new TypeError('Argument 1 must be an object (PHP 7.2+), ' . gettype($hash) . ' given.');
</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">+
</ins><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 TypeError('Argument 2 must be a resource, ' . gettype($fp) . ' given.');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1167,7 +1164,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $az[0] = self::intToChr(self::chrToInt($az[0]) & 248);
</span><span class="cx" style="display: block; padding: 0 10px"> $az[31] = self::intToChr((self::chrToInt($az[31]) & 63) | 64);
</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 $hs */
</del><span class="cx" style="display: block; padding: 0 10px"> $hs = hash_init('sha512');
</span><span class="cx" style="display: block; padding: 0 10px"> hash_update($hs, self::substr($az, 32, 32));
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var resource $hs */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1187,7 +1183,6 @@
</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="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** @var resource $hs */
</del><span class="cx" style="display: block; padding: 0 10px"> $hs = hash_init('sha512');
</span><span class="cx" style="display: block; padding: 0 10px"> hash_update($hs, self::substr($sig, 0, 32));
</span><span class="cx" style="display: block; padding: 0 10px"> hash_update($hs, self::substr($pk, 0, 32));
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1272,7 +1267,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var ParagonIE_Sodium_Core32_Curve25519_Ge_P3 $A */
</span><span class="cx" style="display: block; padding: 0 10px"> $A = ParagonIE_Sodium_Core32_Ed25519::ge_frombytes_negate_vartime($publicKey);
</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 $hs */
</del><span class="cx" style="display: block; padding: 0 10px"> $hs = hash_init('sha512');
</span><span class="cx" style="display: block; padding: 0 10px"> hash_update($hs, self::substr($sig, 0, 32));
</span><span class="cx" style="display: block; padding: 0 10px"> hash_update($hs, self::substr($publicKey, 0, 32));
</span></span></pre>
</div>
</div>
</body>
</html>