Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame^] | 1 | From 57c4b9f6a2f800b41ce2836986fe33640f6c3f8a Mon Sep 17 00:00:00 2001 |
| 2 | From: Andy Polyakov <appro@openssl.org> |
| 3 | Date: Sun, 6 Nov 2016 18:33:17 +0100 |
| 4 | Subject: [PATCH] bn/asm/x86_64-mont.pl: fix for CVE-2016-7055 (Low severity). |
| 5 | |
| 6 | Reviewed-by: Rich Salz <rsalz@openssl.org> |
| 7 | (cherry picked from commit 2fac86d9abeaa643677d1ffd0a139239fdf9406a) |
| 8 | |
| 9 | Upstream-Status: Backport [https://github.com/openssl/openssl/commit/57c4b9f6a2f800b41ce2836986fe33640f6c3f8a] |
| 10 | CVE: CVE-2016-7055 |
| 11 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> |
| 12 | --- |
| 13 | crypto/bn/asm/x86_64-mont.pl | 5 ++--- |
| 14 | 1 file changed, 2 insertions(+), 3 deletions(-) |
| 15 | |
| 16 | diff --git a/crypto/bn/asm/x86_64-mont.pl b/crypto/bn/asm/x86_64-mont.pl |
| 17 | index 044fd7e..80492d8 100755 |
| 18 | --- a/crypto/bn/asm/x86_64-mont.pl |
| 19 | +++ b/crypto/bn/asm/x86_64-mont.pl |
| 20 | @@ -1148,18 +1148,17 @@ $code.=<<___; |
| 21 | mulx 2*8($aptr),%r15,%r13 # ... |
| 22 | adox -3*8($tptr),%r11 |
| 23 | adcx %r15,%r12 |
| 24 | - adox $zero,%r12 |
| 25 | + adox -2*8($tptr),%r12 |
| 26 | adcx $zero,%r13 |
| 27 | + adox $zero,%r13 |
| 28 | |
| 29 | mov $bptr,8(%rsp) # off-load &b[i] |
| 30 | - .byte 0x67 |
| 31 | mov $mi,%r15 |
| 32 | imulq 24(%rsp),$mi # "t[0]"*n0 |
| 33 | xor %ebp,%ebp # xor $zero,$zero # cf=0, of=0 |
| 34 | |
| 35 | mulx 3*8($aptr),%rax,%r14 |
| 36 | mov $mi,%rdx |
| 37 | - adox -2*8($tptr),%r12 |
| 38 | adcx %rax,%r13 |
| 39 | adox -1*8($tptr),%r13 |
| 40 | adcx $zero,%r14 |
| 41 | -- |
| 42 | 2.7.4 |
| 43 | |