aboutsummaryrefslogtreecommitdiff
path: root/sys/crypto/openssl/aarch64/arm64cpuid.S
diff options
context:
space:
mode:
Diffstat (limited to 'sys/crypto/openssl/aarch64/arm64cpuid.S')
-rw-r--r--sys/crypto/openssl/aarch64/arm64cpuid.S137
1 files changed, 136 insertions, 1 deletions
diff --git a/sys/crypto/openssl/aarch64/arm64cpuid.S b/sys/crypto/openssl/aarch64/arm64cpuid.S
index 52c6ee5b65d3..81530bda1c67 100644
--- a/sys/crypto/openssl/aarch64/arm64cpuid.S
+++ b/sys/crypto/openssl/aarch64/arm64cpuid.S
@@ -57,14 +57,46 @@ _armv8_pmull_probe:
ret
.size _armv8_pmull_probe,.-_armv8_pmull_probe
+.globl _armv8_sm4_probe
+.type _armv8_sm4_probe,%function
+_armv8_sm4_probe:
+ AARCH64_VALID_CALL_TARGET
+.inst 0xcec08400 // sm4e v0.4s, v0.4s
+ ret
+.size _armv8_sm4_probe,.-_armv8_sm4_probe
+
.globl _armv8_sha512_probe
.type _armv8_sha512_probe,%function
_armv8_sha512_probe:
AARCH64_VALID_CALL_TARGET
-.long 0xcec08000 // sha512su0 v0.2d,v0.2d
+.inst 0xcec08000 // sha512su0 v0.2d,v0.2d
ret
.size _armv8_sha512_probe,.-_armv8_sha512_probe
+.globl _armv8_eor3_probe
+.type _armv8_eor3_probe,%function
+_armv8_eor3_probe:
+ AARCH64_VALID_CALL_TARGET
+.inst 0xce010800 // eor3 v0.16b, v0.16b, v1.16b, v2.16b
+ ret
+.size _armv8_eor3_probe,.-_armv8_eor3_probe
+
+.globl _armv8_sve_probe
+.type _armv8_sve_probe,%function
+_armv8_sve_probe:
+ AARCH64_VALID_CALL_TARGET
+.inst 0x04a03000 // eor z0.d,z0.d,z0.d
+ ret
+.size _armv8_sve_probe,.-_armv8_sve_probe
+
+.globl _armv8_sve2_probe
+.type _armv8_sve2_probe,%function
+_armv8_sve2_probe:
+ AARCH64_VALID_CALL_TARGET
+.inst 0x04e03400 // xar z0.d,z0.d,z0.d
+ ret
+.size _armv8_sve2_probe,.-_armv8_sve2_probe
+
.globl _armv8_cpuid_probe
.type _armv8_cpuid_probe,%function
_armv8_cpuid_probe:
@@ -73,6 +105,14 @@ _armv8_cpuid_probe:
ret
.size _armv8_cpuid_probe,.-_armv8_cpuid_probe
+.globl _armv8_sm3_probe
+.type _armv8_sm3_probe,%function
+_armv8_sm3_probe:
+ AARCH64_VALID_CALL_TARGET
+.inst 0xce63c004 // sm3partw1 v4.4s, v0.4s, v3.4s
+ ret
+.size _armv8_sm3_probe,.-_armv8_sm3_probe
+
.globl OPENSSL_cleanse
.type OPENSSL_cleanse,%function
.align 5
@@ -138,3 +178,98 @@ CRYPTO_memcmp:
lsr w0,w0,#31
ret
.size CRYPTO_memcmp,.-CRYPTO_memcmp
+
+.globl _armv8_rng_probe
+.type _armv8_rng_probe,%function
+_armv8_rng_probe:
+ AARCH64_VALID_CALL_TARGET
+ mrs x0, s3_3_c2_c4_0 // rndr
+ mrs x0, s3_3_c2_c4_1 // rndrrs
+ ret
+.size _armv8_rng_probe,.-_armv8_rng_probe
+// Fill buffer with Randomly Generated Bytes
+// inputs: char * in x0 - Pointer to buffer
+// size_t in x1 - Number of bytes to write to buffer
+// outputs: size_t in x0 - Number of bytes successfully written to buffer
+.globl OPENSSL_rndr_asm
+.type OPENSSL_rndr_asm,%function
+.align 4
+OPENSSL_rndr_asm:
+ AARCH64_VALID_CALL_TARGET
+ mov x2,xzr
+ mov x3,xzr
+
+.align 4
+.Loop_rndr:
+ cmp x1,#0
+ b.eq .rndr_done
+ mov x3,xzr
+ mrs x3,s3_3_c2_c4_0
+ b.eq .rndr_done
+
+ cmp x1,#8
+ b.lt .Loop_single_byte_rndr
+
+ str x3,[x0]
+ add x0,x0,#8
+ add x2,x2,#8
+ subs x1,x1,#8
+ b.ge .Loop_rndr
+
+.align 4
+.Loop_single_byte_rndr:
+ strb w3,[x0]
+ lsr x3,x3,#8
+ add x2,x2,#1
+ add x0,x0,#1
+ subs x1,x1,#1
+ b.gt .Loop_single_byte_rndr
+
+.align 4
+.rndr_done:
+ mov x0,x2
+ ret
+.size OPENSSL_rndr_asm,.-OPENSSL_rndr_asm
+// Fill buffer with Randomly Generated Bytes
+// inputs: char * in x0 - Pointer to buffer
+// size_t in x1 - Number of bytes to write to buffer
+// outputs: size_t in x0 - Number of bytes successfully written to buffer
+.globl OPENSSL_rndrrs_asm
+.type OPENSSL_rndrrs_asm,%function
+.align 4
+OPENSSL_rndrrs_asm:
+ AARCH64_VALID_CALL_TARGET
+ mov x2,xzr
+ mov x3,xzr
+
+.align 4
+.Loop_rndrrs:
+ cmp x1,#0
+ b.eq .rndrrs_done
+ mov x3,xzr
+ mrs x3,s3_3_c2_c4_1
+ b.eq .rndrrs_done
+
+ cmp x1,#8
+ b.lt .Loop_single_byte_rndrrs
+
+ str x3,[x0]
+ add x0,x0,#8
+ add x2,x2,#8
+ subs x1,x1,#8
+ b.ge .Loop_rndrrs
+
+.align 4
+.Loop_single_byte_rndrrs:
+ strb w3,[x0]
+ lsr x3,x3,#8
+ add x2,x2,#1
+ add x0,x0,#1
+ subs x1,x1,#1
+ b.gt .Loop_single_byte_rndrrs
+
+.align 4
+.rndrrs_done:
+ mov x0,x2
+ ret
+.size OPENSSL_rndrrs_asm,.-OPENSSL_rndrrs_asm