summaryrefslogtreecommitdiff
path: root/rdrand.asm
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-07-10 15:16:20 -0400
committerJeffrey Walton <noloader@gmail.com>2016-07-10 15:16:20 -0400
commit36da00cc9293aa7f5297489e7d32d0cb19e2a4a4 (patch)
treecbf04355b4bdc9e64234db1247b0ff135d1858c4 /rdrand.asm
parentb80f725accdd27c854c3575f877ec2a24d6081ec (diff)
downloadcryptopp-git-36da00cc9293aa7f5297489e7d32d0cb19e2a4a4.tar.gz
Add RDRAND and RDSEED for SunCC 12.1 and above
Diffstat (limited to 'rdrand.asm')
-rw-r--r--rdrand.asm48
1 files changed, 24 insertions, 24 deletions
diff --git a/rdrand.asm b/rdrand.asm
index 73f5a964..9fcf6e0a 100644
--- a/rdrand.asm
+++ b/rdrand.asm
@@ -108,7 +108,7 @@ Call_RDRAND_EAX:
;; RDRAND is not available prior to VS2012. Just emit
;; the byte codes using DB. This is `rdrand eax`.
DB 0Fh, 0C7h, 0F0h
-
+
;; If CF=1, the number returned by RDRAND is valid.
;; If CF=0, a random number was not available.
jc RDRAND_succeeded
@@ -126,13 +126,13 @@ RDRAND_succeeded:
cmp bsize, MWSIZE
jb Partial_Machine_Word
-
+
Full_Machine_Word:
mov DWORD PTR [buffer], eax
add buffer, MWSIZE ;; No need for Intel Core 2 slow workarounds, like
sub bsize, MWSIZE ;; `lea buffer,[buffer+MWSIZE]` for faster adds
-
+
;; Continue
jmp GenerateBlock_Top
@@ -146,9 +146,9 @@ Partial_Machine_Word:
mov WORD PTR [buffer], ax
shr eax, 16
add buffer, 2
-
+
Bit_1_Not_Set:
-
+
;; Test bit 0 to see if size is at least 1
test bsize, 1
jz GenerateBlock_Success
@@ -164,14 +164,14 @@ GenerateBlock_PreRet:
;; Test for success (was the request completely fulfilled?)
cmp bsize, 0
- je GenerateBlock_Success
-
+ je GenerateBlock_Success
+
GenerateBlock_Failure:
xor eax, eax
mov al, RDRAND_FAILURE
ret
-
+
GenerateBlock_Success:
xor eax, eax
@@ -241,7 +241,7 @@ RDRAND_succeeded:
cmp bsize, MWSIZE
jb Partial_Machine_Word
-
+
Full_Machine_Word:
mov QWORD PTR [buffer], rax
@@ -284,19 +284,19 @@ Bit_0_Not_Set:
;; We've hit all the bits
jmp GenerateBlock_Success
-
+
GenerateBlock_PreRet:
;; Test for success (was the request completely fulfilled?)
cmp bsize, 0
je GenerateBlock_Success
-
+
GenerateBlock_Failure:
xor rax, rax
mov al, RDRAND_FAILURE
ret
-
+
GenerateBlock_Success:
xor rax, rax
@@ -352,7 +352,7 @@ Call_RDSEED_EAX:
;; RDSEED is not available prior to VS2012. Just emit
;; the byte codes using DB. This is `rdseed eax`.
DB 0Fh, 0C7h, 0F8h
-
+
;; If CF=1, the number returned by RDSEED is valid.
;; If CF=0, a random number was not available.
jc RDSEED_succeeded
@@ -370,13 +370,13 @@ RDSEED_succeeded:
cmp bsize, MWSIZE
jb Partial_Machine_Word
-
+
Full_Machine_Word:
mov DWORD PTR [buffer], eax
add buffer, MWSIZE ;; No need for Intel Core 2 slow workarounds, like
sub bsize, MWSIZE ;; `lea buffer,[buffer+MWSIZE]` for faster adds
-
+
;; Continue
jmp GenerateBlock_Top
@@ -390,9 +390,9 @@ Partial_Machine_Word:
mov WORD PTR [buffer], ax
shr eax, 16
add buffer, 2
-
+
Bit_1_Not_Set:
-
+
;; Test bit 0 to see if size is at least 1
test bsize, 1
jz GenerateBlock_Success
@@ -408,14 +408,14 @@ GenerateBlock_PreRet:
;; Test for success (was the request completely fulfilled?)
cmp bsize, 0
- je GenerateBlock_Success
-
+ je GenerateBlock_Success
+
GenerateBlock_Failure:
xor eax, eax
mov al, RDSEED_FAILURE
ret
-
+
GenerateBlock_Success:
xor eax, eax
@@ -485,7 +485,7 @@ RDSEED_succeeded:
cmp bsize, MWSIZE
jb Partial_Machine_Word
-
+
Full_Machine_Word:
mov QWORD PTR [buffer], rax
@@ -528,19 +528,19 @@ Bit_0_Not_Set:
;; We've hit all the bits
jmp GenerateBlock_Success
-
+
GenerateBlock_PreRet:
;; Test for success (was the request completely fulfilled?)
cmp bsize, 0
je GenerateBlock_Success
-
+
GenerateBlock_Failure:
xor rax, rax
mov al, RDSEED_FAILURE
ret
-
+
GenerateBlock_Success:
xor rax, rax