Skip to content

Commit

Permalink
Generated ASM
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Jul 19, 2024
1 parent 7f7835a commit 0ebf3f5
Show file tree
Hide file tree
Showing 21 changed files with 293 additions and 536 deletions.
21 changes: 6 additions & 15 deletions generated-src/ios-aarch64/crypto/fipsmodule/sha1-armv8.S
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,13 @@

.text


.private_extern _OPENSSL_armcap_P
.globl _sha1_block_data_order
.private_extern _sha1_block_data_order
.globl _sha1_block_data_order_nohw
.private_extern _sha1_block_data_order_nohw

.align 6
_sha1_block_data_order:
_sha1_block_data_order_nohw:
// Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later.
AARCH64_VALID_CALL_TARGET
#if defined(OPENSSL_HWASAN) && __clang_major__ >= 10
adrp x16,:pg_hi21_nc:_OPENSSL_armcap_P
#else
adrp x16,_OPENSSL_armcap_P@PAGE
#endif
ldr w16,[x16,_OPENSSL_armcap_P@PAGEOFF]
tst w16,#ARMV8_SHA1
b.ne Lv8_entry

stp x29,x30,[sp,#-96]!
add x29,sp,#0
Expand Down Expand Up @@ -1081,12 +1071,13 @@ Loop:
ldr x29,[sp],#96
ret

.globl _sha1_block_data_order_hw
.private_extern _sha1_block_data_order_hw

.align 6
sha1_block_armv8:
_sha1_block_data_order_hw:
// Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later.
AARCH64_VALID_CALL_TARGET
Lv8_entry:
stp x29,x30,[sp,#-16]!
add x29,sp,#0

Expand Down
25 changes: 7 additions & 18 deletions generated-src/ios-aarch64/crypto/fipsmodule/sha256-armv8.S
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,11 @@

.text


.private_extern _OPENSSL_armcap_P
.globl _sha256_block_data_order
.private_extern _sha256_block_data_order
.globl _sha256_block_data_order_nohw
.private_extern _sha256_block_data_order_nohw

.align 6
_sha256_block_data_order:
AARCH64_VALID_CALL_TARGET
#ifndef __KERNEL__
#if defined(OPENSSL_HWASAN) && __clang_major__ >= 10
adrp x16,:pg_hi21_nc:_OPENSSL_armcap_P
#else
adrp x16,_OPENSSL_armcap_P@PAGE
#endif
ldr w16,[x16,_OPENSSL_armcap_P@PAGEOFF]
tst w16,#ARMV8_SHA256
b.ne Lv8_entry
#endif
_sha256_block_data_order_nohw:
AARCH64_SIGN_LINK_REGISTER
stp x29,x30,[sp,#-128]!
add x29,sp,#0
Expand Down Expand Up @@ -1060,10 +1047,11 @@ LK256:
.align 2
.text
#ifndef __KERNEL__
.globl _sha256_block_data_order_hw
.private_extern _sha256_block_data_order_hw

.align 6
sha256_block_armv8:
Lv8_entry:
_sha256_block_data_order_hw:
#ifdef BORINGSSL_DISPATCH_TEST

adrp x9,_BORINGSSL_function_hit@PAGE
Expand All @@ -1072,6 +1060,7 @@ Lv8_entry:
strb w10, [x9,#6] // kFlag_sha256_hw
#endif
// Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later.
AARCH64_VALID_CALL_TARGET
stp x29,x30,[sp,#-16]!
add x29,sp,#0

Expand Down
26 changes: 8 additions & 18 deletions generated-src/ios-aarch64/crypto/fipsmodule/sha512-armv8.S
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,11 @@

.text


.private_extern _OPENSSL_armcap_P
.globl _sha512_block_data_order
.private_extern _sha512_block_data_order
.globl _sha512_block_data_order_nohw
.private_extern _sha512_block_data_order_nohw

.align 6
_sha512_block_data_order:
AARCH64_VALID_CALL_TARGET
#ifndef __KERNEL__
#if defined(OPENSSL_HWASAN) && __clang_major__ >= 10
adrp x16,:pg_hi21_nc:_OPENSSL_armcap_P
#else
adrp x16,_OPENSSL_armcap_P@PAGE
#endif
ldr w16,[x16,_OPENSSL_armcap_P@PAGEOFF]
tst w16,#ARMV8_SHA512
b.ne Lv8_entry
#endif
_sha512_block_data_order_nohw:
AARCH64_SIGN_LINK_REGISTER
stp x29,x30,[sp,#-128]!
add x29,sp,#0
Expand Down Expand Up @@ -1084,17 +1071,20 @@ LK512:
.align 2
.text
#ifndef __KERNEL__
.globl _sha512_block_data_order_hw
.private_extern _sha512_block_data_order_hw

.align 6
sha512_block_armv8:
Lv8_entry:
_sha512_block_data_order_hw:
#ifdef BORINGSSL_DISPATCH_TEST

adrp x9,_BORINGSSL_function_hit@PAGE
add x9, x9, _BORINGSSL_function_hit@PAGEOFF
mov w10, #1
strb w10, [x9,#8] // kFlag_sha512_hw
#endif
// Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later.
AARCH64_VALID_CALL_TARGET
stp x29,x30,[sp,#-16]!
add x29,sp,#0

Expand Down
29 changes: 10 additions & 19 deletions generated-src/linux-aarch64/crypto/fipsmodule/sha1-armv8.S
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,13 @@

.text


.hidden OPENSSL_armcap_P
.globl sha1_block_data_order
.hidden sha1_block_data_order
.type sha1_block_data_order,%function
.globl sha1_block_data_order_nohw
.hidden sha1_block_data_order_nohw
.type sha1_block_data_order_nohw,%function
.align 6
sha1_block_data_order:
sha1_block_data_order_nohw:
// Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later.
AARCH64_VALID_CALL_TARGET
#if defined(OPENSSL_HWASAN) && __clang_major__ >= 10
adrp x16,:pg_hi21_nc:OPENSSL_armcap_P
#else
adrp x16,OPENSSL_armcap_P
#endif
ldr w16,[x16,:lo12:OPENSSL_armcap_P]
tst w16,#ARMV8_SHA1
b.ne .Lv8_entry

stp x29,x30,[sp,#-96]!
add x29,sp,#0
Expand Down Expand Up @@ -1080,13 +1070,14 @@ sha1_block_data_order:
ldp x27,x28,[sp,#80]
ldr x29,[sp],#96
ret
.size sha1_block_data_order,.-sha1_block_data_order
.type sha1_block_armv8,%function
.size sha1_block_data_order_nohw,.-sha1_block_data_order_nohw
.globl sha1_block_data_order_hw
.hidden sha1_block_data_order_hw
.type sha1_block_data_order_hw,%function
.align 6
sha1_block_armv8:
sha1_block_data_order_hw:
// Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later.
AARCH64_VALID_CALL_TARGET
.Lv8_entry:
stp x29,x30,[sp,#-16]!
add x29,sp,#0

Expand Down Expand Up @@ -1213,7 +1204,7 @@ sha1_block_armv8:

ldr x29,[sp],#16
ret
.size sha1_block_armv8,.-sha1_block_armv8
.size sha1_block_data_order_hw,.-sha1_block_data_order_hw
.section .rodata
.align 6
.Lconst:
Expand Down
33 changes: 11 additions & 22 deletions generated-src/linux-aarch64/crypto/fipsmodule/sha256-armv8.S
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,11 @@

.text


.hidden OPENSSL_armcap_P
.globl sha256_block_data_order
.hidden sha256_block_data_order
.type sha256_block_data_order,%function
.globl sha256_block_data_order_nohw
.hidden sha256_block_data_order_nohw
.type sha256_block_data_order_nohw,%function
.align 6
sha256_block_data_order:
AARCH64_VALID_CALL_TARGET
#ifndef __KERNEL__
#if defined(OPENSSL_HWASAN) && __clang_major__ >= 10
adrp x16,:pg_hi21_nc:OPENSSL_armcap_P
#else
adrp x16,OPENSSL_armcap_P
#endif
ldr w16,[x16,:lo12:OPENSSL_armcap_P]
tst w16,#ARMV8_SHA256
b.ne .Lv8_entry
#endif
sha256_block_data_order_nohw:
AARCH64_SIGN_LINK_REGISTER
stp x29,x30,[sp,#-128]!
add x29,sp,#0
Expand Down Expand Up @@ -1031,7 +1018,7 @@ sha256_block_data_order:
ldp x29,x30,[sp],#128
AARCH64_VALIDATE_LINK_REGISTER
ret
.size sha256_block_data_order,.-sha256_block_data_order
.size sha256_block_data_order_nohw,.-sha256_block_data_order_nohw

.section .rodata
.align 6
Expand Down Expand Up @@ -1060,10 +1047,11 @@ sha256_block_data_order:
.align 2
.text
#ifndef __KERNEL__
.type sha256_block_armv8,%function
.globl sha256_block_data_order_hw
.hidden sha256_block_data_order_hw
.type sha256_block_data_order_hw,%function
.align 6
sha256_block_armv8:
.Lv8_entry:
sha256_block_data_order_hw:
#ifdef BORINGSSL_DISPATCH_TEST

adrp x9,BORINGSSL_function_hit
Expand All @@ -1072,6 +1060,7 @@ sha256_block_armv8:
strb w10, [x9,#6] // kFlag_sha256_hw
#endif
// Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later.
AARCH64_VALID_CALL_TARGET
stp x29,x30,[sp,#-16]!
add x29,sp,#0

Expand Down Expand Up @@ -1206,6 +1195,6 @@ sha256_block_armv8:

ldr x29,[sp],#16
ret
.size sha256_block_armv8,.-sha256_block_armv8
.size sha256_block_data_order_hw,.-sha256_block_data_order_hw
#endif
#endif // !OPENSSL_NO_ASM && defined(OPENSSL_AARCH64) && defined(__ELF__)
34 changes: 12 additions & 22 deletions generated-src/linux-aarch64/crypto/fipsmodule/sha512-armv8.S
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,11 @@

.text


.hidden OPENSSL_armcap_P
.globl sha512_block_data_order
.hidden sha512_block_data_order
.type sha512_block_data_order,%function
.globl sha512_block_data_order_nohw
.hidden sha512_block_data_order_nohw
.type sha512_block_data_order_nohw,%function
.align 6
sha512_block_data_order:
AARCH64_VALID_CALL_TARGET
#ifndef __KERNEL__
#if defined(OPENSSL_HWASAN) && __clang_major__ >= 10
adrp x16,:pg_hi21_nc:OPENSSL_armcap_P
#else
adrp x16,OPENSSL_armcap_P
#endif
ldr w16,[x16,:lo12:OPENSSL_armcap_P]
tst w16,#ARMV8_SHA512
b.ne .Lv8_entry
#endif
sha512_block_data_order_nohw:
AARCH64_SIGN_LINK_REGISTER
stp x29,x30,[sp,#-128]!
add x29,sp,#0
Expand Down Expand Up @@ -1031,7 +1018,7 @@ sha512_block_data_order:
ldp x29,x30,[sp],#128
AARCH64_VALIDATE_LINK_REGISTER
ret
.size sha512_block_data_order,.-sha512_block_data_order
.size sha512_block_data_order_nohw,.-sha512_block_data_order_nohw

.section .rodata
.align 6
Expand Down Expand Up @@ -1084,17 +1071,20 @@ sha512_block_data_order:
.align 2
.text
#ifndef __KERNEL__
.type sha512_block_armv8,%function
.globl sha512_block_data_order_hw
.hidden sha512_block_data_order_hw
.type sha512_block_data_order_hw,%function
.align 6
sha512_block_armv8:
.Lv8_entry:
sha512_block_data_order_hw:
#ifdef BORINGSSL_DISPATCH_TEST

adrp x9,BORINGSSL_function_hit
add x9, x9, :lo12:BORINGSSL_function_hit
mov w10, #1
strb w10, [x9,#8] // kFlag_sha512_hw
#endif
// Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later.
AARCH64_VALID_CALL_TARGET
stp x29,x30,[sp,#-16]!
add x29,sp,#0

Expand Down Expand Up @@ -1608,6 +1598,6 @@ sha512_block_armv8:

ldr x29,[sp],#16
ret
.size sha512_block_armv8,.-sha512_block_armv8
.size sha512_block_data_order_hw,.-sha512_block_data_order_hw
#endif
#endif // !OPENSSL_NO_ASM && defined(OPENSSL_AARCH64) && defined(__ELF__)
Loading

0 comments on commit 0ebf3f5

Please sign in to comment.