Skip to content

Commit

Permalink
On 32-bit architectures, just use what's given.
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Jan 30, 2017
1 parent aadeeea commit bcc1df6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Core/Util.php
Expand Up @@ -521,6 +521,9 @@ public static function xorStrings($a, $b)
*/
public static function mul($a, $b)
{
if (PHP_INT_SIZE === 4) {
return (int) ($a * $b);
}
return (int) (
($a | 0x80000000)
* ($b | 0x80000000)
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/UtilTest.php
Expand Up @@ -145,7 +145,9 @@ public function testMul()
$arguments = array(
array(1, 1),
array(65534, 65534),
array(65535, 65534)
array(65535, 65534),
array(0x7ffffffe, 1),
array(0x1fffffff, 0x1fffffff)
);
foreach ($arguments as $arg) {
$this->assertSame(
Expand Down

0 comments on commit bcc1df6

Please sign in to comment.