diff options
author | David S. Miller <davem@davemloft.net> | 2012-08-29 17:49:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-08-29 17:49:23 -0400 |
commit | 9fd130ecbe97f3440d14d3d0c6660413e69ac532 (patch) | |
tree | 4f9c108e6a4c305e61e4d7d7044af6822741a15e /arch/sparc/crypto/aes_asm.S | |
parent | 0bdcaf7495726688a93a2f7226e9b4beaeabd2ec (diff) |
sparc64: Add ctr mode support to AES driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/crypto/aes_asm.S')
-rw-r--r-- | arch/sparc/crypto/aes_asm.S | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/arch/sparc/crypto/aes_asm.S b/arch/sparc/crypto/aes_asm.S index 50faae03c592..7a975d689919 100644 --- a/arch/sparc/crypto/aes_asm.S +++ b/arch/sparc/crypto/aes_asm.S | |||
@@ -44,6 +44,8 @@ | |||
44 | .word 0x85b02307; | 44 | .word 0x85b02307; |
45 | #define MOVXTOD_O0_F0 \ | 45 | #define MOVXTOD_O0_F0 \ |
46 | .word 0x81b02308; | 46 | .word 0x81b02308; |
47 | #define MOVXTOD_O5_F0 \ | ||
48 | .word 0x81b0230d; | ||
47 | #define MOVXTOD_O5_F2 \ | 49 | #define MOVXTOD_O5_F2 \ |
48 | .word 0x85b0230d; | 50 | .word 0x85b0230d; |
49 | 51 | ||
@@ -1137,3 +1139,96 @@ ENTRY(aes_sparc64_cbc_decrypt_256) | |||
1137 | retl | 1139 | retl |
1138 | nop | 1140 | nop |
1139 | ENDPROC(aes_sparc64_cbc_decrypt_256) | 1141 | ENDPROC(aes_sparc64_cbc_decrypt_256) |
1142 | |||
1143 | .align 32 | ||
1144 | ENTRY(aes_sparc64_ctr_crypt_128) | ||
1145 | /* %o0=key, %o1=input, %o2=output, %o3=len, %o4=IV */ | ||
1146 | ldx [%o4 + 0x00], %g3 | ||
1147 | ldx [%o4 + 0x08], %g7 | ||
1148 | ldx [%o0 + 0x00], %g1 | ||
1149 | ldx [%o0 + 0x08], %g2 | ||
1150 | 1: xor %g1, %g3, %o5 | ||
1151 | MOVXTOD_O5_F0 | ||
1152 | xor %g2, %g7, %o5 | ||
1153 | MOVXTOD_O5_F2 | ||
1154 | add %g7, 1, %g7 | ||
1155 | add %g3, 1, %o5 | ||
1156 | movrz %g7, %o5, %g3 | ||
1157 | ENCRYPT_128(8, 0, 2, 4, 6) | ||
1158 | ldd [%o1 + 0x00], %f4 | ||
1159 | ldd [%o1 + 0x08], %f6 | ||
1160 | fxor %f4, %f0, %f4 | ||
1161 | fxor %f6, %f2, %f6 | ||
1162 | std %f4, [%o2 + 0x00] | ||
1163 | std %f6, [%o2 + 0x08] | ||
1164 | subcc %o3, 0x10, %o3 | ||
1165 | add %o1, 0x10, %o1 | ||
1166 | bne,pt %xcc, 1b | ||
1167 | add %o2, 0x10, %o2 | ||
1168 | stx %g3, [%o4 + 0x00] | ||
1169 | stx %g7, [%o4 + 0x08] | ||
1170 | retl | ||
1171 | nop | ||
1172 | ENDPROC(aes_sparc64_ctr_crypt_128) | ||
1173 | |||
1174 | .align 32 | ||
1175 | ENTRY(aes_sparc64_ctr_crypt_192) | ||
1176 | /* %o0=key, %o1=input, %o2=output, %o3=len, %o4=IV */ | ||
1177 | ldx [%o4 + 0x00], %g3 | ||
1178 | ldx [%o4 + 0x08], %g7 | ||
1179 | ldx [%o0 + 0x00], %g1 | ||
1180 | ldx [%o0 + 0x08], %g2 | ||
1181 | 1: xor %g1, %g3, %o5 | ||
1182 | MOVXTOD_O5_F0 | ||
1183 | xor %g2, %g7, %o5 | ||
1184 | MOVXTOD_O5_F2 | ||
1185 | add %g7, 1, %g7 | ||
1186 | add %g3, 1, %o5 | ||
1187 | movrz %g7, %o5, %g3 | ||
1188 | ENCRYPT_192(8, 0, 2, 4, 6) | ||
1189 | ldd [%o1 + 0x00], %f4 | ||
1190 | ldd [%o1 + 0x08], %f6 | ||
1191 | fxor %f4, %f0, %f4 | ||
1192 | fxor %f6, %f2, %f6 | ||
1193 | std %f4, [%o2 + 0x00] | ||
1194 | std %f6, [%o2 + 0x08] | ||
1195 | subcc %o3, 0x10, %o3 | ||
1196 | add %o1, 0x10, %o1 | ||
1197 | bne,pt %xcc, 1b | ||
1198 | add %o2, 0x10, %o2 | ||
1199 | stx %g3, [%o4 + 0x00] | ||
1200 | stx %g7, [%o4 + 0x08] | ||
1201 | retl | ||
1202 | nop | ||
1203 | ENDPROC(aes_sparc64_ctr_crypt_192) | ||
1204 | |||
1205 | .align 32 | ||
1206 | ENTRY(aes_sparc64_ctr_crypt_256) | ||
1207 | /* %o0=key, %o1=input, %o2=output, %o3=len, %o4=IV */ | ||
1208 | ldx [%o4 + 0x00], %g3 | ||
1209 | ldx [%o4 + 0x08], %g7 | ||
1210 | ldx [%o0 + 0x00], %g1 | ||
1211 | ldx [%o0 + 0x08], %g2 | ||
1212 | 1: xor %g1, %g3, %o5 | ||
1213 | MOVXTOD_O5_F0 | ||
1214 | xor %g2, %g7, %o5 | ||
1215 | MOVXTOD_O5_F2 | ||
1216 | add %g7, 1, %g7 | ||
1217 | add %g3, 1, %o5 | ||
1218 | movrz %g7, %o5, %g3 | ||
1219 | ENCRYPT_256(8, 0, 2, 4, 6) | ||
1220 | ldd [%o1 + 0x00], %f4 | ||
1221 | ldd [%o1 + 0x08], %f6 | ||
1222 | fxor %f4, %f0, %f4 | ||
1223 | fxor %f6, %f2, %f6 | ||
1224 | std %f4, [%o2 + 0x00] | ||
1225 | std %f6, [%o2 + 0x08] | ||
1226 | subcc %o3, 0x10, %o3 | ||
1227 | add %o1, 0x10, %o1 | ||
1228 | bne,pt %xcc, 1b | ||
1229 | add %o2, 0x10, %o2 | ||
1230 | stx %g3, [%o4 + 0x00] | ||
1231 | stx %g7, [%o4 + 0x08] | ||
1232 | retl | ||
1233 | nop | ||
1234 | ENDPROC(aes_sparc64_ctr_crypt_256) | ||