mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-06 16:36:16 +08:00
Fix SM2_AMD64
This commit is contained in:
@@ -812,7 +812,7 @@ const uint64_t SM2_Z256_NEG_N[4] = {
|
||||
0xac440bf6c62abedd, 0x8dfc2094de39fad4, 0x0000000000000000, 0x0000000100000000,
|
||||
};
|
||||
|
||||
#if !defined(ENABLE_SM2_ARM64) && !defined(ENABLE_SM2_AMD64)
|
||||
#if !defined(ENABLE_SM2_ARM64)
|
||||
void sm2_z256_modn_add(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b)
|
||||
{
|
||||
uint64_t c;
|
||||
@@ -868,7 +868,7 @@ const uint64_t *sm2_z256_order_minus_one(void) {
|
||||
const uint64_t *SM2_Z256_MODN_MONT_ONE = SM2_Z256_NEG_N;
|
||||
|
||||
|
||||
#if !defined(ENABLE_SM2_ARM64) && !defined(ENABLE_SM2_AMD64)
|
||||
#if !defined(ENABLE_SM2_ARM64)
|
||||
void sm2_z256_modn_mont_mul(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b)
|
||||
{
|
||||
sm2_z512_t z;
|
||||
@@ -917,7 +917,7 @@ void sm2_z256_modn_mul(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b)
|
||||
sm2_z256_modn_from_mont(r, r);
|
||||
}
|
||||
|
||||
#if !defined(ENABLE_SM2_ARM64) && !defined(ENABLE_SM2_AMD64)
|
||||
#if !defined(ENABLE_SM2_ARM64)
|
||||
void sm2_z256_modn_mont_sqr(sm2_z256_t r, const sm2_z256_t a)
|
||||
{
|
||||
sm2_z256_modn_mont_mul(r, a, a);
|
||||
@@ -1020,7 +1020,7 @@ void sm2_z256_modn_inv(sm2_z256_t r, const sm2_z256_t a)
|
||||
}
|
||||
|
||||
|
||||
#if !defined(ENABLE_SM2_ARM64) && !defined(ENABLE_SM2_AMD64)
|
||||
#if !defined(ENABLE_SM2_ARM64)
|
||||
|
||||
// mont(mont(a), 1) = aR * 1 * R^-1 (mod n) = a (mod p)
|
||||
void sm2_z256_modn_from_mont(sm2_z256_t r, const sm2_z256_t a)
|
||||
|
||||
@@ -345,7 +345,10 @@ func(sm2_z256_modp_neg):
|
||||
|
||||
.p2align 5
|
||||
func(sm2_z256_modp_to_mont):
|
||||
// FIXME: swap arg1 arg2
|
||||
// swap(arg1, arg2)
|
||||
movq %rdi, %rax
|
||||
movq %rsi, %rdi
|
||||
movq %rax, %rsi
|
||||
leaq L$RR(%rip),%rdx
|
||||
jmp L$mul_mont
|
||||
|
||||
@@ -637,7 +640,7 @@ __ecp_sm2z256_mul_montq:
|
||||
.globl func(sm2_z256_modp_mont_sqr)
|
||||
|
||||
.p2align 5
|
||||
func(sm2_z256_modp_mont_mul):
|
||||
func(sm2_z256_modp_mont_sqr):
|
||||
pushq %rbp
|
||||
pushq %rbx
|
||||
pushq %r12
|
||||
|
||||
Reference in New Issue
Block a user