--- a/wp/wp-includes/sodium_compat/src/File.php Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/sodium_compat/src/File.php Wed Sep 21 18:19:35 2022 +0200
@@ -141,7 +141,9 @@
ParagonIE_Sodium_Compat::memzero($nonce);
ParagonIE_Sodium_Compat::memzero($ephKeypair);
} catch (SodiumException $ex) {
- unset($ephKeypair);
+ if (isset($ephKeypair)) {
+ unset($ephKeypair);
+ }
}
return $res;
}
@@ -241,6 +243,7 @@
ParagonIE_Sodium_Compat::memzero($nonce);
ParagonIE_Sodium_Compat::memzero($ephKeypair);
} catch (SodiumException $ex) {
+ /** @psalm-suppress PossiblyUndefinedVariable */
unset($ephKeypair);
}
return $res;
@@ -328,7 +331,9 @@
ParagonIE_Sodium_Compat::memzero($nonce);
ParagonIE_Sodium_Compat::memzero($ephKeypair);
} catch (SodiumException $ex) {
- unset($ephKeypair);
+ if (isset($ephKeypair)) {
+ unset($ephKeypair);
+ }
}
return $res;
}
@@ -537,6 +542,7 @@
try {
ParagonIE_Sodium_Compat::memzero($key);
} catch (SodiumException $ex) {
+ /** @psalm-suppress PossiblyUndefinedVariable */
unset($key);
}
return $res;
@@ -591,7 +597,7 @@
$az[31] = self::intToChr((self::chrToInt($az[31]) & 63) | 64);
$hs = hash_init('sha512');
- hash_update($hs, self::substr($az, 32, 32));
+ self::hash_update($hs, self::substr($az, 32, 32));
/** @var resource $hs */
$hs = self::updateHashWithFile($hs, $fp, $size);
@@ -610,8 +616,8 @@
);
$hs = hash_init('sha512');
- hash_update($hs, self::substr($sig, 0, 32));
- hash_update($hs, self::substr($pk, 0, 32));
+ self::hash_update($hs, self::substr($sig, 0, 32));
+ self::hash_update($hs, self::substr($pk, 0, 32));
/** @var resource $hs */
$hs = self::updateHashWithFile($hs, $fp, $size);
@@ -722,8 +728,8 @@
$A = ParagonIE_Sodium_Core_Ed25519::ge_frombytes_negate_vartime($publicKey);
$hs = hash_init('sha512');
- hash_update($hs, self::substr($sig, 0, 32));
- hash_update($hs, self::substr($publicKey, 0, 32));
+ self::hash_update($hs, self::substr($sig, 0, 32));
+ self::hash_update($hs, self::substr($publicKey, 0, 32));
/** @var resource $hs */
$hs = self::updateHashWithFile($hs, $fp, $size);
/** @var string $hDigest */
@@ -1077,7 +1083,7 @@
* Update a hash context with the contents of a file, without
* loading the entire file into memory.
*
- * @param resource|object $hash
+ * @param resource|HashContext $hash
* @param resource $fp
* @param int $size
* @return resource|object Resource on PHP < 7.2, HashContext object on PHP >= 7.2
@@ -1127,7 +1133,7 @@
}
/** @var string $message */
/** @psalm-suppress InvalidArgument */
- hash_update($hash, $message);
+ self::hash_update($hash, $message);
}
// Reset file pointer's position
fseek($fp, $originalPosition, SEEK_SET);
@@ -1169,7 +1175,7 @@
$az[31] = self::intToChr((self::chrToInt($az[31]) & 63) | 64);
$hs = hash_init('sha512');
- hash_update($hs, self::substr($az, 32, 32));
+ self::hash_update($hs, self::substr($az, 32, 32));
/** @var resource $hs */
$hs = self::updateHashWithFile($hs, $fp, $size);
@@ -1188,8 +1194,8 @@
);
$hs = hash_init('sha512');
- hash_update($hs, self::substr($sig, 0, 32));
- hash_update($hs, self::substr($pk, 0, 32));
+ self::hash_update($hs, self::substr($sig, 0, 32));
+ self::hash_update($hs, self::substr($pk, 0, 32));
/** @var resource $hs */
$hs = self::updateHashWithFile($hs, $fp, $size);
@@ -1272,8 +1278,8 @@
$A = ParagonIE_Sodium_Core32_Ed25519::ge_frombytes_negate_vartime($publicKey);
$hs = hash_init('sha512');
- hash_update($hs, self::substr($sig, 0, 32));
- hash_update($hs, self::substr($publicKey, 0, 32));
+ self::hash_update($hs, self::substr($sig, 0, 32));
+ self::hash_update($hs, self::substr($publicKey, 0, 32));
/** @var resource $hs */
$hs = self::updateHashWithFile($hs, $fp, $size);
/** @var string $hDigest */
@@ -1521,12 +1527,6 @@
/** @var int $pos */
$pos = self::ftell($ifp);
- /** @var int $iter */
- $iter = 1;
-
- /** @var int $incr */
- $incr = self::BUFFER_SIZE >> 6;
-
while ($mlen > 0) {
$blockSize = $mlen > self::BUFFER_SIZE
? self::BUFFER_SIZE
@@ -1537,7 +1537,6 @@
}
$state->update($ciphertext);
$mlen -= $blockSize;
- $iter += $incr;
}
$res = ParagonIE_Sodium_Core32_Util::verify_16($tag, $state->finish());