1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
2010-11-10 Francisco Blas Izquierdo Riera <klondike@xiscosoft.es>
#285703
* src/sha1-sse2.S: Add support for x86 and AMD64
This patch is licensed uder the same LICENSE as aircrack-ng
diff -ru aircrack-ng-1.1.old/src/sha1-sse2.S aircrack-ng-1.1/src/sha1-sse2.S
--- aircrack-ng-1.1.old/src/sha1-sse2.S 2010-01-22 02:01:28.000000000 +0100
+++ aircrack-ng-1.1/src/sha1-sse2.S 2011-02-26 06:22:37.061208191 +0100
@@ -8,9 +8,36 @@
// input blocks must be (four bytes) interleaved.
#if defined(__x86_64__) && defined(__APPLE__)
+#define PRELOAD(x)
#define MANGLE(x) x(%rip)
+#define INIT_PIC()
+#define END_PIC()
#else
+#ifdef __PIC__
+
+#ifdef __x86_64__
+#define PRELOAD(x) movq x@GOTPCREL(%rip), %rbx;
+#define MANGLE(x) (%rbx)
+#define INIT_PIC() pushq %rbx
+#define END_PIC() popq %rbx
+#else
+#undef __i686 /* gcc builtin define gets in our way */
+#define PRELOAD(x)
+#define MANGLE(x) x ## @GOTOFF(%ebx)
+#define INIT_PIC() \
+ call __i686.get_pc_thunk.bx ; \
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+#define END_PIC()
+#endif
+
+#else
+
+#define PRELOAD(x)
#define MANGLE(x) x
+#define INIT_PIC()
+#define END_PIC()
+
+#endif
#endif
#if defined(__i386__) || defined(__x86_64__)
@@ -142,12 +169,15 @@
paddd tmp2, e; \
movdqa b, tmp2; \
pslld $30, b; \
+ PRELOAD(k) \
paddd MANGLE(k), e; \
psrld $2, tmp2; \
por tmp2, b; \
movdqa (data*16)(edx_rsi), tmp1; \
movdqa tmp1, tmp2; \
+ PRELOAD(const_ff00) \
pand MANGLE(const_ff00), tmp1; \
+ PRELOAD(const_00ff) \
pand MANGLE(const_00ff), tmp2; \
psrld $8, tmp1; \
pslld $8, tmp2; \
@@ -181,6 +211,7 @@
paddd tmp2, e; \
movdqa b, tmp2; \
pslld $30, b; \
+ PRELOAD(k) \
paddd MANGLE(k), e; \
psrld $2, tmp2; \
por tmp2, b;
@@ -192,10 +223,16 @@
shasse2_init:
_shasse2_init:
+ INIT_PIC()
+ PRELOAD(const_init_a)
movdqa MANGLE(const_init_a), ctxa
+ PRELOAD(const_init_b)
movdqa MANGLE(const_init_b), ctxb
+ PRELOAD(const_init_c)
movdqa MANGLE(const_init_c), ctxc
+ PRELOAD(const_init_d)
movdqa MANGLE(const_init_d), ctxd
+ PRELOAD(const_init_e)
movdqa MANGLE(const_init_e), ctxe
movdqa ctxa, 0(eax_rdi)
@@ -203,6 +240,7 @@
movdqa ctxc, 32(eax_rdi)
movdqa ctxd, 48(eax_rdi)
movdqa ctxe, 64(eax_rdi)
+ END_PIC()
ret
@@ -212,17 +250,20 @@
shasse2_ends:
_shasse2_ends:
- movdqa 0(eax_rdi), ctxa
+ INIT_PIC()
+ movdqa 0(eax_rdi), ctxa
movdqa 16(eax_rdi), ctxb
movdqa 32(eax_rdi), ctxc
movdqa 48(eax_rdi), ctxd
movdqa 64(eax_rdi), ctxe
+ PRELOAD(const_ff00)
movdqa MANGLE(const_ff00), tmp3
movdqa ctxa, tmp1
movdqa ctxb, tmp2
pand tmp3, ctxa
pand tmp3, ctxb
+ PRELOAD(const_00ff)
movdqa MANGLE(const_00ff), tmp3
pand tmp3, tmp1
pand tmp3, tmp2
@@ -243,6 +284,7 @@
movdqa ctxa, 0(edx_rsi)
movdqa ctxb, 16(edx_rsi)
+ PRELOAD(const_ff00)
movdqa MANGLE(const_ff00), tmp5
movdqa ctxc, tmp1
movdqa ctxd, tmp2
@@ -250,6 +292,7 @@
pand tmp5, ctxc
pand tmp5, ctxd
pand tmp5, ctxe
+ PRELOAD(const_00ff)
movdqa MANGLE(const_00ff), tmp5
pand tmp5, tmp1
pand tmp5, tmp2
@@ -279,6 +322,7 @@
movdqa ctxc, 32(edx_rsi)
movdqa ctxd, 48(edx_rsi)
movdqa ctxe, 64(edx_rsi)
+ END_PIC()
ret
@@ -289,6 +333,7 @@
shasse2_data:
_shasse2_data:
+ INIT_PIC()
movdqa 0(eax_rdi), ctxa
movdqa 16(eax_rdi), ctxb
movdqa 32(eax_rdi), ctxc
@@ -400,6 +445,7 @@
movdqa ctxc, 32(eax_rdi)
movdqa ctxd, 48(eax_rdi)
movdqa ctxe, 64(eax_rdi)
+ END_PIC()
ret
@@ -462,6 +508,17 @@
pop %ebx
#endif
ret
+#ifdef __i386__
+#ifdef __PIC__
+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
+.globl __i686.get_pc_thunk.bx
+ .hidden __i686.get_pc_thunk.bx
+ .type __i686.get_pc_thunk.bx,@function
+__i686.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+#endif
+#endif
#endif
|