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
| /**
* vmx-crypto AES encrypt/OpenSSL aes encryption
* At kernel: /drivers/crypto/vmx/aesp8-ppc.S
* At OpenSSL: /crypto/aes/aesp8-ppc.s
**/
.aes_p8_encrypt:
lwz 6,240(5)
lis 0,0xfc00
mfspr 12,256
li 7,15
mtspr 256,0
lvx 0,0,3
neg 11,4
lvx 1,7,3
lvsl 2,0,3
lvsl 3,0,11
li 7,16
vperm 0,0,1,2
lvx 1,0,5
lvsl 5,0,5
srwi 6,6,1
lvx 2,7,5
addi 7,7,16
subi 6,6,1
vperm 1,1,2,5
vxor 0,0,1
lvx 1,7,5
addi 7,7,16
mtctr 6
.Loop_enc:
vperm 2,2,1,5
vcipher 0,0,2
lvx 2,7,5
addi 7,7,16
vperm 1,1,2,5
vcipher 0,0,1
lvx 1,7,5
addi 7,7,16
bdnz .Loop_enc
vperm 2,2,1,5
vcipher 0,0,2
lvx 2,7,5
vperm 1,1,2,5
vcipherlast 0,0,1
vspltisb 2,-1
vxor 1,1,1
li 7,15
vperm 2,1,2,3
lvx 1,0,4
vperm 0,0,0,3
vsel 1,1,0,2
lvx 4,7,4
stvx 1,0,4
vsel 0,0,4,2
stvx 0,7,4
mtspr 256,12
blr
/**
* vmx-crypto AES decrypt
* At kernel: /drivers/crypto/vmx/aesp8-ppc.S
* At OpenSSL: /crypto/aes/aesp8-ppc.s
**/
.aes_p8_decrypt:
lwz 6,240(5)
lis 0,0xfc00
mfspr 12,256
li 7,15
mtspr 256,0
lvx 0,0,3
neg 11,4
lvx 1,7,3
lvsl 2,0,3
lvsl 3,0,11
li 7,16
vperm 0,0,1,2
lvx 1,0,5
lvsl 5,0,5
srwi 6,6,1
lvx 2,7,5
addi 7,7,16
subi 6,6,1
vperm 1,1,2,5
vxor 0,0,1
lvx 1,7,5
addi 7,7,16
mtctr 6
.Loop_dec:
vperm 2,2,1,5
vncipher 0,0,2
lvx 2,7,5
addi 7,7,16
vperm 1,1,2,5
vncipher 0,0,1
lvx 1,7,5
addi 7,7,16
bdnz .Loop_dec
vperm 2,2,1,5
vncipher 0,0,2
lvx 2,7,5
vperm 1,1,2,5
vncipherlast 0,0,1
vspltisb 2,-1
vxor 1,1,1
li 7,15
vperm 2,1,2,3
lvx 1,0,4
vperm 0,0,0,3
vsel 1,1,0,2
lvx 4,7,4
stvx 1,0,4
vsel 0,0,4,2
stvx 0,7,4
mtspr 256,12
blr
|