mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-07 00:46:17 +08:00
Generate compiler compatible assembly symbols
Typically when compiling a function `foo`, GCC will add a prefix `_` to the symbol, i.e., generate `_foo`. But on some platforms, the compiler will not add prefix. option `ENABLE_ASM_UNDERSCORE_PREFIX` change the default name of global symbols in assembly code.
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <gmssl/asm.h>
|
||||
|
||||
|
||||
/* GF(2^128) defined by f(x) = x^128 + x^7 + x^2 + x + 1
|
||||
|
||||
f0 = x^128 = x^7 + x^2 + x + 1
|
||||
@@ -29,9 +32,11 @@
|
||||
= c + (e0 + w0) * x^64 + (d0 + w1) * f0
|
||||
*/
|
||||
.text
|
||||
.globl _gf128_mul
|
||||
|
||||
.globl func(gf128_mul)
|
||||
.align 4
|
||||
_gf128_mul:
|
||||
|
||||
func(gf128_mul):
|
||||
// load (a0, a1)
|
||||
ld1 {v1.2d},[x1]
|
||||
// load (b0, b1)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#include <gmssl/asm.h>
|
||||
|
||||
.align 7
|
||||
|
||||
@@ -62,9 +63,10 @@ Llshift:
|
||||
.byte 4,5,6,7, 8,9,10,11, 12,13,14,15, 0,1,2,3
|
||||
|
||||
|
||||
.globl _sm4_set_encrypt_key
|
||||
.globl func(sm4_set_encrypt_key)
|
||||
.align 4
|
||||
_sm4_set_encrypt_key:
|
||||
|
||||
func(sm4_set_encrypt_key):
|
||||
|
||||
// load const v16..v31 = SBox
|
||||
adr x3, LSBOX
|
||||
@@ -140,9 +142,10 @@ _sm4_set_encrypt_key:
|
||||
ret
|
||||
|
||||
|
||||
.globl _sm4_set_decrypt_key
|
||||
.globl func(sm4_set_decrypt_key)
|
||||
.align 4
|
||||
_sm4_set_decrypt_key:
|
||||
|
||||
func(sm4_set_decrypt_key):
|
||||
|
||||
// load const v16..v31 = SBox
|
||||
adr x3,LSBOX
|
||||
@@ -221,10 +224,10 @@ _sm4_set_decrypt_key:
|
||||
ret
|
||||
|
||||
|
||||
.globl _sm4_encrypt
|
||||
.globl func(sm4_encrypt)
|
||||
|
||||
.align 5
|
||||
_sm4_encrypt:
|
||||
func(sm4_encrypt):
|
||||
|
||||
// load sbox
|
||||
adr x3, LSBOX
|
||||
|
||||
Reference in New Issue
Block a user