Changeset 52988 for trunk/src/wp-includes/sodium_compat/src/File.php
- Timestamp:
- 03/24/2022 03:18:31 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/sodium_compat/src/File.php
r51002 r52988 1155 1155 private static function sign_core32($filePath, $secretKey) 1156 1156 { 1157 /** @var int|bool $size */1158 1157 $size = filesize($filePath); 1159 1158 if (!is_int($size)) { 1160 1159 throw new SodiumException('Could not obtain the file size'); 1161 1160 } 1162 /** @var int $size */ 1163 1164 /** @var resource|bool $fp */ 1161 1165 1162 $fp = fopen($filePath, 'rb'); 1166 1163 if (!is_resource($fp)) { 1167 1164 throw new SodiumException('Could not open input file for reading'); 1168 1165 } 1169 /** @var resource $fp */1170 1166 1171 1167 /** @var string $az */ … … 1180 1176 $hs = self::updateHashWithFile($hs, $fp, $size); 1181 1177 1182 /** @var string $nonceHash */1183 1178 $nonceHash = hash_final($hs, true); 1184 1185 /** @var string $pk */1186 1179 $pk = self::substr($secretKey, 32, 32); 1187 1188 /** @var string $nonce */1189 1180 $nonce = ParagonIE_Sodium_Core32_Ed25519::sc_reduce($nonceHash) . self::substr($nonceHash, 32); 1190 1191 /** @var string $sig */1192 1181 $sig = ParagonIE_Sodium_Core32_Ed25519::ge_p3_tobytes( 1193 1182 ParagonIE_Sodium_Core32_Ed25519::ge_scalarmult_base($nonce) … … 1200 1189 $hs = self::updateHashWithFile($hs, $fp, $size); 1201 1190 1202 /** @var string $hramHash */1203 1191 $hramHash = hash_final($hs, true); 1204 1192 1205 /** @var string $hram */1206 1193 $hram = ParagonIE_Sodium_Core32_Ed25519::sc_reduce($hramHash); 1207 1194 1208 /** @var string $sigAfter */1209 1195 $sigAfter = ParagonIE_Sodium_Core32_Ed25519::sc_muladd($hram, $az, $nonce); 1210 1196 … … 1244 1230 throw new SodiumException('Signature is on too small of an order'); 1245 1231 } 1232 1246 1233 if ((self::chrToInt($sig[63]) & 224) !== 0) { 1247 1234 throw new SodiumException('Invalid signature');
Note: See TracChangeset
for help on using the changeset viewer.