diff options
author | Andy Polyakov <appro@openssl.org> | 2015-05-20 09:36:48 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2015-05-24 21:30:39 +0200 |
commit | 69567687b0b7ed67831c17a010f4d46dfd059aef (patch) | |
tree | 7f05c579f23a4ee55c298e73e942b21495ad7a41 /crypto | |
parent | 86e5d1e32b2d702a5fc777e612cd746e790098ef (diff) |
bn/asm/x86_64-mont5.pl: fix valgrind error.
bn_get_bits5 was overstepping array boundary by 1 byte. It was exclusively
read overstep and data could not have been used. The only potential problem
would be if array happens to end on the very edge of last accesible page.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto')
-rwxr-xr-x | crypto/bn/asm/x86_64-mont5.pl | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/crypto/bn/asm/x86_64-mont5.pl b/crypto/bn/asm/x86_64-mont5.pl index 69e81bf4dd..aa96d43e89 100755 --- a/crypto/bn/asm/x86_64-mont5.pl +++ b/crypto/bn/asm/x86_64-mont5.pl @@ -3231,11 +3231,16 @@ $code.=<<___; .type bn_get_bits5,\@abi-omnipotent .align 16 bn_get_bits5: - mov $inp,%r10 + lea 0($inp),%r10 + lea 1($inp),%r11 mov $num,%ecx - shr \$3,$num - movzw (%r10,$num),%eax - and \$7,%ecx + shr \$4,$num + and \$15,%ecx + lea -8(%ecx),%eax + cmp \$11,%ecx + cmova %r11,%r10 + cmova %eax,%ecx + movzw (%r10,$num,2),%eax shrl %cl,%eax and \$31,%eax ret |