nacl: apply fix for overflow

See https://github.com/dchest/tweetnacl-js/issues/187
This commit is contained in:
Florian Dold 2021-01-07 15:05:36 +01:00
parent e319e99ef9
commit a3313ce3f8
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -1548,7 +1548,7 @@ function modL(r: Uint8Array, x: Float64Array): void {
carry = 0; carry = 0;
for (j = i - 32, k = i - 12; j < k; ++j) { for (j = i - 32, k = i - 12; j < k; ++j) {
x[j] += carry - 16 * x[i] * L[j - (i - 32)]; x[j] += carry - 16 * x[i] * L[j - (i - 32)];
carry = (x[j] + 128) >> 8; carry = Math.floor((x[j] + 128) / 256);
x[j] -= carry * 256; x[j] -= carry * 256;
} }
x[j] += carry; x[j] += carry;