forked from wolfSSL/wolfssl
SP C: change number of words for RSA/DH
Faster small code and fast code. Allow fixed 4096-bit FFDHE parameters in benchmark. Convert [u]int[32|64|128]*_t types to sp_[u]int[32|64|128]. Add a div for when top bits are all 1 WOLFSSL_SP_FAST_LARGE_CODE added to make mul_add function faster on non-embedded platforms. Change mod_exp window sizes for same performance but less memory. P256 with c32 now 9 words instead of 10.
This commit is contained in:
23
configure.ac
23
configure.ac
@ -5238,6 +5238,21 @@ do
|
||||
fi
|
||||
;;
|
||||
|
||||
smallfast)
|
||||
ENABLED_SP_SMALL=yes
|
||||
ENABLED_SP_RSA=yes
|
||||
ENABLED_SP_DH=yes
|
||||
ENABLED_SP_FF_2048=yes
|
||||
ENABLED_SP_FF_3072=yes
|
||||
ENABLED_SP_ECC=yes
|
||||
ENABLED_SP_EC_256=yes
|
||||
if test "$host_cpu" = "x86_64"; then
|
||||
ENABLED_SP_FF_4096=yes
|
||||
ENABLED_SP_EC_384=yes
|
||||
fi
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_FAST_MODEXP"
|
||||
;;
|
||||
|
||||
yes)
|
||||
ENABLED_SP_RSA=yes
|
||||
ENABLED_SP_DH=yes
|
||||
@ -5390,6 +5405,14 @@ if test "$ENABLED_SP_RSA" = "yes" || test "$ENABLED_SP_DH" = "yes"; then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_4096"
|
||||
AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_4096"
|
||||
fi
|
||||
|
||||
case $host_cpu in
|
||||
*x86_64* | *aarch64*)
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_LARGE_CODE"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test "$ENABLED_ECC" != "no" && test "$ENABLED_SP_ECC" = "yes"; then
|
||||
ENABLED_SP=yes
|
||||
|
@ -5056,7 +5056,11 @@ exit_bench_rsa_key:
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FFDHE_4096
|
||||
#define BENCH_DH_KEY_SIZE 512 /* for 4096 bit */
|
||||
#else
|
||||
#define BENCH_DH_KEY_SIZE 384 /* for 3072 bit */
|
||||
#endif
|
||||
#define BENCH_DH_PRIV_SIZE (BENCH_DH_KEY_SIZE/8)
|
||||
|
||||
void bench_dh(int doAsync)
|
||||
@ -5127,6 +5131,12 @@ void bench_dh(int doAsync)
|
||||
dhKeySz = 3072;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_FFDHE_4096
|
||||
else if (use_ffdhe == 4096) {
|
||||
params = wc_Dh_ffdhe4096_Get();
|
||||
dhKeySz = 4096;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* clear for done cleanup */
|
||||
XMEMSET(dhKey, 0, sizeof(dhKey));
|
||||
@ -7005,6 +7015,10 @@ int main(int argc, char** argv)
|
||||
else if (string_matches(argv[1], "-ffdhe3072"))
|
||||
use_ffdhe = 3072;
|
||||
#endif
|
||||
#if !defined(NO_DH) && defined(HAVE_FFDHE_4096)
|
||||
else if (string_matches(argv[1], "-ffdhe4096"))
|
||||
use_ffdhe = 4096;
|
||||
#endif
|
||||
#if defined(HAVE_ECC) && !defined(NO_ECC256)
|
||||
else if (string_matches(argv[1], "-p256"))
|
||||
bench_asym_algs |= BENCH_ECC_P256;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
32147
wolfcrypt/src/sp_c32.c
32147
wolfcrypt/src/sp_c32.c
File diff suppressed because it is too large
Load Diff
15851
wolfcrypt/src/sp_c64.c
15851
wolfcrypt/src/sp_c64.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -219,15 +219,15 @@ L_2048_from_bin_movbe_zero_end:
|
||||
*/
|
||||
#ifndef __APPLE__
|
||||
.text
|
||||
.globl sp_2048_to_bin_bswap
|
||||
.type sp_2048_to_bin_bswap,@function
|
||||
.globl sp_2048_to_bin_bswap_32
|
||||
.type sp_2048_to_bin_bswap_32,@function
|
||||
.align 16
|
||||
sp_2048_to_bin_bswap:
|
||||
sp_2048_to_bin_bswap_32:
|
||||
#else
|
||||
.section __TEXT,__text
|
||||
.globl _sp_2048_to_bin_bswap
|
||||
.globl _sp_2048_to_bin_bswap_32
|
||||
.p2align 4
|
||||
_sp_2048_to_bin_bswap:
|
||||
_sp_2048_to_bin_bswap_32:
|
||||
#endif /* __APPLE__ */
|
||||
movq 248(%rdi), %rdx
|
||||
movq 240(%rdi), %rax
|
||||
@ -327,7 +327,7 @@ _sp_2048_to_bin_bswap:
|
||||
movq %rax, 248(%rsi)
|
||||
repz retq
|
||||
#ifndef __APPLE__
|
||||
.size sp_2048_to_bin_bswap,.-sp_2048_to_bin_bswap
|
||||
.size sp_2048_to_bin_bswap_32,.-sp_2048_to_bin_bswap_32
|
||||
#endif /* __APPLE__ */
|
||||
#ifndef NO_MOVBE_SUPPORT
|
||||
/* Write r as big endian to byte array.
|
||||
@ -339,15 +339,15 @@ _sp_2048_to_bin_bswap:
|
||||
*/
|
||||
#ifndef __APPLE__
|
||||
.text
|
||||
.globl sp_2048_to_bin_movbe
|
||||
.type sp_2048_to_bin_movbe,@function
|
||||
.globl sp_2048_to_bin_movbe_32
|
||||
.type sp_2048_to_bin_movbe_32,@function
|
||||
.align 16
|
||||
sp_2048_to_bin_movbe:
|
||||
sp_2048_to_bin_movbe_32:
|
||||
#else
|
||||
.section __TEXT,__text
|
||||
.globl _sp_2048_to_bin_movbe
|
||||
.globl _sp_2048_to_bin_movbe_32
|
||||
.p2align 4
|
||||
_sp_2048_to_bin_movbe:
|
||||
_sp_2048_to_bin_movbe_32:
|
||||
#endif /* __APPLE__ */
|
||||
movbeq 248(%rdi), %rdx
|
||||
movbeq 240(%rdi), %rax
|
||||
@ -415,7 +415,7 @@ _sp_2048_to_bin_movbe:
|
||||
movq %rax, 248(%rsi)
|
||||
repz retq
|
||||
#ifndef __APPLE__
|
||||
.size sp_2048_to_bin_movbe,.-sp_2048_to_bin_movbe
|
||||
.size sp_2048_to_bin_movbe_32,.-sp_2048_to_bin_movbe_32
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* NO_MOVBE_SUPPORT */
|
||||
/* Multiply a and b into r. (r = a * b)
|
||||
@ -12889,15 +12889,15 @@ L_3072_from_bin_movbe_zero_end:
|
||||
*/
|
||||
#ifndef __APPLE__
|
||||
.text
|
||||
.globl sp_3072_to_bin_bswap
|
||||
.type sp_3072_to_bin_bswap,@function
|
||||
.globl sp_3072_to_bin_bswap_48
|
||||
.type sp_3072_to_bin_bswap_48,@function
|
||||
.align 16
|
||||
sp_3072_to_bin_bswap:
|
||||
sp_3072_to_bin_bswap_48:
|
||||
#else
|
||||
.section __TEXT,__text
|
||||
.globl _sp_3072_to_bin_bswap
|
||||
.globl _sp_3072_to_bin_bswap_48
|
||||
.p2align 4
|
||||
_sp_3072_to_bin_bswap:
|
||||
_sp_3072_to_bin_bswap_48:
|
||||
#endif /* __APPLE__ */
|
||||
movq 376(%rdi), %rdx
|
||||
movq 368(%rdi), %rax
|
||||
@ -13045,7 +13045,7 @@ _sp_3072_to_bin_bswap:
|
||||
movq %rax, 376(%rsi)
|
||||
repz retq
|
||||
#ifndef __APPLE__
|
||||
.size sp_3072_to_bin_bswap,.-sp_3072_to_bin_bswap
|
||||
.size sp_3072_to_bin_bswap_48,.-sp_3072_to_bin_bswap_48
|
||||
#endif /* __APPLE__ */
|
||||
#ifndef NO_MOVBE_SUPPORT
|
||||
/* Write r as big endian to byte array.
|
||||
@ -13057,15 +13057,15 @@ _sp_3072_to_bin_bswap:
|
||||
*/
|
||||
#ifndef __APPLE__
|
||||
.text
|
||||
.globl sp_3072_to_bin_movbe
|
||||
.type sp_3072_to_bin_movbe,@function
|
||||
.globl sp_3072_to_bin_movbe_48
|
||||
.type sp_3072_to_bin_movbe_48,@function
|
||||
.align 16
|
||||
sp_3072_to_bin_movbe:
|
||||
sp_3072_to_bin_movbe_48:
|
||||
#else
|
||||
.section __TEXT,__text
|
||||
.globl _sp_3072_to_bin_movbe
|
||||
.globl _sp_3072_to_bin_movbe_48
|
||||
.p2align 4
|
||||
_sp_3072_to_bin_movbe:
|
||||
_sp_3072_to_bin_movbe_48:
|
||||
#endif /* __APPLE__ */
|
||||
movbeq 376(%rdi), %rdx
|
||||
movbeq 368(%rdi), %rax
|
||||
@ -13165,7 +13165,7 @@ _sp_3072_to_bin_movbe:
|
||||
movq %rax, 376(%rsi)
|
||||
repz retq
|
||||
#ifndef __APPLE__
|
||||
.size sp_3072_to_bin_movbe,.-sp_3072_to_bin_movbe
|
||||
.size sp_3072_to_bin_movbe_48,.-sp_3072_to_bin_movbe_48
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* NO_MOVBE_SUPPORT */
|
||||
/* Multiply a and b into r. (r = a * b)
|
||||
@ -28258,15 +28258,15 @@ L_4096_from_bin_movbe_zero_end:
|
||||
*/
|
||||
#ifndef __APPLE__
|
||||
.text
|
||||
.globl sp_4096_to_bin_bswap
|
||||
.type sp_4096_to_bin_bswap,@function
|
||||
.globl sp_4096_to_bin_bswap_64
|
||||
.type sp_4096_to_bin_bswap_64,@function
|
||||
.align 16
|
||||
sp_4096_to_bin_bswap:
|
||||
sp_4096_to_bin_bswap_64:
|
||||
#else
|
||||
.section __TEXT,__text
|
||||
.globl _sp_4096_to_bin_bswap
|
||||
.globl _sp_4096_to_bin_bswap_64
|
||||
.p2align 4
|
||||
_sp_4096_to_bin_bswap:
|
||||
_sp_4096_to_bin_bswap_64:
|
||||
#endif /* __APPLE__ */
|
||||
movq 504(%rdi), %rdx
|
||||
movq 496(%rdi), %rax
|
||||
@ -28462,7 +28462,7 @@ _sp_4096_to_bin_bswap:
|
||||
movq %rax, 504(%rsi)
|
||||
repz retq
|
||||
#ifndef __APPLE__
|
||||
.size sp_4096_to_bin_bswap,.-sp_4096_to_bin_bswap
|
||||
.size sp_4096_to_bin_bswap_64,.-sp_4096_to_bin_bswap_64
|
||||
#endif /* __APPLE__ */
|
||||
#ifndef NO_MOVBE_SUPPORT
|
||||
/* Write r as big endian to byte array.
|
||||
@ -28474,15 +28474,15 @@ _sp_4096_to_bin_bswap:
|
||||
*/
|
||||
#ifndef __APPLE__
|
||||
.text
|
||||
.globl sp_4096_to_bin_movbe
|
||||
.type sp_4096_to_bin_movbe,@function
|
||||
.globl sp_4096_to_bin_movbe_64
|
||||
.type sp_4096_to_bin_movbe_64,@function
|
||||
.align 16
|
||||
sp_4096_to_bin_movbe:
|
||||
sp_4096_to_bin_movbe_64:
|
||||
#else
|
||||
.section __TEXT,__text
|
||||
.globl _sp_4096_to_bin_movbe
|
||||
.globl _sp_4096_to_bin_movbe_64
|
||||
.p2align 4
|
||||
_sp_4096_to_bin_movbe:
|
||||
_sp_4096_to_bin_movbe_64:
|
||||
#endif /* __APPLE__ */
|
||||
movbeq 504(%rdi), %rdx
|
||||
movbeq 496(%rdi), %rax
|
||||
@ -28614,7 +28614,7 @@ _sp_4096_to_bin_movbe:
|
||||
movq %rax, 504(%rsi)
|
||||
repz retq
|
||||
#ifndef __APPLE__
|
||||
.size sp_4096_to_bin_movbe,.-sp_4096_to_bin_movbe
|
||||
.size sp_4096_to_bin_movbe_64,.-sp_4096_to_bin_movbe_64
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* NO_MOVBE_SUPPORT */
|
||||
/* Sub b from a into a. (a -= b)
|
||||
@ -41080,15 +41080,15 @@ L_256_from_bin_movbe_zero_end:
|
||||
*/
|
||||
#ifndef __APPLE__
|
||||
.text
|
||||
.globl sp_256_to_bin_bswap
|
||||
.type sp_256_to_bin_bswap,@function
|
||||
.globl sp_256_to_bin_bswap_4
|
||||
.type sp_256_to_bin_bswap_4,@function
|
||||
.align 16
|
||||
sp_256_to_bin_bswap:
|
||||
sp_256_to_bin_bswap_4:
|
||||
#else
|
||||
.section __TEXT,__text
|
||||
.globl _sp_256_to_bin_bswap
|
||||
.globl _sp_256_to_bin_bswap_4
|
||||
.p2align 4
|
||||
_sp_256_to_bin_bswap:
|
||||
_sp_256_to_bin_bswap_4:
|
||||
#endif /* __APPLE__ */
|
||||
movq 24(%rdi), %rdx
|
||||
movq 16(%rdi), %rax
|
||||
@ -41104,7 +41104,7 @@ _sp_256_to_bin_bswap:
|
||||
movq %rax, 24(%rsi)
|
||||
repz retq
|
||||
#ifndef __APPLE__
|
||||
.size sp_256_to_bin_bswap,.-sp_256_to_bin_bswap
|
||||
.size sp_256_to_bin_bswap_4,.-sp_256_to_bin_bswap_4
|
||||
#endif /* __APPLE__ */
|
||||
#ifndef NO_MOVBE_SUPPORT
|
||||
/* Write r as big endian to byte array.
|
||||
@ -41116,15 +41116,15 @@ _sp_256_to_bin_bswap:
|
||||
*/
|
||||
#ifndef __APPLE__
|
||||
.text
|
||||
.globl sp_256_to_bin_movbe
|
||||
.type sp_256_to_bin_movbe,@function
|
||||
.globl sp_256_to_bin_movbe_4
|
||||
.type sp_256_to_bin_movbe_4,@function
|
||||
.align 16
|
||||
sp_256_to_bin_movbe:
|
||||
sp_256_to_bin_movbe_4:
|
||||
#else
|
||||
.section __TEXT,__text
|
||||
.globl _sp_256_to_bin_movbe
|
||||
.globl _sp_256_to_bin_movbe_4
|
||||
.p2align 4
|
||||
_sp_256_to_bin_movbe:
|
||||
_sp_256_to_bin_movbe_4:
|
||||
#endif /* __APPLE__ */
|
||||
movbeq 24(%rdi), %rdx
|
||||
movbeq 16(%rdi), %rax
|
||||
@ -41136,7 +41136,7 @@ _sp_256_to_bin_movbe:
|
||||
movq %rax, 24(%rsi)
|
||||
repz retq
|
||||
#ifndef __APPLE__
|
||||
.size sp_256_to_bin_movbe,.-sp_256_to_bin_movbe
|
||||
.size sp_256_to_bin_movbe_4,.-sp_256_to_bin_movbe_4
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* NO_MOVBE_SUPPORT */
|
||||
#ifdef HAVE_INTEL_AVX2
|
||||
@ -45179,15 +45179,15 @@ L_384_from_bin_movbe_zero_end:
|
||||
*/
|
||||
#ifndef __APPLE__
|
||||
.text
|
||||
.globl sp_384_to_bin_bswap
|
||||
.type sp_384_to_bin_bswap,@function
|
||||
.globl sp_384_to_bin_bswap_6
|
||||
.type sp_384_to_bin_bswap_6,@function
|
||||
.align 16
|
||||
sp_384_to_bin_bswap:
|
||||
sp_384_to_bin_bswap_6:
|
||||
#else
|
||||
.section __TEXT,__text
|
||||
.globl _sp_384_to_bin_bswap
|
||||
.globl _sp_384_to_bin_bswap_6
|
||||
.p2align 4
|
||||
_sp_384_to_bin_bswap:
|
||||
_sp_384_to_bin_bswap_6:
|
||||
#endif /* __APPLE__ */
|
||||
movq 40(%rdi), %rdx
|
||||
movq 32(%rdi), %rax
|
||||
@ -45209,7 +45209,7 @@ _sp_384_to_bin_bswap:
|
||||
movq %rax, 40(%rsi)
|
||||
repz retq
|
||||
#ifndef __APPLE__
|
||||
.size sp_384_to_bin_bswap,.-sp_384_to_bin_bswap
|
||||
.size sp_384_to_bin_bswap_6,.-sp_384_to_bin_bswap_6
|
||||
#endif /* __APPLE__ */
|
||||
#ifndef NO_MOVBE_SUPPORT
|
||||
/* Write r as big endian to byte array.
|
||||
@ -45221,15 +45221,15 @@ _sp_384_to_bin_bswap:
|
||||
*/
|
||||
#ifndef __APPLE__
|
||||
.text
|
||||
.globl sp_384_to_bin_movbe
|
||||
.type sp_384_to_bin_movbe,@function
|
||||
.globl sp_384_to_bin_movbe_6
|
||||
.type sp_384_to_bin_movbe_6,@function
|
||||
.align 16
|
||||
sp_384_to_bin_movbe:
|
||||
sp_384_to_bin_movbe_6:
|
||||
#else
|
||||
.section __TEXT,__text
|
||||
.globl _sp_384_to_bin_movbe
|
||||
.globl _sp_384_to_bin_movbe_6
|
||||
.p2align 4
|
||||
_sp_384_to_bin_movbe:
|
||||
_sp_384_to_bin_movbe_6:
|
||||
#endif /* __APPLE__ */
|
||||
movbeq 40(%rdi), %rdx
|
||||
movbeq 32(%rdi), %rax
|
||||
@ -45245,7 +45245,7 @@ _sp_384_to_bin_movbe:
|
||||
movq %rax, 40(%rsi)
|
||||
repz retq
|
||||
#ifndef __APPLE__
|
||||
.size sp_384_to_bin_movbe,.-sp_384_to_bin_movbe
|
||||
.size sp_384_to_bin_movbe_6,.-sp_384_to_bin_movbe_6
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* NO_MOVBE_SUPPORT */
|
||||
/* Sub b from a into a. (a -= b)
|
||||
|
@ -217,7 +217,7 @@ ENDIF
|
||||
; * a Byte array.
|
||||
; */
|
||||
_text SEGMENT READONLY PARA
|
||||
sp_2048_to_bin_bswap PROC
|
||||
sp_2048_to_bin_bswap_32 PROC
|
||||
mov rax, QWORD PTR [rcx+248]
|
||||
mov r8, QWORD PTR [rcx+240]
|
||||
bswap rax
|
||||
@ -315,7 +315,7 @@ sp_2048_to_bin_bswap PROC
|
||||
mov QWORD PTR [rdx+240], rax
|
||||
mov QWORD PTR [rdx+248], r8
|
||||
ret
|
||||
sp_2048_to_bin_bswap ENDP
|
||||
sp_2048_to_bin_bswap_32 ENDP
|
||||
_text ENDS
|
||||
IFNDEF NO_MOVBE_SUPPORT
|
||||
; /* Write r as big endian to byte array.
|
||||
@ -326,7 +326,7 @@ IFNDEF NO_MOVBE_SUPPORT
|
||||
; * a Byte array.
|
||||
; */
|
||||
_text SEGMENT READONLY PARA
|
||||
sp_2048_to_bin_movbe PROC
|
||||
sp_2048_to_bin_movbe_32 PROC
|
||||
movbe rax, QWORD PTR [rcx+248]
|
||||
movbe r8, QWORD PTR [rcx+240]
|
||||
mov QWORD PTR [rdx], rax
|
||||
@ -392,7 +392,7 @@ sp_2048_to_bin_movbe PROC
|
||||
mov QWORD PTR [rdx+240], rax
|
||||
mov QWORD PTR [rdx+248], r8
|
||||
ret
|
||||
sp_2048_to_bin_movbe ENDP
|
||||
sp_2048_to_bin_movbe_32 ENDP
|
||||
_text ENDS
|
||||
ENDIF
|
||||
; /* Multiply a and b into r. (r = a * b)
|
||||
@ -12502,7 +12502,7 @@ ENDIF
|
||||
; * a Byte array.
|
||||
; */
|
||||
_text SEGMENT READONLY PARA
|
||||
sp_3072_to_bin_bswap PROC
|
||||
sp_3072_to_bin_bswap_48 PROC
|
||||
mov rax, QWORD PTR [rcx+376]
|
||||
mov r8, QWORD PTR [rcx+368]
|
||||
bswap rax
|
||||
@ -12648,7 +12648,7 @@ sp_3072_to_bin_bswap PROC
|
||||
mov QWORD PTR [rdx+368], rax
|
||||
mov QWORD PTR [rdx+376], r8
|
||||
ret
|
||||
sp_3072_to_bin_bswap ENDP
|
||||
sp_3072_to_bin_bswap_48 ENDP
|
||||
_text ENDS
|
||||
IFNDEF NO_MOVBE_SUPPORT
|
||||
; /* Write r as big endian to byte array.
|
||||
@ -12659,7 +12659,7 @@ IFNDEF NO_MOVBE_SUPPORT
|
||||
; * a Byte array.
|
||||
; */
|
||||
_text SEGMENT READONLY PARA
|
||||
sp_3072_to_bin_movbe PROC
|
||||
sp_3072_to_bin_movbe_48 PROC
|
||||
movbe rax, QWORD PTR [rcx+376]
|
||||
movbe r8, QWORD PTR [rcx+368]
|
||||
mov QWORD PTR [rdx], rax
|
||||
@ -12757,7 +12757,7 @@ sp_3072_to_bin_movbe PROC
|
||||
mov QWORD PTR [rdx+368], rax
|
||||
mov QWORD PTR [rdx+376], r8
|
||||
ret
|
||||
sp_3072_to_bin_movbe ENDP
|
||||
sp_3072_to_bin_movbe_48 ENDP
|
||||
_text ENDS
|
||||
ENDIF
|
||||
; /* Multiply a and b into r. (r = a * b)
|
||||
@ -27384,7 +27384,7 @@ ENDIF
|
||||
; * a Byte array.
|
||||
; */
|
||||
_text SEGMENT READONLY PARA
|
||||
sp_4096_to_bin_bswap PROC
|
||||
sp_4096_to_bin_bswap_64 PROC
|
||||
mov rax, QWORD PTR [rcx+504]
|
||||
mov r8, QWORD PTR [rcx+496]
|
||||
bswap rax
|
||||
@ -27578,7 +27578,7 @@ sp_4096_to_bin_bswap PROC
|
||||
mov QWORD PTR [rdx+496], rax
|
||||
mov QWORD PTR [rdx+504], r8
|
||||
ret
|
||||
sp_4096_to_bin_bswap ENDP
|
||||
sp_4096_to_bin_bswap_64 ENDP
|
||||
_text ENDS
|
||||
IFNDEF NO_MOVBE_SUPPORT
|
||||
; /* Write r as big endian to byte array.
|
||||
@ -27589,7 +27589,7 @@ IFNDEF NO_MOVBE_SUPPORT
|
||||
; * a Byte array.
|
||||
; */
|
||||
_text SEGMENT READONLY PARA
|
||||
sp_4096_to_bin_movbe PROC
|
||||
sp_4096_to_bin_movbe_64 PROC
|
||||
movbe rax, QWORD PTR [rcx+504]
|
||||
movbe r8, QWORD PTR [rcx+496]
|
||||
mov QWORD PTR [rdx], rax
|
||||
@ -27719,7 +27719,7 @@ sp_4096_to_bin_movbe PROC
|
||||
mov QWORD PTR [rdx+496], rax
|
||||
mov QWORD PTR [rdx+504], r8
|
||||
ret
|
||||
sp_4096_to_bin_movbe ENDP
|
||||
sp_4096_to_bin_movbe_64 ENDP
|
||||
_text ENDS
|
||||
ENDIF
|
||||
; /* Sub b from a into a. (a -= b)
|
||||
@ -39716,7 +39716,7 @@ ENDIF
|
||||
; * a Byte array.
|
||||
; */
|
||||
_text SEGMENT READONLY PARA
|
||||
sp_256_to_bin_bswap PROC
|
||||
sp_256_to_bin_bswap_4 PROC
|
||||
mov rax, QWORD PTR [rcx+24]
|
||||
mov r8, QWORD PTR [rcx+16]
|
||||
bswap rax
|
||||
@ -39730,7 +39730,7 @@ sp_256_to_bin_bswap PROC
|
||||
mov QWORD PTR [rdx+16], rax
|
||||
mov QWORD PTR [rdx+24], r8
|
||||
ret
|
||||
sp_256_to_bin_bswap ENDP
|
||||
sp_256_to_bin_bswap_4 ENDP
|
||||
_text ENDS
|
||||
IFNDEF NO_MOVBE_SUPPORT
|
||||
; /* Write r as big endian to byte array.
|
||||
@ -39741,7 +39741,7 @@ IFNDEF NO_MOVBE_SUPPORT
|
||||
; * a Byte array.
|
||||
; */
|
||||
_text SEGMENT READONLY PARA
|
||||
sp_256_to_bin_movbe PROC
|
||||
sp_256_to_bin_movbe_4 PROC
|
||||
movbe rax, QWORD PTR [rcx+24]
|
||||
movbe r8, QWORD PTR [rcx+16]
|
||||
mov QWORD PTR [rdx], rax
|
||||
@ -39751,7 +39751,7 @@ sp_256_to_bin_movbe PROC
|
||||
mov QWORD PTR [rdx+16], rax
|
||||
mov QWORD PTR [rdx+24], r8
|
||||
ret
|
||||
sp_256_to_bin_movbe ENDP
|
||||
sp_256_to_bin_movbe_4 ENDP
|
||||
_text ENDS
|
||||
ENDIF
|
||||
IFDEF HAVE_INTEL_AVX2
|
||||
@ -43467,7 +43467,7 @@ ENDIF
|
||||
; * a Byte array.
|
||||
; */
|
||||
_text SEGMENT READONLY PARA
|
||||
sp_384_to_bin_bswap PROC
|
||||
sp_384_to_bin_bswap_6 PROC
|
||||
mov rax, QWORD PTR [rcx+40]
|
||||
mov r8, QWORD PTR [rcx+32]
|
||||
bswap rax
|
||||
@ -43487,7 +43487,7 @@ sp_384_to_bin_bswap PROC
|
||||
mov QWORD PTR [rdx+32], rax
|
||||
mov QWORD PTR [rdx+40], r8
|
||||
ret
|
||||
sp_384_to_bin_bswap ENDP
|
||||
sp_384_to_bin_bswap_6 ENDP
|
||||
_text ENDS
|
||||
IFNDEF NO_MOVBE_SUPPORT
|
||||
; /* Write r as big endian to byte array.
|
||||
@ -43498,7 +43498,7 @@ IFNDEF NO_MOVBE_SUPPORT
|
||||
; * a Byte array.
|
||||
; */
|
||||
_text SEGMENT READONLY PARA
|
||||
sp_384_to_bin_movbe PROC
|
||||
sp_384_to_bin_movbe_6 PROC
|
||||
movbe rax, QWORD PTR [rcx+40]
|
||||
movbe r8, QWORD PTR [rcx+32]
|
||||
mov QWORD PTR [rdx], rax
|
||||
@ -43512,7 +43512,7 @@ sp_384_to_bin_movbe PROC
|
||||
mov QWORD PTR [rdx+32], rax
|
||||
mov QWORD PTR [rdx+40], r8
|
||||
ret
|
||||
sp_384_to_bin_movbe ENDP
|
||||
sp_384_to_bin_movbe_6 ENDP
|
||||
_text ENDS
|
||||
ENDIF
|
||||
; /* Sub b from a into a. (a -= b)
|
||||
|
@ -314,6 +314,25 @@ extern "C" {
|
||||
/* Mask of word size. */
|
||||
#define SP_WORD_MASK (SP_WORD_SIZE - 1)
|
||||
|
||||
/* For debugging only - format string for different digit sizes. */
|
||||
#if SP_WORD_SIZE == 64
|
||||
#if SP_ULONG_BITS == 64
|
||||
#define SP_PRINT_FMT "%016lx"
|
||||
#else
|
||||
#define SP_PRINT_FMT "%016llx"
|
||||
#endif
|
||||
#elif SP_WORD_SIZE == 32
|
||||
#if SP_UINT_BITS == 32
|
||||
#define SP_PRINT_FMT "%08x"
|
||||
#else
|
||||
#define SP_PRINT_FMT "%08lx"
|
||||
#endif
|
||||
#elif SP_WORD_SIZE == 16
|
||||
#define SP_PRINT_FMT "%04x"
|
||||
#elif SP_WORD_SIZE == 8
|
||||
#define SP_PRINT_FMT "%02x"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(WOLFSSL_HAVE_SP_ECC) && defined(WOLFSSL_SP_NONBLOCK)
|
||||
/* Non-blocking ECC operation context. */
|
||||
@ -417,25 +436,6 @@ typedef struct sp_ecc_ctx {
|
||||
#endif
|
||||
|
||||
|
||||
/* For debugging only - format string for different digit sizes. */
|
||||
#if SP_WORD_SIZE == 64
|
||||
#if SP_ULONG_BITS == 64
|
||||
#define SP_PRINT_FMT "%016lx"
|
||||
#else
|
||||
#define SP_PRINT_FMT "%016llx"
|
||||
#endif
|
||||
#elif SP_WORD_SIZE == 32
|
||||
#if SP_UINT_BITS == 32
|
||||
#define SP_PRINT_FMT "%08x"
|
||||
#else
|
||||
#define SP_PRINT_FMT "%08lx"
|
||||
#endif
|
||||
#elif SP_WORD_SIZE == 16
|
||||
#define SP_PRINT_FMT "%04x"
|
||||
#elif SP_WORD_SIZE == 8
|
||||
#define SP_PRINT_FMT "%02x"
|
||||
#endif
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
/* Output is formatted to be used with script that checks calculations. */
|
||||
|
||||
|
Reference in New Issue
Block a user