summaryrefslogtreecommitdiffstats
path: root/win-x86_64/crypto/rand/rdrand-x86_64.asm
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2015-10-02 16:09:15 -0700
committerKenny Root <kroot@google.com>2015-10-02 16:09:49 -0700
commitfe7305364c3369f9222a61646c5c9842eae9bceb (patch)
tree360ada970b7bb1046ae069d253ba24d9622eb3ad /win-x86_64/crypto/rand/rdrand-x86_64.asm
parent691ef9d0ff0ece39ffd6a58960a7cd195ef584ae (diff)
parentb452bce3bf2034466cee6206ebf3994409468ee4 (diff)
downloadexternal_boringssl-fe7305364c3369f9222a61646c5c9842eae9bceb.zip
external_boringssl-fe7305364c3369f9222a61646c5c9842eae9bceb.tar.gz
external_boringssl-fe7305364c3369f9222a61646c5c9842eae9bceb.tar.bz2
Merge mnc-dr-dev-plus-aosp into mnc-ub-dev
This pulls in the latest version of BoringSSL. Change-Id: I0ab5c73d60f41a696c9a828fac87670aaca10dec
Diffstat (limited to 'win-x86_64/crypto/rand/rdrand-x86_64.asm')
-rw-r--r--win-x86_64/crypto/rand/rdrand-x86_64.asm50
1 files changed, 49 insertions, 1 deletions
diff --git a/win-x86_64/crypto/rand/rdrand-x86_64.asm b/win-x86_64/crypto/rand/rdrand-x86_64.asm
index a63ea69..4c03791 100644
--- a/win-x86_64/crypto/rand/rdrand-x86_64.asm
+++ b/win-x86_64/crypto/rand/rdrand-x86_64.asm
@@ -5,6 +5,9 @@ default rel
section .text code align=64
+
+
+
global CRYPTO_rdrand
ALIGN 16
@@ -16,7 +19,52 @@ $L$SEH_begin_CRYPTO_rdrand:
mov rdi,rcx
-DB 0x48,0x0f,0xc7,0xf0
+ xor rax,rax
+
+
+DB 0x48,0x0f,0xc7,0xf1
+
+ adc rax,rax
+ mov QWORD[rdi],rcx
+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue
+ mov rsi,QWORD[16+rsp]
+ DB 0F3h,0C3h ;repret
+
+
+
+
+
+global CRYPTO_rdrand_multiple8_buf
+
+ALIGN 16
+CRYPTO_rdrand_multiple8_buf:
+ mov QWORD[8+rsp],rdi ;WIN64 prologue
+ mov QWORD[16+rsp],rsi
+ mov rax,rsp
+$L$SEH_begin_CRYPTO_rdrand_multiple8_buf:
+ mov rdi,rcx
+ mov rsi,rdx
+
+
+ test rsi,rsi
+ jz NEAR $L$out
+ mov rdx,8
+$L$loop:
+
+
+DB 0x48,0x0f,0xc7,0xf1
+ jnc NEAR $L$err
+ mov QWORD[rdi],rcx
+ add rdi,rdx
+ sub rsi,rdx
+ jnz NEAR $L$loop
+$L$out:
+ mov rax,1
+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue
+ mov rsi,QWORD[16+rsp]
+ DB 0F3h,0C3h ;repret
+$L$err:
+ xor rax,rax
mov rdi,QWORD[8+rsp] ;WIN64 epilogue
mov rsi,QWORD[16+rsp]
DB 0F3h,0C3h ;repret