sync with OpenBSD -current

This commit is contained in:
purplerain 2024-02-24 21:16:08 +00:00
parent aee4243932
commit 951aae1a1a
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
39 changed files with 531 additions and 183 deletions

View file

@ -49,7 +49,7 @@
S2N_BN_SYMBOL(bignum_add):
endbr64
_CET_ENDBR
#if WINDOWS_ABI
push rdi

View file

@ -54,7 +54,7 @@
S2N_BN_SYMBOL(bignum_cmadd):
endbr64
_CET_ENDBR
#if WINDOWS_ABI
push rdi

View file

@ -51,7 +51,7 @@
S2N_BN_SYMBOL(bignum_cmul):
endbr64
_CET_ENDBR
#if WINDOWS_ABI
push rdi

View file

@ -59,7 +59,7 @@
S2N_BN_SYMBOL(bignum_mul):
endbr64
_CET_ENDBR
#if WINDOWS_ABI
push rdi

View file

@ -72,7 +72,7 @@
adc h, rdx
S2N_BN_SYMBOL(bignum_mul_4_8_alt):
endbr64
_CET_ENDBR
#if WINDOWS_ABI
push rdi

View file

@ -72,7 +72,7 @@
adc h, rdx
S2N_BN_SYMBOL(bignum_mul_8_16_alt):
endbr64
_CET_ENDBR
#if WINDOWS_ABI
push rdi

View file

@ -62,7 +62,7 @@
#define llshort ebp
S2N_BN_SYMBOL(bignum_sqr):
endbr64
_CET_ENDBR
#if WINDOWS_ABI
push rdi

View file

@ -71,7 +71,7 @@
adc c, 0
S2N_BN_SYMBOL(bignum_sqr_4_8_alt):
endbr64
_CET_ENDBR
#if WINDOWS_ABI
push rdi

View file

@ -103,7 +103,7 @@
adc c, 0
S2N_BN_SYMBOL(bignum_sqr_8_16_alt):
endbr64
_CET_ENDBR
#if WINDOWS_ABI
push rdi

View file

@ -49,7 +49,7 @@
S2N_BN_SYMBOL(bignum_sub):
endbr64
_CET_ENDBR
#if WINDOWS_ABI
push rdi

View file

@ -30,7 +30,7 @@
.text
S2N_BN_SYMBOL(word_clz):
endbr64
_CET_ENDBR
#if WINDOWS_ABI
push rdi

View file

@ -347,7 +347,7 @@ $code.=<<___;
.type MULADD_128x512,\@abi-omnipotent
.align 16
MULADD_128x512:
endbr64
_CET_ENDBR
___
&MULSTEP_512([map("%r$_",(8..15))], "(+8*0)(%rcx)", "%rsi", "%rbp", "%rbx");
$code.=<<___;
@ -415,7 +415,7 @@ $code.=<<___;
.type mont_reduce,\@abi-omnipotent
.align 16
mont_reduce:
endbr64
_CET_ENDBR
___
my $STACK_DEPTH = 8;
@ -678,7 +678,7 @@ $code.=<<___;
.type mont_mul_a3b,\@abi-omnipotent
.align 16
mont_mul_a3b:
endbr64
_CET_ENDBR
#
# multiply tmp = src1 * src2
# For multiply: dst = rcx, src1 = rdi, src2 = rsi
@ -1080,7 +1080,7 @@ $code.=<<___;
.type sqr_reduce,\@abi-omnipotent
.align 16
sqr_reduce:
endbr64
_CET_ENDBR
mov (+$pResult_offset+8)(%rsp), %rcx
___
&SQR_512("%rsp+$tmp16_offset+8", "%rcx", [map("%r$_",(10..15,8..9))], "%rbx", "%rbp", "%rsi", "%rdi");
@ -1110,7 +1110,7 @@ $code.=<<___;
.globl mod_exp_512
.type mod_exp_512,\@function,4
mod_exp_512:
endbr64
_CET_ENDBR
push %rbp
push %rbx
push %r12

View file

@ -63,7 +63,7 @@ $code=<<___;
.type bn_mul_mont,\@function,6
.align 16
bn_mul_mont:
endbr64
_CET_ENDBR
test \$3,${num}d
jnz .Lmul_enter
cmp \$8,${num}d
@ -279,7 +279,7 @@ $code.=<<___;
.align 16
bn_mul4x_mont:
.Lmul4x_enter:
endbr64
_CET_ENDBR
push %rbx
push %rbp
push %r12
@ -708,7 +708,7 @@ $code.=<<___;
.align 16
bn_sqr4x_mont:
.Lsqr4x_enter:
endbr64
_CET_ENDBR
push %rbx
push %rbp
push %r12

View file

@ -57,7 +57,7 @@ $code=<<___;
.type bn_mul_mont_gather5,\@function,6
.align 64
bn_mul_mont_gather5:
endbr64
_CET_ENDBR
test \$3,${num}d
jnz .Lmul_enter
cmp \$8,${num}d
@ -388,7 +388,7 @@ $code.=<<___;
.type bn_mul4x_mont_gather5,\@function,6
.align 16
bn_mul4x_mont_gather5:
endbr64
_CET_ENDBR
.Lmul4x_enter:
mov ${num}d,${num}d
movd `($win64?56:8)`(%rsp),%xmm5 # load 7th argument
@ -927,7 +927,7 @@ $code.=<<___;
.type bn_scatter5,\@abi-omnipotent
.align 16
bn_scatter5:
endbr64
_CET_ENDBR
cmp \$0, $num
jz .Lscatter_epilogue
lea ($tbl,$idx,8),$tbl
@ -946,7 +946,7 @@ bn_scatter5:
.type bn_gather5,\@abi-omnipotent
.align 16
bn_gather5:
endbr64
_CET_ENDBR
.LSEH_begin_bn_gather5: # Win64 thing, but harmless in other cases
# I can't trust assembler to use specific encoding:-(
.byte 0x4c,0x8d,0x14,0x24 # lea (%rsp),%r10
@ -1057,7 +1057,7 @@ $code.=<<___;
.type mul_handler,\@abi-omnipotent
.align 16
mul_handler:
endbr64
_CET_ENDBR
push %rsi
push %rdi
push %rbx

View file

@ -18,6 +18,12 @@
# define S2N_BN_SYMBOL(name) name
#endif
#ifdef __CET__
# include <cet.h>
#else
# define _CET_ENDBR
#endif
#define S2N_BN_SYM_VISIBILITY_DIRECTIVE(name) .globl S2N_BN_SYMBOL(name)
#ifdef S2N_BN_HIDE_SYMBOLS
# ifdef __APPLE__