| 7 | %define YMMWORD |
| 8 | %define ZMMWORD |
| 9 | %define _CET_ENDBR |
| 10 |
| 11 | %ifdef BORINGSSL_PREFIX |
| 12 | %include "boringssl_prefix_symbols_nasm.inc" |
| 13 | %endif |
| 14 | section .text code align=64 |
| 15 |
| 16 |
| 17 |
| 18 |
| 19 |
| 20 | global CRYPTO_rdrand |
| 21 |
| 22 | ALIGN 16 |
| 23 | CRYPTO_rdrand: |
| 24 |
| 25 | _CET_ENDBR |
| 26 | xor rax,rax |
| 27 | rdrand r8 |
| 28 |
| 29 | adc rax,rax |
| 30 | mov QWORD[rcx],r8 |
| 31 | ret |
| 32 |
| 33 |
| 34 |
| 35 |
| 36 |
| 37 |
| 38 |
| 39 | global CRYPTO_rdrand_multiple8_buf |
| 40 |
| 41 | ALIGN 16 |
| 42 | CRYPTO_rdrand_multiple8_buf: |
| 43 |
| 44 | _CET_ENDBR |
| 45 | test rdx,rdx |
| 46 | jz NEAR $L$out |
| 47 | mov r8,8 |
| 48 | $L$loop: |
| 49 | rdrand r9 |
| 50 | jnc NEAR $L$err |
| 51 | mov QWORD[rcx],r9 |
| 52 | add rcx,r8 |
| 53 | sub rdx,r8 |
| 54 | jnz NEAR $L$loop |
| 55 | $L$out: |
| 56 | mov rax,1 |
| 57 | ret |
| 58 | $L$err: |
| 59 | xor rax,rax |
| 60 | ret |
| 61 |
| 62 |
| 63 | %else |
| 64 | ; Work around https://bugzilla.nasm.us/show_bug.cgi?id=3392738 |
| 65 | ret |
| 66 | %endif |
| 67 |