-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f201340
commit a709265
Showing
3 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// This file is generated from a similarly-named Perl script in the BoringSSL | ||
// source tree. Do not edit by hand. | ||
|
||
#include <openssl/asm_base.h> | ||
|
||
#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_AARCH64) && defined(__APPLE__) | ||
#include <openssl/arm_arch.h> | ||
|
||
|
||
.text | ||
|
||
# size_t CRYPTO_rndr(uint8_t *out, size_t out_len) | ||
.globl _CRYPTO_rndr | ||
.private_extern _CRYPTO_rndr | ||
|
||
.align 4 | ||
_CRYPTO_rndr: | ||
cbz x1, Lrndr_error // out_len = 0 is not supported | ||
mov x4, x1 // out_len: requested number of bytes | ||
mov x2, #0 // Counts number of bytes generated | ||
|
||
Lrndr_loop: | ||
mrs x3, s3_3_c2_c4_0 // rndr instruction | ||
cbz x3, Lrndr_error // Check if RNDR failed | ||
|
||
cmp x1, #8 // Sets N if strictly less than 8 bytes left | ||
blt Lrndr_less_than_8_bytes | ||
|
||
str x3, [x0], #8 // Copy 8 bytes to *out and increment pointer by 8 | ||
add x2, x2, #8 // Adds 8 to counter | ||
sub x1, x1, #8 | ||
cbz x1, Lrndr_done // If multiple of 8 this will be 0 eventually | ||
b Lrndr_loop | ||
|
||
Lrndr_less_than_8_bytes: | ||
// Copy remaining bytes one by one | ||
strb w3, [x0] | ||
lsr x3, x3, #8 | ||
add x2, x2, #1 | ||
add x0, x0, #1 | ||
sub x1, x1, #1 | ||
cbnz x1, Lrndr_less_than_8_bytes | ||
|
||
Lrndr_done: | ||
cmp x2, x4 // Ensure correct number of bytes were generated | ||
bne Lrndr_error | ||
mov x0, #1 // Return value success | ||
ret | ||
|
||
Lrndr_error: | ||
mov x0, #0 // Return value error | ||
ret | ||
|
||
#endif // !OPENSSL_NO_ASM && defined(OPENSSL_AARCH64) && defined(__APPLE__) |
54 changes: 54 additions & 0 deletions
54
generated-src/linux-aarch64/crypto/fipsmodule/rndr-armv8.S
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// This file is generated from a similarly-named Perl script in the BoringSSL | ||
// source tree. Do not edit by hand. | ||
|
||
#include <openssl/asm_base.h> | ||
|
||
#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_AARCH64) && defined(__ELF__) | ||
#include <openssl/arm_arch.h> | ||
|
||
.arch armv8-a | ||
.text | ||
|
||
# size_t CRYPTO_rndr(uint8_t *out, size_t out_len) | ||
.globl CRYPTO_rndr | ||
.hidden CRYPTO_rndr | ||
.type CRYPTO_rndr,%function | ||
.align 4 | ||
CRYPTO_rndr: | ||
cbz x1, .Lrndr_error // out_len = 0 is not supported | ||
mov x4, x1 // out_len: requested number of bytes | ||
mov x2, #0 // Counts number of bytes generated | ||
|
||
.Lrndr_loop: | ||
mrs x3, s3_3_c2_c4_0 // rndr instruction | ||
cbz x3, .Lrndr_error // Check if RNDR failed | ||
|
||
cmp x1, #8 // Sets N if strictly less than 8 bytes left | ||
blt .Lrndr_less_than_8_bytes | ||
|
||
str x3, [x0], #8 // Copy 8 bytes to *out and increment pointer by 8 | ||
add x2, x2, #8 // Adds 8 to counter | ||
sub x1, x1, #8 | ||
cbz x1, .Lrndr_done // If multiple of 8 this will be 0 eventually | ||
b .Lrndr_loop | ||
|
||
.Lrndr_less_than_8_bytes: | ||
// Copy remaining bytes one by one | ||
strb w3, [x0] | ||
lsr x3, x3, #8 | ||
add x2, x2, #1 | ||
add x0, x0, #1 | ||
sub x1, x1, #1 | ||
cbnz x1, .Lrndr_less_than_8_bytes | ||
|
||
.Lrndr_done: | ||
cmp x2, x4 // Ensure correct number of bytes were generated | ||
bne .Lrndr_error | ||
mov x0, #1 // Return value success | ||
ret | ||
|
||
.Lrndr_error: | ||
mov x0, #0 // Return value error | ||
ret | ||
.size CRYPTO_rndr,.-CRYPTO_rndr | ||
#endif // !OPENSSL_NO_ASM && defined(OPENSSL_AARCH64) && defined(__ELF__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// This file is generated from a similarly-named Perl script in the BoringSSL | ||
// source tree. Do not edit by hand. | ||
|
||
#include <openssl/asm_base.h> | ||
|
||
#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_AARCH64) && defined(_WIN32) | ||
#include <openssl/arm_arch.h> | ||
|
||
.arch armv8-a | ||
.text | ||
|
||
# size_t CRYPTO_rndr(uint8_t *out, size_t out_len) | ||
.globl CRYPTO_rndr | ||
|
||
.def CRYPTO_rndr | ||
.type 32 | ||
.endef | ||
.align 4 | ||
CRYPTO_rndr: | ||
cbz x1, Lrndr_error // out_len = 0 is not supported | ||
mov x4, x1 // out_len: requested number of bytes | ||
mov x2, #0 // Counts number of bytes generated | ||
|
||
Lrndr_loop: | ||
mrs x3, s3_3_c2_c4_0 // rndr instruction | ||
cbz x3, Lrndr_error // Check if RNDR failed | ||
|
||
cmp x1, #8 // Sets N if strictly less than 8 bytes left | ||
blt Lrndr_less_than_8_bytes | ||
|
||
str x3, [x0], #8 // Copy 8 bytes to *out and increment pointer by 8 | ||
add x2, x2, #8 // Adds 8 to counter | ||
sub x1, x1, #8 | ||
cbz x1, Lrndr_done // If multiple of 8 this will be 0 eventually | ||
b Lrndr_loop | ||
|
||
Lrndr_less_than_8_bytes: | ||
// Copy remaining bytes one by one | ||
strb w3, [x0] | ||
lsr x3, x3, #8 | ||
add x2, x2, #1 | ||
add x0, x0, #1 | ||
sub x1, x1, #1 | ||
cbnz x1, Lrndr_less_than_8_bytes | ||
|
||
Lrndr_done: | ||
cmp x2, x4 // Ensure correct number of bytes were generated | ||
bne Lrndr_error | ||
mov x0, #1 // Return value success | ||
ret | ||
|
||
Lrndr_error: | ||
mov x0, #0 // Return value error | ||
ret | ||
|
||
#endif // !OPENSSL_NO_ASM && defined(OPENSSL_AARCH64) && defined(_WIN32) |