aeskeys_amd64.S (219178) | aeskeys_amd64.S (255187) |
---|---|
1/*- 2* The white paper of AES-NI instructions can be downloaded from: 3 * http://softwarecommunity.intel.com/isn/downloads/intelavx/AES-Instructions-Set_WP.pdf 4 * 5 * Copyright (C) 2008-2010, Intel Corporation 6 * Author: Huang Ying <ying.huang@intel.com> 7 * Vinodh Gopal <vinodh.gopal@intel.com> 8 * Kahraman Akdemir --- 111 unchanged lines hidden (view full) --- 120 addq $0x10,%rsi # key addr 121 pxor %xmm4,%xmm4 # xmm4 is assumed 0 in _key_expansion_x 122 cmpl $12,%edx 123 jb .Lenc_key128 124 je .Lenc_key192 125 movups 0x10(%rdi),%xmm2 # other user key 126 movaps %xmm2,(%rsi) 127 addq $0x10,%rsi | 1/*- 2* The white paper of AES-NI instructions can be downloaded from: 3 * http://softwarecommunity.intel.com/isn/downloads/intelavx/AES-Instructions-Set_WP.pdf 4 * 5 * Copyright (C) 2008-2010, Intel Corporation 6 * Author: Huang Ying <ying.huang@intel.com> 7 * Vinodh Gopal <vinodh.gopal@intel.com> 8 * Kahraman Akdemir --- 111 unchanged lines hidden (view full) --- 120 addq $0x10,%rsi # key addr 121 pxor %xmm4,%xmm4 # xmm4 is assumed 0 in _key_expansion_x 122 cmpl $12,%edx 123 jb .Lenc_key128 124 je .Lenc_key192 125 movups 0x10(%rdi),%xmm2 # other user key 126 movaps %xmm2,(%rsi) 127 addq $0x10,%rsi |
128// aeskeygenassist $0x1,%xmm2,%xmm1 # round 1 129 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x01 | 128 aeskeygenassist $0x1,%xmm2,%xmm1 # round 1 |
130 call _key_expansion_256a | 129 call _key_expansion_256a |
131// aeskeygenassist $0x1,%xmm0,%xmm1 132 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x01 | 130 aeskeygenassist $0x1,%xmm0,%xmm1 |
133 call _key_expansion_256b | 131 call _key_expansion_256b |
134// aeskeygenassist $0x2,%xmm2,%xmm1 # round 2 135 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x02 | 132 aeskeygenassist $0x2,%xmm2,%xmm1 # round 2 |
136 call _key_expansion_256a | 133 call _key_expansion_256a |
137// aeskeygenassist $0x2,%xmm0,%xmm1 138 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x02 | 134 aeskeygenassist $0x2,%xmm0,%xmm1 |
139 call _key_expansion_256b | 135 call _key_expansion_256b |
140// aeskeygenassist $0x4,%xmm2,%xmm1 # round 3 141 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x04 | 136 aeskeygenassist $0x4,%xmm2,%xmm1 # round 3 |
142 call _key_expansion_256a | 137 call _key_expansion_256a |
143// aeskeygenassist $0x4,%xmm0,%xmm1 144 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x04 | 138 aeskeygenassist $0x4,%xmm0,%xmm1 |
145 call _key_expansion_256b | 139 call _key_expansion_256b |
146// aeskeygenassist $0x8,%xmm2,%xmm1 # round 4 147 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x08 | 140 aeskeygenassist $0x8,%xmm2,%xmm1 # round 4 |
148 call _key_expansion_256a | 141 call _key_expansion_256a |
149// aeskeygenassist $0x8,%xmm0,%xmm1 150 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x08 | 142 aeskeygenassist $0x8,%xmm0,%xmm1 |
151 call _key_expansion_256b | 143 call _key_expansion_256b |
152// aeskeygenassist $0x10,%xmm2,%xmm1 # round 5 153 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x10 | 144 aeskeygenassist $0x10,%xmm2,%xmm1 # round 5 |
154 call _key_expansion_256a | 145 call _key_expansion_256a |
155// aeskeygenassist $0x10,%xmm0,%xmm1 156 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x10 | 146 aeskeygenassist $0x10,%xmm0,%xmm1 |
157 call _key_expansion_256b | 147 call _key_expansion_256b |
158// aeskeygenassist $0x20,%xmm2,%xmm1 # round 6 159 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x20 | 148 aeskeygenassist $0x20,%xmm2,%xmm1 # round 6 |
160 call _key_expansion_256a | 149 call _key_expansion_256a |
161// aeskeygenassist $0x20,%xmm0,%xmm1 162 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x20 | 150 aeskeygenassist $0x20,%xmm0,%xmm1 |
163 call _key_expansion_256b | 151 call _key_expansion_256b |
164// aeskeygenassist $0x40,%xmm2,%xmm1 # round 7 165 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x40 | 152 aeskeygenassist $0x40,%xmm2,%xmm1 # round 7 |
166 call _key_expansion_256a 167 retq 168.Lenc_key192: 169 movq 0x10(%rdi),%xmm2 # other user key | 153 call _key_expansion_256a 154 retq 155.Lenc_key192: 156 movq 0x10(%rdi),%xmm2 # other user key |
170// aeskeygenassist $0x1,%xmm2,%xmm1 # round 1 171 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x01 | 157 aeskeygenassist $0x1,%xmm2,%xmm1 # round 1 |
172 call _key_expansion_192a | 158 call _key_expansion_192a |
173// aeskeygenassist $0x2,%xmm2,%xmm1 # round 2 174 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x02 | 159 aeskeygenassist $0x2,%xmm2,%xmm1 # round 2 |
175 call _key_expansion_192b | 160 call _key_expansion_192b |
176// aeskeygenassist $0x4,%xmm2,%xmm1 # round 3 177 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x04 | 161 aeskeygenassist $0x4,%xmm2,%xmm1 # round 3 |
178 call _key_expansion_192a | 162 call _key_expansion_192a |
179// aeskeygenassist $0x8,%xmm2,%xmm1 # round 4 180 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x08 | 163 aeskeygenassist $0x8,%xmm2,%xmm1 # round 4 |
181 call _key_expansion_192b | 164 call _key_expansion_192b |
182// aeskeygenassist $0x10,%xmm2,%xmm1 # round 5 183 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x10 | 165 aeskeygenassist $0x10,%xmm2,%xmm1 # round 5 |
184 call _key_expansion_192a | 166 call _key_expansion_192a |
185// aeskeygenassist $0x20,%xmm2,%xmm1 # round 6 186 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x20 | 167 aeskeygenassist $0x20,%xmm2,%xmm1 # round 6 |
187 call _key_expansion_192b | 168 call _key_expansion_192b |
188// aeskeygenassist $0x40,%xmm2,%xmm1 # round 7 189 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x40 | 169 aeskeygenassist $0x40,%xmm2,%xmm1 # round 7 |
190 call _key_expansion_192a | 170 call _key_expansion_192a |
191// aeskeygenassist $0x80,%xmm2,%xmm1 # round 8 192 .byte 0x66,0x0f,0x3a,0xdf,0xca,0x80 | 171 aeskeygenassist $0x80,%xmm2,%xmm1 # round 8 |
193 call _key_expansion_192b 194 retq 195.Lenc_key128: | 172 call _key_expansion_192b 173 retq 174.Lenc_key128: |
196// aeskeygenassist $0x1,%xmm0,%xmm1 # round 1 197 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x01 | 175 aeskeygenassist $0x1,%xmm0,%xmm1 # round 1 |
198 call _key_expansion_128 | 176 call _key_expansion_128 |
199// aeskeygenassist $0x2,%xmm0,%xmm1 # round 2 200 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x02 | 177 aeskeygenassist $0x2,%xmm0,%xmm1 # round 2 |
201 call _key_expansion_128 | 178 call _key_expansion_128 |
202// aeskeygenassist $0x4,%xmm0,%xmm1 # round 3 203 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x04 | 179 aeskeygenassist $0x4,%xmm0,%xmm1 # round 3 |
204 call _key_expansion_128 | 180 call _key_expansion_128 |
205// aeskeygenassist $0x8,%xmm0,%xmm1 # round 4 206 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x08 | 181 aeskeygenassist $0x8,%xmm0,%xmm1 # round 4 |
207 call _key_expansion_128 | 182 call _key_expansion_128 |
208// aeskeygenassist $0x10,%xmm0,%xmm1 # round 5 209 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x10 | 183 aeskeygenassist $0x10,%xmm0,%xmm1 # round 5 |
210 call _key_expansion_128 | 184 call _key_expansion_128 |
211// aeskeygenassist $0x20,%xmm0,%xmm1 # round 6 212 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x20 | 185 aeskeygenassist $0x20,%xmm0,%xmm1 # round 6 |
213 call _key_expansion_128 | 186 call _key_expansion_128 |
214// aeskeygenassist $0x40,%xmm0,%xmm1 # round 7 215 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x40 | 187 aeskeygenassist $0x40,%xmm0,%xmm1 # round 7 |
216 call _key_expansion_128 | 188 call _key_expansion_128 |
217// aeskeygenassist $0x80,%xmm0,%xmm1 # round 8 218 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x80 | 189 aeskeygenassist $0x80,%xmm0,%xmm1 # round 8 |
219 call _key_expansion_128 | 190 call _key_expansion_128 |
220// aeskeygenassist $0x1b,%xmm0,%xmm1 # round 9 221 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x1b | 191 aeskeygenassist $0x1b,%xmm0,%xmm1 # round 9 |
222 call _key_expansion_128 | 192 call _key_expansion_128 |
223// aeskeygenassist $0x36,%xmm0,%xmm1 # round 10 224 .byte 0x66,0x0f,0x3a,0xdf,0xc8,0x36 | 193 aeskeygenassist $0x36,%xmm0,%xmm1 # round 10 |
225 call _key_expansion_128 226 retq 227 .cfi_endproc 228END(aesni_set_enckey) 229 230ENTRY(aesni_set_deckey) 231 .cfi_startproc 232 movslq %edx,%rax 233 shlq $4,%rax 234 addq %rax,%rdi 235 movdqa (%rdi),%xmm0 236 movdqa %xmm0,(%rsi) 237 decl %edx 2381: 239 addq $0x10,%rsi 240 subq $0x10,%rdi | 194 call _key_expansion_128 195 retq 196 .cfi_endproc 197END(aesni_set_enckey) 198 199ENTRY(aesni_set_deckey) 200 .cfi_startproc 201 movslq %edx,%rax 202 shlq $4,%rax 203 addq %rax,%rdi 204 movdqa (%rdi),%xmm0 205 movdqa %xmm0,(%rsi) 206 decl %edx 2071: 208 addq $0x10,%rsi 209 subq $0x10,%rdi |
241// aesimc (%rdi),%xmm1 242 .byte 0x66,0x0f,0x38,0xdb,0x0f | 210 aesimc (%rdi),%xmm1 |
243 movdqa %xmm1,(%rsi) 244 decl %edx 245 jne 1b 246 247 addq $0x10,%rsi 248 subq $0x10,%rdi 249 movdqa (%rdi),%xmm0 250 movdqa %xmm0,(%rsi) 251 retq 252 .cfi_endproc 253END(aesni_set_deckey) 254 | 211 movdqa %xmm1,(%rsi) 212 decl %edx 213 jne 1b 214 215 addq $0x10,%rsi 216 subq $0x10,%rdi 217 movdqa (%rdi),%xmm0 218 movdqa %xmm0,(%rsi) 219 retq 220 .cfi_endproc 221END(aesni_set_deckey) 222 |
255 .ident "$FreeBSD: head/sys/crypto/aesni/aeskeys_amd64.S 219178 2011-03-02 14:56:58Z kib $" | 223 .ident "$FreeBSD: head/sys/crypto/aesni/aeskeys_amd64.S 255187 2013-09-03 18:31:23Z jmg $" |