File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1742,7 +1742,20 @@ public poly1305 finish(byte [] mac, int macpos) {
17421742 }
17431743 g [9 ] -= (1 << 13 ); g [9 ] &= 0xffff ;
17441744
1745- mask = (g [9 ] >>> ((2 * 8 ) - 1 )) - 1 ; mask &= 0xffff ;
1745+ /*
1746+ backport from tweetnacl-fast.js https://github.com/dchest/tweetnacl-js/releases/tag/v0.14.3
1747+ <<<
1748+ "The issue was not properly detecting if st->h was >= 2^130 - 5,
1749+ coupled with [testing mistake] not catching the failure.
1750+ The chance of the bug affecting anything in the real world is essentially zero luckily,
1751+ but it's good to have it fixed."
1752+ >>>
1753+ */
1754+ ///change mask = (g[9] >>> ((2 * 8) - 1)) - 1; to as
1755+ mask = (c ^ 1 ) - 1 ;
1756+ mask &= 0xffff ;
1757+ ///////////////////////////////////////
1758+
17461759 for (i = 0 ; i < 10 ; i ++) g [i ] &= mask ;
17471760 mask = ~mask ;
17481761 for (i = 0 ; i < 10 ; i ++) this .h [i ] = (this .h [i ] & mask ) | g [i ];
You can’t perform that action at this time.
0 commit comments