• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1default	rel
2%define XMMWORD
3%define YMMWORD
4%define ZMMWORD
5section	.text code align=64
6
7
8
9
10
11global	CRYPTO_rdrand
12
13ALIGN	16
14CRYPTO_rdrand:
15	mov	QWORD[8+rsp],rdi	;WIN64 prologue
16	mov	QWORD[16+rsp],rsi
17	mov	rax,rsp
18$L$SEH_begin_CRYPTO_rdrand:
19	mov	rdi,rcx
20
21
22	xor	rax,rax
23
24
25DB	0x48,0x0f,0xc7,0xf1
26
27	adc	rax,rax
28	mov	QWORD[rdi],rcx
29	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
30	mov	rsi,QWORD[16+rsp]
31	DB	0F3h,0C3h		;repret
32
33
34
35
36
37global	CRYPTO_rdrand_multiple8_buf
38
39ALIGN	16
40CRYPTO_rdrand_multiple8_buf:
41	mov	QWORD[8+rsp],rdi	;WIN64 prologue
42	mov	QWORD[16+rsp],rsi
43	mov	rax,rsp
44$L$SEH_begin_CRYPTO_rdrand_multiple8_buf:
45	mov	rdi,rcx
46	mov	rsi,rdx
47
48
49	test	rsi,rsi
50	jz	NEAR $L$out
51	mov	rdx,8
52$L$loop:
53
54
55DB	0x48,0x0f,0xc7,0xf1
56	jnc	NEAR $L$err
57	mov	QWORD[rdi],rcx
58	add	rdi,rdx
59	sub	rsi,rdx
60	jnz	NEAR $L$loop
61$L$out:
62	mov	rax,1
63	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
64	mov	rsi,QWORD[16+rsp]
65	DB	0F3h,0C3h		;repret
66$L$err:
67	xor	rax,rax
68	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
69	mov	rsi,QWORD[16+rsp]
70	DB	0F3h,0C3h		;repret
71