Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 56 additions & 4 deletions wolfcrypt/src/fe_x25519_asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -11952,6 +11952,19 @@ _sc_reduce_x64:
adcq %rdx, %r13
adcq %rsi, %r14
adcq $0x00, %r15
# Add order if negative
movq %r15, %rcx
sarq $63, %rcx
movq $0x5812631a5cf5d3ed, %rax
movq $0x14def9dea2f79cd6, %rdx
movq $0x1000000000000000, %rsi
andq %rcx, %rax
andq %rcx, %rdx
andq %rcx, %rsi
addq %rax, %r12
adcq %rdx, %r13
adcq $0x00, %r14
adcq %rsi, %r15
# Sub product of top 4 words and order
movq $0xa7ed9ce5a30a2c13, %rcx
movq %r12, %rax
Expand Down Expand Up @@ -12068,7 +12081,7 @@ _sc_reduce_x64:
andq %rsi, %rdx
andq %rsi, %rbx
addq %rax, %r8
movq $0xfffffffffffffff, %rax
movq $0x1fffffffffffffff, %rax
adcq %rdx, %r9
adcq $0x00, %r10
adcq %rbx, %r11
Expand Down Expand Up @@ -12240,6 +12253,19 @@ _sc_muladd_x64:
adcq %rdx, %r13
adcq %rcx, %r14
adcq $0x00, %r15
# Add order if negative
movq %r15, %rbx
sarq $63, %rbx
movq $0x5812631a5cf5d3ed, %rax
movq $0x14def9dea2f79cd6, %rdx
movq $0x1000000000000000, %rcx
andq %rbx, %rax
andq %rbx, %rdx
andq %rbx, %rcx
addq %rax, %r12
adcq %rdx, %r13
adcq $0x00, %r14
adcq %rcx, %r15
# Sub product of top 4 words and order
movq $0xa7ed9ce5a30a2c13, %rbx
movq %r12, %rax
Expand Down Expand Up @@ -12356,7 +12382,7 @@ _sc_muladd_x64:
andq %rcx, %rdx
andq %rcx, %rsi
addq %rax, %r8
movq $0xfffffffffffffff, %rax
movq $0x1fffffffffffffff, %rax
adcq %rdx, %r9
adcq $0x00, %r10
adcq %rsi, %r11
Expand Down Expand Up @@ -21401,6 +21427,19 @@ _sc_reduce_avx2:
adcq %rbx, %r13
adcq %rcx, %r14
adcq $0x00, %r15
# Add order if negative
movq %r15, %rax
sarq $63, %rax
movq $0x5812631a5cf5d3ed, %rsi
movq $0x14def9dea2f79cd6, %rbx
movq $0x1000000000000000, %rcx
andq %rax, %rsi
andq %rax, %rbx
andq %rax, %rcx
addq %rsi, %r12
adcq %rbx, %r13
adcq $0x00, %r14
adcq %rcx, %r15
# Sub product of top 4 words and order
movq $0xa7ed9ce5a30a2c13, %rdx
mulxq %r12, %rcx, %rax
Expand Down Expand Up @@ -21497,7 +21536,7 @@ _sc_reduce_avx2:
andq %rcx, %rbx
andq %rcx, %rbp
addq %rsi, %r8
movq $0xfffffffffffffff, %rsi
movq $0x1fffffffffffffff, %rsi
adcq %rbx, %r9
adcq $0x00, %r10
adcq %rbp, %r11
Expand Down Expand Up @@ -21647,6 +21686,19 @@ _sc_muladd_avx2:
adcq %r8, %r15
adcq %rcx, %rbx
adcq $0x00, %rbp
# Add order if negative
movq %rbp, %rax
sarq $63, %rax
movq $0x5812631a5cf5d3ed, %rsi
movq $0x14def9dea2f79cd6, %r8
movq $0x1000000000000000, %rcx
andq %rax, %rsi
andq %rax, %r8
andq %rax, %rcx
addq %rsi, %r14
adcq %r8, %r15
adcq $0x00, %rbx
adcq %rcx, %rbp
# Sub product of top 4 words and order
movq $0xa7ed9ce5a30a2c13, %rdx
mulxq %r14, %rcx, %rax
Expand Down Expand Up @@ -21743,7 +21795,7 @@ _sc_muladd_avx2:
andq %rcx, %r8
andq %rcx, %r9
addq %rsi, %r10
movq $0xfffffffffffffff, %rsi
movq $0x1fffffffffffffff, %rsi
adcq %r8, %r11
adcq $0x00, %r12
adcq %r9, %r13
Expand Down
60 changes: 56 additions & 4 deletions wolfcrypt/src/fe_x25519_asm.asm
Original file line number Diff line number Diff line change
Expand Up @@ -10644,6 +10644,19 @@ sc_reduce_x64 PROC
adc r14, rdx
adc r15, rsi
adc rdi, 0
; Add order if negative
mov r8, rdi
sar r8, 63
mov rax, 6346243789798364141
mov rdx, 1503914060200516822
mov rsi, 1152921504606846976
and rax, r8
and rdx, r8
and rsi, r8
add r13, rax
adc r14, rdx
adc r15, 0
adc rdi, rsi
; Sub product of top 4 words and order
mov r8, 12100500283911187475
mov rax, r13
Expand Down Expand Up @@ -10760,7 +10773,7 @@ sc_reduce_x64 PROC
and rdx, rsi
and rbx, rsi
add r9, rax
mov rax, 1152921504606846975
mov rax, 2305843009213693951
adc r10, rdx
adc r11, 0
adc r12, rbx
Expand Down Expand Up @@ -10924,6 +10937,19 @@ sc_muladd_x64 PROC
adc r15, rdx
adc rdi, r9
adc rsi, 0
; Add order if negative
mov rbx, rsi
sar rbx, 63
mov rax, 6346243789798364141
mov rdx, 1503914060200516822
mov r9, 1152921504606846976
and rax, rbx
and rdx, rbx
and r9, rbx
add r14, rax
adc r15, rdx
adc rdi, 0
adc rsi, r9
; Sub product of top 4 words and order
mov rbx, 12100500283911187475
mov rax, r14
Expand Down Expand Up @@ -11040,7 +11066,7 @@ sc_muladd_x64 PROC
and rdx, r9
and r8, r9
add r10, rax
mov rax, 1152921504606846975
mov rax, 2305843009213693951
adc r11, rdx
adc r12, 0
adc r13, r8
Expand Down Expand Up @@ -19677,6 +19703,19 @@ sc_reduce_avx2 PROC
adc r14, rbx
adc r15, rcx
adc rdi, 0
; Add order if negative
mov rax, rdi
sar rax, 63
mov rsi, 6346243789798364141
mov rbx, 1503914060200516822
mov rcx, 1152921504606846976
and rsi, rax
and rbx, rax
and rcx, rax
add r13, rsi
adc r14, rbx
adc r15, 0
adc rdi, rcx
; Sub product of top 4 words and order
mov rdx, 12100500283911187475
mulx rax, rcx, r13
Expand Down Expand Up @@ -19773,7 +19812,7 @@ sc_reduce_avx2 PROC
and rbx, rcx
and rbp, rcx
add r9, rsi
mov rsi, 1152921504606846975
mov rsi, 2305843009213693951
adc r10, rbx
adc r11, 0
adc r12, rbp
Expand Down Expand Up @@ -19916,6 +19955,19 @@ sc_muladd_avx2 PROC
adc rsi, r10
adc rbx, rcx
adc rbp, 0
; Add order if negative
mov rax, rbp
sar rax, 63
mov r9, 6346243789798364141
mov r10, 1503914060200516822
mov rcx, 1152921504606846976
and r9, rax
and r10, rax
and rcx, rax
add rdi, r9
adc rsi, r10
adc rbx, 0
adc rbp, rcx
; Sub product of top 4 words and order
mov rdx, 12100500283911187475
mulx rax, rcx, rdi
Expand Down Expand Up @@ -20012,7 +20064,7 @@ sc_muladd_avx2 PROC
and r10, rcx
and r11, rcx
add r12, r9
mov r9, 1152921504606846975
mov r9, 2305843009213693951
adc r13, r10
adc r14, 0
adc r15, r11
Expand Down
Loading
Loading