1ifndef X64
2.686p
3.XMM
4.model flat, C
5endif
6
7.code
8
9rust_crypto_util_supports_aesni PROC public
10  ; Return false since the AES-NI function have not been
11  ; converted to assembly
12  xor eax, eax
13  ret
14rust_crypto_util_supports_aesni ENDP
15
16; The rust_crypto_util_fixed_time_eq_asm for X86-64
17ifdef X64
18rust_crypto_util_fixed_time_eq_asm PROC public lhs:QWORD, rhs:QWORD, count:QWORD
19  ; lhs is in RCX
20  ; rhs is in RDX
21  ; count is in R8
22
23  ; set the return value initially to 0
24  xor eax, eax
25
26  test r8, r8
27  jz DONE
28
29  BEGIN:
30
31  mov r10b, [rcx]
32  xor r10b, [rdx]
33  or al, r10b
34
35  inc rcx
36  inc rdx
37  dec r8
38  jnz BEGIN
39
40  DONE:
41
42  ret
43rust_crypto_util_fixed_time_eq_asm ENDP
44endif
45
46; The rust_crypto_util_fixed_time_eq_asm for X86 (32-bit)
47ifndef X64
48rust_crypto_util_fixed_time_eq_asm PROC public lhs:DWORD, rhs:DWORD, count:DWORD
49  push ebx
50  push esi
51
52  mov ecx, lhs
53  mov edx, rhs
54  mov esi, count
55
56  xor eax, eax
57
58  test esi, esi
59  jz DONE
60
61  BEGIN:
62
63  mov bl, [ecx]
64  xor bl, [edx]
65  or al, bl
66
67  inc ecx
68  inc edx
69  dec esi
70  jnz BEGIN
71
72  DONE:
73
74  pop esi
75  pop ebx
76
77  ret
78rust_crypto_util_fixed_time_eq_asm ENDP
79endif
80
81ifdef X64
82rust_crypto_util_secure_memset PROC public dst:QWORD, val:BYTE, count:QWORD
83  ; dst is in RCX
84  ; val is in RDX
85  ; count is in R8
86
87  test r8, r8
88  jz DONE
89
90  BEGIN:
91
92  mov [rcx], dl
93  inc rcx
94  dec r8
95  jnz BEGIN
96
97  DONE:
98
99  ret
100rust_crypto_util_secure_memset ENDP
101endif
102
103ifndef X64
104rust_crypto_util_secure_memset PROC public dst:DWORD, val:BYTE, count:DWORD
105  mov eax, dst
106  mov cl, val
107  mov edx, count
108
109  test edx, edx
110  jz DONE
111
112  BEGIN:
113
114  mov [eax], cl
115  inc eax
116  dec edx
117  jnz BEGIN
118
119  DONE:
120
121  ret
122rust_crypto_util_secure_memset ENDP
123endif
124
125end
126
127