diff options
44 files changed, 8684 insertions, 2049 deletions
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile index 3537d4b91f74..2b0b9631474b 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile | |||
| @@ -5,12 +5,14 @@ | |||
| 5 | obj-$(CONFIG_CRYPTO_AES_586) += aes-i586.o | 5 | obj-$(CONFIG_CRYPTO_AES_586) += aes-i586.o |
| 6 | obj-$(CONFIG_CRYPTO_TWOFISH_586) += twofish-i586.o | 6 | obj-$(CONFIG_CRYPTO_TWOFISH_586) += twofish-i586.o |
| 7 | obj-$(CONFIG_CRYPTO_SALSA20_586) += salsa20-i586.o | 7 | obj-$(CONFIG_CRYPTO_SALSA20_586) += salsa20-i586.o |
| 8 | obj-$(CONFIG_CRYPTO_SERPENT_SSE2_586) += serpent-sse2-i586.o | ||
| 8 | 9 | ||
| 9 | obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o | 10 | obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o |
| 10 | obj-$(CONFIG_CRYPTO_BLOWFISH_X86_64) += blowfish-x86_64.o | 11 | obj-$(CONFIG_CRYPTO_BLOWFISH_X86_64) += blowfish-x86_64.o |
| 11 | obj-$(CONFIG_CRYPTO_TWOFISH_X86_64) += twofish-x86_64.o | 12 | obj-$(CONFIG_CRYPTO_TWOFISH_X86_64) += twofish-x86_64.o |
| 12 | obj-$(CONFIG_CRYPTO_TWOFISH_X86_64_3WAY) += twofish-x86_64-3way.o | 13 | obj-$(CONFIG_CRYPTO_TWOFISH_X86_64_3WAY) += twofish-x86_64-3way.o |
| 13 | obj-$(CONFIG_CRYPTO_SALSA20_X86_64) += salsa20-x86_64.o | 14 | obj-$(CONFIG_CRYPTO_SALSA20_X86_64) += salsa20-x86_64.o |
| 15 | obj-$(CONFIG_CRYPTO_SERPENT_SSE2_X86_64) += serpent-sse2-x86_64.o | ||
| 14 | obj-$(CONFIG_CRYPTO_AES_NI_INTEL) += aesni-intel.o | 16 | obj-$(CONFIG_CRYPTO_AES_NI_INTEL) += aesni-intel.o |
| 15 | obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) += ghash-clmulni-intel.o | 17 | obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) += ghash-clmulni-intel.o |
| 16 | 18 | ||
| @@ -20,12 +22,14 @@ obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o | |||
| 20 | aes-i586-y := aes-i586-asm_32.o aes_glue.o | 22 | aes-i586-y := aes-i586-asm_32.o aes_glue.o |
| 21 | twofish-i586-y := twofish-i586-asm_32.o twofish_glue.o | 23 | twofish-i586-y := twofish-i586-asm_32.o twofish_glue.o |
| 22 | salsa20-i586-y := salsa20-i586-asm_32.o salsa20_glue.o | 24 | salsa20-i586-y := salsa20-i586-asm_32.o salsa20_glue.o |
| 25 | serpent-sse2-i586-y := serpent-sse2-i586-asm_32.o serpent_sse2_glue.o | ||
| 23 | 26 | ||
| 24 | aes-x86_64-y := aes-x86_64-asm_64.o aes_glue.o | 27 | aes-x86_64-y := aes-x86_64-asm_64.o aes_glue.o |
| 25 | blowfish-x86_64-y := blowfish-x86_64-asm_64.o blowfish_glue.o | 28 | blowfish-x86_64-y := blowfish-x86_64-asm_64.o blowfish_glue.o |
| 26 | twofish-x86_64-y := twofish-x86_64-asm_64.o twofish_glue.o | 29 | twofish-x86_64-y := twofish-x86_64-asm_64.o twofish_glue.o |
| 27 | twofish-x86_64-3way-y := twofish-x86_64-asm_64-3way.o twofish_glue_3way.o | 30 | twofish-x86_64-3way-y := twofish-x86_64-asm_64-3way.o twofish_glue_3way.o |
| 28 | salsa20-x86_64-y := salsa20-x86_64-asm_64.o salsa20_glue.o | 31 | salsa20-x86_64-y := salsa20-x86_64-asm_64.o salsa20_glue.o |
| 32 | serpent-sse2-x86_64-y := serpent-sse2-x86_64-asm_64.o serpent_sse2_glue.o | ||
| 29 | 33 | ||
| 30 | aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o | 34 | aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o |
| 31 | 35 | ||
diff --git a/arch/x86/crypto/serpent-sse2-i586-asm_32.S b/arch/x86/crypto/serpent-sse2-i586-asm_32.S new file mode 100644 index 000000000000..4e37677ca851 --- /dev/null +++ b/arch/x86/crypto/serpent-sse2-i586-asm_32.S | |||
| @@ -0,0 +1,638 @@ | |||
| 1 | /* | ||
| 2 | * Serpent Cipher 4-way parallel algorithm (i586/SSE2) | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | ||
| 5 | * | ||
| 6 | * Based on crypto/serpent.c by | ||
| 7 | * Copyright (C) 2002 Dag Arne Osvik <osvik@ii.uib.no> | ||
| 8 | * 2003 Herbert Valerio Riedel <hvr@gnu.org> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License as published by | ||
| 12 | * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | * (at your option) any later version. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, | ||
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | * GNU General Public License for more details. | ||
| 19 | * | ||
| 20 | * You should have received a copy of the GNU General Public License | ||
| 21 | * along with this program; if not, write to the Free Software | ||
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
| 23 | * USA | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | |||
| 27 | .file "serpent-sse2-i586-asm_32.S" | ||
| 28 | .text | ||
| 29 | |||
| 30 | #define arg_ctx 4 | ||
| 31 | #define arg_dst 8 | ||
| 32 | #define arg_src 12 | ||
| 33 | #define arg_xor 16 | ||
| 34 | |||
| 35 | /********************************************************************** | ||
| 36 | 4-way SSE2 serpent | ||
| 37 | **********************************************************************/ | ||
| 38 | #define CTX %edx | ||
| 39 | |||
| 40 | #define RA %xmm0 | ||
| 41 | #define RB %xmm1 | ||
| 42 | #define RC %xmm2 | ||
| 43 | #define RD %xmm3 | ||
| 44 | #define RE %xmm4 | ||
| 45 | |||
| 46 | #define RT0 %xmm5 | ||
| 47 | #define RT1 %xmm6 | ||
| 48 | |||
| 49 | #define RNOT %xmm7 | ||
| 50 | |||
| 51 | #define get_key(i, j, t) \ | ||
| 52 | movd (4*(i)+(j))*4(CTX), t; \ | ||
| 53 | pshufd $0, t, t; | ||
| 54 | |||
| 55 | #define K(x0, x1, x2, x3, x4, i) \ | ||
| 56 | get_key(i, 0, x4); \ | ||
| 57 | get_key(i, 1, RT0); \ | ||
| 58 | get_key(i, 2, RT1); \ | ||
| 59 | pxor x4, x0; \ | ||
| 60 | pxor RT0, x1; \ | ||
| 61 | pxor RT1, x2; \ | ||
| 62 | get_key(i, 3, x4); \ | ||
| 63 | pxor x4, x3; | ||
| 64 | |||
| 65 | #define LK(x0, x1, x2, x3, x4, i) \ | ||
| 66 | movdqa x0, x4; \ | ||
| 67 | pslld $13, x0; \ | ||
| 68 | psrld $(32 - 13), x4; \ | ||
| 69 | por x4, x0; \ | ||
| 70 | pxor x0, x1; \ | ||
| 71 | movdqa x2, x4; \ | ||
| 72 | pslld $3, x2; \ | ||
| 73 | psrld $(32 - 3), x4; \ | ||
| 74 | por x4, x2; \ | ||
| 75 | pxor x2, x1; \ | ||
| 76 | movdqa x1, x4; \ | ||
| 77 | pslld $1, x1; \ | ||
| 78 | psrld $(32 - 1), x4; \ | ||
| 79 | por x4, x1; \ | ||
| 80 | movdqa x0, x4; \ | ||
| 81 | pslld $3, x4; \ | ||
| 82 | pxor x2, x3; \ | ||
| 83 | pxor x4, x3; \ | ||
| 84 | movdqa x3, x4; \ | ||
| 85 | pslld $7, x3; \ | ||
| 86 | psrld $(32 - 7), x4; \ | ||
| 87 | por x4, x3; \ | ||
| 88 | movdqa x1, x4; \ | ||
| 89 | pslld $7, x4; \ | ||
| 90 | pxor x1, x0; \ | ||
| 91 | pxor x3, x0; \ | ||
| 92 | pxor x3, x2; \ | ||
| 93 | pxor x4, x2; \ | ||
| 94 | movdqa x0, x4; \ | ||
| 95 | get_key(i, 1, RT0); \ | ||
| 96 | pxor RT0, x1; \ | ||
| 97 | get_key(i, 3, RT0); \ | ||
| 98 | pxor RT0, x3; \ | ||
| 99 | pslld $5, x0; \ | ||
| 100 | psrld $(32 - 5), x4; \ | ||
| 101 | por x4, x0; \ | ||
| 102 | movdqa x2, x4; \ | ||
| 103 | pslld $22, x2; \ | ||
| 104 | psrld $(32 - 22), x4; \ | ||
| 105 | por x4, x2; \ | ||
| 106 | get_key(i, 0, RT0); \ | ||
| 107 | pxor RT0, x0; \ | ||
| 108 | get_key(i, 2, RT0); \ | ||
| 109 | pxor RT0, x2; | ||
| 110 | |||
| 111 | #define KL(x0, x1, x2, x3, x4, i) \ | ||
| 112 | K(x0, x1, x2, x3, x4, i); \ | ||
| 113 | movdqa x0, x4; \ | ||
| 114 | psrld $5, x0; \ | ||
| 115 | pslld $(32 - 5), x4; \ | ||
| 116 | por x4, x0; \ | ||
| 117 | movdqa x2, x4; \ | ||
| 118 | psrld $22, x2; \ | ||
| 119 | pslld $(32 - 22), x4; \ | ||
| 120 | por x4, x2; \ | ||
| 121 | pxor x3, x2; \ | ||
| 122 | pxor x3, x0; \ | ||
| 123 | movdqa x1, x4; \ | ||
| 124 | pslld $7, x4; \ | ||
| 125 | pxor x1, x0; \ | ||
| 126 | pxor x4, x2; \ | ||
| 127 | movdqa x1, x4; \ | ||
| 128 | psrld $1, x1; \ | ||
| 129 | pslld $(32 - 1), x4; \ | ||
| 130 | por x4, x1; \ | ||
| 131 | movdqa x3, x4; \ | ||
| 132 | psrld $7, x3; \ | ||
| 133 | pslld $(32 - 7), x4; \ | ||
| 134 | por x4, x3; \ | ||
| 135 | pxor x0, x1; \ | ||
| 136 | movdqa x0, x4; \ | ||
| 137 | pslld $3, x4; \ | ||
| 138 | pxor x4, x3; \ | ||
| 139 | movdqa x0, x4; \ | ||
| 140 | psrld $13, x0; \ | ||
| 141 | pslld $(32 - 13), x4; \ | ||
| 142 | por x4, x0; \ | ||
| 143 | pxor x2, x1; \ | ||
| 144 | pxor x2, x3; \ | ||
| 145 | movdqa x2, x4; \ | ||
| 146 | psrld $3, x2; \ | ||
| 147 | pslld $(32 - 3), x4; \ | ||
| 148 | por x4, x2; | ||
| 149 | |||
| 150 | #define S0(x0, x1, x2, x3, x4) \ | ||
| 151 | movdqa x3, x4; \ | ||
| 152 | por x0, x3; \ | ||
| 153 | pxor x4, x0; \ | ||
| 154 | pxor x2, x4; \ | ||
| 155 | pxor RNOT, x4; \ | ||
| 156 | pxor x1, x3; \ | ||
| 157 | pand x0, x1; \ | ||
| 158 | pxor x4, x1; \ | ||
| 159 | pxor x0, x2; \ | ||
| 160 | pxor x3, x0; \ | ||
| 161 | por x0, x4; \ | ||
| 162 | pxor x2, x0; \ | ||
| 163 | pand x1, x2; \ | ||
| 164 | pxor x2, x3; \ | ||
| 165 | pxor RNOT, x1; \ | ||
| 166 | pxor x4, x2; \ | ||
| 167 | pxor x2, x1; | ||
| 168 | |||
| 169 | #define S1(x0, x1, x2, x3, x4) \ | ||
| 170 | movdqa x1, x4; \ | ||
| 171 | pxor x0, x1; \ | ||
| 172 | pxor x3, x0; \ | ||
| 173 | pxor RNOT, x3; \ | ||
| 174 | pand x1, x4; \ | ||
| 175 | por x1, x0; \ | ||
| 176 | pxor x2, x3; \ | ||
| 177 | pxor x3, x0; \ | ||
| 178 | pxor x3, x1; \ | ||
| 179 | pxor x4, x3; \ | ||
| 180 | por x4, x1; \ | ||
| 181 | pxor x2, x4; \ | ||
| 182 | pand x0, x2; \ | ||
| 183 | pxor x1, x2; \ | ||
| 184 | por x0, x1; \ | ||
| 185 | pxor RNOT, x0; \ | ||
| 186 | pxor x2, x0; \ | ||
| 187 | pxor x1, x4; | ||
| 188 | |||
| 189 | #define S2(x0, x1, x2, x3, x4) \ | ||
| 190 | pxor RNOT, x3; \ | ||
| 191 | pxor x0, x1; \ | ||
| 192 | movdqa x0, x4; \ | ||
| 193 | pand x2, x0; \ | ||
| 194 | pxor x3, x0; \ | ||
| 195 | por x4, x3; \ | ||
| 196 | pxor x1, x2; \ | ||
| 197 | pxor x1, x3; \ | ||
| 198 | pand x0, x1; \ | ||
| 199 | pxor x2, x0; \ | ||
| 200 | pand x3, x2; \ | ||
| 201 | por x1, x3; \ | ||
| 202 | pxor RNOT, x0; \ | ||
| 203 | pxor x0, x3; \ | ||
| 204 | pxor x0, x4; \ | ||
| 205 | pxor x2, x0; \ | ||
| 206 | por x2, x1; | ||
| 207 | |||
| 208 | #define S3(x0, x1, x2, x3, x4) \ | ||
| 209 | movdqa x1, x4; \ | ||
| 210 | pxor x3, x1; \ | ||
| 211 | por x0, x3; \ | ||
| 212 | pand x0, x4; \ | ||
| 213 | pxor x2, x0; \ | ||
| 214 | pxor x1, x2; \ | ||
| 215 | pand x3, x1; \ | ||
| 216 | pxor x3, x2; \ | ||
| 217 | por x4, x0; \ | ||
| 218 | pxor x3, x4; \ | ||
| 219 | pxor x0, x1; \ | ||
| 220 | pand x3, x0; \ | ||
| 221 | pand x4, x3; \ | ||
| 222 | pxor x2, x3; \ | ||
| 223 | por x1, x4; \ | ||
| 224 | pand x1, x2; \ | ||
| 225 | pxor x3, x4; \ | ||
| 226 | pxor x3, x0; \ | ||
| 227 | pxor x2, x3; | ||
| 228 | |||
| 229 | #define S4(x0, x1, x2, x3, x4) \ | ||
| 230 | movdqa x3, x4; \ | ||
| 231 | pand x0, x3; \ | ||
| 232 | pxor x4, x0; \ | ||
| 233 | pxor x2, x3; \ | ||
| 234 | por x4, x2; \ | ||
| 235 | pxor x1, x0; \ | ||
| 236 | pxor x3, x4; \ | ||
| 237 | por x0, x2; \ | ||
| 238 | pxor x1, x2; \ | ||
| 239 | pand x0, x1; \ | ||
| 240 | pxor x4, x1; \ | ||
| 241 | pand x2, x4; \ | ||
| 242 | pxor x3, x2; \ | ||
| 243 | pxor x0, x4; \ | ||
| 244 | por x1, x3; \ | ||
| 245 | pxor RNOT, x1; \ | ||
| 246 | pxor x0, x3; | ||
| 247 | |||
| 248 | #define S5(x0, x1, x2, x3, x4) \ | ||
| 249 | movdqa x1, x4; \ | ||
| 250 | por x0, x1; \ | ||
| 251 | pxor x1, x2; \ | ||
| 252 | pxor RNOT, x3; \ | ||
| 253 | pxor x0, x4; \ | ||
| 254 | pxor x2, x0; \ | ||
| 255 | pand x4, x1; \ | ||
| 256 | por x3, x4; \ | ||
| 257 | pxor x0, x4; \ | ||
| 258 | pand x3, x0; \ | ||
| 259 | pxor x3, x1; \ | ||
| 260 | pxor x2, x3; \ | ||
| 261 | pxor x1, x0; \ | ||
| 262 | pand x4, x2; \ | ||
| 263 | pxor x2, x1; \ | ||
| 264 | pand x0, x2; \ | ||
| 265 | pxor x2, x3; | ||
| 266 | |||
| 267 | #define S6(x0, x1, x2, x3, x4) \ | ||
| 268 | movdqa x1, x4; \ | ||
| 269 | pxor x0, x3; \ | ||
| 270 | pxor x2, x1; \ | ||
| 271 | pxor x0, x2; \ | ||
| 272 | pand x3, x0; \ | ||
| 273 | por x3, x1; \ | ||
| 274 | pxor RNOT, x4; \ | ||
| 275 | pxor x1, x0; \ | ||
| 276 | pxor x2, x1; \ | ||
| 277 | pxor x4, x3; \ | ||
| 278 | pxor x0, x4; \ | ||
| 279 | pand x0, x2; \ | ||
| 280 | pxor x1, x4; \ | ||
| 281 | pxor x3, x2; \ | ||
| 282 | pand x1, x3; \ | ||
| 283 | pxor x0, x3; \ | ||
| 284 | pxor x2, x1; | ||
| 285 | |||
| 286 | #define S7(x0, x1, x2, x3, x4) \ | ||
| 287 | pxor RNOT, x1; \ | ||
| 288 | movdqa x1, x4; \ | ||
| 289 | pxor RNOT, x0; \ | ||
| 290 | pand x2, x1; \ | ||
| 291 | pxor x3, x1; \ | ||
| 292 | por x4, x3; \ | ||
| 293 | pxor x2, x4; \ | ||
| 294 | pxor x3, x2; \ | ||
| 295 | pxor x0, x3; \ | ||
| 296 | por x1, x0; \ | ||
| 297 | pand x0, x2; \ | ||
| 298 | pxor x4, x0; \ | ||
| 299 | pxor x3, x4; \ | ||
| 300 | pand x0, x3; \ | ||
| 301 | pxor x1, x4; \ | ||
| 302 | pxor x4, x2; \ | ||
| 303 | pxor x1, x3; \ | ||
| 304 | por x0, x4; \ | ||
| 305 | pxor x1, x4; | ||
| 306 | |||
| 307 | #define SI0(x0, x1, x2, x3, x4) \ | ||
| 308 | movdqa x3, x4; \ | ||
| 309 | pxor x0, x1; \ | ||
| 310 | por x1, x3; \ | ||
| 311 | pxor x1, x4; \ | ||
| 312 | pxor RNOT, x0; \ | ||
| 313 | pxor x3, x2; \ | ||
| 314 | pxor x0, x3; \ | ||
| 315 | pand x1, x0; \ | ||
| 316 | pxor x2, x0; \ | ||
| 317 | pand x3, x2; \ | ||
| 318 | pxor x4, x3; \ | ||
| 319 | pxor x3, x2; \ | ||
| 320 | pxor x3, x1; \ | ||
| 321 | pand x0, x3; \ | ||
| 322 | pxor x0, x1; \ | ||
| 323 | pxor x2, x0; \ | ||
| 324 | pxor x3, x4; | ||
| 325 | |||
| 326 | #define SI1(x0, x1, x2, x3, x4) \ | ||
| 327 | pxor x3, x1; \ | ||
| 328 | movdqa x0, x4; \ | ||
| 329 | pxor x2, x0; \ | ||
| 330 | pxor RNOT, x2; \ | ||
| 331 | por x1, x4; \ | ||
| 332 | pxor x3, x4; \ | ||
| 333 | pand x1, x3; \ | ||
| 334 | pxor x2, x1; \ | ||
| 335 | pand x4, x2; \ | ||
| 336 | pxor x1, x4; \ | ||
| 337 | por x3, x1; \ | ||
| 338 | pxor x0, x3; \ | ||
| 339 | pxor x0, x2; \ | ||
| 340 | por x4, x0; \ | ||
| 341 | pxor x4, x2; \ | ||
| 342 | pxor x0, x1; \ | ||
| 343 | pxor x1, x4; | ||
| 344 | |||
| 345 | #define SI2(x0, x1, x2, x3, x4) \ | ||
| 346 | pxor x1, x2; \ | ||
| 347 | movdqa x3, x4; \ | ||
| 348 | pxor RNOT, x3; \ | ||
| 349 | por x2, x3; \ | ||
| 350 | pxor x4, x2; \ | ||
| 351 | pxor x0, x4; \ | ||
| 352 | pxor x1, x3; \ | ||
| 353 | por x2, x1; \ | ||
| 354 | pxor x0, x2; \ | ||
| 355 | pxor x4, x1; \ | ||
| 356 | por x3, x4; \ | ||
| 357 | pxor x3, x2; \ | ||
| 358 | pxor x2, x4; \ | ||
| 359 | pand x1, x2; \ | ||
| 360 | pxor x3, x2; \ | ||
| 361 | pxor x4, x3; \ | ||
| 362 | pxor x0, x4; | ||
| 363 | |||
| 364 | #define SI3(x0, x1, x2, x3, x4) \ | ||
| 365 | pxor x1, x2; \ | ||
| 366 | movdqa x1, x4; \ | ||
| 367 | pand x2, x1; \ | ||
| 368 | pxor x0, x1; \ | ||
| 369 | por x4, x0; \ | ||
| 370 | pxor x3, x4; \ | ||
| 371 | pxor x3, x0; \ | ||
| 372 | por x1, x3; \ | ||
| 373 | pxor x2, x1; \ | ||
| 374 | pxor x3, x1; \ | ||
| 375 | pxor x2, x0; \ | ||
| 376 | pxor x3, x2; \ | ||
| 377 | pand x1, x3; \ | ||
| 378 | pxor x0, x1; \ | ||
| 379 | pand x2, x0; \ | ||
| 380 | pxor x3, x4; \ | ||
| 381 | pxor x0, x3; \ | ||
| 382 | pxor x1, x0; | ||
| 383 | |||
| 384 | #define SI4(x0, x1, x2, x3, x4) \ | ||
| 385 | pxor x3, x2; \ | ||
| 386 | movdqa x0, x4; \ | ||
| 387 | pand x1, x0; \ | ||
| 388 | pxor x2, x0; \ | ||
| 389 | por x3, x2; \ | ||
| 390 | pxor RNOT, x4; \ | ||
| 391 | pxor x0, x1; \ | ||
| 392 | pxor x2, x0; \ | ||
| 393 | pand x4, x2; \ | ||
| 394 | pxor x0, x2; \ | ||
| 395 | por x4, x0; \ | ||
| 396 | pxor x3, x0; \ | ||
| 397 | pand x2, x3; \ | ||
| 398 | pxor x3, x4; \ | ||
| 399 | pxor x1, x3; \ | ||
| 400 | pand x0, x1; \ | ||
| 401 | pxor x1, x4; \ | ||
| 402 | pxor x3, x0; | ||
| 403 | |||
| 404 | #define SI5(x0, x1, x2, x3, x4) \ | ||
| 405 | movdqa x1, x4; \ | ||
| 406 | por x2, x1; \ | ||
| 407 | pxor x4, x2; \ | ||
| 408 | pxor x3, x1; \ | ||
| 409 | pand x4, x3; \ | ||
| 410 | pxor x3, x2; \ | ||
| 411 | por x0, x3; \ | ||
| 412 | pxor RNOT, x0; \ | ||
| 413 | pxor x2, x3; \ | ||
| 414 | por x0, x2; \ | ||
| 415 | pxor x1, x4; \ | ||
| 416 | pxor x4, x2; \ | ||
| 417 | pand x0, x4; \ | ||
| 418 | pxor x1, x0; \ | ||
| 419 | pxor x3, x1; \ | ||
| 420 | pand x2, x0; \ | ||
| 421 | pxor x3, x2; \ | ||
| 422 | pxor x2, x0; \ | ||
| 423 | pxor x4, x2; \ | ||
| 424 | pxor x3, x4; | ||
| 425 | |||
| 426 | #define SI6(x0, x1, x2, x3, x4) \ | ||
| 427 | pxor x2, x0; \ | ||
| 428 | movdqa x0, x4; \ | ||
| 429 | pand x3, x0; \ | ||
| 430 | pxor x3, x2; \ | ||
| 431 | pxor x2, x0; \ | ||
| 432 | pxor x1, x3; \ | ||
| 433 | por x4, x2; \ | ||
| 434 | pxor x3, x2; \ | ||
| 435 | pand x0, x3; \ | ||
| 436 | pxor RNOT, x0; \ | ||
| 437 | pxor x1, x3; \ | ||
| 438 | pand x2, x1; \ | ||
| 439 | pxor x0, x4; \ | ||
| 440 | pxor x4, x3; \ | ||
| 441 | pxor x2, x4; \ | ||
| 442 | pxor x1, x0; \ | ||
| 443 | pxor x0, x2; | ||
| 444 | |||
| 445 | #define SI7(x0, x1, x2, x3, x4) \ | ||
| 446 | movdqa x3, x4; \ | ||
| 447 | pand x0, x3; \ | ||
| 448 | pxor x2, x0; \ | ||
| 449 | por x4, x2; \ | ||
| 450 | pxor x1, x4; \ | ||
| 451 | pxor RNOT, x0; \ | ||
| 452 | por x3, x1; \ | ||
| 453 | pxor x0, x4; \ | ||
| 454 | pand x2, x0; \ | ||
| 455 | pxor x1, x0; \ | ||
| 456 | pand x2, x1; \ | ||
| 457 | pxor x2, x3; \ | ||
| 458 | pxor x3, x4; \ | ||
| 459 | pand x3, x2; \ | ||
| 460 | por x0, x3; \ | ||
| 461 | pxor x4, x1; \ | ||
| 462 | pxor x4, x3; \ | ||
| 463 | pand x0, x4; \ | ||
| 464 | pxor x2, x4; | ||
| 465 | |||
| 466 | #define transpose_4x4(x0, x1, x2, x3, t1, t2, t3) \ | ||
| 467 | movdqa x2, t3; \ | ||
| 468 | movdqa x0, t1; \ | ||
| 469 | unpcklps x3, t3; \ | ||
| 470 | movdqa x0, t2; \ | ||
| 471 | unpcklps x1, t1; \ | ||
| 472 | unpckhps x1, t2; \ | ||
| 473 | movdqa t3, x1; \ | ||
| 474 | unpckhps x3, x2; \ | ||
| 475 | movdqa t1, x0; \ | ||
| 476 | movhlps t1, x1; \ | ||
| 477 | movdqa t2, t1; \ | ||
| 478 | movlhps t3, x0; \ | ||
| 479 | movlhps x2, t1; \ | ||
| 480 | movhlps t2, x2; \ | ||
| 481 | movdqa x2, x3; \ | ||
| 482 | movdqa t1, x2; | ||
| 483 | |||
| 484 | #define read_blocks(in, x0, x1, x2, x3, t0, t1, t2) \ | ||
| 485 | movdqu (0*4*4)(in), x0; \ | ||
| 486 | movdqu (1*4*4)(in), x1; \ | ||
| 487 | movdqu (2*4*4)(in), x2; \ | ||
| 488 | movdqu (3*4*4)(in), x3; \ | ||
| 489 | \ | ||
| 490 | transpose_4x4(x0, x1, x2, x3, t0, t1, t2) | ||
| 491 | |||
| 492 | #define write_blocks(out, x0, x1, x2, x3, t0, t1, t2) \ | ||
| 493 | transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \ | ||
| 494 | \ | ||
| 495 | movdqu x0, (0*4*4)(out); \ | ||
| 496 | movdqu x1, (1*4*4)(out); \ | ||
| 497 | movdqu x2, (2*4*4)(out); \ | ||
| 498 | movdqu x3, (3*4*4)(out); | ||
| 499 | |||
| 500 | #define xor_blocks(out, x0, x1, x2, x3, t0, t1, t2) \ | ||
| 501 | transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \ | ||
| 502 | \ | ||
| 503 | movdqu (0*4*4)(out), t0; \ | ||
| 504 | pxor t0, x0; \ | ||
| 505 | movdqu x0, (0*4*4)(out); \ | ||
| 506 | movdqu (1*4*4)(out), t0; \ | ||
| 507 | pxor t0, x1; \ | ||
| 508 | movdqu x1, (1*4*4)(out); \ | ||
| 509 | movdqu (2*4*4)(out), t0; \ | ||
| 510 | pxor t0, x2; \ | ||
| 511 | movdqu x2, (2*4*4)(out); \ | ||
| 512 | movdqu (3*4*4)(out), t0; \ | ||
| 513 | pxor t0, x3; \ | ||
| 514 | movdqu x3, (3*4*4)(out); | ||
| 515 | |||
| 516 | .align 8 | ||
| 517 | .global __serpent_enc_blk_4way | ||
| 518 | .type __serpent_enc_blk_4way,@function; | ||
| 519 | |||
| 520 | __serpent_enc_blk_4way: | ||
| 521 | /* input: | ||
| 522 | * arg_ctx(%esp): ctx, CTX | ||
| 523 | * arg_dst(%esp): dst | ||
| 524 | * arg_src(%esp): src | ||
| 525 | * arg_xor(%esp): bool, if true: xor output | ||
| 526 | */ | ||
| 527 | |||
| 528 | pcmpeqd RNOT, RNOT; | ||
| 529 | |||
| 530 | movl arg_ctx(%esp), CTX; | ||
| 531 | |||
| 532 | movl arg_src(%esp), %eax; | ||
| 533 | read_blocks(%eax, RA, RB, RC, RD, RT0, RT1, RE); | ||
| 534 | |||
| 535 | K(RA, RB, RC, RD, RE, 0); | ||
| 536 | S0(RA, RB, RC, RD, RE); LK(RC, RB, RD, RA, RE, 1); | ||
| 537 | S1(RC, RB, RD, RA, RE); LK(RE, RD, RA, RC, RB, 2); | ||
| 538 | S2(RE, RD, RA, RC, RB); LK(RB, RD, RE, RC, RA, 3); | ||
| 539 | S3(RB, RD, RE, RC, RA); LK(RC, RA, RD, RB, RE, 4); | ||
| 540 | S4(RC, RA, RD, RB, RE); LK(RA, RD, RB, RE, RC, 5); | ||
| 541 | S5(RA, RD, RB, RE, RC); LK(RC, RA, RD, RE, RB, 6); | ||
| 542 | S6(RC, RA, RD, RE, RB); LK(RD, RB, RA, RE, RC, 7); | ||
| 543 | S7(RD, RB, RA, RE, RC); LK(RC, RA, RE, RD, RB, 8); | ||
| 544 | S0(RC, RA, RE, RD, RB); LK(RE, RA, RD, RC, RB, 9); | ||
| 545 | S1(RE, RA, RD, RC, RB); LK(RB, RD, RC, RE, RA, 10); | ||
| 546 | S2(RB, RD, RC, RE, RA); LK(RA, RD, RB, RE, RC, 11); | ||
| 547 | S3(RA, RD, RB, RE, RC); LK(RE, RC, RD, RA, RB, 12); | ||
| 548 | S4(RE, RC, RD, RA, RB); LK(RC, RD, RA, RB, RE, 13); | ||
| 549 | S5(RC, RD, RA, RB, RE); LK(RE, RC, RD, RB, RA, 14); | ||
| 550 | S6(RE, RC, RD, RB, RA); LK(RD, RA, RC, RB, RE, 15); | ||
| 551 | S7(RD, RA, RC, RB, RE); LK(RE, RC, RB, RD, RA, 16); | ||
| 552 | S0(RE, RC, RB, RD, RA); LK(RB, RC, RD, RE, RA, 17); | ||
| 553 | S1(RB, RC, RD, RE, RA); LK(RA, RD, RE, RB, RC, 18); | ||
| 554 | S2(RA, RD, RE, RB, RC); LK(RC, RD, RA, RB, RE, 19); | ||
| 555 | S3(RC, RD, RA, RB, RE); LK(RB, RE, RD, RC, RA, 20); | ||
| 556 | S4(RB, RE, RD, RC, RA); LK(RE, RD, RC, RA, RB, 21); | ||
| 557 | S5(RE, RD, RC, RA, RB); LK(RB, RE, RD, RA, RC, 22); | ||
| 558 | S6(RB, RE, RD, RA, RC); LK(RD, RC, RE, RA, RB, 23); | ||
| 559 | S7(RD, RC, RE, RA, RB); LK(RB, RE, RA, RD, RC, 24); | ||
| 560 | S0(RB, RE, RA, RD, RC); LK(RA, RE, RD, RB, RC, 25); | ||
| 561 | S1(RA, RE, RD, RB, RC); LK(RC, RD, RB, RA, RE, 26); | ||
| 562 | S2(RC, RD, RB, RA, RE); LK(RE, RD, RC, RA, RB, 27); | ||
| 563 | S3(RE, RD, RC, RA, RB); LK(RA, RB, RD, RE, RC, 28); | ||
| 564 | S4(RA, RB, RD, RE, RC); LK(RB, RD, RE, RC, RA, 29); | ||
| 565 | S5(RB, RD, RE, RC, RA); LK(RA, RB, RD, RC, RE, 30); | ||
| 566 | S6(RA, RB, RD, RC, RE); LK(RD, RE, RB, RC, RA, 31); | ||
| 567 | S7(RD, RE, RB, RC, RA); K(RA, RB, RC, RD, RE, 32); | ||
| 568 | |||
| 569 | movl arg_dst(%esp), %eax; | ||
| 570 | |||
| 571 | cmpb $0, arg_xor(%esp); | ||
| 572 | jnz __enc_xor4; | ||
| 573 | |||
| 574 | write_blocks(%eax, RA, RB, RC, RD, RT0, RT1, RE); | ||
| 575 | |||
| 576 | ret; | ||
| 577 | |||
| 578 | __enc_xor4: | ||
| 579 | xor_blocks(%eax, RA, RB, RC, RD, RT0, RT1, RE); | ||
| 580 | |||
| 581 | ret; | ||
| 582 | |||
| 583 | .align 8 | ||
| 584 | .global serpent_dec_blk_4way | ||
| 585 | .type serpent_dec_blk_4way,@function; | ||
| 586 | |||
| 587 | serpent_dec_blk_4way: | ||
| 588 | /* input: | ||
| 589 | * arg_ctx(%esp): ctx, CTX | ||
| 590 | * arg_dst(%esp): dst | ||
| 591 | * arg_src(%esp): src | ||
| 592 | */ | ||
| 593 | |||
| 594 | pcmpeqd RNOT, RNOT; | ||
| 595 | |||
| 596 | movl arg_ctx(%esp), CTX; | ||
| 597 | |||
| 598 | movl arg_src(%esp), %eax; | ||
| 599 | read_blocks(%eax, RA, RB, RC, RD, RT0, RT1, RE); | ||
| 600 | |||
| 601 | K(RA, RB, RC, RD, RE, 32); | ||
| 602 | SI7(RA, RB, RC, RD, RE); KL(RB, RD, RA, RE, RC, 31); | ||
| 603 | SI6(RB, RD, RA, RE, RC); KL(RA, RC, RE, RB, RD, 30); | ||
| 604 | SI5(RA, RC, RE, RB, RD); KL(RC, RD, RA, RE, RB, 29); | ||
| 605 | SI4(RC, RD, RA, RE, RB); KL(RC, RA, RB, RE, RD, 28); | ||
| 606 | SI3(RC, RA, RB, RE, RD); KL(RB, RC, RD, RE, RA, 27); | ||
| 607 | SI2(RB, RC, RD, RE, RA); KL(RC, RA, RE, RD, RB, 26); | ||
| 608 | SI1(RC, RA, RE, RD, RB); KL(RB, RA, RE, RD, RC, 25); | ||
| 609 | SI0(RB, RA, RE, RD, RC); KL(RE, RC, RA, RB, RD, 24); | ||
| 610 | SI7(RE, RC, RA, RB, RD); KL(RC, RB, RE, RD, RA, 23); | ||
| 611 | SI6(RC, RB, RE, RD, RA); KL(RE, RA, RD, RC, RB, 22); | ||
| 612 | SI5(RE, RA, RD, RC, RB); KL(RA, RB, RE, RD, RC, 21); | ||
| 613 | SI4(RA, RB, RE, RD, RC); KL(RA, RE, RC, RD, RB, 20); | ||
| 614 | SI3(RA, RE, RC, RD, RB); KL(RC, RA, RB, RD, RE, 19); | ||
| 615 | SI2(RC, RA, RB, RD, RE); KL(RA, RE, RD, RB, RC, 18); | ||
| 616 | SI1(RA, RE, RD, RB, RC); KL(RC, RE, RD, RB, RA, 17); | ||
| 617 | SI0(RC, RE, RD, RB, RA); KL(RD, RA, RE, RC, RB, 16); | ||
| 618 | SI7(RD, RA, RE, RC, RB); KL(RA, RC, RD, RB, RE, 15); | ||
| 619 | SI6(RA, RC, RD, RB, RE); KL(RD, RE, RB, RA, RC, 14); | ||
| 620 | SI5(RD, RE, RB, RA, RC); KL(RE, RC, RD, RB, RA, 13); | ||
| 621 | SI4(RE, RC, RD, RB, RA); KL(RE, RD, RA, RB, RC, 12); | ||
| 622 | SI3(RE, RD, RA, RB, RC); KL(RA, RE, RC, RB, RD, 11); | ||
| 623 | SI2(RA, RE, RC, RB, RD); KL(RE, RD, RB, RC, RA, 10); | ||
| 624 | SI1(RE, RD, RB, RC, RA); KL(RA, RD, RB, RC, RE, 9); | ||
| 625 | SI0(RA, RD, RB, RC, RE); KL(RB, RE, RD, RA, RC, 8); | ||
| 626 | SI7(RB, RE, RD, RA, RC); KL(RE, RA, RB, RC, RD, 7); | ||
| 627 | SI6(RE, RA, RB, RC, RD); KL(RB, RD, RC, RE, RA, 6); | ||
| 628 | SI5(RB, RD, RC, RE, RA); KL(RD, RA, RB, RC, RE, 5); | ||
| 629 | SI4(RD, RA, RB, RC, RE); KL(RD, RB, RE, RC, RA, 4); | ||
| 630 | SI3(RD, RB, RE, RC, RA); KL(RE, RD, RA, RC, RB, 3); | ||
| 631 | SI2(RE, RD, RA, RC, RB); KL(RD, RB, RC, RA, RE, 2); | ||
| 632 | SI1(RD, RB, RC, RA, RE); KL(RE, RB, RC, RA, RD, 1); | ||
| 633 | SI0(RE, RB, RC, RA, RD); K(RC, RD, RB, RE, RA, 0); | ||
| 634 | |||
| 635 | movl arg_dst(%esp), %eax; | ||
| 636 | write_blocks(%eax, RC, RD, RB, RE, RT0, RT1, RA); | ||
| 637 | |||
| 638 | ret; | ||
diff --git a/arch/x86/crypto/serpent-sse2-x86_64-asm_64.S b/arch/x86/crypto/serpent-sse2-x86_64-asm_64.S new file mode 100644 index 000000000000..7f24a1540821 --- /dev/null +++ b/arch/x86/crypto/serpent-sse2-x86_64-asm_64.S | |||
| @@ -0,0 +1,761 @@ | |||
| 1 | /* | ||
| 2 | * Serpent Cipher 8-way parallel algorithm (x86_64/SSE2) | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | ||
| 5 | * | ||
| 6 | * Based on crypto/serpent.c by | ||
| 7 | * Copyright (C) 2002 Dag Arne Osvik <osvik@ii.uib.no> | ||
| 8 | * 2003 Herbert Valerio Riedel <hvr@gnu.org> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License as published by | ||
| 12 | * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | * (at your option) any later version. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, | ||
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | * GNU General Public License for more details. | ||
| 19 | * | ||
| 20 | * You should have received a copy of the GNU General Public License | ||
| 21 | * along with this program; if not, write to the Free Software | ||
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
| 23 | * USA | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | |||
| 27 | .file "serpent-sse2-x86_64-asm_64.S" | ||
| 28 | .text | ||
| 29 | |||
| 30 | #define CTX %rdi | ||
| 31 | |||
| 32 | /********************************************************************** | ||
| 33 | 8-way SSE2 serpent | ||
| 34 | **********************************************************************/ | ||
| 35 | #define RA1 %xmm0 | ||
| 36 | #define RB1 %xmm1 | ||
| 37 | #define RC1 %xmm2 | ||
| 38 | #define RD1 %xmm3 | ||
| 39 | #define RE1 %xmm4 | ||
| 40 | |||
| 41 | #define RA2 %xmm5 | ||
| 42 | #define RB2 %xmm6 | ||
| 43 | #define RC2 %xmm7 | ||
| 44 | #define RD2 %xmm8 | ||
| 45 | #define RE2 %xmm9 | ||
| 46 | |||
| 47 | #define RNOT %xmm10 | ||
| 48 | |||
| 49 | #define RK0 %xmm11 | ||
| 50 | #define RK1 %xmm12 | ||
| 51 | #define RK2 %xmm13 | ||
| 52 | #define RK3 %xmm14 | ||
| 53 | |||
| 54 | #define S0_1(x0, x1, x2, x3, x4) \ | ||
| 55 | movdqa x3, x4; \ | ||
| 56 | por x0, x3; \ | ||
| 57 | pxor x4, x0; \ | ||
| 58 | pxor x2, x4; \ | ||
| 59 | pxor RNOT, x4; \ | ||
| 60 | pxor x1, x3; \ | ||
| 61 | pand x0, x1; \ | ||
| 62 | pxor x4, x1; \ | ||
| 63 | pxor x0, x2; | ||
| 64 | #define S0_2(x0, x1, x2, x3, x4) \ | ||
| 65 | pxor x3, x0; \ | ||
| 66 | por x0, x4; \ | ||
| 67 | pxor x2, x0; \ | ||
| 68 | pand x1, x2; \ | ||
| 69 | pxor x2, x3; \ | ||
| 70 | pxor RNOT, x1; \ | ||
| 71 | pxor x4, x2; \ | ||
| 72 | pxor x2, x1; | ||
| 73 | |||
| 74 | #define S1_1(x0, x1, x2, x3, x4) \ | ||
| 75 | movdqa x1, x4; \ | ||
| 76 | pxor x0, x1; \ | ||
| 77 | pxor x3, x0; \ | ||
| 78 | pxor RNOT, x3; \ | ||
| 79 | pand x1, x4; \ | ||
| 80 | por x1, x0; \ | ||
| 81 | pxor x2, x3; \ | ||
| 82 | pxor x3, x0; \ | ||
| 83 | pxor x3, x1; | ||
| 84 | #define S1_2(x0, x1, x2, x3, x4) \ | ||
| 85 | pxor x4, x3; \ | ||
| 86 | por x4, x1; \ | ||
| 87 | pxor x2, x4; \ | ||
| 88 | pand x0, x2; \ | ||
| 89 | pxor x1, x2; \ | ||
| 90 | por x0, x1; \ | ||
| 91 | pxor RNOT, x0; \ | ||
| 92 | pxor x2, x0; \ | ||
| 93 | pxor x1, x4; | ||
| 94 | |||
| 95 | #define S2_1(x0, x1, x2, x3, x4) \ | ||
| 96 | pxor RNOT, x3; \ | ||
| 97 | pxor x0, x1; \ | ||
| 98 | movdqa x0, x4; \ | ||
| 99 | pand x2, x0; \ | ||
| 100 | pxor x3, x0; \ | ||
| 101 | por x4, x3; \ | ||
| 102 | pxor x1, x2; \ | ||
| 103 | pxor x1, x3; \ | ||
| 104 | pand x0, x1; | ||
| 105 | #define S2_2(x0, x1, x2, x3, x4) \ | ||
| 106 | pxor x2, x0; \ | ||
| 107 | pand x3, x2; \ | ||
| 108 | por x1, x3; \ | ||
| 109 | pxor RNOT, x0; \ | ||
| 110 | pxor x0, x3; \ | ||
| 111 | pxor x0, x4; \ | ||
| 112 | pxor x2, x0; \ | ||
| 113 | por x2, x1; | ||
| 114 | |||
| 115 | #define S3_1(x0, x1, x2, x3, x4) \ | ||
| 116 | movdqa x1, x4; \ | ||
| 117 | pxor x3, x1; \ | ||
| 118 | por x0, x3; \ | ||
| 119 | pand x0, x4; \ | ||
| 120 | pxor x2, x0; \ | ||
| 121 | pxor x1, x2; \ | ||
| 122 | pand x3, x1; \ | ||
| 123 | pxor x3, x2; \ | ||
| 124 | por x4, x0; \ | ||
| 125 | pxor x3, x4; | ||
| 126 | #define S3_2(x0, x1, x2, x3, x4) \ | ||
| 127 | pxor x0, x1; \ | ||
| 128 | pand x3, x0; \ | ||
| 129 | pand x4, x3; \ | ||
| 130 | pxor x2, x3; \ | ||
| 131 | por x1, x4; \ | ||
| 132 | pand x1, x2; \ | ||
| 133 | pxor x3, x4; \ | ||
| 134 | pxor x3, x0; \ | ||
| 135 | pxor x2, x3; | ||
| 136 | |||
| 137 | #define S4_1(x0, x1, x2, x3, x4) \ | ||
| 138 | movdqa x3, x4; \ | ||
| 139 | pand x0, x3; \ | ||
| 140 | pxor x4, x0; \ | ||
| 141 | pxor x2, x3; \ | ||
| 142 | por x4, x2; \ | ||
| 143 | pxor x1, x0; \ | ||
| 144 | pxor x3, x4; \ | ||
| 145 | por x0, x2; \ | ||
| 146 | pxor x1, x2; | ||
| 147 | #define S4_2(x0, x1, x2, x3, x4) \ | ||
| 148 | pand x0, x1; \ | ||
| 149 | pxor x4, x1; \ | ||
| 150 | pand x2, x4; \ | ||
| 151 | pxor x3, x2; \ | ||
| 152 | pxor x0, x4; \ | ||
| 153 | por x1, x3; \ | ||
| 154 | pxor RNOT, x1; \ | ||
| 155 | pxor x0, x3; | ||
| 156 | |||
| 157 | #define S5_1(x0, x1, x2, x3, x4) \ | ||
| 158 | movdqa x1, x4; \ | ||
| 159 | por x0, x1; \ | ||
| 160 | pxor x1, x2; \ | ||
| 161 | pxor RNOT, x3; \ | ||
| 162 | pxor x0, x4; \ | ||
| 163 | pxor x2, x0; \ | ||
| 164 | pand x4, x1; \ | ||
| 165 | por x3, x4; \ | ||
| 166 | pxor x0, x4; | ||
| 167 | #define S5_2(x0, x1, x2, x3, x4) \ | ||
| 168 | pand x3, x0; \ | ||
| 169 | pxor x3, x1; \ | ||
| 170 | pxor x2, x3; \ | ||
| 171 | pxor x1, x0; \ | ||
| 172 | pand x4, x2; \ | ||
| 173 | pxor x2, x1; \ | ||
| 174 | pand x0, x2; \ | ||
| 175 | pxor x2, x3; | ||
| 176 | |||
| 177 | #define S6_1(x0, x1, x2, x3, x4) \ | ||
| 178 | movdqa x1, x4; \ | ||
| 179 | pxor x0, x3; \ | ||
| 180 | pxor x2, x1; \ | ||
| 181 | pxor x0, x2; \ | ||
| 182 | pand x3, x0; \ | ||
| 183 | por x3, x1; \ | ||
| 184 | pxor RNOT, x4; \ | ||
| 185 | pxor x1, x0; \ | ||
| 186 | pxor x2, x1; | ||
| 187 | #define S6_2(x0, x1, x2, x3, x4) \ | ||
| 188 | pxor x4, x3; \ | ||
| 189 | pxor x0, x4; \ | ||
| 190 | pand x0, x2; \ | ||
| 191 | pxor x1, x4; \ | ||
| 192 | pxor x3, x2; \ | ||
| 193 | pand x1, x3; \ | ||
| 194 | pxor x0, x3; \ | ||
| 195 | pxor x2, x1; | ||
| 196 | |||
| 197 | #define S7_1(x0, x1, x2, x3, x4) \ | ||
| 198 | pxor RNOT, x1; \ | ||
| 199 | movdqa x1, x4; \ | ||
| 200 | pxor RNOT, x0; \ | ||
| 201 | pand x2, x1; \ | ||
| 202 | pxor x3, x1; \ | ||
| 203 | por x4, x3; \ | ||
| 204 | pxor x2, x4; \ | ||
| 205 | pxor x3, x2; \ | ||
| 206 | pxor x0, x3; \ | ||
| 207 | por x1, x0; | ||
| 208 | #define S7_2(x0, x1, x2, x3, x4) \ | ||
| 209 | pand x0, x2; \ | ||
| 210 | pxor x4, x0; \ | ||
| 211 | pxor x3, x4; \ | ||
| 212 | pand x0, x3; \ | ||
| 213 | pxor x1, x4; \ | ||
| 214 | pxor x4, x2; \ | ||
| 215 | pxor x1, x3; \ | ||
| 216 | por x0, x4; \ | ||
| 217 | pxor x1, x4; | ||
| 218 | |||
| 219 | #define SI0_1(x0, x1, x2, x3, x4) \ | ||
| 220 | movdqa x3, x4; \ | ||
| 221 | pxor x0, x1; \ | ||
| 222 | por x1, x3; \ | ||
| 223 | pxor x1, x4; \ | ||
| 224 | pxor RNOT, x0; \ | ||
| 225 | pxor x3, x2; \ | ||
| 226 | pxor x0, x3; \ | ||
| 227 | pand x1, x0; \ | ||
| 228 | pxor x2, x0; | ||
| 229 | #define SI0_2(x0, x1, x2, x3, x4) \ | ||
| 230 | pand x3, x2; \ | ||
| 231 | pxor x4, x3; \ | ||
| 232 | pxor x3, x2; \ | ||
| 233 | pxor x3, x1; \ | ||
| 234 | pand x0, x3; \ | ||
| 235 | pxor x0, x1; \ | ||
| 236 | pxor x2, x0; \ | ||
| 237 | pxor x3, x4; | ||
| 238 | |||
| 239 | #define SI1_1(x0, x1, x2, x3, x4) \ | ||
| 240 | pxor x3, x1; \ | ||
| 241 | movdqa x0, x4; \ | ||
| 242 | pxor x2, x0; \ | ||
| 243 | pxor RNOT, x2; \ | ||
| 244 | por x1, x4; \ | ||
| 245 | pxor x3, x4; \ | ||
| 246 | pand x1, x3; \ | ||
| 247 | pxor x2, x1; \ | ||
| 248 | pand x4, x2; | ||
| 249 | #define SI1_2(x0, x1, x2, x3, x4) \ | ||
| 250 | pxor x1, x4; \ | ||
| 251 | por x3, x1; \ | ||
| 252 | pxor x0, x3; \ | ||
| 253 | pxor x0, x2; \ | ||
| 254 | por x4, x0; \ | ||
| 255 | pxor x4, x2; \ | ||
| 256 | pxor x0, x1; \ | ||
| 257 | pxor x1, x4; | ||
| 258 | |||
| 259 | #define SI2_1(x0, x1, x2, x3, x4) \ | ||
| 260 | pxor x1, x2; \ | ||
| 261 | movdqa x3, x4; \ | ||
| 262 | pxor RNOT, x3; \ | ||
| 263 | por x2, x3; \ | ||
| 264 | pxor x4, x2; \ | ||
| 265 | pxor x0, x4; \ | ||
| 266 | pxor x1, x3; \ | ||
| 267 | por x2, x1; \ | ||
| 268 | pxor x0, x2; | ||
| 269 | #define SI2_2(x0, x1, x2, x3, x4) \ | ||
| 270 | pxor x4, x1; \ | ||
| 271 | por x3, x4; \ | ||
| 272 | pxor x3, x2; \ | ||
| 273 | pxor x2, x4; \ | ||
| 274 | pand x1, x2; \ | ||
| 275 | pxor x3, x2; \ | ||
| 276 | pxor x4, x3; \ | ||
| 277 | pxor x0, x4; | ||
| 278 | |||
| 279 | #define SI3_1(x0, x1, x2, x3, x4) \ | ||
| 280 | pxor x1, x2; \ | ||
| 281 | movdqa x1, x4; \ | ||
| 282 | pand x2, x1; \ | ||
| 283 | pxor x0, x1; \ | ||
| 284 | por x4, x0; \ | ||
| 285 | pxor x3, x4; \ | ||
| 286 | pxor x3, x0; \ | ||
| 287 | por x1, x3; \ | ||
| 288 | pxor x2, x1; | ||
| 289 | #define SI3_2(x0, x1, x2, x3, x4) \ | ||
| 290 | pxor x3, x1; \ | ||
| 291 | pxor x2, x0; \ | ||
| 292 | pxor x3, x2; \ | ||
| 293 | pand x1, x3; \ | ||
| 294 | pxor x0, x1; \ | ||
| 295 | pand x2, x0; \ | ||
| 296 | pxor x3, x4; \ | ||
| 297 | pxor x0, x3; \ | ||
| 298 | pxor x1, x0; | ||
| 299 | |||
| 300 | #define SI4_1(x0, x1, x2, x3, x4) \ | ||
| 301 | pxor x3, x2; \ | ||
| 302 | movdqa x0, x4; \ | ||
| 303 | pand x1, x0; \ | ||
| 304 | pxor x2, x0; \ | ||
| 305 | por x3, x2; \ | ||
| 306 | pxor RNOT, x4; \ | ||
| 307 | pxor x0, x1; \ | ||
| 308 | pxor x2, x0; \ | ||
| 309 | pand x4, x2; | ||
| 310 | #define SI4_2(x0, x1, x2, x3, x4) \ | ||
| 311 | pxor x0, x2; \ | ||
| 312 | por x4, x0; \ | ||
| 313 | pxor x3, x0; \ | ||
| 314 | pand x2, x3; \ | ||
| 315 | pxor x3, x4; \ | ||
| 316 | pxor x1, x3; \ | ||
| 317 | pand x0, x1; \ | ||
| 318 | pxor x1, x4; \ | ||
| 319 | pxor x3, x0; | ||
| 320 | |||
| 321 | #define SI5_1(x0, x1, x2, x3, x4) \ | ||
| 322 | movdqa x1, x4; \ | ||
| 323 | por x2, x1; \ | ||
| 324 | pxor x4, x2; \ | ||
| 325 | pxor x3, x1; \ | ||
| 326 | pand x4, x3; \ | ||
| 327 | pxor x3, x2; \ | ||
| 328 | por x0, x3; \ | ||
| 329 | pxor RNOT, x0; \ | ||
| 330 | pxor x2, x3; \ | ||
| 331 | por x0, x2; | ||
| 332 | #define SI5_2(x0, x1, x2, x3, x4) \ | ||
| 333 | pxor x1, x4; \ | ||
| 334 | pxor x4, x2; \ | ||
| 335 | pand x0, x4; \ | ||
| 336 | pxor x1, x0; \ | ||
| 337 | pxor x3, x1; \ | ||
| 338 | pand x2, x0; \ | ||
| 339 | pxor x3, x2; \ | ||
| 340 | pxor x2, x0; \ | ||
| 341 | pxor x4, x2; \ | ||
| 342 | pxor x3, x4; | ||
| 343 | |||
| 344 | #define SI6_1(x0, x1, x2, x3, x4) \ | ||
| 345 | pxor x2, x0; \ | ||
| 346 | movdqa x0, x4; \ | ||
| 347 | pand x3, x0; \ | ||
| 348 | pxor x3, x2; \ | ||
| 349 | pxor x2, x0; \ | ||
| 350 | pxor x1, x3; \ | ||
| 351 | por x4, x2; \ | ||
| 352 | pxor x3, x2; \ | ||
| 353 | pand x0, x3; | ||
| 354 | #define SI6_2(x0, x1, x2, x3, x4) \ | ||
| 355 | pxor RNOT, x0; \ | ||
| 356 | pxor x1, x3; \ | ||
| 357 | pand x2, x1; \ | ||
| 358 | pxor x0, x4; \ | ||
| 359 | pxor x4, x3; \ | ||
| 360 | pxor x2, x4; \ | ||
| 361 | pxor x1, x0; \ | ||
| 362 | pxor x0, x2; | ||
| 363 | |||
| 364 | #define SI7_1(x0, x1, x2, x3, x4) \ | ||
| 365 | movdqa x3, x4; \ | ||
| 366 | pand x0, x3; \ | ||
| 367 | pxor x2, x0; \ | ||
| 368 | por x4, x2; \ | ||
| 369 | pxor x1, x4; \ | ||
| 370 | pxor RNOT, x0; \ | ||
| 371 | por x3, x1; \ | ||
| 372 | pxor x0, x4; \ | ||
| 373 | pand x2, x0; \ | ||
| 374 | pxor x1, x0; | ||
| 375 | #define SI7_2(x0, x1, x2, x3, x4) \ | ||
| 376 | pand x2, x1; \ | ||
| 377 | pxor x2, x3; \ | ||
| 378 | pxor x3, x4; \ | ||
| 379 | pand x3, x2; \ | ||
| 380 | por x0, x3; \ | ||
| 381 | pxor x4, x1; \ | ||
| 382 | pxor x4, x3; \ | ||
| 383 | pand x0, x4; \ | ||
| 384 | pxor x2, x4; | ||
| 385 | |||
| 386 | #define get_key(i, j, t) \ | ||
| 387 | movd (4*(i)+(j))*4(CTX), t; \ | ||
| 388 | pshufd $0, t, t; | ||
| 389 | |||
| 390 | #define K2(x0, x1, x2, x3, x4, i) \ | ||
| 391 | get_key(i, 0, RK0); \ | ||
| 392 | get_key(i, 1, RK1); \ | ||
| 393 | get_key(i, 2, RK2); \ | ||
| 394 | get_key(i, 3, RK3); \ | ||
| 395 | pxor RK0, x0 ## 1; \ | ||
| 396 | pxor RK1, x1 ## 1; \ | ||
| 397 | pxor RK2, x2 ## 1; \ | ||
| 398 | pxor RK3, x3 ## 1; \ | ||
| 399 | pxor RK0, x0 ## 2; \ | ||
| 400 | pxor RK1, x1 ## 2; \ | ||
| 401 | pxor RK2, x2 ## 2; \ | ||
| 402 | pxor RK3, x3 ## 2; | ||
| 403 | |||
| 404 | #define LK2(x0, x1, x2, x3, x4, i) \ | ||
| 405 | movdqa x0 ## 1, x4 ## 1; \ | ||
| 406 | pslld $13, x0 ## 1; \ | ||
| 407 | psrld $(32 - 13), x4 ## 1; \ | ||
| 408 | por x4 ## 1, x0 ## 1; \ | ||
| 409 | pxor x0 ## 1, x1 ## 1; \ | ||
| 410 | movdqa x2 ## 1, x4 ## 1; \ | ||
| 411 | pslld $3, x2 ## 1; \ | ||
| 412 | psrld $(32 - 3), x4 ## 1; \ | ||
| 413 | por x4 ## 1, x2 ## 1; \ | ||
| 414 | pxor x2 ## 1, x1 ## 1; \ | ||
| 415 | movdqa x0 ## 2, x4 ## 2; \ | ||
| 416 | pslld $13, x0 ## 2; \ | ||
| 417 | psrld $(32 - 13), x4 ## 2; \ | ||
| 418 | por x4 ## 2, x0 ## 2; \ | ||
| 419 | pxor x0 ## 2, x1 ## 2; \ | ||
| 420 | movdqa x2 ## 2, x4 ## 2; \ | ||
| 421 | pslld $3, x2 ## 2; \ | ||
| 422 | psrld $(32 - 3), x4 ## 2; \ | ||
| 423 | por x4 ## 2, x2 ## 2; \ | ||
| 424 | pxor x2 ## 2, x1 ## 2; \ | ||
| 425 | movdqa x1 ## 1, x4 ## 1; \ | ||
| 426 | pslld $1, x1 ## 1; \ | ||
| 427 | psrld $(32 - 1), x4 ## 1; \ | ||
| 428 | por x4 ## 1, x1 ## 1; \ | ||
| 429 | movdqa x0 ## 1, x4 ## 1; \ | ||
| 430 | pslld $3, x4 ## 1; \ | ||
| 431 | pxor x2 ## 1, x3 ## 1; \ | ||
| 432 | pxor x4 ## 1, x3 ## 1; \ | ||
| 433 | movdqa x3 ## 1, x4 ## 1; \ | ||
| 434 | get_key(i, 1, RK1); \ | ||
| 435 | movdqa x1 ## 2, x4 ## 2; \ | ||
| 436 | pslld $1, x1 ## 2; \ | ||
| 437 | psrld $(32 - 1), x4 ## 2; \ | ||
| 438 | por x4 ## 2, x1 ## 2; \ | ||
| 439 | movdqa x0 ## 2, x4 ## 2; \ | ||
| 440 | pslld $3, x4 ## 2; \ | ||
| 441 | pxor x2 ## 2, x3 ## 2; \ | ||
| 442 | pxor x4 ## 2, x3 ## 2; \ | ||
| 443 | movdqa x3 ## 2, x4 ## 2; \ | ||
| 444 | get_key(i, 3, RK3); \ | ||
| 445 | pslld $7, x3 ## 1; \ | ||
| 446 | psrld $(32 - 7), x4 ## 1; \ | ||
| 447 | por x4 ## 1, x3 ## 1; \ | ||
| 448 | movdqa x1 ## 1, x4 ## 1; \ | ||
| 449 | pslld $7, x4 ## 1; \ | ||
| 450 | pxor x1 ## 1, x0 ## 1; \ | ||
| 451 | pxor x3 ## 1, x0 ## 1; \ | ||
| 452 | pxor x3 ## 1, x2 ## 1; \ | ||
| 453 | pxor x4 ## 1, x2 ## 1; \ | ||
| 454 | get_key(i, 0, RK0); \ | ||
| 455 | pslld $7, x3 ## 2; \ | ||
| 456 | psrld $(32 - 7), x4 ## 2; \ | ||
| 457 | por x4 ## 2, x3 ## 2; \ | ||
| 458 | movdqa x1 ## 2, x4 ## 2; \ | ||
| 459 | pslld $7, x4 ## 2; \ | ||
| 460 | pxor x1 ## 2, x0 ## 2; \ | ||
| 461 | pxor x3 ## 2, x0 ## 2; \ | ||
| 462 | pxor x3 ## 2, x2 ## 2; \ | ||
| 463 | pxor x4 ## 2, x2 ## 2; \ | ||
| 464 | get_key(i, 2, RK2); \ | ||
| 465 | pxor RK1, x1 ## 1; \ | ||
| 466 | pxor RK3, x3 ## 1; \ | ||
| 467 | movdqa x0 ## 1, x4 ## 1; \ | ||
| 468 | pslld $5, x0 ## 1; \ | ||
| 469 | psrld $(32 - 5), x4 ## 1; \ | ||
| 470 | por x4 ## 1, x0 ## 1; \ | ||
| 471 | movdqa x2 ## 1, x4 ## 1; \ | ||
| 472 | pslld $22, x2 ## 1; \ | ||
| 473 | psrld $(32 - 22), x4 ## 1; \ | ||
| 474 | por x4 ## 1, x2 ## 1; \ | ||
| 475 | pxor RK0, x0 ## 1; \ | ||
| 476 | pxor RK2, x2 ## 1; \ | ||
| 477 | pxor RK1, x1 ## 2; \ | ||
| 478 | pxor RK3, x3 ## 2; \ | ||
| 479 | movdqa x0 ## 2, x4 ## 2; \ | ||
| 480 | pslld $5, x0 ## 2; \ | ||
| 481 | psrld $(32 - 5), x4 ## 2; \ | ||
| 482 | por x4 ## 2, x0 ## 2; \ | ||
| 483 | movdqa x2 ## 2, x4 ## 2; \ | ||
| 484 | pslld $22, x2 ## 2; \ | ||
| 485 | psrld $(32 - 22), x4 ## 2; \ | ||
| 486 | por x4 ## 2, x2 ## 2; \ | ||
| 487 | pxor RK0, x0 ## 2; \ | ||
| 488 | pxor RK2, x2 ## 2; | ||
| 489 | |||
| 490 | #define KL2(x0, x1, x2, x3, x4, i) \ | ||
| 491 | pxor RK0, x0 ## 1; \ | ||
| 492 | pxor RK2, x2 ## 1; \ | ||
| 493 | movdqa x0 ## 1, x4 ## 1; \ | ||
| 494 | psrld $5, x0 ## 1; \ | ||
| 495 | pslld $(32 - 5), x4 ## 1; \ | ||
| 496 | por x4 ## 1, x0 ## 1; \ | ||
| 497 | pxor RK3, x3 ## 1; \ | ||
| 498 | pxor RK1, x1 ## 1; \ | ||
| 499 | movdqa x2 ## 1, x4 ## 1; \ | ||
| 500 | psrld $22, x2 ## 1; \ | ||
| 501 | pslld $(32 - 22), x4 ## 1; \ | ||
| 502 | por x4 ## 1, x2 ## 1; \ | ||
| 503 | pxor x3 ## 1, x2 ## 1; \ | ||
| 504 | pxor RK0, x0 ## 2; \ | ||
| 505 | pxor RK2, x2 ## 2; \ | ||
| 506 | movdqa x0 ## 2, x4 ## 2; \ | ||
| 507 | psrld $5, x0 ## 2; \ | ||
| 508 | pslld $(32 - 5), x4 ## 2; \ | ||
| 509 | por x4 ## 2, x0 ## 2; \ | ||
| 510 | pxor RK3, x3 ## 2; \ | ||
| 511 | pxor RK1, x1 ## 2; \ | ||
| 512 | movdqa x2 ## 2, x4 ## 2; \ | ||
| 513 | psrld $22, x2 ## 2; \ | ||
| 514 | pslld $(32 - 22), x4 ## 2; \ | ||
| 515 | por x4 ## 2, x2 ## 2; \ | ||
| 516 | pxor x3 ## 2, x2 ## 2; \ | ||
| 517 | pxor x3 ## 1, x0 ## 1; \ | ||
| 518 | movdqa x1 ## 1, x4 ## 1; \ | ||
| 519 | pslld $7, x4 ## 1; \ | ||
| 520 | pxor x1 ## 1, x0 ## 1; \ | ||
| 521 | pxor x4 ## 1, x2 ## 1; \ | ||
| 522 | movdqa x1 ## 1, x4 ## 1; \ | ||
| 523 | psrld $1, x1 ## 1; \ | ||
| 524 | pslld $(32 - 1), x4 ## 1; \ | ||
| 525 | por x4 ## 1, x1 ## 1; \ | ||
| 526 | pxor x3 ## 2, x0 ## 2; \ | ||
| 527 | movdqa x1 ## 2, x4 ## 2; \ | ||
| 528 | pslld $7, x4 ## 2; \ | ||
| 529 | pxor x1 ## 2, x0 ## 2; \ | ||
| 530 | pxor x4 ## 2, x2 ## 2; \ | ||
| 531 | movdqa x1 ## 2, x4 ## 2; \ | ||
| 532 | psrld $1, x1 ## 2; \ | ||
| 533 | pslld $(32 - 1), x4 ## 2; \ | ||
| 534 | por x4 ## 2, x1 ## 2; \ | ||
| 535 | movdqa x3 ## 1, x4 ## 1; \ | ||
| 536 | psrld $7, x3 ## 1; \ | ||
| 537 | pslld $(32 - 7), x4 ## 1; \ | ||
| 538 | por x4 ## 1, x3 ## 1; \ | ||
| 539 | pxor x0 ## 1, x1 ## 1; \ | ||
| 540 | movdqa x0 ## 1, x4 ## 1; \ | ||
| 541 | pslld $3, x4 ## 1; \ | ||
| 542 | pxor x4 ## 1, x3 ## 1; \ | ||
| 543 | movdqa x0 ## 1, x4 ## 1; \ | ||
| 544 | movdqa x3 ## 2, x4 ## 2; \ | ||
| 545 | psrld $7, x3 ## 2; \ | ||
| 546 | pslld $(32 - 7), x4 ## 2; \ | ||
| 547 | por x4 ## 2, x3 ## 2; \ | ||
| 548 | pxor x0 ## 2, x1 ## 2; \ | ||
| 549 | movdqa x0 ## 2, x4 ## 2; \ | ||
| 550 | pslld $3, x4 ## 2; \ | ||
| 551 | pxor x4 ## 2, x3 ## 2; \ | ||
| 552 | movdqa x0 ## 2, x4 ## 2; \ | ||
| 553 | psrld $13, x0 ## 1; \ | ||
| 554 | pslld $(32 - 13), x4 ## 1; \ | ||
| 555 | por x4 ## 1, x0 ## 1; \ | ||
| 556 | pxor x2 ## 1, x1 ## 1; \ | ||
| 557 | pxor x2 ## 1, x3 ## 1; \ | ||
| 558 | movdqa x2 ## 1, x4 ## 1; \ | ||
| 559 | psrld $3, x2 ## 1; \ | ||
| 560 | pslld $(32 - 3), x4 ## 1; \ | ||
| 561 | por x4 ## 1, x2 ## 1; \ | ||
| 562 | psrld $13, x0 ## 2; \ | ||
| 563 | pslld $(32 - 13), x4 ## 2; \ | ||
| 564 | por x4 ## 2, x0 ## 2; \ | ||
| 565 | pxor x2 ## 2, x1 ## 2; \ | ||
| 566 | pxor x2 ## 2, x3 ## 2; \ | ||
| 567 | movdqa x2 ## 2, x4 ## 2; \ | ||
| 568 | psrld $3, x2 ## 2; \ | ||
| 569 | pslld $(32 - 3), x4 ## 2; \ | ||
| 570 | por x4 ## 2, x2 ## 2; | ||
| 571 | |||
| 572 | #define S(SBOX, x0, x1, x2, x3, x4) \ | ||
| 573 | SBOX ## _1(x0 ## 1, x1 ## 1, x2 ## 1, x3 ## 1, x4 ## 1); \ | ||
| 574 | SBOX ## _2(x0 ## 1, x1 ## 1, x2 ## 1, x3 ## 1, x4 ## 1); \ | ||
| 575 | SBOX ## _1(x0 ## 2, x1 ## 2, x2 ## 2, x3 ## 2, x4 ## 2); \ | ||
| 576 | SBOX ## _2(x0 ## 2, x1 ## 2, x2 ## 2, x3 ## 2, x4 ## 2); | ||
| 577 | |||
| 578 | #define SP(SBOX, x0, x1, x2, x3, x4, i) \ | ||
| 579 | get_key(i, 0, RK0); \ | ||
| 580 | SBOX ## _1(x0 ## 1, x1 ## 1, x2 ## 1, x3 ## 1, x4 ## 1); \ | ||
| 581 | get_key(i, 2, RK2); \ | ||
| 582 | SBOX ## _1(x0 ## 2, x1 ## 2, x2 ## 2, x3 ## 2, x4 ## 2); \ | ||
| 583 | get_key(i, 3, RK3); \ | ||
| 584 | SBOX ## _2(x0 ## 1, x1 ## 1, x2 ## 1, x3 ## 1, x4 ## 1); \ | ||
| 585 | get_key(i, 1, RK1); \ | ||
| 586 | SBOX ## _2(x0 ## 2, x1 ## 2, x2 ## 2, x3 ## 2, x4 ## 2); \ | ||
| 587 | |||
| 588 | #define transpose_4x4(x0, x1, x2, x3, t1, t2, t3) \ | ||
| 589 | movdqa x2, t3; \ | ||
| 590 | movdqa x0, t1; \ | ||
| 591 | unpcklps x3, t3; \ | ||
| 592 | movdqa x0, t2; \ | ||
| 593 | unpcklps x1, t1; \ | ||
| 594 | unpckhps x1, t2; \ | ||
| 595 | movdqa t3, x1; \ | ||
| 596 | unpckhps x3, x2; \ | ||
| 597 | movdqa t1, x0; \ | ||
| 598 | movhlps t1, x1; \ | ||
| 599 | movdqa t2, t1; \ | ||
| 600 | movlhps t3, x0; \ | ||
| 601 | movlhps x2, t1; \ | ||
| 602 | movhlps t2, x2; \ | ||
| 603 | movdqa x2, x3; \ | ||
| 604 | movdqa t1, x2; | ||
| 605 | |||
| 606 | #define read_blocks(in, x0, x1, x2, x3, t0, t1, t2) \ | ||
| 607 | movdqu (0*4*4)(in), x0; \ | ||
| 608 | movdqu (1*4*4)(in), x1; \ | ||
| 609 | movdqu (2*4*4)(in), x2; \ | ||
| 610 | movdqu (3*4*4)(in), x3; \ | ||
| 611 | \ | ||
| 612 | transpose_4x4(x0, x1, x2, x3, t0, t1, t2) | ||
| 613 | |||
| 614 | #define write_blocks(out, x0, x1, x2, x3, t0, t1, t2) \ | ||
| 615 | transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \ | ||
| 616 | \ | ||
| 617 | movdqu x0, (0*4*4)(out); \ | ||
| 618 | movdqu x1, (1*4*4)(out); \ | ||
| 619 | movdqu x2, (2*4*4)(out); \ | ||
| 620 | movdqu x3, (3*4*4)(out); | ||
| 621 | |||
| 622 | #define xor_blocks(out, x0, x1, x2, x3, t0, t1, t2) \ | ||
| 623 | transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \ | ||
| 624 | \ | ||
| 625 | movdqu (0*4*4)(out), t0; \ | ||
| 626 | pxor t0, x0; \ | ||
| 627 | movdqu x0, (0*4*4)(out); \ | ||
| 628 | movdqu (1*4*4)(out), t0; \ | ||
| 629 | pxor t0, x1; \ | ||
| 630 | movdqu x1, (1*4*4)(out); \ | ||
| 631 | movdqu (2*4*4)(out), t0; \ | ||
| 632 | pxor t0, x2; \ | ||
| 633 | movdqu x2, (2*4*4)(out); \ | ||
| 634 | movdqu (3*4*4)(out), t0; \ | ||
| 635 | pxor t0, x3; \ | ||
| 636 | movdqu x3, (3*4*4)(out); | ||
| 637 | |||
| 638 | .align 8 | ||
| 639 | .global __serpent_enc_blk_8way | ||
| 640 | .type __serpent_enc_blk_8way,@function; | ||
| 641 | |||
| 642 | __serpent_enc_blk_8way: | ||
| 643 | /* input: | ||
| 644 | * %rdi: ctx, CTX | ||
| 645 | * %rsi: dst | ||
| 646 | * %rdx: src | ||
| 647 | * %rcx: bool, if true: xor output | ||
| 648 | */ | ||
| 649 | |||
| 650 | pcmpeqd RNOT, RNOT; | ||
| 651 | |||
| 652 | leaq (4*4*4)(%rdx), %rax; | ||
| 653 | read_blocks(%rdx, RA1, RB1, RC1, RD1, RK0, RK1, RK2); | ||
| 654 | read_blocks(%rax, RA2, RB2, RC2, RD2, RK0, RK1, RK2); | ||
| 655 | |||
| 656 | K2(RA, RB, RC, RD, RE, 0); | ||
| 657 | S(S0, RA, RB, RC, RD, RE); LK2(RC, RB, RD, RA, RE, 1); | ||
| 658 | S(S1, RC, RB, RD, RA, RE); LK2(RE, RD, RA, RC, RB, 2); | ||
| 659 | S(S2, RE, RD, RA, RC, RB); LK2(RB, RD, RE, RC, RA, 3); | ||
| 660 | S(S3, RB, RD, RE, RC, RA); LK2(RC, RA, RD, RB, RE, 4); | ||
| 661 | S(S4, RC, RA, RD, RB, RE); LK2(RA, RD, RB, RE, RC, 5); | ||
| 662 | S(S5, RA, RD, RB, RE, RC); LK2(RC, RA, RD, RE, RB, 6); | ||
| 663 | S(S6, RC, RA, RD, RE, RB); LK2(RD, RB, RA, RE, RC, 7); | ||
| 664 | S(S7, RD, RB, RA, RE, RC); LK2(RC, RA, RE, RD, RB, 8); | ||
| 665 | S(S0, RC, RA, RE, RD, RB); LK2(RE, RA, RD, RC, RB, 9); | ||
| 666 | S(S1, RE, RA, RD, RC, RB); LK2(RB, RD, RC, RE, RA, 10); | ||
| 667 | S(S2, RB, RD, RC, RE, RA); LK2(RA, RD, RB, RE, RC, 11); | ||
| 668 | S(S3, RA, RD, RB, RE, RC); LK2(RE, RC, RD, RA, RB, 12); | ||
| 669 | S(S4, RE, RC, RD, RA, RB); LK2(RC, RD, RA, RB, RE, 13); | ||
| 670 | S(S5, RC, RD, RA, RB, RE); LK2(RE, RC, RD, RB, RA, 14); | ||
| 671 | S(S6, RE, RC, RD, RB, RA); LK2(RD, RA, RC, RB, RE, 15); | ||
| 672 | S(S7, RD, RA, RC, RB, RE); LK2(RE, RC, RB, RD, RA, 16); | ||
| 673 | S(S0, RE, RC, RB, RD, RA); LK2(RB, RC, RD, RE, RA, 17); | ||
| 674 | S(S1, RB, RC, RD, RE, RA); LK2(RA, RD, RE, RB, RC, 18); | ||
| 675 | S(S2, RA, RD, RE, RB, RC); LK2(RC, RD, RA, RB, RE, 19); | ||
| 676 | S(S3, RC, RD, RA, RB, RE); LK2(RB, RE, RD, RC, RA, 20); | ||
| 677 | S(S4, RB, RE, RD, RC, RA); LK2(RE, RD, RC, RA, RB, 21); | ||
| 678 | S(S5, RE, RD, RC, RA, RB); LK2(RB, RE, RD, RA, RC, 22); | ||
| 679 | S(S6, RB, RE, RD, RA, RC); LK2(RD, RC, RE, RA, RB, 23); | ||
| 680 | S(S7, RD, RC, RE, RA, RB); LK2(RB, RE, RA, RD, RC, 24); | ||
| 681 | S(S0, RB, RE, RA, RD, RC); LK2(RA, RE, RD, RB, RC, 25); | ||
| 682 | S(S1, RA, RE, RD, RB, RC); LK2(RC, RD, RB, RA, RE, 26); | ||
| 683 | S(S2, RC, RD, RB, RA, RE); LK2(RE, RD, RC, RA, RB, 27); | ||
| 684 | S(S3, RE, RD, RC, RA, RB); LK2(RA, RB, RD, RE, RC, 28); | ||
| 685 | S(S4, RA, RB, RD, RE, RC); LK2(RB, RD, RE, RC, RA, 29); | ||
| 686 | S(S5, RB, RD, RE, RC, RA); LK2(RA, RB, RD, RC, RE, 30); | ||
| 687 | S(S6, RA, RB, RD, RC, RE); LK2(RD, RE, RB, RC, RA, 31); | ||
| 688 | S(S7, RD, RE, RB, RC, RA); K2(RA, RB, RC, RD, RE, 32); | ||
| 689 | |||
| 690 | leaq (4*4*4)(%rsi), %rax; | ||
| 691 | |||
| 692 | testb %cl, %cl; | ||
| 693 | jnz __enc_xor8; | ||
| 694 | |||
| 695 | write_blocks(%rsi, RA1, RB1, RC1, RD1, RK0, RK1, RK2); | ||
| 696 | write_blocks(%rax, RA2, RB2, RC2, RD2, RK0, RK1, RK2); | ||
| 697 | |||
| 698 | ret; | ||
| 699 | |||
| 700 | __enc_xor8: | ||
| 701 | xor_blocks(%rsi, RA1, RB1, RC1, RD1, RK0, RK1, RK2); | ||
| 702 | xor_blocks(%rax, RA2, RB2, RC2, RD2, RK0, RK1, RK2); | ||
| 703 | |||
| 704 | ret; | ||
| 705 | |||
| 706 | .align 8 | ||
| 707 | .global serpent_dec_blk_8way | ||
| 708 | .type serpent_dec_blk_8way,@function; | ||
| 709 | |||
| 710 | serpent_dec_blk_8way: | ||
| 711 | /* input: | ||
| 712 | * %rdi: ctx, CTX | ||
| 713 | * %rsi: dst | ||
| 714 | * %rdx: src | ||
| 715 | */ | ||
| 716 | |||
| 717 | pcmpeqd RNOT, RNOT; | ||
| 718 | |||
| 719 | leaq (4*4*4)(%rdx), %rax; | ||
| 720 | read_blocks(%rdx, RA1, RB1, RC1, RD1, RK0, RK1, RK2); | ||
| 721 | read_blocks(%rax, RA2, RB2, RC2, RD2, RK0, RK1, RK2); | ||
| 722 | |||
| 723 | K2(RA, RB, RC, RD, RE, 32); | ||
| 724 | SP(SI7, RA, RB, RC, RD, RE, 31); KL2(RB, RD, RA, RE, RC, 31); | ||
| 725 | SP(SI6, RB, RD, RA, RE, RC, 30); KL2(RA, RC, RE, RB, RD, 30); | ||
| 726 | SP(SI5, RA, RC, RE, RB, RD, 29); KL2(RC, RD, RA, RE, RB, 29); | ||
| 727 | SP(SI4, RC, RD, RA, RE, RB, 28); KL2(RC, RA, RB, RE, RD, 28); | ||
| 728 | SP(SI3, RC, RA, RB, RE, RD, 27); KL2(RB, RC, RD, RE, RA, 27); | ||
| 729 | SP(SI2, RB, RC, RD, RE, RA, 26); KL2(RC, RA, RE, RD, RB, 26); | ||
| 730 | SP(SI1, RC, RA, RE, RD, RB, 25); KL2(RB, RA, RE, RD, RC, 25); | ||
| 731 | SP(SI0, RB, RA, RE, RD, RC, 24); KL2(RE, RC, RA, RB, RD, 24); | ||
| 732 | SP(SI7, RE, RC, RA, RB, RD, 23); KL2(RC, RB, RE, RD, RA, 23); | ||
| 733 | SP(SI6, RC, RB, RE, RD, RA, 22); KL2(RE, RA, RD, RC, RB, 22); | ||
| 734 | SP(SI5, RE, RA, RD, RC, RB, 21); KL2(RA, RB, RE, RD, RC, 21); | ||
| 735 | SP(SI4, RA, RB, RE, RD, RC, 20); KL2(RA, RE, RC, RD, RB, 20); | ||
| 736 | SP(SI3, RA, RE, RC, RD, RB, 19); KL2(RC, RA, RB, RD, RE, 19); | ||
| 737 | SP(SI2, RC, RA, RB, RD, RE, 18); KL2(RA, RE, RD, RB, RC, 18); | ||
| 738 | SP(SI1, RA, RE, RD, RB, RC, 17); KL2(RC, RE, RD, RB, RA, 17); | ||
| 739 | SP(SI0, RC, RE, RD, RB, RA, 16); KL2(RD, RA, RE, RC, RB, 16); | ||
| 740 | SP(SI7, RD, RA, RE, RC, RB, 15); KL2(RA, RC, RD, RB, RE, 15); | ||
| 741 | SP(SI6, RA, RC, RD, RB, RE, 14); KL2(RD, RE, RB, RA, RC, 14); | ||
| 742 | SP(SI5, RD, RE, RB, RA, RC, 13); KL2(RE, RC, RD, RB, RA, 13); | ||
| 743 | SP(SI4, RE, RC, RD, RB, RA, 12); KL2(RE, RD, RA, RB, RC, 12); | ||
| 744 | SP(SI3, RE, RD, RA, RB, RC, 11); KL2(RA, RE, RC, RB, RD, 11); | ||
| 745 | SP(SI2, RA, RE, RC, RB, RD, 10); KL2(RE, RD, RB, RC, RA, 10); | ||
| 746 | SP(SI1, RE, RD, RB, RC, RA, 9); KL2(RA, RD, RB, RC, RE, 9); | ||
| 747 | SP(SI0, RA, RD, RB, RC, RE, 8); KL2(RB, RE, RD, RA, RC, 8); | ||
| 748 | SP(SI7, RB, RE, RD, RA, RC, 7); KL2(RE, RA, RB, RC, RD, 7); | ||
| 749 | SP(SI6, RE, RA, RB, RC, RD, 6); KL2(RB, RD, RC, RE, RA, 6); | ||
| 750 | SP(SI5, RB, RD, RC, RE, RA, 5); KL2(RD, RA, RB, RC, RE, 5); | ||
| 751 | SP(SI4, RD, RA, RB, RC, RE, 4); KL2(RD, RB, RE, RC, RA, 4); | ||
| 752 | SP(SI3, RD, RB, RE, RC, RA, 3); KL2(RE, RD, RA, RC, RB, 3); | ||
| 753 | SP(SI2, RE, RD, RA, RC, RB, 2); KL2(RD, RB, RC, RA, RE, 2); | ||
| 754 | SP(SI1, RD, RB, RC, RA, RE, 1); KL2(RE, RB, RC, RA, RD, 1); | ||
| 755 | S(SI0, RE, RB, RC, RA, RD); K2(RC, RD, RB, RE, RA, 0); | ||
| 756 | |||
| 757 | leaq (4*4*4)(%rsi), %rax; | ||
| 758 | write_blocks(%rsi, RC1, RD1, RB1, RE1, RK0, RK1, RK2); | ||
| 759 | write_blocks(%rax, RC2, RD2, RB2, RE2, RK0, RK1, RK2); | ||
| 760 | |||
| 761 | ret; | ||
diff --git a/arch/x86/crypto/serpent_sse2_glue.c b/arch/x86/crypto/serpent_sse2_glue.c new file mode 100644 index 000000000000..7955a9b76b91 --- /dev/null +++ b/arch/x86/crypto/serpent_sse2_glue.c | |||
| @@ -0,0 +1,1070 @@ | |||
| 1 | /* | ||
| 2 | * Glue Code for SSE2 assembler versions of Serpent Cipher | ||
| 3 | * | ||
| 4 | * Copyright (c) 2011 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | ||
| 5 | * | ||
| 6 | * Glue code based on aesni-intel_glue.c by: | ||
| 7 | * Copyright (C) 2008, Intel Corp. | ||
| 8 | * Author: Huang Ying <ying.huang@intel.com> | ||
| 9 | * | ||
| 10 | * CBC & ECB parts based on code (crypto/cbc.c,ecb.c) by: | ||
| 11 | * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au> | ||
| 12 | * CTR part based on code (crypto/ctr.c) by: | ||
| 13 | * (C) Copyright IBM Corp. 2007 - Joy Latten <latten@us.ibm.com> | ||
| 14 | * | ||
| 15 | * This program is free software; you can redistribute it and/or modify | ||
| 16 | * it under the terms of the GNU General Public License as published by | ||
| 17 | * the Free Software Foundation; either version 2 of the License, or | ||
| 18 | * (at your option) any later version. | ||
| 19 | * | ||
| 20 | * This program is distributed in the hope that it will be useful, | ||
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 23 | * GNU General Public License for more details. | ||
| 24 | * | ||
| 25 | * You should have received a copy of the GNU General Public License | ||
| 26 | * along with this program; if not, write to the Free Software | ||
| 27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
| 28 | * USA | ||
| 29 | * | ||
| 30 | */ | ||
| 31 | |||
| 32 | #include <linux/module.h> | ||
| 33 | #include <linux/hardirq.h> | ||
| 34 | #include <linux/types.h> | ||
| 35 | #include <linux/crypto.h> | ||
| 36 | #include <linux/err.h> | ||
| 37 | #include <crypto/algapi.h> | ||
| 38 | #include <crypto/serpent.h> | ||
| 39 | #include <crypto/cryptd.h> | ||
| 40 | #include <crypto/b128ops.h> | ||
| 41 | #include <crypto/ctr.h> | ||
| 42 | #include <crypto/lrw.h> | ||
| 43 | #include <crypto/xts.h> | ||
| 44 | #include <asm/i387.h> | ||
| 45 | #include <asm/serpent.h> | ||
| 46 | #include <crypto/scatterwalk.h> | ||
| 47 | #include <linux/workqueue.h> | ||
| 48 | #include <linux/spinlock.h> | ||
| 49 | |||
| 50 | struct async_serpent_ctx { | ||
| 51 | struct cryptd_ablkcipher *cryptd_tfm; | ||
| 52 | }; | ||
| 53 | |||
| 54 | static inline bool serpent_fpu_begin(bool fpu_enabled, unsigned int nbytes) | ||
| 55 | { | ||
| 56 | if (fpu_enabled) | ||
| 57 | return true; | ||
| 58 | |||
| 59 | /* SSE2 is only used when chunk to be processed is large enough, so | ||
| 60 | * do not enable FPU until it is necessary. | ||
| 61 | */ | ||
| 62 | if (nbytes < SERPENT_BLOCK_SIZE * SERPENT_PARALLEL_BLOCKS) | ||
| 63 | return false; | ||
| 64 | |||
| 65 | kernel_fpu_begin(); | ||
| 66 | return true; | ||
| 67 | } | ||
| 68 | |||
| 69 | static inline void serpent_fpu_end(bool fpu_enabled) | ||
| 70 | { | ||
| 71 | if (fpu_enabled) | ||
| 72 | kernel_fpu_end(); | ||
| 73 | } | ||
| 74 | |||
| 75 | static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk, | ||
| 76 | bool enc) | ||
| 77 | { | ||
| 78 | bool fpu_enabled = false; | ||
| 79 | struct serpent_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 80 | const unsigned int bsize = SERPENT_BLOCK_SIZE; | ||
| 81 | unsigned int nbytes; | ||
| 82 | int err; | ||
| 83 | |||
| 84 | err = blkcipher_walk_virt(desc, walk); | ||
| 85 | desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; | ||
| 86 | |||
| 87 | while ((nbytes = walk->nbytes)) { | ||
| 88 | u8 *wsrc = walk->src.virt.addr; | ||
| 89 | u8 *wdst = walk->dst.virt.addr; | ||
| 90 | |||
| 91 | fpu_enabled = serpent_fpu_begin(fpu_enabled, nbytes); | ||
| 92 | |||
| 93 | /* Process multi-block batch */ | ||
| 94 | if (nbytes >= bsize * SERPENT_PARALLEL_BLOCKS) { | ||
| 95 | do { | ||
| 96 | if (enc) | ||
| 97 | serpent_enc_blk_xway(ctx, wdst, wsrc); | ||
| 98 | else | ||
| 99 | serpent_dec_blk_xway(ctx, wdst, wsrc); | ||
| 100 | |||
| 101 | wsrc += bsize * SERPENT_PARALLEL_BLOCKS; | ||
| 102 | wdst += bsize * SERPENT_PARALLEL_BLOCKS; | ||
| 103 | nbytes -= bsize * SERPENT_PARALLEL_BLOCKS; | ||
| 104 | } while (nbytes >= bsize * SERPENT_PARALLEL_BLOCKS); | ||
| 105 | |||
| 106 | if (nbytes < bsize) | ||
| 107 | goto done; | ||
| 108 | } | ||
| 109 | |||
| 110 | /* Handle leftovers */ | ||
| 111 | do { | ||
| 112 | if (enc) | ||
| 113 | __serpent_encrypt(ctx, wdst, wsrc); | ||
| 114 | else | ||
| 115 | __serpent_decrypt(ctx, wdst, wsrc); | ||
| 116 | |||
| 117 | wsrc += bsize; | ||
| 118 | wdst += bsize; | ||
| 119 | nbytes -= bsize; | ||
| 120 | } while (nbytes >= bsize); | ||
| 121 | |||
| 122 | done: | ||
| 123 | err = blkcipher_walk_done(desc, walk, nbytes); | ||
| 124 | } | ||
| 125 | |||
| 126 | serpent_fpu_end(fpu_enabled); | ||
| 127 | return err; | ||
| 128 | } | ||
| 129 | |||
| 130 | static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 131 | struct scatterlist *src, unsigned int nbytes) | ||
| 132 | { | ||
| 133 | struct blkcipher_walk walk; | ||
| 134 | |||
| 135 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
| 136 | return ecb_crypt(desc, &walk, true); | ||
| 137 | } | ||
| 138 | |||
| 139 | static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 140 | struct scatterlist *src, unsigned int nbytes) | ||
| 141 | { | ||
| 142 | struct blkcipher_walk walk; | ||
| 143 | |||
| 144 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
| 145 | return ecb_crypt(desc, &walk, false); | ||
| 146 | } | ||
| 147 | |||
| 148 | static struct crypto_alg blk_ecb_alg = { | ||
| 149 | .cra_name = "__ecb-serpent-sse2", | ||
| 150 | .cra_driver_name = "__driver-ecb-serpent-sse2", | ||
| 151 | .cra_priority = 0, | ||
| 152 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
| 153 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 154 | .cra_ctxsize = sizeof(struct serpent_ctx), | ||
| 155 | .cra_alignmask = 0, | ||
| 156 | .cra_type = &crypto_blkcipher_type, | ||
| 157 | .cra_module = THIS_MODULE, | ||
| 158 | .cra_list = LIST_HEAD_INIT(blk_ecb_alg.cra_list), | ||
| 159 | .cra_u = { | ||
| 160 | .blkcipher = { | ||
| 161 | .min_keysize = SERPENT_MIN_KEY_SIZE, | ||
| 162 | .max_keysize = SERPENT_MAX_KEY_SIZE, | ||
| 163 | .setkey = serpent_setkey, | ||
| 164 | .encrypt = ecb_encrypt, | ||
| 165 | .decrypt = ecb_decrypt, | ||
| 166 | }, | ||
| 167 | }, | ||
| 168 | }; | ||
| 169 | |||
| 170 | static unsigned int __cbc_encrypt(struct blkcipher_desc *desc, | ||
| 171 | struct blkcipher_walk *walk) | ||
| 172 | { | ||
| 173 | struct serpent_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 174 | const unsigned int bsize = SERPENT_BLOCK_SIZE; | ||
| 175 | unsigned int nbytes = walk->nbytes; | ||
| 176 | u128 *src = (u128 *)walk->src.virt.addr; | ||
| 177 | u128 *dst = (u128 *)walk->dst.virt.addr; | ||
| 178 | u128 *iv = (u128 *)walk->iv; | ||
| 179 | |||
| 180 | do { | ||
| 181 | u128_xor(dst, src, iv); | ||
| 182 | __serpent_encrypt(ctx, (u8 *)dst, (u8 *)dst); | ||
| 183 | iv = dst; | ||
| 184 | |||
| 185 | src += 1; | ||
| 186 | dst += 1; | ||
| 187 | nbytes -= bsize; | ||
| 188 | } while (nbytes >= bsize); | ||
| 189 | |||
| 190 | u128_xor((u128 *)walk->iv, (u128 *)walk->iv, iv); | ||
| 191 | return nbytes; | ||
| 192 | } | ||
| 193 | |||
| 194 | static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 195 | struct scatterlist *src, unsigned int nbytes) | ||
| 196 | { | ||
| 197 | struct blkcipher_walk walk; | ||
| 198 | int err; | ||
| 199 | |||
| 200 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
| 201 | err = blkcipher_walk_virt(desc, &walk); | ||
| 202 | |||
| 203 | while ((nbytes = walk.nbytes)) { | ||
| 204 | nbytes = __cbc_encrypt(desc, &walk); | ||
| 205 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
| 206 | } | ||
| 207 | |||
| 208 | return err; | ||
| 209 | } | ||
| 210 | |||
| 211 | static unsigned int __cbc_decrypt(struct blkcipher_desc *desc, | ||
| 212 | struct blkcipher_walk *walk) | ||
| 213 | { | ||
| 214 | struct serpent_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 215 | const unsigned int bsize = SERPENT_BLOCK_SIZE; | ||
| 216 | unsigned int nbytes = walk->nbytes; | ||
| 217 | u128 *src = (u128 *)walk->src.virt.addr; | ||
| 218 | u128 *dst = (u128 *)walk->dst.virt.addr; | ||
| 219 | u128 ivs[SERPENT_PARALLEL_BLOCKS - 1]; | ||
| 220 | u128 last_iv; | ||
| 221 | int i; | ||
| 222 | |||
| 223 | /* Start of the last block. */ | ||
| 224 | src += nbytes / bsize - 1; | ||
| 225 | dst += nbytes / bsize - 1; | ||
| 226 | |||
| 227 | last_iv = *src; | ||
| 228 | |||
| 229 | /* Process multi-block batch */ | ||
| 230 | if (nbytes >= bsize * SERPENT_PARALLEL_BLOCKS) { | ||
| 231 | do { | ||
| 232 | nbytes -= bsize * (SERPENT_PARALLEL_BLOCKS - 1); | ||
| 233 | src -= SERPENT_PARALLEL_BLOCKS - 1; | ||
| 234 | dst -= SERPENT_PARALLEL_BLOCKS - 1; | ||
| 235 | |||
| 236 | for (i = 0; i < SERPENT_PARALLEL_BLOCKS - 1; i++) | ||
| 237 | ivs[i] = src[i]; | ||
| 238 | |||
| 239 | serpent_dec_blk_xway(ctx, (u8 *)dst, (u8 *)src); | ||
| 240 | |||
| 241 | for (i = 0; i < SERPENT_PARALLEL_BLOCKS - 1; i++) | ||
| 242 | u128_xor(dst + (i + 1), dst + (i + 1), ivs + i); | ||
| 243 | |||
| 244 | nbytes -= bsize; | ||
| 245 | if (nbytes < bsize) | ||
| 246 | goto done; | ||
| 247 | |||
| 248 | u128_xor(dst, dst, src - 1); | ||
| 249 | src -= 1; | ||
| 250 | dst -= 1; | ||
| 251 | } while (nbytes >= bsize * SERPENT_PARALLEL_BLOCKS); | ||
| 252 | |||
| 253 | if (nbytes < bsize) | ||
| 254 | goto done; | ||
| 255 | } | ||
| 256 | |||
| 257 | /* Handle leftovers */ | ||
| 258 | for (;;) { | ||
| 259 | __serpent_decrypt(ctx, (u8 *)dst, (u8 *)src); | ||
| 260 | |||
| 261 | nbytes -= bsize; | ||
| 262 | if (nbytes < bsize) | ||
| 263 | break; | ||
| 264 | |||
| 265 | u128_xor(dst, dst, src - 1); | ||
| 266 | src -= 1; | ||
| 267 | dst -= 1; | ||
| 268 | } | ||
| 269 | |||
| 270 | done: | ||
| 271 | u128_xor(dst, dst, (u128 *)walk->iv); | ||
| 272 | *(u128 *)walk->iv = last_iv; | ||
| 273 | |||
| 274 | return nbytes; | ||
| 275 | } | ||
| 276 | |||
| 277 | static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 278 | struct scatterlist *src, unsigned int nbytes) | ||
| 279 | { | ||
| 280 | bool fpu_enabled = false; | ||
| 281 | struct blkcipher_walk walk; | ||
| 282 | int err; | ||
| 283 | |||
| 284 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
| 285 | err = blkcipher_walk_virt(desc, &walk); | ||
| 286 | desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; | ||
| 287 | |||
| 288 | while ((nbytes = walk.nbytes)) { | ||
| 289 | fpu_enabled = serpent_fpu_begin(fpu_enabled, nbytes); | ||
| 290 | nbytes = __cbc_decrypt(desc, &walk); | ||
| 291 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
| 292 | } | ||
| 293 | |||
| 294 | serpent_fpu_end(fpu_enabled); | ||
| 295 | return err; | ||
| 296 | } | ||
| 297 | |||
| 298 | static struct crypto_alg blk_cbc_alg = { | ||
| 299 | .cra_name = "__cbc-serpent-sse2", | ||
| 300 | .cra_driver_name = "__driver-cbc-serpent-sse2", | ||
| 301 | .cra_priority = 0, | ||
| 302 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
| 303 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 304 | .cra_ctxsize = sizeof(struct serpent_ctx), | ||
| 305 | .cra_alignmask = 0, | ||
| 306 | .cra_type = &crypto_blkcipher_type, | ||
| 307 | .cra_module = THIS_MODULE, | ||
| 308 | .cra_list = LIST_HEAD_INIT(blk_cbc_alg.cra_list), | ||
| 309 | .cra_u = { | ||
| 310 | .blkcipher = { | ||
| 311 | .min_keysize = SERPENT_MIN_KEY_SIZE, | ||
| 312 | .max_keysize = SERPENT_MAX_KEY_SIZE, | ||
| 313 | .setkey = serpent_setkey, | ||
| 314 | .encrypt = cbc_encrypt, | ||
| 315 | .decrypt = cbc_decrypt, | ||
| 316 | }, | ||
| 317 | }, | ||
| 318 | }; | ||
| 319 | |||
| 320 | static inline void u128_to_be128(be128 *dst, const u128 *src) | ||
| 321 | { | ||
| 322 | dst->a = cpu_to_be64(src->a); | ||
| 323 | dst->b = cpu_to_be64(src->b); | ||
| 324 | } | ||
| 325 | |||
| 326 | static inline void be128_to_u128(u128 *dst, const be128 *src) | ||
| 327 | { | ||
| 328 | dst->a = be64_to_cpu(src->a); | ||
| 329 | dst->b = be64_to_cpu(src->b); | ||
| 330 | } | ||
| 331 | |||
| 332 | static inline void u128_inc(u128 *i) | ||
| 333 | { | ||
| 334 | i->b++; | ||
| 335 | if (!i->b) | ||
| 336 | i->a++; | ||
| 337 | } | ||
| 338 | |||
| 339 | static void ctr_crypt_final(struct blkcipher_desc *desc, | ||
| 340 | struct blkcipher_walk *walk) | ||
| 341 | { | ||
| 342 | struct serpent_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 343 | u8 *ctrblk = walk->iv; | ||
| 344 | u8 keystream[SERPENT_BLOCK_SIZE]; | ||
| 345 | u8 *src = walk->src.virt.addr; | ||
| 346 | u8 *dst = walk->dst.virt.addr; | ||
| 347 | unsigned int nbytes = walk->nbytes; | ||
| 348 | |||
| 349 | __serpent_encrypt(ctx, keystream, ctrblk); | ||
| 350 | crypto_xor(keystream, src, nbytes); | ||
| 351 | memcpy(dst, keystream, nbytes); | ||
| 352 | |||
| 353 | crypto_inc(ctrblk, SERPENT_BLOCK_SIZE); | ||
| 354 | } | ||
| 355 | |||
| 356 | static unsigned int __ctr_crypt(struct blkcipher_desc *desc, | ||
| 357 | struct blkcipher_walk *walk) | ||
| 358 | { | ||
| 359 | struct serpent_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 360 | const unsigned int bsize = SERPENT_BLOCK_SIZE; | ||
| 361 | unsigned int nbytes = walk->nbytes; | ||
| 362 | u128 *src = (u128 *)walk->src.virt.addr; | ||
| 363 | u128 *dst = (u128 *)walk->dst.virt.addr; | ||
| 364 | u128 ctrblk; | ||
| 365 | be128 ctrblocks[SERPENT_PARALLEL_BLOCKS]; | ||
| 366 | int i; | ||
| 367 | |||
| 368 | be128_to_u128(&ctrblk, (be128 *)walk->iv); | ||
| 369 | |||
| 370 | /* Process multi-block batch */ | ||
| 371 | if (nbytes >= bsize * SERPENT_PARALLEL_BLOCKS) { | ||
| 372 | do { | ||
| 373 | /* create ctrblks for parallel encrypt */ | ||
| 374 | for (i = 0; i < SERPENT_PARALLEL_BLOCKS; i++) { | ||
| 375 | if (dst != src) | ||
| 376 | dst[i] = src[i]; | ||
| 377 | |||
| 378 | u128_to_be128(&ctrblocks[i], &ctrblk); | ||
| 379 | u128_inc(&ctrblk); | ||
| 380 | } | ||
| 381 | |||
| 382 | serpent_enc_blk_xway_xor(ctx, (u8 *)dst, | ||
| 383 | (u8 *)ctrblocks); | ||
| 384 | |||
| 385 | src += SERPENT_PARALLEL_BLOCKS; | ||
| 386 | dst += SERPENT_PARALLEL_BLOCKS; | ||
| 387 | nbytes -= bsize * SERPENT_PARALLEL_BLOCKS; | ||
| 388 | } while (nbytes >= bsize * SERPENT_PARALLEL_BLOCKS); | ||
| 389 | |||
| 390 | if (nbytes < bsize) | ||
| 391 | goto done; | ||
| 392 | } | ||
| 393 | |||
| 394 | /* Handle leftovers */ | ||
| 395 | do { | ||
| 396 | if (dst != src) | ||
| 397 | *dst = *src; | ||
| 398 | |||
| 399 | u128_to_be128(&ctrblocks[0], &ctrblk); | ||
| 400 | u128_inc(&ctrblk); | ||
| 401 | |||
| 402 | __serpent_encrypt(ctx, (u8 *)ctrblocks, (u8 *)ctrblocks); | ||
| 403 | u128_xor(dst, dst, (u128 *)ctrblocks); | ||
| 404 | |||
| 405 | src += 1; | ||
| 406 | dst += 1; | ||
| 407 | nbytes -= bsize; | ||
| 408 | } while (nbytes >= bsize); | ||
| 409 | |||
| 410 | done: | ||
| 411 | u128_to_be128((be128 *)walk->iv, &ctrblk); | ||
| 412 | return nbytes; | ||
| 413 | } | ||
| 414 | |||
| 415 | static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 416 | struct scatterlist *src, unsigned int nbytes) | ||
| 417 | { | ||
| 418 | bool fpu_enabled = false; | ||
| 419 | struct blkcipher_walk walk; | ||
| 420 | int err; | ||
| 421 | |||
| 422 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
| 423 | err = blkcipher_walk_virt_block(desc, &walk, SERPENT_BLOCK_SIZE); | ||
| 424 | desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; | ||
| 425 | |||
| 426 | while ((nbytes = walk.nbytes) >= SERPENT_BLOCK_SIZE) { | ||
| 427 | fpu_enabled = serpent_fpu_begin(fpu_enabled, nbytes); | ||
| 428 | nbytes = __ctr_crypt(desc, &walk); | ||
| 429 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
| 430 | } | ||
| 431 | |||
| 432 | serpent_fpu_end(fpu_enabled); | ||
| 433 | |||
| 434 | if (walk.nbytes) { | ||
| 435 | ctr_crypt_final(desc, &walk); | ||
| 436 | err = blkcipher_walk_done(desc, &walk, 0); | ||
| 437 | } | ||
| 438 | |||
| 439 | return err; | ||
| 440 | } | ||
| 441 | |||
| 442 | static struct crypto_alg blk_ctr_alg = { | ||
| 443 | .cra_name = "__ctr-serpent-sse2", | ||
| 444 | .cra_driver_name = "__driver-ctr-serpent-sse2", | ||
| 445 | .cra_priority = 0, | ||
| 446 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
| 447 | .cra_blocksize = 1, | ||
| 448 | .cra_ctxsize = sizeof(struct serpent_ctx), | ||
| 449 | .cra_alignmask = 0, | ||
| 450 | .cra_type = &crypto_blkcipher_type, | ||
| 451 | .cra_module = THIS_MODULE, | ||
| 452 | .cra_list = LIST_HEAD_INIT(blk_ctr_alg.cra_list), | ||
| 453 | .cra_u = { | ||
| 454 | .blkcipher = { | ||
| 455 | .min_keysize = SERPENT_MIN_KEY_SIZE, | ||
| 456 | .max_keysize = SERPENT_MAX_KEY_SIZE, | ||
| 457 | .ivsize = SERPENT_BLOCK_SIZE, | ||
| 458 | .setkey = serpent_setkey, | ||
| 459 | .encrypt = ctr_crypt, | ||
| 460 | .decrypt = ctr_crypt, | ||
| 461 | }, | ||
| 462 | }, | ||
| 463 | }; | ||
| 464 | |||
| 465 | struct crypt_priv { | ||
| 466 | struct serpent_ctx *ctx; | ||
| 467 | bool fpu_enabled; | ||
| 468 | }; | ||
| 469 | |||
| 470 | static void encrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes) | ||
| 471 | { | ||
| 472 | const unsigned int bsize = SERPENT_BLOCK_SIZE; | ||
| 473 | struct crypt_priv *ctx = priv; | ||
| 474 | int i; | ||
| 475 | |||
| 476 | ctx->fpu_enabled = serpent_fpu_begin(ctx->fpu_enabled, nbytes); | ||
| 477 | |||
| 478 | if (nbytes == bsize * SERPENT_PARALLEL_BLOCKS) { | ||
| 479 | serpent_enc_blk_xway(ctx->ctx, srcdst, srcdst); | ||
| 480 | return; | ||
| 481 | } | ||
| 482 | |||
| 483 | for (i = 0; i < nbytes / bsize; i++, srcdst += bsize) | ||
| 484 | __serpent_encrypt(ctx->ctx, srcdst, srcdst); | ||
| 485 | } | ||
| 486 | |||
| 487 | static void decrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes) | ||
| 488 | { | ||
| 489 | const unsigned int bsize = SERPENT_BLOCK_SIZE; | ||
| 490 | struct crypt_priv *ctx = priv; | ||
| 491 | int i; | ||
| 492 | |||
| 493 | ctx->fpu_enabled = serpent_fpu_begin(ctx->fpu_enabled, nbytes); | ||
| 494 | |||
| 495 | if (nbytes == bsize * SERPENT_PARALLEL_BLOCKS) { | ||
| 496 | serpent_dec_blk_xway(ctx->ctx, srcdst, srcdst); | ||
| 497 | return; | ||
| 498 | } | ||
| 499 | |||
| 500 | for (i = 0; i < nbytes / bsize; i++, srcdst += bsize) | ||
| 501 | __serpent_decrypt(ctx->ctx, srcdst, srcdst); | ||
| 502 | } | ||
| 503 | |||
| 504 | struct serpent_lrw_ctx { | ||
| 505 | struct lrw_table_ctx lrw_table; | ||
| 506 | struct serpent_ctx serpent_ctx; | ||
| 507 | }; | ||
| 508 | |||
| 509 | static int lrw_serpent_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
| 510 | unsigned int keylen) | ||
| 511 | { | ||
| 512 | struct serpent_lrw_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 513 | int err; | ||
| 514 | |||
| 515 | err = __serpent_setkey(&ctx->serpent_ctx, key, keylen - | ||
| 516 | SERPENT_BLOCK_SIZE); | ||
| 517 | if (err) | ||
| 518 | return err; | ||
| 519 | |||
| 520 | return lrw_init_table(&ctx->lrw_table, key + keylen - | ||
| 521 | SERPENT_BLOCK_SIZE); | ||
| 522 | } | ||
| 523 | |||
| 524 | static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 525 | struct scatterlist *src, unsigned int nbytes) | ||
| 526 | { | ||
| 527 | struct serpent_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 528 | be128 buf[SERPENT_PARALLEL_BLOCKS]; | ||
| 529 | struct crypt_priv crypt_ctx = { | ||
| 530 | .ctx = &ctx->serpent_ctx, | ||
| 531 | .fpu_enabled = false, | ||
| 532 | }; | ||
| 533 | struct lrw_crypt_req req = { | ||
| 534 | .tbuf = buf, | ||
| 535 | .tbuflen = sizeof(buf), | ||
| 536 | |||
| 537 | .table_ctx = &ctx->lrw_table, | ||
| 538 | .crypt_ctx = &crypt_ctx, | ||
| 539 | .crypt_fn = encrypt_callback, | ||
| 540 | }; | ||
| 541 | int ret; | ||
| 542 | |||
| 543 | desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; | ||
| 544 | ret = lrw_crypt(desc, dst, src, nbytes, &req); | ||
| 545 | serpent_fpu_end(crypt_ctx.fpu_enabled); | ||
| 546 | |||
| 547 | return ret; | ||
| 548 | } | ||
| 549 | |||
| 550 | static int lrw_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 551 | struct scatterlist *src, unsigned int nbytes) | ||
| 552 | { | ||
| 553 | struct serpent_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 554 | be128 buf[SERPENT_PARALLEL_BLOCKS]; | ||
| 555 | struct crypt_priv crypt_ctx = { | ||
| 556 | .ctx = &ctx->serpent_ctx, | ||
| 557 | .fpu_enabled = false, | ||
| 558 | }; | ||
| 559 | struct lrw_crypt_req req = { | ||
| 560 | .tbuf = buf, | ||
| 561 | .tbuflen = sizeof(buf), | ||
| 562 | |||
| 563 | .table_ctx = &ctx->lrw_table, | ||
| 564 | .crypt_ctx = &crypt_ctx, | ||
| 565 | .crypt_fn = decrypt_callback, | ||
| 566 | }; | ||
| 567 | int ret; | ||
| 568 | |||
| 569 | desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; | ||
| 570 | ret = lrw_crypt(desc, dst, src, nbytes, &req); | ||
| 571 | serpent_fpu_end(crypt_ctx.fpu_enabled); | ||
| 572 | |||
| 573 | return ret; | ||
| 574 | } | ||
| 575 | |||
| 576 | static void lrw_exit_tfm(struct crypto_tfm *tfm) | ||
| 577 | { | ||
| 578 | struct serpent_lrw_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 579 | |||
| 580 | lrw_free_table(&ctx->lrw_table); | ||
| 581 | } | ||
| 582 | |||
| 583 | static struct crypto_alg blk_lrw_alg = { | ||
| 584 | .cra_name = "__lrw-serpent-sse2", | ||
| 585 | .cra_driver_name = "__driver-lrw-serpent-sse2", | ||
| 586 | .cra_priority = 0, | ||
| 587 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
| 588 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 589 | .cra_ctxsize = sizeof(struct serpent_lrw_ctx), | ||
| 590 | .cra_alignmask = 0, | ||
| 591 | .cra_type = &crypto_blkcipher_type, | ||
| 592 | .cra_module = THIS_MODULE, | ||
| 593 | .cra_list = LIST_HEAD_INIT(blk_lrw_alg.cra_list), | ||
| 594 | .cra_exit = lrw_exit_tfm, | ||
| 595 | .cra_u = { | ||
| 596 | .blkcipher = { | ||
| 597 | .min_keysize = SERPENT_MIN_KEY_SIZE + | ||
| 598 | SERPENT_BLOCK_SIZE, | ||
| 599 | .max_keysize = SERPENT_MAX_KEY_SIZE + | ||
| 600 | SERPENT_BLOCK_SIZE, | ||
| 601 | .ivsize = SERPENT_BLOCK_SIZE, | ||
| 602 | .setkey = lrw_serpent_setkey, | ||
| 603 | .encrypt = lrw_encrypt, | ||
| 604 | .decrypt = lrw_decrypt, | ||
| 605 | }, | ||
| 606 | }, | ||
| 607 | }; | ||
| 608 | |||
| 609 | struct serpent_xts_ctx { | ||
| 610 | struct serpent_ctx tweak_ctx; | ||
| 611 | struct serpent_ctx crypt_ctx; | ||
| 612 | }; | ||
| 613 | |||
| 614 | static int xts_serpent_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
| 615 | unsigned int keylen) | ||
| 616 | { | ||
| 617 | struct serpent_xts_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 618 | u32 *flags = &tfm->crt_flags; | ||
| 619 | int err; | ||
| 620 | |||
| 621 | /* key consists of keys of equal size concatenated, therefore | ||
| 622 | * the length must be even | ||
| 623 | */ | ||
| 624 | if (keylen % 2) { | ||
| 625 | *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; | ||
| 626 | return -EINVAL; | ||
| 627 | } | ||
| 628 | |||
| 629 | /* first half of xts-key is for crypt */ | ||
| 630 | err = __serpent_setkey(&ctx->crypt_ctx, key, keylen / 2); | ||
| 631 | if (err) | ||
| 632 | return err; | ||
| 633 | |||
| 634 | /* second half of xts-key is for tweak */ | ||
| 635 | return __serpent_setkey(&ctx->tweak_ctx, key + keylen / 2, keylen / 2); | ||
| 636 | } | ||
| 637 | |||
| 638 | static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 639 | struct scatterlist *src, unsigned int nbytes) | ||
| 640 | { | ||
| 641 | struct serpent_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 642 | be128 buf[SERPENT_PARALLEL_BLOCKS]; | ||
| 643 | struct crypt_priv crypt_ctx = { | ||
| 644 | .ctx = &ctx->crypt_ctx, | ||
| 645 | .fpu_enabled = false, | ||
| 646 | }; | ||
| 647 | struct xts_crypt_req req = { | ||
| 648 | .tbuf = buf, | ||
| 649 | .tbuflen = sizeof(buf), | ||
| 650 | |||
| 651 | .tweak_ctx = &ctx->tweak_ctx, | ||
| 652 | .tweak_fn = XTS_TWEAK_CAST(__serpent_encrypt), | ||
| 653 | .crypt_ctx = &crypt_ctx, | ||
| 654 | .crypt_fn = encrypt_callback, | ||
| 655 | }; | ||
| 656 | int ret; | ||
| 657 | |||
| 658 | desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; | ||
| 659 | ret = xts_crypt(desc, dst, src, nbytes, &req); | ||
| 660 | serpent_fpu_end(crypt_ctx.fpu_enabled); | ||
| 661 | |||
| 662 | return ret; | ||
| 663 | } | ||
| 664 | |||
| 665 | static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 666 | struct scatterlist *src, unsigned int nbytes) | ||
| 667 | { | ||
| 668 | struct serpent_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 669 | be128 buf[SERPENT_PARALLEL_BLOCKS]; | ||
| 670 | struct crypt_priv crypt_ctx = { | ||
| 671 | .ctx = &ctx->crypt_ctx, | ||
| 672 | .fpu_enabled = false, | ||
| 673 | }; | ||
| 674 | struct xts_crypt_req req = { | ||
| 675 | .tbuf = buf, | ||
| 676 | .tbuflen = sizeof(buf), | ||
| 677 | |||
| 678 | .tweak_ctx = &ctx->tweak_ctx, | ||
| 679 | .tweak_fn = XTS_TWEAK_CAST(__serpent_encrypt), | ||
| 680 | .crypt_ctx = &crypt_ctx, | ||
| 681 | .crypt_fn = decrypt_callback, | ||
| 682 | }; | ||
| 683 | int ret; | ||
| 684 | |||
| 685 | desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; | ||
| 686 | ret = xts_crypt(desc, dst, src, nbytes, &req); | ||
| 687 | serpent_fpu_end(crypt_ctx.fpu_enabled); | ||
| 688 | |||
| 689 | return ret; | ||
| 690 | } | ||
| 691 | |||
| 692 | static struct crypto_alg blk_xts_alg = { | ||
| 693 | .cra_name = "__xts-serpent-sse2", | ||
| 694 | .cra_driver_name = "__driver-xts-serpent-sse2", | ||
| 695 | .cra_priority = 0, | ||
| 696 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
| 697 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 698 | .cra_ctxsize = sizeof(struct serpent_xts_ctx), | ||
| 699 | .cra_alignmask = 0, | ||
| 700 | .cra_type = &crypto_blkcipher_type, | ||
| 701 | .cra_module = THIS_MODULE, | ||
| 702 | .cra_list = LIST_HEAD_INIT(blk_xts_alg.cra_list), | ||
| 703 | .cra_u = { | ||
| 704 | .blkcipher = { | ||
| 705 | .min_keysize = SERPENT_MIN_KEY_SIZE * 2, | ||
| 706 | .max_keysize = SERPENT_MAX_KEY_SIZE * 2, | ||
| 707 | .ivsize = SERPENT_BLOCK_SIZE, | ||
| 708 | .setkey = xts_serpent_setkey, | ||
| 709 | .encrypt = xts_encrypt, | ||
| 710 | .decrypt = xts_decrypt, | ||
| 711 | }, | ||
| 712 | }, | ||
| 713 | }; | ||
| 714 | |||
| 715 | static int ablk_set_key(struct crypto_ablkcipher *tfm, const u8 *key, | ||
| 716 | unsigned int key_len) | ||
| 717 | { | ||
| 718 | struct async_serpent_ctx *ctx = crypto_ablkcipher_ctx(tfm); | ||
| 719 | struct crypto_ablkcipher *child = &ctx->cryptd_tfm->base; | ||
| 720 | int err; | ||
| 721 | |||
| 722 | crypto_ablkcipher_clear_flags(child, CRYPTO_TFM_REQ_MASK); | ||
| 723 | crypto_ablkcipher_set_flags(child, crypto_ablkcipher_get_flags(tfm) | ||
| 724 | & CRYPTO_TFM_REQ_MASK); | ||
| 725 | err = crypto_ablkcipher_setkey(child, key, key_len); | ||
| 726 | crypto_ablkcipher_set_flags(tfm, crypto_ablkcipher_get_flags(child) | ||
| 727 | & CRYPTO_TFM_RES_MASK); | ||
| 728 | return err; | ||
| 729 | } | ||
| 730 | |||
| 731 | static int __ablk_encrypt(struct ablkcipher_request *req) | ||
| 732 | { | ||
| 733 | struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); | ||
| 734 | struct async_serpent_ctx *ctx = crypto_ablkcipher_ctx(tfm); | ||
| 735 | struct blkcipher_desc desc; | ||
| 736 | |||
| 737 | desc.tfm = cryptd_ablkcipher_child(ctx->cryptd_tfm); | ||
| 738 | desc.info = req->info; | ||
| 739 | desc.flags = 0; | ||
| 740 | |||
| 741 | return crypto_blkcipher_crt(desc.tfm)->encrypt( | ||
| 742 | &desc, req->dst, req->src, req->nbytes); | ||
| 743 | } | ||
| 744 | |||
| 745 | static int ablk_encrypt(struct ablkcipher_request *req) | ||
| 746 | { | ||
| 747 | struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); | ||
| 748 | struct async_serpent_ctx *ctx = crypto_ablkcipher_ctx(tfm); | ||
| 749 | |||
| 750 | if (!irq_fpu_usable()) { | ||
| 751 | struct ablkcipher_request *cryptd_req = | ||
| 752 | ablkcipher_request_ctx(req); | ||
| 753 | |||
| 754 | memcpy(cryptd_req, req, sizeof(*req)); | ||
| 755 | ablkcipher_request_set_tfm(cryptd_req, &ctx->cryptd_tfm->base); | ||
| 756 | |||
| 757 | return crypto_ablkcipher_encrypt(cryptd_req); | ||
| 758 | } else { | ||
| 759 | return __ablk_encrypt(req); | ||
| 760 | } | ||
| 761 | } | ||
| 762 | |||
| 763 | static int ablk_decrypt(struct ablkcipher_request *req) | ||
| 764 | { | ||
| 765 | struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); | ||
| 766 | struct async_serpent_ctx *ctx = crypto_ablkcipher_ctx(tfm); | ||
| 767 | |||
| 768 | if (!irq_fpu_usable()) { | ||
| 769 | struct ablkcipher_request *cryptd_req = | ||
| 770 | ablkcipher_request_ctx(req); | ||
| 771 | |||
| 772 | memcpy(cryptd_req, req, sizeof(*req)); | ||
| 773 | ablkcipher_request_set_tfm(cryptd_req, &ctx->cryptd_tfm->base); | ||
| 774 | |||
| 775 | return crypto_ablkcipher_decrypt(cryptd_req); | ||
| 776 | } else { | ||
| 777 | struct blkcipher_desc desc; | ||
| 778 | |||
| 779 | desc.tfm = cryptd_ablkcipher_child(ctx->cryptd_tfm); | ||
| 780 | desc.info = req->info; | ||
| 781 | desc.flags = 0; | ||
| 782 | |||
| 783 | return crypto_blkcipher_crt(desc.tfm)->decrypt( | ||
| 784 | &desc, req->dst, req->src, req->nbytes); | ||
| 785 | } | ||
| 786 | } | ||
| 787 | |||
| 788 | static void ablk_exit(struct crypto_tfm *tfm) | ||
| 789 | { | ||
| 790 | struct async_serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 791 | |||
| 792 | cryptd_free_ablkcipher(ctx->cryptd_tfm); | ||
| 793 | } | ||
| 794 | |||
| 795 | static void ablk_init_common(struct crypto_tfm *tfm, | ||
| 796 | struct cryptd_ablkcipher *cryptd_tfm) | ||
| 797 | { | ||
| 798 | struct async_serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 799 | |||
| 800 | ctx->cryptd_tfm = cryptd_tfm; | ||
| 801 | tfm->crt_ablkcipher.reqsize = sizeof(struct ablkcipher_request) + | ||
| 802 | crypto_ablkcipher_reqsize(&cryptd_tfm->base); | ||
| 803 | } | ||
| 804 | |||
| 805 | static int ablk_ecb_init(struct crypto_tfm *tfm) | ||
| 806 | { | ||
| 807 | struct cryptd_ablkcipher *cryptd_tfm; | ||
| 808 | |||
| 809 | cryptd_tfm = cryptd_alloc_ablkcipher("__driver-ecb-serpent-sse2", 0, 0); | ||
| 810 | if (IS_ERR(cryptd_tfm)) | ||
| 811 | return PTR_ERR(cryptd_tfm); | ||
| 812 | ablk_init_common(tfm, cryptd_tfm); | ||
| 813 | return 0; | ||
| 814 | } | ||
| 815 | |||
| 816 | static struct crypto_alg ablk_ecb_alg = { | ||
| 817 | .cra_name = "ecb(serpent)", | ||
| 818 | .cra_driver_name = "ecb-serpent-sse2", | ||
| 819 | .cra_priority = 400, | ||
| 820 | .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, | ||
| 821 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 822 | .cra_ctxsize = sizeof(struct async_serpent_ctx), | ||
| 823 | .cra_alignmask = 0, | ||
| 824 | .cra_type = &crypto_ablkcipher_type, | ||
| 825 | .cra_module = THIS_MODULE, | ||
| 826 | .cra_list = LIST_HEAD_INIT(ablk_ecb_alg.cra_list), | ||
| 827 | .cra_init = ablk_ecb_init, | ||
| 828 | .cra_exit = ablk_exit, | ||
| 829 | .cra_u = { | ||
| 830 | .ablkcipher = { | ||
| 831 | .min_keysize = SERPENT_MIN_KEY_SIZE, | ||
| 832 | .max_keysize = SERPENT_MAX_KEY_SIZE, | ||
| 833 | .setkey = ablk_set_key, | ||
| 834 | .encrypt = ablk_encrypt, | ||
| 835 | .decrypt = ablk_decrypt, | ||
| 836 | }, | ||
| 837 | }, | ||
| 838 | }; | ||
| 839 | |||
| 840 | static int ablk_cbc_init(struct crypto_tfm *tfm) | ||
| 841 | { | ||
| 842 | struct cryptd_ablkcipher *cryptd_tfm; | ||
| 843 | |||
| 844 | cryptd_tfm = cryptd_alloc_ablkcipher("__driver-cbc-serpent-sse2", 0, 0); | ||
| 845 | if (IS_ERR(cryptd_tfm)) | ||
| 846 | return PTR_ERR(cryptd_tfm); | ||
| 847 | ablk_init_common(tfm, cryptd_tfm); | ||
| 848 | return 0; | ||
| 849 | } | ||
| 850 | |||
| 851 | static struct crypto_alg ablk_cbc_alg = { | ||
| 852 | .cra_name = "cbc(serpent)", | ||
| 853 | .cra_driver_name = "cbc-serpent-sse2", | ||
| 854 | .cra_priority = 400, | ||
| 855 | .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, | ||
| 856 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 857 | .cra_ctxsize = sizeof(struct async_serpent_ctx), | ||
| 858 | .cra_alignmask = 0, | ||
| 859 | .cra_type = &crypto_ablkcipher_type, | ||
| 860 | .cra_module = THIS_MODULE, | ||
| 861 | .cra_list = LIST_HEAD_INIT(ablk_cbc_alg.cra_list), | ||
| 862 | .cra_init = ablk_cbc_init, | ||
| 863 | .cra_exit = ablk_exit, | ||
| 864 | .cra_u = { | ||
| 865 | .ablkcipher = { | ||
| 866 | .min_keysize = SERPENT_MIN_KEY_SIZE, | ||
| 867 | .max_keysize = SERPENT_MAX_KEY_SIZE, | ||
| 868 | .ivsize = SERPENT_BLOCK_SIZE, | ||
| 869 | .setkey = ablk_set_key, | ||
| 870 | .encrypt = __ablk_encrypt, | ||
| 871 | .decrypt = ablk_decrypt, | ||
| 872 | }, | ||
| 873 | }, | ||
| 874 | }; | ||
| 875 | |||
| 876 | static int ablk_ctr_init(struct crypto_tfm *tfm) | ||
| 877 | { | ||
| 878 | struct cryptd_ablkcipher *cryptd_tfm; | ||
| 879 | |||
| 880 | cryptd_tfm = cryptd_alloc_ablkcipher("__driver-ctr-serpent-sse2", 0, 0); | ||
| 881 | if (IS_ERR(cryptd_tfm)) | ||
| 882 | return PTR_ERR(cryptd_tfm); | ||
| 883 | ablk_init_common(tfm, cryptd_tfm); | ||
| 884 | return 0; | ||
| 885 | } | ||
| 886 | |||
| 887 | static struct crypto_alg ablk_ctr_alg = { | ||
| 888 | .cra_name = "ctr(serpent)", | ||
| 889 | .cra_driver_name = "ctr-serpent-sse2", | ||
| 890 | .cra_priority = 400, | ||
| 891 | .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, | ||
| 892 | .cra_blocksize = 1, | ||
| 893 | .cra_ctxsize = sizeof(struct async_serpent_ctx), | ||
| 894 | .cra_alignmask = 0, | ||
| 895 | .cra_type = &crypto_ablkcipher_type, | ||
| 896 | .cra_module = THIS_MODULE, | ||
| 897 | .cra_list = LIST_HEAD_INIT(ablk_ctr_alg.cra_list), | ||
| 898 | .cra_init = ablk_ctr_init, | ||
| 899 | .cra_exit = ablk_exit, | ||
| 900 | .cra_u = { | ||
| 901 | .ablkcipher = { | ||
| 902 | .min_keysize = SERPENT_MIN_KEY_SIZE, | ||
| 903 | .max_keysize = SERPENT_MAX_KEY_SIZE, | ||
| 904 | .ivsize = SERPENT_BLOCK_SIZE, | ||
| 905 | .setkey = ablk_set_key, | ||
| 906 | .encrypt = ablk_encrypt, | ||
| 907 | .decrypt = ablk_encrypt, | ||
| 908 | .geniv = "chainiv", | ||
| 909 | }, | ||
| 910 | }, | ||
| 911 | }; | ||
| 912 | |||
| 913 | static int ablk_lrw_init(struct crypto_tfm *tfm) | ||
| 914 | { | ||
| 915 | struct cryptd_ablkcipher *cryptd_tfm; | ||
| 916 | |||
| 917 | cryptd_tfm = cryptd_alloc_ablkcipher("__driver-lrw-serpent-sse2", 0, 0); | ||
| 918 | if (IS_ERR(cryptd_tfm)) | ||
| 919 | return PTR_ERR(cryptd_tfm); | ||
| 920 | ablk_init_common(tfm, cryptd_tfm); | ||
| 921 | return 0; | ||
| 922 | } | ||
| 923 | |||
| 924 | static struct crypto_alg ablk_lrw_alg = { | ||
| 925 | .cra_name = "lrw(serpent)", | ||
| 926 | .cra_driver_name = "lrw-serpent-sse2", | ||
| 927 | .cra_priority = 400, | ||
| 928 | .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, | ||
| 929 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 930 | .cra_ctxsize = sizeof(struct async_serpent_ctx), | ||
| 931 | .cra_alignmask = 0, | ||
| 932 | .cra_type = &crypto_ablkcipher_type, | ||
| 933 | .cra_module = THIS_MODULE, | ||
| 934 | .cra_list = LIST_HEAD_INIT(ablk_lrw_alg.cra_list), | ||
| 935 | .cra_init = ablk_lrw_init, | ||
| 936 | .cra_exit = ablk_exit, | ||
| 937 | .cra_u = { | ||
| 938 | .ablkcipher = { | ||
| 939 | .min_keysize = SERPENT_MIN_KEY_SIZE + | ||
| 940 | SERPENT_BLOCK_SIZE, | ||
| 941 | .max_keysize = SERPENT_MAX_KEY_SIZE + | ||
| 942 | SERPENT_BLOCK_SIZE, | ||
| 943 | .ivsize = SERPENT_BLOCK_SIZE, | ||
| 944 | .setkey = ablk_set_key, | ||
| 945 | .encrypt = ablk_encrypt, | ||
| 946 | .decrypt = ablk_decrypt, | ||
| 947 | }, | ||
| 948 | }, | ||
| 949 | }; | ||
| 950 | |||
| 951 | static int ablk_xts_init(struct crypto_tfm *tfm) | ||
| 952 | { | ||
| 953 | struct cryptd_ablkcipher *cryptd_tfm; | ||
| 954 | |||
| 955 | cryptd_tfm = cryptd_alloc_ablkcipher("__driver-xts-serpent-sse2", 0, 0); | ||
| 956 | if (IS_ERR(cryptd_tfm)) | ||
| 957 | return PTR_ERR(cryptd_tfm); | ||
| 958 | ablk_init_common(tfm, cryptd_tfm); | ||
| 959 | return 0; | ||
| 960 | } | ||
| 961 | |||
| 962 | static struct crypto_alg ablk_xts_alg = { | ||
| 963 | .cra_name = "xts(serpent)", | ||
| 964 | .cra_driver_name = "xts-serpent-sse2", | ||
| 965 | .cra_priority = 400, | ||
| 966 | .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, | ||
| 967 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 968 | .cra_ctxsize = sizeof(struct async_serpent_ctx), | ||
| 969 | .cra_alignmask = 0, | ||
| 970 | .cra_type = &crypto_ablkcipher_type, | ||
| 971 | .cra_module = THIS_MODULE, | ||
| 972 | .cra_list = LIST_HEAD_INIT(ablk_xts_alg.cra_list), | ||
| 973 | .cra_init = ablk_xts_init, | ||
| 974 | .cra_exit = ablk_exit, | ||
| 975 | .cra_u = { | ||
| 976 | .ablkcipher = { | ||
| 977 | .min_keysize = SERPENT_MIN_KEY_SIZE * 2, | ||
| 978 | .max_keysize = SERPENT_MAX_KEY_SIZE * 2, | ||
| 979 | .ivsize = SERPENT_BLOCK_SIZE, | ||
| 980 | .setkey = ablk_set_key, | ||
| 981 | .encrypt = ablk_encrypt, | ||
| 982 | .decrypt = ablk_decrypt, | ||
| 983 | }, | ||
| 984 | }, | ||
| 985 | }; | ||
| 986 | |||
| 987 | static int __init serpent_sse2_init(void) | ||
| 988 | { | ||
| 989 | int err; | ||
| 990 | |||
| 991 | if (!cpu_has_xmm2) { | ||
| 992 | printk(KERN_INFO "SSE2 instructions are not detected.\n"); | ||
| 993 | return -ENODEV; | ||
| 994 | } | ||
| 995 | |||
| 996 | err = crypto_register_alg(&blk_ecb_alg); | ||
| 997 | if (err) | ||
| 998 | goto blk_ecb_err; | ||
| 999 | err = crypto_register_alg(&blk_cbc_alg); | ||
| 1000 | if (err) | ||
| 1001 | goto blk_cbc_err; | ||
| 1002 | err = crypto_register_alg(&blk_ctr_alg); | ||
| 1003 | if (err) | ||
| 1004 | goto blk_ctr_err; | ||
| 1005 | err = crypto_register_alg(&ablk_ecb_alg); | ||
| 1006 | if (err) | ||
| 1007 | goto ablk_ecb_err; | ||
| 1008 | err = crypto_register_alg(&ablk_cbc_alg); | ||
| 1009 | if (err) | ||
| 1010 | goto ablk_cbc_err; | ||
| 1011 | err = crypto_register_alg(&ablk_ctr_alg); | ||
| 1012 | if (err) | ||
| 1013 | goto ablk_ctr_err; | ||
| 1014 | err = crypto_register_alg(&blk_lrw_alg); | ||
| 1015 | if (err) | ||
| 1016 | goto blk_lrw_err; | ||
| 1017 | err = crypto_register_alg(&ablk_lrw_alg); | ||
| 1018 | if (err) | ||
| 1019 | goto ablk_lrw_err; | ||
| 1020 | err = crypto_register_alg(&blk_xts_alg); | ||
| 1021 | if (err) | ||
| 1022 | goto blk_xts_err; | ||
| 1023 | err = crypto_register_alg(&ablk_xts_alg); | ||
| 1024 | if (err) | ||
| 1025 | goto ablk_xts_err; | ||
| 1026 | return err; | ||
| 1027 | |||
| 1028 | crypto_unregister_alg(&ablk_xts_alg); | ||
| 1029 | ablk_xts_err: | ||
| 1030 | crypto_unregister_alg(&blk_xts_alg); | ||
| 1031 | blk_xts_err: | ||
| 1032 | crypto_unregister_alg(&ablk_lrw_alg); | ||
| 1033 | ablk_lrw_err: | ||
| 1034 | crypto_unregister_alg(&blk_lrw_alg); | ||
| 1035 | blk_lrw_err: | ||
| 1036 | crypto_unregister_alg(&ablk_ctr_alg); | ||
| 1037 | ablk_ctr_err: | ||
| 1038 | crypto_unregister_alg(&ablk_cbc_alg); | ||
| 1039 | ablk_cbc_err: | ||
| 1040 | crypto_unregister_alg(&ablk_ecb_alg); | ||
| 1041 | ablk_ecb_err: | ||
| 1042 | crypto_unregister_alg(&blk_ctr_alg); | ||
| 1043 | blk_ctr_err: | ||
| 1044 | crypto_unregister_alg(&blk_cbc_alg); | ||
| 1045 | blk_cbc_err: | ||
| 1046 | crypto_unregister_alg(&blk_ecb_alg); | ||
| 1047 | blk_ecb_err: | ||
| 1048 | return err; | ||
| 1049 | } | ||
| 1050 | |||
| 1051 | static void __exit serpent_sse2_exit(void) | ||
| 1052 | { | ||
| 1053 | crypto_unregister_alg(&ablk_xts_alg); | ||
| 1054 | crypto_unregister_alg(&blk_xts_alg); | ||
| 1055 | crypto_unregister_alg(&ablk_lrw_alg); | ||
| 1056 | crypto_unregister_alg(&blk_lrw_alg); | ||
| 1057 | crypto_unregister_alg(&ablk_ctr_alg); | ||
| 1058 | crypto_unregister_alg(&ablk_cbc_alg); | ||
| 1059 | crypto_unregister_alg(&ablk_ecb_alg); | ||
| 1060 | crypto_unregister_alg(&blk_ctr_alg); | ||
| 1061 | crypto_unregister_alg(&blk_cbc_alg); | ||
| 1062 | crypto_unregister_alg(&blk_ecb_alg); | ||
| 1063 | } | ||
| 1064 | |||
| 1065 | module_init(serpent_sse2_init); | ||
| 1066 | module_exit(serpent_sse2_exit); | ||
| 1067 | |||
| 1068 | MODULE_DESCRIPTION("Serpent Cipher Algorithm, SSE2 optimized"); | ||
| 1069 | MODULE_LICENSE("GPL"); | ||
| 1070 | MODULE_ALIAS("serpent"); | ||
diff --git a/arch/x86/crypto/twofish_glue_3way.c b/arch/x86/crypto/twofish_glue_3way.c index 5ede9c444c3e..7fee8c152f93 100644 --- a/arch/x86/crypto/twofish_glue_3way.c +++ b/arch/x86/crypto/twofish_glue_3way.c | |||
| @@ -32,6 +32,8 @@ | |||
| 32 | #include <crypto/algapi.h> | 32 | #include <crypto/algapi.h> |
| 33 | #include <crypto/twofish.h> | 33 | #include <crypto/twofish.h> |
| 34 | #include <crypto/b128ops.h> | 34 | #include <crypto/b128ops.h> |
| 35 | #include <crypto/lrw.h> | ||
| 36 | #include <crypto/xts.h> | ||
| 35 | 37 | ||
| 36 | /* regular block cipher functions from twofish_x86_64 module */ | 38 | /* regular block cipher functions from twofish_x86_64 module */ |
| 37 | asmlinkage void twofish_enc_blk(struct twofish_ctx *ctx, u8 *dst, | 39 | asmlinkage void twofish_enc_blk(struct twofish_ctx *ctx, u8 *dst, |
| @@ -432,6 +434,209 @@ static struct crypto_alg blk_ctr_alg = { | |||
| 432 | }, | 434 | }, |
| 433 | }; | 435 | }; |
| 434 | 436 | ||
| 437 | static void encrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes) | ||
| 438 | { | ||
| 439 | const unsigned int bsize = TF_BLOCK_SIZE; | ||
| 440 | struct twofish_ctx *ctx = priv; | ||
| 441 | int i; | ||
| 442 | |||
| 443 | if (nbytes == 3 * bsize) { | ||
| 444 | twofish_enc_blk_3way(ctx, srcdst, srcdst); | ||
| 445 | return; | ||
| 446 | } | ||
| 447 | |||
| 448 | for (i = 0; i < nbytes / bsize; i++, srcdst += bsize) | ||
| 449 | twofish_enc_blk(ctx, srcdst, srcdst); | ||
| 450 | } | ||
| 451 | |||
| 452 | static void decrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes) | ||
| 453 | { | ||
| 454 | const unsigned int bsize = TF_BLOCK_SIZE; | ||
| 455 | struct twofish_ctx *ctx = priv; | ||
| 456 | int i; | ||
| 457 | |||
| 458 | if (nbytes == 3 * bsize) { | ||
| 459 | twofish_dec_blk_3way(ctx, srcdst, srcdst); | ||
| 460 | return; | ||
| 461 | } | ||
| 462 | |||
| 463 | for (i = 0; i < nbytes / bsize; i++, srcdst += bsize) | ||
| 464 | twofish_dec_blk(ctx, srcdst, srcdst); | ||
| 465 | } | ||
| 466 | |||
| 467 | struct twofish_lrw_ctx { | ||
| 468 | struct lrw_table_ctx lrw_table; | ||
| 469 | struct twofish_ctx twofish_ctx; | ||
| 470 | }; | ||
| 471 | |||
| 472 | static int lrw_twofish_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
| 473 | unsigned int keylen) | ||
| 474 | { | ||
| 475 | struct twofish_lrw_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 476 | int err; | ||
| 477 | |||
| 478 | err = __twofish_setkey(&ctx->twofish_ctx, key, keylen - TF_BLOCK_SIZE, | ||
| 479 | &tfm->crt_flags); | ||
| 480 | if (err) | ||
| 481 | return err; | ||
| 482 | |||
| 483 | return lrw_init_table(&ctx->lrw_table, key + keylen - TF_BLOCK_SIZE); | ||
| 484 | } | ||
| 485 | |||
| 486 | static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 487 | struct scatterlist *src, unsigned int nbytes) | ||
| 488 | { | ||
| 489 | struct twofish_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 490 | be128 buf[3]; | ||
| 491 | struct lrw_crypt_req req = { | ||
| 492 | .tbuf = buf, | ||
| 493 | .tbuflen = sizeof(buf), | ||
| 494 | |||
| 495 | .table_ctx = &ctx->lrw_table, | ||
| 496 | .crypt_ctx = &ctx->twofish_ctx, | ||
| 497 | .crypt_fn = encrypt_callback, | ||
| 498 | }; | ||
| 499 | |||
| 500 | return lrw_crypt(desc, dst, src, nbytes, &req); | ||
| 501 | } | ||
| 502 | |||
| 503 | static int lrw_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 504 | struct scatterlist *src, unsigned int nbytes) | ||
| 505 | { | ||
| 506 | struct twofish_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 507 | be128 buf[3]; | ||
| 508 | struct lrw_crypt_req req = { | ||
| 509 | .tbuf = buf, | ||
| 510 | .tbuflen = sizeof(buf), | ||
| 511 | |||
| 512 | .table_ctx = &ctx->lrw_table, | ||
| 513 | .crypt_ctx = &ctx->twofish_ctx, | ||
| 514 | .crypt_fn = decrypt_callback, | ||
| 515 | }; | ||
| 516 | |||
| 517 | return lrw_crypt(desc, dst, src, nbytes, &req); | ||
| 518 | } | ||
| 519 | |||
| 520 | static void lrw_exit_tfm(struct crypto_tfm *tfm) | ||
| 521 | { | ||
| 522 | struct twofish_lrw_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 523 | |||
| 524 | lrw_free_table(&ctx->lrw_table); | ||
| 525 | } | ||
| 526 | |||
| 527 | static struct crypto_alg blk_lrw_alg = { | ||
| 528 | .cra_name = "lrw(twofish)", | ||
| 529 | .cra_driver_name = "lrw-twofish-3way", | ||
| 530 | .cra_priority = 300, | ||
| 531 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
| 532 | .cra_blocksize = TF_BLOCK_SIZE, | ||
| 533 | .cra_ctxsize = sizeof(struct twofish_lrw_ctx), | ||
| 534 | .cra_alignmask = 0, | ||
| 535 | .cra_type = &crypto_blkcipher_type, | ||
| 536 | .cra_module = THIS_MODULE, | ||
| 537 | .cra_list = LIST_HEAD_INIT(blk_lrw_alg.cra_list), | ||
| 538 | .cra_exit = lrw_exit_tfm, | ||
| 539 | .cra_u = { | ||
| 540 | .blkcipher = { | ||
| 541 | .min_keysize = TF_MIN_KEY_SIZE + TF_BLOCK_SIZE, | ||
| 542 | .max_keysize = TF_MAX_KEY_SIZE + TF_BLOCK_SIZE, | ||
| 543 | .ivsize = TF_BLOCK_SIZE, | ||
| 544 | .setkey = lrw_twofish_setkey, | ||
| 545 | .encrypt = lrw_encrypt, | ||
| 546 | .decrypt = lrw_decrypt, | ||
| 547 | }, | ||
| 548 | }, | ||
| 549 | }; | ||
| 550 | |||
| 551 | struct twofish_xts_ctx { | ||
| 552 | struct twofish_ctx tweak_ctx; | ||
| 553 | struct twofish_ctx crypt_ctx; | ||
| 554 | }; | ||
| 555 | |||
| 556 | static int xts_twofish_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
| 557 | unsigned int keylen) | ||
| 558 | { | ||
| 559 | struct twofish_xts_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 560 | u32 *flags = &tfm->crt_flags; | ||
| 561 | int err; | ||
| 562 | |||
| 563 | /* key consists of keys of equal size concatenated, therefore | ||
| 564 | * the length must be even | ||
| 565 | */ | ||
| 566 | if (keylen % 2) { | ||
| 567 | *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; | ||
| 568 | return -EINVAL; | ||
| 569 | } | ||
| 570 | |||
| 571 | /* first half of xts-key is for crypt */ | ||
| 572 | err = __twofish_setkey(&ctx->crypt_ctx, key, keylen / 2, flags); | ||
| 573 | if (err) | ||
| 574 | return err; | ||
| 575 | |||
| 576 | /* second half of xts-key is for tweak */ | ||
| 577 | return __twofish_setkey(&ctx->tweak_ctx, key + keylen / 2, keylen / 2, | ||
| 578 | flags); | ||
| 579 | } | ||
| 580 | |||
| 581 | static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 582 | struct scatterlist *src, unsigned int nbytes) | ||
| 583 | { | ||
| 584 | struct twofish_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 585 | be128 buf[3]; | ||
| 586 | struct xts_crypt_req req = { | ||
| 587 | .tbuf = buf, | ||
| 588 | .tbuflen = sizeof(buf), | ||
| 589 | |||
| 590 | .tweak_ctx = &ctx->tweak_ctx, | ||
| 591 | .tweak_fn = XTS_TWEAK_CAST(twofish_enc_blk), | ||
| 592 | .crypt_ctx = &ctx->crypt_ctx, | ||
| 593 | .crypt_fn = encrypt_callback, | ||
| 594 | }; | ||
| 595 | |||
| 596 | return xts_crypt(desc, dst, src, nbytes, &req); | ||
| 597 | } | ||
| 598 | |||
| 599 | static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 600 | struct scatterlist *src, unsigned int nbytes) | ||
| 601 | { | ||
| 602 | struct twofish_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 603 | be128 buf[3]; | ||
| 604 | struct xts_crypt_req req = { | ||
| 605 | .tbuf = buf, | ||
| 606 | .tbuflen = sizeof(buf), | ||
| 607 | |||
| 608 | .tweak_ctx = &ctx->tweak_ctx, | ||
| 609 | .tweak_fn = XTS_TWEAK_CAST(twofish_enc_blk), | ||
| 610 | .crypt_ctx = &ctx->crypt_ctx, | ||
| 611 | .crypt_fn = decrypt_callback, | ||
| 612 | }; | ||
| 613 | |||
| 614 | return xts_crypt(desc, dst, src, nbytes, &req); | ||
| 615 | } | ||
| 616 | |||
| 617 | static struct crypto_alg blk_xts_alg = { | ||
| 618 | .cra_name = "xts(twofish)", | ||
| 619 | .cra_driver_name = "xts-twofish-3way", | ||
| 620 | .cra_priority = 300, | ||
| 621 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
| 622 | .cra_blocksize = TF_BLOCK_SIZE, | ||
| 623 | .cra_ctxsize = sizeof(struct twofish_xts_ctx), | ||
| 624 | .cra_alignmask = 0, | ||
| 625 | .cra_type = &crypto_blkcipher_type, | ||
| 626 | .cra_module = THIS_MODULE, | ||
| 627 | .cra_list = LIST_HEAD_INIT(blk_xts_alg.cra_list), | ||
| 628 | .cra_u = { | ||
| 629 | .blkcipher = { | ||
| 630 | .min_keysize = TF_MIN_KEY_SIZE * 2, | ||
| 631 | .max_keysize = TF_MAX_KEY_SIZE * 2, | ||
| 632 | .ivsize = TF_BLOCK_SIZE, | ||
| 633 | .setkey = xts_twofish_setkey, | ||
| 634 | .encrypt = xts_encrypt, | ||
| 635 | .decrypt = xts_decrypt, | ||
| 636 | }, | ||
| 637 | }, | ||
| 638 | }; | ||
| 639 | |||
| 435 | int __init init(void) | 640 | int __init init(void) |
| 436 | { | 641 | { |
| 437 | int err; | 642 | int err; |
| @@ -445,9 +650,20 @@ int __init init(void) | |||
| 445 | err = crypto_register_alg(&blk_ctr_alg); | 650 | err = crypto_register_alg(&blk_ctr_alg); |
| 446 | if (err) | 651 | if (err) |
| 447 | goto ctr_err; | 652 | goto ctr_err; |
| 653 | err = crypto_register_alg(&blk_lrw_alg); | ||
| 654 | if (err) | ||
| 655 | goto blk_lrw_err; | ||
| 656 | err = crypto_register_alg(&blk_xts_alg); | ||
| 657 | if (err) | ||
| 658 | goto blk_xts_err; | ||
| 448 | 659 | ||
| 449 | return 0; | 660 | return 0; |
| 450 | 661 | ||
| 662 | crypto_unregister_alg(&blk_xts_alg); | ||
| 663 | blk_xts_err: | ||
| 664 | crypto_unregister_alg(&blk_lrw_alg); | ||
| 665 | blk_lrw_err: | ||
| 666 | crypto_unregister_alg(&blk_ctr_alg); | ||
| 451 | ctr_err: | 667 | ctr_err: |
| 452 | crypto_unregister_alg(&blk_cbc_alg); | 668 | crypto_unregister_alg(&blk_cbc_alg); |
| 453 | cbc_err: | 669 | cbc_err: |
| @@ -458,6 +674,8 @@ ecb_err: | |||
| 458 | 674 | ||
| 459 | void __exit fini(void) | 675 | void __exit fini(void) |
| 460 | { | 676 | { |
| 677 | crypto_unregister_alg(&blk_xts_alg); | ||
| 678 | crypto_unregister_alg(&blk_lrw_alg); | ||
| 461 | crypto_unregister_alg(&blk_ctr_alg); | 679 | crypto_unregister_alg(&blk_ctr_alg); |
| 462 | crypto_unregister_alg(&blk_cbc_alg); | 680 | crypto_unregister_alg(&blk_cbc_alg); |
| 463 | crypto_unregister_alg(&blk_ecb_alg); | 681 | crypto_unregister_alg(&blk_ecb_alg); |
diff --git a/arch/x86/include/asm/serpent.h b/arch/x86/include/asm/serpent.h new file mode 100644 index 000000000000..d3ef63fe0c81 --- /dev/null +++ b/arch/x86/include/asm/serpent.h | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | #ifndef ASM_X86_SERPENT_H | ||
| 2 | #define ASM_X86_SERPENT_H | ||
| 3 | |||
| 4 | #include <linux/crypto.h> | ||
| 5 | #include <crypto/serpent.h> | ||
| 6 | |||
| 7 | #ifdef CONFIG_X86_32 | ||
| 8 | |||
| 9 | #define SERPENT_PARALLEL_BLOCKS 4 | ||
| 10 | |||
| 11 | asmlinkage void __serpent_enc_blk_4way(struct serpent_ctx *ctx, u8 *dst, | ||
| 12 | const u8 *src, bool xor); | ||
| 13 | asmlinkage void serpent_dec_blk_4way(struct serpent_ctx *ctx, u8 *dst, | ||
| 14 | const u8 *src); | ||
| 15 | |||
| 16 | static inline void serpent_enc_blk_xway(struct serpent_ctx *ctx, u8 *dst, | ||
| 17 | const u8 *src) | ||
| 18 | { | ||
| 19 | __serpent_enc_blk_4way(ctx, dst, src, false); | ||
| 20 | } | ||
| 21 | |||
| 22 | static inline void serpent_enc_blk_xway_xor(struct serpent_ctx *ctx, u8 *dst, | ||
| 23 | const u8 *src) | ||
| 24 | { | ||
| 25 | __serpent_enc_blk_4way(ctx, dst, src, true); | ||
| 26 | } | ||
| 27 | |||
| 28 | static inline void serpent_dec_blk_xway(struct serpent_ctx *ctx, u8 *dst, | ||
| 29 | const u8 *src) | ||
| 30 | { | ||
| 31 | serpent_dec_blk_4way(ctx, dst, src); | ||
| 32 | } | ||
| 33 | |||
| 34 | #else | ||
| 35 | |||
| 36 | #define SERPENT_PARALLEL_BLOCKS 8 | ||
| 37 | |||
| 38 | asmlinkage void __serpent_enc_blk_8way(struct serpent_ctx *ctx, u8 *dst, | ||
| 39 | const u8 *src, bool xor); | ||
| 40 | asmlinkage void serpent_dec_blk_8way(struct serpent_ctx *ctx, u8 *dst, | ||
| 41 | const u8 *src); | ||
| 42 | |||
| 43 | static inline void serpent_enc_blk_xway(struct serpent_ctx *ctx, u8 *dst, | ||
| 44 | const u8 *src) | ||
| 45 | { | ||
| 46 | __serpent_enc_blk_8way(ctx, dst, src, false); | ||
| 47 | } | ||
| 48 | |||
| 49 | static inline void serpent_enc_blk_xway_xor(struct serpent_ctx *ctx, u8 *dst, | ||
| 50 | const u8 *src) | ||
| 51 | { | ||
| 52 | __serpent_enc_blk_8way(ctx, dst, src, true); | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline void serpent_dec_blk_xway(struct serpent_ctx *ctx, u8 *dst, | ||
| 56 | const u8 *src) | ||
| 57 | { | ||
| 58 | serpent_dec_blk_8way(ctx, dst, src); | ||
| 59 | } | ||
| 60 | |||
| 61 | #endif | ||
| 62 | |||
| 63 | #endif | ||
diff --git a/crypto/Kconfig b/crypto/Kconfig index ae9c3ceb2867..e6cfe1a25137 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
| @@ -105,7 +105,7 @@ config CRYPTO_USER | |||
| 105 | depends on NET | 105 | depends on NET |
| 106 | select CRYPTO_MANAGER | 106 | select CRYPTO_MANAGER |
| 107 | help | 107 | help |
| 108 | Userapace configuration for cryptographic instantiations such as | 108 | Userspace configuration for cryptographic instantiations such as |
| 109 | cbc(aes). | 109 | cbc(aes). |
| 110 | 110 | ||
| 111 | config CRYPTO_MANAGER_DISABLE_TESTS | 111 | config CRYPTO_MANAGER_DISABLE_TESTS |
| @@ -117,7 +117,7 @@ config CRYPTO_MANAGER_DISABLE_TESTS | |||
| 117 | algorithm registration. | 117 | algorithm registration. |
| 118 | 118 | ||
| 119 | config CRYPTO_GF128MUL | 119 | config CRYPTO_GF128MUL |
| 120 | tristate "GF(2^128) multiplication functions (EXPERIMENTAL)" | 120 | tristate "GF(2^128) multiplication functions" |
| 121 | help | 121 | help |
| 122 | Efficient table driven implementation of multiplications in the | 122 | Efficient table driven implementation of multiplications in the |
| 123 | field GF(2^128). This is needed by some cypher modes. This | 123 | field GF(2^128). This is needed by some cypher modes. This |
| @@ -241,8 +241,7 @@ config CRYPTO_ECB | |||
| 241 | the input block by block. | 241 | the input block by block. |
| 242 | 242 | ||
| 243 | config CRYPTO_LRW | 243 | config CRYPTO_LRW |
| 244 | tristate "LRW support (EXPERIMENTAL)" | 244 | tristate "LRW support" |
| 245 | depends on EXPERIMENTAL | ||
| 246 | select CRYPTO_BLKCIPHER | 245 | select CRYPTO_BLKCIPHER |
| 247 | select CRYPTO_MANAGER | 246 | select CRYPTO_MANAGER |
| 248 | select CRYPTO_GF128MUL | 247 | select CRYPTO_GF128MUL |
| @@ -262,8 +261,7 @@ config CRYPTO_PCBC | |||
| 262 | This block cipher algorithm is required for RxRPC. | 261 | This block cipher algorithm is required for RxRPC. |
| 263 | 262 | ||
| 264 | config CRYPTO_XTS | 263 | config CRYPTO_XTS |
| 265 | tristate "XTS support (EXPERIMENTAL)" | 264 | tristate "XTS support" |
| 266 | depends on EXPERIMENTAL | ||
| 267 | select CRYPTO_BLKCIPHER | 265 | select CRYPTO_BLKCIPHER |
| 268 | select CRYPTO_MANAGER | 266 | select CRYPTO_MANAGER |
| 269 | select CRYPTO_GF128MUL | 267 | select CRYPTO_GF128MUL |
| @@ -764,6 +762,46 @@ config CRYPTO_SERPENT | |||
| 764 | See also: | 762 | See also: |
| 765 | <http://www.cl.cam.ac.uk/~rja14/serpent.html> | 763 | <http://www.cl.cam.ac.uk/~rja14/serpent.html> |
| 766 | 764 | ||
| 765 | config CRYPTO_SERPENT_SSE2_X86_64 | ||
| 766 | tristate "Serpent cipher algorithm (x86_64/SSE2)" | ||
| 767 | depends on X86 && 64BIT | ||
| 768 | select CRYPTO_ALGAPI | ||
| 769 | select CRYPTO_CRYPTD | ||
| 770 | select CRYPTO_SERPENT | ||
| 771 | select CRYPTO_LRW | ||
| 772 | select CRYPTO_XTS | ||
| 773 | help | ||
| 774 | Serpent cipher algorithm, by Anderson, Biham & Knudsen. | ||
| 775 | |||
| 776 | Keys are allowed to be from 0 to 256 bits in length, in steps | ||
| 777 | of 8 bits. | ||
| 778 | |||
| 779 | This module provides Serpent cipher algorithm that processes eigth | ||
| 780 | blocks parallel using SSE2 instruction set. | ||
| 781 | |||
| 782 | See also: | ||
| 783 | <http://www.cl.cam.ac.uk/~rja14/serpent.html> | ||
| 784 | |||
| 785 | config CRYPTO_SERPENT_SSE2_586 | ||
| 786 | tristate "Serpent cipher algorithm (i586/SSE2)" | ||
| 787 | depends on X86 && !64BIT | ||
| 788 | select CRYPTO_ALGAPI | ||
| 789 | select CRYPTO_CRYPTD | ||
| 790 | select CRYPTO_SERPENT | ||
| 791 | select CRYPTO_LRW | ||
| 792 | select CRYPTO_XTS | ||
| 793 | help | ||
| 794 | Serpent cipher algorithm, by Anderson, Biham & Knudsen. | ||
| 795 | |||
| 796 | Keys are allowed to be from 0 to 256 bits in length, in steps | ||
| 797 | of 8 bits. | ||
| 798 | |||
| 799 | This module provides Serpent cipher algorithm that processes four | ||
| 800 | blocks parallel using SSE2 instruction set. | ||
| 801 | |||
| 802 | See also: | ||
| 803 | <http://www.cl.cam.ac.uk/~rja14/serpent.html> | ||
| 804 | |||
| 767 | config CRYPTO_TEA | 805 | config CRYPTO_TEA |
| 768 | tristate "TEA, XTEA and XETA cipher algorithms" | 806 | tristate "TEA, XTEA and XETA cipher algorithms" |
| 769 | select CRYPTO_ALGAPI | 807 | select CRYPTO_ALGAPI |
| @@ -840,6 +878,8 @@ config CRYPTO_TWOFISH_X86_64_3WAY | |||
| 840 | select CRYPTO_ALGAPI | 878 | select CRYPTO_ALGAPI |
| 841 | select CRYPTO_TWOFISH_COMMON | 879 | select CRYPTO_TWOFISH_COMMON |
| 842 | select CRYPTO_TWOFISH_X86_64 | 880 | select CRYPTO_TWOFISH_X86_64 |
| 881 | select CRYPTO_LRW | ||
| 882 | select CRYPTO_XTS | ||
| 843 | help | 883 | help |
| 844 | Twofish cipher algorithm (x86_64, 3-way parallel). | 884 | Twofish cipher algorithm (x86_64, 3-way parallel). |
| 845 | 885 | ||
diff --git a/crypto/Makefile b/crypto/Makefile index 9e6eee2c05db..f638063f4ea9 100644 --- a/crypto/Makefile +++ b/crypto/Makefile | |||
| @@ -65,7 +65,7 @@ obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish_generic.o | |||
| 65 | obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) += blowfish_common.o | 65 | obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) += blowfish_common.o |
| 66 | obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o | 66 | obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o |
| 67 | obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o | 67 | obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o |
| 68 | obj-$(CONFIG_CRYPTO_SERPENT) += serpent.o | 68 | obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o |
| 69 | obj-$(CONFIG_CRYPTO_AES) += aes_generic.o | 69 | obj-$(CONFIG_CRYPTO_AES) += aes_generic.o |
| 70 | obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia.o | 70 | obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia.o |
| 71 | obj-$(CONFIG_CRYPTO_CAST5) += cast5.o | 71 | obj-$(CONFIG_CRYPTO_CAST5) += cast5.o |
diff --git a/crypto/algapi.c b/crypto/algapi.c index 54dd4e33b5d6..9d4a9fe913f8 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
| @@ -518,6 +518,35 @@ err: | |||
| 518 | } | 518 | } |
| 519 | EXPORT_SYMBOL_GPL(crypto_register_instance); | 519 | EXPORT_SYMBOL_GPL(crypto_register_instance); |
| 520 | 520 | ||
| 521 | int crypto_unregister_instance(struct crypto_alg *alg) | ||
| 522 | { | ||
| 523 | int err; | ||
| 524 | struct crypto_instance *inst = (void *)alg; | ||
| 525 | struct crypto_template *tmpl = inst->tmpl; | ||
| 526 | LIST_HEAD(users); | ||
| 527 | |||
| 528 | if (!(alg->cra_flags & CRYPTO_ALG_INSTANCE)) | ||
| 529 | return -EINVAL; | ||
| 530 | |||
| 531 | BUG_ON(atomic_read(&alg->cra_refcnt) != 1); | ||
| 532 | |||
| 533 | down_write(&crypto_alg_sem); | ||
| 534 | |||
| 535 | hlist_del_init(&inst->list); | ||
| 536 | err = crypto_remove_alg(alg, &users); | ||
| 537 | |||
| 538 | up_write(&crypto_alg_sem); | ||
| 539 | |||
| 540 | if (err) | ||
| 541 | return err; | ||
| 542 | |||
| 543 | tmpl->free(inst); | ||
| 544 | crypto_remove_final(&users); | ||
| 545 | |||
| 546 | return 0; | ||
| 547 | } | ||
| 548 | EXPORT_SYMBOL_GPL(crypto_unregister_instance); | ||
| 549 | |||
| 521 | int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, | 550 | int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, |
| 522 | struct crypto_instance *inst, u32 mask) | 551 | struct crypto_instance *inst, u32 mask) |
| 523 | { | 552 | { |
diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c index ffa0245e2abc..6ddd99e6114b 100644 --- a/crypto/ansi_cprng.c +++ b/crypto/ansi_cprng.c | |||
| @@ -414,10 +414,18 @@ static int fips_cprng_get_random(struct crypto_rng *tfm, u8 *rdata, | |||
| 414 | static int fips_cprng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int slen) | 414 | static int fips_cprng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int slen) |
| 415 | { | 415 | { |
| 416 | u8 rdata[DEFAULT_BLK_SZ]; | 416 | u8 rdata[DEFAULT_BLK_SZ]; |
| 417 | u8 *key = seed + DEFAULT_BLK_SZ; | ||
| 417 | int rc; | 418 | int rc; |
| 418 | 419 | ||
| 419 | struct prng_context *prng = crypto_rng_ctx(tfm); | 420 | struct prng_context *prng = crypto_rng_ctx(tfm); |
| 420 | 421 | ||
| 422 | if (slen < DEFAULT_PRNG_KSZ + DEFAULT_BLK_SZ) | ||
| 423 | return -EINVAL; | ||
| 424 | |||
| 425 | /* fips strictly requires seed != key */ | ||
| 426 | if (!memcmp(seed, key, DEFAULT_PRNG_KSZ)) | ||
| 427 | return -EINVAL; | ||
| 428 | |||
| 421 | rc = cprng_reset(tfm, seed, slen); | 429 | rc = cprng_reset(tfm, seed, slen); |
| 422 | 430 | ||
| 423 | if (!rc) | 431 | if (!rc) |
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index 0605a2bbba75..3ba6ef508869 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c | |||
| @@ -298,7 +298,7 @@ static int crypto_del_alg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
| 298 | if (atomic_read(&alg->cra_refcnt) != 1) | 298 | if (atomic_read(&alg->cra_refcnt) != 1) |
| 299 | return -EBUSY; | 299 | return -EBUSY; |
| 300 | 300 | ||
| 301 | return crypto_unregister_alg(alg); | 301 | return crypto_unregister_instance(alg); |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | static int crypto_add_alg(struct sk_buff *skb, struct nlmsghdr *nlh, | 304 | static int crypto_add_alg(struct sk_buff *skb, struct nlmsghdr *nlh, |
diff --git a/crypto/lrw.c b/crypto/lrw.c index 358f80be2bf9..ba42acc4deba 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2006 Rik Snel <rsnel@cube.dyndns.org> | 4 | * Copyright (c) 2006 Rik Snel <rsnel@cube.dyndns.org> |
| 5 | * | 5 | * |
| 6 | * Based om ecb.c | 6 | * Based on ecb.c |
| 7 | * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au> | 7 | * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
| @@ -16,6 +16,7 @@ | |||
| 16 | * http://www.mail-archive.com/stds-p1619@listserv.ieee.org/msg00173.html | 16 | * http://www.mail-archive.com/stds-p1619@listserv.ieee.org/msg00173.html |
| 17 | * | 17 | * |
| 18 | * The test vectors are included in the testing module tcrypt.[ch] */ | 18 | * The test vectors are included in the testing module tcrypt.[ch] */ |
| 19 | |||
| 19 | #include <crypto/algapi.h> | 20 | #include <crypto/algapi.h> |
| 20 | #include <linux/err.h> | 21 | #include <linux/err.h> |
| 21 | #include <linux/init.h> | 22 | #include <linux/init.h> |
| @@ -26,21 +27,11 @@ | |||
| 26 | 27 | ||
| 27 | #include <crypto/b128ops.h> | 28 | #include <crypto/b128ops.h> |
| 28 | #include <crypto/gf128mul.h> | 29 | #include <crypto/gf128mul.h> |
| 30 | #include <crypto/lrw.h> | ||
| 29 | 31 | ||
| 30 | struct priv { | 32 | struct priv { |
| 31 | struct crypto_cipher *child; | 33 | struct crypto_cipher *child; |
| 32 | /* optimizes multiplying a random (non incrementing, as at the | 34 | struct lrw_table_ctx table; |
| 33 | * start of a new sector) value with key2, we could also have | ||
| 34 | * used 4k optimization tables or no optimization at all. In the | ||
| 35 | * latter case we would have to store key2 here */ | ||
| 36 | struct gf128mul_64k *table; | ||
| 37 | /* stores: | ||
| 38 | * key2*{ 0,0,...0,0,0,0,1 }, key2*{ 0,0,...0,0,0,1,1 }, | ||
| 39 | * key2*{ 0,0,...0,0,1,1,1 }, key2*{ 0,0,...0,1,1,1,1 } | ||
| 40 | * key2*{ 0,0,...1,1,1,1,1 }, etc | ||
| 41 | * needed for optimized multiplication of incrementing values | ||
| 42 | * with key2 */ | ||
| 43 | be128 mulinc[128]; | ||
| 44 | }; | 35 | }; |
| 45 | 36 | ||
| 46 | static inline void setbit128_bbe(void *b, int bit) | 37 | static inline void setbit128_bbe(void *b, int bit) |
| @@ -54,28 +45,16 @@ static inline void setbit128_bbe(void *b, int bit) | |||
| 54 | ), b); | 45 | ), b); |
| 55 | } | 46 | } |
| 56 | 47 | ||
| 57 | static int setkey(struct crypto_tfm *parent, const u8 *key, | 48 | int lrw_init_table(struct lrw_table_ctx *ctx, const u8 *tweak) |
| 58 | unsigned int keylen) | ||
| 59 | { | 49 | { |
| 60 | struct priv *ctx = crypto_tfm_ctx(parent); | ||
| 61 | struct crypto_cipher *child = ctx->child; | ||
| 62 | int err, i; | ||
| 63 | be128 tmp = { 0 }; | 50 | be128 tmp = { 0 }; |
| 64 | int bsize = crypto_cipher_blocksize(child); | 51 | int i; |
| 65 | |||
| 66 | crypto_cipher_clear_flags(child, CRYPTO_TFM_REQ_MASK); | ||
| 67 | crypto_cipher_set_flags(child, crypto_tfm_get_flags(parent) & | ||
| 68 | CRYPTO_TFM_REQ_MASK); | ||
| 69 | if ((err = crypto_cipher_setkey(child, key, keylen - bsize))) | ||
| 70 | return err; | ||
| 71 | crypto_tfm_set_flags(parent, crypto_cipher_get_flags(child) & | ||
| 72 | CRYPTO_TFM_RES_MASK); | ||
| 73 | 52 | ||
| 74 | if (ctx->table) | 53 | if (ctx->table) |
| 75 | gf128mul_free_64k(ctx->table); | 54 | gf128mul_free_64k(ctx->table); |
| 76 | 55 | ||
| 77 | /* initialize multiplication table for Key2 */ | 56 | /* initialize multiplication table for Key2 */ |
| 78 | ctx->table = gf128mul_init_64k_bbe((be128 *)(key + keylen - bsize)); | 57 | ctx->table = gf128mul_init_64k_bbe((be128 *)tweak); |
| 79 | if (!ctx->table) | 58 | if (!ctx->table) |
| 80 | return -ENOMEM; | 59 | return -ENOMEM; |
| 81 | 60 | ||
| @@ -88,6 +67,34 @@ static int setkey(struct crypto_tfm *parent, const u8 *key, | |||
| 88 | 67 | ||
| 89 | return 0; | 68 | return 0; |
| 90 | } | 69 | } |
| 70 | EXPORT_SYMBOL_GPL(lrw_init_table); | ||
| 71 | |||
| 72 | void lrw_free_table(struct lrw_table_ctx *ctx) | ||
| 73 | { | ||
| 74 | if (ctx->table) | ||
| 75 | gf128mul_free_64k(ctx->table); | ||
| 76 | } | ||
| 77 | EXPORT_SYMBOL_GPL(lrw_free_table); | ||
| 78 | |||
| 79 | static int setkey(struct crypto_tfm *parent, const u8 *key, | ||
| 80 | unsigned int keylen) | ||
| 81 | { | ||
| 82 | struct priv *ctx = crypto_tfm_ctx(parent); | ||
| 83 | struct crypto_cipher *child = ctx->child; | ||
| 84 | int err, bsize = LRW_BLOCK_SIZE; | ||
| 85 | const u8 *tweak = key + keylen - bsize; | ||
| 86 | |||
| 87 | crypto_cipher_clear_flags(child, CRYPTO_TFM_REQ_MASK); | ||
| 88 | crypto_cipher_set_flags(child, crypto_tfm_get_flags(parent) & | ||
| 89 | CRYPTO_TFM_REQ_MASK); | ||
| 90 | err = crypto_cipher_setkey(child, key, keylen - bsize); | ||
| 91 | if (err) | ||
| 92 | return err; | ||
| 93 | crypto_tfm_set_flags(parent, crypto_cipher_get_flags(child) & | ||
| 94 | CRYPTO_TFM_RES_MASK); | ||
| 95 | |||
| 96 | return lrw_init_table(&ctx->table, tweak); | ||
| 97 | } | ||
| 91 | 98 | ||
| 92 | struct sinfo { | 99 | struct sinfo { |
| 93 | be128 t; | 100 | be128 t; |
| @@ -134,7 +141,7 @@ static int crypt(struct blkcipher_desc *d, | |||
| 134 | { | 141 | { |
| 135 | int err; | 142 | int err; |
| 136 | unsigned int avail; | 143 | unsigned int avail; |
| 137 | const int bs = crypto_cipher_blocksize(ctx->child); | 144 | const int bs = LRW_BLOCK_SIZE; |
| 138 | struct sinfo s = { | 145 | struct sinfo s = { |
| 139 | .tfm = crypto_cipher_tfm(ctx->child), | 146 | .tfm = crypto_cipher_tfm(ctx->child), |
| 140 | .fn = fn | 147 | .fn = fn |
| @@ -155,7 +162,7 @@ static int crypt(struct blkcipher_desc *d, | |||
| 155 | s.t = *iv; | 162 | s.t = *iv; |
| 156 | 163 | ||
| 157 | /* T <- I*Key2 */ | 164 | /* T <- I*Key2 */ |
| 158 | gf128mul_64k_bbe(&s.t, ctx->table); | 165 | gf128mul_64k_bbe(&s.t, ctx->table.table); |
| 159 | 166 | ||
| 160 | goto first; | 167 | goto first; |
| 161 | 168 | ||
| @@ -163,7 +170,8 @@ static int crypt(struct blkcipher_desc *d, | |||
| 163 | do { | 170 | do { |
| 164 | /* T <- I*Key2, using the optimization | 171 | /* T <- I*Key2, using the optimization |
| 165 | * discussed in the specification */ | 172 | * discussed in the specification */ |
| 166 | be128_xor(&s.t, &s.t, &ctx->mulinc[get_index128(iv)]); | 173 | be128_xor(&s.t, &s.t, |
| 174 | &ctx->table.mulinc[get_index128(iv)]); | ||
| 167 | inc(iv); | 175 | inc(iv); |
| 168 | 176 | ||
| 169 | first: | 177 | first: |
| @@ -206,6 +214,85 @@ static int decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
| 206 | crypto_cipher_alg(ctx->child)->cia_decrypt); | 214 | crypto_cipher_alg(ctx->child)->cia_decrypt); |
| 207 | } | 215 | } |
| 208 | 216 | ||
| 217 | int lrw_crypt(struct blkcipher_desc *desc, struct scatterlist *sdst, | ||
| 218 | struct scatterlist *ssrc, unsigned int nbytes, | ||
| 219 | struct lrw_crypt_req *req) | ||
| 220 | { | ||
| 221 | const unsigned int bsize = LRW_BLOCK_SIZE; | ||
| 222 | const unsigned int max_blks = req->tbuflen / bsize; | ||
| 223 | struct lrw_table_ctx *ctx = req->table_ctx; | ||
| 224 | struct blkcipher_walk walk; | ||
| 225 | unsigned int nblocks; | ||
| 226 | be128 *iv, *src, *dst, *t; | ||
| 227 | be128 *t_buf = req->tbuf; | ||
| 228 | int err, i; | ||
| 229 | |||
| 230 | BUG_ON(max_blks < 1); | ||
| 231 | |||
| 232 | blkcipher_walk_init(&walk, sdst, ssrc, nbytes); | ||
| 233 | |||
| 234 | err = blkcipher_walk_virt(desc, &walk); | ||
| 235 | nbytes = walk.nbytes; | ||
| 236 | if (!nbytes) | ||
| 237 | return err; | ||
| 238 | |||
| 239 | nblocks = min(walk.nbytes / bsize, max_blks); | ||
| 240 | src = (be128 *)walk.src.virt.addr; | ||
| 241 | dst = (be128 *)walk.dst.virt.addr; | ||
| 242 | |||
| 243 | /* calculate first value of T */ | ||
| 244 | iv = (be128 *)walk.iv; | ||
| 245 | t_buf[0] = *iv; | ||
| 246 | |||
| 247 | /* T <- I*Key2 */ | ||
| 248 | gf128mul_64k_bbe(&t_buf[0], ctx->table); | ||
| 249 | |||
| 250 | i = 0; | ||
| 251 | goto first; | ||
| 252 | |||
| 253 | for (;;) { | ||
| 254 | do { | ||
| 255 | for (i = 0; i < nblocks; i++) { | ||
| 256 | /* T <- I*Key2, using the optimization | ||
| 257 | * discussed in the specification */ | ||
| 258 | be128_xor(&t_buf[i], t, | ||
| 259 | &ctx->mulinc[get_index128(iv)]); | ||
| 260 | inc(iv); | ||
| 261 | first: | ||
| 262 | t = &t_buf[i]; | ||
| 263 | |||
| 264 | /* PP <- T xor P */ | ||
| 265 | be128_xor(dst + i, t, src + i); | ||
| 266 | } | ||
| 267 | |||
| 268 | /* CC <- E(Key2,PP) */ | ||
| 269 | req->crypt_fn(req->crypt_ctx, (u8 *)dst, | ||
| 270 | nblocks * bsize); | ||
| 271 | |||
| 272 | /* C <- T xor CC */ | ||
| 273 | for (i = 0; i < nblocks; i++) | ||
| 274 | be128_xor(dst + i, dst + i, &t_buf[i]); | ||
| 275 | |||
| 276 | src += nblocks; | ||
| 277 | dst += nblocks; | ||
| 278 | nbytes -= nblocks * bsize; | ||
| 279 | nblocks = min(nbytes / bsize, max_blks); | ||
| 280 | } while (nblocks > 0); | ||
| 281 | |||
| 282 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
| 283 | nbytes = walk.nbytes; | ||
| 284 | if (!nbytes) | ||
| 285 | break; | ||
| 286 | |||
| 287 | nblocks = min(nbytes / bsize, max_blks); | ||
| 288 | src = (be128 *)walk.src.virt.addr; | ||
| 289 | dst = (be128 *)walk.dst.virt.addr; | ||
| 290 | } | ||
| 291 | |||
| 292 | return err; | ||
| 293 | } | ||
| 294 | EXPORT_SYMBOL_GPL(lrw_crypt); | ||
| 295 | |||
| 209 | static int init_tfm(struct crypto_tfm *tfm) | 296 | static int init_tfm(struct crypto_tfm *tfm) |
| 210 | { | 297 | { |
| 211 | struct crypto_cipher *cipher; | 298 | struct crypto_cipher *cipher; |
| @@ -218,8 +305,9 @@ static int init_tfm(struct crypto_tfm *tfm) | |||
| 218 | if (IS_ERR(cipher)) | 305 | if (IS_ERR(cipher)) |
| 219 | return PTR_ERR(cipher); | 306 | return PTR_ERR(cipher); |
| 220 | 307 | ||
| 221 | if (crypto_cipher_blocksize(cipher) != 16) { | 308 | if (crypto_cipher_blocksize(cipher) != LRW_BLOCK_SIZE) { |
| 222 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; | 309 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; |
| 310 | crypto_free_cipher(cipher); | ||
| 223 | return -EINVAL; | 311 | return -EINVAL; |
| 224 | } | 312 | } |
| 225 | 313 | ||
| @@ -230,8 +318,8 @@ static int init_tfm(struct crypto_tfm *tfm) | |||
| 230 | static void exit_tfm(struct crypto_tfm *tfm) | 318 | static void exit_tfm(struct crypto_tfm *tfm) |
| 231 | { | 319 | { |
| 232 | struct priv *ctx = crypto_tfm_ctx(tfm); | 320 | struct priv *ctx = crypto_tfm_ctx(tfm); |
| 233 | if (ctx->table) | 321 | |
| 234 | gf128mul_free_64k(ctx->table); | 322 | lrw_free_table(&ctx->table); |
| 235 | crypto_free_cipher(ctx->child); | 323 | crypto_free_cipher(ctx->child); |
| 236 | } | 324 | } |
| 237 | 325 | ||
diff --git a/crypto/serpent.c b/crypto/serpent.c deleted file mode 100644 index b651a55fa569..000000000000 --- a/crypto/serpent.c +++ /dev/null | |||
| @@ -1,587 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Cryptographic API. | ||
| 3 | * | ||
| 4 | * Serpent Cipher Algorithm. | ||
| 5 | * | ||
| 6 | * Copyright (C) 2002 Dag Arne Osvik <osvik@ii.uib.no> | ||
| 7 | * 2003 Herbert Valerio Riedel <hvr@gnu.org> | ||
| 8 | * | ||
| 9 | * Added tnepres support: Ruben Jesus Garcia Hernandez <ruben@ugr.es>, 18.10.2004 | ||
| 10 | * Based on code by hvr | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify | ||
| 13 | * it under the terms of the GNU General Public License as published by | ||
| 14 | * the Free Software Foundation; either version 2 of the License, or | ||
| 15 | * (at your option) any later version. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <linux/init.h> | ||
| 19 | #include <linux/module.h> | ||
| 20 | #include <linux/errno.h> | ||
| 21 | #include <asm/byteorder.h> | ||
| 22 | #include <linux/crypto.h> | ||
| 23 | #include <linux/types.h> | ||
| 24 | |||
| 25 | /* Key is padded to the maximum of 256 bits before round key generation. | ||
| 26 | * Any key length <= 256 bits (32 bytes) is allowed by the algorithm. | ||
| 27 | */ | ||
| 28 | |||
| 29 | #define SERPENT_MIN_KEY_SIZE 0 | ||
| 30 | #define SERPENT_MAX_KEY_SIZE 32 | ||
| 31 | #define SERPENT_EXPKEY_WORDS 132 | ||
| 32 | #define SERPENT_BLOCK_SIZE 16 | ||
| 33 | |||
| 34 | #define PHI 0x9e3779b9UL | ||
| 35 | |||
| 36 | #define keyiter(a,b,c,d,i,j) \ | ||
| 37 | b ^= d; b ^= c; b ^= a; b ^= PHI ^ i; b = rol32(b,11); k[j] = b; | ||
| 38 | |||
| 39 | #define loadkeys(x0,x1,x2,x3,i) \ | ||
| 40 | x0=k[i]; x1=k[i+1]; x2=k[i+2]; x3=k[i+3]; | ||
| 41 | |||
| 42 | #define storekeys(x0,x1,x2,x3,i) \ | ||
| 43 | k[i]=x0; k[i+1]=x1; k[i+2]=x2; k[i+3]=x3; | ||
| 44 | |||
| 45 | #define K(x0,x1,x2,x3,i) \ | ||
| 46 | x3 ^= k[4*(i)+3]; x2 ^= k[4*(i)+2]; \ | ||
| 47 | x1 ^= k[4*(i)+1]; x0 ^= k[4*(i)+0]; | ||
| 48 | |||
| 49 | #define LK(x0,x1,x2,x3,x4,i) \ | ||
| 50 | x0=rol32(x0,13);\ | ||
| 51 | x2=rol32(x2,3); x1 ^= x0; x4 = x0 << 3; \ | ||
| 52 | x3 ^= x2; x1 ^= x2; \ | ||
| 53 | x1=rol32(x1,1); x3 ^= x4; \ | ||
| 54 | x3=rol32(x3,7); x4 = x1; \ | ||
| 55 | x0 ^= x1; x4 <<= 7; x2 ^= x3; \ | ||
| 56 | x0 ^= x3; x2 ^= x4; x3 ^= k[4*i+3]; \ | ||
| 57 | x1 ^= k[4*i+1]; x0=rol32(x0,5); x2=rol32(x2,22);\ | ||
| 58 | x0 ^= k[4*i+0]; x2 ^= k[4*i+2]; | ||
| 59 | |||
| 60 | #define KL(x0,x1,x2,x3,x4,i) \ | ||
| 61 | x0 ^= k[4*i+0]; x1 ^= k[4*i+1]; x2 ^= k[4*i+2]; \ | ||
| 62 | x3 ^= k[4*i+3]; x0=ror32(x0,5); x2=ror32(x2,22);\ | ||
| 63 | x4 = x1; x2 ^= x3; x0 ^= x3; \ | ||
| 64 | x4 <<= 7; x0 ^= x1; x1=ror32(x1,1); \ | ||
| 65 | x2 ^= x4; x3=ror32(x3,7); x4 = x0 << 3; \ | ||
| 66 | x1 ^= x0; x3 ^= x4; x0=ror32(x0,13);\ | ||
| 67 | x1 ^= x2; x3 ^= x2; x2=ror32(x2,3); | ||
| 68 | |||
| 69 | #define S0(x0,x1,x2,x3,x4) \ | ||
| 70 | x4 = x3; \ | ||
| 71 | x3 |= x0; x0 ^= x4; x4 ^= x2; \ | ||
| 72 | x4 =~ x4; x3 ^= x1; x1 &= x0; \ | ||
| 73 | x1 ^= x4; x2 ^= x0; x0 ^= x3; \ | ||
| 74 | x4 |= x0; x0 ^= x2; x2 &= x1; \ | ||
| 75 | x3 ^= x2; x1 =~ x1; x2 ^= x4; \ | ||
| 76 | x1 ^= x2; | ||
| 77 | |||
| 78 | #define S1(x0,x1,x2,x3,x4) \ | ||
| 79 | x4 = x1; \ | ||
| 80 | x1 ^= x0; x0 ^= x3; x3 =~ x3; \ | ||
| 81 | x4 &= x1; x0 |= x1; x3 ^= x2; \ | ||
| 82 | x0 ^= x3; x1 ^= x3; x3 ^= x4; \ | ||
| 83 | x1 |= x4; x4 ^= x2; x2 &= x0; \ | ||
| 84 | x2 ^= x1; x1 |= x0; x0 =~ x0; \ | ||
| 85 | x0 ^= x2; x4 ^= x1; | ||
| 86 | |||
| 87 | #define S2(x0,x1,x2,x3,x4) \ | ||
| 88 | x3 =~ x3; \ | ||
| 89 | x1 ^= x0; x4 = x0; x0 &= x2; \ | ||
| 90 | x0 ^= x3; x3 |= x4; x2 ^= x1; \ | ||
| 91 | x3 ^= x1; x1 &= x0; x0 ^= x2; \ | ||
| 92 | x2 &= x3; x3 |= x1; x0 =~ x0; \ | ||
| 93 | x3 ^= x0; x4 ^= x0; x0 ^= x2; \ | ||
| 94 | x1 |= x2; | ||
| 95 | |||
| 96 | #define S3(x0,x1,x2,x3,x4) \ | ||
| 97 | x4 = x1; \ | ||
| 98 | x1 ^= x3; x3 |= x0; x4 &= x0; \ | ||
| 99 | x0 ^= x2; x2 ^= x1; x1 &= x3; \ | ||
| 100 | x2 ^= x3; x0 |= x4; x4 ^= x3; \ | ||
| 101 | x1 ^= x0; x0 &= x3; x3 &= x4; \ | ||
| 102 | x3 ^= x2; x4 |= x1; x2 &= x1; \ | ||
| 103 | x4 ^= x3; x0 ^= x3; x3 ^= x2; | ||
| 104 | |||
| 105 | #define S4(x0,x1,x2,x3,x4) \ | ||
| 106 | x4 = x3; \ | ||
| 107 | x3 &= x0; x0 ^= x4; \ | ||
| 108 | x3 ^= x2; x2 |= x4; x0 ^= x1; \ | ||
| 109 | x4 ^= x3; x2 |= x0; \ | ||
| 110 | x2 ^= x1; x1 &= x0; \ | ||
| 111 | x1 ^= x4; x4 &= x2; x2 ^= x3; \ | ||
| 112 | x4 ^= x0; x3 |= x1; x1 =~ x1; \ | ||
| 113 | x3 ^= x0; | ||
| 114 | |||
| 115 | #define S5(x0,x1,x2,x3,x4) \ | ||
| 116 | x4 = x1; x1 |= x0; \ | ||
| 117 | x2 ^= x1; x3 =~ x3; x4 ^= x0; \ | ||
| 118 | x0 ^= x2; x1 &= x4; x4 |= x3; \ | ||
| 119 | x4 ^= x0; x0 &= x3; x1 ^= x3; \ | ||
| 120 | x3 ^= x2; x0 ^= x1; x2 &= x4; \ | ||
| 121 | x1 ^= x2; x2 &= x0; \ | ||
| 122 | x3 ^= x2; | ||
| 123 | |||
| 124 | #define S6(x0,x1,x2,x3,x4) \ | ||
| 125 | x4 = x1; \ | ||
| 126 | x3 ^= x0; x1 ^= x2; x2 ^= x0; \ | ||
| 127 | x0 &= x3; x1 |= x3; x4 =~ x4; \ | ||
| 128 | x0 ^= x1; x1 ^= x2; \ | ||
| 129 | x3 ^= x4; x4 ^= x0; x2 &= x0; \ | ||
| 130 | x4 ^= x1; x2 ^= x3; x3 &= x1; \ | ||
| 131 | x3 ^= x0; x1 ^= x2; | ||
| 132 | |||
| 133 | #define S7(x0,x1,x2,x3,x4) \ | ||
| 134 | x1 =~ x1; \ | ||
| 135 | x4 = x1; x0 =~ x0; x1 &= x2; \ | ||
| 136 | x1 ^= x3; x3 |= x4; x4 ^= x2; \ | ||
| 137 | x2 ^= x3; x3 ^= x0; x0 |= x1; \ | ||
| 138 | x2 &= x0; x0 ^= x4; x4 ^= x3; \ | ||
| 139 | x3 &= x0; x4 ^= x1; \ | ||
| 140 | x2 ^= x4; x3 ^= x1; x4 |= x0; \ | ||
| 141 | x4 ^= x1; | ||
| 142 | |||
| 143 | #define SI0(x0,x1,x2,x3,x4) \ | ||
| 144 | x4 = x3; x1 ^= x0; \ | ||
| 145 | x3 |= x1; x4 ^= x1; x0 =~ x0; \ | ||
| 146 | x2 ^= x3; x3 ^= x0; x0 &= x1; \ | ||
| 147 | x0 ^= x2; x2 &= x3; x3 ^= x4; \ | ||
| 148 | x2 ^= x3; x1 ^= x3; x3 &= x0; \ | ||
| 149 | x1 ^= x0; x0 ^= x2; x4 ^= x3; | ||
| 150 | |||
| 151 | #define SI1(x0,x1,x2,x3,x4) \ | ||
| 152 | x1 ^= x3; x4 = x0; \ | ||
| 153 | x0 ^= x2; x2 =~ x2; x4 |= x1; \ | ||
| 154 | x4 ^= x3; x3 &= x1; x1 ^= x2; \ | ||
| 155 | x2 &= x4; x4 ^= x1; x1 |= x3; \ | ||
| 156 | x3 ^= x0; x2 ^= x0; x0 |= x4; \ | ||
| 157 | x2 ^= x4; x1 ^= x0; \ | ||
| 158 | x4 ^= x1; | ||
| 159 | |||
| 160 | #define SI2(x0,x1,x2,x3,x4) \ | ||
| 161 | x2 ^= x1; x4 = x3; x3 =~ x3; \ | ||
| 162 | x3 |= x2; x2 ^= x4; x4 ^= x0; \ | ||
| 163 | x3 ^= x1; x1 |= x2; x2 ^= x0; \ | ||
| 164 | x1 ^= x4; x4 |= x3; x2 ^= x3; \ | ||
| 165 | x4 ^= x2; x2 &= x1; \ | ||
| 166 | x2 ^= x3; x3 ^= x4; x4 ^= x0; | ||
| 167 | |||
| 168 | #define SI3(x0,x1,x2,x3,x4) \ | ||
| 169 | x2 ^= x1; \ | ||
| 170 | x4 = x1; x1 &= x2; \ | ||
| 171 | x1 ^= x0; x0 |= x4; x4 ^= x3; \ | ||
| 172 | x0 ^= x3; x3 |= x1; x1 ^= x2; \ | ||
| 173 | x1 ^= x3; x0 ^= x2; x2 ^= x3; \ | ||
| 174 | x3 &= x1; x1 ^= x0; x0 &= x2; \ | ||
| 175 | x4 ^= x3; x3 ^= x0; x0 ^= x1; | ||
| 176 | |||
| 177 | #define SI4(x0,x1,x2,x3,x4) \ | ||
| 178 | x2 ^= x3; x4 = x0; x0 &= x1; \ | ||
| 179 | x0 ^= x2; x2 |= x3; x4 =~ x4; \ | ||
| 180 | x1 ^= x0; x0 ^= x2; x2 &= x4; \ | ||
| 181 | x2 ^= x0; x0 |= x4; \ | ||
| 182 | x0 ^= x3; x3 &= x2; \ | ||
| 183 | x4 ^= x3; x3 ^= x1; x1 &= x0; \ | ||
| 184 | x4 ^= x1; x0 ^= x3; | ||
| 185 | |||
| 186 | #define SI5(x0,x1,x2,x3,x4) \ | ||
| 187 | x4 = x1; x1 |= x2; \ | ||
| 188 | x2 ^= x4; x1 ^= x3; x3 &= x4; \ | ||
| 189 | x2 ^= x3; x3 |= x0; x0 =~ x0; \ | ||
| 190 | x3 ^= x2; x2 |= x0; x4 ^= x1; \ | ||
| 191 | x2 ^= x4; x4 &= x0; x0 ^= x1; \ | ||
| 192 | x1 ^= x3; x0 &= x2; x2 ^= x3; \ | ||
| 193 | x0 ^= x2; x2 ^= x4; x4 ^= x3; | ||
| 194 | |||
| 195 | #define SI6(x0,x1,x2,x3,x4) \ | ||
| 196 | x0 ^= x2; \ | ||
| 197 | x4 = x0; x0 &= x3; x2 ^= x3; \ | ||
| 198 | x0 ^= x2; x3 ^= x1; x2 |= x4; \ | ||
| 199 | x2 ^= x3; x3 &= x0; x0 =~ x0; \ | ||
| 200 | x3 ^= x1; x1 &= x2; x4 ^= x0; \ | ||
| 201 | x3 ^= x4; x4 ^= x2; x0 ^= x1; \ | ||
| 202 | x2 ^= x0; | ||
| 203 | |||
| 204 | #define SI7(x0,x1,x2,x3,x4) \ | ||
| 205 | x4 = x3; x3 &= x0; x0 ^= x2; \ | ||
| 206 | x2 |= x4; x4 ^= x1; x0 =~ x0; \ | ||
| 207 | x1 |= x3; x4 ^= x0; x0 &= x2; \ | ||
| 208 | x0 ^= x1; x1 &= x2; x3 ^= x2; \ | ||
| 209 | x4 ^= x3; x2 &= x3; x3 |= x0; \ | ||
| 210 | x1 ^= x4; x3 ^= x4; x4 &= x0; \ | ||
| 211 | x4 ^= x2; | ||
| 212 | |||
| 213 | struct serpent_ctx { | ||
| 214 | u32 expkey[SERPENT_EXPKEY_WORDS]; | ||
| 215 | }; | ||
| 216 | |||
| 217 | |||
| 218 | static int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
| 219 | unsigned int keylen) | ||
| 220 | { | ||
| 221 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 222 | u32 *k = ctx->expkey; | ||
| 223 | u8 *k8 = (u8 *)k; | ||
| 224 | u32 r0,r1,r2,r3,r4; | ||
| 225 | int i; | ||
| 226 | |||
| 227 | /* Copy key, add padding */ | ||
| 228 | |||
| 229 | for (i = 0; i < keylen; ++i) | ||
| 230 | k8[i] = key[i]; | ||
| 231 | if (i < SERPENT_MAX_KEY_SIZE) | ||
| 232 | k8[i++] = 1; | ||
| 233 | while (i < SERPENT_MAX_KEY_SIZE) | ||
| 234 | k8[i++] = 0; | ||
| 235 | |||
| 236 | /* Expand key using polynomial */ | ||
| 237 | |||
| 238 | r0 = le32_to_cpu(k[3]); | ||
| 239 | r1 = le32_to_cpu(k[4]); | ||
| 240 | r2 = le32_to_cpu(k[5]); | ||
| 241 | r3 = le32_to_cpu(k[6]); | ||
| 242 | r4 = le32_to_cpu(k[7]); | ||
| 243 | |||
| 244 | keyiter(le32_to_cpu(k[0]),r0,r4,r2,0,0); | ||
| 245 | keyiter(le32_to_cpu(k[1]),r1,r0,r3,1,1); | ||
| 246 | keyiter(le32_to_cpu(k[2]),r2,r1,r4,2,2); | ||
| 247 | keyiter(le32_to_cpu(k[3]),r3,r2,r0,3,3); | ||
| 248 | keyiter(le32_to_cpu(k[4]),r4,r3,r1,4,4); | ||
| 249 | keyiter(le32_to_cpu(k[5]),r0,r4,r2,5,5); | ||
| 250 | keyiter(le32_to_cpu(k[6]),r1,r0,r3,6,6); | ||
| 251 | keyiter(le32_to_cpu(k[7]),r2,r1,r4,7,7); | ||
| 252 | |||
| 253 | keyiter(k[ 0],r3,r2,r0, 8, 8); keyiter(k[ 1],r4,r3,r1, 9, 9); | ||
| 254 | keyiter(k[ 2],r0,r4,r2, 10, 10); keyiter(k[ 3],r1,r0,r3, 11, 11); | ||
| 255 | keyiter(k[ 4],r2,r1,r4, 12, 12); keyiter(k[ 5],r3,r2,r0, 13, 13); | ||
| 256 | keyiter(k[ 6],r4,r3,r1, 14, 14); keyiter(k[ 7],r0,r4,r2, 15, 15); | ||
| 257 | keyiter(k[ 8],r1,r0,r3, 16, 16); keyiter(k[ 9],r2,r1,r4, 17, 17); | ||
| 258 | keyiter(k[ 10],r3,r2,r0, 18, 18); keyiter(k[ 11],r4,r3,r1, 19, 19); | ||
| 259 | keyiter(k[ 12],r0,r4,r2, 20, 20); keyiter(k[ 13],r1,r0,r3, 21, 21); | ||
| 260 | keyiter(k[ 14],r2,r1,r4, 22, 22); keyiter(k[ 15],r3,r2,r0, 23, 23); | ||
| 261 | keyiter(k[ 16],r4,r3,r1, 24, 24); keyiter(k[ 17],r0,r4,r2, 25, 25); | ||
| 262 | keyiter(k[ 18],r1,r0,r3, 26, 26); keyiter(k[ 19],r2,r1,r4, 27, 27); | ||
| 263 | keyiter(k[ 20],r3,r2,r0, 28, 28); keyiter(k[ 21],r4,r3,r1, 29, 29); | ||
| 264 | keyiter(k[ 22],r0,r4,r2, 30, 30); keyiter(k[ 23],r1,r0,r3, 31, 31); | ||
| 265 | |||
| 266 | k += 50; | ||
| 267 | |||
| 268 | keyiter(k[-26],r2,r1,r4, 32,-18); keyiter(k[-25],r3,r2,r0, 33,-17); | ||
| 269 | keyiter(k[-24],r4,r3,r1, 34,-16); keyiter(k[-23],r0,r4,r2, 35,-15); | ||
| 270 | keyiter(k[-22],r1,r0,r3, 36,-14); keyiter(k[-21],r2,r1,r4, 37,-13); | ||
| 271 | keyiter(k[-20],r3,r2,r0, 38,-12); keyiter(k[-19],r4,r3,r1, 39,-11); | ||
| 272 | keyiter(k[-18],r0,r4,r2, 40,-10); keyiter(k[-17],r1,r0,r3, 41, -9); | ||
| 273 | keyiter(k[-16],r2,r1,r4, 42, -8); keyiter(k[-15],r3,r2,r0, 43, -7); | ||
| 274 | keyiter(k[-14],r4,r3,r1, 44, -6); keyiter(k[-13],r0,r4,r2, 45, -5); | ||
| 275 | keyiter(k[-12],r1,r0,r3, 46, -4); keyiter(k[-11],r2,r1,r4, 47, -3); | ||
| 276 | keyiter(k[-10],r3,r2,r0, 48, -2); keyiter(k[ -9],r4,r3,r1, 49, -1); | ||
| 277 | keyiter(k[ -8],r0,r4,r2, 50, 0); keyiter(k[ -7],r1,r0,r3, 51, 1); | ||
| 278 | keyiter(k[ -6],r2,r1,r4, 52, 2); keyiter(k[ -5],r3,r2,r0, 53, 3); | ||
| 279 | keyiter(k[ -4],r4,r3,r1, 54, 4); keyiter(k[ -3],r0,r4,r2, 55, 5); | ||
| 280 | keyiter(k[ -2],r1,r0,r3, 56, 6); keyiter(k[ -1],r2,r1,r4, 57, 7); | ||
| 281 | keyiter(k[ 0],r3,r2,r0, 58, 8); keyiter(k[ 1],r4,r3,r1, 59, 9); | ||
| 282 | keyiter(k[ 2],r0,r4,r2, 60, 10); keyiter(k[ 3],r1,r0,r3, 61, 11); | ||
| 283 | keyiter(k[ 4],r2,r1,r4, 62, 12); keyiter(k[ 5],r3,r2,r0, 63, 13); | ||
| 284 | keyiter(k[ 6],r4,r3,r1, 64, 14); keyiter(k[ 7],r0,r4,r2, 65, 15); | ||
| 285 | keyiter(k[ 8],r1,r0,r3, 66, 16); keyiter(k[ 9],r2,r1,r4, 67, 17); | ||
| 286 | keyiter(k[ 10],r3,r2,r0, 68, 18); keyiter(k[ 11],r4,r3,r1, 69, 19); | ||
| 287 | keyiter(k[ 12],r0,r4,r2, 70, 20); keyiter(k[ 13],r1,r0,r3, 71, 21); | ||
| 288 | keyiter(k[ 14],r2,r1,r4, 72, 22); keyiter(k[ 15],r3,r2,r0, 73, 23); | ||
| 289 | keyiter(k[ 16],r4,r3,r1, 74, 24); keyiter(k[ 17],r0,r4,r2, 75, 25); | ||
| 290 | keyiter(k[ 18],r1,r0,r3, 76, 26); keyiter(k[ 19],r2,r1,r4, 77, 27); | ||
| 291 | keyiter(k[ 20],r3,r2,r0, 78, 28); keyiter(k[ 21],r4,r3,r1, 79, 29); | ||
| 292 | keyiter(k[ 22],r0,r4,r2, 80, 30); keyiter(k[ 23],r1,r0,r3, 81, 31); | ||
| 293 | |||
| 294 | k += 50; | ||
| 295 | |||
| 296 | keyiter(k[-26],r2,r1,r4, 82,-18); keyiter(k[-25],r3,r2,r0, 83,-17); | ||
| 297 | keyiter(k[-24],r4,r3,r1, 84,-16); keyiter(k[-23],r0,r4,r2, 85,-15); | ||
| 298 | keyiter(k[-22],r1,r0,r3, 86,-14); keyiter(k[-21],r2,r1,r4, 87,-13); | ||
| 299 | keyiter(k[-20],r3,r2,r0, 88,-12); keyiter(k[-19],r4,r3,r1, 89,-11); | ||
| 300 | keyiter(k[-18],r0,r4,r2, 90,-10); keyiter(k[-17],r1,r0,r3, 91, -9); | ||
| 301 | keyiter(k[-16],r2,r1,r4, 92, -8); keyiter(k[-15],r3,r2,r0, 93, -7); | ||
| 302 | keyiter(k[-14],r4,r3,r1, 94, -6); keyiter(k[-13],r0,r4,r2, 95, -5); | ||
| 303 | keyiter(k[-12],r1,r0,r3, 96, -4); keyiter(k[-11],r2,r1,r4, 97, -3); | ||
| 304 | keyiter(k[-10],r3,r2,r0, 98, -2); keyiter(k[ -9],r4,r3,r1, 99, -1); | ||
| 305 | keyiter(k[ -8],r0,r4,r2,100, 0); keyiter(k[ -7],r1,r0,r3,101, 1); | ||
| 306 | keyiter(k[ -6],r2,r1,r4,102, 2); keyiter(k[ -5],r3,r2,r0,103, 3); | ||
| 307 | keyiter(k[ -4],r4,r3,r1,104, 4); keyiter(k[ -3],r0,r4,r2,105, 5); | ||
| 308 | keyiter(k[ -2],r1,r0,r3,106, 6); keyiter(k[ -1],r2,r1,r4,107, 7); | ||
| 309 | keyiter(k[ 0],r3,r2,r0,108, 8); keyiter(k[ 1],r4,r3,r1,109, 9); | ||
| 310 | keyiter(k[ 2],r0,r4,r2,110, 10); keyiter(k[ 3],r1,r0,r3,111, 11); | ||
| 311 | keyiter(k[ 4],r2,r1,r4,112, 12); keyiter(k[ 5],r3,r2,r0,113, 13); | ||
| 312 | keyiter(k[ 6],r4,r3,r1,114, 14); keyiter(k[ 7],r0,r4,r2,115, 15); | ||
| 313 | keyiter(k[ 8],r1,r0,r3,116, 16); keyiter(k[ 9],r2,r1,r4,117, 17); | ||
| 314 | keyiter(k[ 10],r3,r2,r0,118, 18); keyiter(k[ 11],r4,r3,r1,119, 19); | ||
| 315 | keyiter(k[ 12],r0,r4,r2,120, 20); keyiter(k[ 13],r1,r0,r3,121, 21); | ||
| 316 | keyiter(k[ 14],r2,r1,r4,122, 22); keyiter(k[ 15],r3,r2,r0,123, 23); | ||
| 317 | keyiter(k[ 16],r4,r3,r1,124, 24); keyiter(k[ 17],r0,r4,r2,125, 25); | ||
| 318 | keyiter(k[ 18],r1,r0,r3,126, 26); keyiter(k[ 19],r2,r1,r4,127, 27); | ||
| 319 | keyiter(k[ 20],r3,r2,r0,128, 28); keyiter(k[ 21],r4,r3,r1,129, 29); | ||
| 320 | keyiter(k[ 22],r0,r4,r2,130, 30); keyiter(k[ 23],r1,r0,r3,131, 31); | ||
| 321 | |||
| 322 | /* Apply S-boxes */ | ||
| 323 | |||
| 324 | S3(r3,r4,r0,r1,r2); storekeys(r1,r2,r4,r3, 28); loadkeys(r1,r2,r4,r3, 24); | ||
| 325 | S4(r1,r2,r4,r3,r0); storekeys(r2,r4,r3,r0, 24); loadkeys(r2,r4,r3,r0, 20); | ||
| 326 | S5(r2,r4,r3,r0,r1); storekeys(r1,r2,r4,r0, 20); loadkeys(r1,r2,r4,r0, 16); | ||
| 327 | S6(r1,r2,r4,r0,r3); storekeys(r4,r3,r2,r0, 16); loadkeys(r4,r3,r2,r0, 12); | ||
| 328 | S7(r4,r3,r2,r0,r1); storekeys(r1,r2,r0,r4, 12); loadkeys(r1,r2,r0,r4, 8); | ||
| 329 | S0(r1,r2,r0,r4,r3); storekeys(r0,r2,r4,r1, 8); loadkeys(r0,r2,r4,r1, 4); | ||
| 330 | S1(r0,r2,r4,r1,r3); storekeys(r3,r4,r1,r0, 4); loadkeys(r3,r4,r1,r0, 0); | ||
| 331 | S2(r3,r4,r1,r0,r2); storekeys(r2,r4,r3,r0, 0); loadkeys(r2,r4,r3,r0, -4); | ||
| 332 | S3(r2,r4,r3,r0,r1); storekeys(r0,r1,r4,r2, -4); loadkeys(r0,r1,r4,r2, -8); | ||
| 333 | S4(r0,r1,r4,r2,r3); storekeys(r1,r4,r2,r3, -8); loadkeys(r1,r4,r2,r3,-12); | ||
| 334 | S5(r1,r4,r2,r3,r0); storekeys(r0,r1,r4,r3,-12); loadkeys(r0,r1,r4,r3,-16); | ||
| 335 | S6(r0,r1,r4,r3,r2); storekeys(r4,r2,r1,r3,-16); loadkeys(r4,r2,r1,r3,-20); | ||
| 336 | S7(r4,r2,r1,r3,r0); storekeys(r0,r1,r3,r4,-20); loadkeys(r0,r1,r3,r4,-24); | ||
| 337 | S0(r0,r1,r3,r4,r2); storekeys(r3,r1,r4,r0,-24); loadkeys(r3,r1,r4,r0,-28); | ||
| 338 | k -= 50; | ||
| 339 | S1(r3,r1,r4,r0,r2); storekeys(r2,r4,r0,r3, 22); loadkeys(r2,r4,r0,r3, 18); | ||
| 340 | S2(r2,r4,r0,r3,r1); storekeys(r1,r4,r2,r3, 18); loadkeys(r1,r4,r2,r3, 14); | ||
| 341 | S3(r1,r4,r2,r3,r0); storekeys(r3,r0,r4,r1, 14); loadkeys(r3,r0,r4,r1, 10); | ||
| 342 | S4(r3,r0,r4,r1,r2); storekeys(r0,r4,r1,r2, 10); loadkeys(r0,r4,r1,r2, 6); | ||
| 343 | S5(r0,r4,r1,r2,r3); storekeys(r3,r0,r4,r2, 6); loadkeys(r3,r0,r4,r2, 2); | ||
| 344 | S6(r3,r0,r4,r2,r1); storekeys(r4,r1,r0,r2, 2); loadkeys(r4,r1,r0,r2, -2); | ||
| 345 | S7(r4,r1,r0,r2,r3); storekeys(r3,r0,r2,r4, -2); loadkeys(r3,r0,r2,r4, -6); | ||
| 346 | S0(r3,r0,r2,r4,r1); storekeys(r2,r0,r4,r3, -6); loadkeys(r2,r0,r4,r3,-10); | ||
| 347 | S1(r2,r0,r4,r3,r1); storekeys(r1,r4,r3,r2,-10); loadkeys(r1,r4,r3,r2,-14); | ||
| 348 | S2(r1,r4,r3,r2,r0); storekeys(r0,r4,r1,r2,-14); loadkeys(r0,r4,r1,r2,-18); | ||
| 349 | S3(r0,r4,r1,r2,r3); storekeys(r2,r3,r4,r0,-18); loadkeys(r2,r3,r4,r0,-22); | ||
| 350 | k -= 50; | ||
| 351 | S4(r2,r3,r4,r0,r1); storekeys(r3,r4,r0,r1, 28); loadkeys(r3,r4,r0,r1, 24); | ||
| 352 | S5(r3,r4,r0,r1,r2); storekeys(r2,r3,r4,r1, 24); loadkeys(r2,r3,r4,r1, 20); | ||
| 353 | S6(r2,r3,r4,r1,r0); storekeys(r4,r0,r3,r1, 20); loadkeys(r4,r0,r3,r1, 16); | ||
| 354 | S7(r4,r0,r3,r1,r2); storekeys(r2,r3,r1,r4, 16); loadkeys(r2,r3,r1,r4, 12); | ||
| 355 | S0(r2,r3,r1,r4,r0); storekeys(r1,r3,r4,r2, 12); loadkeys(r1,r3,r4,r2, 8); | ||
| 356 | S1(r1,r3,r4,r2,r0); storekeys(r0,r4,r2,r1, 8); loadkeys(r0,r4,r2,r1, 4); | ||
| 357 | S2(r0,r4,r2,r1,r3); storekeys(r3,r4,r0,r1, 4); loadkeys(r3,r4,r0,r1, 0); | ||
| 358 | S3(r3,r4,r0,r1,r2); storekeys(r1,r2,r4,r3, 0); | ||
| 359 | |||
| 360 | return 0; | ||
| 361 | } | ||
| 362 | |||
| 363 | static void serpent_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
| 364 | { | ||
| 365 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 366 | const u32 | ||
| 367 | *k = ctx->expkey; | ||
| 368 | const __le32 *s = (const __le32 *)src; | ||
| 369 | __le32 *d = (__le32 *)dst; | ||
| 370 | u32 r0, r1, r2, r3, r4; | ||
| 371 | |||
| 372 | /* | ||
| 373 | * Note: The conversions between u8* and u32* might cause trouble | ||
| 374 | * on architectures with stricter alignment rules than x86 | ||
| 375 | */ | ||
| 376 | |||
| 377 | r0 = le32_to_cpu(s[0]); | ||
| 378 | r1 = le32_to_cpu(s[1]); | ||
| 379 | r2 = le32_to_cpu(s[2]); | ||
| 380 | r3 = le32_to_cpu(s[3]); | ||
| 381 | |||
| 382 | K(r0,r1,r2,r3,0); | ||
| 383 | S0(r0,r1,r2,r3,r4); LK(r2,r1,r3,r0,r4,1); | ||
| 384 | S1(r2,r1,r3,r0,r4); LK(r4,r3,r0,r2,r1,2); | ||
| 385 | S2(r4,r3,r0,r2,r1); LK(r1,r3,r4,r2,r0,3); | ||
| 386 | S3(r1,r3,r4,r2,r0); LK(r2,r0,r3,r1,r4,4); | ||
| 387 | S4(r2,r0,r3,r1,r4); LK(r0,r3,r1,r4,r2,5); | ||
| 388 | S5(r0,r3,r1,r4,r2); LK(r2,r0,r3,r4,r1,6); | ||
| 389 | S6(r2,r0,r3,r4,r1); LK(r3,r1,r0,r4,r2,7); | ||
| 390 | S7(r3,r1,r0,r4,r2); LK(r2,r0,r4,r3,r1,8); | ||
| 391 | S0(r2,r0,r4,r3,r1); LK(r4,r0,r3,r2,r1,9); | ||
| 392 | S1(r4,r0,r3,r2,r1); LK(r1,r3,r2,r4,r0,10); | ||
| 393 | S2(r1,r3,r2,r4,r0); LK(r0,r3,r1,r4,r2,11); | ||
| 394 | S3(r0,r3,r1,r4,r2); LK(r4,r2,r3,r0,r1,12); | ||
| 395 | S4(r4,r2,r3,r0,r1); LK(r2,r3,r0,r1,r4,13); | ||
| 396 | S5(r2,r3,r0,r1,r4); LK(r4,r2,r3,r1,r0,14); | ||
| 397 | S6(r4,r2,r3,r1,r0); LK(r3,r0,r2,r1,r4,15); | ||
| 398 | S7(r3,r0,r2,r1,r4); LK(r4,r2,r1,r3,r0,16); | ||
| 399 | S0(r4,r2,r1,r3,r0); LK(r1,r2,r3,r4,r0,17); | ||
| 400 | S1(r1,r2,r3,r4,r0); LK(r0,r3,r4,r1,r2,18); | ||
| 401 | S2(r0,r3,r4,r1,r2); LK(r2,r3,r0,r1,r4,19); | ||
| 402 | S3(r2,r3,r0,r1,r4); LK(r1,r4,r3,r2,r0,20); | ||
| 403 | S4(r1,r4,r3,r2,r0); LK(r4,r3,r2,r0,r1,21); | ||
| 404 | S5(r4,r3,r2,r0,r1); LK(r1,r4,r3,r0,r2,22); | ||
| 405 | S6(r1,r4,r3,r0,r2); LK(r3,r2,r4,r0,r1,23); | ||
| 406 | S7(r3,r2,r4,r0,r1); LK(r1,r4,r0,r3,r2,24); | ||
| 407 | S0(r1,r4,r0,r3,r2); LK(r0,r4,r3,r1,r2,25); | ||
| 408 | S1(r0,r4,r3,r1,r2); LK(r2,r3,r1,r0,r4,26); | ||
| 409 | S2(r2,r3,r1,r0,r4); LK(r4,r3,r2,r0,r1,27); | ||
| 410 | S3(r4,r3,r2,r0,r1); LK(r0,r1,r3,r4,r2,28); | ||
| 411 | S4(r0,r1,r3,r4,r2); LK(r1,r3,r4,r2,r0,29); | ||
| 412 | S5(r1,r3,r4,r2,r0); LK(r0,r1,r3,r2,r4,30); | ||
| 413 | S6(r0,r1,r3,r2,r4); LK(r3,r4,r1,r2,r0,31); | ||
| 414 | S7(r3,r4,r1,r2,r0); K(r0,r1,r2,r3,32); | ||
| 415 | |||
| 416 | d[0] = cpu_to_le32(r0); | ||
| 417 | d[1] = cpu_to_le32(r1); | ||
| 418 | d[2] = cpu_to_le32(r2); | ||
| 419 | d[3] = cpu_to_le32(r3); | ||
| 420 | } | ||
| 421 | |||
| 422 | static void serpent_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
| 423 | { | ||
| 424 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 425 | const u32 | ||
| 426 | *k = ((struct serpent_ctx *)ctx)->expkey; | ||
| 427 | const __le32 *s = (const __le32 *)src; | ||
| 428 | __le32 *d = (__le32 *)dst; | ||
| 429 | u32 r0, r1, r2, r3, r4; | ||
| 430 | |||
| 431 | r0 = le32_to_cpu(s[0]); | ||
| 432 | r1 = le32_to_cpu(s[1]); | ||
| 433 | r2 = le32_to_cpu(s[2]); | ||
| 434 | r3 = le32_to_cpu(s[3]); | ||
| 435 | |||
| 436 | K(r0,r1,r2,r3,32); | ||
| 437 | SI7(r0,r1,r2,r3,r4); KL(r1,r3,r0,r4,r2,31); | ||
| 438 | SI6(r1,r3,r0,r4,r2); KL(r0,r2,r4,r1,r3,30); | ||
| 439 | SI5(r0,r2,r4,r1,r3); KL(r2,r3,r0,r4,r1,29); | ||
| 440 | SI4(r2,r3,r0,r4,r1); KL(r2,r0,r1,r4,r3,28); | ||
| 441 | SI3(r2,r0,r1,r4,r3); KL(r1,r2,r3,r4,r0,27); | ||
| 442 | SI2(r1,r2,r3,r4,r0); KL(r2,r0,r4,r3,r1,26); | ||
| 443 | SI1(r2,r0,r4,r3,r1); KL(r1,r0,r4,r3,r2,25); | ||
| 444 | SI0(r1,r0,r4,r3,r2); KL(r4,r2,r0,r1,r3,24); | ||
| 445 | SI7(r4,r2,r0,r1,r3); KL(r2,r1,r4,r3,r0,23); | ||
| 446 | SI6(r2,r1,r4,r3,r0); KL(r4,r0,r3,r2,r1,22); | ||
| 447 | SI5(r4,r0,r3,r2,r1); KL(r0,r1,r4,r3,r2,21); | ||
| 448 | SI4(r0,r1,r4,r3,r2); KL(r0,r4,r2,r3,r1,20); | ||
| 449 | SI3(r0,r4,r2,r3,r1); KL(r2,r0,r1,r3,r4,19); | ||
| 450 | SI2(r2,r0,r1,r3,r4); KL(r0,r4,r3,r1,r2,18); | ||
| 451 | SI1(r0,r4,r3,r1,r2); KL(r2,r4,r3,r1,r0,17); | ||
| 452 | SI0(r2,r4,r3,r1,r0); KL(r3,r0,r4,r2,r1,16); | ||
| 453 | SI7(r3,r0,r4,r2,r1); KL(r0,r2,r3,r1,r4,15); | ||
| 454 | SI6(r0,r2,r3,r1,r4); KL(r3,r4,r1,r0,r2,14); | ||
| 455 | SI5(r3,r4,r1,r0,r2); KL(r4,r2,r3,r1,r0,13); | ||
| 456 | SI4(r4,r2,r3,r1,r0); KL(r4,r3,r0,r1,r2,12); | ||
| 457 | SI3(r4,r3,r0,r1,r2); KL(r0,r4,r2,r1,r3,11); | ||
| 458 | SI2(r0,r4,r2,r1,r3); KL(r4,r3,r1,r2,r0,10); | ||
| 459 | SI1(r4,r3,r1,r2,r0); KL(r0,r3,r1,r2,r4,9); | ||
| 460 | SI0(r0,r3,r1,r2,r4); KL(r1,r4,r3,r0,r2,8); | ||
| 461 | SI7(r1,r4,r3,r0,r2); KL(r4,r0,r1,r2,r3,7); | ||
| 462 | SI6(r4,r0,r1,r2,r3); KL(r1,r3,r2,r4,r0,6); | ||
| 463 | SI5(r1,r3,r2,r4,r0); KL(r3,r0,r1,r2,r4,5); | ||
| 464 | SI4(r3,r0,r1,r2,r4); KL(r3,r1,r4,r2,r0,4); | ||
| 465 | SI3(r3,r1,r4,r2,r0); KL(r4,r3,r0,r2,r1,3); | ||
| 466 | SI2(r4,r3,r0,r2,r1); KL(r3,r1,r2,r0,r4,2); | ||
| 467 | SI1(r3,r1,r2,r0,r4); KL(r4,r1,r2,r0,r3,1); | ||
| 468 | SI0(r4,r1,r2,r0,r3); K(r2,r3,r1,r4,0); | ||
| 469 | |||
| 470 | d[0] = cpu_to_le32(r2); | ||
| 471 | d[1] = cpu_to_le32(r3); | ||
| 472 | d[2] = cpu_to_le32(r1); | ||
| 473 | d[3] = cpu_to_le32(r4); | ||
| 474 | } | ||
| 475 | |||
| 476 | static struct crypto_alg serpent_alg = { | ||
| 477 | .cra_name = "serpent", | ||
| 478 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
| 479 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 480 | .cra_ctxsize = sizeof(struct serpent_ctx), | ||
| 481 | .cra_alignmask = 3, | ||
| 482 | .cra_module = THIS_MODULE, | ||
| 483 | .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list), | ||
| 484 | .cra_u = { .cipher = { | ||
| 485 | .cia_min_keysize = SERPENT_MIN_KEY_SIZE, | ||
| 486 | .cia_max_keysize = SERPENT_MAX_KEY_SIZE, | ||
| 487 | .cia_setkey = serpent_setkey, | ||
| 488 | .cia_encrypt = serpent_encrypt, | ||
| 489 | .cia_decrypt = serpent_decrypt } } | ||
| 490 | }; | ||
| 491 | |||
| 492 | static int tnepres_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
| 493 | unsigned int keylen) | ||
| 494 | { | ||
| 495 | u8 rev_key[SERPENT_MAX_KEY_SIZE]; | ||
| 496 | int i; | ||
| 497 | |||
| 498 | for (i = 0; i < keylen; ++i) | ||
| 499 | rev_key[keylen - i - 1] = key[i]; | ||
| 500 | |||
| 501 | return serpent_setkey(tfm, rev_key, keylen); | ||
| 502 | } | ||
| 503 | |||
| 504 | static void tnepres_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
| 505 | { | ||
| 506 | const u32 * const s = (const u32 * const)src; | ||
| 507 | u32 * const d = (u32 * const)dst; | ||
| 508 | |||
| 509 | u32 rs[4], rd[4]; | ||
| 510 | |||
| 511 | rs[0] = swab32(s[3]); | ||
| 512 | rs[1] = swab32(s[2]); | ||
| 513 | rs[2] = swab32(s[1]); | ||
| 514 | rs[3] = swab32(s[0]); | ||
| 515 | |||
| 516 | serpent_encrypt(tfm, (u8 *)rd, (u8 *)rs); | ||
| 517 | |||
| 518 | d[0] = swab32(rd[3]); | ||
| 519 | d[1] = swab32(rd[2]); | ||
| 520 | d[2] = swab32(rd[1]); | ||
| 521 | d[3] = swab32(rd[0]); | ||
| 522 | } | ||
| 523 | |||
| 524 | static void tnepres_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
| 525 | { | ||
| 526 | const u32 * const s = (const u32 * const)src; | ||
| 527 | u32 * const d = (u32 * const)dst; | ||
| 528 | |||
| 529 | u32 rs[4], rd[4]; | ||
| 530 | |||
| 531 | rs[0] = swab32(s[3]); | ||
| 532 | rs[1] = swab32(s[2]); | ||
| 533 | rs[2] = swab32(s[1]); | ||
| 534 | rs[3] = swab32(s[0]); | ||
| 535 | |||
| 536 | serpent_decrypt(tfm, (u8 *)rd, (u8 *)rs); | ||
| 537 | |||
| 538 | d[0] = swab32(rd[3]); | ||
| 539 | d[1] = swab32(rd[2]); | ||
| 540 | d[2] = swab32(rd[1]); | ||
| 541 | d[3] = swab32(rd[0]); | ||
| 542 | } | ||
| 543 | |||
| 544 | static struct crypto_alg tnepres_alg = { | ||
| 545 | .cra_name = "tnepres", | ||
| 546 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
| 547 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 548 | .cra_ctxsize = sizeof(struct serpent_ctx), | ||
| 549 | .cra_alignmask = 3, | ||
| 550 | .cra_module = THIS_MODULE, | ||
| 551 | .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list), | ||
| 552 | .cra_u = { .cipher = { | ||
| 553 | .cia_min_keysize = SERPENT_MIN_KEY_SIZE, | ||
| 554 | .cia_max_keysize = SERPENT_MAX_KEY_SIZE, | ||
| 555 | .cia_setkey = tnepres_setkey, | ||
| 556 | .cia_encrypt = tnepres_encrypt, | ||
| 557 | .cia_decrypt = tnepres_decrypt } } | ||
| 558 | }; | ||
| 559 | |||
| 560 | static int __init serpent_mod_init(void) | ||
| 561 | { | ||
| 562 | int ret = crypto_register_alg(&serpent_alg); | ||
| 563 | |||
| 564 | if (ret) | ||
| 565 | return ret; | ||
| 566 | |||
| 567 | ret = crypto_register_alg(&tnepres_alg); | ||
| 568 | |||
| 569 | if (ret) | ||
| 570 | crypto_unregister_alg(&serpent_alg); | ||
| 571 | |||
| 572 | return ret; | ||
| 573 | } | ||
| 574 | |||
| 575 | static void __exit serpent_mod_fini(void) | ||
| 576 | { | ||
| 577 | crypto_unregister_alg(&tnepres_alg); | ||
| 578 | crypto_unregister_alg(&serpent_alg); | ||
| 579 | } | ||
| 580 | |||
| 581 | module_init(serpent_mod_init); | ||
| 582 | module_exit(serpent_mod_fini); | ||
| 583 | |||
| 584 | MODULE_LICENSE("GPL"); | ||
| 585 | MODULE_DESCRIPTION("Serpent and tnepres (kerneli compatible serpent reversed) Cipher Algorithm"); | ||
| 586 | MODULE_AUTHOR("Dag Arne Osvik <osvik@ii.uib.no>"); | ||
| 587 | MODULE_ALIAS("tnepres"); | ||
diff --git a/crypto/serpent_generic.c b/crypto/serpent_generic.c new file mode 100644 index 000000000000..8f32cf35e5ce --- /dev/null +++ b/crypto/serpent_generic.c | |||
| @@ -0,0 +1,684 @@ | |||
| 1 | /* | ||
| 2 | * Cryptographic API. | ||
| 3 | * | ||
| 4 | * Serpent Cipher Algorithm. | ||
| 5 | * | ||
| 6 | * Copyright (C) 2002 Dag Arne Osvik <osvik@ii.uib.no> | ||
| 7 | * 2003 Herbert Valerio Riedel <hvr@gnu.org> | ||
| 8 | * | ||
| 9 | * Added tnepres support: | ||
| 10 | * Ruben Jesus Garcia Hernandez <ruben@ugr.es>, 18.10.2004 | ||
| 11 | * Based on code by hvr | ||
| 12 | * | ||
| 13 | * This program is free software; you can redistribute it and/or modify | ||
| 14 | * it under the terms of the GNU General Public License as published by | ||
| 15 | * the Free Software Foundation; either version 2 of the License, or | ||
| 16 | * (at your option) any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/init.h> | ||
| 20 | #include <linux/module.h> | ||
| 21 | #include <linux/errno.h> | ||
| 22 | #include <asm/byteorder.h> | ||
| 23 | #include <linux/crypto.h> | ||
| 24 | #include <linux/types.h> | ||
| 25 | #include <crypto/serpent.h> | ||
| 26 | |||
| 27 | /* Key is padded to the maximum of 256 bits before round key generation. | ||
| 28 | * Any key length <= 256 bits (32 bytes) is allowed by the algorithm. | ||
| 29 | */ | ||
| 30 | |||
| 31 | #define PHI 0x9e3779b9UL | ||
| 32 | |||
| 33 | #define keyiter(a, b, c, d, i, j) \ | ||
| 34 | ({ b ^= d; b ^= c; b ^= a; b ^= PHI ^ i; b = rol32(b, 11); k[j] = b; }) | ||
| 35 | |||
| 36 | #define loadkeys(x0, x1, x2, x3, i) \ | ||
| 37 | ({ x0 = k[i]; x1 = k[i+1]; x2 = k[i+2]; x3 = k[i+3]; }) | ||
| 38 | |||
| 39 | #define storekeys(x0, x1, x2, x3, i) \ | ||
| 40 | ({ k[i] = x0; k[i+1] = x1; k[i+2] = x2; k[i+3] = x3; }) | ||
| 41 | |||
| 42 | #define store_and_load_keys(x0, x1, x2, x3, s, l) \ | ||
| 43 | ({ storekeys(x0, x1, x2, x3, s); loadkeys(x0, x1, x2, x3, l); }) | ||
| 44 | |||
| 45 | #define K(x0, x1, x2, x3, i) ({ \ | ||
| 46 | x3 ^= k[4*(i)+3]; x2 ^= k[4*(i)+2]; \ | ||
| 47 | x1 ^= k[4*(i)+1]; x0 ^= k[4*(i)+0]; \ | ||
| 48 | }) | ||
| 49 | |||
| 50 | #define LK(x0, x1, x2, x3, x4, i) ({ \ | ||
| 51 | x0 = rol32(x0, 13);\ | ||
| 52 | x2 = rol32(x2, 3); x1 ^= x0; x4 = x0 << 3; \ | ||
| 53 | x3 ^= x2; x1 ^= x2; \ | ||
| 54 | x1 = rol32(x1, 1); x3 ^= x4; \ | ||
| 55 | x3 = rol32(x3, 7); x4 = x1; \ | ||
| 56 | x0 ^= x1; x4 <<= 7; x2 ^= x3; \ | ||
| 57 | x0 ^= x3; x2 ^= x4; x3 ^= k[4*i+3]; \ | ||
| 58 | x1 ^= k[4*i+1]; x0 = rol32(x0, 5); x2 = rol32(x2, 22);\ | ||
| 59 | x0 ^= k[4*i+0]; x2 ^= k[4*i+2]; \ | ||
| 60 | }) | ||
| 61 | |||
| 62 | #define KL(x0, x1, x2, x3, x4, i) ({ \ | ||
| 63 | x0 ^= k[4*i+0]; x1 ^= k[4*i+1]; x2 ^= k[4*i+2]; \ | ||
| 64 | x3 ^= k[4*i+3]; x0 = ror32(x0, 5); x2 = ror32(x2, 22);\ | ||
| 65 | x4 = x1; x2 ^= x3; x0 ^= x3; \ | ||
| 66 | x4 <<= 7; x0 ^= x1; x1 = ror32(x1, 1); \ | ||
| 67 | x2 ^= x4; x3 = ror32(x3, 7); x4 = x0 << 3; \ | ||
| 68 | x1 ^= x0; x3 ^= x4; x0 = ror32(x0, 13);\ | ||
| 69 | x1 ^= x2; x3 ^= x2; x2 = ror32(x2, 3); \ | ||
| 70 | }) | ||
| 71 | |||
| 72 | #define S0(x0, x1, x2, x3, x4) ({ \ | ||
| 73 | x4 = x3; \ | ||
| 74 | x3 |= x0; x0 ^= x4; x4 ^= x2; \ | ||
| 75 | x4 = ~x4; x3 ^= x1; x1 &= x0; \ | ||
| 76 | x1 ^= x4; x2 ^= x0; x0 ^= x3; \ | ||
| 77 | x4 |= x0; x0 ^= x2; x2 &= x1; \ | ||
| 78 | x3 ^= x2; x1 = ~x1; x2 ^= x4; \ | ||
| 79 | x1 ^= x2; \ | ||
| 80 | }) | ||
| 81 | |||
| 82 | #define S1(x0, x1, x2, x3, x4) ({ \ | ||
| 83 | x4 = x1; \ | ||
| 84 | x1 ^= x0; x0 ^= x3; x3 = ~x3; \ | ||
| 85 | x4 &= x1; x0 |= x1; x3 ^= x2; \ | ||
| 86 | x0 ^= x3; x1 ^= x3; x3 ^= x4; \ | ||
| 87 | x1 |= x4; x4 ^= x2; x2 &= x0; \ | ||
| 88 | x2 ^= x1; x1 |= x0; x0 = ~x0; \ | ||
| 89 | x0 ^= x2; x4 ^= x1; \ | ||
| 90 | }) | ||
| 91 | |||
| 92 | #define S2(x0, x1, x2, x3, x4) ({ \ | ||
| 93 | x3 = ~x3; \ | ||
| 94 | x1 ^= x0; x4 = x0; x0 &= x2; \ | ||
| 95 | x0 ^= x3; x3 |= x4; x2 ^= x1; \ | ||
| 96 | x3 ^= x1; x1 &= x0; x0 ^= x2; \ | ||
| 97 | x2 &= x3; x3 |= x1; x0 = ~x0; \ | ||
| 98 | x3 ^= x0; x4 ^= x0; x0 ^= x2; \ | ||
| 99 | x1 |= x2; \ | ||
| 100 | }) | ||
| 101 | |||
| 102 | #define S3(x0, x1, x2, x3, x4) ({ \ | ||
| 103 | x4 = x1; \ | ||
| 104 | x1 ^= x3; x3 |= x0; x4 &= x0; \ | ||
| 105 | x0 ^= x2; x2 ^= x1; x1 &= x3; \ | ||
| 106 | x2 ^= x3; x0 |= x4; x4 ^= x3; \ | ||
| 107 | x1 ^= x0; x0 &= x3; x3 &= x4; \ | ||
| 108 | x3 ^= x2; x4 |= x1; x2 &= x1; \ | ||
| 109 | x4 ^= x3; x0 ^= x3; x3 ^= x2; \ | ||
| 110 | }) | ||
| 111 | |||
| 112 | #define S4(x0, x1, x2, x3, x4) ({ \ | ||
| 113 | x4 = x3; \ | ||
| 114 | x3 &= x0; x0 ^= x4; \ | ||
| 115 | x3 ^= x2; x2 |= x4; x0 ^= x1; \ | ||
| 116 | x4 ^= x3; x2 |= x0; \ | ||
| 117 | x2 ^= x1; x1 &= x0; \ | ||
| 118 | x1 ^= x4; x4 &= x2; x2 ^= x3; \ | ||
| 119 | x4 ^= x0; x3 |= x1; x1 = ~x1; \ | ||
| 120 | x3 ^= x0; \ | ||
| 121 | }) | ||
| 122 | |||
| 123 | #define S5(x0, x1, x2, x3, x4) ({ \ | ||
| 124 | x4 = x1; x1 |= x0; \ | ||
| 125 | x2 ^= x1; x3 = ~x3; x4 ^= x0; \ | ||
| 126 | x0 ^= x2; x1 &= x4; x4 |= x3; \ | ||
| 127 | x4 ^= x0; x0 &= x3; x1 ^= x3; \ | ||
| 128 | x3 ^= x2; x0 ^= x1; x2 &= x4; \ | ||
| 129 | x1 ^= x2; x2 &= x0; \ | ||
| 130 | x3 ^= x2; \ | ||
| 131 | }) | ||
| 132 | |||
| 133 | #define S6(x0, x1, x2, x3, x4) ({ \ | ||
| 134 | x4 = x1; \ | ||
| 135 | x3 ^= x0; x1 ^= x2; x2 ^= x0; \ | ||
| 136 | x0 &= x3; x1 |= x3; x4 = ~x4; \ | ||
| 137 | x0 ^= x1; x1 ^= x2; \ | ||
| 138 | x3 ^= x4; x4 ^= x0; x2 &= x0; \ | ||
| 139 | x4 ^= x1; x2 ^= x3; x3 &= x1; \ | ||
| 140 | x3 ^= x0; x1 ^= x2; \ | ||
| 141 | }) | ||
| 142 | |||
| 143 | #define S7(x0, x1, x2, x3, x4) ({ \ | ||
| 144 | x1 = ~x1; \ | ||
| 145 | x4 = x1; x0 = ~x0; x1 &= x2; \ | ||
| 146 | x1 ^= x3; x3 |= x4; x4 ^= x2; \ | ||
| 147 | x2 ^= x3; x3 ^= x0; x0 |= x1; \ | ||
| 148 | x2 &= x0; x0 ^= x4; x4 ^= x3; \ | ||
| 149 | x3 &= x0; x4 ^= x1; \ | ||
| 150 | x2 ^= x4; x3 ^= x1; x4 |= x0; \ | ||
| 151 | x4 ^= x1; \ | ||
| 152 | }) | ||
| 153 | |||
| 154 | #define SI0(x0, x1, x2, x3, x4) ({ \ | ||
| 155 | x4 = x3; x1 ^= x0; \ | ||
| 156 | x3 |= x1; x4 ^= x1; x0 = ~x0; \ | ||
| 157 | x2 ^= x3; x3 ^= x0; x0 &= x1; \ | ||
| 158 | x0 ^= x2; x2 &= x3; x3 ^= x4; \ | ||
| 159 | x2 ^= x3; x1 ^= x3; x3 &= x0; \ | ||
| 160 | x1 ^= x0; x0 ^= x2; x4 ^= x3; \ | ||
| 161 | }) | ||
| 162 | |||
| 163 | #define SI1(x0, x1, x2, x3, x4) ({ \ | ||
| 164 | x1 ^= x3; x4 = x0; \ | ||
| 165 | x0 ^= x2; x2 = ~x2; x4 |= x1; \ | ||
| 166 | x4 ^= x3; x3 &= x1; x1 ^= x2; \ | ||
| 167 | x2 &= x4; x4 ^= x1; x1 |= x3; \ | ||
| 168 | x3 ^= x0; x2 ^= x0; x0 |= x4; \ | ||
| 169 | x2 ^= x4; x1 ^= x0; \ | ||
| 170 | x4 ^= x1; \ | ||
| 171 | }) | ||
| 172 | |||
| 173 | #define SI2(x0, x1, x2, x3, x4) ({ \ | ||
| 174 | x2 ^= x1; x4 = x3; x3 = ~x3; \ | ||
| 175 | x3 |= x2; x2 ^= x4; x4 ^= x0; \ | ||
| 176 | x3 ^= x1; x1 |= x2; x2 ^= x0; \ | ||
| 177 | x1 ^= x4; x4 |= x3; x2 ^= x3; \ | ||
| 178 | x4 ^= x2; x2 &= x1; \ | ||
| 179 | x2 ^= x3; x3 ^= x4; x4 ^= x0; \ | ||
| 180 | }) | ||
| 181 | |||
| 182 | #define SI3(x0, x1, x2, x3, x4) ({ \ | ||
| 183 | x2 ^= x1; \ | ||
| 184 | x4 = x1; x1 &= x2; \ | ||
| 185 | x1 ^= x0; x0 |= x4; x4 ^= x3; \ | ||
| 186 | x0 ^= x3; x3 |= x1; x1 ^= x2; \ | ||
| 187 | x1 ^= x3; x0 ^= x2; x2 ^= x3; \ | ||
| 188 | x3 &= x1; x1 ^= x0; x0 &= x2; \ | ||
| 189 | x4 ^= x3; x3 ^= x0; x0 ^= x1; \ | ||
| 190 | }) | ||
| 191 | |||
| 192 | #define SI4(x0, x1, x2, x3, x4) ({ \ | ||
| 193 | x2 ^= x3; x4 = x0; x0 &= x1; \ | ||
| 194 | x0 ^= x2; x2 |= x3; x4 = ~x4; \ | ||
| 195 | x1 ^= x0; x0 ^= x2; x2 &= x4; \ | ||
| 196 | x2 ^= x0; x0 |= x4; \ | ||
| 197 | x0 ^= x3; x3 &= x2; \ | ||
| 198 | x4 ^= x3; x3 ^= x1; x1 &= x0; \ | ||
| 199 | x4 ^= x1; x0 ^= x3; \ | ||
| 200 | }) | ||
| 201 | |||
| 202 | #define SI5(x0, x1, x2, x3, x4) ({ \ | ||
| 203 | x4 = x1; x1 |= x2; \ | ||
| 204 | x2 ^= x4; x1 ^= x3; x3 &= x4; \ | ||
| 205 | x2 ^= x3; x3 |= x0; x0 = ~x0; \ | ||
| 206 | x3 ^= x2; x2 |= x0; x4 ^= x1; \ | ||
| 207 | x2 ^= x4; x4 &= x0; x0 ^= x1; \ | ||
| 208 | x1 ^= x3; x0 &= x2; x2 ^= x3; \ | ||
| 209 | x0 ^= x2; x2 ^= x4; x4 ^= x3; \ | ||
| 210 | }) | ||
| 211 | |||
| 212 | #define SI6(x0, x1, x2, x3, x4) ({ \ | ||
| 213 | x0 ^= x2; \ | ||
| 214 | x4 = x0; x0 &= x3; x2 ^= x3; \ | ||
| 215 | x0 ^= x2; x3 ^= x1; x2 |= x4; \ | ||
| 216 | x2 ^= x3; x3 &= x0; x0 = ~x0; \ | ||
| 217 | x3 ^= x1; x1 &= x2; x4 ^= x0; \ | ||
| 218 | x3 ^= x4; x4 ^= x2; x0 ^= x1; \ | ||
| 219 | x2 ^= x0; \ | ||
| 220 | }) | ||
| 221 | |||
| 222 | #define SI7(x0, x1, x2, x3, x4) ({ \ | ||
| 223 | x4 = x3; x3 &= x0; x0 ^= x2; \ | ||
| 224 | x2 |= x4; x4 ^= x1; x0 = ~x0; \ | ||
| 225 | x1 |= x3; x4 ^= x0; x0 &= x2; \ | ||
| 226 | x0 ^= x1; x1 &= x2; x3 ^= x2; \ | ||
| 227 | x4 ^= x3; x2 &= x3; x3 |= x0; \ | ||
| 228 | x1 ^= x4; x3 ^= x4; x4 &= x0; \ | ||
| 229 | x4 ^= x2; \ | ||
| 230 | }) | ||
| 231 | |||
| 232 | int __serpent_setkey(struct serpent_ctx *ctx, const u8 *key, | ||
| 233 | unsigned int keylen) | ||
| 234 | { | ||
| 235 | u32 *k = ctx->expkey; | ||
| 236 | u8 *k8 = (u8 *)k; | ||
| 237 | u32 r0, r1, r2, r3, r4; | ||
| 238 | int i; | ||
| 239 | |||
| 240 | /* Copy key, add padding */ | ||
| 241 | |||
| 242 | for (i = 0; i < keylen; ++i) | ||
| 243 | k8[i] = key[i]; | ||
| 244 | if (i < SERPENT_MAX_KEY_SIZE) | ||
| 245 | k8[i++] = 1; | ||
| 246 | while (i < SERPENT_MAX_KEY_SIZE) | ||
| 247 | k8[i++] = 0; | ||
| 248 | |||
| 249 | /* Expand key using polynomial */ | ||
| 250 | |||
| 251 | r0 = le32_to_cpu(k[3]); | ||
| 252 | r1 = le32_to_cpu(k[4]); | ||
| 253 | r2 = le32_to_cpu(k[5]); | ||
| 254 | r3 = le32_to_cpu(k[6]); | ||
| 255 | r4 = le32_to_cpu(k[7]); | ||
| 256 | |||
| 257 | keyiter(le32_to_cpu(k[0]), r0, r4, r2, 0, 0); | ||
| 258 | keyiter(le32_to_cpu(k[1]), r1, r0, r3, 1, 1); | ||
| 259 | keyiter(le32_to_cpu(k[2]), r2, r1, r4, 2, 2); | ||
| 260 | keyiter(le32_to_cpu(k[3]), r3, r2, r0, 3, 3); | ||
| 261 | keyiter(le32_to_cpu(k[4]), r4, r3, r1, 4, 4); | ||
| 262 | keyiter(le32_to_cpu(k[5]), r0, r4, r2, 5, 5); | ||
| 263 | keyiter(le32_to_cpu(k[6]), r1, r0, r3, 6, 6); | ||
| 264 | keyiter(le32_to_cpu(k[7]), r2, r1, r4, 7, 7); | ||
| 265 | |||
| 266 | keyiter(k[0], r3, r2, r0, 8, 8); | ||
| 267 | keyiter(k[1], r4, r3, r1, 9, 9); | ||
| 268 | keyiter(k[2], r0, r4, r2, 10, 10); | ||
| 269 | keyiter(k[3], r1, r0, r3, 11, 11); | ||
| 270 | keyiter(k[4], r2, r1, r4, 12, 12); | ||
| 271 | keyiter(k[5], r3, r2, r0, 13, 13); | ||
| 272 | keyiter(k[6], r4, r3, r1, 14, 14); | ||
| 273 | keyiter(k[7], r0, r4, r2, 15, 15); | ||
| 274 | keyiter(k[8], r1, r0, r3, 16, 16); | ||
| 275 | keyiter(k[9], r2, r1, r4, 17, 17); | ||
| 276 | keyiter(k[10], r3, r2, r0, 18, 18); | ||
| 277 | keyiter(k[11], r4, r3, r1, 19, 19); | ||
| 278 | keyiter(k[12], r0, r4, r2, 20, 20); | ||
| 279 | keyiter(k[13], r1, r0, r3, 21, 21); | ||
| 280 | keyiter(k[14], r2, r1, r4, 22, 22); | ||
| 281 | keyiter(k[15], r3, r2, r0, 23, 23); | ||
| 282 | keyiter(k[16], r4, r3, r1, 24, 24); | ||
| 283 | keyiter(k[17], r0, r4, r2, 25, 25); | ||
| 284 | keyiter(k[18], r1, r0, r3, 26, 26); | ||
| 285 | keyiter(k[19], r2, r1, r4, 27, 27); | ||
| 286 | keyiter(k[20], r3, r2, r0, 28, 28); | ||
| 287 | keyiter(k[21], r4, r3, r1, 29, 29); | ||
| 288 | keyiter(k[22], r0, r4, r2, 30, 30); | ||
| 289 | keyiter(k[23], r1, r0, r3, 31, 31); | ||
| 290 | |||
| 291 | k += 50; | ||
| 292 | |||
| 293 | keyiter(k[-26], r2, r1, r4, 32, -18); | ||
| 294 | keyiter(k[-25], r3, r2, r0, 33, -17); | ||
| 295 | keyiter(k[-24], r4, r3, r1, 34, -16); | ||
| 296 | keyiter(k[-23], r0, r4, r2, 35, -15); | ||
| 297 | keyiter(k[-22], r1, r0, r3, 36, -14); | ||
| 298 | keyiter(k[-21], r2, r1, r4, 37, -13); | ||
| 299 | keyiter(k[-20], r3, r2, r0, 38, -12); | ||
| 300 | keyiter(k[-19], r4, r3, r1, 39, -11); | ||
| 301 | keyiter(k[-18], r0, r4, r2, 40, -10); | ||
| 302 | keyiter(k[-17], r1, r0, r3, 41, -9); | ||
| 303 | keyiter(k[-16], r2, r1, r4, 42, -8); | ||
| 304 | keyiter(k[-15], r3, r2, r0, 43, -7); | ||
| 305 | keyiter(k[-14], r4, r3, r1, 44, -6); | ||
| 306 | keyiter(k[-13], r0, r4, r2, 45, -5); | ||
| 307 | keyiter(k[-12], r1, r0, r3, 46, -4); | ||
| 308 | keyiter(k[-11], r2, r1, r4, 47, -3); | ||
| 309 | keyiter(k[-10], r3, r2, r0, 48, -2); | ||
| 310 | keyiter(k[-9], r4, r3, r1, 49, -1); | ||
| 311 | keyiter(k[-8], r0, r4, r2, 50, 0); | ||
| 312 | keyiter(k[-7], r1, r0, r3, 51, 1); | ||
| 313 | keyiter(k[-6], r2, r1, r4, 52, 2); | ||
| 314 | keyiter(k[-5], r3, r2, r0, 53, 3); | ||
| 315 | keyiter(k[-4], r4, r3, r1, 54, 4); | ||
| 316 | keyiter(k[-3], r0, r4, r2, 55, 5); | ||
| 317 | keyiter(k[-2], r1, r0, r3, 56, 6); | ||
| 318 | keyiter(k[-1], r2, r1, r4, 57, 7); | ||
| 319 | keyiter(k[0], r3, r2, r0, 58, 8); | ||
| 320 | keyiter(k[1], r4, r3, r1, 59, 9); | ||
| 321 | keyiter(k[2], r0, r4, r2, 60, 10); | ||
| 322 | keyiter(k[3], r1, r0, r3, 61, 11); | ||
| 323 | keyiter(k[4], r2, r1, r4, 62, 12); | ||
| 324 | keyiter(k[5], r3, r2, r0, 63, 13); | ||
| 325 | keyiter(k[6], r4, r3, r1, 64, 14); | ||
| 326 | keyiter(k[7], r0, r4, r2, 65, 15); | ||
| 327 | keyiter(k[8], r1, r0, r3, 66, 16); | ||
| 328 | keyiter(k[9], r2, r1, r4, 67, 17); | ||
| 329 | keyiter(k[10], r3, r2, r0, 68, 18); | ||
| 330 | keyiter(k[11], r4, r3, r1, 69, 19); | ||
| 331 | keyiter(k[12], r0, r4, r2, 70, 20); | ||
| 332 | keyiter(k[13], r1, r0, r3, 71, 21); | ||
| 333 | keyiter(k[14], r2, r1, r4, 72, 22); | ||
| 334 | keyiter(k[15], r3, r2, r0, 73, 23); | ||
| 335 | keyiter(k[16], r4, r3, r1, 74, 24); | ||
| 336 | keyiter(k[17], r0, r4, r2, 75, 25); | ||
| 337 | keyiter(k[18], r1, r0, r3, 76, 26); | ||
| 338 | keyiter(k[19], r2, r1, r4, 77, 27); | ||
| 339 | keyiter(k[20], r3, r2, r0, 78, 28); | ||
| 340 | keyiter(k[21], r4, r3, r1, 79, 29); | ||
| 341 | keyiter(k[22], r0, r4, r2, 80, 30); | ||
| 342 | keyiter(k[23], r1, r0, r3, 81, 31); | ||
| 343 | |||
| 344 | k += 50; | ||
| 345 | |||
| 346 | keyiter(k[-26], r2, r1, r4, 82, -18); | ||
| 347 | keyiter(k[-25], r3, r2, r0, 83, -17); | ||
| 348 | keyiter(k[-24], r4, r3, r1, 84, -16); | ||
| 349 | keyiter(k[-23], r0, r4, r2, 85, -15); | ||
| 350 | keyiter(k[-22], r1, r0, r3, 86, -14); | ||
| 351 | keyiter(k[-21], r2, r1, r4, 87, -13); | ||
| 352 | keyiter(k[-20], r3, r2, r0, 88, -12); | ||
| 353 | keyiter(k[-19], r4, r3, r1, 89, -11); | ||
| 354 | keyiter(k[-18], r0, r4, r2, 90, -10); | ||
| 355 | keyiter(k[-17], r1, r0, r3, 91, -9); | ||
| 356 | keyiter(k[-16], r2, r1, r4, 92, -8); | ||
| 357 | keyiter(k[-15], r3, r2, r0, 93, -7); | ||
| 358 | keyiter(k[-14], r4, r3, r1, 94, -6); | ||
| 359 | keyiter(k[-13], r0, r4, r2, 95, -5); | ||
| 360 | keyiter(k[-12], r1, r0, r3, 96, -4); | ||
| 361 | keyiter(k[-11], r2, r1, r4, 97, -3); | ||
| 362 | keyiter(k[-10], r3, r2, r0, 98, -2); | ||
| 363 | keyiter(k[-9], r4, r3, r1, 99, -1); | ||
| 364 | keyiter(k[-8], r0, r4, r2, 100, 0); | ||
| 365 | keyiter(k[-7], r1, r0, r3, 101, 1); | ||
| 366 | keyiter(k[-6], r2, r1, r4, 102, 2); | ||
| 367 | keyiter(k[-5], r3, r2, r0, 103, 3); | ||
| 368 | keyiter(k[-4], r4, r3, r1, 104, 4); | ||
| 369 | keyiter(k[-3], r0, r4, r2, 105, 5); | ||
| 370 | keyiter(k[-2], r1, r0, r3, 106, 6); | ||
| 371 | keyiter(k[-1], r2, r1, r4, 107, 7); | ||
| 372 | keyiter(k[0], r3, r2, r0, 108, 8); | ||
| 373 | keyiter(k[1], r4, r3, r1, 109, 9); | ||
| 374 | keyiter(k[2], r0, r4, r2, 110, 10); | ||
| 375 | keyiter(k[3], r1, r0, r3, 111, 11); | ||
| 376 | keyiter(k[4], r2, r1, r4, 112, 12); | ||
| 377 | keyiter(k[5], r3, r2, r0, 113, 13); | ||
| 378 | keyiter(k[6], r4, r3, r1, 114, 14); | ||
| 379 | keyiter(k[7], r0, r4, r2, 115, 15); | ||
| 380 | keyiter(k[8], r1, r0, r3, 116, 16); | ||
| 381 | keyiter(k[9], r2, r1, r4, 117, 17); | ||
| 382 | keyiter(k[10], r3, r2, r0, 118, 18); | ||
| 383 | keyiter(k[11], r4, r3, r1, 119, 19); | ||
| 384 | keyiter(k[12], r0, r4, r2, 120, 20); | ||
| 385 | keyiter(k[13], r1, r0, r3, 121, 21); | ||
| 386 | keyiter(k[14], r2, r1, r4, 122, 22); | ||
| 387 | keyiter(k[15], r3, r2, r0, 123, 23); | ||
| 388 | keyiter(k[16], r4, r3, r1, 124, 24); | ||
| 389 | keyiter(k[17], r0, r4, r2, 125, 25); | ||
| 390 | keyiter(k[18], r1, r0, r3, 126, 26); | ||
| 391 | keyiter(k[19], r2, r1, r4, 127, 27); | ||
| 392 | keyiter(k[20], r3, r2, r0, 128, 28); | ||
| 393 | keyiter(k[21], r4, r3, r1, 129, 29); | ||
| 394 | keyiter(k[22], r0, r4, r2, 130, 30); | ||
| 395 | keyiter(k[23], r1, r0, r3, 131, 31); | ||
| 396 | |||
| 397 | /* Apply S-boxes */ | ||
| 398 | |||
| 399 | S3(r3, r4, r0, r1, r2); store_and_load_keys(r1, r2, r4, r3, 28, 24); | ||
| 400 | S4(r1, r2, r4, r3, r0); store_and_load_keys(r2, r4, r3, r0, 24, 20); | ||
| 401 | S5(r2, r4, r3, r0, r1); store_and_load_keys(r1, r2, r4, r0, 20, 16); | ||
| 402 | S6(r1, r2, r4, r0, r3); store_and_load_keys(r4, r3, r2, r0, 16, 12); | ||
| 403 | S7(r4, r3, r2, r0, r1); store_and_load_keys(r1, r2, r0, r4, 12, 8); | ||
| 404 | S0(r1, r2, r0, r4, r3); store_and_load_keys(r0, r2, r4, r1, 8, 4); | ||
| 405 | S1(r0, r2, r4, r1, r3); store_and_load_keys(r3, r4, r1, r0, 4, 0); | ||
| 406 | S2(r3, r4, r1, r0, r2); store_and_load_keys(r2, r4, r3, r0, 0, -4); | ||
| 407 | S3(r2, r4, r3, r0, r1); store_and_load_keys(r0, r1, r4, r2, -4, -8); | ||
| 408 | S4(r0, r1, r4, r2, r3); store_and_load_keys(r1, r4, r2, r3, -8, -12); | ||
| 409 | S5(r1, r4, r2, r3, r0); store_and_load_keys(r0, r1, r4, r3, -12, -16); | ||
| 410 | S6(r0, r1, r4, r3, r2); store_and_load_keys(r4, r2, r1, r3, -16, -20); | ||
| 411 | S7(r4, r2, r1, r3, r0); store_and_load_keys(r0, r1, r3, r4, -20, -24); | ||
| 412 | S0(r0, r1, r3, r4, r2); store_and_load_keys(r3, r1, r4, r0, -24, -28); | ||
| 413 | k -= 50; | ||
| 414 | S1(r3, r1, r4, r0, r2); store_and_load_keys(r2, r4, r0, r3, 22, 18); | ||
| 415 | S2(r2, r4, r0, r3, r1); store_and_load_keys(r1, r4, r2, r3, 18, 14); | ||
| 416 | S3(r1, r4, r2, r3, r0); store_and_load_keys(r3, r0, r4, r1, 14, 10); | ||
| 417 | S4(r3, r0, r4, r1, r2); store_and_load_keys(r0, r4, r1, r2, 10, 6); | ||
| 418 | S5(r0, r4, r1, r2, r3); store_and_load_keys(r3, r0, r4, r2, 6, 2); | ||
| 419 | S6(r3, r0, r4, r2, r1); store_and_load_keys(r4, r1, r0, r2, 2, -2); | ||
| 420 | S7(r4, r1, r0, r2, r3); store_and_load_keys(r3, r0, r2, r4, -2, -6); | ||
| 421 | S0(r3, r0, r2, r4, r1); store_and_load_keys(r2, r0, r4, r3, -6, -10); | ||
| 422 | S1(r2, r0, r4, r3, r1); store_and_load_keys(r1, r4, r3, r2, -10, -14); | ||
| 423 | S2(r1, r4, r3, r2, r0); store_and_load_keys(r0, r4, r1, r2, -14, -18); | ||
| 424 | S3(r0, r4, r1, r2, r3); store_and_load_keys(r2, r3, r4, r0, -18, -22); | ||
| 425 | k -= 50; | ||
| 426 | S4(r2, r3, r4, r0, r1); store_and_load_keys(r3, r4, r0, r1, 28, 24); | ||
| 427 | S5(r3, r4, r0, r1, r2); store_and_load_keys(r2, r3, r4, r1, 24, 20); | ||
| 428 | S6(r2, r3, r4, r1, r0); store_and_load_keys(r4, r0, r3, r1, 20, 16); | ||
| 429 | S7(r4, r0, r3, r1, r2); store_and_load_keys(r2, r3, r1, r4, 16, 12); | ||
| 430 | S0(r2, r3, r1, r4, r0); store_and_load_keys(r1, r3, r4, r2, 12, 8); | ||
| 431 | S1(r1, r3, r4, r2, r0); store_and_load_keys(r0, r4, r2, r1, 8, 4); | ||
| 432 | S2(r0, r4, r2, r1, r3); store_and_load_keys(r3, r4, r0, r1, 4, 0); | ||
| 433 | S3(r3, r4, r0, r1, r2); storekeys(r1, r2, r4, r3, 0); | ||
| 434 | |||
| 435 | return 0; | ||
| 436 | } | ||
| 437 | EXPORT_SYMBOL_GPL(__serpent_setkey); | ||
| 438 | |||
| 439 | int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) | ||
| 440 | { | ||
| 441 | return __serpent_setkey(crypto_tfm_ctx(tfm), key, keylen); | ||
| 442 | } | ||
| 443 | EXPORT_SYMBOL_GPL(serpent_setkey); | ||
| 444 | |||
| 445 | void __serpent_encrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src) | ||
| 446 | { | ||
| 447 | const u32 *k = ctx->expkey; | ||
| 448 | const __le32 *s = (const __le32 *)src; | ||
| 449 | __le32 *d = (__le32 *)dst; | ||
| 450 | u32 r0, r1, r2, r3, r4; | ||
| 451 | |||
| 452 | /* | ||
| 453 | * Note: The conversions between u8* and u32* might cause trouble | ||
| 454 | * on architectures with stricter alignment rules than x86 | ||
| 455 | */ | ||
| 456 | |||
| 457 | r0 = le32_to_cpu(s[0]); | ||
| 458 | r1 = le32_to_cpu(s[1]); | ||
| 459 | r2 = le32_to_cpu(s[2]); | ||
| 460 | r3 = le32_to_cpu(s[3]); | ||
| 461 | |||
| 462 | K(r0, r1, r2, r3, 0); | ||
| 463 | S0(r0, r1, r2, r3, r4); LK(r2, r1, r3, r0, r4, 1); | ||
| 464 | S1(r2, r1, r3, r0, r4); LK(r4, r3, r0, r2, r1, 2); | ||
| 465 | S2(r4, r3, r0, r2, r1); LK(r1, r3, r4, r2, r0, 3); | ||
| 466 | S3(r1, r3, r4, r2, r0); LK(r2, r0, r3, r1, r4, 4); | ||
| 467 | S4(r2, r0, r3, r1, r4); LK(r0, r3, r1, r4, r2, 5); | ||
| 468 | S5(r0, r3, r1, r4, r2); LK(r2, r0, r3, r4, r1, 6); | ||
| 469 | S6(r2, r0, r3, r4, r1); LK(r3, r1, r0, r4, r2, 7); | ||
| 470 | S7(r3, r1, r0, r4, r2); LK(r2, r0, r4, r3, r1, 8); | ||
| 471 | S0(r2, r0, r4, r3, r1); LK(r4, r0, r3, r2, r1, 9); | ||
| 472 | S1(r4, r0, r3, r2, r1); LK(r1, r3, r2, r4, r0, 10); | ||
| 473 | S2(r1, r3, r2, r4, r0); LK(r0, r3, r1, r4, r2, 11); | ||
| 474 | S3(r0, r3, r1, r4, r2); LK(r4, r2, r3, r0, r1, 12); | ||
| 475 | S4(r4, r2, r3, r0, r1); LK(r2, r3, r0, r1, r4, 13); | ||
| 476 | S5(r2, r3, r0, r1, r4); LK(r4, r2, r3, r1, r0, 14); | ||
| 477 | S6(r4, r2, r3, r1, r0); LK(r3, r0, r2, r1, r4, 15); | ||
| 478 | S7(r3, r0, r2, r1, r4); LK(r4, r2, r1, r3, r0, 16); | ||
| 479 | S0(r4, r2, r1, r3, r0); LK(r1, r2, r3, r4, r0, 17); | ||
| 480 | S1(r1, r2, r3, r4, r0); LK(r0, r3, r4, r1, r2, 18); | ||
| 481 | S2(r0, r3, r4, r1, r2); LK(r2, r3, r0, r1, r4, 19); | ||
| 482 | S3(r2, r3, r0, r1, r4); LK(r1, r4, r3, r2, r0, 20); | ||
| 483 | S4(r1, r4, r3, r2, r0); LK(r4, r3, r2, r0, r1, 21); | ||
| 484 | S5(r4, r3, r2, r0, r1); LK(r1, r4, r3, r0, r2, 22); | ||
| 485 | S6(r1, r4, r3, r0, r2); LK(r3, r2, r4, r0, r1, 23); | ||
| 486 | S7(r3, r2, r4, r0, r1); LK(r1, r4, r0, r3, r2, 24); | ||
| 487 | S0(r1, r4, r0, r3, r2); LK(r0, r4, r3, r1, r2, 25); | ||
| 488 | S1(r0, r4, r3, r1, r2); LK(r2, r3, r1, r0, r4, 26); | ||
| 489 | S2(r2, r3, r1, r0, r4); LK(r4, r3, r2, r0, r1, 27); | ||
| 490 | S3(r4, r3, r2, r0, r1); LK(r0, r1, r3, r4, r2, 28); | ||
| 491 | S4(r0, r1, r3, r4, r2); LK(r1, r3, r4, r2, r0, 29); | ||
| 492 | S5(r1, r3, r4, r2, r0); LK(r0, r1, r3, r2, r4, 30); | ||
| 493 | S6(r0, r1, r3, r2, r4); LK(r3, r4, r1, r2, r0, 31); | ||
| 494 | S7(r3, r4, r1, r2, r0); K(r0, r1, r2, r3, 32); | ||
| 495 | |||
| 496 | d[0] = cpu_to_le32(r0); | ||
| 497 | d[1] = cpu_to_le32(r1); | ||
| 498 | d[2] = cpu_to_le32(r2); | ||
| 499 | d[3] = cpu_to_le32(r3); | ||
| 500 | } | ||
| 501 | EXPORT_SYMBOL_GPL(__serpent_encrypt); | ||
| 502 | |||
| 503 | static void serpent_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
| 504 | { | ||
| 505 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 506 | |||
| 507 | __serpent_encrypt(ctx, dst, src); | ||
| 508 | } | ||
| 509 | |||
| 510 | void __serpent_decrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src) | ||
| 511 | { | ||
| 512 | const u32 *k = ctx->expkey; | ||
| 513 | const __le32 *s = (const __le32 *)src; | ||
| 514 | __le32 *d = (__le32 *)dst; | ||
| 515 | u32 r0, r1, r2, r3, r4; | ||
| 516 | |||
| 517 | r0 = le32_to_cpu(s[0]); | ||
| 518 | r1 = le32_to_cpu(s[1]); | ||
| 519 | r2 = le32_to_cpu(s[2]); | ||
| 520 | r3 = le32_to_cpu(s[3]); | ||
| 521 | |||
| 522 | K(r0, r1, r2, r3, 32); | ||
| 523 | SI7(r0, r1, r2, r3, r4); KL(r1, r3, r0, r4, r2, 31); | ||
| 524 | SI6(r1, r3, r0, r4, r2); KL(r0, r2, r4, r1, r3, 30); | ||
| 525 | SI5(r0, r2, r4, r1, r3); KL(r2, r3, r0, r4, r1, 29); | ||
| 526 | SI4(r2, r3, r0, r4, r1); KL(r2, r0, r1, r4, r3, 28); | ||
| 527 | SI3(r2, r0, r1, r4, r3); KL(r1, r2, r3, r4, r0, 27); | ||
| 528 | SI2(r1, r2, r3, r4, r0); KL(r2, r0, r4, r3, r1, 26); | ||
| 529 | SI1(r2, r0, r4, r3, r1); KL(r1, r0, r4, r3, r2, 25); | ||
| 530 | SI0(r1, r0, r4, r3, r2); KL(r4, r2, r0, r1, r3, 24); | ||
| 531 | SI7(r4, r2, r0, r1, r3); KL(r2, r1, r4, r3, r0, 23); | ||
| 532 | SI6(r2, r1, r4, r3, r0); KL(r4, r0, r3, r2, r1, 22); | ||
| 533 | SI5(r4, r0, r3, r2, r1); KL(r0, r1, r4, r3, r2, 21); | ||
| 534 | SI4(r0, r1, r4, r3, r2); KL(r0, r4, r2, r3, r1, 20); | ||
| 535 | SI3(r0, r4, r2, r3, r1); KL(r2, r0, r1, r3, r4, 19); | ||
| 536 | SI2(r2, r0, r1, r3, r4); KL(r0, r4, r3, r1, r2, 18); | ||
| 537 | SI1(r0, r4, r3, r1, r2); KL(r2, r4, r3, r1, r0, 17); | ||
| 538 | SI0(r2, r4, r3, r1, r0); KL(r3, r0, r4, r2, r1, 16); | ||
| 539 | SI7(r3, r0, r4, r2, r1); KL(r0, r2, r3, r1, r4, 15); | ||
| 540 | SI6(r0, r2, r3, r1, r4); KL(r3, r4, r1, r0, r2, 14); | ||
| 541 | SI5(r3, r4, r1, r0, r2); KL(r4, r2, r3, r1, r0, 13); | ||
| 542 | SI4(r4, r2, r3, r1, r0); KL(r4, r3, r0, r1, r2, 12); | ||
| 543 | SI3(r4, r3, r0, r1, r2); KL(r0, r4, r2, r1, r3, 11); | ||
| 544 | SI2(r0, r4, r2, r1, r3); KL(r4, r3, r1, r2, r0, 10); | ||
| 545 | SI1(r4, r3, r1, r2, r0); KL(r0, r3, r1, r2, r4, 9); | ||
| 546 | SI0(r0, r3, r1, r2, r4); KL(r1, r4, r3, r0, r2, 8); | ||
| 547 | SI7(r1, r4, r3, r0, r2); KL(r4, r0, r1, r2, r3, 7); | ||
| 548 | SI6(r4, r0, r1, r2, r3); KL(r1, r3, r2, r4, r0, 6); | ||
| 549 | SI5(r1, r3, r2, r4, r0); KL(r3, r0, r1, r2, r4, 5); | ||
| 550 | SI4(r3, r0, r1, r2, r4); KL(r3, r1, r4, r2, r0, 4); | ||
| 551 | SI3(r3, r1, r4, r2, r0); KL(r4, r3, r0, r2, r1, 3); | ||
| 552 | SI2(r4, r3, r0, r2, r1); KL(r3, r1, r2, r0, r4, 2); | ||
| 553 | SI1(r3, r1, r2, r0, r4); KL(r4, r1, r2, r0, r3, 1); | ||
| 554 | SI0(r4, r1, r2, r0, r3); K(r2, r3, r1, r4, 0); | ||
| 555 | |||
| 556 | d[0] = cpu_to_le32(r2); | ||
| 557 | d[1] = cpu_to_le32(r3); | ||
| 558 | d[2] = cpu_to_le32(r1); | ||
| 559 | d[3] = cpu_to_le32(r4); | ||
| 560 | } | ||
| 561 | EXPORT_SYMBOL_GPL(__serpent_decrypt); | ||
| 562 | |||
| 563 | static void serpent_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
| 564 | { | ||
| 565 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 566 | |||
| 567 | __serpent_decrypt(ctx, dst, src); | ||
| 568 | } | ||
| 569 | |||
| 570 | static struct crypto_alg serpent_alg = { | ||
| 571 | .cra_name = "serpent", | ||
| 572 | .cra_driver_name = "serpent-generic", | ||
| 573 | .cra_priority = 100, | ||
| 574 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
| 575 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 576 | .cra_ctxsize = sizeof(struct serpent_ctx), | ||
| 577 | .cra_alignmask = 3, | ||
| 578 | .cra_module = THIS_MODULE, | ||
| 579 | .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list), | ||
| 580 | .cra_u = { .cipher = { | ||
| 581 | .cia_min_keysize = SERPENT_MIN_KEY_SIZE, | ||
| 582 | .cia_max_keysize = SERPENT_MAX_KEY_SIZE, | ||
| 583 | .cia_setkey = serpent_setkey, | ||
| 584 | .cia_encrypt = serpent_encrypt, | ||
| 585 | .cia_decrypt = serpent_decrypt } } | ||
| 586 | }; | ||
| 587 | |||
| 588 | static int tnepres_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
| 589 | unsigned int keylen) | ||
| 590 | { | ||
| 591 | u8 rev_key[SERPENT_MAX_KEY_SIZE]; | ||
| 592 | int i; | ||
| 593 | |||
| 594 | for (i = 0; i < keylen; ++i) | ||
| 595 | rev_key[keylen - i - 1] = key[i]; | ||
| 596 | |||
| 597 | return serpent_setkey(tfm, rev_key, keylen); | ||
| 598 | } | ||
| 599 | |||
| 600 | static void tnepres_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
| 601 | { | ||
| 602 | const u32 * const s = (const u32 * const)src; | ||
| 603 | u32 * const d = (u32 * const)dst; | ||
| 604 | |||
| 605 | u32 rs[4], rd[4]; | ||
| 606 | |||
| 607 | rs[0] = swab32(s[3]); | ||
| 608 | rs[1] = swab32(s[2]); | ||
| 609 | rs[2] = swab32(s[1]); | ||
| 610 | rs[3] = swab32(s[0]); | ||
| 611 | |||
| 612 | serpent_encrypt(tfm, (u8 *)rd, (u8 *)rs); | ||
| 613 | |||
| 614 | d[0] = swab32(rd[3]); | ||
| 615 | d[1] = swab32(rd[2]); | ||
| 616 | d[2] = swab32(rd[1]); | ||
| 617 | d[3] = swab32(rd[0]); | ||
| 618 | } | ||
| 619 | |||
| 620 | static void tnepres_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
| 621 | { | ||
| 622 | const u32 * const s = (const u32 * const)src; | ||
| 623 | u32 * const d = (u32 * const)dst; | ||
| 624 | |||
| 625 | u32 rs[4], rd[4]; | ||
| 626 | |||
| 627 | rs[0] = swab32(s[3]); | ||
| 628 | rs[1] = swab32(s[2]); | ||
| 629 | rs[2] = swab32(s[1]); | ||
| 630 | rs[3] = swab32(s[0]); | ||
| 631 | |||
| 632 | serpent_decrypt(tfm, (u8 *)rd, (u8 *)rs); | ||
| 633 | |||
| 634 | d[0] = swab32(rd[3]); | ||
| 635 | d[1] = swab32(rd[2]); | ||
| 636 | d[2] = swab32(rd[1]); | ||
| 637 | d[3] = swab32(rd[0]); | ||
| 638 | } | ||
| 639 | |||
| 640 | static struct crypto_alg tnepres_alg = { | ||
| 641 | .cra_name = "tnepres", | ||
| 642 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
| 643 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
| 644 | .cra_ctxsize = sizeof(struct serpent_ctx), | ||
| 645 | .cra_alignmask = 3, | ||
| 646 | .cra_module = THIS_MODULE, | ||
| 647 | .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list), | ||
| 648 | .cra_u = { .cipher = { | ||
| 649 | .cia_min_keysize = SERPENT_MIN_KEY_SIZE, | ||
| 650 | .cia_max_keysize = SERPENT_MAX_KEY_SIZE, | ||
| 651 | .cia_setkey = tnepres_setkey, | ||
| 652 | .cia_encrypt = tnepres_encrypt, | ||
| 653 | .cia_decrypt = tnepres_decrypt } } | ||
| 654 | }; | ||
| 655 | |||
| 656 | static int __init serpent_mod_init(void) | ||
| 657 | { | ||
| 658 | int ret = crypto_register_alg(&serpent_alg); | ||
| 659 | |||
| 660 | if (ret) | ||
| 661 | return ret; | ||
| 662 | |||
| 663 | ret = crypto_register_alg(&tnepres_alg); | ||
| 664 | |||
| 665 | if (ret) | ||
| 666 | crypto_unregister_alg(&serpent_alg); | ||
| 667 | |||
| 668 | return ret; | ||
| 669 | } | ||
| 670 | |||
| 671 | static void __exit serpent_mod_fini(void) | ||
| 672 | { | ||
| 673 | crypto_unregister_alg(&tnepres_alg); | ||
| 674 | crypto_unregister_alg(&serpent_alg); | ||
| 675 | } | ||
| 676 | |||
| 677 | module_init(serpent_mod_init); | ||
| 678 | module_exit(serpent_mod_fini); | ||
| 679 | |||
| 680 | MODULE_LICENSE("GPL"); | ||
| 681 | MODULE_DESCRIPTION("Serpent and tnepres (kerneli compatible serpent reversed) Cipher Algorithm"); | ||
| 682 | MODULE_AUTHOR("Dag Arne Osvik <osvik@ii.uib.no>"); | ||
| 683 | MODULE_ALIAS("tnepres"); | ||
| 684 | MODULE_ALIAS("serpent"); | ||
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 0c4e80f34651..7736a9f05aba 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
| @@ -719,6 +719,207 @@ out: | |||
| 719 | crypto_free_ahash(tfm); | 719 | crypto_free_ahash(tfm); |
| 720 | } | 720 | } |
| 721 | 721 | ||
| 722 | static inline int do_one_acipher_op(struct ablkcipher_request *req, int ret) | ||
| 723 | { | ||
| 724 | if (ret == -EINPROGRESS || ret == -EBUSY) { | ||
| 725 | struct tcrypt_result *tr = req->base.data; | ||
| 726 | |||
| 727 | ret = wait_for_completion_interruptible(&tr->completion); | ||
| 728 | if (!ret) | ||
| 729 | ret = tr->err; | ||
| 730 | INIT_COMPLETION(tr->completion); | ||
| 731 | } | ||
| 732 | |||
| 733 | return ret; | ||
| 734 | } | ||
| 735 | |||
| 736 | static int test_acipher_jiffies(struct ablkcipher_request *req, int enc, | ||
| 737 | int blen, int sec) | ||
| 738 | { | ||
| 739 | unsigned long start, end; | ||
| 740 | int bcount; | ||
| 741 | int ret; | ||
| 742 | |||
| 743 | for (start = jiffies, end = start + sec * HZ, bcount = 0; | ||
| 744 | time_before(jiffies, end); bcount++) { | ||
| 745 | if (enc) | ||
| 746 | ret = do_one_acipher_op(req, | ||
| 747 | crypto_ablkcipher_encrypt(req)); | ||
| 748 | else | ||
| 749 | ret = do_one_acipher_op(req, | ||
| 750 | crypto_ablkcipher_decrypt(req)); | ||
| 751 | |||
| 752 | if (ret) | ||
| 753 | return ret; | ||
| 754 | } | ||
| 755 | |||
| 756 | pr_cont("%d operations in %d seconds (%ld bytes)\n", | ||
| 757 | bcount, sec, (long)bcount * blen); | ||
| 758 | return 0; | ||
| 759 | } | ||
| 760 | |||
| 761 | static int test_acipher_cycles(struct ablkcipher_request *req, int enc, | ||
| 762 | int blen) | ||
| 763 | { | ||
| 764 | unsigned long cycles = 0; | ||
| 765 | int ret = 0; | ||
| 766 | int i; | ||
| 767 | |||
| 768 | /* Warm-up run. */ | ||
| 769 | for (i = 0; i < 4; i++) { | ||
| 770 | if (enc) | ||
| 771 | ret = do_one_acipher_op(req, | ||
| 772 | crypto_ablkcipher_encrypt(req)); | ||
| 773 | else | ||
| 774 | ret = do_one_acipher_op(req, | ||
| 775 | crypto_ablkcipher_decrypt(req)); | ||
| 776 | |||
| 777 | if (ret) | ||
| 778 | goto out; | ||
| 779 | } | ||
| 780 | |||
| 781 | /* The real thing. */ | ||
| 782 | for (i = 0; i < 8; i++) { | ||
| 783 | cycles_t start, end; | ||
| 784 | |||
| 785 | start = get_cycles(); | ||
| 786 | if (enc) | ||
| 787 | ret = do_one_acipher_op(req, | ||
| 788 | crypto_ablkcipher_encrypt(req)); | ||
| 789 | else | ||
| 790 | ret = do_one_acipher_op(req, | ||
| 791 | crypto_ablkcipher_decrypt(req)); | ||
| 792 | end = get_cycles(); | ||
| 793 | |||
| 794 | if (ret) | ||
| 795 | goto out; | ||
| 796 | |||
| 797 | cycles += end - start; | ||
| 798 | } | ||
| 799 | |||
| 800 | out: | ||
| 801 | if (ret == 0) | ||
| 802 | pr_cont("1 operation in %lu cycles (%d bytes)\n", | ||
| 803 | (cycles + 4) / 8, blen); | ||
| 804 | |||
| 805 | return ret; | ||
| 806 | } | ||
| 807 | |||
| 808 | static void test_acipher_speed(const char *algo, int enc, unsigned int sec, | ||
| 809 | struct cipher_speed_template *template, | ||
| 810 | unsigned int tcount, u8 *keysize) | ||
| 811 | { | ||
| 812 | unsigned int ret, i, j, iv_len; | ||
| 813 | struct tcrypt_result tresult; | ||
| 814 | const char *key; | ||
| 815 | char iv[128]; | ||
| 816 | struct ablkcipher_request *req; | ||
| 817 | struct crypto_ablkcipher *tfm; | ||
| 818 | const char *e; | ||
| 819 | u32 *b_size; | ||
| 820 | |||
| 821 | if (enc == ENCRYPT) | ||
| 822 | e = "encryption"; | ||
| 823 | else | ||
| 824 | e = "decryption"; | ||
| 825 | |||
| 826 | pr_info("\ntesting speed of async %s %s\n", algo, e); | ||
| 827 | |||
| 828 | init_completion(&tresult.completion); | ||
| 829 | |||
| 830 | tfm = crypto_alloc_ablkcipher(algo, 0, 0); | ||
| 831 | |||
| 832 | if (IS_ERR(tfm)) { | ||
| 833 | pr_err("failed to load transform for %s: %ld\n", algo, | ||
| 834 | PTR_ERR(tfm)); | ||
| 835 | return; | ||
| 836 | } | ||
| 837 | |||
| 838 | req = ablkcipher_request_alloc(tfm, GFP_KERNEL); | ||
| 839 | if (!req) { | ||
| 840 | pr_err("tcrypt: skcipher: Failed to allocate request for %s\n", | ||
| 841 | algo); | ||
| 842 | goto out; | ||
| 843 | } | ||
| 844 | |||
| 845 | ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, | ||
| 846 | tcrypt_complete, &tresult); | ||
| 847 | |||
| 848 | i = 0; | ||
| 849 | do { | ||
| 850 | b_size = block_sizes; | ||
| 851 | |||
| 852 | do { | ||
| 853 | struct scatterlist sg[TVMEMSIZE]; | ||
| 854 | |||
| 855 | if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) { | ||
| 856 | pr_err("template (%u) too big for " | ||
| 857 | "tvmem (%lu)\n", *keysize + *b_size, | ||
| 858 | TVMEMSIZE * PAGE_SIZE); | ||
| 859 | goto out_free_req; | ||
| 860 | } | ||
| 861 | |||
| 862 | pr_info("test %u (%d bit key, %d byte blocks): ", i, | ||
| 863 | *keysize * 8, *b_size); | ||
| 864 | |||
| 865 | memset(tvmem[0], 0xff, PAGE_SIZE); | ||
| 866 | |||
| 867 | /* set key, plain text and IV */ | ||
| 868 | key = tvmem[0]; | ||
| 869 | for (j = 0; j < tcount; j++) { | ||
| 870 | if (template[j].klen == *keysize) { | ||
| 871 | key = template[j].key; | ||
| 872 | break; | ||
| 873 | } | ||
| 874 | } | ||
| 875 | |||
| 876 | crypto_ablkcipher_clear_flags(tfm, ~0); | ||
| 877 | |||
| 878 | ret = crypto_ablkcipher_setkey(tfm, key, *keysize); | ||
| 879 | if (ret) { | ||
| 880 | pr_err("setkey() failed flags=%x\n", | ||
| 881 | crypto_ablkcipher_get_flags(tfm)); | ||
| 882 | goto out_free_req; | ||
| 883 | } | ||
| 884 | |||
| 885 | sg_init_table(sg, TVMEMSIZE); | ||
| 886 | sg_set_buf(sg, tvmem[0] + *keysize, | ||
| 887 | PAGE_SIZE - *keysize); | ||
| 888 | for (j = 1; j < TVMEMSIZE; j++) { | ||
| 889 | sg_set_buf(sg + j, tvmem[j], PAGE_SIZE); | ||
| 890 | memset(tvmem[j], 0xff, PAGE_SIZE); | ||
| 891 | } | ||
| 892 | |||
| 893 | iv_len = crypto_ablkcipher_ivsize(tfm); | ||
| 894 | if (iv_len) | ||
| 895 | memset(&iv, 0xff, iv_len); | ||
| 896 | |||
| 897 | ablkcipher_request_set_crypt(req, sg, sg, *b_size, iv); | ||
| 898 | |||
| 899 | if (sec) | ||
| 900 | ret = test_acipher_jiffies(req, enc, | ||
| 901 | *b_size, sec); | ||
| 902 | else | ||
| 903 | ret = test_acipher_cycles(req, enc, | ||
| 904 | *b_size); | ||
| 905 | |||
| 906 | if (ret) { | ||
| 907 | pr_err("%s() failed flags=%x\n", e, | ||
| 908 | crypto_ablkcipher_get_flags(tfm)); | ||
| 909 | break; | ||
| 910 | } | ||
| 911 | b_size++; | ||
| 912 | i++; | ||
| 913 | } while (*b_size); | ||
| 914 | keysize++; | ||
| 915 | } while (*keysize); | ||
| 916 | |||
| 917 | out_free_req: | ||
| 918 | ablkcipher_request_free(req); | ||
| 919 | out: | ||
| 920 | crypto_free_ablkcipher(tfm); | ||
| 921 | } | ||
| 922 | |||
| 722 | static void test_available(void) | 923 | static void test_available(void) |
| 723 | { | 924 | { |
| 724 | char **name = check; | 925 | char **name = check; |
| @@ -789,10 +990,16 @@ static int do_test(int m) | |||
| 789 | ret += tcrypt_test("ecb(twofish)"); | 990 | ret += tcrypt_test("ecb(twofish)"); |
| 790 | ret += tcrypt_test("cbc(twofish)"); | 991 | ret += tcrypt_test("cbc(twofish)"); |
| 791 | ret += tcrypt_test("ctr(twofish)"); | 992 | ret += tcrypt_test("ctr(twofish)"); |
| 993 | ret += tcrypt_test("lrw(twofish)"); | ||
| 994 | ret += tcrypt_test("xts(twofish)"); | ||
| 792 | break; | 995 | break; |
| 793 | 996 | ||
| 794 | case 9: | 997 | case 9: |
| 795 | ret += tcrypt_test("ecb(serpent)"); | 998 | ret += tcrypt_test("ecb(serpent)"); |
| 999 | ret += tcrypt_test("cbc(serpent)"); | ||
| 1000 | ret += tcrypt_test("ctr(serpent)"); | ||
| 1001 | ret += tcrypt_test("lrw(serpent)"); | ||
| 1002 | ret += tcrypt_test("xts(serpent)"); | ||
| 796 | break; | 1003 | break; |
| 797 | 1004 | ||
| 798 | case 10: | 1005 | case 10: |
| @@ -1045,6 +1252,14 @@ static int do_test(int m) | |||
| 1045 | speed_template_16_24_32); | 1252 | speed_template_16_24_32); |
| 1046 | test_cipher_speed("ctr(twofish)", DECRYPT, sec, NULL, 0, | 1253 | test_cipher_speed("ctr(twofish)", DECRYPT, sec, NULL, 0, |
| 1047 | speed_template_16_24_32); | 1254 | speed_template_16_24_32); |
| 1255 | test_cipher_speed("lrw(twofish)", ENCRYPT, sec, NULL, 0, | ||
| 1256 | speed_template_32_40_48); | ||
| 1257 | test_cipher_speed("lrw(twofish)", DECRYPT, sec, NULL, 0, | ||
| 1258 | speed_template_32_40_48); | ||
| 1259 | test_cipher_speed("xts(twofish)", ENCRYPT, sec, NULL, 0, | ||
| 1260 | speed_template_32_48_64); | ||
| 1261 | test_cipher_speed("xts(twofish)", DECRYPT, sec, NULL, 0, | ||
| 1262 | speed_template_32_48_64); | ||
| 1048 | break; | 1263 | break; |
| 1049 | 1264 | ||
| 1050 | case 203: | 1265 | case 203: |
| @@ -1089,6 +1304,29 @@ static int do_test(int m) | |||
| 1089 | speed_template_16_32); | 1304 | speed_template_16_32); |
| 1090 | break; | 1305 | break; |
| 1091 | 1306 | ||
| 1307 | case 207: | ||
| 1308 | test_cipher_speed("ecb(serpent)", ENCRYPT, sec, NULL, 0, | ||
| 1309 | speed_template_16_32); | ||
| 1310 | test_cipher_speed("ecb(serpent)", DECRYPT, sec, NULL, 0, | ||
| 1311 | speed_template_16_32); | ||
| 1312 | test_cipher_speed("cbc(serpent)", ENCRYPT, sec, NULL, 0, | ||
| 1313 | speed_template_16_32); | ||
| 1314 | test_cipher_speed("cbc(serpent)", DECRYPT, sec, NULL, 0, | ||
| 1315 | speed_template_16_32); | ||
| 1316 | test_cipher_speed("ctr(serpent)", ENCRYPT, sec, NULL, 0, | ||
| 1317 | speed_template_16_32); | ||
| 1318 | test_cipher_speed("ctr(serpent)", DECRYPT, sec, NULL, 0, | ||
| 1319 | speed_template_16_32); | ||
| 1320 | test_cipher_speed("lrw(serpent)", ENCRYPT, sec, NULL, 0, | ||
| 1321 | speed_template_32_48); | ||
| 1322 | test_cipher_speed("lrw(serpent)", DECRYPT, sec, NULL, 0, | ||
| 1323 | speed_template_32_48); | ||
| 1324 | test_cipher_speed("xts(serpent)", ENCRYPT, sec, NULL, 0, | ||
| 1325 | speed_template_32_64); | ||
| 1326 | test_cipher_speed("xts(serpent)", DECRYPT, sec, NULL, 0, | ||
| 1327 | speed_template_32_64); | ||
| 1328 | break; | ||
| 1329 | |||
| 1092 | case 300: | 1330 | case 300: |
| 1093 | /* fall through */ | 1331 | /* fall through */ |
| 1094 | 1332 | ||
| @@ -1241,6 +1479,78 @@ static int do_test(int m) | |||
| 1241 | case 499: | 1479 | case 499: |
| 1242 | break; | 1480 | break; |
| 1243 | 1481 | ||
| 1482 | case 500: | ||
| 1483 | test_acipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, | ||
| 1484 | speed_template_16_24_32); | ||
| 1485 | test_acipher_speed("ecb(aes)", DECRYPT, sec, NULL, 0, | ||
| 1486 | speed_template_16_24_32); | ||
| 1487 | test_acipher_speed("cbc(aes)", ENCRYPT, sec, NULL, 0, | ||
| 1488 | speed_template_16_24_32); | ||
| 1489 | test_acipher_speed("cbc(aes)", DECRYPT, sec, NULL, 0, | ||
| 1490 | speed_template_16_24_32); | ||
| 1491 | test_acipher_speed("lrw(aes)", ENCRYPT, sec, NULL, 0, | ||
| 1492 | speed_template_32_40_48); | ||
| 1493 | test_acipher_speed("lrw(aes)", DECRYPT, sec, NULL, 0, | ||
| 1494 | speed_template_32_40_48); | ||
| 1495 | test_acipher_speed("xts(aes)", ENCRYPT, sec, NULL, 0, | ||
| 1496 | speed_template_32_48_64); | ||
| 1497 | test_acipher_speed("xts(aes)", DECRYPT, sec, NULL, 0, | ||
| 1498 | speed_template_32_48_64); | ||
| 1499 | test_acipher_speed("ctr(aes)", ENCRYPT, sec, NULL, 0, | ||
| 1500 | speed_template_16_24_32); | ||
| 1501 | test_acipher_speed("ctr(aes)", DECRYPT, sec, NULL, 0, | ||
| 1502 | speed_template_16_24_32); | ||
| 1503 | break; | ||
| 1504 | |||
| 1505 | case 501: | ||
| 1506 | test_acipher_speed("ecb(des3_ede)", ENCRYPT, sec, | ||
| 1507 | des3_speed_template, DES3_SPEED_VECTORS, | ||
| 1508 | speed_template_24); | ||
| 1509 | test_acipher_speed("ecb(des3_ede)", DECRYPT, sec, | ||
| 1510 | des3_speed_template, DES3_SPEED_VECTORS, | ||
| 1511 | speed_template_24); | ||
| 1512 | test_acipher_speed("cbc(des3_ede)", ENCRYPT, sec, | ||
| 1513 | des3_speed_template, DES3_SPEED_VECTORS, | ||
| 1514 | speed_template_24); | ||
| 1515 | test_acipher_speed("cbc(des3_ede)", DECRYPT, sec, | ||
| 1516 | des3_speed_template, DES3_SPEED_VECTORS, | ||
| 1517 | speed_template_24); | ||
| 1518 | break; | ||
| 1519 | |||
| 1520 | case 502: | ||
| 1521 | test_acipher_speed("ecb(des)", ENCRYPT, sec, NULL, 0, | ||
| 1522 | speed_template_8); | ||
| 1523 | test_acipher_speed("ecb(des)", DECRYPT, sec, NULL, 0, | ||
| 1524 | speed_template_8); | ||
| 1525 | test_acipher_speed("cbc(des)", ENCRYPT, sec, NULL, 0, | ||
| 1526 | speed_template_8); | ||
| 1527 | test_acipher_speed("cbc(des)", DECRYPT, sec, NULL, 0, | ||
| 1528 | speed_template_8); | ||
| 1529 | break; | ||
| 1530 | |||
| 1531 | case 503: | ||
| 1532 | test_acipher_speed("ecb(serpent)", ENCRYPT, sec, NULL, 0, | ||
| 1533 | speed_template_16_32); | ||
| 1534 | test_acipher_speed("ecb(serpent)", DECRYPT, sec, NULL, 0, | ||
| 1535 | speed_template_16_32); | ||
| 1536 | test_acipher_speed("cbc(serpent)", ENCRYPT, sec, NULL, 0, | ||
| 1537 | speed_template_16_32); | ||
| 1538 | test_acipher_speed("cbc(serpent)", DECRYPT, sec, NULL, 0, | ||
| 1539 | speed_template_16_32); | ||
| 1540 | test_acipher_speed("ctr(serpent)", ENCRYPT, sec, NULL, 0, | ||
| 1541 | speed_template_16_32); | ||
| 1542 | test_acipher_speed("ctr(serpent)", DECRYPT, sec, NULL, 0, | ||
| 1543 | speed_template_16_32); | ||
| 1544 | test_acipher_speed("lrw(serpent)", ENCRYPT, sec, NULL, 0, | ||
| 1545 | speed_template_32_48); | ||
| 1546 | test_acipher_speed("lrw(serpent)", DECRYPT, sec, NULL, 0, | ||
| 1547 | speed_template_32_48); | ||
| 1548 | test_acipher_speed("xts(serpent)", ENCRYPT, sec, NULL, 0, | ||
| 1549 | speed_template_32_64); | ||
| 1550 | test_acipher_speed("xts(serpent)", DECRYPT, sec, NULL, 0, | ||
| 1551 | speed_template_32_64); | ||
| 1552 | break; | ||
| 1553 | |||
| 1244 | case 1000: | 1554 | case 1000: |
| 1245 | test_available(); | 1555 | test_available(); |
| 1246 | break; | 1556 | break; |
diff --git a/crypto/tcrypt.h b/crypto/tcrypt.h index 10cb925132c9..5be1fc8c1ab3 100644 --- a/crypto/tcrypt.h +++ b/crypto/tcrypt.h | |||
| @@ -51,7 +51,9 @@ static u8 speed_template_8_32[] = {8, 32, 0}; | |||
| 51 | static u8 speed_template_16_32[] = {16, 32, 0}; | 51 | static u8 speed_template_16_32[] = {16, 32, 0}; |
| 52 | static u8 speed_template_16_24_32[] = {16, 24, 32, 0}; | 52 | static u8 speed_template_16_24_32[] = {16, 24, 32, 0}; |
| 53 | static u8 speed_template_32_40_48[] = {32, 40, 48, 0}; | 53 | static u8 speed_template_32_40_48[] = {32, 40, 48, 0}; |
| 54 | static u8 speed_template_32_48[] = {32, 48, 0}; | ||
| 54 | static u8 speed_template_32_48_64[] = {32, 48, 64, 0}; | 55 | static u8 speed_template_32_48_64[] = {32, 48, 64, 0}; |
| 56 | static u8 speed_template_32_64[] = {32, 64, 0}; | ||
| 55 | 57 | ||
| 56 | /* | 58 | /* |
| 57 | * Digest speed tests | 59 | * Digest speed tests |
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index e91c1eb1722a..bb54b882d738 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
| @@ -1534,6 +1534,21 @@ static int alg_test_null(const struct alg_test_desc *desc, | |||
| 1534 | /* Please keep this list sorted by algorithm name. */ | 1534 | /* Please keep this list sorted by algorithm name. */ |
| 1535 | static const struct alg_test_desc alg_test_descs[] = { | 1535 | static const struct alg_test_desc alg_test_descs[] = { |
| 1536 | { | 1536 | { |
| 1537 | .alg = "__cbc-serpent-sse2", | ||
| 1538 | .test = alg_test_null, | ||
| 1539 | .suite = { | ||
| 1540 | .cipher = { | ||
| 1541 | .enc = { | ||
| 1542 | .vecs = NULL, | ||
| 1543 | .count = 0 | ||
| 1544 | }, | ||
| 1545 | .dec = { | ||
| 1546 | .vecs = NULL, | ||
| 1547 | .count = 0 | ||
| 1548 | } | ||
| 1549 | } | ||
| 1550 | } | ||
| 1551 | }, { | ||
| 1537 | .alg = "__driver-cbc-aes-aesni", | 1552 | .alg = "__driver-cbc-aes-aesni", |
| 1538 | .test = alg_test_null, | 1553 | .test = alg_test_null, |
| 1539 | .suite = { | 1554 | .suite = { |
| @@ -1549,6 +1564,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 1549 | } | 1564 | } |
| 1550 | } | 1565 | } |
| 1551 | }, { | 1566 | }, { |
| 1567 | .alg = "__driver-cbc-serpent-sse2", | ||
| 1568 | .test = alg_test_null, | ||
| 1569 | .suite = { | ||
| 1570 | .cipher = { | ||
| 1571 | .enc = { | ||
| 1572 | .vecs = NULL, | ||
| 1573 | .count = 0 | ||
| 1574 | }, | ||
| 1575 | .dec = { | ||
| 1576 | .vecs = NULL, | ||
| 1577 | .count = 0 | ||
| 1578 | } | ||
| 1579 | } | ||
| 1580 | } | ||
| 1581 | }, { | ||
| 1552 | .alg = "__driver-ecb-aes-aesni", | 1582 | .alg = "__driver-ecb-aes-aesni", |
| 1553 | .test = alg_test_null, | 1583 | .test = alg_test_null, |
| 1554 | .suite = { | 1584 | .suite = { |
| @@ -1564,6 +1594,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 1564 | } | 1594 | } |
| 1565 | } | 1595 | } |
| 1566 | }, { | 1596 | }, { |
| 1597 | .alg = "__driver-ecb-serpent-sse2", | ||
| 1598 | .test = alg_test_null, | ||
| 1599 | .suite = { | ||
| 1600 | .cipher = { | ||
| 1601 | .enc = { | ||
| 1602 | .vecs = NULL, | ||
| 1603 | .count = 0 | ||
| 1604 | }, | ||
| 1605 | .dec = { | ||
| 1606 | .vecs = NULL, | ||
| 1607 | .count = 0 | ||
| 1608 | } | ||
| 1609 | } | ||
| 1610 | } | ||
| 1611 | }, { | ||
| 1567 | .alg = "__ghash-pclmulqdqni", | 1612 | .alg = "__ghash-pclmulqdqni", |
| 1568 | .test = alg_test_null, | 1613 | .test = alg_test_null, |
| 1569 | .suite = { | 1614 | .suite = { |
| @@ -1675,6 +1720,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 1675 | } | 1720 | } |
| 1676 | } | 1721 | } |
| 1677 | }, { | 1722 | }, { |
| 1723 | .alg = "cbc(serpent)", | ||
| 1724 | .test = alg_test_skcipher, | ||
| 1725 | .suite = { | ||
| 1726 | .cipher = { | ||
| 1727 | .enc = { | ||
| 1728 | .vecs = serpent_cbc_enc_tv_template, | ||
| 1729 | .count = SERPENT_CBC_ENC_TEST_VECTORS | ||
| 1730 | }, | ||
| 1731 | .dec = { | ||
| 1732 | .vecs = serpent_cbc_dec_tv_template, | ||
| 1733 | .count = SERPENT_CBC_DEC_TEST_VECTORS | ||
| 1734 | } | ||
| 1735 | } | ||
| 1736 | } | ||
| 1737 | }, { | ||
| 1678 | .alg = "cbc(twofish)", | 1738 | .alg = "cbc(twofish)", |
| 1679 | .test = alg_test_skcipher, | 1739 | .test = alg_test_skcipher, |
| 1680 | .suite = { | 1740 | .suite = { |
| @@ -1731,6 +1791,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 1731 | } | 1791 | } |
| 1732 | } | 1792 | } |
| 1733 | }, { | 1793 | }, { |
| 1794 | .alg = "cryptd(__driver-ecb-serpent-sse2)", | ||
| 1795 | .test = alg_test_null, | ||
| 1796 | .suite = { | ||
| 1797 | .cipher = { | ||
| 1798 | .enc = { | ||
| 1799 | .vecs = NULL, | ||
| 1800 | .count = 0 | ||
| 1801 | }, | ||
| 1802 | .dec = { | ||
| 1803 | .vecs = NULL, | ||
| 1804 | .count = 0 | ||
| 1805 | } | ||
| 1806 | } | ||
| 1807 | } | ||
| 1808 | }, { | ||
| 1734 | .alg = "cryptd(__ghash-pclmulqdqni)", | 1809 | .alg = "cryptd(__ghash-pclmulqdqni)", |
| 1735 | .test = alg_test_null, | 1810 | .test = alg_test_null, |
| 1736 | .suite = { | 1811 | .suite = { |
| @@ -1771,6 +1846,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 1771 | } | 1846 | } |
| 1772 | } | 1847 | } |
| 1773 | }, { | 1848 | }, { |
| 1849 | .alg = "ctr(serpent)", | ||
| 1850 | .test = alg_test_skcipher, | ||
| 1851 | .suite = { | ||
| 1852 | .cipher = { | ||
| 1853 | .enc = { | ||
| 1854 | .vecs = serpent_ctr_enc_tv_template, | ||
| 1855 | .count = SERPENT_CTR_ENC_TEST_VECTORS | ||
| 1856 | }, | ||
| 1857 | .dec = { | ||
| 1858 | .vecs = serpent_ctr_dec_tv_template, | ||
| 1859 | .count = SERPENT_CTR_DEC_TEST_VECTORS | ||
| 1860 | } | ||
| 1861 | } | ||
| 1862 | } | ||
| 1863 | }, { | ||
| 1774 | .alg = "ctr(twofish)", | 1864 | .alg = "ctr(twofish)", |
| 1775 | .test = alg_test_skcipher, | 1865 | .test = alg_test_skcipher, |
| 1776 | .suite = { | 1866 | .suite = { |
| @@ -2207,6 +2297,36 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2207 | } | 2297 | } |
| 2208 | } | 2298 | } |
| 2209 | }, { | 2299 | }, { |
| 2300 | .alg = "lrw(serpent)", | ||
| 2301 | .test = alg_test_skcipher, | ||
| 2302 | .suite = { | ||
| 2303 | .cipher = { | ||
| 2304 | .enc = { | ||
| 2305 | .vecs = serpent_lrw_enc_tv_template, | ||
| 2306 | .count = SERPENT_LRW_ENC_TEST_VECTORS | ||
| 2307 | }, | ||
| 2308 | .dec = { | ||
| 2309 | .vecs = serpent_lrw_dec_tv_template, | ||
| 2310 | .count = SERPENT_LRW_DEC_TEST_VECTORS | ||
| 2311 | } | ||
| 2312 | } | ||
| 2313 | } | ||
| 2314 | }, { | ||
| 2315 | .alg = "lrw(twofish)", | ||
| 2316 | .test = alg_test_skcipher, | ||
| 2317 | .suite = { | ||
| 2318 | .cipher = { | ||
| 2319 | .enc = { | ||
| 2320 | .vecs = tf_lrw_enc_tv_template, | ||
| 2321 | .count = TF_LRW_ENC_TEST_VECTORS | ||
| 2322 | }, | ||
| 2323 | .dec = { | ||
| 2324 | .vecs = tf_lrw_dec_tv_template, | ||
| 2325 | .count = TF_LRW_DEC_TEST_VECTORS | ||
| 2326 | } | ||
| 2327 | } | ||
| 2328 | } | ||
| 2329 | }, { | ||
| 2210 | .alg = "lzo", | 2330 | .alg = "lzo", |
| 2211 | .test = alg_test_comp, | 2331 | .test = alg_test_comp, |
| 2212 | .suite = { | 2332 | .suite = { |
| @@ -2514,6 +2634,36 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2514 | } | 2634 | } |
| 2515 | } | 2635 | } |
| 2516 | }, { | 2636 | }, { |
| 2637 | .alg = "xts(serpent)", | ||
| 2638 | .test = alg_test_skcipher, | ||
| 2639 | .suite = { | ||
| 2640 | .cipher = { | ||
| 2641 | .enc = { | ||
| 2642 | .vecs = serpent_xts_enc_tv_template, | ||
| 2643 | .count = SERPENT_XTS_ENC_TEST_VECTORS | ||
| 2644 | }, | ||
| 2645 | .dec = { | ||
| 2646 | .vecs = serpent_xts_dec_tv_template, | ||
| 2647 | .count = SERPENT_XTS_DEC_TEST_VECTORS | ||
| 2648 | } | ||
| 2649 | } | ||
| 2650 | } | ||
| 2651 | }, { | ||
| 2652 | .alg = "xts(twofish)", | ||
| 2653 | .test = alg_test_skcipher, | ||
| 2654 | .suite = { | ||
| 2655 | .cipher = { | ||
| 2656 | .enc = { | ||
| 2657 | .vecs = tf_xts_enc_tv_template, | ||
| 2658 | .count = TF_XTS_ENC_TEST_VECTORS | ||
| 2659 | }, | ||
| 2660 | .dec = { | ||
| 2661 | .vecs = tf_xts_dec_tv_template, | ||
| 2662 | .count = TF_XTS_DEC_TEST_VECTORS | ||
| 2663 | } | ||
| 2664 | } | ||
| 2665 | } | ||
| 2666 | }, { | ||
| 2517 | .alg = "zlib", | 2667 | .alg = "zlib", |
| 2518 | .test = alg_test_pcomp, | 2668 | .test = alg_test_pcomp, |
| 2519 | .suite = { | 2669 | .suite = { |
diff --git a/crypto/testmgr.h b/crypto/testmgr.h index 37b4d8f45447..43e84d32b341 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h | |||
| @@ -2717,6 +2717,10 @@ static struct cipher_testvec bf_ctr_dec_tv_template[] = { | |||
| 2717 | #define TF_CBC_DEC_TEST_VECTORS 5 | 2717 | #define TF_CBC_DEC_TEST_VECTORS 5 |
| 2718 | #define TF_CTR_ENC_TEST_VECTORS 2 | 2718 | #define TF_CTR_ENC_TEST_VECTORS 2 |
| 2719 | #define TF_CTR_DEC_TEST_VECTORS 2 | 2719 | #define TF_CTR_DEC_TEST_VECTORS 2 |
| 2720 | #define TF_LRW_ENC_TEST_VECTORS 8 | ||
| 2721 | #define TF_LRW_DEC_TEST_VECTORS 8 | ||
| 2722 | #define TF_XTS_ENC_TEST_VECTORS 5 | ||
| 2723 | #define TF_XTS_DEC_TEST_VECTORS 5 | ||
| 2720 | 2724 | ||
| 2721 | static struct cipher_testvec tf_enc_tv_template[] = { | 2725 | static struct cipher_testvec tf_enc_tv_template[] = { |
| 2722 | { | 2726 | { |
| @@ -3092,16 +3096,1206 @@ static struct cipher_testvec tf_ctr_dec_tv_template[] = { | |||
| 3092 | }, | 3096 | }, |
| 3093 | }; | 3097 | }; |
| 3094 | 3098 | ||
| 3099 | static struct cipher_testvec tf_lrw_enc_tv_template[] = { | ||
| 3100 | /* Generated from AES-LRW test vectors */ | ||
| 3101 | { | ||
| 3102 | .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" | ||
| 3103 | "\x4c\x26\x84\x14\xb5\x68\x01\x85" | ||
| 3104 | "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03" | ||
| 3105 | "\xee\x5a\x83\x0c\xcc\x09\x4c\x87", | ||
| 3106 | .klen = 32, | ||
| 3107 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3108 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 3109 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3110 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3111 | .ilen = 16, | ||
| 3112 | .result = "\xa1\x6c\x50\x69\x26\xa4\xef\x7b" | ||
| 3113 | "\x7c\xc6\x91\xeb\x72\xdd\x9b\xee", | ||
| 3114 | .rlen = 16, | ||
| 3115 | }, { | ||
| 3116 | .key = "\x59\x70\x47\x14\xf5\x57\x47\x8c" | ||
| 3117 | "\xd7\x79\xe8\x0f\x54\x88\x79\x44" | ||
| 3118 | "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea" | ||
| 3119 | "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf", | ||
| 3120 | .klen = 32, | ||
| 3121 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3122 | "\x00\x00\x00\x00\x00\x00\x00\x02", | ||
| 3123 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3124 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3125 | .ilen = 16, | ||
| 3126 | .result = "\xab\x72\x0a\xad\x3b\x0c\xf0\xc9" | ||
| 3127 | "\x42\x2f\xf1\xae\xf1\x3c\xb1\xbd", | ||
| 3128 | .rlen = 16, | ||
| 3129 | }, { | ||
| 3130 | .key = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50" | ||
| 3131 | "\x30\xfe\x69\xe2\x37\x7f\x98\x47" | ||
| 3132 | "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6" | ||
| 3133 | "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f", | ||
| 3134 | .klen = 32, | ||
| 3135 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3136 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 3137 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3138 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3139 | .ilen = 16, | ||
| 3140 | .result = "\x85\xa7\x56\x67\x08\xfa\x42\xe1" | ||
| 3141 | "\x22\xe6\x82\xfc\xd9\xb4\xd7\xd4", | ||
| 3142 | .rlen = 16, | ||
| 3143 | }, { | ||
| 3144 | .key = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15" | ||
| 3145 | "\x25\x83\xf7\x3c\x1f\x01\x28\x74" | ||
| 3146 | "\xca\xc6\xbc\x35\x4d\x4a\x65\x54" | ||
| 3147 | "\x90\xae\x61\xcf\x7b\xae\xbd\xcc" | ||
| 3148 | "\xad\xe4\x94\xc5\x4a\x29\xae\x70", | ||
| 3149 | .klen = 40, | ||
| 3150 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3151 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 3152 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3153 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3154 | .ilen = 16, | ||
| 3155 | .result = "\xd2\xaf\x69\x35\x24\x1d\x0e\x1c" | ||
| 3156 | "\x84\x8b\x05\xe4\xa2\x2f\x16\xf5", | ||
| 3157 | .rlen = 16, | ||
| 3158 | }, { | ||
| 3159 | .key = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff" | ||
| 3160 | "\xf8\x86\xce\xac\x93\xc5\xad\xc6" | ||
| 3161 | "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd" | ||
| 3162 | "\x52\x13\xb2\xb7\xf0\xff\x11\xd8" | ||
| 3163 | "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f", | ||
| 3164 | .klen = 40, | ||
| 3165 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3166 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 3167 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3168 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3169 | .ilen = 16, | ||
| 3170 | .result = "\x4a\x23\x56\xd7\xff\x90\xd0\x9a" | ||
| 3171 | "\x0d\x7c\x26\xfc\xf0\xf0\xf6\xe4", | ||
| 3172 | .rlen = 16, | ||
| 3173 | }, { | ||
| 3174 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
| 3175 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
| 3176 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
| 3177 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
| 3178 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
| 3179 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
| 3180 | .klen = 48, | ||
| 3181 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3182 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 3183 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3184 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3185 | .ilen = 16, | ||
| 3186 | .result = "\x30\xaf\x26\x05\x9d\x5d\x0a\x58" | ||
| 3187 | "\xe2\xe7\xce\x8a\xb2\x56\x6d\x76", | ||
| 3188 | .rlen = 16, | ||
| 3189 | }, { | ||
| 3190 | .key = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d" | ||
| 3191 | "\xd4\x70\x98\x0b\xc7\x95\x84\xc8" | ||
| 3192 | "\xb2\xfb\x64\xce\x60\x97\x87\x8d" | ||
| 3193 | "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7" | ||
| 3194 | "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4" | ||
| 3195 | "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c", | ||
| 3196 | .klen = 48, | ||
| 3197 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3198 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 3199 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3200 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3201 | .ilen = 16, | ||
| 3202 | .result = "\xdf\xcf\xdc\xd2\xe1\xcf\x86\x75" | ||
| 3203 | "\x17\x66\x5e\x0c\x14\xa1\x3d\x40", | ||
| 3204 | .rlen = 16, | ||
| 3205 | }, { | ||
| 3206 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
| 3207 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
| 3208 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
| 3209 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
| 3210 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
| 3211 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
| 3212 | .klen = 48, | ||
| 3213 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3214 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 3215 | .input = "\x05\x11\xb7\x18\xab\xc6\x2d\xac" | ||
| 3216 | "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c" | ||
| 3217 | "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8" | ||
| 3218 | "\x50\x38\x1f\x71\x49\xb6\x57\xd6" | ||
| 3219 | "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90" | ||
| 3220 | "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6" | ||
| 3221 | "\xad\x1e\x9e\x20\x5f\x38\xbe\x04" | ||
| 3222 | "\xda\x10\x8e\xed\xa2\xa4\x87\xab" | ||
| 3223 | "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c" | ||
| 3224 | "\xc9\xac\x42\x31\x95\x7c\xc9\x04" | ||
| 3225 | "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6" | ||
| 3226 | "\x15\xd7\x3f\x4f\x2f\x66\x69\x03" | ||
| 3227 | "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65" | ||
| 3228 | "\x4c\x96\x12\xed\x7c\x92\x03\x01" | ||
| 3229 | "\x6f\xbc\x35\x93\xac\xf1\x27\xf1" | ||
| 3230 | "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50" | ||
| 3231 | "\x89\xa4\x8e\x66\x44\x85\xcc\xfd" | ||
| 3232 | "\x33\x14\x70\xe3\x96\xb2\xc3\xd3" | ||
| 3233 | "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5" | ||
| 3234 | "\x2d\x64\x75\xdd\xb4\x54\xe6\x74" | ||
| 3235 | "\x8c\xd3\x9d\x9e\x86\xab\x51\x53" | ||
| 3236 | "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40" | ||
| 3237 | "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5" | ||
| 3238 | "\x76\x12\x73\x44\x1a\x56\xd7\x72" | ||
| 3239 | "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda" | ||
| 3240 | "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd" | ||
| 3241 | "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60" | ||
| 3242 | "\x1a\xe2\x70\x85\x58\xc2\x1b\x09" | ||
| 3243 | "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9" | ||
| 3244 | "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8" | ||
| 3245 | "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8" | ||
| 3246 | "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10" | ||
| 3247 | "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1" | ||
| 3248 | "\x90\x3e\x76\x4a\x74\xa4\x21\x2c" | ||
| 3249 | "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e" | ||
| 3250 | "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f" | ||
| 3251 | "\x8d\x23\x31\x74\x84\xeb\x88\x6e" | ||
| 3252 | "\xcc\xb9\xbc\x22\x83\x19\x07\x22" | ||
| 3253 | "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78" | ||
| 3254 | "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5" | ||
| 3255 | "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41" | ||
| 3256 | "\x3c\xce\x8f\x42\x60\x71\xa7\x75" | ||
| 3257 | "\x08\x40\x65\x8a\x82\xbf\xf5\x43" | ||
| 3258 | "\x71\x96\xa9\x4d\x44\x8a\x20\xbe" | ||
| 3259 | "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65" | ||
| 3260 | "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9" | ||
| 3261 | "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4" | ||
| 3262 | "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a" | ||
| 3263 | "\x62\x73\x65\xfd\x46\x63\x25\x3d" | ||
| 3264 | "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf" | ||
| 3265 | "\x24\xf3\xb4\xac\x64\xba\xdf\x4b" | ||
| 3266 | "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7" | ||
| 3267 | "\xc5\x68\x77\x84\x32\x2b\xcc\x85" | ||
| 3268 | "\x74\x96\xf0\x12\x77\x61\xb9\xeb" | ||
| 3269 | "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8" | ||
| 3270 | "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24" | ||
| 3271 | "\xda\x39\x87\x45\xc0\x2b\xbb\x01" | ||
| 3272 | "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce" | ||
| 3273 | "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6" | ||
| 3274 | "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32" | ||
| 3275 | "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45" | ||
| 3276 | "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6" | ||
| 3277 | "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" | ||
| 3278 | "\x21\xc4\xc2\x75\x67\x89\x37\x0a", | ||
| 3279 | .ilen = 512, | ||
| 3280 | .result = "\x30\x38\xeb\xaf\x12\x43\x1a\x89" | ||
| 3281 | "\x62\xa2\x36\xe5\xcf\x77\x1e\xd9" | ||
| 3282 | "\x08\xc3\x0d\xdd\x95\xab\x19\x96" | ||
| 3283 | "\x27\x52\x41\xc3\xca\xfb\xf6\xee" | ||
| 3284 | "\x40\x2d\xdf\xdd\x00\x0c\xb9\x0a" | ||
| 3285 | "\x3a\xf0\xc0\xd1\xda\x63\x9e\x45" | ||
| 3286 | "\x42\xe9\x29\xc0\xb4\x07\xb4\x31" | ||
| 3287 | "\x66\x77\x72\xb5\xb6\xb3\x57\x46" | ||
| 3288 | "\x34\x9a\xfe\x03\xaf\x6b\x36\x07" | ||
| 3289 | "\x63\x8e\xc2\x5d\xa6\x0f\xb6\x7d" | ||
| 3290 | "\xfb\x6d\x82\x51\xb6\x98\xd0\x71" | ||
| 3291 | "\xe7\x10\x7a\xdf\xb2\xbd\xf1\x1d" | ||
| 3292 | "\x72\x2b\x54\x13\xe3\x6d\x79\x37" | ||
| 3293 | "\xa9\x39\x2c\xdf\x21\xab\x87\xd5" | ||
| 3294 | "\xee\xef\x9a\x12\x50\x39\x2e\x1b" | ||
| 3295 | "\x7d\xe6\x6a\x27\x48\xb9\xe7\xac" | ||
| 3296 | "\xaa\xcd\x79\x5f\xf2\xf3\xa0\x08" | ||
| 3297 | "\x6f\x2c\xf4\x0e\xd1\xb8\x89\x25" | ||
| 3298 | "\x31\x9d\xef\xb1\x1d\x27\x55\x04" | ||
| 3299 | "\xc9\x8c\xb7\x68\xdc\xb6\x67\x8a" | ||
| 3300 | "\xdb\xcf\x22\xf2\x3b\x6f\xce\xbb" | ||
| 3301 | "\x26\xbe\x4f\x27\x04\x42\xd1\x44" | ||
| 3302 | "\x4c\x08\xa3\x95\x4c\x7f\x1a\xaf" | ||
| 3303 | "\x1d\x28\x14\xfd\xb1\x1a\x34\x18" | ||
| 3304 | "\xf5\x1e\x28\x69\x95\x6a\x5a\xba" | ||
| 3305 | "\x8e\xb2\x58\x1d\x28\x17\x13\x3d" | ||
| 3306 | "\x38\x7d\x14\x8d\xab\x5d\xf9\xe8" | ||
| 3307 | "\x3c\x0f\x2b\x0d\x2b\x08\xb4\x4b" | ||
| 3308 | "\x6b\x0d\xc8\xa7\x84\xc2\x3a\x1a" | ||
| 3309 | "\xb7\xbd\xda\x92\x29\xb8\x5b\x5a" | ||
| 3310 | "\x63\xa5\x99\x82\x09\x72\x8f\xc6" | ||
| 3311 | "\xa4\x62\x24\x69\x8c\x2d\x26\x00" | ||
| 3312 | "\x99\x83\x91\xd6\xc6\xcf\x57\x67" | ||
| 3313 | "\x38\xea\xf2\xfc\x29\xe0\x73\x39" | ||
| 3314 | "\xf9\x13\x94\x6d\xe2\x58\x28\x75" | ||
| 3315 | "\x3e\xae\x71\x90\x07\x70\x1c\x38" | ||
| 3316 | "\x5b\x4c\x1e\xb5\xa5\x3b\x20\xef" | ||
| 3317 | "\xb1\x4c\x3e\x1a\x72\x62\xbb\x22" | ||
| 3318 | "\x82\x09\xe3\x18\x3f\x4f\x48\xfc" | ||
| 3319 | "\xdd\xac\xfc\xb6\x09\xdb\xd2\x7b" | ||
| 3320 | "\xd6\xb7\x7e\x41\x2f\x14\xf5\x0e" | ||
| 3321 | "\xc3\xac\x4a\xed\xe7\x82\xef\x31" | ||
| 3322 | "\x1f\x1a\x51\x1e\x29\x60\xc8\x98" | ||
| 3323 | "\x93\x51\x1d\x3d\x62\x59\x83\x82" | ||
| 3324 | "\x0c\xf1\xd7\x8d\xac\x33\x44\x81" | ||
| 3325 | "\x3c\x59\xb7\xd4\x5b\x65\x82\xc4" | ||
| 3326 | "\xec\xdc\x24\xfd\x0e\x1a\x79\x94" | ||
| 3327 | "\x34\xb0\x62\xfa\x98\x49\x26\x1f" | ||
| 3328 | "\xf4\x9e\x40\x44\x5b\x1f\xf8\xbe" | ||
| 3329 | "\x36\xff\xc6\xc6\x9d\xf2\xd6\xcc" | ||
| 3330 | "\x63\x93\x29\xb9\x0b\x6d\xd7\x6c" | ||
| 3331 | "\xdb\xf6\x21\x80\xf7\x5a\x37\x15" | ||
| 3332 | "\x0c\xe3\x36\xc8\x74\x75\x20\x91" | ||
| 3333 | "\xdf\x52\x2d\x0c\xe7\x45\xff\x46" | ||
| 3334 | "\xb3\xf4\xec\xc2\xbd\xd3\x37\xb6" | ||
| 3335 | "\x26\xa2\x5d\x7d\x61\xbf\x10\x46" | ||
| 3336 | "\x57\x8d\x05\x96\x70\x0b\xd6\x41" | ||
| 3337 | "\x5c\xe9\xd3\x54\x81\x39\x3a\xdd" | ||
| 3338 | "\x5f\x92\x81\x6e\x35\x03\xd4\x72" | ||
| 3339 | "\x3d\x5a\xe7\xb9\x3b\x0c\x84\x23" | ||
| 3340 | "\x45\x5d\xec\x72\xc1\x52\xef\x2e" | ||
| 3341 | "\x81\x00\xd3\xfe\x4c\x3c\x05\x61" | ||
| 3342 | "\x80\x18\xc4\x6c\x03\xd3\xb7\xba" | ||
| 3343 | "\x11\xd7\xb8\x6e\xea\xe1\x80\x30", | ||
| 3344 | .rlen = 512, | ||
| 3345 | }, | ||
| 3346 | }; | ||
| 3347 | |||
| 3348 | static struct cipher_testvec tf_lrw_dec_tv_template[] = { | ||
| 3349 | /* Generated from AES-LRW test vectors */ | ||
| 3350 | /* same as enc vectors with input and result reversed */ | ||
| 3351 | { | ||
| 3352 | .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" | ||
| 3353 | "\x4c\x26\x84\x14\xb5\x68\x01\x85" | ||
| 3354 | "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03" | ||
| 3355 | "\xee\x5a\x83\x0c\xcc\x09\x4c\x87", | ||
| 3356 | .klen = 32, | ||
| 3357 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3358 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 3359 | .input = "\xa1\x6c\x50\x69\x26\xa4\xef\x7b" | ||
| 3360 | "\x7c\xc6\x91\xeb\x72\xdd\x9b\xee", | ||
| 3361 | .ilen = 16, | ||
| 3362 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3363 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3364 | .rlen = 16, | ||
| 3365 | }, { | ||
| 3366 | .key = "\x59\x70\x47\x14\xf5\x57\x47\x8c" | ||
| 3367 | "\xd7\x79\xe8\x0f\x54\x88\x79\x44" | ||
| 3368 | "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea" | ||
| 3369 | "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf", | ||
| 3370 | .klen = 32, | ||
| 3371 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3372 | "\x00\x00\x00\x00\x00\x00\x00\x02", | ||
| 3373 | .input = "\xab\x72\x0a\xad\x3b\x0c\xf0\xc9" | ||
| 3374 | "\x42\x2f\xf1\xae\xf1\x3c\xb1\xbd", | ||
| 3375 | .ilen = 16, | ||
| 3376 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3377 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3378 | .rlen = 16, | ||
| 3379 | }, { | ||
| 3380 | .key = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50" | ||
| 3381 | "\x30\xfe\x69\xe2\x37\x7f\x98\x47" | ||
| 3382 | "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6" | ||
| 3383 | "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f", | ||
| 3384 | .klen = 32, | ||
| 3385 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3386 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 3387 | .input = "\x85\xa7\x56\x67\x08\xfa\x42\xe1" | ||
| 3388 | "\x22\xe6\x82\xfc\xd9\xb4\xd7\xd4", | ||
| 3389 | .ilen = 16, | ||
| 3390 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3391 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3392 | .rlen = 16, | ||
| 3393 | }, { | ||
| 3394 | .key = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15" | ||
| 3395 | "\x25\x83\xf7\x3c\x1f\x01\x28\x74" | ||
| 3396 | "\xca\xc6\xbc\x35\x4d\x4a\x65\x54" | ||
| 3397 | "\x90\xae\x61\xcf\x7b\xae\xbd\xcc" | ||
| 3398 | "\xad\xe4\x94\xc5\x4a\x29\xae\x70", | ||
| 3399 | .klen = 40, | ||
| 3400 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3401 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 3402 | .input = "\xd2\xaf\x69\x35\x24\x1d\x0e\x1c" | ||
| 3403 | "\x84\x8b\x05\xe4\xa2\x2f\x16\xf5", | ||
| 3404 | .ilen = 16, | ||
| 3405 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3406 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3407 | .rlen = 16, | ||
| 3408 | }, { | ||
| 3409 | .key = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff" | ||
| 3410 | "\xf8\x86\xce\xac\x93\xc5\xad\xc6" | ||
| 3411 | "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd" | ||
| 3412 | "\x52\x13\xb2\xb7\xf0\xff\x11\xd8" | ||
| 3413 | "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f", | ||
| 3414 | .klen = 40, | ||
| 3415 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3416 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 3417 | .input = "\x4a\x23\x56\xd7\xff\x90\xd0\x9a" | ||
| 3418 | "\x0d\x7c\x26\xfc\xf0\xf0\xf6\xe4", | ||
| 3419 | .ilen = 16, | ||
| 3420 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3421 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3422 | .rlen = 16, | ||
| 3423 | }, { | ||
| 3424 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
| 3425 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
| 3426 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
| 3427 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
| 3428 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
| 3429 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
| 3430 | .klen = 48, | ||
| 3431 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3432 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 3433 | .input = "\x30\xaf\x26\x05\x9d\x5d\x0a\x58" | ||
| 3434 | "\xe2\xe7\xce\x8a\xb2\x56\x6d\x76", | ||
| 3435 | .ilen = 16, | ||
| 3436 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3437 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3438 | .rlen = 16, | ||
| 3439 | }, { | ||
| 3440 | .key = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d" | ||
| 3441 | "\xd4\x70\x98\x0b\xc7\x95\x84\xc8" | ||
| 3442 | "\xb2\xfb\x64\xce\x60\x97\x87\x8d" | ||
| 3443 | "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7" | ||
| 3444 | "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4" | ||
| 3445 | "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c", | ||
| 3446 | .klen = 48, | ||
| 3447 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3448 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 3449 | .input = "\xdf\xcf\xdc\xd2\xe1\xcf\x86\x75" | ||
| 3450 | "\x17\x66\x5e\x0c\x14\xa1\x3d\x40", | ||
| 3451 | .ilen = 16, | ||
| 3452 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3453 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 3454 | .rlen = 16, | ||
| 3455 | }, { | ||
| 3456 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
| 3457 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
| 3458 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
| 3459 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
| 3460 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
| 3461 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
| 3462 | .klen = 48, | ||
| 3463 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3464 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 3465 | .input = "\x30\x38\xeb\xaf\x12\x43\x1a\x89" | ||
| 3466 | "\x62\xa2\x36\xe5\xcf\x77\x1e\xd9" | ||
| 3467 | "\x08\xc3\x0d\xdd\x95\xab\x19\x96" | ||
| 3468 | "\x27\x52\x41\xc3\xca\xfb\xf6\xee" | ||
| 3469 | "\x40\x2d\xdf\xdd\x00\x0c\xb9\x0a" | ||
| 3470 | "\x3a\xf0\xc0\xd1\xda\x63\x9e\x45" | ||
| 3471 | "\x42\xe9\x29\xc0\xb4\x07\xb4\x31" | ||
| 3472 | "\x66\x77\x72\xb5\xb6\xb3\x57\x46" | ||
| 3473 | "\x34\x9a\xfe\x03\xaf\x6b\x36\x07" | ||
| 3474 | "\x63\x8e\xc2\x5d\xa6\x0f\xb6\x7d" | ||
| 3475 | "\xfb\x6d\x82\x51\xb6\x98\xd0\x71" | ||
| 3476 | "\xe7\x10\x7a\xdf\xb2\xbd\xf1\x1d" | ||
| 3477 | "\x72\x2b\x54\x13\xe3\x6d\x79\x37" | ||
| 3478 | "\xa9\x39\x2c\xdf\x21\xab\x87\xd5" | ||
| 3479 | "\xee\xef\x9a\x12\x50\x39\x2e\x1b" | ||
| 3480 | "\x7d\xe6\x6a\x27\x48\xb9\xe7\xac" | ||
| 3481 | "\xaa\xcd\x79\x5f\xf2\xf3\xa0\x08" | ||
| 3482 | "\x6f\x2c\xf4\x0e\xd1\xb8\x89\x25" | ||
| 3483 | "\x31\x9d\xef\xb1\x1d\x27\x55\x04" | ||
| 3484 | "\xc9\x8c\xb7\x68\xdc\xb6\x67\x8a" | ||
| 3485 | "\xdb\xcf\x22\xf2\x3b\x6f\xce\xbb" | ||
| 3486 | "\x26\xbe\x4f\x27\x04\x42\xd1\x44" | ||
| 3487 | "\x4c\x08\xa3\x95\x4c\x7f\x1a\xaf" | ||
| 3488 | "\x1d\x28\x14\xfd\xb1\x1a\x34\x18" | ||
| 3489 | "\xf5\x1e\x28\x69\x95\x6a\x5a\xba" | ||
| 3490 | "\x8e\xb2\x58\x1d\x28\x17\x13\x3d" | ||
| 3491 | "\x38\x7d\x14\x8d\xab\x5d\xf9\xe8" | ||
| 3492 | "\x3c\x0f\x2b\x0d\x2b\x08\xb4\x4b" | ||
| 3493 | "\x6b\x0d\xc8\xa7\x84\xc2\x3a\x1a" | ||
| 3494 | "\xb7\xbd\xda\x92\x29\xb8\x5b\x5a" | ||
| 3495 | "\x63\xa5\x99\x82\x09\x72\x8f\xc6" | ||
| 3496 | "\xa4\x62\x24\x69\x8c\x2d\x26\x00" | ||
| 3497 | "\x99\x83\x91\xd6\xc6\xcf\x57\x67" | ||
| 3498 | "\x38\xea\xf2\xfc\x29\xe0\x73\x39" | ||
| 3499 | "\xf9\x13\x94\x6d\xe2\x58\x28\x75" | ||
| 3500 | "\x3e\xae\x71\x90\x07\x70\x1c\x38" | ||
| 3501 | "\x5b\x4c\x1e\xb5\xa5\x3b\x20\xef" | ||
| 3502 | "\xb1\x4c\x3e\x1a\x72\x62\xbb\x22" | ||
| 3503 | "\x82\x09\xe3\x18\x3f\x4f\x48\xfc" | ||
| 3504 | "\xdd\xac\xfc\xb6\x09\xdb\xd2\x7b" | ||
| 3505 | "\xd6\xb7\x7e\x41\x2f\x14\xf5\x0e" | ||
| 3506 | "\xc3\xac\x4a\xed\xe7\x82\xef\x31" | ||
| 3507 | "\x1f\x1a\x51\x1e\x29\x60\xc8\x98" | ||
| 3508 | "\x93\x51\x1d\x3d\x62\x59\x83\x82" | ||
| 3509 | "\x0c\xf1\xd7\x8d\xac\x33\x44\x81" | ||
| 3510 | "\x3c\x59\xb7\xd4\x5b\x65\x82\xc4" | ||
| 3511 | "\xec\xdc\x24\xfd\x0e\x1a\x79\x94" | ||
| 3512 | "\x34\xb0\x62\xfa\x98\x49\x26\x1f" | ||
| 3513 | "\xf4\x9e\x40\x44\x5b\x1f\xf8\xbe" | ||
| 3514 | "\x36\xff\xc6\xc6\x9d\xf2\xd6\xcc" | ||
| 3515 | "\x63\x93\x29\xb9\x0b\x6d\xd7\x6c" | ||
| 3516 | "\xdb\xf6\x21\x80\xf7\x5a\x37\x15" | ||
| 3517 | "\x0c\xe3\x36\xc8\x74\x75\x20\x91" | ||
| 3518 | "\xdf\x52\x2d\x0c\xe7\x45\xff\x46" | ||
| 3519 | "\xb3\xf4\xec\xc2\xbd\xd3\x37\xb6" | ||
| 3520 | "\x26\xa2\x5d\x7d\x61\xbf\x10\x46" | ||
| 3521 | "\x57\x8d\x05\x96\x70\x0b\xd6\x41" | ||
| 3522 | "\x5c\xe9\xd3\x54\x81\x39\x3a\xdd" | ||
| 3523 | "\x5f\x92\x81\x6e\x35\x03\xd4\x72" | ||
| 3524 | "\x3d\x5a\xe7\xb9\x3b\x0c\x84\x23" | ||
| 3525 | "\x45\x5d\xec\x72\xc1\x52\xef\x2e" | ||
| 3526 | "\x81\x00\xd3\xfe\x4c\x3c\x05\x61" | ||
| 3527 | "\x80\x18\xc4\x6c\x03\xd3\xb7\xba" | ||
| 3528 | "\x11\xd7\xb8\x6e\xea\xe1\x80\x30", | ||
| 3529 | .ilen = 512, | ||
| 3530 | .result = "\x05\x11\xb7\x18\xab\xc6\x2d\xac" | ||
| 3531 | "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c" | ||
| 3532 | "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8" | ||
| 3533 | "\x50\x38\x1f\x71\x49\xb6\x57\xd6" | ||
| 3534 | "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90" | ||
| 3535 | "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6" | ||
| 3536 | "\xad\x1e\x9e\x20\x5f\x38\xbe\x04" | ||
| 3537 | "\xda\x10\x8e\xed\xa2\xa4\x87\xab" | ||
| 3538 | "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c" | ||
| 3539 | "\xc9\xac\x42\x31\x95\x7c\xc9\x04" | ||
| 3540 | "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6" | ||
| 3541 | "\x15\xd7\x3f\x4f\x2f\x66\x69\x03" | ||
| 3542 | "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65" | ||
| 3543 | "\x4c\x96\x12\xed\x7c\x92\x03\x01" | ||
| 3544 | "\x6f\xbc\x35\x93\xac\xf1\x27\xf1" | ||
| 3545 | "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50" | ||
| 3546 | "\x89\xa4\x8e\x66\x44\x85\xcc\xfd" | ||
| 3547 | "\x33\x14\x70\xe3\x96\xb2\xc3\xd3" | ||
| 3548 | "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5" | ||
| 3549 | "\x2d\x64\x75\xdd\xb4\x54\xe6\x74" | ||
| 3550 | "\x8c\xd3\x9d\x9e\x86\xab\x51\x53" | ||
| 3551 | "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40" | ||
| 3552 | "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5" | ||
| 3553 | "\x76\x12\x73\x44\x1a\x56\xd7\x72" | ||
| 3554 | "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda" | ||
| 3555 | "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd" | ||
| 3556 | "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60" | ||
| 3557 | "\x1a\xe2\x70\x85\x58\xc2\x1b\x09" | ||
| 3558 | "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9" | ||
| 3559 | "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8" | ||
| 3560 | "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8" | ||
| 3561 | "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10" | ||
| 3562 | "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1" | ||
| 3563 | "\x90\x3e\x76\x4a\x74\xa4\x21\x2c" | ||
| 3564 | "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e" | ||
| 3565 | "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f" | ||
| 3566 | "\x8d\x23\x31\x74\x84\xeb\x88\x6e" | ||
| 3567 | "\xcc\xb9\xbc\x22\x83\x19\x07\x22" | ||
| 3568 | "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78" | ||
| 3569 | "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5" | ||
| 3570 | "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41" | ||
| 3571 | "\x3c\xce\x8f\x42\x60\x71\xa7\x75" | ||
| 3572 | "\x08\x40\x65\x8a\x82\xbf\xf5\x43" | ||
| 3573 | "\x71\x96\xa9\x4d\x44\x8a\x20\xbe" | ||
| 3574 | "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65" | ||
| 3575 | "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9" | ||
| 3576 | "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4" | ||
| 3577 | "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a" | ||
| 3578 | "\x62\x73\x65\xfd\x46\x63\x25\x3d" | ||
| 3579 | "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf" | ||
| 3580 | "\x24\xf3\xb4\xac\x64\xba\xdf\x4b" | ||
| 3581 | "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7" | ||
| 3582 | "\xc5\x68\x77\x84\x32\x2b\xcc\x85" | ||
| 3583 | "\x74\x96\xf0\x12\x77\x61\xb9\xeb" | ||
| 3584 | "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8" | ||
| 3585 | "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24" | ||
| 3586 | "\xda\x39\x87\x45\xc0\x2b\xbb\x01" | ||
| 3587 | "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce" | ||
| 3588 | "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6" | ||
| 3589 | "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32" | ||
| 3590 | "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45" | ||
| 3591 | "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6" | ||
| 3592 | "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" | ||
| 3593 | "\x21\xc4\xc2\x75\x67\x89\x37\x0a", | ||
| 3594 | .rlen = 512, | ||
| 3595 | }, | ||
| 3596 | }; | ||
| 3597 | |||
| 3598 | static struct cipher_testvec tf_xts_enc_tv_template[] = { | ||
| 3599 | /* Generated from AES-XTS test vectors */ | ||
| 3600 | { | ||
| 3601 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3602 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3603 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3604 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3605 | .klen = 32, | ||
| 3606 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3607 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3608 | .input = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3609 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3610 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3611 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3612 | .ilen = 32, | ||
| 3613 | .result = "\x4b\xc9\x44\x4a\x11\xa3\xef\xac" | ||
| 3614 | "\x30\x74\xe4\x44\x52\x77\x97\x43" | ||
| 3615 | "\xa7\x60\xb2\x45\x2e\xf9\x00\x90" | ||
| 3616 | "\x9f\xaa\xfd\x89\x6e\x9d\x4a\xe0", | ||
| 3617 | .rlen = 32, | ||
| 3618 | }, { | ||
| 3619 | .key = "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
| 3620 | "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
| 3621 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
| 3622 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
| 3623 | .klen = 32, | ||
| 3624 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
| 3625 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3626 | .input = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3627 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3628 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3629 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
| 3630 | .ilen = 32, | ||
| 3631 | .result = "\x57\x0e\x8f\xe5\x2a\x35\x61\x4f" | ||
| 3632 | "\x32\xd3\xbd\x36\x05\x15\x44\x2c" | ||
| 3633 | "\x58\x06\xf7\xf8\x00\xa8\xb6\xd5" | ||
| 3634 | "\xc6\x28\x92\xdb\xd8\x34\xa2\xe9", | ||
| 3635 | .rlen = 32, | ||
| 3636 | }, { | ||
| 3637 | .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" | ||
| 3638 | "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" | ||
| 3639 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
| 3640 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
| 3641 | .klen = 32, | ||
| 3642 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
| 3643 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3644 | .input = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3645 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3646 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3647 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
| 3648 | .ilen = 32, | ||
| 3649 | .result = "\x96\x45\x8f\x8d\x7a\x75\xb1\xde" | ||
| 3650 | "\x40\x0c\x89\x56\xf6\x4d\xa7\x07" | ||
| 3651 | "\x38\xbb\x5b\xe9\xcd\x84\xae\xb2" | ||
| 3652 | "\x7b\x6a\x62\xf4\x8c\xb5\x37\xea", | ||
| 3653 | .rlen = 32, | ||
| 3654 | }, { | ||
| 3655 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
| 3656 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
| 3657 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
| 3658 | "\x23\x84\x62\x64\x33\x83\x27\x95", | ||
| 3659 | .klen = 32, | ||
| 3660 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3661 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3662 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 3663 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 3664 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 3665 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 3666 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 3667 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 3668 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3669 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 3670 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 3671 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 3672 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 3673 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 3674 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 3675 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 3676 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 3677 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 3678 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 3679 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 3680 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 3681 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 3682 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 3683 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 3684 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 3685 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 3686 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 3687 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 3688 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 3689 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 3690 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 3691 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 3692 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 3693 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
| 3694 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 3695 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 3696 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 3697 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 3698 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 3699 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 3700 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3701 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 3702 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 3703 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 3704 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 3705 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 3706 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 3707 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 3708 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 3709 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 3710 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 3711 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 3712 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 3713 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 3714 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 3715 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 3716 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 3717 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 3718 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 3719 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 3720 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 3721 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 3722 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 3723 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 3724 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 3725 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
| 3726 | .ilen = 512, | ||
| 3727 | .result = "\xa9\x78\xae\x1e\xea\xa2\x44\x4c" | ||
| 3728 | "\xa2\x7a\x64\x1f\xaf\x46\xc1\xe0" | ||
| 3729 | "\x6c\xb2\xf3\x92\x9a\xd6\x7d\x58" | ||
| 3730 | "\xb8\x2d\xb9\x5d\x58\x07\x66\x50" | ||
| 3731 | "\xea\x35\x35\x8c\xb2\x46\x61\x06" | ||
| 3732 | "\x5d\x65\xfc\x57\x8f\x69\x74\xab" | ||
| 3733 | "\x8a\x06\x69\xb5\x6c\xda\x66\xc7" | ||
| 3734 | "\x52\x90\xbb\x8e\x6d\x8b\xb5\xa2" | ||
| 3735 | "\x78\x1d\xc2\xa9\xc2\x73\x00\xc3" | ||
| 3736 | "\x32\x36\x7c\x97\x6b\x4e\x8a\x50" | ||
| 3737 | "\xe4\x91\x83\x96\x8f\xf4\x94\x1a" | ||
| 3738 | "\xa6\x27\xe1\x33\xcb\x91\xc6\x5f" | ||
| 3739 | "\x94\x75\xbc\xd7\x3e\x3e\x6f\x9e" | ||
| 3740 | "\xa9\x31\x80\x5e\xe5\xdb\xc8\x53" | ||
| 3741 | "\x01\x73\x68\x32\x25\x19\xfa\xfb" | ||
| 3742 | "\xe4\xcf\xb9\x3e\xa2\xa0\x8f\x31" | ||
| 3743 | "\xbf\x54\x06\x93\xa8\xb1\x0f\xb6" | ||
| 3744 | "\x7c\x3c\xde\x6f\x0f\xfb\x0c\x11" | ||
| 3745 | "\x39\x80\x39\x09\x97\x65\xf2\x83" | ||
| 3746 | "\xae\xe6\xa1\x6f\x47\xb8\x49\xde" | ||
| 3747 | "\x99\x36\x20\x7d\x97\x3b\xec\xfa" | ||
| 3748 | "\xb4\x33\x6e\x7a\xc7\x46\x84\x49" | ||
| 3749 | "\x91\xcd\xe1\x57\x0d\xed\x40\x08" | ||
| 3750 | "\x13\xf1\x4e\x3e\xa4\xa4\x5c\xe6" | ||
| 3751 | "\xd2\x0c\x20\x8f\x3e\xdf\x3f\x47" | ||
| 3752 | "\x9a\x2f\xde\x6d\x66\xc9\x99\x4a" | ||
| 3753 | "\x2d\x9e\x9d\x4b\x1a\x27\xa2\x12" | ||
| 3754 | "\x99\xf0\xf8\xb1\xb6\xf6\x57\xc3" | ||
| 3755 | "\xca\x1c\xa3\x8e\xed\x39\x28\xb5" | ||
| 3756 | "\x10\x1b\x4b\x08\x42\x00\x4a\xd3" | ||
| 3757 | "\xad\x5a\xc6\x8e\xc8\xbb\x95\xc4" | ||
| 3758 | "\x4b\xaa\xfe\xd5\x42\xa8\xa3\x6d" | ||
| 3759 | "\x3c\xf3\x34\x91\x2d\xb4\xdd\x20" | ||
| 3760 | "\x0c\x90\x6d\xa3\x9b\x66\x9d\x24" | ||
| 3761 | "\x02\xa6\xa9\x3f\x3f\x58\x5d\x47" | ||
| 3762 | "\x24\x65\x63\x7e\xbd\x8c\xe6\x52" | ||
| 3763 | "\x7d\xef\x33\x53\x63\xec\xaa\x0b" | ||
| 3764 | "\x64\x15\xa9\xa6\x1f\x10\x00\x38" | ||
| 3765 | "\x35\xa8\xe7\xbe\x23\x70\x22\xe0" | ||
| 3766 | "\xd3\xb9\xe6\xfd\xe6\xaa\x03\x50" | ||
| 3767 | "\xf3\x3c\x27\x36\x8b\xcc\xfe\x9c" | ||
| 3768 | "\x9c\xa3\xb3\xe7\x68\x9b\xa2\x71" | ||
| 3769 | "\xe0\x07\xd9\x1f\x68\x1f\xac\x5e" | ||
| 3770 | "\x7a\x74\x85\xa9\x6a\x90\xab\x2c" | ||
| 3771 | "\x38\x51\xbc\x1f\x43\x4a\x56\x1c" | ||
| 3772 | "\xf8\x47\x03\x4e\x67\xa8\x1f\x99" | ||
| 3773 | "\x04\x39\x73\x32\xb2\x86\x79\xe7" | ||
| 3774 | "\x14\x28\x70\xb8\xe2\x7d\x69\x85" | ||
| 3775 | "\xb6\x0f\xc5\xd0\xd0\x01\x5c\xe6" | ||
| 3776 | "\x09\x0f\x75\xf7\xb6\x81\xd2\x11" | ||
| 3777 | "\x20\x9c\xa1\xee\x11\x44\x79\xd0" | ||
| 3778 | "\xb2\x34\x77\xda\x10\x9a\x6f\x6f" | ||
| 3779 | "\xef\x7c\xd9\xdc\x35\xb7\x61\xdd" | ||
| 3780 | "\xf1\xa4\xc6\x1c\xbf\x05\x22\xac" | ||
| 3781 | "\xfe\x2f\x85\x00\x44\xdf\x33\x16" | ||
| 3782 | "\x35\xb6\xa3\xd3\x70\xdf\x69\x35" | ||
| 3783 | "\x6a\xc7\xb4\x99\x45\x27\xc8\x8e" | ||
| 3784 | "\x5a\x14\x30\xd0\x55\x3e\x4f\x64" | ||
| 3785 | "\x0d\x38\xe3\xdf\x8b\xa8\x93\x26" | ||
| 3786 | "\x75\xae\xf6\xb5\x23\x0b\x17\x31" | ||
| 3787 | "\xbf\x27\xb8\xb5\x94\x31\xa7\x8f" | ||
| 3788 | "\x43\xc4\x46\x24\x22\x4f\x8f\x7e" | ||
| 3789 | "\xe5\xf4\x6d\x1e\x0e\x18\x7a\xbb" | ||
| 3790 | "\xa6\x8f\xfb\x49\x49\xd8\x7e\x5a", | ||
| 3791 | .rlen = 512, | ||
| 3792 | }, { | ||
| 3793 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
| 3794 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
| 3795 | "\x62\x49\x77\x57\x24\x70\x93\x69" | ||
| 3796 | "\x99\x59\x57\x49\x66\x96\x76\x27" | ||
| 3797 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
| 3798 | "\x23\x84\x62\x64\x33\x83\x27\x95" | ||
| 3799 | "\x02\x88\x41\x97\x16\x93\x99\x37" | ||
| 3800 | "\x51\x05\x82\x09\x74\x94\x45\x92", | ||
| 3801 | .klen = 64, | ||
| 3802 | .iv = "\xff\x00\x00\x00\x00\x00\x00\x00" | ||
| 3803 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3804 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 3805 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 3806 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 3807 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 3808 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 3809 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 3810 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3811 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 3812 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 3813 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 3814 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 3815 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 3816 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 3817 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 3818 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 3819 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 3820 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 3821 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 3822 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 3823 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 3824 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 3825 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 3826 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 3827 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 3828 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 3829 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 3830 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 3831 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 3832 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 3833 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 3834 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 3835 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
| 3836 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 3837 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 3838 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 3839 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 3840 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 3841 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 3842 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 3843 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 3844 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 3845 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 3846 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 3847 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 3848 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 3849 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 3850 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 3851 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 3852 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 3853 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 3854 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 3855 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 3856 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 3857 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 3858 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 3859 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 3860 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 3861 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 3862 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 3863 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 3864 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 3865 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 3866 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 3867 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
| 3868 | .ilen = 512, | ||
| 3869 | .result = "\xd7\x4b\x93\x7d\x13\xa2\xa2\xe1" | ||
| 3870 | "\x35\x39\x71\x88\x76\x1e\xc9\xea" | ||
| 3871 | "\x86\xad\xf3\x14\x48\x3d\x5e\xe9" | ||
| 3872 | "\xe9\x2d\xb2\x56\x59\x35\x9d\xec" | ||
| 3873 | "\x84\xfa\x7e\x9d\x6d\x33\x36\x8f" | ||
| 3874 | "\xce\xf4\xa9\x21\x0b\x5f\x96\xec" | ||
| 3875 | "\xcb\xf9\x57\x68\x33\x88\x39\xbf" | ||
| 3876 | "\x2f\xbb\x59\x03\xbd\x66\x8b\x11" | ||
| 3877 | "\x11\x65\x51\x2e\xb8\x67\x05\xd1" | ||
| 3878 | "\x27\x11\x5c\xd4\xcc\x97\xc2\xb3" | ||
| 3879 | "\xa9\x55\xaf\x07\x56\xd1\xdc\xf5" | ||
| 3880 | "\x85\xdc\x46\xe6\xf0\x24\xeb\x93" | ||
| 3881 | "\x4d\xf0\x9b\xf5\x73\x1c\xda\x03" | ||
| 3882 | "\x22\xc8\x3a\x4f\xb4\x19\x91\x09" | ||
| 3883 | "\x54\x0b\xf6\xfe\x17\x3d\x1a\x53" | ||
| 3884 | "\x72\x60\x79\xcb\x0e\x32\x8a\x77" | ||
| 3885 | "\xd5\xed\xdb\x33\xd7\x62\x16\x69" | ||
| 3886 | "\x63\xe0\xab\xb5\xf6\x9c\x5f\x3d" | ||
| 3887 | "\x69\x35\x61\x86\xf8\x86\xb9\x89" | ||
| 3888 | "\x6e\x59\x35\xac\xf6\x6b\x33\xa0" | ||
| 3889 | "\xea\xef\x96\x62\xd8\xa9\xcf\x56" | ||
| 3890 | "\xbf\xdb\x8a\xfd\xa1\x82\x77\x73" | ||
| 3891 | "\x3d\x94\x4a\x49\x42\x6d\x08\x60" | ||
| 3892 | "\xa1\xea\xab\xb6\x88\x13\x94\xb8" | ||
| 3893 | "\x51\x98\xdb\x35\x85\xdf\xf6\xb9" | ||
| 3894 | "\x8f\xcd\xdf\x80\xd3\x40\x2d\x72" | ||
| 3895 | "\xb8\xb2\x6c\x02\x43\x35\x22\x2a" | ||
| 3896 | "\x31\xed\xcd\x16\x19\xdf\x62\x0f" | ||
| 3897 | "\x29\xcf\x87\x04\xec\x02\x4f\xe4" | ||
| 3898 | "\xa2\xed\x73\xc6\x69\xd3\x7e\x89" | ||
| 3899 | "\x0b\x76\x10\x7c\xd6\xf9\x6a\x25" | ||
| 3900 | "\xed\xcc\x60\x5d\x61\x20\xc1\x97" | ||
| 3901 | "\x56\x91\x57\x28\xbe\x71\x0d\xcd" | ||
| 3902 | "\xde\xc4\x9e\x55\x91\xbe\xd1\x28" | ||
| 3903 | "\x9b\x90\xeb\x73\xf3\x68\x51\xc6" | ||
| 3904 | "\xdf\x82\xcc\xd8\x1f\xce\x5b\x27" | ||
| 3905 | "\xc0\x60\x5e\x33\xd6\xa7\x20\xea" | ||
| 3906 | "\xb2\x54\xc7\x5d\x6a\x3b\x67\x47" | ||
| 3907 | "\xcf\xa0\xe3\xab\x86\xaf\xc1\x42" | ||
| 3908 | "\xe6\xb0\x23\x4a\xaf\x53\xdf\xa0" | ||
| 3909 | "\xad\x12\x32\x31\x03\xf7\x21\xbe" | ||
| 3910 | "\x2d\xd5\x82\x42\xb6\x4a\x3d\xcd" | ||
| 3911 | "\xd8\x81\x77\xa9\x49\x98\x6c\x09" | ||
| 3912 | "\xc5\xa3\x61\x12\x62\x85\x6b\xcd" | ||
| 3913 | "\xb3\xf4\x20\x0c\x41\xc4\x05\x37" | ||
| 3914 | "\x46\x5f\xeb\x71\x8b\xf1\xaf\x6e" | ||
| 3915 | "\xba\xf3\x50\x2e\xfe\xa8\x37\xeb" | ||
| 3916 | "\xe8\x8c\x4f\xa4\x0c\xf1\x31\xc8" | ||
| 3917 | "\x6e\x71\x4f\xa5\xd7\x97\x73\xe0" | ||
| 3918 | "\x93\x4a\x2f\xda\x7b\xe0\x20\x54" | ||
| 3919 | "\x1f\x8d\x85\x79\x0b\x7b\x5e\x75" | ||
| 3920 | "\xb9\x07\x67\xcc\xc8\xe7\x21\x15" | ||
| 3921 | "\xa7\xc8\x98\xff\x4b\x80\x1c\x12" | ||
| 3922 | "\xa8\x54\xe1\x38\x52\xe6\x74\x81" | ||
| 3923 | "\x97\x47\xa1\x41\x0e\xc0\x50\xe3" | ||
| 3924 | "\x55\x0e\xc3\xa7\x70\x77\xce\x07" | ||
| 3925 | "\xed\x8c\x88\xe6\xa1\x5b\x14\xec" | ||
| 3926 | "\xe6\xde\x06\x6d\x74\xc5\xd9\xfa" | ||
| 3927 | "\xe5\x2f\x5a\xff\xc8\x05\xee\x27" | ||
| 3928 | "\x35\x61\xbf\x0b\x19\x78\x9b\xd2" | ||
| 3929 | "\x04\xc7\x05\xb1\x79\xb4\xff\x5f" | ||
| 3930 | "\xf3\xea\x67\x52\x78\xc2\xce\x70" | ||
| 3931 | "\xa4\x05\x0b\xb2\xb3\xa8\x30\x97" | ||
| 3932 | "\x37\x30\xe1\x91\x8d\xb3\x2a\xff", | ||
| 3933 | .rlen = 512, | ||
| 3934 | }, | ||
| 3935 | }; | ||
| 3936 | |||
| 3937 | static struct cipher_testvec tf_xts_dec_tv_template[] = { | ||
| 3938 | /* Generated from AES-XTS test vectors */ | ||
| 3939 | /* same as enc vectors with input and result reversed */ | ||
| 3940 | { | ||
| 3941 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3942 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3943 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3944 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3945 | .klen = 32, | ||
| 3946 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3947 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3948 | .input = "\x4b\xc9\x44\x4a\x11\xa3\xef\xac" | ||
| 3949 | "\x30\x74\xe4\x44\x52\x77\x97\x43" | ||
| 3950 | "\xa7\x60\xb2\x45\x2e\xf9\x00\x90" | ||
| 3951 | "\x9f\xaa\xfd\x89\x6e\x9d\x4a\xe0", | ||
| 3952 | .ilen = 32, | ||
| 3953 | .result = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3954 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3955 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 3956 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3957 | .rlen = 32, | ||
| 3958 | }, { | ||
| 3959 | .key = "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
| 3960 | "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
| 3961 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
| 3962 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
| 3963 | .klen = 32, | ||
| 3964 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
| 3965 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3966 | .input = "\x57\x0e\x8f\xe5\x2a\x35\x61\x4f" | ||
| 3967 | "\x32\xd3\xbd\x36\x05\x15\x44\x2c" | ||
| 3968 | "\x58\x06\xf7\xf8\x00\xa8\xb6\xd5" | ||
| 3969 | "\xc6\x28\x92\xdb\xd8\x34\xa2\xe9", | ||
| 3970 | .ilen = 32, | ||
| 3971 | .result = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3972 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3973 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3974 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
| 3975 | .rlen = 32, | ||
| 3976 | }, { | ||
| 3977 | .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" | ||
| 3978 | "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" | ||
| 3979 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
| 3980 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
| 3981 | .klen = 32, | ||
| 3982 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
| 3983 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 3984 | .input = "\x96\x45\x8f\x8d\x7a\x75\xb1\xde" | ||
| 3985 | "\x40\x0c\x89\x56\xf6\x4d\xa7\x07" | ||
| 3986 | "\x38\xbb\x5b\xe9\xcd\x84\xae\xb2" | ||
| 3987 | "\x7b\x6a\x62\xf4\x8c\xb5\x37\xea", | ||
| 3988 | .ilen = 32, | ||
| 3989 | .result = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3990 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3991 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 3992 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
| 3993 | .rlen = 32, | ||
| 3994 | }, { | ||
| 3995 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
| 3996 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
| 3997 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
| 3998 | "\x23\x84\x62\x64\x33\x83\x27\x95", | ||
| 3999 | .klen = 32, | ||
| 4000 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 4001 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 4002 | .input = "\xa9\x78\xae\x1e\xea\xa2\x44\x4c" | ||
| 4003 | "\xa2\x7a\x64\x1f\xaf\x46\xc1\xe0" | ||
| 4004 | "\x6c\xb2\xf3\x92\x9a\xd6\x7d\x58" | ||
| 4005 | "\xb8\x2d\xb9\x5d\x58\x07\x66\x50" | ||
| 4006 | "\xea\x35\x35\x8c\xb2\x46\x61\x06" | ||
| 4007 | "\x5d\x65\xfc\x57\x8f\x69\x74\xab" | ||
| 4008 | "\x8a\x06\x69\xb5\x6c\xda\x66\xc7" | ||
| 4009 | "\x52\x90\xbb\x8e\x6d\x8b\xb5\xa2" | ||
| 4010 | "\x78\x1d\xc2\xa9\xc2\x73\x00\xc3" | ||
| 4011 | "\x32\x36\x7c\x97\x6b\x4e\x8a\x50" | ||
| 4012 | "\xe4\x91\x83\x96\x8f\xf4\x94\x1a" | ||
| 4013 | "\xa6\x27\xe1\x33\xcb\x91\xc6\x5f" | ||
| 4014 | "\x94\x75\xbc\xd7\x3e\x3e\x6f\x9e" | ||
| 4015 | "\xa9\x31\x80\x5e\xe5\xdb\xc8\x53" | ||
| 4016 | "\x01\x73\x68\x32\x25\x19\xfa\xfb" | ||
| 4017 | "\xe4\xcf\xb9\x3e\xa2\xa0\x8f\x31" | ||
| 4018 | "\xbf\x54\x06\x93\xa8\xb1\x0f\xb6" | ||
| 4019 | "\x7c\x3c\xde\x6f\x0f\xfb\x0c\x11" | ||
| 4020 | "\x39\x80\x39\x09\x97\x65\xf2\x83" | ||
| 4021 | "\xae\xe6\xa1\x6f\x47\xb8\x49\xde" | ||
| 4022 | "\x99\x36\x20\x7d\x97\x3b\xec\xfa" | ||
| 4023 | "\xb4\x33\x6e\x7a\xc7\x46\x84\x49" | ||
| 4024 | "\x91\xcd\xe1\x57\x0d\xed\x40\x08" | ||
| 4025 | "\x13\xf1\x4e\x3e\xa4\xa4\x5c\xe6" | ||
| 4026 | "\xd2\x0c\x20\x8f\x3e\xdf\x3f\x47" | ||
| 4027 | "\x9a\x2f\xde\x6d\x66\xc9\x99\x4a" | ||
| 4028 | "\x2d\x9e\x9d\x4b\x1a\x27\xa2\x12" | ||
| 4029 | "\x99\xf0\xf8\xb1\xb6\xf6\x57\xc3" | ||
| 4030 | "\xca\x1c\xa3\x8e\xed\x39\x28\xb5" | ||
| 4031 | "\x10\x1b\x4b\x08\x42\x00\x4a\xd3" | ||
| 4032 | "\xad\x5a\xc6\x8e\xc8\xbb\x95\xc4" | ||
| 4033 | "\x4b\xaa\xfe\xd5\x42\xa8\xa3\x6d" | ||
| 4034 | "\x3c\xf3\x34\x91\x2d\xb4\xdd\x20" | ||
| 4035 | "\x0c\x90\x6d\xa3\x9b\x66\x9d\x24" | ||
| 4036 | "\x02\xa6\xa9\x3f\x3f\x58\x5d\x47" | ||
| 4037 | "\x24\x65\x63\x7e\xbd\x8c\xe6\x52" | ||
| 4038 | "\x7d\xef\x33\x53\x63\xec\xaa\x0b" | ||
| 4039 | "\x64\x15\xa9\xa6\x1f\x10\x00\x38" | ||
| 4040 | "\x35\xa8\xe7\xbe\x23\x70\x22\xe0" | ||
| 4041 | "\xd3\xb9\xe6\xfd\xe6\xaa\x03\x50" | ||
| 4042 | "\xf3\x3c\x27\x36\x8b\xcc\xfe\x9c" | ||
| 4043 | "\x9c\xa3\xb3\xe7\x68\x9b\xa2\x71" | ||
| 4044 | "\xe0\x07\xd9\x1f\x68\x1f\xac\x5e" | ||
| 4045 | "\x7a\x74\x85\xa9\x6a\x90\xab\x2c" | ||
| 4046 | "\x38\x51\xbc\x1f\x43\x4a\x56\x1c" | ||
| 4047 | "\xf8\x47\x03\x4e\x67\xa8\x1f\x99" | ||
| 4048 | "\x04\x39\x73\x32\xb2\x86\x79\xe7" | ||
| 4049 | "\x14\x28\x70\xb8\xe2\x7d\x69\x85" | ||
| 4050 | "\xb6\x0f\xc5\xd0\xd0\x01\x5c\xe6" | ||
| 4051 | "\x09\x0f\x75\xf7\xb6\x81\xd2\x11" | ||
| 4052 | "\x20\x9c\xa1\xee\x11\x44\x79\xd0" | ||
| 4053 | "\xb2\x34\x77\xda\x10\x9a\x6f\x6f" | ||
| 4054 | "\xef\x7c\xd9\xdc\x35\xb7\x61\xdd" | ||
| 4055 | "\xf1\xa4\xc6\x1c\xbf\x05\x22\xac" | ||
| 4056 | "\xfe\x2f\x85\x00\x44\xdf\x33\x16" | ||
| 4057 | "\x35\xb6\xa3\xd3\x70\xdf\x69\x35" | ||
| 4058 | "\x6a\xc7\xb4\x99\x45\x27\xc8\x8e" | ||
| 4059 | "\x5a\x14\x30\xd0\x55\x3e\x4f\x64" | ||
| 4060 | "\x0d\x38\xe3\xdf\x8b\xa8\x93\x26" | ||
| 4061 | "\x75\xae\xf6\xb5\x23\x0b\x17\x31" | ||
| 4062 | "\xbf\x27\xb8\xb5\x94\x31\xa7\x8f" | ||
| 4063 | "\x43\xc4\x46\x24\x22\x4f\x8f\x7e" | ||
| 4064 | "\xe5\xf4\x6d\x1e\x0e\x18\x7a\xbb" | ||
| 4065 | "\xa6\x8f\xfb\x49\x49\xd8\x7e\x5a", | ||
| 4066 | .ilen = 512, | ||
| 4067 | .result = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 4068 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 4069 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 4070 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 4071 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 4072 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 4073 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 4074 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 4075 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 4076 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 4077 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 4078 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 4079 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 4080 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 4081 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 4082 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 4083 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 4084 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 4085 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 4086 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 4087 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 4088 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 4089 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 4090 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 4091 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 4092 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 4093 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 4094 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 4095 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 4096 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 4097 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 4098 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
| 4099 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 4100 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 4101 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 4102 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 4103 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 4104 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 4105 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 4106 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 4107 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 4108 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 4109 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 4110 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 4111 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 4112 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 4113 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 4114 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 4115 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 4116 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 4117 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 4118 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 4119 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 4120 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 4121 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 4122 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 4123 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 4124 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 4125 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 4126 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 4127 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 4128 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 4129 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 4130 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
| 4131 | .rlen = 512, | ||
| 4132 | }, { | ||
| 4133 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
| 4134 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
| 4135 | "\x62\x49\x77\x57\x24\x70\x93\x69" | ||
| 4136 | "\x99\x59\x57\x49\x66\x96\x76\x27" | ||
| 4137 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
| 4138 | "\x23\x84\x62\x64\x33\x83\x27\x95" | ||
| 4139 | "\x02\x88\x41\x97\x16\x93\x99\x37" | ||
| 4140 | "\x51\x05\x82\x09\x74\x94\x45\x92", | ||
| 4141 | .klen = 64, | ||
| 4142 | .iv = "\xff\x00\x00\x00\x00\x00\x00\x00" | ||
| 4143 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 4144 | .input = "\xd7\x4b\x93\x7d\x13\xa2\xa2\xe1" | ||
| 4145 | "\x35\x39\x71\x88\x76\x1e\xc9\xea" | ||
| 4146 | "\x86\xad\xf3\x14\x48\x3d\x5e\xe9" | ||
| 4147 | "\xe9\x2d\xb2\x56\x59\x35\x9d\xec" | ||
| 4148 | "\x84\xfa\x7e\x9d\x6d\x33\x36\x8f" | ||
| 4149 | "\xce\xf4\xa9\x21\x0b\x5f\x96\xec" | ||
| 4150 | "\xcb\xf9\x57\x68\x33\x88\x39\xbf" | ||
| 4151 | "\x2f\xbb\x59\x03\xbd\x66\x8b\x11" | ||
| 4152 | "\x11\x65\x51\x2e\xb8\x67\x05\xd1" | ||
| 4153 | "\x27\x11\x5c\xd4\xcc\x97\xc2\xb3" | ||
| 4154 | "\xa9\x55\xaf\x07\x56\xd1\xdc\xf5" | ||
| 4155 | "\x85\xdc\x46\xe6\xf0\x24\xeb\x93" | ||
| 4156 | "\x4d\xf0\x9b\xf5\x73\x1c\xda\x03" | ||
| 4157 | "\x22\xc8\x3a\x4f\xb4\x19\x91\x09" | ||
| 4158 | "\x54\x0b\xf6\xfe\x17\x3d\x1a\x53" | ||
| 4159 | "\x72\x60\x79\xcb\x0e\x32\x8a\x77" | ||
| 4160 | "\xd5\xed\xdb\x33\xd7\x62\x16\x69" | ||
| 4161 | "\x63\xe0\xab\xb5\xf6\x9c\x5f\x3d" | ||
| 4162 | "\x69\x35\x61\x86\xf8\x86\xb9\x89" | ||
| 4163 | "\x6e\x59\x35\xac\xf6\x6b\x33\xa0" | ||
| 4164 | "\xea\xef\x96\x62\xd8\xa9\xcf\x56" | ||
| 4165 | "\xbf\xdb\x8a\xfd\xa1\x82\x77\x73" | ||
| 4166 | "\x3d\x94\x4a\x49\x42\x6d\x08\x60" | ||
| 4167 | "\xa1\xea\xab\xb6\x88\x13\x94\xb8" | ||
| 4168 | "\x51\x98\xdb\x35\x85\xdf\xf6\xb9" | ||
| 4169 | "\x8f\xcd\xdf\x80\xd3\x40\x2d\x72" | ||
| 4170 | "\xb8\xb2\x6c\x02\x43\x35\x22\x2a" | ||
| 4171 | "\x31\xed\xcd\x16\x19\xdf\x62\x0f" | ||
| 4172 | "\x29\xcf\x87\x04\xec\x02\x4f\xe4" | ||
| 4173 | "\xa2\xed\x73\xc6\x69\xd3\x7e\x89" | ||
| 4174 | "\x0b\x76\x10\x7c\xd6\xf9\x6a\x25" | ||
| 4175 | "\xed\xcc\x60\x5d\x61\x20\xc1\x97" | ||
| 4176 | "\x56\x91\x57\x28\xbe\x71\x0d\xcd" | ||
| 4177 | "\xde\xc4\x9e\x55\x91\xbe\xd1\x28" | ||
| 4178 | "\x9b\x90\xeb\x73\xf3\x68\x51\xc6" | ||
| 4179 | "\xdf\x82\xcc\xd8\x1f\xce\x5b\x27" | ||
| 4180 | "\xc0\x60\x5e\x33\xd6\xa7\x20\xea" | ||
| 4181 | "\xb2\x54\xc7\x5d\x6a\x3b\x67\x47" | ||
| 4182 | "\xcf\xa0\xe3\xab\x86\xaf\xc1\x42" | ||
| 4183 | "\xe6\xb0\x23\x4a\xaf\x53\xdf\xa0" | ||
| 4184 | "\xad\x12\x32\x31\x03\xf7\x21\xbe" | ||
| 4185 | "\x2d\xd5\x82\x42\xb6\x4a\x3d\xcd" | ||
| 4186 | "\xd8\x81\x77\xa9\x49\x98\x6c\x09" | ||
| 4187 | "\xc5\xa3\x61\x12\x62\x85\x6b\xcd" | ||
| 4188 | "\xb3\xf4\x20\x0c\x41\xc4\x05\x37" | ||
| 4189 | "\x46\x5f\xeb\x71\x8b\xf1\xaf\x6e" | ||
| 4190 | "\xba\xf3\x50\x2e\xfe\xa8\x37\xeb" | ||
| 4191 | "\xe8\x8c\x4f\xa4\x0c\xf1\x31\xc8" | ||
| 4192 | "\x6e\x71\x4f\xa5\xd7\x97\x73\xe0" | ||
| 4193 | "\x93\x4a\x2f\xda\x7b\xe0\x20\x54" | ||
| 4194 | "\x1f\x8d\x85\x79\x0b\x7b\x5e\x75" | ||
| 4195 | "\xb9\x07\x67\xcc\xc8\xe7\x21\x15" | ||
| 4196 | "\xa7\xc8\x98\xff\x4b\x80\x1c\x12" | ||
| 4197 | "\xa8\x54\xe1\x38\x52\xe6\x74\x81" | ||
| 4198 | "\x97\x47\xa1\x41\x0e\xc0\x50\xe3" | ||
| 4199 | "\x55\x0e\xc3\xa7\x70\x77\xce\x07" | ||
| 4200 | "\xed\x8c\x88\xe6\xa1\x5b\x14\xec" | ||
| 4201 | "\xe6\xde\x06\x6d\x74\xc5\xd9\xfa" | ||
| 4202 | "\xe5\x2f\x5a\xff\xc8\x05\xee\x27" | ||
| 4203 | "\x35\x61\xbf\x0b\x19\x78\x9b\xd2" | ||
| 4204 | "\x04\xc7\x05\xb1\x79\xb4\xff\x5f" | ||
| 4205 | "\xf3\xea\x67\x52\x78\xc2\xce\x70" | ||
| 4206 | "\xa4\x05\x0b\xb2\xb3\xa8\x30\x97" | ||
| 4207 | "\x37\x30\xe1\x91\x8d\xb3\x2a\xff", | ||
| 4208 | .ilen = 512, | ||
| 4209 | .result = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 4210 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 4211 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 4212 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 4213 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 4214 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 4215 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 4216 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 4217 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 4218 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 4219 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 4220 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 4221 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 4222 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 4223 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 4224 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 4225 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 4226 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 4227 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 4228 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 4229 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 4230 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 4231 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 4232 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 4233 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 4234 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 4235 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 4236 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 4237 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 4238 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 4239 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 4240 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
| 4241 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 4242 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 4243 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 4244 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 4245 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 4246 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 4247 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 4248 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 4249 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 4250 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 4251 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 4252 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 4253 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 4254 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 4255 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 4256 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 4257 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 4258 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 4259 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 4260 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 4261 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 4262 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 4263 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 4264 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 4265 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 4266 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 4267 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 4268 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 4269 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 4270 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 4271 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 4272 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
| 4273 | .rlen = 512, | ||
| 4274 | }, | ||
| 4275 | }; | ||
| 4276 | |||
| 3095 | /* | 4277 | /* |
| 3096 | * Serpent test vectors. These are backwards because Serpent writes | 4278 | * Serpent test vectors. These are backwards because Serpent writes |
| 3097 | * octet sequences in right-to-left mode. | 4279 | * octet sequences in right-to-left mode. |
| 3098 | */ | 4280 | */ |
| 3099 | #define SERPENT_ENC_TEST_VECTORS 4 | 4281 | #define SERPENT_ENC_TEST_VECTORS 5 |
| 3100 | #define SERPENT_DEC_TEST_VECTORS 4 | 4282 | #define SERPENT_DEC_TEST_VECTORS 5 |
| 3101 | 4283 | ||
| 3102 | #define TNEPRES_ENC_TEST_VECTORS 4 | 4284 | #define TNEPRES_ENC_TEST_VECTORS 4 |
| 3103 | #define TNEPRES_DEC_TEST_VECTORS 4 | 4285 | #define TNEPRES_DEC_TEST_VECTORS 4 |
| 3104 | 4286 | ||
| 4287 | #define SERPENT_CBC_ENC_TEST_VECTORS 1 | ||
| 4288 | #define SERPENT_CBC_DEC_TEST_VECTORS 1 | ||
| 4289 | |||
| 4290 | #define SERPENT_CTR_ENC_TEST_VECTORS 2 | ||
| 4291 | #define SERPENT_CTR_DEC_TEST_VECTORS 2 | ||
| 4292 | |||
| 4293 | #define SERPENT_LRW_ENC_TEST_VECTORS 8 | ||
| 4294 | #define SERPENT_LRW_DEC_TEST_VECTORS 8 | ||
| 4295 | |||
| 4296 | #define SERPENT_XTS_ENC_TEST_VECTORS 5 | ||
| 4297 | #define SERPENT_XTS_DEC_TEST_VECTORS 5 | ||
| 4298 | |||
| 3105 | static struct cipher_testvec serpent_enc_tv_template[] = { | 4299 | static struct cipher_testvec serpent_enc_tv_template[] = { |
| 3106 | { | 4300 | { |
| 3107 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" | 4301 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" |
| @@ -3140,6 +4334,50 @@ static struct cipher_testvec serpent_enc_tv_template[] = { | |||
| 3140 | .result = "\xdd\xd2\x6b\x98\xa5\xff\xd8\x2c" | 4334 | .result = "\xdd\xd2\x6b\x98\xa5\xff\xd8\x2c" |
| 3141 | "\x05\x34\x5a\x9d\xad\xbf\xaf\x49", | 4335 | "\x05\x34\x5a\x9d\xad\xbf\xaf\x49", |
| 3142 | .rlen = 16, | 4336 | .rlen = 16, |
| 4337 | }, { /* Generated with Crypto++ */ | ||
| 4338 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
| 4339 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
| 4340 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
| 4341 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
| 4342 | .klen = 32, | ||
| 4343 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
| 4344 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
| 4345 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
| 4346 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
| 4347 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
| 4348 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
| 4349 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
| 4350 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
| 4351 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
| 4352 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
| 4353 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
| 4354 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
| 4355 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
| 4356 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
| 4357 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
| 4358 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
| 4359 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
| 4360 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
| 4361 | .ilen = 144, | ||
| 4362 | .result = "\xFB\xB0\x5D\xDE\xC0\xFE\xFC\xEB" | ||
| 4363 | "\xB1\x80\x10\x43\xDE\x62\x70\xBD" | ||
| 4364 | "\xFA\x8A\x93\xEA\x6B\xF7\xC5\xD7" | ||
| 4365 | "\x0C\xD1\xBB\x29\x25\x14\x4C\x22" | ||
| 4366 | "\x77\xA6\x38\x00\xDB\xB9\xE2\x07" | ||
| 4367 | "\xD1\xAC\x82\xBA\xEA\x67\xAA\x39" | ||
| 4368 | "\x99\x34\x89\x5B\x54\xE9\x12\x13" | ||
| 4369 | "\x3B\x04\xE5\x12\x42\xC5\x79\xAB" | ||
| 4370 | "\x0D\xC7\x3C\x58\x2D\xA3\x98\xF6" | ||
| 4371 | "\xE4\x61\x9E\x17\x0B\xCE\xE8\xAA" | ||
| 4372 | "\xB5\x6C\x1A\x3A\x67\x52\x81\x6A" | ||
| 4373 | "\x04\xFF\x8A\x1B\x96\xFE\xE6\x87" | ||
| 4374 | "\x3C\xD4\x39\x7D\x36\x9B\x03\xD5" | ||
| 4375 | "\xB6\xA0\x75\x3C\x83\xE6\x1C\x73" | ||
| 4376 | "\x9D\x74\x2B\x77\x53\x2D\xE5\xBD" | ||
| 4377 | "\x69\xDA\x7A\x01\xF5\x6A\x70\x39" | ||
| 4378 | "\x30\xD4\x2C\xF2\x8E\x06\x4B\x39" | ||
| 4379 | "\xB3\x12\x1D\xB3\x17\x46\xE6\xD6", | ||
| 4380 | .rlen = 144, | ||
| 3143 | }, | 4381 | }, |
| 3144 | }; | 4382 | }; |
| 3145 | 4383 | ||
| @@ -3231,6 +4469,50 @@ static struct cipher_testvec serpent_dec_tv_template[] = { | |||
| 3231 | .ilen = 16, | 4469 | .ilen = 16, |
| 3232 | .result = zeroed_string, | 4470 | .result = zeroed_string, |
| 3233 | .rlen = 16, | 4471 | .rlen = 16, |
| 4472 | }, { /* Generated with Crypto++ */ | ||
| 4473 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
| 4474 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
| 4475 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
| 4476 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
| 4477 | .klen = 32, | ||
| 4478 | .input = "\xFB\xB0\x5D\xDE\xC0\xFE\xFC\xEB" | ||
| 4479 | "\xB1\x80\x10\x43\xDE\x62\x70\xBD" | ||
| 4480 | "\xFA\x8A\x93\xEA\x6B\xF7\xC5\xD7" | ||
| 4481 | "\x0C\xD1\xBB\x29\x25\x14\x4C\x22" | ||
| 4482 | "\x77\xA6\x38\x00\xDB\xB9\xE2\x07" | ||
| 4483 | "\xD1\xAC\x82\xBA\xEA\x67\xAA\x39" | ||
| 4484 | "\x99\x34\x89\x5B\x54\xE9\x12\x13" | ||
| 4485 | "\x3B\x04\xE5\x12\x42\xC5\x79\xAB" | ||
| 4486 | "\x0D\xC7\x3C\x58\x2D\xA3\x98\xF6" | ||
| 4487 | "\xE4\x61\x9E\x17\x0B\xCE\xE8\xAA" | ||
| 4488 | "\xB5\x6C\x1A\x3A\x67\x52\x81\x6A" | ||
| 4489 | "\x04\xFF\x8A\x1B\x96\xFE\xE6\x87" | ||
| 4490 | "\x3C\xD4\x39\x7D\x36\x9B\x03\xD5" | ||
| 4491 | "\xB6\xA0\x75\x3C\x83\xE6\x1C\x73" | ||
| 4492 | "\x9D\x74\x2B\x77\x53\x2D\xE5\xBD" | ||
| 4493 | "\x69\xDA\x7A\x01\xF5\x6A\x70\x39" | ||
| 4494 | "\x30\xD4\x2C\xF2\x8E\x06\x4B\x39" | ||
| 4495 | "\xB3\x12\x1D\xB3\x17\x46\xE6\xD6", | ||
| 4496 | .ilen = 144, | ||
| 4497 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
| 4498 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
| 4499 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
| 4500 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
| 4501 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
| 4502 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
| 4503 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
| 4504 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
| 4505 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
| 4506 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
| 4507 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
| 4508 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
| 4509 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
| 4510 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
| 4511 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
| 4512 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
| 4513 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
| 4514 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
| 4515 | .rlen = 144, | ||
| 3234 | }, | 4516 | }, |
| 3235 | }; | 4517 | }; |
| 3236 | 4518 | ||
| @@ -3275,6 +4557,1479 @@ static struct cipher_testvec tnepres_dec_tv_template[] = { | |||
| 3275 | }, | 4557 | }, |
| 3276 | }; | 4558 | }; |
| 3277 | 4559 | ||
| 4560 | static struct cipher_testvec serpent_cbc_enc_tv_template[] = { | ||
| 4561 | { /* Generated with Crypto++ */ | ||
| 4562 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
| 4563 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
| 4564 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
| 4565 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
| 4566 | .klen = 32, | ||
| 4567 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
| 4568 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
| 4569 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
| 4570 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
| 4571 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
| 4572 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
| 4573 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
| 4574 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
| 4575 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
| 4576 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
| 4577 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
| 4578 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
| 4579 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
| 4580 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
| 4581 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
| 4582 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
| 4583 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
| 4584 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
| 4585 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
| 4586 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
| 4587 | .ilen = 144, | ||
| 4588 | .result = "\x80\xCF\x11\x41\x1A\xB9\x4B\x9C" | ||
| 4589 | "\xFF\xB7\x6C\xEA\xF0\xAF\x77\x6E" | ||
| 4590 | "\x71\x75\x95\x9D\x4E\x1C\xCF\xAD" | ||
| 4591 | "\x81\x34\xE9\x8F\xAE\x5A\x91\x1C" | ||
| 4592 | "\x38\x63\x35\x7E\x79\x18\x0A\xE8" | ||
| 4593 | "\x67\x06\x76\xD5\xFF\x22\x2F\xDA" | ||
| 4594 | "\xB6\x2D\x57\x13\xB6\x3C\xBC\x97" | ||
| 4595 | "\xFE\x53\x75\x35\x97\x7F\x51\xEA" | ||
| 4596 | "\xDF\x5D\xE8\x9D\xCC\xD9\xAE\xE7" | ||
| 4597 | "\x62\x67\xFF\x04\xC2\x18\x22\x5F" | ||
| 4598 | "\x2E\x06\xC1\xE2\x26\xCD\xC6\x1E" | ||
| 4599 | "\xE5\x2C\x4E\x87\x23\xDD\xF0\x41" | ||
| 4600 | "\x08\xA5\xB4\x3E\x07\x1E\x0B\xBB" | ||
| 4601 | "\x72\x84\xF8\x0A\x3F\x38\x5E\x91" | ||
| 4602 | "\x15\x26\xE1\xDB\xA4\x3D\x74\xD2" | ||
| 4603 | "\x41\x1E\x3F\xA9\xC6\x7D\x2A\xAB" | ||
| 4604 | "\x27\xDF\x89\x1D\x86\x3E\xF7\x5A" | ||
| 4605 | "\xF6\xE3\x0F\xC7\x6B\x4C\x96\x7C", | ||
| 4606 | .rlen = 144, | ||
| 4607 | }, | ||
| 4608 | }; | ||
| 4609 | |||
| 4610 | static struct cipher_testvec serpent_cbc_dec_tv_template[] = { | ||
| 4611 | { /* Generated with Crypto++ */ | ||
| 4612 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
| 4613 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
| 4614 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
| 4615 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
| 4616 | .klen = 32, | ||
| 4617 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
| 4618 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
| 4619 | .input = "\x80\xCF\x11\x41\x1A\xB9\x4B\x9C" | ||
| 4620 | "\xFF\xB7\x6C\xEA\xF0\xAF\x77\x6E" | ||
| 4621 | "\x71\x75\x95\x9D\x4E\x1C\xCF\xAD" | ||
| 4622 | "\x81\x34\xE9\x8F\xAE\x5A\x91\x1C" | ||
| 4623 | "\x38\x63\x35\x7E\x79\x18\x0A\xE8" | ||
| 4624 | "\x67\x06\x76\xD5\xFF\x22\x2F\xDA" | ||
| 4625 | "\xB6\x2D\x57\x13\xB6\x3C\xBC\x97" | ||
| 4626 | "\xFE\x53\x75\x35\x97\x7F\x51\xEA" | ||
| 4627 | "\xDF\x5D\xE8\x9D\xCC\xD9\xAE\xE7" | ||
| 4628 | "\x62\x67\xFF\x04\xC2\x18\x22\x5F" | ||
| 4629 | "\x2E\x06\xC1\xE2\x26\xCD\xC6\x1E" | ||
| 4630 | "\xE5\x2C\x4E\x87\x23\xDD\xF0\x41" | ||
| 4631 | "\x08\xA5\xB4\x3E\x07\x1E\x0B\xBB" | ||
| 4632 | "\x72\x84\xF8\x0A\x3F\x38\x5E\x91" | ||
| 4633 | "\x15\x26\xE1\xDB\xA4\x3D\x74\xD2" | ||
| 4634 | "\x41\x1E\x3F\xA9\xC6\x7D\x2A\xAB" | ||
| 4635 | "\x27\xDF\x89\x1D\x86\x3E\xF7\x5A" | ||
| 4636 | "\xF6\xE3\x0F\xC7\x6B\x4C\x96\x7C", | ||
| 4637 | .ilen = 144, | ||
| 4638 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
| 4639 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
| 4640 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
| 4641 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
| 4642 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
| 4643 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
| 4644 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
| 4645 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
| 4646 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
| 4647 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
| 4648 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
| 4649 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
| 4650 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
| 4651 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
| 4652 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
| 4653 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
| 4654 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
| 4655 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
| 4656 | .rlen = 144, | ||
| 4657 | }, | ||
| 4658 | }; | ||
| 4659 | |||
| 4660 | static struct cipher_testvec serpent_ctr_enc_tv_template[] = { | ||
| 4661 | { /* Generated with Crypto++ */ | ||
| 4662 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
| 4663 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
| 4664 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
| 4665 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
| 4666 | .klen = 32, | ||
| 4667 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
| 4668 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
| 4669 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
| 4670 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
| 4671 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
| 4672 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
| 4673 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
| 4674 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
| 4675 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
| 4676 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
| 4677 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
| 4678 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
| 4679 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
| 4680 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
| 4681 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
| 4682 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
| 4683 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
| 4684 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
| 4685 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
| 4686 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
| 4687 | .ilen = 144, | ||
| 4688 | .result = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA" | ||
| 4689 | "\x37\x69\xE3\x3A\x22\x85\x48\x46" | ||
| 4690 | "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E" | ||
| 4691 | "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9" | ||
| 4692 | "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D" | ||
| 4693 | "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF" | ||
| 4694 | "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8" | ||
| 4695 | "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B" | ||
| 4696 | "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88" | ||
| 4697 | "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C" | ||
| 4698 | "\x22\xF6\x55\x5A\xFA\x35\xA5\x17" | ||
| 4699 | "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91" | ||
| 4700 | "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE" | ||
| 4701 | "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96" | ||
| 4702 | "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5" | ||
| 4703 | "\x7C\xB5\x12\x89\xED\xBF\xB6\x09" | ||
| 4704 | "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC" | ||
| 4705 | "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9", | ||
| 4706 | .rlen = 144, | ||
| 4707 | }, { /* Generated with Crypto++ */ | ||
| 4708 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
| 4709 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
| 4710 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
| 4711 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
| 4712 | .klen = 32, | ||
| 4713 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
| 4714 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
| 4715 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
| 4716 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
| 4717 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
| 4718 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
| 4719 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
| 4720 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
| 4721 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
| 4722 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
| 4723 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
| 4724 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
| 4725 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
| 4726 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
| 4727 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
| 4728 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
| 4729 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
| 4730 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
| 4731 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
| 4732 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" | ||
| 4733 | "\xF1\x65\xFC", | ||
| 4734 | .ilen = 147, | ||
| 4735 | .result = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA" | ||
| 4736 | "\x37\x69\xE3\x3A\x22\x85\x48\x46" | ||
| 4737 | "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E" | ||
| 4738 | "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9" | ||
| 4739 | "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D" | ||
| 4740 | "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF" | ||
| 4741 | "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8" | ||
| 4742 | "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B" | ||
| 4743 | "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88" | ||
| 4744 | "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C" | ||
| 4745 | "\x22\xF6\x55\x5A\xFA\x35\xA5\x17" | ||
| 4746 | "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91" | ||
| 4747 | "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE" | ||
| 4748 | "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96" | ||
| 4749 | "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5" | ||
| 4750 | "\x7C\xB5\x12\x89\xED\xBF\xB6\x09" | ||
| 4751 | "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC" | ||
| 4752 | "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9" | ||
| 4753 | "\xE6\xD0\x97", | ||
| 4754 | .rlen = 147, | ||
| 4755 | }, | ||
| 4756 | }; | ||
| 4757 | |||
| 4758 | static struct cipher_testvec serpent_ctr_dec_tv_template[] = { | ||
| 4759 | { /* Generated with Crypto++ */ | ||
| 4760 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
| 4761 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
| 4762 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
| 4763 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
| 4764 | .klen = 32, | ||
| 4765 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
| 4766 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
| 4767 | .input = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA" | ||
| 4768 | "\x37\x69\xE3\x3A\x22\x85\x48\x46" | ||
| 4769 | "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E" | ||
| 4770 | "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9" | ||
| 4771 | "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D" | ||
| 4772 | "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF" | ||
| 4773 | "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8" | ||
| 4774 | "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B" | ||
| 4775 | "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88" | ||
| 4776 | "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C" | ||
| 4777 | "\x22\xF6\x55\x5A\xFA\x35\xA5\x17" | ||
| 4778 | "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91" | ||
| 4779 | "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE" | ||
| 4780 | "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96" | ||
| 4781 | "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5" | ||
| 4782 | "\x7C\xB5\x12\x89\xED\xBF\xB6\x09" | ||
| 4783 | "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC" | ||
| 4784 | "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9", | ||
| 4785 | .ilen = 144, | ||
| 4786 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
| 4787 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
| 4788 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
| 4789 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
| 4790 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
| 4791 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
| 4792 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
| 4793 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
| 4794 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
| 4795 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
| 4796 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
| 4797 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
| 4798 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
| 4799 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
| 4800 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
| 4801 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
| 4802 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
| 4803 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
| 4804 | .rlen = 144, | ||
| 4805 | }, { /* Generated with Crypto++ */ | ||
| 4806 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
| 4807 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
| 4808 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
| 4809 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
| 4810 | .klen = 32, | ||
| 4811 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
| 4812 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
| 4813 | .input = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA" | ||
| 4814 | "\x37\x69\xE3\x3A\x22\x85\x48\x46" | ||
| 4815 | "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E" | ||
| 4816 | "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9" | ||
| 4817 | "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D" | ||
| 4818 | "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF" | ||
| 4819 | "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8" | ||
| 4820 | "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B" | ||
| 4821 | "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88" | ||
| 4822 | "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C" | ||
| 4823 | "\x22\xF6\x55\x5A\xFA\x35\xA5\x17" | ||
| 4824 | "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91" | ||
| 4825 | "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE" | ||
| 4826 | "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96" | ||
| 4827 | "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5" | ||
| 4828 | "\x7C\xB5\x12\x89\xED\xBF\xB6\x09" | ||
| 4829 | "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC" | ||
| 4830 | "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9" | ||
| 4831 | "\xE6\xD0\x97", | ||
| 4832 | .ilen = 147, | ||
| 4833 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
| 4834 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
| 4835 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
| 4836 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
| 4837 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
| 4838 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
| 4839 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
| 4840 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
| 4841 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
| 4842 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
| 4843 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
| 4844 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
| 4845 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
| 4846 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
| 4847 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
| 4848 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
| 4849 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
| 4850 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" | ||
| 4851 | "\xF1\x65\xFC", | ||
| 4852 | .rlen = 147, | ||
| 4853 | }, | ||
| 4854 | }; | ||
| 4855 | |||
| 4856 | static struct cipher_testvec serpent_lrw_enc_tv_template[] = { | ||
| 4857 | /* Generated from AES-LRW test vectors */ | ||
| 4858 | { | ||
| 4859 | .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" | ||
| 4860 | "\x4c\x26\x84\x14\xb5\x68\x01\x85" | ||
| 4861 | "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03" | ||
| 4862 | "\xee\x5a\x83\x0c\xcc\x09\x4c\x87", | ||
| 4863 | .klen = 32, | ||
| 4864 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 4865 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 4866 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 4867 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 4868 | .ilen = 16, | ||
| 4869 | .result = "\x6f\xbf\xd4\xa4\x5d\x71\x16\x79" | ||
| 4870 | "\x63\x9c\xa6\x8e\x40\xbe\x0d\x8a", | ||
| 4871 | .rlen = 16, | ||
| 4872 | }, { | ||
| 4873 | .key = "\x59\x70\x47\x14\xf5\x57\x47\x8c" | ||
| 4874 | "\xd7\x79\xe8\x0f\x54\x88\x79\x44" | ||
| 4875 | "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea" | ||
| 4876 | "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf", | ||
| 4877 | .klen = 32, | ||
| 4878 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 4879 | "\x00\x00\x00\x00\x00\x00\x00\x02", | ||
| 4880 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 4881 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 4882 | .ilen = 16, | ||
| 4883 | .result = "\xfd\xb2\x66\x98\x80\x96\x55\xad" | ||
| 4884 | "\x08\x94\x54\x9c\x21\x7c\x69\xe3", | ||
| 4885 | .rlen = 16, | ||
| 4886 | }, { | ||
| 4887 | .key = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50" | ||
| 4888 | "\x30\xfe\x69\xe2\x37\x7f\x98\x47" | ||
| 4889 | "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6" | ||
| 4890 | "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f", | ||
| 4891 | .klen = 32, | ||
| 4892 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 4893 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 4894 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 4895 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 4896 | .ilen = 16, | ||
| 4897 | .result = "\x14\x5e\x3d\x70\xc0\x6e\x9c\x34" | ||
| 4898 | "\x5b\x5e\xcf\x0f\xe4\x8c\x21\x5c", | ||
| 4899 | .rlen = 16, | ||
| 4900 | }, { | ||
| 4901 | .key = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15" | ||
| 4902 | "\x25\x83\xf7\x3c\x1f\x01\x28\x74" | ||
| 4903 | "\xca\xc6\xbc\x35\x4d\x4a\x65\x54" | ||
| 4904 | "\x90\xae\x61\xcf\x7b\xae\xbd\xcc" | ||
| 4905 | "\xad\xe4\x94\xc5\x4a\x29\xae\x70", | ||
| 4906 | .klen = 40, | ||
| 4907 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 4908 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 4909 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 4910 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 4911 | .ilen = 16, | ||
| 4912 | .result = "\x25\x39\xaa\xa5\xf0\x65\xc8\xdc" | ||
| 4913 | "\x5d\x45\x95\x30\x8f\xff\x2f\x1b", | ||
| 4914 | .rlen = 16, | ||
| 4915 | }, { | ||
| 4916 | .key = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff" | ||
| 4917 | "\xf8\x86\xce\xac\x93\xc5\xad\xc6" | ||
| 4918 | "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd" | ||
| 4919 | "\x52\x13\xb2\xb7\xf0\xff\x11\xd8" | ||
| 4920 | "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f", | ||
| 4921 | .klen = 40, | ||
| 4922 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 4923 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 4924 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 4925 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 4926 | .ilen = 16, | ||
| 4927 | .result = "\x0c\x20\x20\x63\xd6\x8b\xfc\x8f" | ||
| 4928 | "\xc0\xe2\x17\xbb\xd2\x59\x6f\x26", | ||
| 4929 | .rlen = 16, | ||
| 4930 | }, { | ||
| 4931 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
| 4932 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
| 4933 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
| 4934 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
| 4935 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
| 4936 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
| 4937 | .klen = 48, | ||
| 4938 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 4939 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 4940 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 4941 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 4942 | .ilen = 16, | ||
| 4943 | .result = "\xc1\x35\x2e\x53\xf0\x96\x4d\x9c" | ||
| 4944 | "\x2e\x18\xe6\x99\xcd\xd3\x15\x68", | ||
| 4945 | .rlen = 16, | ||
| 4946 | }, { | ||
| 4947 | .key = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d" | ||
| 4948 | "\xd4\x70\x98\x0b\xc7\x95\x84\xc8" | ||
| 4949 | "\xb2\xfb\x64\xce\x60\x97\x87\x8d" | ||
| 4950 | "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7" | ||
| 4951 | "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4" | ||
| 4952 | "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c", | ||
| 4953 | .klen = 48, | ||
| 4954 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 4955 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 4956 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 4957 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 4958 | .ilen = 16, | ||
| 4959 | .result = "\x86\x0a\xc6\xa9\x1a\x9f\xe7\xe6" | ||
| 4960 | "\x64\x3b\x33\xd6\xd5\x84\xd6\xdf", | ||
| 4961 | .rlen = 16, | ||
| 4962 | }, { | ||
| 4963 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
| 4964 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
| 4965 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
| 4966 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
| 4967 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
| 4968 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
| 4969 | .klen = 48, | ||
| 4970 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 4971 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 4972 | .input = "\x05\x11\xb7\x18\xab\xc6\x2d\xac" | ||
| 4973 | "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c" | ||
| 4974 | "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8" | ||
| 4975 | "\x50\x38\x1f\x71\x49\xb6\x57\xd6" | ||
| 4976 | "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90" | ||
| 4977 | "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6" | ||
| 4978 | "\xad\x1e\x9e\x20\x5f\x38\xbe\x04" | ||
| 4979 | "\xda\x10\x8e\xed\xa2\xa4\x87\xab" | ||
| 4980 | "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c" | ||
| 4981 | "\xc9\xac\x42\x31\x95\x7c\xc9\x04" | ||
| 4982 | "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6" | ||
| 4983 | "\x15\xd7\x3f\x4f\x2f\x66\x69\x03" | ||
| 4984 | "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65" | ||
| 4985 | "\x4c\x96\x12\xed\x7c\x92\x03\x01" | ||
| 4986 | "\x6f\xbc\x35\x93\xac\xf1\x27\xf1" | ||
| 4987 | "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50" | ||
| 4988 | "\x89\xa4\x8e\x66\x44\x85\xcc\xfd" | ||
| 4989 | "\x33\x14\x70\xe3\x96\xb2\xc3\xd3" | ||
| 4990 | "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5" | ||
| 4991 | "\x2d\x64\x75\xdd\xb4\x54\xe6\x74" | ||
| 4992 | "\x8c\xd3\x9d\x9e\x86\xab\x51\x53" | ||
| 4993 | "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40" | ||
| 4994 | "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5" | ||
| 4995 | "\x76\x12\x73\x44\x1a\x56\xd7\x72" | ||
| 4996 | "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda" | ||
| 4997 | "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd" | ||
| 4998 | "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60" | ||
| 4999 | "\x1a\xe2\x70\x85\x58\xc2\x1b\x09" | ||
| 5000 | "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9" | ||
| 5001 | "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8" | ||
| 5002 | "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8" | ||
| 5003 | "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10" | ||
| 5004 | "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1" | ||
| 5005 | "\x90\x3e\x76\x4a\x74\xa4\x21\x2c" | ||
| 5006 | "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e" | ||
| 5007 | "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f" | ||
| 5008 | "\x8d\x23\x31\x74\x84\xeb\x88\x6e" | ||
| 5009 | "\xcc\xb9\xbc\x22\x83\x19\x07\x22" | ||
| 5010 | "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78" | ||
| 5011 | "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5" | ||
| 5012 | "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41" | ||
| 5013 | "\x3c\xce\x8f\x42\x60\x71\xa7\x75" | ||
| 5014 | "\x08\x40\x65\x8a\x82\xbf\xf5\x43" | ||
| 5015 | "\x71\x96\xa9\x4d\x44\x8a\x20\xbe" | ||
| 5016 | "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65" | ||
| 5017 | "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9" | ||
| 5018 | "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4" | ||
| 5019 | "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a" | ||
| 5020 | "\x62\x73\x65\xfd\x46\x63\x25\x3d" | ||
| 5021 | "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf" | ||
| 5022 | "\x24\xf3\xb4\xac\x64\xba\xdf\x4b" | ||
| 5023 | "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7" | ||
| 5024 | "\xc5\x68\x77\x84\x32\x2b\xcc\x85" | ||
| 5025 | "\x74\x96\xf0\x12\x77\x61\xb9\xeb" | ||
| 5026 | "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8" | ||
| 5027 | "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24" | ||
| 5028 | "\xda\x39\x87\x45\xc0\x2b\xbb\x01" | ||
| 5029 | "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce" | ||
| 5030 | "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6" | ||
| 5031 | "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32" | ||
| 5032 | "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45" | ||
| 5033 | "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6" | ||
| 5034 | "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" | ||
| 5035 | "\x21\xc4\xc2\x75\x67\x89\x37\x0a", | ||
| 5036 | .ilen = 512, | ||
| 5037 | .result = "\xe3\x5a\x38\x0f\x4d\x92\x3a\x74" | ||
| 5038 | "\x15\xb1\x50\x8c\x9a\xd8\x99\x1d" | ||
| 5039 | "\x82\xec\xf1\x5f\x03\x6d\x02\x58" | ||
| 5040 | "\x90\x67\xfc\xdd\x8d\xe1\x38\x08" | ||
| 5041 | "\x7b\xc9\x9b\x4b\x04\x09\x50\x15" | ||
| 5042 | "\xce\xab\xda\x33\x30\x20\x12\xfa" | ||
| 5043 | "\x83\xc4\xa6\x9a\x2e\x7d\x90\xd9" | ||
| 5044 | "\xa6\xa6\x67\x43\xb4\xa7\xa8\x5c" | ||
| 5045 | "\xbb\x6a\x49\x2b\x8b\xf8\xd0\x22" | ||
| 5046 | "\xe5\x9e\xba\xe8\x8c\x67\xb8\x5b" | ||
| 5047 | "\x60\xbc\xf5\xa4\x95\x4e\x66\xe5" | ||
| 5048 | "\x6d\x8e\xa9\xf6\x65\x2e\x04\xf5" | ||
| 5049 | "\xba\xb5\xdb\x88\xc2\xf6\x7a\x4b" | ||
| 5050 | "\x89\x58\x7c\x9a\xae\x26\xe8\xb7" | ||
| 5051 | "\xb7\x28\xcc\xd6\xcc\xa5\x98\x4d" | ||
| 5052 | "\xb9\x91\xcb\xb4\xe4\x8b\x96\x47" | ||
| 5053 | "\x5f\x03\x8b\xdd\x94\xd1\xee\x12" | ||
| 5054 | "\xa7\x83\x80\xf2\xc1\x15\x74\x4f" | ||
| 5055 | "\x49\xf9\xb0\x7e\x6f\xdc\x73\x2f" | ||
| 5056 | "\xe2\xcf\xe0\x1b\x34\xa5\xa0\x52" | ||
| 5057 | "\xfb\x3c\x5d\x85\x91\xe6\x6d\x98" | ||
| 5058 | "\x04\xd6\xdd\x4c\x00\x64\xd9\x54" | ||
| 5059 | "\x5c\x3c\x08\x1d\x4c\x06\x9f\xb8" | ||
| 5060 | "\x1c\x4d\x8d\xdc\xa4\x3c\xb9\x3b" | ||
| 5061 | "\x9e\x85\xce\xc3\xa8\x4a\x0c\xd9" | ||
| 5062 | "\x04\xc3\x6f\x17\x66\xa9\x1f\x59" | ||
| 5063 | "\xd9\xe2\x19\x36\xa3\x88\xb8\x0b" | ||
| 5064 | "\x0f\x4a\x4d\xf8\xc8\x6f\xd5\x43" | ||
| 5065 | "\xeb\xa0\xab\x1f\x61\xc0\x06\xeb" | ||
| 5066 | "\x93\xb7\xb8\x6f\x0d\xbd\x07\x49" | ||
| 5067 | "\xb3\xac\x5d\xcf\x31\xa0\x27\x26" | ||
| 5068 | "\x21\xbe\x94\x2e\x19\xea\xf4\xee" | ||
| 5069 | "\xb5\x13\x89\xf7\x94\x0b\xef\x59" | ||
| 5070 | "\x44\xc5\x78\x8b\x3c\x3b\x71\x20" | ||
| 5071 | "\xf9\x35\x0c\x70\x74\xdc\x5b\xc2" | ||
| 5072 | "\xb4\x11\x0e\x2c\x61\xa1\x52\x46" | ||
| 5073 | "\x18\x11\x16\xc6\x86\x44\xa7\xaf" | ||
| 5074 | "\xd5\x0c\x7d\xa6\x9e\x25\x2d\x1b" | ||
| 5075 | "\x9a\x8f\x0f\xf8\x6a\x61\xa0\xea" | ||
| 5076 | "\x3f\x0e\x90\xd6\x8f\x83\x30\x64" | ||
| 5077 | "\xb5\x51\x2d\x08\x3c\xcd\x99\x36" | ||
| 5078 | "\x96\xd4\xb1\xb5\x48\x30\xca\x48" | ||
| 5079 | "\xf7\x11\xa8\xf5\x97\x8a\x6a\x6d" | ||
| 5080 | "\x12\x33\x2f\xc0\xe8\xda\xec\x8a" | ||
| 5081 | "\xe1\x88\x72\x63\xde\x20\xa3\xe1" | ||
| 5082 | "\x8e\xac\x84\x37\x35\xf5\xf7\x3f" | ||
| 5083 | "\x00\x02\x0e\xe4\xc1\x53\x68\x3f" | ||
| 5084 | "\xaa\xd5\xac\x52\x3d\x20\x2f\x4d" | ||
| 5085 | "\x7c\x83\xd0\xbd\xaa\x97\x35\x36" | ||
| 5086 | "\x98\x88\x59\x5d\xe7\x24\xe3\x90" | ||
| 5087 | "\x9d\x30\x47\xa7\xc3\x60\x35\xf4" | ||
| 5088 | "\xd5\xdb\x0e\x4d\x44\xc1\x81\x8b" | ||
| 5089 | "\xfd\xbd\xc3\x2b\xba\x68\xfe\x8d" | ||
| 5090 | "\x49\x5a\x3c\x8a\xa3\x01\xae\x25" | ||
| 5091 | "\x42\xab\xd2\x87\x1b\x35\xd6\xd2" | ||
| 5092 | "\xd7\x70\x1c\x1f\x72\xd1\xe1\x39" | ||
| 5093 | "\x1c\x58\xa2\xb4\xd0\x78\x55\x72" | ||
| 5094 | "\x76\x59\xea\xd9\xd7\x6e\x63\x8b" | ||
| 5095 | "\xcc\x9b\xa7\x74\x89\xfc\xa3\x68" | ||
| 5096 | "\x86\x28\xd1\xbb\x54\x8d\x66\xad" | ||
| 5097 | "\x2a\x92\xf9\x4e\x04\x3d\xae\xfd" | ||
| 5098 | "\x1b\x2b\x7f\xc3\x2f\x1a\x78\x0a" | ||
| 5099 | "\x5c\xc6\x84\xfe\x7c\xcb\x26\xfd" | ||
| 5100 | "\xd9\x51\x0f\xd7\x94\x2f\xc5\xa7", | ||
| 5101 | .rlen = 512, | ||
| 5102 | }, | ||
| 5103 | }; | ||
| 5104 | |||
| 5105 | static struct cipher_testvec serpent_lrw_dec_tv_template[] = { | ||
| 5106 | /* Generated from AES-LRW test vectors */ | ||
| 5107 | /* same as enc vectors with input and result reversed */ | ||
| 5108 | { | ||
| 5109 | .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" | ||
| 5110 | "\x4c\x26\x84\x14\xb5\x68\x01\x85" | ||
| 5111 | "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03" | ||
| 5112 | "\xee\x5a\x83\x0c\xcc\x09\x4c\x87", | ||
| 5113 | .klen = 32, | ||
| 5114 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5115 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 5116 | .input = "\x6f\xbf\xd4\xa4\x5d\x71\x16\x79" | ||
| 5117 | "\x63\x9c\xa6\x8e\x40\xbe\x0d\x8a", | ||
| 5118 | .ilen = 16, | ||
| 5119 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5120 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 5121 | .rlen = 16, | ||
| 5122 | }, { | ||
| 5123 | .key = "\x59\x70\x47\x14\xf5\x57\x47\x8c" | ||
| 5124 | "\xd7\x79\xe8\x0f\x54\x88\x79\x44" | ||
| 5125 | "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea" | ||
| 5126 | "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf", | ||
| 5127 | .klen = 32, | ||
| 5128 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5129 | "\x00\x00\x00\x00\x00\x00\x00\x02", | ||
| 5130 | .input = "\xfd\xb2\x66\x98\x80\x96\x55\xad" | ||
| 5131 | "\x08\x94\x54\x9c\x21\x7c\x69\xe3", | ||
| 5132 | .ilen = 16, | ||
| 5133 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5134 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 5135 | .rlen = 16, | ||
| 5136 | }, { | ||
| 5137 | .key = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50" | ||
| 5138 | "\x30\xfe\x69\xe2\x37\x7f\x98\x47" | ||
| 5139 | "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6" | ||
| 5140 | "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f", | ||
| 5141 | .klen = 32, | ||
| 5142 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5143 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 5144 | .input = "\x14\x5e\x3d\x70\xc0\x6e\x9c\x34" | ||
| 5145 | "\x5b\x5e\xcf\x0f\xe4\x8c\x21\x5c", | ||
| 5146 | .ilen = 16, | ||
| 5147 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5148 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 5149 | .rlen = 16, | ||
| 5150 | }, { | ||
| 5151 | .key = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15" | ||
| 5152 | "\x25\x83\xf7\x3c\x1f\x01\x28\x74" | ||
| 5153 | "\xca\xc6\xbc\x35\x4d\x4a\x65\x54" | ||
| 5154 | "\x90\xae\x61\xcf\x7b\xae\xbd\xcc" | ||
| 5155 | "\xad\xe4\x94\xc5\x4a\x29\xae\x70", | ||
| 5156 | .klen = 40, | ||
| 5157 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5158 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 5159 | .input = "\x25\x39\xaa\xa5\xf0\x65\xc8\xdc" | ||
| 5160 | "\x5d\x45\x95\x30\x8f\xff\x2f\x1b", | ||
| 5161 | .ilen = 16, | ||
| 5162 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5163 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 5164 | .rlen = 16, | ||
| 5165 | }, { | ||
| 5166 | .key = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff" | ||
| 5167 | "\xf8\x86\xce\xac\x93\xc5\xad\xc6" | ||
| 5168 | "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd" | ||
| 5169 | "\x52\x13\xb2\xb7\xf0\xff\x11\xd8" | ||
| 5170 | "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f", | ||
| 5171 | .klen = 40, | ||
| 5172 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5173 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 5174 | .input = "\x0c\x20\x20\x63\xd6\x8b\xfc\x8f" | ||
| 5175 | "\xc0\xe2\x17\xbb\xd2\x59\x6f\x26", | ||
| 5176 | .ilen = 16, | ||
| 5177 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5178 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 5179 | .rlen = 16, | ||
| 5180 | }, { | ||
| 5181 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
| 5182 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
| 5183 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
| 5184 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
| 5185 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
| 5186 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
| 5187 | .klen = 48, | ||
| 5188 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5189 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 5190 | .input = "\xc1\x35\x2e\x53\xf0\x96\x4d\x9c" | ||
| 5191 | "\x2e\x18\xe6\x99\xcd\xd3\x15\x68", | ||
| 5192 | .ilen = 16, | ||
| 5193 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5194 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 5195 | .rlen = 16, | ||
| 5196 | }, { | ||
| 5197 | .key = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d" | ||
| 5198 | "\xd4\x70\x98\x0b\xc7\x95\x84\xc8" | ||
| 5199 | "\xb2\xfb\x64\xce\x60\x97\x87\x8d" | ||
| 5200 | "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7" | ||
| 5201 | "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4" | ||
| 5202 | "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c", | ||
| 5203 | .klen = 48, | ||
| 5204 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5205 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
| 5206 | .input = "\x86\x0a\xc6\xa9\x1a\x9f\xe7\xe6" | ||
| 5207 | "\x64\x3b\x33\xd6\xd5\x84\xd6\xdf", | ||
| 5208 | .ilen = 16, | ||
| 5209 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5210 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
| 5211 | .rlen = 16, | ||
| 5212 | }, { | ||
| 5213 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
| 5214 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
| 5215 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
| 5216 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
| 5217 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
| 5218 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
| 5219 | .klen = 48, | ||
| 5220 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5221 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
| 5222 | .input = "\xe3\x5a\x38\x0f\x4d\x92\x3a\x74" | ||
| 5223 | "\x15\xb1\x50\x8c\x9a\xd8\x99\x1d" | ||
| 5224 | "\x82\xec\xf1\x5f\x03\x6d\x02\x58" | ||
| 5225 | "\x90\x67\xfc\xdd\x8d\xe1\x38\x08" | ||
| 5226 | "\x7b\xc9\x9b\x4b\x04\x09\x50\x15" | ||
| 5227 | "\xce\xab\xda\x33\x30\x20\x12\xfa" | ||
| 5228 | "\x83\xc4\xa6\x9a\x2e\x7d\x90\xd9" | ||
| 5229 | "\xa6\xa6\x67\x43\xb4\xa7\xa8\x5c" | ||
| 5230 | "\xbb\x6a\x49\x2b\x8b\xf8\xd0\x22" | ||
| 5231 | "\xe5\x9e\xba\xe8\x8c\x67\xb8\x5b" | ||
| 5232 | "\x60\xbc\xf5\xa4\x95\x4e\x66\xe5" | ||
| 5233 | "\x6d\x8e\xa9\xf6\x65\x2e\x04\xf5" | ||
| 5234 | "\xba\xb5\xdb\x88\xc2\xf6\x7a\x4b" | ||
| 5235 | "\x89\x58\x7c\x9a\xae\x26\xe8\xb7" | ||
| 5236 | "\xb7\x28\xcc\xd6\xcc\xa5\x98\x4d" | ||
| 5237 | "\xb9\x91\xcb\xb4\xe4\x8b\x96\x47" | ||
| 5238 | "\x5f\x03\x8b\xdd\x94\xd1\xee\x12" | ||
| 5239 | "\xa7\x83\x80\xf2\xc1\x15\x74\x4f" | ||
| 5240 | "\x49\xf9\xb0\x7e\x6f\xdc\x73\x2f" | ||
| 5241 | "\xe2\xcf\xe0\x1b\x34\xa5\xa0\x52" | ||
| 5242 | "\xfb\x3c\x5d\x85\x91\xe6\x6d\x98" | ||
| 5243 | "\x04\xd6\xdd\x4c\x00\x64\xd9\x54" | ||
| 5244 | "\x5c\x3c\x08\x1d\x4c\x06\x9f\xb8" | ||
| 5245 | "\x1c\x4d\x8d\xdc\xa4\x3c\xb9\x3b" | ||
| 5246 | "\x9e\x85\xce\xc3\xa8\x4a\x0c\xd9" | ||
| 5247 | "\x04\xc3\x6f\x17\x66\xa9\x1f\x59" | ||
| 5248 | "\xd9\xe2\x19\x36\xa3\x88\xb8\x0b" | ||
| 5249 | "\x0f\x4a\x4d\xf8\xc8\x6f\xd5\x43" | ||
| 5250 | "\xeb\xa0\xab\x1f\x61\xc0\x06\xeb" | ||
| 5251 | "\x93\xb7\xb8\x6f\x0d\xbd\x07\x49" | ||
| 5252 | "\xb3\xac\x5d\xcf\x31\xa0\x27\x26" | ||
| 5253 | "\x21\xbe\x94\x2e\x19\xea\xf4\xee" | ||
| 5254 | "\xb5\x13\x89\xf7\x94\x0b\xef\x59" | ||
| 5255 | "\x44\xc5\x78\x8b\x3c\x3b\x71\x20" | ||
| 5256 | "\xf9\x35\x0c\x70\x74\xdc\x5b\xc2" | ||
| 5257 | "\xb4\x11\x0e\x2c\x61\xa1\x52\x46" | ||
| 5258 | "\x18\x11\x16\xc6\x86\x44\xa7\xaf" | ||
| 5259 | "\xd5\x0c\x7d\xa6\x9e\x25\x2d\x1b" | ||
| 5260 | "\x9a\x8f\x0f\xf8\x6a\x61\xa0\xea" | ||
| 5261 | "\x3f\x0e\x90\xd6\x8f\x83\x30\x64" | ||
| 5262 | "\xb5\x51\x2d\x08\x3c\xcd\x99\x36" | ||
| 5263 | "\x96\xd4\xb1\xb5\x48\x30\xca\x48" | ||
| 5264 | "\xf7\x11\xa8\xf5\x97\x8a\x6a\x6d" | ||
| 5265 | "\x12\x33\x2f\xc0\xe8\xda\xec\x8a" | ||
| 5266 | "\xe1\x88\x72\x63\xde\x20\xa3\xe1" | ||
| 5267 | "\x8e\xac\x84\x37\x35\xf5\xf7\x3f" | ||
| 5268 | "\x00\x02\x0e\xe4\xc1\x53\x68\x3f" | ||
| 5269 | "\xaa\xd5\xac\x52\x3d\x20\x2f\x4d" | ||
| 5270 | "\x7c\x83\xd0\xbd\xaa\x97\x35\x36" | ||
| 5271 | "\x98\x88\x59\x5d\xe7\x24\xe3\x90" | ||
| 5272 | "\x9d\x30\x47\xa7\xc3\x60\x35\xf4" | ||
| 5273 | "\xd5\xdb\x0e\x4d\x44\xc1\x81\x8b" | ||
| 5274 | "\xfd\xbd\xc3\x2b\xba\x68\xfe\x8d" | ||
| 5275 | "\x49\x5a\x3c\x8a\xa3\x01\xae\x25" | ||
| 5276 | "\x42\xab\xd2\x87\x1b\x35\xd6\xd2" | ||
| 5277 | "\xd7\x70\x1c\x1f\x72\xd1\xe1\x39" | ||
| 5278 | "\x1c\x58\xa2\xb4\xd0\x78\x55\x72" | ||
| 5279 | "\x76\x59\xea\xd9\xd7\x6e\x63\x8b" | ||
| 5280 | "\xcc\x9b\xa7\x74\x89\xfc\xa3\x68" | ||
| 5281 | "\x86\x28\xd1\xbb\x54\x8d\x66\xad" | ||
| 5282 | "\x2a\x92\xf9\x4e\x04\x3d\xae\xfd" | ||
| 5283 | "\x1b\x2b\x7f\xc3\x2f\x1a\x78\x0a" | ||
| 5284 | "\x5c\xc6\x84\xfe\x7c\xcb\x26\xfd" | ||
| 5285 | "\xd9\x51\x0f\xd7\x94\x2f\xc5\xa7", | ||
| 5286 | .ilen = 512, | ||
| 5287 | .result = "\x05\x11\xb7\x18\xab\xc6\x2d\xac" | ||
| 5288 | "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c" | ||
| 5289 | "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8" | ||
| 5290 | "\x50\x38\x1f\x71\x49\xb6\x57\xd6" | ||
| 5291 | "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90" | ||
| 5292 | "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6" | ||
| 5293 | "\xad\x1e\x9e\x20\x5f\x38\xbe\x04" | ||
| 5294 | "\xda\x10\x8e\xed\xa2\xa4\x87\xab" | ||
| 5295 | "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c" | ||
| 5296 | "\xc9\xac\x42\x31\x95\x7c\xc9\x04" | ||
| 5297 | "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6" | ||
| 5298 | "\x15\xd7\x3f\x4f\x2f\x66\x69\x03" | ||
| 5299 | "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65" | ||
| 5300 | "\x4c\x96\x12\xed\x7c\x92\x03\x01" | ||
| 5301 | "\x6f\xbc\x35\x93\xac\xf1\x27\xf1" | ||
| 5302 | "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50" | ||
| 5303 | "\x89\xa4\x8e\x66\x44\x85\xcc\xfd" | ||
| 5304 | "\x33\x14\x70\xe3\x96\xb2\xc3\xd3" | ||
| 5305 | "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5" | ||
| 5306 | "\x2d\x64\x75\xdd\xb4\x54\xe6\x74" | ||
| 5307 | "\x8c\xd3\x9d\x9e\x86\xab\x51\x53" | ||
| 5308 | "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40" | ||
| 5309 | "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5" | ||
| 5310 | "\x76\x12\x73\x44\x1a\x56\xd7\x72" | ||
| 5311 | "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda" | ||
| 5312 | "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd" | ||
| 5313 | "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60" | ||
| 5314 | "\x1a\xe2\x70\x85\x58\xc2\x1b\x09" | ||
| 5315 | "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9" | ||
| 5316 | "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8" | ||
| 5317 | "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8" | ||
| 5318 | "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10" | ||
| 5319 | "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1" | ||
| 5320 | "\x90\x3e\x76\x4a\x74\xa4\x21\x2c" | ||
| 5321 | "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e" | ||
| 5322 | "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f" | ||
| 5323 | "\x8d\x23\x31\x74\x84\xeb\x88\x6e" | ||
| 5324 | "\xcc\xb9\xbc\x22\x83\x19\x07\x22" | ||
| 5325 | "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78" | ||
| 5326 | "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5" | ||
| 5327 | "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41" | ||
| 5328 | "\x3c\xce\x8f\x42\x60\x71\xa7\x75" | ||
| 5329 | "\x08\x40\x65\x8a\x82\xbf\xf5\x43" | ||
| 5330 | "\x71\x96\xa9\x4d\x44\x8a\x20\xbe" | ||
| 5331 | "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65" | ||
| 5332 | "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9" | ||
| 5333 | "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4" | ||
| 5334 | "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a" | ||
| 5335 | "\x62\x73\x65\xfd\x46\x63\x25\x3d" | ||
| 5336 | "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf" | ||
| 5337 | "\x24\xf3\xb4\xac\x64\xba\xdf\x4b" | ||
| 5338 | "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7" | ||
| 5339 | "\xc5\x68\x77\x84\x32\x2b\xcc\x85" | ||
| 5340 | "\x74\x96\xf0\x12\x77\x61\xb9\xeb" | ||
| 5341 | "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8" | ||
| 5342 | "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24" | ||
| 5343 | "\xda\x39\x87\x45\xc0\x2b\xbb\x01" | ||
| 5344 | "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce" | ||
| 5345 | "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6" | ||
| 5346 | "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32" | ||
| 5347 | "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45" | ||
| 5348 | "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6" | ||
| 5349 | "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" | ||
| 5350 | "\x21\xc4\xc2\x75\x67\x89\x37\x0a", | ||
| 5351 | .rlen = 512, | ||
| 5352 | }, | ||
| 5353 | }; | ||
| 5354 | |||
| 5355 | static struct cipher_testvec serpent_xts_enc_tv_template[] = { | ||
| 5356 | /* Generated from AES-XTS test vectors */ | ||
| 5357 | { | ||
| 5358 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5359 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5360 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5361 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5362 | .klen = 32, | ||
| 5363 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5364 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5365 | .input = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5366 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5367 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5368 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5369 | .ilen = 32, | ||
| 5370 | .result = "\xe1\x08\xb8\x1d\x2c\xf5\x33\x64" | ||
| 5371 | "\xc8\x12\x04\xc7\xb3\x70\xe8\xc4" | ||
| 5372 | "\x6a\x31\xc5\xf3\x00\xca\xb9\x16" | ||
| 5373 | "\xde\xe2\x77\x66\xf7\xfe\x62\x08", | ||
| 5374 | .rlen = 32, | ||
| 5375 | }, { | ||
| 5376 | .key = "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
| 5377 | "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
| 5378 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
| 5379 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
| 5380 | .klen = 32, | ||
| 5381 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
| 5382 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5383 | .input = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5384 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5385 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5386 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
| 5387 | .ilen = 32, | ||
| 5388 | .result = "\x1a\x0a\x09\x5f\xcd\x07\x07\x98" | ||
| 5389 | "\x41\x86\x12\xaf\xb3\xd7\x68\x13" | ||
| 5390 | "\xed\x81\xcd\x06\x87\x43\x1a\xbb" | ||
| 5391 | "\x13\x3d\xd6\x1e\x2b\xe1\x77\xbe", | ||
| 5392 | .rlen = 32, | ||
| 5393 | }, { | ||
| 5394 | .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" | ||
| 5395 | "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" | ||
| 5396 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
| 5397 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
| 5398 | .klen = 32, | ||
| 5399 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
| 5400 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5401 | .input = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5402 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5403 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5404 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
| 5405 | .ilen = 32, | ||
| 5406 | .result = "\xf9\x9b\x28\xb8\x5c\xaf\x8c\x61" | ||
| 5407 | "\xb6\x1c\x81\x8f\x2c\x87\x60\x89" | ||
| 5408 | "\x0d\x8d\x7a\xe8\x60\x48\xcc\x86" | ||
| 5409 | "\xc1\x68\x45\xaa\x00\xe9\x24\xc5", | ||
| 5410 | .rlen = 32, | ||
| 5411 | }, { | ||
| 5412 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
| 5413 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
| 5414 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
| 5415 | "\x23\x84\x62\x64\x33\x83\x27\x95", | ||
| 5416 | .klen = 32, | ||
| 5417 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5418 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5419 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 5420 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 5421 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 5422 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 5423 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 5424 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 5425 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5426 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 5427 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 5428 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 5429 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 5430 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 5431 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 5432 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 5433 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 5434 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 5435 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 5436 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 5437 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 5438 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 5439 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 5440 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 5441 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 5442 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 5443 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 5444 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 5445 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 5446 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 5447 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 5448 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 5449 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 5450 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
| 5451 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 5452 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 5453 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 5454 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 5455 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 5456 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 5457 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5458 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 5459 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 5460 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 5461 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 5462 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 5463 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 5464 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 5465 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 5466 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 5467 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 5468 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 5469 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 5470 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 5471 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 5472 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 5473 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 5474 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 5475 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 5476 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 5477 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 5478 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 5479 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 5480 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 5481 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 5482 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
| 5483 | .ilen = 512, | ||
| 5484 | .result = "\xfe\x47\x4a\xc8\x60\x7e\xb4\x8b" | ||
| 5485 | "\x0d\x10\xf4\xb0\x0d\xba\xf8\x53" | ||
| 5486 | "\x65\x6e\x38\x4b\xdb\xaa\xb1\x9e" | ||
| 5487 | "\x28\xca\xb0\x22\xb3\x85\x75\xf4" | ||
| 5488 | "\x00\x5c\x75\x14\x06\xd6\x25\x82" | ||
| 5489 | "\xe6\xcb\x08\xf7\x29\x90\x23\x8e" | ||
| 5490 | "\xa4\x68\x57\xe4\xf0\xd8\x32\xf3" | ||
| 5491 | "\x80\x51\x67\xb5\x0b\x85\x69\xe8" | ||
| 5492 | "\x19\xfe\xc4\xc7\x3e\xea\x90\xd3" | ||
| 5493 | "\x8f\xa3\xf2\x0a\xac\x17\x4b\xa0" | ||
| 5494 | "\x63\x5a\x16\x0f\xf0\xce\x66\x1f" | ||
| 5495 | "\x2c\x21\x07\xf1\xa4\x03\xa3\x44" | ||
| 5496 | "\x41\x61\x87\x5d\x6b\xb3\xef\xd4" | ||
| 5497 | "\xfc\xaa\x32\x7e\x55\x58\x04\x41" | ||
| 5498 | "\xc9\x07\x33\xc6\xa2\x68\xd6\x5a" | ||
| 5499 | "\x55\x79\x4b\x6f\xcf\x89\xb9\x19" | ||
| 5500 | "\xe5\x54\x13\x15\xb2\x1a\xfa\x15" | ||
| 5501 | "\xc2\xf0\x06\x59\xfa\xa0\x25\x05" | ||
| 5502 | "\x58\xfa\x43\x91\x16\x85\x40\xbb" | ||
| 5503 | "\x0d\x34\x4d\xc5\x1e\x20\xd5\x08" | ||
| 5504 | "\xcd\x22\x22\x41\x11\x9f\x6c\x7c" | ||
| 5505 | "\x8d\x57\xc9\xba\x57\xe8\x2c\xf7" | ||
| 5506 | "\xa0\x42\xa8\xde\xfc\xa3\xca\x98" | ||
| 5507 | "\x4b\x43\xb1\xce\x4b\xbf\x01\x67" | ||
| 5508 | "\x6e\x29\x60\xbd\x10\x14\x84\x82" | ||
| 5509 | "\x83\x82\x0c\x63\x73\x92\x02\x7c" | ||
| 5510 | "\x55\x37\x20\x80\x17\x51\xc8\xbc" | ||
| 5511 | "\x46\x02\xcb\x38\x07\x6d\xe2\x85" | ||
| 5512 | "\xaa\x29\xaf\x24\x58\x0d\xf0\x75" | ||
| 5513 | "\x08\x0a\xa5\x34\x25\x16\xf3\x74" | ||
| 5514 | "\xa7\x0b\x97\xbe\xc1\xa9\xdc\x29" | ||
| 5515 | "\x1a\x0a\x56\xc1\x1a\x91\x97\x8c" | ||
| 5516 | "\x0b\xc7\x16\xed\x5a\x22\xa6\x2e" | ||
| 5517 | "\x8c\x2b\x4f\x54\x76\x47\x53\x8e" | ||
| 5518 | "\xe8\x00\xec\x92\xb9\x55\xe6\xa2" | ||
| 5519 | "\xf3\xe2\x4f\x6a\x66\x60\xd0\x87" | ||
| 5520 | "\xe6\xd1\xcc\xe3\x6a\xc5\x2d\x21" | ||
| 5521 | "\xcc\x9d\x6a\xb6\x75\xaa\xe2\x19" | ||
| 5522 | "\x21\x9f\xa1\x5e\x4c\xfd\x72\xf9" | ||
| 5523 | "\x94\x4e\x63\xc7\xae\xfc\xed\x47" | ||
| 5524 | "\xe2\xfe\x7a\x63\x77\xfe\x97\x82" | ||
| 5525 | "\xb1\x10\x6e\x36\x1d\xe1\xc4\x80" | ||
| 5526 | "\xec\x69\x41\xec\xa7\x8a\xe0\x2f" | ||
| 5527 | "\xe3\x49\x26\xa2\x41\xb2\x08\x0f" | ||
| 5528 | "\x28\xb4\xa7\x39\xa1\x99\x2d\x1e" | ||
| 5529 | "\x43\x42\x35\xd0\xcf\xec\x77\x67" | ||
| 5530 | "\xb2\x3b\x9e\x1c\x35\xde\x4f\x5e" | ||
| 5531 | "\x73\x3f\x5d\x6f\x07\x4b\x2e\x50" | ||
| 5532 | "\xab\x6c\x6b\xff\xea\x00\x67\xaa" | ||
| 5533 | "\x0e\x82\x32\xdd\x3d\xb5\xe5\x76" | ||
| 5534 | "\x2b\x77\x3f\xbe\x12\x75\xfb\x92" | ||
| 5535 | "\xc6\x89\x67\x4d\xca\xf7\xd4\x50" | ||
| 5536 | "\xc0\x74\x47\xcc\xd9\x0a\xd4\xc6" | ||
| 5537 | "\x3b\x17\x2e\xe3\x35\xbb\x53\xb5" | ||
| 5538 | "\x86\xad\x51\xcc\xd5\x96\xb8\xdc" | ||
| 5539 | "\x03\x57\xe6\x98\x52\x2f\x61\x62" | ||
| 5540 | "\xc4\x5c\x9c\x36\x71\x07\xfb\x94" | ||
| 5541 | "\xe3\x02\xc4\x2b\x08\x75\xc7\x35" | ||
| 5542 | "\xfb\x2e\x88\x7b\xbb\x67\x00\xe1" | ||
| 5543 | "\xc9\xdd\x99\xb2\x13\x53\x1a\x4e" | ||
| 5544 | "\x76\x87\x19\x04\x1a\x2f\x38\x3e" | ||
| 5545 | "\xef\x91\x64\x1d\x18\x07\x4e\x31" | ||
| 5546 | "\x88\x21\x7c\xb0\xa5\x12\x4c\x3c" | ||
| 5547 | "\xb0\x20\xbd\xda\xdf\xf9\x7c\xdd", | ||
| 5548 | .rlen = 512, | ||
| 5549 | }, { | ||
| 5550 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
| 5551 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
| 5552 | "\x62\x49\x77\x57\x24\x70\x93\x69" | ||
| 5553 | "\x99\x59\x57\x49\x66\x96\x76\x27" | ||
| 5554 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
| 5555 | "\x23\x84\x62\x64\x33\x83\x27\x95" | ||
| 5556 | "\x02\x88\x41\x97\x16\x93\x99\x37" | ||
| 5557 | "\x51\x05\x82\x09\x74\x94\x45\x92", | ||
| 5558 | .klen = 64, | ||
| 5559 | .iv = "\xff\x00\x00\x00\x00\x00\x00\x00" | ||
| 5560 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5561 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 5562 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 5563 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 5564 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 5565 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 5566 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 5567 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5568 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 5569 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 5570 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 5571 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 5572 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 5573 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 5574 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 5575 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 5576 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 5577 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 5578 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 5579 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 5580 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 5581 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 5582 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 5583 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 5584 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 5585 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 5586 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 5587 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 5588 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 5589 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 5590 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 5591 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 5592 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
| 5593 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 5594 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 5595 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 5596 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 5597 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 5598 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 5599 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5600 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 5601 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 5602 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 5603 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 5604 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 5605 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 5606 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 5607 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 5608 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 5609 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 5610 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 5611 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 5612 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 5613 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 5614 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 5615 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 5616 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 5617 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 5618 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 5619 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 5620 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 5621 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 5622 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 5623 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 5624 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
| 5625 | .ilen = 512, | ||
| 5626 | .result = "\x2b\xc9\xb4\x6b\x10\x94\xa9\x32" | ||
| 5627 | "\xaa\xb0\x20\xc6\x44\x3d\x74\x1f" | ||
| 5628 | "\x75\x01\xa7\xf6\xf5\xf7\x62\x1b" | ||
| 5629 | "\x80\x1b\x82\xcb\x01\x59\x91\x7f" | ||
| 5630 | "\x80\x3a\x98\xf0\xd2\xca\xc4\xc3" | ||
| 5631 | "\x34\xfd\xe6\x11\xf9\x33\x45\x12" | ||
| 5632 | "\x48\xc5\x8c\x25\xf1\xc5\xc5\x23" | ||
| 5633 | "\xd3\x44\xb4\x73\xd5\x04\xc0\xb7" | ||
| 5634 | "\xca\x2f\xf5\xcd\xc5\xb4\xdd\xb0" | ||
| 5635 | "\xf4\x60\xe8\xfb\xc6\x9c\xc5\x78" | ||
| 5636 | "\xcd\xec\x7d\xdc\x19\x9c\x72\x64" | ||
| 5637 | "\x63\x0b\x38\x2e\x76\xdd\x2d\x36" | ||
| 5638 | "\x49\xb0\x1d\xea\x78\x9e\x00\xca" | ||
| 5639 | "\x20\xcc\x1b\x1e\x98\x74\xab\xed" | ||
| 5640 | "\x79\xf7\xd0\x6c\xd8\x93\x80\x29" | ||
| 5641 | "\xac\xa5\x5e\x34\xa9\xab\xa0\x55" | ||
| 5642 | "\x9a\xea\xaa\x95\x4d\x7b\xfe\x46" | ||
| 5643 | "\x26\x8a\xfd\x88\xa2\xa8\xa6\xae" | ||
| 5644 | "\x25\x42\x17\xbf\x76\x8f\x1c\x3d" | ||
| 5645 | "\xec\x9a\xda\x64\x96\xb5\x61\xff" | ||
| 5646 | "\x99\xeb\x12\x96\x85\x82\x9d\xd5" | ||
| 5647 | "\x81\x85\x14\xa8\x59\xac\x8c\x94" | ||
| 5648 | "\xbb\x3b\x85\x2b\xdf\xb3\x0c\xba" | ||
| 5649 | "\x82\xc6\x4d\xca\x86\xea\x53\x28" | ||
| 5650 | "\x4c\xe0\x4e\x31\xe3\x73\x2f\x79" | ||
| 5651 | "\x9d\x42\xe1\x03\xe3\x8b\xc4\xff" | ||
| 5652 | "\x05\xca\x81\x7b\xda\xa2\xde\x63" | ||
| 5653 | "\x3a\x10\xbe\xc2\xac\x32\xc4\x05" | ||
| 5654 | "\x47\x7e\xef\x67\xe2\x5f\x5b\xae" | ||
| 5655 | "\xed\xf1\x70\x34\x16\x9a\x07\x7b" | ||
| 5656 | "\xf2\x25\x2b\xb0\xf8\x3c\x15\x9a" | ||
| 5657 | "\xa6\x59\x55\x5f\xc1\xf4\x1e\xcd" | ||
| 5658 | "\x93\x1f\x06\xba\xd4\x9a\x22\x69" | ||
| 5659 | "\xfa\x8e\x95\x0d\xf3\x23\x59\x2c" | ||
| 5660 | "\xfe\x00\xba\xf0\x0e\xbc\x6d\xd6" | ||
| 5661 | "\x62\xf0\x7a\x0e\x83\x3e\xdb\x32" | ||
| 5662 | "\xfd\x43\x7d\xda\x42\x51\x87\x43" | ||
| 5663 | "\x9d\xf9\xef\xf4\x30\x97\xf8\x09" | ||
| 5664 | "\x88\xfc\x3f\x93\x70\xc1\x4a\xec" | ||
| 5665 | "\x27\x5f\x11\xac\x71\xc7\x48\x46" | ||
| 5666 | "\x2f\xf9\xdf\x8d\x9f\xf7\x2e\x56" | ||
| 5667 | "\x0d\x4e\xb0\x32\x76\xce\x86\x81" | ||
| 5668 | "\xcd\xdf\xe4\x00\xbf\xfd\x5f\x24" | ||
| 5669 | "\xaf\xf7\x9a\xde\xff\x18\xac\x14" | ||
| 5670 | "\x90\xc5\x01\x39\x34\x0f\x24\xf3" | ||
| 5671 | "\x13\x2f\x5e\x4f\x30\x9a\x36\x40" | ||
| 5672 | "\xec\xea\xbc\xcd\x9e\x0e\x5b\x23" | ||
| 5673 | "\x50\x88\x97\x40\x69\xb1\x37\xf5" | ||
| 5674 | "\xc3\x15\xf9\x3f\xb7\x79\x64\xe8" | ||
| 5675 | "\x7b\x10\x20\xb9\x2b\x46\x83\x5b" | ||
| 5676 | "\xd8\x39\xfc\xe4\xfa\x88\x52\xf2" | ||
| 5677 | "\x72\xb0\x97\x4e\x89\xb3\x48\x00" | ||
| 5678 | "\xc1\x16\x73\x50\x77\xba\xa6\x65" | ||
| 5679 | "\x20\x2d\xb0\x02\x27\x89\xda\x99" | ||
| 5680 | "\x45\xfb\xe9\xd3\x1d\x39\x2f\xd6" | ||
| 5681 | "\x2a\xda\x09\x12\x11\xaf\xe6\x57" | ||
| 5682 | "\x01\x04\x8a\xff\x86\x8b\xac\xf8" | ||
| 5683 | "\xee\xe4\x1c\x98\x5b\xcf\x6b\x76" | ||
| 5684 | "\xa3\x0e\x33\x74\x40\x18\x39\x72" | ||
| 5685 | "\x66\x50\x31\xfd\x70\xdf\xe8\x51" | ||
| 5686 | "\x96\x21\x36\xb2\x9b\xfa\x85\xd1" | ||
| 5687 | "\x30\x05\xc8\x92\x98\x80\xff\x7a" | ||
| 5688 | "\xaf\x43\x0b\xc5\x20\x41\x92\x20" | ||
| 5689 | "\xd4\xa0\x91\x98\x11\x5f\x4d\xb1", | ||
| 5690 | .rlen = 512, | ||
| 5691 | }, | ||
| 5692 | }; | ||
| 5693 | |||
| 5694 | static struct cipher_testvec serpent_xts_dec_tv_template[] = { | ||
| 5695 | /* Generated from AES-XTS test vectors */ | ||
| 5696 | /* same as enc vectors with input and result reversed */ | ||
| 5697 | { | ||
| 5698 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5699 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5700 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5701 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5702 | .klen = 32, | ||
| 5703 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5704 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5705 | .input = "\xe1\x08\xb8\x1d\x2c\xf5\x33\x64" | ||
| 5706 | "\xc8\x12\x04\xc7\xb3\x70\xe8\xc4" | ||
| 5707 | "\x6a\x31\xc5\xf3\x00\xca\xb9\x16" | ||
| 5708 | "\xde\xe2\x77\x66\xf7\xfe\x62\x08", | ||
| 5709 | .ilen = 32, | ||
| 5710 | .result = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5711 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5712 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5713 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5714 | .rlen = 32, | ||
| 5715 | }, { | ||
| 5716 | .key = "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
| 5717 | "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
| 5718 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
| 5719 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
| 5720 | .klen = 32, | ||
| 5721 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
| 5722 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5723 | .input = "\x1a\x0a\x09\x5f\xcd\x07\x07\x98" | ||
| 5724 | "\x41\x86\x12\xaf\xb3\xd7\x68\x13" | ||
| 5725 | "\xed\x81\xcd\x06\x87\x43\x1a\xbb" | ||
| 5726 | "\x13\x3d\xd6\x1e\x2b\xe1\x77\xbe", | ||
| 5727 | .ilen = 32, | ||
| 5728 | .result = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5729 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5730 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5731 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
| 5732 | .rlen = 32, | ||
| 5733 | }, { | ||
| 5734 | .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" | ||
| 5735 | "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" | ||
| 5736 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
| 5737 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
| 5738 | .klen = 32, | ||
| 5739 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
| 5740 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5741 | .input = "\xf9\x9b\x28\xb8\x5c\xaf\x8c\x61" | ||
| 5742 | "\xb6\x1c\x81\x8f\x2c\x87\x60\x89" | ||
| 5743 | "\x0d\x8d\x7a\xe8\x60\x48\xcc\x86" | ||
| 5744 | "\xc1\x68\x45\xaa\x00\xe9\x24\xc5", | ||
| 5745 | .ilen = 32, | ||
| 5746 | .result = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5747 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5748 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
| 5749 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
| 5750 | .rlen = 32, | ||
| 5751 | }, { | ||
| 5752 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
| 5753 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
| 5754 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
| 5755 | "\x23\x84\x62\x64\x33\x83\x27\x95", | ||
| 5756 | .klen = 32, | ||
| 5757 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| 5758 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5759 | .input = "\xfe\x47\x4a\xc8\x60\x7e\xb4\x8b" | ||
| 5760 | "\x0d\x10\xf4\xb0\x0d\xba\xf8\x53" | ||
| 5761 | "\x65\x6e\x38\x4b\xdb\xaa\xb1\x9e" | ||
| 5762 | "\x28\xca\xb0\x22\xb3\x85\x75\xf4" | ||
| 5763 | "\x00\x5c\x75\x14\x06\xd6\x25\x82" | ||
| 5764 | "\xe6\xcb\x08\xf7\x29\x90\x23\x8e" | ||
| 5765 | "\xa4\x68\x57\xe4\xf0\xd8\x32\xf3" | ||
| 5766 | "\x80\x51\x67\xb5\x0b\x85\x69\xe8" | ||
| 5767 | "\x19\xfe\xc4\xc7\x3e\xea\x90\xd3" | ||
| 5768 | "\x8f\xa3\xf2\x0a\xac\x17\x4b\xa0" | ||
| 5769 | "\x63\x5a\x16\x0f\xf0\xce\x66\x1f" | ||
| 5770 | "\x2c\x21\x07\xf1\xa4\x03\xa3\x44" | ||
| 5771 | "\x41\x61\x87\x5d\x6b\xb3\xef\xd4" | ||
| 5772 | "\xfc\xaa\x32\x7e\x55\x58\x04\x41" | ||
| 5773 | "\xc9\x07\x33\xc6\xa2\x68\xd6\x5a" | ||
| 5774 | "\x55\x79\x4b\x6f\xcf\x89\xb9\x19" | ||
| 5775 | "\xe5\x54\x13\x15\xb2\x1a\xfa\x15" | ||
| 5776 | "\xc2\xf0\x06\x59\xfa\xa0\x25\x05" | ||
| 5777 | "\x58\xfa\x43\x91\x16\x85\x40\xbb" | ||
| 5778 | "\x0d\x34\x4d\xc5\x1e\x20\xd5\x08" | ||
| 5779 | "\xcd\x22\x22\x41\x11\x9f\x6c\x7c" | ||
| 5780 | "\x8d\x57\xc9\xba\x57\xe8\x2c\xf7" | ||
| 5781 | "\xa0\x42\xa8\xde\xfc\xa3\xca\x98" | ||
| 5782 | "\x4b\x43\xb1\xce\x4b\xbf\x01\x67" | ||
| 5783 | "\x6e\x29\x60\xbd\x10\x14\x84\x82" | ||
| 5784 | "\x83\x82\x0c\x63\x73\x92\x02\x7c" | ||
| 5785 | "\x55\x37\x20\x80\x17\x51\xc8\xbc" | ||
| 5786 | "\x46\x02\xcb\x38\x07\x6d\xe2\x85" | ||
| 5787 | "\xaa\x29\xaf\x24\x58\x0d\xf0\x75" | ||
| 5788 | "\x08\x0a\xa5\x34\x25\x16\xf3\x74" | ||
| 5789 | "\xa7\x0b\x97\xbe\xc1\xa9\xdc\x29" | ||
| 5790 | "\x1a\x0a\x56\xc1\x1a\x91\x97\x8c" | ||
| 5791 | "\x0b\xc7\x16\xed\x5a\x22\xa6\x2e" | ||
| 5792 | "\x8c\x2b\x4f\x54\x76\x47\x53\x8e" | ||
| 5793 | "\xe8\x00\xec\x92\xb9\x55\xe6\xa2" | ||
| 5794 | "\xf3\xe2\x4f\x6a\x66\x60\xd0\x87" | ||
| 5795 | "\xe6\xd1\xcc\xe3\x6a\xc5\x2d\x21" | ||
| 5796 | "\xcc\x9d\x6a\xb6\x75\xaa\xe2\x19" | ||
| 5797 | "\x21\x9f\xa1\x5e\x4c\xfd\x72\xf9" | ||
| 5798 | "\x94\x4e\x63\xc7\xae\xfc\xed\x47" | ||
| 5799 | "\xe2\xfe\x7a\x63\x77\xfe\x97\x82" | ||
| 5800 | "\xb1\x10\x6e\x36\x1d\xe1\xc4\x80" | ||
| 5801 | "\xec\x69\x41\xec\xa7\x8a\xe0\x2f" | ||
| 5802 | "\xe3\x49\x26\xa2\x41\xb2\x08\x0f" | ||
| 5803 | "\x28\xb4\xa7\x39\xa1\x99\x2d\x1e" | ||
| 5804 | "\x43\x42\x35\xd0\xcf\xec\x77\x67" | ||
| 5805 | "\xb2\x3b\x9e\x1c\x35\xde\x4f\x5e" | ||
| 5806 | "\x73\x3f\x5d\x6f\x07\x4b\x2e\x50" | ||
| 5807 | "\xab\x6c\x6b\xff\xea\x00\x67\xaa" | ||
| 5808 | "\x0e\x82\x32\xdd\x3d\xb5\xe5\x76" | ||
| 5809 | "\x2b\x77\x3f\xbe\x12\x75\xfb\x92" | ||
| 5810 | "\xc6\x89\x67\x4d\xca\xf7\xd4\x50" | ||
| 5811 | "\xc0\x74\x47\xcc\xd9\x0a\xd4\xc6" | ||
| 5812 | "\x3b\x17\x2e\xe3\x35\xbb\x53\xb5" | ||
| 5813 | "\x86\xad\x51\xcc\xd5\x96\xb8\xdc" | ||
| 5814 | "\x03\x57\xe6\x98\x52\x2f\x61\x62" | ||
| 5815 | "\xc4\x5c\x9c\x36\x71\x07\xfb\x94" | ||
| 5816 | "\xe3\x02\xc4\x2b\x08\x75\xc7\x35" | ||
| 5817 | "\xfb\x2e\x88\x7b\xbb\x67\x00\xe1" | ||
| 5818 | "\xc9\xdd\x99\xb2\x13\x53\x1a\x4e" | ||
| 5819 | "\x76\x87\x19\x04\x1a\x2f\x38\x3e" | ||
| 5820 | "\xef\x91\x64\x1d\x18\x07\x4e\x31" | ||
| 5821 | "\x88\x21\x7c\xb0\xa5\x12\x4c\x3c" | ||
| 5822 | "\xb0\x20\xbd\xda\xdf\xf9\x7c\xdd", | ||
| 5823 | .ilen = 512, | ||
| 5824 | .result = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 5825 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 5826 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 5827 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 5828 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 5829 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 5830 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5831 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 5832 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 5833 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 5834 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 5835 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 5836 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 5837 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 5838 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 5839 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 5840 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 5841 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 5842 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 5843 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 5844 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 5845 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 5846 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 5847 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 5848 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 5849 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 5850 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 5851 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 5852 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 5853 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 5854 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 5855 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
| 5856 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 5857 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 5858 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 5859 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 5860 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 5861 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 5862 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5863 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 5864 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 5865 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 5866 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 5867 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 5868 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 5869 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 5870 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 5871 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 5872 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 5873 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 5874 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 5875 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 5876 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 5877 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 5878 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 5879 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 5880 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 5881 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 5882 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 5883 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 5884 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 5885 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 5886 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 5887 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
| 5888 | .rlen = 512, | ||
| 5889 | }, { | ||
| 5890 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
| 5891 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
| 5892 | "\x62\x49\x77\x57\x24\x70\x93\x69" | ||
| 5893 | "\x99\x59\x57\x49\x66\x96\x76\x27" | ||
| 5894 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
| 5895 | "\x23\x84\x62\x64\x33\x83\x27\x95" | ||
| 5896 | "\x02\x88\x41\x97\x16\x93\x99\x37" | ||
| 5897 | "\x51\x05\x82\x09\x74\x94\x45\x92", | ||
| 5898 | .klen = 64, | ||
| 5899 | .iv = "\xff\x00\x00\x00\x00\x00\x00\x00" | ||
| 5900 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
| 5901 | .input = "\x2b\xc9\xb4\x6b\x10\x94\xa9\x32" | ||
| 5902 | "\xaa\xb0\x20\xc6\x44\x3d\x74\x1f" | ||
| 5903 | "\x75\x01\xa7\xf6\xf5\xf7\x62\x1b" | ||
| 5904 | "\x80\x1b\x82\xcb\x01\x59\x91\x7f" | ||
| 5905 | "\x80\x3a\x98\xf0\xd2\xca\xc4\xc3" | ||
| 5906 | "\x34\xfd\xe6\x11\xf9\x33\x45\x12" | ||
| 5907 | "\x48\xc5\x8c\x25\xf1\xc5\xc5\x23" | ||
| 5908 | "\xd3\x44\xb4\x73\xd5\x04\xc0\xb7" | ||
| 5909 | "\xca\x2f\xf5\xcd\xc5\xb4\xdd\xb0" | ||
| 5910 | "\xf4\x60\xe8\xfb\xc6\x9c\xc5\x78" | ||
| 5911 | "\xcd\xec\x7d\xdc\x19\x9c\x72\x64" | ||
| 5912 | "\x63\x0b\x38\x2e\x76\xdd\x2d\x36" | ||
| 5913 | "\x49\xb0\x1d\xea\x78\x9e\x00\xca" | ||
| 5914 | "\x20\xcc\x1b\x1e\x98\x74\xab\xed" | ||
| 5915 | "\x79\xf7\xd0\x6c\xd8\x93\x80\x29" | ||
| 5916 | "\xac\xa5\x5e\x34\xa9\xab\xa0\x55" | ||
| 5917 | "\x9a\xea\xaa\x95\x4d\x7b\xfe\x46" | ||
| 5918 | "\x26\x8a\xfd\x88\xa2\xa8\xa6\xae" | ||
| 5919 | "\x25\x42\x17\xbf\x76\x8f\x1c\x3d" | ||
| 5920 | "\xec\x9a\xda\x64\x96\xb5\x61\xff" | ||
| 5921 | "\x99\xeb\x12\x96\x85\x82\x9d\xd5" | ||
| 5922 | "\x81\x85\x14\xa8\x59\xac\x8c\x94" | ||
| 5923 | "\xbb\x3b\x85\x2b\xdf\xb3\x0c\xba" | ||
| 5924 | "\x82\xc6\x4d\xca\x86\xea\x53\x28" | ||
| 5925 | "\x4c\xe0\x4e\x31\xe3\x73\x2f\x79" | ||
| 5926 | "\x9d\x42\xe1\x03\xe3\x8b\xc4\xff" | ||
| 5927 | "\x05\xca\x81\x7b\xda\xa2\xde\x63" | ||
| 5928 | "\x3a\x10\xbe\xc2\xac\x32\xc4\x05" | ||
| 5929 | "\x47\x7e\xef\x67\xe2\x5f\x5b\xae" | ||
| 5930 | "\xed\xf1\x70\x34\x16\x9a\x07\x7b" | ||
| 5931 | "\xf2\x25\x2b\xb0\xf8\x3c\x15\x9a" | ||
| 5932 | "\xa6\x59\x55\x5f\xc1\xf4\x1e\xcd" | ||
| 5933 | "\x93\x1f\x06\xba\xd4\x9a\x22\x69" | ||
| 5934 | "\xfa\x8e\x95\x0d\xf3\x23\x59\x2c" | ||
| 5935 | "\xfe\x00\xba\xf0\x0e\xbc\x6d\xd6" | ||
| 5936 | "\x62\xf0\x7a\x0e\x83\x3e\xdb\x32" | ||
| 5937 | "\xfd\x43\x7d\xda\x42\x51\x87\x43" | ||
| 5938 | "\x9d\xf9\xef\xf4\x30\x97\xf8\x09" | ||
| 5939 | "\x88\xfc\x3f\x93\x70\xc1\x4a\xec" | ||
| 5940 | "\x27\x5f\x11\xac\x71\xc7\x48\x46" | ||
| 5941 | "\x2f\xf9\xdf\x8d\x9f\xf7\x2e\x56" | ||
| 5942 | "\x0d\x4e\xb0\x32\x76\xce\x86\x81" | ||
| 5943 | "\xcd\xdf\xe4\x00\xbf\xfd\x5f\x24" | ||
| 5944 | "\xaf\xf7\x9a\xde\xff\x18\xac\x14" | ||
| 5945 | "\x90\xc5\x01\x39\x34\x0f\x24\xf3" | ||
| 5946 | "\x13\x2f\x5e\x4f\x30\x9a\x36\x40" | ||
| 5947 | "\xec\xea\xbc\xcd\x9e\x0e\x5b\x23" | ||
| 5948 | "\x50\x88\x97\x40\x69\xb1\x37\xf5" | ||
| 5949 | "\xc3\x15\xf9\x3f\xb7\x79\x64\xe8" | ||
| 5950 | "\x7b\x10\x20\xb9\x2b\x46\x83\x5b" | ||
| 5951 | "\xd8\x39\xfc\xe4\xfa\x88\x52\xf2" | ||
| 5952 | "\x72\xb0\x97\x4e\x89\xb3\x48\x00" | ||
| 5953 | "\xc1\x16\x73\x50\x77\xba\xa6\x65" | ||
| 5954 | "\x20\x2d\xb0\x02\x27\x89\xda\x99" | ||
| 5955 | "\x45\xfb\xe9\xd3\x1d\x39\x2f\xd6" | ||
| 5956 | "\x2a\xda\x09\x12\x11\xaf\xe6\x57" | ||
| 5957 | "\x01\x04\x8a\xff\x86\x8b\xac\xf8" | ||
| 5958 | "\xee\xe4\x1c\x98\x5b\xcf\x6b\x76" | ||
| 5959 | "\xa3\x0e\x33\x74\x40\x18\x39\x72" | ||
| 5960 | "\x66\x50\x31\xfd\x70\xdf\xe8\x51" | ||
| 5961 | "\x96\x21\x36\xb2\x9b\xfa\x85\xd1" | ||
| 5962 | "\x30\x05\xc8\x92\x98\x80\xff\x7a" | ||
| 5963 | "\xaf\x43\x0b\xc5\x20\x41\x92\x20" | ||
| 5964 | "\xd4\xa0\x91\x98\x11\x5f\x4d\xb1", | ||
| 5965 | .ilen = 512, | ||
| 5966 | .result = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 5967 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 5968 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 5969 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 5970 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 5971 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 5972 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 5973 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 5974 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 5975 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 5976 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 5977 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 5978 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 5979 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 5980 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 5981 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 5982 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 5983 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 5984 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 5985 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 5986 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 5987 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 5988 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 5989 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 5990 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 5991 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 5992 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 5993 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 5994 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 5995 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 5996 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 5997 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
| 5998 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
| 5999 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
| 6000 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
| 6001 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
| 6002 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
| 6003 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
| 6004 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
| 6005 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
| 6006 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
| 6007 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
| 6008 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
| 6009 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
| 6010 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
| 6011 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
| 6012 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
| 6013 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
| 6014 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
| 6015 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
| 6016 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
| 6017 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
| 6018 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
| 6019 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
| 6020 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
| 6021 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
| 6022 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
| 6023 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
| 6024 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
| 6025 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
| 6026 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
| 6027 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
| 6028 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
| 6029 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
| 6030 | .rlen = 512, | ||
| 6031 | }, | ||
| 6032 | }; | ||
| 3278 | 6033 | ||
| 3279 | /* Cast6 test vectors from RFC 2612 */ | 6034 | /* Cast6 test vectors from RFC 2612 */ |
| 3280 | #define CAST6_ENC_TEST_VECTORS 3 | 6035 | #define CAST6_ENC_TEST_VECTORS 3 |
diff --git a/crypto/twofish_common.c b/crypto/twofish_common.c index 0af216c75d7e..5f62c4f9f6e0 100644 --- a/crypto/twofish_common.c +++ b/crypto/twofish_common.c | |||
| @@ -580,12 +580,9 @@ static const u8 calc_sb_tbl[512] = { | |||
| 580 | ctx->a[(j) + 1] = rol32(y, 9) | 580 | ctx->a[(j) + 1] = rol32(y, 9) |
| 581 | 581 | ||
| 582 | /* Perform the key setup. */ | 582 | /* Perform the key setup. */ |
| 583 | int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len) | 583 | int __twofish_setkey(struct twofish_ctx *ctx, const u8 *key, |
| 584 | unsigned int key_len, u32 *flags) | ||
| 584 | { | 585 | { |
| 585 | |||
| 586 | struct twofish_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 587 | u32 *flags = &tfm->crt_flags; | ||
| 588 | |||
| 589 | int i, j, k; | 586 | int i, j, k; |
| 590 | 587 | ||
| 591 | /* Temporaries for CALC_K. */ | 588 | /* Temporaries for CALC_K. */ |
| @@ -701,7 +698,13 @@ int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len) | |||
| 701 | 698 | ||
| 702 | return 0; | 699 | return 0; |
| 703 | } | 700 | } |
| 701 | EXPORT_SYMBOL_GPL(__twofish_setkey); | ||
| 704 | 702 | ||
| 703 | int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len) | ||
| 704 | { | ||
| 705 | return __twofish_setkey(crypto_tfm_ctx(tfm), key, key_len, | ||
| 706 | &tfm->crt_flags); | ||
| 707 | } | ||
| 705 | EXPORT_SYMBOL_GPL(twofish_setkey); | 708 | EXPORT_SYMBOL_GPL(twofish_setkey); |
| 706 | 709 | ||
| 707 | MODULE_LICENSE("GPL"); | 710 | MODULE_LICENSE("GPL"); |
diff --git a/crypto/xts.c b/crypto/xts.c index 851705446c82..ca1608f44cb5 100644 --- a/crypto/xts.c +++ b/crypto/xts.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/scatterlist.h> | 21 | #include <linux/scatterlist.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | 23 | ||
| 24 | #include <crypto/xts.h> | ||
| 24 | #include <crypto/b128ops.h> | 25 | #include <crypto/b128ops.h> |
| 25 | #include <crypto/gf128mul.h> | 26 | #include <crypto/gf128mul.h> |
| 26 | 27 | ||
| @@ -96,7 +97,7 @@ static int crypt(struct blkcipher_desc *d, | |||
| 96 | { | 97 | { |
| 97 | int err; | 98 | int err; |
| 98 | unsigned int avail; | 99 | unsigned int avail; |
| 99 | const int bs = crypto_cipher_blocksize(ctx->child); | 100 | const int bs = XTS_BLOCK_SIZE; |
| 100 | struct sinfo s = { | 101 | struct sinfo s = { |
| 101 | .tfm = crypto_cipher_tfm(ctx->child), | 102 | .tfm = crypto_cipher_tfm(ctx->child), |
| 102 | .fn = fn | 103 | .fn = fn |
| @@ -165,6 +166,78 @@ static int decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
| 165 | crypto_cipher_alg(ctx->child)->cia_decrypt); | 166 | crypto_cipher_alg(ctx->child)->cia_decrypt); |
| 166 | } | 167 | } |
| 167 | 168 | ||
| 169 | int xts_crypt(struct blkcipher_desc *desc, struct scatterlist *sdst, | ||
| 170 | struct scatterlist *ssrc, unsigned int nbytes, | ||
| 171 | struct xts_crypt_req *req) | ||
| 172 | { | ||
| 173 | const unsigned int bsize = XTS_BLOCK_SIZE; | ||
| 174 | const unsigned int max_blks = req->tbuflen / bsize; | ||
| 175 | struct blkcipher_walk walk; | ||
| 176 | unsigned int nblocks; | ||
| 177 | be128 *src, *dst, *t; | ||
| 178 | be128 *t_buf = req->tbuf; | ||
| 179 | int err, i; | ||
| 180 | |||
| 181 | BUG_ON(max_blks < 1); | ||
| 182 | |||
| 183 | blkcipher_walk_init(&walk, sdst, ssrc, nbytes); | ||
| 184 | |||
| 185 | err = blkcipher_walk_virt(desc, &walk); | ||
| 186 | nbytes = walk.nbytes; | ||
| 187 | if (!nbytes) | ||
| 188 | return err; | ||
| 189 | |||
| 190 | nblocks = min(nbytes / bsize, max_blks); | ||
| 191 | src = (be128 *)walk.src.virt.addr; | ||
| 192 | dst = (be128 *)walk.dst.virt.addr; | ||
| 193 | |||
| 194 | /* calculate first value of T */ | ||
| 195 | req->tweak_fn(req->tweak_ctx, (u8 *)&t_buf[0], walk.iv); | ||
| 196 | |||
| 197 | i = 0; | ||
| 198 | goto first; | ||
| 199 | |||
| 200 | for (;;) { | ||
| 201 | do { | ||
| 202 | for (i = 0; i < nblocks; i++) { | ||
| 203 | gf128mul_x_ble(&t_buf[i], t); | ||
| 204 | first: | ||
| 205 | t = &t_buf[i]; | ||
| 206 | |||
| 207 | /* PP <- T xor P */ | ||
| 208 | be128_xor(dst + i, t, src + i); | ||
| 209 | } | ||
| 210 | |||
| 211 | /* CC <- E(Key2,PP) */ | ||
| 212 | req->crypt_fn(req->crypt_ctx, (u8 *)dst, | ||
| 213 | nblocks * bsize); | ||
| 214 | |||
| 215 | /* C <- T xor CC */ | ||
| 216 | for (i = 0; i < nblocks; i++) | ||
| 217 | be128_xor(dst + i, dst + i, &t_buf[i]); | ||
| 218 | |||
| 219 | src += nblocks; | ||
| 220 | dst += nblocks; | ||
| 221 | nbytes -= nblocks * bsize; | ||
| 222 | nblocks = min(nbytes / bsize, max_blks); | ||
| 223 | } while (nblocks > 0); | ||
| 224 | |||
| 225 | *(be128 *)walk.iv = *t; | ||
| 226 | |||
| 227 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
| 228 | nbytes = walk.nbytes; | ||
| 229 | if (!nbytes) | ||
| 230 | break; | ||
| 231 | |||
| 232 | nblocks = min(nbytes / bsize, max_blks); | ||
| 233 | src = (be128 *)walk.src.virt.addr; | ||
| 234 | dst = (be128 *)walk.dst.virt.addr; | ||
| 235 | } | ||
| 236 | |||
| 237 | return err; | ||
| 238 | } | ||
| 239 | EXPORT_SYMBOL_GPL(xts_crypt); | ||
| 240 | |||
| 168 | static int init_tfm(struct crypto_tfm *tfm) | 241 | static int init_tfm(struct crypto_tfm *tfm) |
| 169 | { | 242 | { |
| 170 | struct crypto_cipher *cipher; | 243 | struct crypto_cipher *cipher; |
| @@ -177,7 +250,7 @@ static int init_tfm(struct crypto_tfm *tfm) | |||
| 177 | if (IS_ERR(cipher)) | 250 | if (IS_ERR(cipher)) |
| 178 | return PTR_ERR(cipher); | 251 | return PTR_ERR(cipher); |
| 179 | 252 | ||
| 180 | if (crypto_cipher_blocksize(cipher) != 16) { | 253 | if (crypto_cipher_blocksize(cipher) != XTS_BLOCK_SIZE) { |
| 181 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; | 254 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; |
| 182 | crypto_free_cipher(cipher); | 255 | crypto_free_cipher(cipher); |
| 183 | return -EINVAL; | 256 | return -EINVAL; |
| @@ -192,7 +265,7 @@ static int init_tfm(struct crypto_tfm *tfm) | |||
| 192 | } | 265 | } |
| 193 | 266 | ||
| 194 | /* this check isn't really needed, leave it here just in case */ | 267 | /* this check isn't really needed, leave it here just in case */ |
| 195 | if (crypto_cipher_blocksize(cipher) != 16) { | 268 | if (crypto_cipher_blocksize(cipher) != XTS_BLOCK_SIZE) { |
| 196 | crypto_free_cipher(cipher); | 269 | crypto_free_cipher(cipher); |
| 197 | crypto_free_cipher(ctx->child); | 270 | crypto_free_cipher(ctx->child); |
| 198 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; | 271 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; |
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c index 241df2e76aba..f518b99f53f5 100644 --- a/drivers/char/hw_random/atmel-rng.c +++ b/drivers/char/hw_random/atmel-rng.c | |||
| @@ -141,17 +141,7 @@ static struct platform_driver atmel_trng_driver = { | |||
| 141 | }, | 141 | }, |
| 142 | }; | 142 | }; |
| 143 | 143 | ||
| 144 | static int __init atmel_trng_init(void) | 144 | module_platform_driver(atmel_trng_driver); |
| 145 | { | ||
| 146 | return platform_driver_register(&atmel_trng_driver); | ||
| 147 | } | ||
| 148 | module_init(atmel_trng_init); | ||
| 149 | |||
| 150 | static void __exit atmel_trng_exit(void) | ||
| 151 | { | ||
| 152 | platform_driver_unregister(&atmel_trng_driver); | ||
| 153 | } | ||
| 154 | module_exit(atmel_trng_exit); | ||
| 155 | 145 | ||
| 156 | MODULE_LICENSE("GPL"); | 146 | MODULE_LICENSE("GPL"); |
| 157 | MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>"); | 147 | MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>"); |
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c index c3de70de00d4..ebd48f0135da 100644 --- a/drivers/char/hw_random/n2-drv.c +++ b/drivers/char/hw_random/n2-drv.c | |||
| @@ -770,15 +770,4 @@ static struct platform_driver n2rng_driver = { | |||
| 770 | .remove = __devexit_p(n2rng_remove), | 770 | .remove = __devexit_p(n2rng_remove), |
| 771 | }; | 771 | }; |
| 772 | 772 | ||
| 773 | static int __init n2rng_init(void) | 773 | module_platform_driver(n2rng_driver); |
| 774 | { | ||
| 775 | return platform_driver_register(&n2rng_driver); | ||
| 776 | } | ||
| 777 | |||
| 778 | static void __exit n2rng_exit(void) | ||
| 779 | { | ||
| 780 | platform_driver_unregister(&n2rng_driver); | ||
| 781 | } | ||
| 782 | |||
| 783 | module_init(n2rng_init); | ||
| 784 | module_exit(n2rng_exit); | ||
diff --git a/drivers/char/hw_random/octeon-rng.c b/drivers/char/hw_random/octeon-rng.c index 9cd0feca318c..0943edc782a1 100644 --- a/drivers/char/hw_random/octeon-rng.c +++ b/drivers/char/hw_random/octeon-rng.c | |||
| @@ -131,18 +131,7 @@ static struct platform_driver octeon_rng_driver = { | |||
| 131 | .remove = __exit_p(octeon_rng_remove), | 131 | .remove = __exit_p(octeon_rng_remove), |
| 132 | }; | 132 | }; |
| 133 | 133 | ||
| 134 | static int __init octeon_rng_mod_init(void) | 134 | module_platform_driver(octeon_rng_driver); |
| 135 | { | ||
| 136 | return platform_driver_register(&octeon_rng_driver); | ||
| 137 | } | ||
| 138 | |||
| 139 | static void __exit octeon_rng_mod_exit(void) | ||
| 140 | { | ||
| 141 | platform_driver_unregister(&octeon_rng_driver); | ||
| 142 | } | ||
| 143 | |||
| 144 | module_init(octeon_rng_mod_init); | ||
| 145 | module_exit(octeon_rng_mod_exit); | ||
| 146 | 135 | ||
| 147 | MODULE_AUTHOR("David Daney"); | 136 | MODULE_AUTHOR("David Daney"); |
| 148 | MODULE_LICENSE("GPL"); | 137 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c index 1d504815e6db..3a632673aed5 100644 --- a/drivers/char/hw_random/pasemi-rng.c +++ b/drivers/char/hw_random/pasemi-rng.c | |||
| @@ -148,17 +148,7 @@ static struct platform_driver rng_driver = { | |||
| 148 | .remove = rng_remove, | 148 | .remove = rng_remove, |
| 149 | }; | 149 | }; |
| 150 | 150 | ||
| 151 | static int __init rng_init(void) | 151 | module_platform_driver(rng_driver); |
| 152 | { | ||
| 153 | return platform_driver_register(&rng_driver); | ||
| 154 | } | ||
| 155 | module_init(rng_init); | ||
| 156 | |||
| 157 | static void __exit rng_exit(void) | ||
| 158 | { | ||
| 159 | platform_driver_unregister(&rng_driver); | ||
| 160 | } | ||
| 161 | module_exit(rng_exit); | ||
| 162 | 152 | ||
| 163 | MODULE_LICENSE("GPL"); | 153 | MODULE_LICENSE("GPL"); |
| 164 | MODULE_AUTHOR("Egor Martovetsky <egor@pasemi.com>"); | 154 | MODULE_AUTHOR("Egor Martovetsky <egor@pasemi.com>"); |
diff --git a/drivers/char/hw_random/picoxcell-rng.c b/drivers/char/hw_random/picoxcell-rng.c index 990d55a5e3e8..97bd891422c7 100644 --- a/drivers/char/hw_random/picoxcell-rng.c +++ b/drivers/char/hw_random/picoxcell-rng.c | |||
| @@ -191,17 +191,7 @@ static struct platform_driver picoxcell_trng_driver = { | |||
| 191 | }, | 191 | }, |
| 192 | }; | 192 | }; |
| 193 | 193 | ||
| 194 | static int __init picoxcell_trng_init(void) | 194 | module_platform_driver(picoxcell_trng_driver); |
| 195 | { | ||
| 196 | return platform_driver_register(&picoxcell_trng_driver); | ||
| 197 | } | ||
| 198 | module_init(picoxcell_trng_init); | ||
| 199 | |||
| 200 | static void __exit picoxcell_trng_exit(void) | ||
| 201 | { | ||
| 202 | platform_driver_unregister(&picoxcell_trng_driver); | ||
| 203 | } | ||
| 204 | module_exit(picoxcell_trng_exit); | ||
| 205 | 195 | ||
| 206 | MODULE_LICENSE("GPL"); | 196 | MODULE_LICENSE("GPL"); |
| 207 | MODULE_AUTHOR("Jamie Iles"); | 197 | MODULE_AUTHOR("Jamie Iles"); |
diff --git a/drivers/char/hw_random/ppc4xx-rng.c b/drivers/char/hw_random/ppc4xx-rng.c index b8afa6a4ff67..c51762c13031 100644 --- a/drivers/char/hw_random/ppc4xx-rng.c +++ b/drivers/char/hw_random/ppc4xx-rng.c | |||
| @@ -139,17 +139,7 @@ static struct platform_driver ppc4xx_rng_driver = { | |||
| 139 | .remove = ppc4xx_rng_remove, | 139 | .remove = ppc4xx_rng_remove, |
| 140 | }; | 140 | }; |
| 141 | 141 | ||
| 142 | static int __init ppc4xx_rng_init(void) | 142 | module_platform_driver(ppc4xx_rng_driver); |
| 143 | { | ||
| 144 | return platform_driver_register(&ppc4xx_rng_driver); | ||
| 145 | } | ||
| 146 | module_init(ppc4xx_rng_init); | ||
| 147 | |||
| 148 | static void __exit ppc4xx_rng_exit(void) | ||
| 149 | { | ||
| 150 | platform_driver_unregister(&ppc4xx_rng_driver); | ||
| 151 | } | ||
| 152 | module_exit(ppc4xx_rng_exit); | ||
| 153 | 143 | ||
| 154 | MODULE_LICENSE("GPL"); | 144 | MODULE_LICENSE("GPL"); |
| 155 | MODULE_AUTHOR("Josh Boyer <jwboyer@linux.vnet.ibm.com>"); | 145 | MODULE_AUTHOR("Josh Boyer <jwboyer@linux.vnet.ibm.com>"); |
diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c index a8428e6f64a9..f1a1618db1fb 100644 --- a/drivers/char/hw_random/timeriomem-rng.c +++ b/drivers/char/hw_random/timeriomem-rng.c | |||
| @@ -149,18 +149,7 @@ static struct platform_driver timeriomem_rng_driver = { | |||
| 149 | .remove = __devexit_p(timeriomem_rng_remove), | 149 | .remove = __devexit_p(timeriomem_rng_remove), |
| 150 | }; | 150 | }; |
| 151 | 151 | ||
| 152 | static int __init timeriomem_rng_init(void) | 152 | module_platform_driver(timeriomem_rng_driver); |
| 153 | { | ||
| 154 | return platform_driver_register(&timeriomem_rng_driver); | ||
| 155 | } | ||
| 156 | |||
| 157 | static void __exit timeriomem_rng_exit(void) | ||
| 158 | { | ||
| 159 | platform_driver_unregister(&timeriomem_rng_driver); | ||
| 160 | } | ||
| 161 | |||
| 162 | module_init(timeriomem_rng_init); | ||
| 163 | module_exit(timeriomem_rng_exit); | ||
| 164 | 153 | ||
| 165 | MODULE_LICENSE("GPL"); | 154 | MODULE_LICENSE("GPL"); |
| 166 | MODULE_AUTHOR("Alexander Clouter <alex@digriz.org.uk>"); | 155 | MODULE_AUTHOR("Alexander Clouter <alex@digriz.org.uk>"); |
diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c index 1d103f997dc2..13f8e1a14988 100644 --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c | |||
| @@ -1292,18 +1292,7 @@ static struct platform_driver crypto4xx_driver = { | |||
| 1292 | .remove = crypto4xx_remove, | 1292 | .remove = crypto4xx_remove, |
| 1293 | }; | 1293 | }; |
| 1294 | 1294 | ||
| 1295 | static int __init crypto4xx_init(void) | 1295 | module_platform_driver(crypto4xx_driver); |
| 1296 | { | ||
| 1297 | return platform_driver_register(&crypto4xx_driver); | ||
| 1298 | } | ||
| 1299 | |||
| 1300 | static void __exit crypto4xx_exit(void) | ||
| 1301 | { | ||
| 1302 | platform_driver_unregister(&crypto4xx_driver); | ||
| 1303 | } | ||
| 1304 | |||
| 1305 | module_init(crypto4xx_init); | ||
| 1306 | module_exit(crypto4xx_exit); | ||
| 1307 | 1296 | ||
| 1308 | MODULE_LICENSE("GPL"); | 1297 | MODULE_LICENSE("GPL"); |
| 1309 | MODULE_AUTHOR("James Hsiao <jhsiao@amcc.com>"); | 1298 | MODULE_AUTHOR("James Hsiao <jhsiao@amcc.com>"); |
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 4159265b453b..e73cf2e8110a 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
| @@ -113,7 +113,7 @@ static inline void append_dec_shr_done(u32 *desc) | |||
| 113 | 113 | ||
| 114 | jump_cmd = append_jump(desc, JUMP_CLASS_CLASS1 | JUMP_TEST_ALL); | 114 | jump_cmd = append_jump(desc, JUMP_CLASS_CLASS1 | JUMP_TEST_ALL); |
| 115 | set_jump_tgt_here(desc, jump_cmd); | 115 | set_jump_tgt_here(desc, jump_cmd); |
| 116 | append_cmd(desc, SET_OK_PROP_ERRORS | CMD_LOAD); | 116 | append_cmd(desc, SET_OK_NO_PROP_ERRORS | CMD_LOAD); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | /* | 119 | /* |
| @@ -213,7 +213,7 @@ static void init_sh_desc_key_aead(u32 *desc, struct caam_ctx *ctx, | |||
| 213 | set_jump_tgt_here(desc, key_jump_cmd); | 213 | set_jump_tgt_here(desc, key_jump_cmd); |
| 214 | 214 | ||
| 215 | /* Propagate errors from shared to job descriptor */ | 215 | /* Propagate errors from shared to job descriptor */ |
| 216 | append_cmd(desc, SET_OK_PROP_ERRORS | CMD_LOAD); | 216 | append_cmd(desc, SET_OK_NO_PROP_ERRORS | CMD_LOAD); |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | static int aead_set_sh_desc(struct crypto_aead *aead) | 219 | static int aead_set_sh_desc(struct crypto_aead *aead) |
| @@ -310,7 +310,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead) | |||
| 310 | /* Only propagate error immediately if shared */ | 310 | /* Only propagate error immediately if shared */ |
| 311 | jump_cmd = append_jump(desc, JUMP_TEST_ALL); | 311 | jump_cmd = append_jump(desc, JUMP_TEST_ALL); |
| 312 | set_jump_tgt_here(desc, key_jump_cmd); | 312 | set_jump_tgt_here(desc, key_jump_cmd); |
| 313 | append_cmd(desc, SET_OK_PROP_ERRORS | CMD_LOAD); | 313 | append_cmd(desc, SET_OK_NO_PROP_ERRORS | CMD_LOAD); |
| 314 | set_jump_tgt_here(desc, jump_cmd); | 314 | set_jump_tgt_here(desc, jump_cmd); |
| 315 | 315 | ||
| 316 | /* Class 2 operation */ | 316 | /* Class 2 operation */ |
| @@ -683,7 +683,7 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher, | |||
| 683 | set_jump_tgt_here(desc, key_jump_cmd); | 683 | set_jump_tgt_here(desc, key_jump_cmd); |
| 684 | 684 | ||
| 685 | /* Propagate errors from shared to job descriptor */ | 685 | /* Propagate errors from shared to job descriptor */ |
| 686 | append_cmd(desc, SET_OK_PROP_ERRORS | CMD_LOAD); | 686 | append_cmd(desc, SET_OK_NO_PROP_ERRORS | CMD_LOAD); |
| 687 | 687 | ||
| 688 | /* Load iv */ | 688 | /* Load iv */ |
| 689 | append_cmd(desc, CMD_SEQ_LOAD | LDST_SRCDST_BYTE_CONTEXT | | 689 | append_cmd(desc, CMD_SEQ_LOAD | LDST_SRCDST_BYTE_CONTEXT | |
| @@ -724,7 +724,7 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher, | |||
| 724 | /* For aead, only propagate error immediately if shared */ | 724 | /* For aead, only propagate error immediately if shared */ |
| 725 | jump_cmd = append_jump(desc, JUMP_TEST_ALL); | 725 | jump_cmd = append_jump(desc, JUMP_TEST_ALL); |
| 726 | set_jump_tgt_here(desc, key_jump_cmd); | 726 | set_jump_tgt_here(desc, key_jump_cmd); |
| 727 | append_cmd(desc, SET_OK_PROP_ERRORS | CMD_LOAD); | 727 | append_cmd(desc, SET_OK_NO_PROP_ERRORS | CMD_LOAD); |
| 728 | set_jump_tgt_here(desc, jump_cmd); | 728 | set_jump_tgt_here(desc, jump_cmd); |
| 729 | 729 | ||
| 730 | /* load IV */ | 730 | /* load IV */ |
| @@ -1806,6 +1806,25 @@ struct caam_alg_template { | |||
| 1806 | static struct caam_alg_template driver_algs[] = { | 1806 | static struct caam_alg_template driver_algs[] = { |
| 1807 | /* single-pass ipsec_esp descriptor */ | 1807 | /* single-pass ipsec_esp descriptor */ |
| 1808 | { | 1808 | { |
| 1809 | .name = "authenc(hmac(md5),cbc(aes))", | ||
| 1810 | .driver_name = "authenc-hmac-md5-cbc-aes-caam", | ||
| 1811 | .blocksize = AES_BLOCK_SIZE, | ||
| 1812 | .type = CRYPTO_ALG_TYPE_AEAD, | ||
| 1813 | .template_aead = { | ||
| 1814 | .setkey = aead_setkey, | ||
| 1815 | .setauthsize = aead_setauthsize, | ||
| 1816 | .encrypt = aead_encrypt, | ||
| 1817 | .decrypt = aead_decrypt, | ||
| 1818 | .givencrypt = aead_givencrypt, | ||
| 1819 | .geniv = "<built-in>", | ||
| 1820 | .ivsize = AES_BLOCK_SIZE, | ||
| 1821 | .maxauthsize = MD5_DIGEST_SIZE, | ||
| 1822 | }, | ||
| 1823 | .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, | ||
| 1824 | .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, | ||
| 1825 | .alg_op = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC, | ||
| 1826 | }, | ||
| 1827 | { | ||
| 1809 | .name = "authenc(hmac(sha1),cbc(aes))", | 1828 | .name = "authenc(hmac(sha1),cbc(aes))", |
| 1810 | .driver_name = "authenc-hmac-sha1-cbc-aes-caam", | 1829 | .driver_name = "authenc-hmac-sha1-cbc-aes-caam", |
| 1811 | .blocksize = AES_BLOCK_SIZE, | 1830 | .blocksize = AES_BLOCK_SIZE, |
| @@ -1865,6 +1884,25 @@ static struct caam_alg_template driver_algs[] = { | |||
| 1865 | .alg_op = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC, | 1884 | .alg_op = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC, |
| 1866 | }, | 1885 | }, |
| 1867 | { | 1886 | { |
| 1887 | .name = "authenc(hmac(md5),cbc(des3_ede))", | ||
| 1888 | .driver_name = "authenc-hmac-md5-cbc-des3_ede-caam", | ||
| 1889 | .blocksize = DES3_EDE_BLOCK_SIZE, | ||
| 1890 | .type = CRYPTO_ALG_TYPE_AEAD, | ||
| 1891 | .template_aead = { | ||
| 1892 | .setkey = aead_setkey, | ||
| 1893 | .setauthsize = aead_setauthsize, | ||
| 1894 | .encrypt = aead_encrypt, | ||
| 1895 | .decrypt = aead_decrypt, | ||
| 1896 | .givencrypt = aead_givencrypt, | ||
| 1897 | .geniv = "<built-in>", | ||
| 1898 | .ivsize = DES3_EDE_BLOCK_SIZE, | ||
| 1899 | .maxauthsize = MD5_DIGEST_SIZE, | ||
| 1900 | }, | ||
| 1901 | .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, | ||
| 1902 | .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, | ||
| 1903 | .alg_op = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC, | ||
| 1904 | }, | ||
| 1905 | { | ||
| 1868 | .name = "authenc(hmac(sha1),cbc(des3_ede))", | 1906 | .name = "authenc(hmac(sha1),cbc(des3_ede))", |
| 1869 | .driver_name = "authenc-hmac-sha1-cbc-des3_ede-caam", | 1907 | .driver_name = "authenc-hmac-sha1-cbc-des3_ede-caam", |
| 1870 | .blocksize = DES3_EDE_BLOCK_SIZE, | 1908 | .blocksize = DES3_EDE_BLOCK_SIZE, |
| @@ -1924,6 +1962,25 @@ static struct caam_alg_template driver_algs[] = { | |||
| 1924 | .alg_op = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC, | 1962 | .alg_op = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC, |
| 1925 | }, | 1963 | }, |
| 1926 | { | 1964 | { |
| 1965 | .name = "authenc(hmac(md5),cbc(des))", | ||
| 1966 | .driver_name = "authenc-hmac-md5-cbc-des-caam", | ||
| 1967 | .blocksize = DES_BLOCK_SIZE, | ||
| 1968 | .type = CRYPTO_ALG_TYPE_AEAD, | ||
| 1969 | .template_aead = { | ||
| 1970 | .setkey = aead_setkey, | ||
| 1971 | .setauthsize = aead_setauthsize, | ||
| 1972 | .encrypt = aead_encrypt, | ||
| 1973 | .decrypt = aead_decrypt, | ||
| 1974 | .givencrypt = aead_givencrypt, | ||
| 1975 | .geniv = "<built-in>", | ||
| 1976 | .ivsize = DES_BLOCK_SIZE, | ||
| 1977 | .maxauthsize = MD5_DIGEST_SIZE, | ||
| 1978 | }, | ||
| 1979 | .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, | ||
| 1980 | .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, | ||
| 1981 | .alg_op = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC, | ||
| 1982 | }, | ||
| 1983 | { | ||
| 1927 | .name = "authenc(hmac(sha1),cbc(des))", | 1984 | .name = "authenc(hmac(sha1),cbc(des))", |
| 1928 | .driver_name = "authenc-hmac-sha1-cbc-des-caam", | 1985 | .driver_name = "authenc-hmac-sha1-cbc-des-caam", |
| 1929 | .blocksize = DES_BLOCK_SIZE, | 1986 | .blocksize = DES_BLOCK_SIZE, |
diff --git a/drivers/crypto/caam/compat.h b/drivers/crypto/caam/compat.h index d38f2afaa966..a63bc65fae86 100644 --- a/drivers/crypto/caam/compat.h +++ b/drivers/crypto/caam/compat.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <crypto/aes.h> | 28 | #include <crypto/aes.h> |
| 29 | #include <crypto/des.h> | 29 | #include <crypto/des.h> |
| 30 | #include <crypto/sha.h> | 30 | #include <crypto/sha.h> |
| 31 | #include <crypto/md5.h> | ||
| 31 | #include <crypto/aead.h> | 32 | #include <crypto/aead.h> |
| 32 | #include <crypto/authenc.h> | 33 | #include <crypto/authenc.h> |
| 33 | #include <crypto/scatterwalk.h> | 34 | #include <crypto/scatterwalk.h> |
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 73988bb7322a..8ae3ba2a160d 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c | |||
| @@ -52,8 +52,6 @@ static int caam_probe(struct platform_device *pdev) | |||
| 52 | struct caam_ctrl __iomem *ctrl; | 52 | struct caam_ctrl __iomem *ctrl; |
| 53 | struct caam_full __iomem *topregs; | 53 | struct caam_full __iomem *topregs; |
| 54 | struct caam_drv_private *ctrlpriv; | 54 | struct caam_drv_private *ctrlpriv; |
| 55 | struct caam_deco **deco; | ||
| 56 | u32 deconum; | ||
| 57 | #ifdef CONFIG_DEBUG_FS | 55 | #ifdef CONFIG_DEBUG_FS |
| 58 | struct caam_perfmon *perfmon; | 56 | struct caam_perfmon *perfmon; |
| 59 | #endif | 57 | #endif |
| @@ -92,17 +90,6 @@ static int caam_probe(struct platform_device *pdev) | |||
| 92 | if (sizeof(dma_addr_t) == sizeof(u64)) | 90 | if (sizeof(dma_addr_t) == sizeof(u64)) |
| 93 | dma_set_mask(dev, DMA_BIT_MASK(36)); | 91 | dma_set_mask(dev, DMA_BIT_MASK(36)); |
| 94 | 92 | ||
| 95 | /* Find out how many DECOs are present */ | ||
| 96 | deconum = (rd_reg64(&topregs->ctrl.perfmon.cha_num) & | ||
| 97 | CHA_NUM_DECONUM_MASK) >> CHA_NUM_DECONUM_SHIFT; | ||
| 98 | |||
| 99 | ctrlpriv->deco = kmalloc(deconum * sizeof(struct caam_deco *), | ||
| 100 | GFP_KERNEL); | ||
| 101 | |||
| 102 | deco = (struct caam_deco __force **)&topregs->deco; | ||
| 103 | for (d = 0; d < deconum; d++) | ||
| 104 | ctrlpriv->deco[d] = deco[d]; | ||
| 105 | |||
| 106 | /* | 93 | /* |
| 107 | * Detect and enable JobRs | 94 | * Detect and enable JobRs |
| 108 | * First, find out how many ring spec'ed, allocate references | 95 | * First, find out how many ring spec'ed, allocate references |
| @@ -253,18 +240,7 @@ static struct platform_driver caam_driver = { | |||
| 253 | .remove = __devexit_p(caam_remove), | 240 | .remove = __devexit_p(caam_remove), |
| 254 | }; | 241 | }; |
| 255 | 242 | ||
| 256 | static int __init caam_base_init(void) | 243 | module_platform_driver(caam_driver); |
| 257 | { | ||
| 258 | return platform_driver_register(&caam_driver); | ||
| 259 | } | ||
| 260 | |||
| 261 | static void __exit caam_base_exit(void) | ||
| 262 | { | ||
| 263 | return platform_driver_unregister(&caam_driver); | ||
| 264 | } | ||
| 265 | |||
| 266 | module_init(caam_base_init); | ||
| 267 | module_exit(caam_base_exit); | ||
| 268 | 244 | ||
| 269 | MODULE_LICENSE("GPL"); | 245 | MODULE_LICENSE("GPL"); |
| 270 | MODULE_DESCRIPTION("FSL CAAM request backend"); | 246 | MODULE_DESCRIPTION("FSL CAAM request backend"); |
diff --git a/drivers/crypto/caam/desc.h b/drivers/crypto/caam/desc.h index 974a75842da9..a17c2958dab1 100644 --- a/drivers/crypto/caam/desc.h +++ b/drivers/crypto/caam/desc.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #define DESC_H | 9 | #define DESC_H |
| 10 | 10 | ||
| 11 | /* Max size of any CAAM descriptor in 32-bit words, inclusive of header */ | 11 | /* Max size of any CAAM descriptor in 32-bit words, inclusive of header */ |
| 12 | #define MAX_CAAM_DESCSIZE 64 | 12 | #define MAX_CAAM_DESCSIZE 64 |
| 13 | 13 | ||
| 14 | /* Block size of any entity covered/uncovered with a KEK/TKEK */ | 14 | /* Block size of any entity covered/uncovered with a KEK/TKEK */ |
| 15 | #define KEK_BLOCKSIZE 16 | 15 | #define KEK_BLOCKSIZE 16 |
| @@ -18,38 +18,38 @@ | |||
| 18 | * Supported descriptor command types as they show up | 18 | * Supported descriptor command types as they show up |
| 19 | * inside a descriptor command word. | 19 | * inside a descriptor command word. |
| 20 | */ | 20 | */ |
| 21 | #define CMD_SHIFT 27 | 21 | #define CMD_SHIFT 27 |
| 22 | #define CMD_MASK 0xf8000000 | 22 | #define CMD_MASK 0xf8000000 |
| 23 | 23 | ||
| 24 | #define CMD_KEY (0x00 << CMD_SHIFT) | 24 | #define CMD_KEY (0x00 << CMD_SHIFT) |
| 25 | #define CMD_SEQ_KEY (0x01 << CMD_SHIFT) | 25 | #define CMD_SEQ_KEY (0x01 << CMD_SHIFT) |
| 26 | #define CMD_LOAD (0x02 << CMD_SHIFT) | 26 | #define CMD_LOAD (0x02 << CMD_SHIFT) |
| 27 | #define CMD_SEQ_LOAD (0x03 << CMD_SHIFT) | 27 | #define CMD_SEQ_LOAD (0x03 << CMD_SHIFT) |
| 28 | #define CMD_FIFO_LOAD (0x04 << CMD_SHIFT) | 28 | #define CMD_FIFO_LOAD (0x04 << CMD_SHIFT) |
| 29 | #define CMD_SEQ_FIFO_LOAD (0x05 << CMD_SHIFT) | 29 | #define CMD_SEQ_FIFO_LOAD (0x05 << CMD_SHIFT) |
| 30 | #define CMD_STORE (0x0a << CMD_SHIFT) | 30 | #define CMD_STORE (0x0a << CMD_SHIFT) |
| 31 | #define CMD_SEQ_STORE (0x0b << CMD_SHIFT) | 31 | #define CMD_SEQ_STORE (0x0b << CMD_SHIFT) |
| 32 | #define CMD_FIFO_STORE (0x0c << CMD_SHIFT) | 32 | #define CMD_FIFO_STORE (0x0c << CMD_SHIFT) |
| 33 | #define CMD_SEQ_FIFO_STORE (0x0d << CMD_SHIFT) | 33 | #define CMD_SEQ_FIFO_STORE (0x0d << CMD_SHIFT) |
| 34 | #define CMD_MOVE_LEN (0x0e << CMD_SHIFT) | 34 | #define CMD_MOVE_LEN (0x0e << CMD_SHIFT) |
| 35 | #define CMD_MOVE (0x0f << CMD_SHIFT) | 35 | #define CMD_MOVE (0x0f << CMD_SHIFT) |
| 36 | #define CMD_OPERATION (0x10 << CMD_SHIFT) | 36 | #define CMD_OPERATION (0x10 << CMD_SHIFT) |
| 37 | #define CMD_SIGNATURE (0x12 << CMD_SHIFT) | 37 | #define CMD_SIGNATURE (0x12 << CMD_SHIFT) |
| 38 | #define CMD_JUMP (0x14 << CMD_SHIFT) | 38 | #define CMD_JUMP (0x14 << CMD_SHIFT) |
| 39 | #define CMD_MATH (0x15 << CMD_SHIFT) | 39 | #define CMD_MATH (0x15 << CMD_SHIFT) |
| 40 | #define CMD_DESC_HDR (0x16 << CMD_SHIFT) | 40 | #define CMD_DESC_HDR (0x16 << CMD_SHIFT) |
| 41 | #define CMD_SHARED_DESC_HDR (0x17 << CMD_SHIFT) | 41 | #define CMD_SHARED_DESC_HDR (0x17 << CMD_SHIFT) |
| 42 | #define CMD_SEQ_IN_PTR (0x1e << CMD_SHIFT) | 42 | #define CMD_SEQ_IN_PTR (0x1e << CMD_SHIFT) |
| 43 | #define CMD_SEQ_OUT_PTR (0x1f << CMD_SHIFT) | 43 | #define CMD_SEQ_OUT_PTR (0x1f << CMD_SHIFT) |
| 44 | 44 | ||
| 45 | /* General-purpose class selector for all commands */ | 45 | /* General-purpose class selector for all commands */ |
| 46 | #define CLASS_SHIFT 25 | 46 | #define CLASS_SHIFT 25 |
| 47 | #define CLASS_MASK (0x03 << CLASS_SHIFT) | 47 | #define CLASS_MASK (0x03 << CLASS_SHIFT) |
| 48 | 48 | ||
| 49 | #define CLASS_NONE (0x00 << CLASS_SHIFT) | 49 | #define CLASS_NONE (0x00 << CLASS_SHIFT) |
| 50 | #define CLASS_1 (0x01 << CLASS_SHIFT) | 50 | #define CLASS_1 (0x01 << CLASS_SHIFT) |
| 51 | #define CLASS_2 (0x02 << CLASS_SHIFT) | 51 | #define CLASS_2 (0x02 << CLASS_SHIFT) |
| 52 | #define CLASS_BOTH (0x03 << CLASS_SHIFT) | 52 | #define CLASS_BOTH (0x03 << CLASS_SHIFT) |
| 53 | 53 | ||
| 54 | /* | 54 | /* |
| 55 | * Descriptor header command constructs | 55 | * Descriptor header command constructs |
| @@ -60,82 +60,82 @@ | |||
| 60 | * Do Not Run - marks a descriptor inexecutable if there was | 60 | * Do Not Run - marks a descriptor inexecutable if there was |
| 61 | * a preceding error somewhere | 61 | * a preceding error somewhere |
| 62 | */ | 62 | */ |
| 63 | #define HDR_DNR 0x01000000 | 63 | #define HDR_DNR 0x01000000 |
| 64 | 64 | ||
| 65 | /* | 65 | /* |
| 66 | * ONE - should always be set. Combination of ONE (always | 66 | * ONE - should always be set. Combination of ONE (always |
| 67 | * set) and ZRO (always clear) forms an endianness sanity check | 67 | * set) and ZRO (always clear) forms an endianness sanity check |
| 68 | */ | 68 | */ |
| 69 | #define HDR_ONE 0x00800000 | 69 | #define HDR_ONE 0x00800000 |
| 70 | #define HDR_ZRO 0x00008000 | 70 | #define HDR_ZRO 0x00008000 |
| 71 | 71 | ||
| 72 | /* Start Index or SharedDesc Length */ | 72 | /* Start Index or SharedDesc Length */ |
| 73 | #define HDR_START_IDX_MASK 0x3f | 73 | #define HDR_START_IDX_MASK 0x3f |
| 74 | #define HDR_START_IDX_SHIFT 16 | 74 | #define HDR_START_IDX_SHIFT 16 |
| 75 | 75 | ||
| 76 | /* If shared descriptor header, 6-bit length */ | 76 | /* If shared descriptor header, 6-bit length */ |
| 77 | #define HDR_DESCLEN_SHR_MASK 0x3f | 77 | #define HDR_DESCLEN_SHR_MASK 0x3f |
| 78 | 78 | ||
| 79 | /* If non-shared header, 7-bit length */ | 79 | /* If non-shared header, 7-bit length */ |
| 80 | #define HDR_DESCLEN_MASK 0x7f | 80 | #define HDR_DESCLEN_MASK 0x7f |
| 81 | 81 | ||
| 82 | /* This is a TrustedDesc (if not SharedDesc) */ | 82 | /* This is a TrustedDesc (if not SharedDesc) */ |
| 83 | #define HDR_TRUSTED 0x00004000 | 83 | #define HDR_TRUSTED 0x00004000 |
| 84 | 84 | ||
| 85 | /* Make into TrustedDesc (if not SharedDesc) */ | 85 | /* Make into TrustedDesc (if not SharedDesc) */ |
| 86 | #define HDR_MAKE_TRUSTED 0x00002000 | 86 | #define HDR_MAKE_TRUSTED 0x00002000 |
| 87 | 87 | ||
| 88 | /* Save context if self-shared (if SharedDesc) */ | 88 | /* Save context if self-shared (if SharedDesc) */ |
| 89 | #define HDR_SAVECTX 0x00001000 | 89 | #define HDR_SAVECTX 0x00001000 |
| 90 | 90 | ||
| 91 | /* Next item points to SharedDesc */ | 91 | /* Next item points to SharedDesc */ |
| 92 | #define HDR_SHARED 0x00001000 | 92 | #define HDR_SHARED 0x00001000 |
| 93 | 93 | ||
| 94 | /* | 94 | /* |
| 95 | * Reverse Execution Order - execute JobDesc first, then | 95 | * Reverse Execution Order - execute JobDesc first, then |
| 96 | * execute SharedDesc (normally SharedDesc goes first). | 96 | * execute SharedDesc (normally SharedDesc goes first). |
| 97 | */ | 97 | */ |
| 98 | #define HDR_REVERSE 0x00000800 | 98 | #define HDR_REVERSE 0x00000800 |
| 99 | 99 | ||
| 100 | /* Propogate DNR property to SharedDesc */ | 100 | /* Propogate DNR property to SharedDesc */ |
| 101 | #define HDR_PROP_DNR 0x00000800 | 101 | #define HDR_PROP_DNR 0x00000800 |
| 102 | 102 | ||
| 103 | /* JobDesc/SharedDesc share property */ | 103 | /* JobDesc/SharedDesc share property */ |
| 104 | #define HDR_SD_SHARE_MASK 0x03 | 104 | #define HDR_SD_SHARE_MASK 0x03 |
| 105 | #define HDR_SD_SHARE_SHIFT 8 | 105 | #define HDR_SD_SHARE_SHIFT 8 |
| 106 | #define HDR_JD_SHARE_MASK 0x07 | 106 | #define HDR_JD_SHARE_MASK 0x07 |
| 107 | #define HDR_JD_SHARE_SHIFT 8 | 107 | #define HDR_JD_SHARE_SHIFT 8 |
| 108 | 108 | ||
| 109 | #define HDR_SHARE_NEVER (0x00 << HDR_SD_SHARE_SHIFT) | 109 | #define HDR_SHARE_NEVER (0x00 << HDR_SD_SHARE_SHIFT) |
| 110 | #define HDR_SHARE_WAIT (0x01 << HDR_SD_SHARE_SHIFT) | 110 | #define HDR_SHARE_WAIT (0x01 << HDR_SD_SHARE_SHIFT) |
| 111 | #define HDR_SHARE_SERIAL (0x02 << HDR_SD_SHARE_SHIFT) | 111 | #define HDR_SHARE_SERIAL (0x02 << HDR_SD_SHARE_SHIFT) |
| 112 | #define HDR_SHARE_ALWAYS (0x03 << HDR_SD_SHARE_SHIFT) | 112 | #define HDR_SHARE_ALWAYS (0x03 << HDR_SD_SHARE_SHIFT) |
| 113 | #define HDR_SHARE_DEFER (0x04 << HDR_SD_SHARE_SHIFT) | 113 | #define HDR_SHARE_DEFER (0x04 << HDR_SD_SHARE_SHIFT) |
| 114 | 114 | ||
| 115 | /* JobDesc/SharedDesc descriptor length */ | 115 | /* JobDesc/SharedDesc descriptor length */ |
| 116 | #define HDR_JD_LENGTH_MASK 0x7f | 116 | #define HDR_JD_LENGTH_MASK 0x7f |
| 117 | #define HDR_SD_LENGTH_MASK 0x3f | 117 | #define HDR_SD_LENGTH_MASK 0x3f |
| 118 | 118 | ||
| 119 | /* | 119 | /* |
| 120 | * KEY/SEQ_KEY Command Constructs | 120 | * KEY/SEQ_KEY Command Constructs |
| 121 | */ | 121 | */ |
| 122 | 122 | ||
| 123 | /* Key Destination Class: 01 = Class 1, 02 - Class 2 */ | 123 | /* Key Destination Class: 01 = Class 1, 02 - Class 2 */ |
| 124 | #define KEY_DEST_CLASS_SHIFT 25 /* use CLASS_1 or CLASS_2 */ | 124 | #define KEY_DEST_CLASS_SHIFT 25 /* use CLASS_1 or CLASS_2 */ |
| 125 | #define KEY_DEST_CLASS_MASK (0x03 << KEY_DEST_CLASS_SHIFT) | 125 | #define KEY_DEST_CLASS_MASK (0x03 << KEY_DEST_CLASS_SHIFT) |
| 126 | 126 | ||
| 127 | /* Scatter-Gather Table/Variable Length Field */ | 127 | /* Scatter-Gather Table/Variable Length Field */ |
| 128 | #define KEY_SGF 0x01000000 | 128 | #define KEY_SGF 0x01000000 |
| 129 | #define KEY_VLF 0x01000000 | 129 | #define KEY_VLF 0x01000000 |
| 130 | 130 | ||
| 131 | /* Immediate - Key follows command in the descriptor */ | 131 | /* Immediate - Key follows command in the descriptor */ |
| 132 | #define KEY_IMM 0x00800000 | 132 | #define KEY_IMM 0x00800000 |
| 133 | 133 | ||
| 134 | /* | 134 | /* |
| 135 | * Encrypted - Key is encrypted either with the KEK, or | 135 | * Encrypted - Key is encrypted either with the KEK, or |
| 136 | * with the TDKEK if TK is set | 136 | * with the TDKEK if TK is set |
| 137 | */ | 137 | */ |
| 138 | #define KEY_ENC 0x00400000 | 138 | #define KEY_ENC 0x00400000 |
| 139 | 139 | ||
| 140 | /* | 140 | /* |
| 141 | * No Write Back - Do not allow key to be FIFO STOREd | 141 | * No Write Back - Do not allow key to be FIFO STOREd |
| @@ -156,16 +156,16 @@ | |||
| 156 | * KDEST - Key Destination: 0 - class key register, | 156 | * KDEST - Key Destination: 0 - class key register, |
| 157 | * 1 - PKHA 'e', 2 - AFHA Sbox, 3 - MDHA split-key | 157 | * 1 - PKHA 'e', 2 - AFHA Sbox, 3 - MDHA split-key |
| 158 | */ | 158 | */ |
| 159 | #define KEY_DEST_SHIFT 16 | 159 | #define KEY_DEST_SHIFT 16 |
| 160 | #define KEY_DEST_MASK (0x03 << KEY_DEST_SHIFT) | 160 | #define KEY_DEST_MASK (0x03 << KEY_DEST_SHIFT) |
| 161 | 161 | ||
| 162 | #define KEY_DEST_CLASS_REG (0x00 << KEY_DEST_SHIFT) | 162 | #define KEY_DEST_CLASS_REG (0x00 << KEY_DEST_SHIFT) |
| 163 | #define KEY_DEST_PKHA_E (0x01 << KEY_DEST_SHIFT) | 163 | #define KEY_DEST_PKHA_E (0x01 << KEY_DEST_SHIFT) |
| 164 | #define KEY_DEST_AFHA_SBOX (0x02 << KEY_DEST_SHIFT) | 164 | #define KEY_DEST_AFHA_SBOX (0x02 << KEY_DEST_SHIFT) |
| 165 | #define KEY_DEST_MDHA_SPLIT (0x03 << KEY_DEST_SHIFT) | 165 | #define KEY_DEST_MDHA_SPLIT (0x03 << KEY_DEST_SHIFT) |
| 166 | 166 | ||
| 167 | /* Length in bytes */ | 167 | /* Length in bytes */ |
| 168 | #define KEY_LENGTH_MASK 0x000003ff | 168 | #define KEY_LENGTH_MASK 0x000003ff |
| 169 | 169 | ||
| 170 | /* | 170 | /* |
| 171 | * LOAD/SEQ_LOAD/STORE/SEQ_STORE Command Constructs | 171 | * LOAD/SEQ_LOAD/STORE/SEQ_STORE Command Constructs |
| @@ -175,25 +175,25 @@ | |||
| 175 | * Load/Store Destination: 0 = class independent CCB, | 175 | * Load/Store Destination: 0 = class independent CCB, |
| 176 | * 1 = class 1 CCB, 2 = class 2 CCB, 3 = DECO | 176 | * 1 = class 1 CCB, 2 = class 2 CCB, 3 = DECO |
| 177 | */ | 177 | */ |
| 178 | #define LDST_CLASS_SHIFT 25 | 178 | #define LDST_CLASS_SHIFT 25 |
| 179 | #define LDST_CLASS_MASK (0x03 << LDST_CLASS_SHIFT) | 179 | #define LDST_CLASS_MASK (0x03 << LDST_CLASS_SHIFT) |
| 180 | #define LDST_CLASS_IND_CCB (0x00 << LDST_CLASS_SHIFT) | 180 | #define LDST_CLASS_IND_CCB (0x00 << LDST_CLASS_SHIFT) |
| 181 | #define LDST_CLASS_1_CCB (0x01 << LDST_CLASS_SHIFT) | 181 | #define LDST_CLASS_1_CCB (0x01 << LDST_CLASS_SHIFT) |
| 182 | #define LDST_CLASS_2_CCB (0x02 << LDST_CLASS_SHIFT) | 182 | #define LDST_CLASS_2_CCB (0x02 << LDST_CLASS_SHIFT) |
| 183 | #define LDST_CLASS_DECO (0x03 << LDST_CLASS_SHIFT) | 183 | #define LDST_CLASS_DECO (0x03 << LDST_CLASS_SHIFT) |
| 184 | 184 | ||
| 185 | /* Scatter-Gather Table/Variable Length Field */ | 185 | /* Scatter-Gather Table/Variable Length Field */ |
| 186 | #define LDST_SGF 0x01000000 | 186 | #define LDST_SGF 0x01000000 |
| 187 | #define LDST_VLF LDST_SGF | 187 | #define LDST_VLF LDST_SGF |
| 188 | 188 | ||
| 189 | /* Immediate - Key follows this command in descriptor */ | 189 | /* Immediate - Key follows this command in descriptor */ |
| 190 | #define LDST_IMM_MASK 1 | 190 | #define LDST_IMM_MASK 1 |
| 191 | #define LDST_IMM_SHIFT 23 | 191 | #define LDST_IMM_SHIFT 23 |
| 192 | #define LDST_IMM (LDST_IMM_MASK << LDST_IMM_SHIFT) | 192 | #define LDST_IMM (LDST_IMM_MASK << LDST_IMM_SHIFT) |
| 193 | 193 | ||
| 194 | /* SRC/DST - Destination for LOAD, Source for STORE */ | 194 | /* SRC/DST - Destination for LOAD, Source for STORE */ |
| 195 | #define LDST_SRCDST_SHIFT 16 | 195 | #define LDST_SRCDST_SHIFT 16 |
| 196 | #define LDST_SRCDST_MASK (0x7f << LDST_SRCDST_SHIFT) | 196 | #define LDST_SRCDST_MASK (0x7f << LDST_SRCDST_SHIFT) |
| 197 | 197 | ||
| 198 | #define LDST_SRCDST_BYTE_CONTEXT (0x20 << LDST_SRCDST_SHIFT) | 198 | #define LDST_SRCDST_BYTE_CONTEXT (0x20 << LDST_SRCDST_SHIFT) |
| 199 | #define LDST_SRCDST_BYTE_KEY (0x40 << LDST_SRCDST_SHIFT) | 199 | #define LDST_SRCDST_BYTE_KEY (0x40 << LDST_SRCDST_SHIFT) |
| @@ -205,64 +205,64 @@ | |||
| 205 | #define LDST_SRCDST_WORD_DATASZ_REG (0x02 << LDST_SRCDST_SHIFT) | 205 | #define LDST_SRCDST_WORD_DATASZ_REG (0x02 << LDST_SRCDST_SHIFT) |
| 206 | #define LDST_SRCDST_WORD_ICVSZ_REG (0x03 << LDST_SRCDST_SHIFT) | 206 | #define LDST_SRCDST_WORD_ICVSZ_REG (0x03 << LDST_SRCDST_SHIFT) |
| 207 | #define LDST_SRCDST_WORD_CHACTRL (0x06 << LDST_SRCDST_SHIFT) | 207 | #define LDST_SRCDST_WORD_CHACTRL (0x06 << LDST_SRCDST_SHIFT) |
| 208 | #define LDST_SRCDST_WORD_DECOCTRL (0x06 << LDST_SRCDST_SHIFT) | 208 | #define LDST_SRCDST_WORD_DECOCTRL (0x06 << LDST_SRCDST_SHIFT) |
| 209 | #define LDST_SRCDST_WORD_IRQCTRL (0x07 << LDST_SRCDST_SHIFT) | 209 | #define LDST_SRCDST_WORD_IRQCTRL (0x07 << LDST_SRCDST_SHIFT) |
| 210 | #define LDST_SRCDST_WORD_DECO_PCLOVRD (0x07 << LDST_SRCDST_SHIFT) | 210 | #define LDST_SRCDST_WORD_DECO_PCLOVRD (0x07 << LDST_SRCDST_SHIFT) |
| 211 | #define LDST_SRCDST_WORD_CLRW (0x08 << LDST_SRCDST_SHIFT) | 211 | #define LDST_SRCDST_WORD_CLRW (0x08 << LDST_SRCDST_SHIFT) |
| 212 | #define LDST_SRCDST_WORD_DECO_MATH0 (0x08 << LDST_SRCDST_SHIFT) | 212 | #define LDST_SRCDST_WORD_DECO_MATH0 (0x08 << LDST_SRCDST_SHIFT) |
| 213 | #define LDST_SRCDST_WORD_STAT (0x09 << LDST_SRCDST_SHIFT) | 213 | #define LDST_SRCDST_WORD_STAT (0x09 << LDST_SRCDST_SHIFT) |
| 214 | #define LDST_SRCDST_WORD_DECO_MATH1 (0x09 << LDST_SRCDST_SHIFT) | 214 | #define LDST_SRCDST_WORD_DECO_MATH1 (0x09 << LDST_SRCDST_SHIFT) |
| 215 | #define LDST_SRCDST_WORD_DECO_MATH2 (0x0a << LDST_SRCDST_SHIFT) | 215 | #define LDST_SRCDST_WORD_DECO_MATH2 (0x0a << LDST_SRCDST_SHIFT) |
| 216 | #define LDST_SRCDST_WORD_DECO_AAD_SZ (0x0b << LDST_SRCDST_SHIFT) | 216 | #define LDST_SRCDST_WORD_DECO_AAD_SZ (0x0b << LDST_SRCDST_SHIFT) |
| 217 | #define LDST_SRCDST_WORD_DECO_MATH3 (0x0b << LDST_SRCDST_SHIFT) | 217 | #define LDST_SRCDST_WORD_DECO_MATH3 (0x0b << LDST_SRCDST_SHIFT) |
| 218 | #define LDST_SRCDST_WORD_CLASS1_ICV_SZ (0x0c << LDST_SRCDST_SHIFT) | 218 | #define LDST_SRCDST_WORD_CLASS1_ICV_SZ (0x0c << LDST_SRCDST_SHIFT) |
| 219 | #define LDST_SRCDST_WORD_ALTDS_CLASS1 (0x0f << LDST_SRCDST_SHIFT) | 219 | #define LDST_SRCDST_WORD_ALTDS_CLASS1 (0x0f << LDST_SRCDST_SHIFT) |
| 220 | #define LDST_SRCDST_WORD_PKHA_A_SZ (0x10 << LDST_SRCDST_SHIFT) | 220 | #define LDST_SRCDST_WORD_PKHA_A_SZ (0x10 << LDST_SRCDST_SHIFT) |
| 221 | #define LDST_SRCDST_WORD_PKHA_B_SZ (0x11 << LDST_SRCDST_SHIFT) | 221 | #define LDST_SRCDST_WORD_PKHA_B_SZ (0x11 << LDST_SRCDST_SHIFT) |
| 222 | #define LDST_SRCDST_WORD_PKHA_N_SZ (0x12 << LDST_SRCDST_SHIFT) | 222 | #define LDST_SRCDST_WORD_PKHA_N_SZ (0x12 << LDST_SRCDST_SHIFT) |
| 223 | #define LDST_SRCDST_WORD_PKHA_E_SZ (0x13 << LDST_SRCDST_SHIFT) | 223 | #define LDST_SRCDST_WORD_PKHA_E_SZ (0x13 << LDST_SRCDST_SHIFT) |
| 224 | #define LDST_SRCDST_WORD_DESCBUF (0x40 << LDST_SRCDST_SHIFT) | 224 | #define LDST_SRCDST_WORD_DESCBUF (0x40 << LDST_SRCDST_SHIFT) |
| 225 | #define LDST_SRCDST_WORD_INFO_FIFO (0x7a << LDST_SRCDST_SHIFT) | 225 | #define LDST_SRCDST_WORD_INFO_FIFO (0x7a << LDST_SRCDST_SHIFT) |
| 226 | 226 | ||
| 227 | /* Offset in source/destination */ | 227 | /* Offset in source/destination */ |
| 228 | #define LDST_OFFSET_SHIFT 8 | 228 | #define LDST_OFFSET_SHIFT 8 |
| 229 | #define LDST_OFFSET_MASK (0xff << LDST_OFFSET_SHIFT) | 229 | #define LDST_OFFSET_MASK (0xff << LDST_OFFSET_SHIFT) |
| 230 | 230 | ||
| 231 | /* LDOFF definitions used when DST = LDST_SRCDST_WORD_DECOCTRL */ | 231 | /* LDOFF definitions used when DST = LDST_SRCDST_WORD_DECOCTRL */ |
| 232 | /* These could also be shifted by LDST_OFFSET_SHIFT - this reads better */ | 232 | /* These could also be shifted by LDST_OFFSET_SHIFT - this reads better */ |
| 233 | #define LDOFF_CHG_SHARE_SHIFT 0 | 233 | #define LDOFF_CHG_SHARE_SHIFT 0 |
| 234 | #define LDOFF_CHG_SHARE_MASK (0x3 << LDOFF_CHG_SHARE_SHIFT) | 234 | #define LDOFF_CHG_SHARE_MASK (0x3 << LDOFF_CHG_SHARE_SHIFT) |
| 235 | #define LDOFF_CHG_SHARE_NEVER (0x1 << LDOFF_CHG_SHARE_SHIFT) | 235 | #define LDOFF_CHG_SHARE_NEVER (0x1 << LDOFF_CHG_SHARE_SHIFT) |
| 236 | #define LDOFF_CHG_SHARE_OK_NO_PROP (0x2 << LDOFF_CHG_SHARE_SHIFT) | 236 | #define LDOFF_CHG_SHARE_OK_PROP (0x2 << LDOFF_CHG_SHARE_SHIFT) |
| 237 | #define LDOFF_CHG_SHARE_OK_PROP (0x3 << LDOFF_CHG_SHARE_SHIFT) | 237 | #define LDOFF_CHG_SHARE_OK_NO_PROP (0x3 << LDOFF_CHG_SHARE_SHIFT) |
| 238 | 238 | ||
| 239 | #define LDOFF_ENABLE_AUTO_NFIFO (1 << 2) | 239 | #define LDOFF_ENABLE_AUTO_NFIFO (1 << 2) |
| 240 | #define LDOFF_DISABLE_AUTO_NFIFO (1 << 3) | 240 | #define LDOFF_DISABLE_AUTO_NFIFO (1 << 3) |
| 241 | 241 | ||
| 242 | #define LDOFF_CHG_NONSEQLIODN_SHIFT 4 | 242 | #define LDOFF_CHG_NONSEQLIODN_SHIFT 4 |
| 243 | #define LDOFF_CHG_NONSEQLIODN_MASK (0x3 << LDOFF_CHG_NONSEQLIODN_SHIFT) | 243 | #define LDOFF_CHG_NONSEQLIODN_MASK (0x3 << LDOFF_CHG_NONSEQLIODN_SHIFT) |
| 244 | #define LDOFF_CHG_NONSEQLIODN_SEQ (0x1 << LDOFF_CHG_NONSEQLIODN_SHIFT) | 244 | #define LDOFF_CHG_NONSEQLIODN_SEQ (0x1 << LDOFF_CHG_NONSEQLIODN_SHIFT) |
| 245 | #define LDOFF_CHG_NONSEQLIODN_NON_SEQ (0x2 << LDOFF_CHG_NONSEQLIODN_SHIFT) | 245 | #define LDOFF_CHG_NONSEQLIODN_NON_SEQ (0x2 << LDOFF_CHG_NONSEQLIODN_SHIFT) |
| 246 | #define LDOFF_CHG_NONSEQLIODN_TRUSTED (0x3 << LDOFF_CHG_NONSEQLIODN_SHIFT) | 246 | #define LDOFF_CHG_NONSEQLIODN_TRUSTED (0x3 << LDOFF_CHG_NONSEQLIODN_SHIFT) |
| 247 | 247 | ||
| 248 | #define LDOFF_CHG_SEQLIODN_SHIFT 6 | 248 | #define LDOFF_CHG_SEQLIODN_SHIFT 6 |
| 249 | #define LDOFF_CHG_SEQLIODN_MASK (0x3 << LDOFF_CHG_SEQLIODN_SHIFT) | 249 | #define LDOFF_CHG_SEQLIODN_MASK (0x3 << LDOFF_CHG_SEQLIODN_SHIFT) |
| 250 | #define LDOFF_CHG_SEQLIODN_SEQ (0x1 << LDOFF_CHG_SEQLIODN_SHIFT) | 250 | #define LDOFF_CHG_SEQLIODN_SEQ (0x1 << LDOFF_CHG_SEQLIODN_SHIFT) |
| 251 | #define LDOFF_CHG_SEQLIODN_NON_SEQ (0x2 << LDOFF_CHG_SEQLIODN_SHIFT) | 251 | #define LDOFF_CHG_SEQLIODN_NON_SEQ (0x2 << LDOFF_CHG_SEQLIODN_SHIFT) |
| 252 | #define LDOFF_CHG_SEQLIODN_TRUSTED (0x3 << LDOFF_CHG_SEQLIODN_SHIFT) | 252 | #define LDOFF_CHG_SEQLIODN_TRUSTED (0x3 << LDOFF_CHG_SEQLIODN_SHIFT) |
| 253 | 253 | ||
| 254 | /* Data length in bytes */ | 254 | /* Data length in bytes */ |
| 255 | #define LDST_LEN_SHIFT 0 | 255 | #define LDST_LEN_SHIFT 0 |
| 256 | #define LDST_LEN_MASK (0xff << LDST_LEN_SHIFT) | 256 | #define LDST_LEN_MASK (0xff << LDST_LEN_SHIFT) |
| 257 | 257 | ||
| 258 | /* Special Length definitions when dst=deco-ctrl */ | 258 | /* Special Length definitions when dst=deco-ctrl */ |
| 259 | #define LDLEN_ENABLE_OSL_COUNT (1 << 7) | 259 | #define LDLEN_ENABLE_OSL_COUNT (1 << 7) |
| 260 | #define LDLEN_RST_CHA_OFIFO_PTR (1 << 6) | 260 | #define LDLEN_RST_CHA_OFIFO_PTR (1 << 6) |
| 261 | #define LDLEN_RST_OFIFO (1 << 5) | 261 | #define LDLEN_RST_OFIFO (1 << 5) |
| 262 | #define LDLEN_SET_OFIFO_OFF_VALID (1 << 4) | 262 | #define LDLEN_SET_OFIFO_OFF_VALID (1 << 4) |
| 263 | #define LDLEN_SET_OFIFO_OFF_RSVD (1 << 3) | 263 | #define LDLEN_SET_OFIFO_OFF_RSVD (1 << 3) |
| 264 | #define LDLEN_SET_OFIFO_OFFSET_SHIFT 0 | 264 | #define LDLEN_SET_OFIFO_OFFSET_SHIFT 0 |
| 265 | #define LDLEN_SET_OFIFO_OFFSET_MASK (3 << LDLEN_SET_OFIFO_OFFSET_SHIFT) | 265 | #define LDLEN_SET_OFIFO_OFFSET_MASK (3 << LDLEN_SET_OFIFO_OFFSET_SHIFT) |
| 266 | 266 | ||
| 267 | /* | 267 | /* |
| 268 | * FIFO_LOAD/FIFO_STORE/SEQ_FIFO_LOAD/SEQ_FIFO_STORE | 268 | * FIFO_LOAD/FIFO_STORE/SEQ_FIFO_LOAD/SEQ_FIFO_STORE |
| @@ -274,808 +274,808 @@ | |||
| 274 | * 1 = Load for Class1, 2 = Load for Class2, 3 = Load both | 274 | * 1 = Load for Class1, 2 = Load for Class2, 3 = Load both |
| 275 | * Store Source: 0 = normal, 1 = Class1key, 2 = Class2key | 275 | * Store Source: 0 = normal, 1 = Class1key, 2 = Class2key |
| 276 | */ | 276 | */ |
| 277 | #define FIFOLD_CLASS_SHIFT 25 | 277 | #define FIFOLD_CLASS_SHIFT 25 |
| 278 | #define FIFOLD_CLASS_MASK (0x03 << FIFOLD_CLASS_SHIFT) | 278 | #define FIFOLD_CLASS_MASK (0x03 << FIFOLD_CLASS_SHIFT) |
| 279 | #define FIFOLD_CLASS_SKIP (0x00 << FIFOLD_CLASS_SHIFT) | 279 | #define FIFOLD_CLASS_SKIP (0x00 << FIFOLD_CLASS_SHIFT) |
| 280 | #define FIFOLD_CLASS_CLASS1 (0x01 << FIFOLD_CLASS_SHIFT) | 280 | #define FIFOLD_CLASS_CLASS1 (0x01 << FIFOLD_CLASS_SHIFT) |
| 281 | #define FIFOLD_CLASS_CLASS2 (0x02 << FIFOLD_CLASS_SHIFT) | 281 | #define FIFOLD_CLASS_CLASS2 (0x02 << FIFOLD_CLASS_SHIFT) |
| 282 | #define FIFOLD_CLASS_BOTH (0x03 << FIFOLD_CLASS_SHIFT) | 282 | #define FIFOLD_CLASS_BOTH (0x03 << FIFOLD_CLASS_SHIFT) |
| 283 | 283 | ||
| 284 | #define FIFOST_CLASS_SHIFT 25 | 284 | #define FIFOST_CLASS_SHIFT 25 |
| 285 | #define FIFOST_CLASS_MASK (0x03 << FIFOST_CLASS_SHIFT) | 285 | #define FIFOST_CLASS_MASK (0x03 << FIFOST_CLASS_SHIFT) |
| 286 | #define FIFOST_CLASS_NORMAL (0x00 << FIFOST_CLASS_SHIFT) | 286 | #define FIFOST_CLASS_NORMAL (0x00 << FIFOST_CLASS_SHIFT) |
| 287 | #define FIFOST_CLASS_CLASS1KEY (0x01 << FIFOST_CLASS_SHIFT) | 287 | #define FIFOST_CLASS_CLASS1KEY (0x01 << FIFOST_CLASS_SHIFT) |
| 288 | #define FIFOST_CLASS_CLASS2KEY (0x02 << FIFOST_CLASS_SHIFT) | 288 | #define FIFOST_CLASS_CLASS2KEY (0x02 << FIFOST_CLASS_SHIFT) |
| 289 | 289 | ||
| 290 | /* | 290 | /* |
| 291 | * Scatter-Gather Table/Variable Length Field | 291 | * Scatter-Gather Table/Variable Length Field |
| 292 | * If set for FIFO_LOAD, refers to a SG table. Within | 292 | * If set for FIFO_LOAD, refers to a SG table. Within |
| 293 | * SEQ_FIFO_LOAD, is variable input sequence | 293 | * SEQ_FIFO_LOAD, is variable input sequence |
| 294 | */ | 294 | */ |
| 295 | #define FIFOLDST_SGF_SHIFT 24 | 295 | #define FIFOLDST_SGF_SHIFT 24 |
| 296 | #define FIFOLDST_SGF_MASK (1 << FIFOLDST_SGF_SHIFT) | 296 | #define FIFOLDST_SGF_MASK (1 << FIFOLDST_SGF_SHIFT) |
| 297 | #define FIFOLDST_VLF_MASK (1 << FIFOLDST_SGF_SHIFT) | 297 | #define FIFOLDST_VLF_MASK (1 << FIFOLDST_SGF_SHIFT) |
| 298 | #define FIFOLDST_SGF (1 << FIFOLDST_SGF_SHIFT) | 298 | #define FIFOLDST_SGF (1 << FIFOLDST_SGF_SHIFT) |
| 299 | #define FIFOLDST_VLF (1 << FIFOLDST_SGF_SHIFT) | 299 | #define FIFOLDST_VLF (1 << FIFOLDST_SGF_SHIFT) |
| 300 | 300 | ||
| 301 | /* Immediate - Data follows command in descriptor */ | 301 | /* Immediate - Data follows command in descriptor */ |
| 302 | #define FIFOLD_IMM_SHIFT 23 | 302 | #define FIFOLD_IMM_SHIFT 23 |
| 303 | #define FIFOLD_IMM_MASK (1 << FIFOLD_IMM_SHIFT) | 303 | #define FIFOLD_IMM_MASK (1 << FIFOLD_IMM_SHIFT) |
| 304 | #define FIFOLD_IMM (1 << FIFOLD_IMM_SHIFT) | 304 | #define FIFOLD_IMM (1 << FIFOLD_IMM_SHIFT) |
| 305 | 305 | ||
| 306 | /* Continue - Not the last FIFO store to come */ | 306 | /* Continue - Not the last FIFO store to come */ |
| 307 | #define FIFOST_CONT_SHIFT 23 | 307 | #define FIFOST_CONT_SHIFT 23 |
| 308 | #define FIFOST_CONT_MASK (1 << FIFOST_CONT_SHIFT) | 308 | #define FIFOST_CONT_MASK (1 << FIFOST_CONT_SHIFT) |
| 309 | #define FIFOST_CONT_MASK (1 << FIFOST_CONT_SHIFT) | 309 | #define FIFOST_CONT_MASK (1 << FIFOST_CONT_SHIFT) |
| 310 | 310 | ||
| 311 | /* | 311 | /* |
| 312 | * Extended Length - use 32-bit extended length that | 312 | * Extended Length - use 32-bit extended length that |
| 313 | * follows the pointer field. Illegal with IMM set | 313 | * follows the pointer field. Illegal with IMM set |
| 314 | */ | 314 | */ |
| 315 | #define FIFOLDST_EXT_SHIFT 22 | 315 | #define FIFOLDST_EXT_SHIFT 22 |
| 316 | #define FIFOLDST_EXT_MASK (1 << FIFOLDST_EXT_SHIFT) | 316 | #define FIFOLDST_EXT_MASK (1 << FIFOLDST_EXT_SHIFT) |
| 317 | #define FIFOLDST_EXT (1 << FIFOLDST_EXT_SHIFT) | 317 | #define FIFOLDST_EXT (1 << FIFOLDST_EXT_SHIFT) |
| 318 | 318 | ||
| 319 | /* Input data type.*/ | 319 | /* Input data type.*/ |
| 320 | #define FIFOLD_TYPE_SHIFT 16 | 320 | #define FIFOLD_TYPE_SHIFT 16 |
| 321 | #define FIFOLD_CONT_TYPE_SHIFT 19 /* shift past last-flush bits */ | 321 | #define FIFOLD_CONT_TYPE_SHIFT 19 /* shift past last-flush bits */ |
| 322 | #define FIFOLD_TYPE_MASK (0x3f << FIFOLD_TYPE_SHIFT) | 322 | #define FIFOLD_TYPE_MASK (0x3f << FIFOLD_TYPE_SHIFT) |
| 323 | 323 | ||
| 324 | /* PK types */ | 324 | /* PK types */ |
| 325 | #define FIFOLD_TYPE_PK (0x00 << FIFOLD_TYPE_SHIFT) | 325 | #define FIFOLD_TYPE_PK (0x00 << FIFOLD_TYPE_SHIFT) |
| 326 | #define FIFOLD_TYPE_PK_MASK (0x30 << FIFOLD_TYPE_SHIFT) | 326 | #define FIFOLD_TYPE_PK_MASK (0x30 << FIFOLD_TYPE_SHIFT) |
| 327 | #define FIFOLD_TYPE_PK_TYPEMASK (0x0f << FIFOLD_TYPE_SHIFT) | 327 | #define FIFOLD_TYPE_PK_TYPEMASK (0x0f << FIFOLD_TYPE_SHIFT) |
| 328 | #define FIFOLD_TYPE_PK_A0 (0x00 << FIFOLD_TYPE_SHIFT) | 328 | #define FIFOLD_TYPE_PK_A0 (0x00 << FIFOLD_TYPE_SHIFT) |
| 329 | #define FIFOLD_TYPE_PK_A1 (0x01 << FIFOLD_TYPE_SHIFT) | 329 | #define FIFOLD_TYPE_PK_A1 (0x01 << FIFOLD_TYPE_SHIFT) |
| 330 | #define FIFOLD_TYPE_PK_A2 (0x02 << FIFOLD_TYPE_SHIFT) | 330 | #define FIFOLD_TYPE_PK_A2 (0x02 << FIFOLD_TYPE_SHIFT) |
| 331 | #define FIFOLD_TYPE_PK_A3 (0x03 << FIFOLD_TYPE_SHIFT) | 331 | #define FIFOLD_TYPE_PK_A3 (0x03 << FIFOLD_TYPE_SHIFT) |
| 332 | #define FIFOLD_TYPE_PK_B0 (0x04 << FIFOLD_TYPE_SHIFT) | 332 | #define FIFOLD_TYPE_PK_B0 (0x04 << FIFOLD_TYPE_SHIFT) |
| 333 | #define FIFOLD_TYPE_PK_B1 (0x05 << FIFOLD_TYPE_SHIFT) | 333 | #define FIFOLD_TYPE_PK_B1 (0x05 << FIFOLD_TYPE_SHIFT) |
| 334 | #define FIFOLD_TYPE_PK_B2 (0x06 << FIFOLD_TYPE_SHIFT) | 334 | #define FIFOLD_TYPE_PK_B2 (0x06 << FIFOLD_TYPE_SHIFT) |
| 335 | #define FIFOLD_TYPE_PK_B3 (0x07 << FIFOLD_TYPE_SHIFT) | 335 | #define FIFOLD_TYPE_PK_B3 (0x07 << FIFOLD_TYPE_SHIFT) |
| 336 | #define FIFOLD_TYPE_PK_N (0x08 << FIFOLD_TYPE_SHIFT) | 336 | #define FIFOLD_TYPE_PK_N (0x08 << FIFOLD_TYPE_SHIFT) |
| 337 | #define FIFOLD_TYPE_PK_A (0x0c << FIFOLD_TYPE_SHIFT) | 337 | #define FIFOLD_TYPE_PK_A (0x0c << FIFOLD_TYPE_SHIFT) |
| 338 | #define FIFOLD_TYPE_PK_B (0x0d << FIFOLD_TYPE_SHIFT) | 338 | #define FIFOLD_TYPE_PK_B (0x0d << FIFOLD_TYPE_SHIFT) |
| 339 | 339 | ||
| 340 | /* Other types. Need to OR in last/flush bits as desired */ | 340 | /* Other types. Need to OR in last/flush bits as desired */ |
| 341 | #define FIFOLD_TYPE_MSG_MASK (0x38 << FIFOLD_TYPE_SHIFT) | 341 | #define FIFOLD_TYPE_MSG_MASK (0x38 << FIFOLD_TYPE_SHIFT) |
| 342 | #define FIFOLD_TYPE_MSG (0x10 << FIFOLD_TYPE_SHIFT) | 342 | #define FIFOLD_TYPE_MSG (0x10 << FIFOLD_TYPE_SHIFT) |
| 343 | #define FIFOLD_TYPE_MSG1OUT2 (0x18 << FIFOLD_TYPE_SHIFT) | 343 | #define FIFOLD_TYPE_MSG1OUT2 (0x18 << FIFOLD_TYPE_SHIFT) |
| 344 | #define FIFOLD_TYPE_IV (0x20 << FIFOLD_TYPE_SHIFT) | 344 | #define FIFOLD_TYPE_IV (0x20 << FIFOLD_TYPE_SHIFT) |
| 345 | #define FIFOLD_TYPE_BITDATA (0x28 << FIFOLD_TYPE_SHIFT) | 345 | #define FIFOLD_TYPE_BITDATA (0x28 << FIFOLD_TYPE_SHIFT) |
| 346 | #define FIFOLD_TYPE_AAD (0x30 << FIFOLD_TYPE_SHIFT) | 346 | #define FIFOLD_TYPE_AAD (0x30 << FIFOLD_TYPE_SHIFT) |
| 347 | #define FIFOLD_TYPE_ICV (0x38 << FIFOLD_TYPE_SHIFT) | 347 | #define FIFOLD_TYPE_ICV (0x38 << FIFOLD_TYPE_SHIFT) |
| 348 | 348 | ||
| 349 | /* Last/Flush bits for use with "other" types above */ | 349 | /* Last/Flush bits for use with "other" types above */ |
| 350 | #define FIFOLD_TYPE_ACT_MASK (0x07 << FIFOLD_TYPE_SHIFT) | 350 | #define FIFOLD_TYPE_ACT_MASK (0x07 << FIFOLD_TYPE_SHIFT) |
| 351 | #define FIFOLD_TYPE_NOACTION (0x00 << FIFOLD_TYPE_SHIFT) | 351 | #define FIFOLD_TYPE_NOACTION (0x00 << FIFOLD_TYPE_SHIFT) |
| 352 | #define FIFOLD_TYPE_FLUSH1 (0x01 << FIFOLD_TYPE_SHIFT) | 352 | #define FIFOLD_TYPE_FLUSH1 (0x01 << FIFOLD_TYPE_SHIFT) |
| 353 | #define FIFOLD_TYPE_LAST1 (0x02 << FIFOLD_TYPE_SHIFT) | 353 | #define FIFOLD_TYPE_LAST1 (0x02 << FIFOLD_TYPE_SHIFT) |
| 354 | #define FIFOLD_TYPE_LAST2FLUSH (0x03 << FIFOLD_TYPE_SHIFT) | 354 | #define FIFOLD_TYPE_LAST2FLUSH (0x03 << FIFOLD_TYPE_SHIFT) |
| 355 | #define FIFOLD_TYPE_LAST2 (0x04 << FIFOLD_TYPE_SHIFT) | 355 | #define FIFOLD_TYPE_LAST2 (0x04 << FIFOLD_TYPE_SHIFT) |
| 356 | #define FIFOLD_TYPE_LAST2FLUSH1 (0x05 << FIFOLD_TYPE_SHIFT) | 356 | #define FIFOLD_TYPE_LAST2FLUSH1 (0x05 << FIFOLD_TYPE_SHIFT) |
| 357 | #define FIFOLD_TYPE_LASTBOTH (0x06 << FIFOLD_TYPE_SHIFT) | 357 | #define FIFOLD_TYPE_LASTBOTH (0x06 << FIFOLD_TYPE_SHIFT) |
| 358 | #define FIFOLD_TYPE_LASTBOTHFL (0x07 << FIFOLD_TYPE_SHIFT) | 358 | #define FIFOLD_TYPE_LASTBOTHFL (0x07 << FIFOLD_TYPE_SHIFT) |
| 359 | 359 | ||
| 360 | #define FIFOLDST_LEN_MASK 0xffff | 360 | #define FIFOLDST_LEN_MASK 0xffff |
| 361 | #define FIFOLDST_EXT_LEN_MASK 0xffffffff | 361 | #define FIFOLDST_EXT_LEN_MASK 0xffffffff |
| 362 | 362 | ||
| 363 | /* Output data types */ | 363 | /* Output data types */ |
| 364 | #define FIFOST_TYPE_SHIFT 16 | 364 | #define FIFOST_TYPE_SHIFT 16 |
| 365 | #define FIFOST_TYPE_MASK (0x3f << FIFOST_TYPE_SHIFT) | 365 | #define FIFOST_TYPE_MASK (0x3f << FIFOST_TYPE_SHIFT) |
| 366 | 366 | ||
| 367 | #define FIFOST_TYPE_PKHA_A0 (0x00 << FIFOST_TYPE_SHIFT) | 367 | #define FIFOST_TYPE_PKHA_A0 (0x00 << FIFOST_TYPE_SHIFT) |
| 368 | #define FIFOST_TYPE_PKHA_A1 (0x01 << FIFOST_TYPE_SHIFT) | 368 | #define FIFOST_TYPE_PKHA_A1 (0x01 << FIFOST_TYPE_SHIFT) |
| 369 | #define FIFOST_TYPE_PKHA_A2 (0x02 << FIFOST_TYPE_SHIFT) | 369 | #define FIFOST_TYPE_PKHA_A2 (0x02 << FIFOST_TYPE_SHIFT) |
| 370 | #define FIFOST_TYPE_PKHA_A3 (0x03 << FIFOST_TYPE_SHIFT) | 370 | #define FIFOST_TYPE_PKHA_A3 (0x03 << FIFOST_TYPE_SHIFT) |
| 371 | #define FIFOST_TYPE_PKHA_B0 (0x04 << FIFOST_TYPE_SHIFT) | 371 | #define FIFOST_TYPE_PKHA_B0 (0x04 << FIFOST_TYPE_SHIFT) |
| 372 | #define FIFOST_TYPE_PKHA_B1 (0x05 << FIFOST_TYPE_SHIFT) | 372 | #define FIFOST_TYPE_PKHA_B1 (0x05 << FIFOST_TYPE_SHIFT) |
| 373 | #define FIFOST_TYPE_PKHA_B2 (0x06 << FIFOST_TYPE_SHIFT) | 373 | #define FIFOST_TYPE_PKHA_B2 (0x06 << FIFOST_TYPE_SHIFT) |
| 374 | #define FIFOST_TYPE_PKHA_B3 (0x07 << FIFOST_TYPE_SHIFT) | 374 | #define FIFOST_TYPE_PKHA_B3 (0x07 << FIFOST_TYPE_SHIFT) |
| 375 | #define FIFOST_TYPE_PKHA_N (0x08 << FIFOST_TYPE_SHIFT) | 375 | #define FIFOST_TYPE_PKHA_N (0x08 << FIFOST_TYPE_SHIFT) |
| 376 | #define FIFOST_TYPE_PKHA_A (0x0c << FIFOST_TYPE_SHIFT) | 376 | #define FIFOST_TYPE_PKHA_A (0x0c << FIFOST_TYPE_SHIFT) |
| 377 | #define FIFOST_TYPE_PKHA_B (0x0d << FIFOST_TYPE_SHIFT) | 377 | #define FIFOST_TYPE_PKHA_B (0x0d << FIFOST_TYPE_SHIFT) |
| 378 | #define FIFOST_TYPE_AF_SBOX_JKEK (0x10 << FIFOST_TYPE_SHIFT) | 378 | #define FIFOST_TYPE_AF_SBOX_JKEK (0x10 << FIFOST_TYPE_SHIFT) |
| 379 | #define FIFOST_TYPE_AF_SBOX_TKEK (0x21 << FIFOST_TYPE_SHIFT) | 379 | #define FIFOST_TYPE_AF_SBOX_TKEK (0x21 << FIFOST_TYPE_SHIFT) |
| 380 | #define FIFOST_TYPE_PKHA_E_JKEK (0x22 << FIFOST_TYPE_SHIFT) | 380 | #define FIFOST_TYPE_PKHA_E_JKEK (0x22 << FIFOST_TYPE_SHIFT) |
| 381 | #define FIFOST_TYPE_PKHA_E_TKEK (0x23 << FIFOST_TYPE_SHIFT) | 381 | #define FIFOST_TYPE_PKHA_E_TKEK (0x23 << FIFOST_TYPE_SHIFT) |
| 382 | #define FIFOST_TYPE_KEY_KEK (0x24 << FIFOST_TYPE_SHIFT) | 382 | #define FIFOST_TYPE_KEY_KEK (0x24 << FIFOST_TYPE_SHIFT) |
| 383 | #define FIFOST_TYPE_KEY_TKEK (0x25 << FIFOST_TYPE_SHIFT) | 383 | #define FIFOST_TYPE_KEY_TKEK (0x25 << FIFOST_TYPE_SHIFT) |
| 384 | #define FIFOST_TYPE_SPLIT_KEK (0x26 << FIFOST_TYPE_SHIFT) | 384 | #define FIFOST_TYPE_SPLIT_KEK (0x26 << FIFOST_TYPE_SHIFT) |
| 385 | #define FIFOST_TYPE_SPLIT_TKEK (0x27 << FIFOST_TYPE_SHIFT) | 385 | #define FIFOST_TYPE_SPLIT_TKEK (0x27 << FIFOST_TYPE_SHIFT) |
| 386 | #define FIFOST_TYPE_OUTFIFO_KEK (0x28 << FIFOST_TYPE_SHIFT) | 386 | #define FIFOST_TYPE_OUTFIFO_KEK (0x28 << FIFOST_TYPE_SHIFT) |
| 387 | #define FIFOST_TYPE_OUTFIFO_TKEK (0x29 << FIFOST_TYPE_SHIFT) | 387 | #define FIFOST_TYPE_OUTFIFO_TKEK (0x29 << FIFOST_TYPE_SHIFT) |
| 388 | #define FIFOST_TYPE_MESSAGE_DATA (0x30 << FIFOST_TYPE_SHIFT) | 388 | #define FIFOST_TYPE_MESSAGE_DATA (0x30 << FIFOST_TYPE_SHIFT) |
| 389 | #define FIFOST_TYPE_RNGSTORE (0x34 << FIFOST_TYPE_SHIFT) | 389 | #define FIFOST_TYPE_RNGSTORE (0x34 << FIFOST_TYPE_SHIFT) |
| 390 | #define FIFOST_TYPE_RNGFIFO (0x35 << FIFOST_TYPE_SHIFT) | 390 | #define FIFOST_TYPE_RNGFIFO (0x35 << FIFOST_TYPE_SHIFT) |
| 391 | #define FIFOST_TYPE_SKIP (0x3f << FIFOST_TYPE_SHIFT) | 391 | #define FIFOST_TYPE_SKIP (0x3f << FIFOST_TYPE_SHIFT) |
| 392 | 392 | ||
| 393 | /* | 393 | /* |
| 394 | * OPERATION Command Constructs | 394 | * OPERATION Command Constructs |
| 395 | */ | 395 | */ |
| 396 | 396 | ||
| 397 | /* Operation type selectors - OP TYPE */ | 397 | /* Operation type selectors - OP TYPE */ |
| 398 | #define OP_TYPE_SHIFT 24 | 398 | #define OP_TYPE_SHIFT 24 |
| 399 | #define OP_TYPE_MASK (0x07 << OP_TYPE_SHIFT) | 399 | #define OP_TYPE_MASK (0x07 << OP_TYPE_SHIFT) |
| 400 | 400 | ||
| 401 | #define OP_TYPE_UNI_PROTOCOL (0x00 << OP_TYPE_SHIFT) | 401 | #define OP_TYPE_UNI_PROTOCOL (0x00 << OP_TYPE_SHIFT) |
| 402 | #define OP_TYPE_PK (0x01 << OP_TYPE_SHIFT) | 402 | #define OP_TYPE_PK (0x01 << OP_TYPE_SHIFT) |
| 403 | #define OP_TYPE_CLASS1_ALG (0x02 << OP_TYPE_SHIFT) | 403 | #define OP_TYPE_CLASS1_ALG (0x02 << OP_TYPE_SHIFT) |
| 404 | #define OP_TYPE_CLASS2_ALG (0x04 << OP_TYPE_SHIFT) | 404 | #define OP_TYPE_CLASS2_ALG (0x04 << OP_TYPE_SHIFT) |
| 405 | #define OP_TYPE_DECAP_PROTOCOL (0x06 << OP_TYPE_SHIFT) | 405 | #define OP_TYPE_DECAP_PROTOCOL (0x06 << OP_TYPE_SHIFT) |
| 406 | #define OP_TYPE_ENCAP_PROTOCOL (0x07 << OP_TYPE_SHIFT) | 406 | #define OP_TYPE_ENCAP_PROTOCOL (0x07 << OP_TYPE_SHIFT) |
| 407 | 407 | ||
| 408 | /* ProtocolID selectors - PROTID */ | 408 | /* ProtocolID selectors - PROTID */ |
| 409 | #define OP_PCLID_SHIFT 16 | 409 | #define OP_PCLID_SHIFT 16 |
| 410 | #define OP_PCLID_MASK (0xff << 16) | 410 | #define OP_PCLID_MASK (0xff << 16) |
| 411 | 411 | ||
| 412 | /* Assuming OP_TYPE = OP_TYPE_UNI_PROTOCOL */ | 412 | /* Assuming OP_TYPE = OP_TYPE_UNI_PROTOCOL */ |
| 413 | #define OP_PCLID_IKEV1_PRF (0x01 << OP_PCLID_SHIFT) | 413 | #define OP_PCLID_IKEV1_PRF (0x01 << OP_PCLID_SHIFT) |
| 414 | #define OP_PCLID_IKEV2_PRF (0x02 << OP_PCLID_SHIFT) | 414 | #define OP_PCLID_IKEV2_PRF (0x02 << OP_PCLID_SHIFT) |
| 415 | #define OP_PCLID_SSL30_PRF (0x08 << OP_PCLID_SHIFT) | 415 | #define OP_PCLID_SSL30_PRF (0x08 << OP_PCLID_SHIFT) |
| 416 | #define OP_PCLID_TLS10_PRF (0x09 << OP_PCLID_SHIFT) | 416 | #define OP_PCLID_TLS10_PRF (0x09 << OP_PCLID_SHIFT) |
| 417 | #define OP_PCLID_TLS11_PRF (0x0a << OP_PCLID_SHIFT) | 417 | #define OP_PCLID_TLS11_PRF (0x0a << OP_PCLID_SHIFT) |
| 418 | #define OP_PCLID_DTLS10_PRF (0x0c << OP_PCLID_SHIFT) | 418 | #define OP_PCLID_DTLS10_PRF (0x0c << OP_PCLID_SHIFT) |
| 419 | #define OP_PCLID_PRF (0x06 << OP_PCLID_SHIFT) | 419 | #define OP_PCLID_PRF (0x06 << OP_PCLID_SHIFT) |
| 420 | #define OP_PCLID_BLOB (0x0d << OP_PCLID_SHIFT) | 420 | #define OP_PCLID_BLOB (0x0d << OP_PCLID_SHIFT) |
| 421 | #define OP_PCLID_SECRETKEY (0x11 << OP_PCLID_SHIFT) | 421 | #define OP_PCLID_SECRETKEY (0x11 << OP_PCLID_SHIFT) |
| 422 | #define OP_PCLID_PUBLICKEYPAIR (0x14 << OP_PCLID_SHIFT) | 422 | #define OP_PCLID_PUBLICKEYPAIR (0x14 << OP_PCLID_SHIFT) |
| 423 | #define OP_PCLID_DSASIGN (0x15 << OP_PCLID_SHIFT) | 423 | #define OP_PCLID_DSASIGN (0x15 << OP_PCLID_SHIFT) |
| 424 | #define OP_PCLID_DSAVERIFY (0x16 << OP_PCLID_SHIFT) | 424 | #define OP_PCLID_DSAVERIFY (0x16 << OP_PCLID_SHIFT) |
| 425 | 425 | ||
| 426 | /* Assuming OP_TYPE = OP_TYPE_DECAP_PROTOCOL/ENCAP_PROTOCOL */ | 426 | /* Assuming OP_TYPE = OP_TYPE_DECAP_PROTOCOL/ENCAP_PROTOCOL */ |
| 427 | #define OP_PCLID_IPSEC (0x01 << OP_PCLID_SHIFT) | 427 | #define OP_PCLID_IPSEC (0x01 << OP_PCLID_SHIFT) |
| 428 | #define OP_PCLID_SRTP (0x02 << OP_PCLID_SHIFT) | 428 | #define OP_PCLID_SRTP (0x02 << OP_PCLID_SHIFT) |
| 429 | #define OP_PCLID_MACSEC (0x03 << OP_PCLID_SHIFT) | 429 | #define OP_PCLID_MACSEC (0x03 << OP_PCLID_SHIFT) |
| 430 | #define OP_PCLID_WIFI (0x04 << OP_PCLID_SHIFT) | 430 | #define OP_PCLID_WIFI (0x04 << OP_PCLID_SHIFT) |
| 431 | #define OP_PCLID_WIMAX (0x05 << OP_PCLID_SHIFT) | 431 | #define OP_PCLID_WIMAX (0x05 << OP_PCLID_SHIFT) |
| 432 | #define OP_PCLID_SSL30 (0x08 << OP_PCLID_SHIFT) | 432 | #define OP_PCLID_SSL30 (0x08 << OP_PCLID_SHIFT) |
| 433 | #define OP_PCLID_TLS10 (0x09 << OP_PCLID_SHIFT) | 433 | #define OP_PCLID_TLS10 (0x09 << OP_PCLID_SHIFT) |
| 434 | #define OP_PCLID_TLS11 (0x0a << OP_PCLID_SHIFT) | 434 | #define OP_PCLID_TLS11 (0x0a << OP_PCLID_SHIFT) |
| 435 | #define OP_PCLID_TLS12 (0x0b << OP_PCLID_SHIFT) | 435 | #define OP_PCLID_TLS12 (0x0b << OP_PCLID_SHIFT) |
| 436 | #define OP_PCLID_DTLS (0x0c << OP_PCLID_SHIFT) | 436 | #define OP_PCLID_DTLS (0x0c << OP_PCLID_SHIFT) |
| 437 | 437 | ||
| 438 | /* | 438 | /* |
| 439 | * ProtocolInfo selectors | 439 | * ProtocolInfo selectors |
| 440 | */ | 440 | */ |
| 441 | #define OP_PCLINFO_MASK 0xffff | 441 | #define OP_PCLINFO_MASK 0xffff |
| 442 | 442 | ||
| 443 | /* for OP_PCLID_IPSEC */ | 443 | /* for OP_PCLID_IPSEC */ |
| 444 | #define OP_PCL_IPSEC_CIPHER_MASK 0xff00 | 444 | #define OP_PCL_IPSEC_CIPHER_MASK 0xff00 |
| 445 | #define OP_PCL_IPSEC_AUTH_MASK 0x00ff | 445 | #define OP_PCL_IPSEC_AUTH_MASK 0x00ff |
| 446 | 446 | ||
| 447 | #define OP_PCL_IPSEC_DES_IV64 0x0100 | 447 | #define OP_PCL_IPSEC_DES_IV64 0x0100 |
| 448 | #define OP_PCL_IPSEC_DES 0x0200 | 448 | #define OP_PCL_IPSEC_DES 0x0200 |
| 449 | #define OP_PCL_IPSEC_3DES 0x0300 | 449 | #define OP_PCL_IPSEC_3DES 0x0300 |
| 450 | #define OP_PCL_IPSEC_AES_CBC 0x0c00 | 450 | #define OP_PCL_IPSEC_AES_CBC 0x0c00 |
| 451 | #define OP_PCL_IPSEC_AES_CTR 0x0d00 | 451 | #define OP_PCL_IPSEC_AES_CTR 0x0d00 |
| 452 | #define OP_PCL_IPSEC_AES_XTS 0x1600 | 452 | #define OP_PCL_IPSEC_AES_XTS 0x1600 |
| 453 | #define OP_PCL_IPSEC_AES_CCM8 0x0e00 | 453 | #define OP_PCL_IPSEC_AES_CCM8 0x0e00 |
| 454 | #define OP_PCL_IPSEC_AES_CCM12 0x0f00 | 454 | #define OP_PCL_IPSEC_AES_CCM12 0x0f00 |
| 455 | #define OP_PCL_IPSEC_AES_CCM16 0x1000 | 455 | #define OP_PCL_IPSEC_AES_CCM16 0x1000 |
| 456 | #define OP_PCL_IPSEC_AES_GCM8 0x1200 | 456 | #define OP_PCL_IPSEC_AES_GCM8 0x1200 |
| 457 | #define OP_PCL_IPSEC_AES_GCM12 0x1300 | 457 | #define OP_PCL_IPSEC_AES_GCM12 0x1300 |
| 458 | #define OP_PCL_IPSEC_AES_GCM16 0x1400 | 458 | #define OP_PCL_IPSEC_AES_GCM16 0x1400 |
| 459 | 459 | ||
| 460 | #define OP_PCL_IPSEC_HMAC_NULL 0x0000 | 460 | #define OP_PCL_IPSEC_HMAC_NULL 0x0000 |
| 461 | #define OP_PCL_IPSEC_HMAC_MD5_96 0x0001 | 461 | #define OP_PCL_IPSEC_HMAC_MD5_96 0x0001 |
| 462 | #define OP_PCL_IPSEC_HMAC_SHA1_96 0x0002 | 462 | #define OP_PCL_IPSEC_HMAC_SHA1_96 0x0002 |
| 463 | #define OP_PCL_IPSEC_AES_XCBC_MAC_96 0x0005 | 463 | #define OP_PCL_IPSEC_AES_XCBC_MAC_96 0x0005 |
| 464 | #define OP_PCL_IPSEC_HMAC_MD5_128 0x0006 | 464 | #define OP_PCL_IPSEC_HMAC_MD5_128 0x0006 |
| 465 | #define OP_PCL_IPSEC_HMAC_SHA1_160 0x0007 | 465 | #define OP_PCL_IPSEC_HMAC_SHA1_160 0x0007 |
| 466 | #define OP_PCL_IPSEC_HMAC_SHA2_256_128 0x000c | 466 | #define OP_PCL_IPSEC_HMAC_SHA2_256_128 0x000c |
| 467 | #define OP_PCL_IPSEC_HMAC_SHA2_384_192 0x000d | 467 | #define OP_PCL_IPSEC_HMAC_SHA2_384_192 0x000d |
| 468 | #define OP_PCL_IPSEC_HMAC_SHA2_512_256 0x000e | 468 | #define OP_PCL_IPSEC_HMAC_SHA2_512_256 0x000e |
| 469 | 469 | ||
| 470 | /* For SRTP - OP_PCLID_SRTP */ | 470 | /* For SRTP - OP_PCLID_SRTP */ |
| 471 | #define OP_PCL_SRTP_CIPHER_MASK 0xff00 | 471 | #define OP_PCL_SRTP_CIPHER_MASK 0xff00 |
| 472 | #define OP_PCL_SRTP_AUTH_MASK 0x00ff | 472 | #define OP_PCL_SRTP_AUTH_MASK 0x00ff |
| 473 | 473 | ||
| 474 | #define OP_PCL_SRTP_AES_CTR 0x0d00 | 474 | #define OP_PCL_SRTP_AES_CTR 0x0d00 |
| 475 | 475 | ||
| 476 | #define OP_PCL_SRTP_HMAC_SHA1_160 0x0007 | 476 | #define OP_PCL_SRTP_HMAC_SHA1_160 0x0007 |
| 477 | 477 | ||
| 478 | /* For SSL 3.0 - OP_PCLID_SSL30 */ | 478 | /* For SSL 3.0 - OP_PCLID_SSL30 */ |
| 479 | #define OP_PCL_SSL30_AES_128_CBC_SHA 0x002f | 479 | #define OP_PCL_SSL30_AES_128_CBC_SHA 0x002f |
| 480 | #define OP_PCL_SSL30_AES_128_CBC_SHA_2 0x0030 | 480 | #define OP_PCL_SSL30_AES_128_CBC_SHA_2 0x0030 |
| 481 | #define OP_PCL_SSL30_AES_128_CBC_SHA_3 0x0031 | 481 | #define OP_PCL_SSL30_AES_128_CBC_SHA_3 0x0031 |
| 482 | #define OP_PCL_SSL30_AES_128_CBC_SHA_4 0x0032 | 482 | #define OP_PCL_SSL30_AES_128_CBC_SHA_4 0x0032 |
| 483 | #define OP_PCL_SSL30_AES_128_CBC_SHA_5 0x0033 | 483 | #define OP_PCL_SSL30_AES_128_CBC_SHA_5 0x0033 |
| 484 | #define OP_PCL_SSL30_AES_128_CBC_SHA_6 0x0034 | 484 | #define OP_PCL_SSL30_AES_128_CBC_SHA_6 0x0034 |
| 485 | #define OP_PCL_SSL30_AES_128_CBC_SHA_7 0x008c | 485 | #define OP_PCL_SSL30_AES_128_CBC_SHA_7 0x008c |
| 486 | #define OP_PCL_SSL30_AES_128_CBC_SHA_8 0x0090 | 486 | #define OP_PCL_SSL30_AES_128_CBC_SHA_8 0x0090 |
| 487 | #define OP_PCL_SSL30_AES_128_CBC_SHA_9 0x0094 | 487 | #define OP_PCL_SSL30_AES_128_CBC_SHA_9 0x0094 |
| 488 | #define OP_PCL_SSL30_AES_128_CBC_SHA_10 0xc004 | 488 | #define OP_PCL_SSL30_AES_128_CBC_SHA_10 0xc004 |
| 489 | #define OP_PCL_SSL30_AES_128_CBC_SHA_11 0xc009 | 489 | #define OP_PCL_SSL30_AES_128_CBC_SHA_11 0xc009 |
| 490 | #define OP_PCL_SSL30_AES_128_CBC_SHA_12 0xc00e | 490 | #define OP_PCL_SSL30_AES_128_CBC_SHA_12 0xc00e |
| 491 | #define OP_PCL_SSL30_AES_128_CBC_SHA_13 0xc013 | 491 | #define OP_PCL_SSL30_AES_128_CBC_SHA_13 0xc013 |
| 492 | #define OP_PCL_SSL30_AES_128_CBC_SHA_14 0xc018 | 492 | #define OP_PCL_SSL30_AES_128_CBC_SHA_14 0xc018 |
| 493 | #define OP_PCL_SSL30_AES_128_CBC_SHA_15 0xc01d | 493 | #define OP_PCL_SSL30_AES_128_CBC_SHA_15 0xc01d |
| 494 | #define OP_PCL_SSL30_AES_128_CBC_SHA_16 0xc01e | 494 | #define OP_PCL_SSL30_AES_128_CBC_SHA_16 0xc01e |
| 495 | #define OP_PCL_SSL30_AES_128_CBC_SHA_17 0xc01f | 495 | #define OP_PCL_SSL30_AES_128_CBC_SHA_17 0xc01f |
| 496 | 496 | ||
| 497 | #define OP_PCL_SSL30_AES_256_CBC_SHA 0x0035 | 497 | #define OP_PCL_SSL30_AES_256_CBC_SHA 0x0035 |
| 498 | #define OP_PCL_SSL30_AES_256_CBC_SHA_2 0x0036 | 498 | #define OP_PCL_SSL30_AES_256_CBC_SHA_2 0x0036 |
| 499 | #define OP_PCL_SSL30_AES_256_CBC_SHA_3 0x0037 | 499 | #define OP_PCL_SSL30_AES_256_CBC_SHA_3 0x0037 |
| 500 | #define OP_PCL_SSL30_AES_256_CBC_SHA_4 0x0038 | 500 | #define OP_PCL_SSL30_AES_256_CBC_SHA_4 0x0038 |
| 501 | #define OP_PCL_SSL30_AES_256_CBC_SHA_5 0x0039 | 501 | #define OP_PCL_SSL30_AES_256_CBC_SHA_5 0x0039 |
| 502 | #define OP_PCL_SSL30_AES_256_CBC_SHA_6 0x003a | 502 | #define OP_PCL_SSL30_AES_256_CBC_SHA_6 0x003a |
| 503 | #define OP_PCL_SSL30_AES_256_CBC_SHA_7 0x008d | 503 | #define OP_PCL_SSL30_AES_256_CBC_SHA_7 0x008d |
| 504 | #define OP_PCL_SSL30_AES_256_CBC_SHA_8 0x0091 | 504 | #define OP_PCL_SSL30_AES_256_CBC_SHA_8 0x0091 |
| 505 | #define OP_PCL_SSL30_AES_256_CBC_SHA_9 0x0095 | 505 | #define OP_PCL_SSL30_AES_256_CBC_SHA_9 0x0095 |
| 506 | #define OP_PCL_SSL30_AES_256_CBC_SHA_10 0xc005 | 506 | #define OP_PCL_SSL30_AES_256_CBC_SHA_10 0xc005 |
| 507 | #define OP_PCL_SSL30_AES_256_CBC_SHA_11 0xc00a | 507 | #define OP_PCL_SSL30_AES_256_CBC_SHA_11 0xc00a |
| 508 | #define OP_PCL_SSL30_AES_256_CBC_SHA_12 0xc00f | 508 | #define OP_PCL_SSL30_AES_256_CBC_SHA_12 0xc00f |
| 509 | #define OP_PCL_SSL30_AES_256_CBC_SHA_13 0xc014 | 509 | #define OP_PCL_SSL30_AES_256_CBC_SHA_13 0xc014 |
| 510 | #define OP_PCL_SSL30_AES_256_CBC_SHA_14 0xc019 | 510 | #define OP_PCL_SSL30_AES_256_CBC_SHA_14 0xc019 |
| 511 | #define OP_PCL_SSL30_AES_256_CBC_SHA_15 0xc020 | 511 | #define OP_PCL_SSL30_AES_256_CBC_SHA_15 0xc020 |
| 512 | #define OP_PCL_SSL30_AES_256_CBC_SHA_16 0xc021 | 512 | #define OP_PCL_SSL30_AES_256_CBC_SHA_16 0xc021 |
| 513 | #define OP_PCL_SSL30_AES_256_CBC_SHA_17 0xc022 | 513 | #define OP_PCL_SSL30_AES_256_CBC_SHA_17 0xc022 |
| 514 | 514 | ||
| 515 | #define OP_PCL_SSL30_3DES_EDE_CBC_MD5 0x0023 | 515 | #define OP_PCL_SSL30_3DES_EDE_CBC_MD5 0x0023 |
| 516 | 516 | ||
| 517 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA 0x001f | 517 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA 0x001f |
| 518 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_2 0x008b | 518 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_2 0x008b |
| 519 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_3 0x008f | 519 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_3 0x008f |
| 520 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_4 0x0093 | 520 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_4 0x0093 |
| 521 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_5 0x000a | 521 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_5 0x000a |
| 522 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_6 0x000d | 522 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_6 0x000d |
| 523 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_7 0x0010 | 523 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_7 0x0010 |
| 524 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_8 0x0013 | 524 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_8 0x0013 |
| 525 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_9 0x0016 | 525 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_9 0x0016 |
| 526 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_10 0x001b | 526 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_10 0x001b |
| 527 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_11 0xc003 | 527 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_11 0xc003 |
| 528 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_12 0xc008 | 528 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_12 0xc008 |
| 529 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_13 0xc00d | 529 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_13 0xc00d |
| 530 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_14 0xc012 | 530 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_14 0xc012 |
| 531 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_15 0xc017 | 531 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_15 0xc017 |
| 532 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_16 0xc01a | 532 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_16 0xc01a |
| 533 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_17 0xc01b | 533 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_17 0xc01b |
| 534 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_18 0xc01c | 534 | #define OP_PCL_SSL30_3DES_EDE_CBC_SHA_18 0xc01c |
| 535 | 535 | ||
| 536 | #define OP_PCL_SSL30_DES40_CBC_MD5 0x0029 | 536 | #define OP_PCL_SSL30_DES40_CBC_MD5 0x0029 |
| 537 | 537 | ||
| 538 | #define OP_PCL_SSL30_DES_CBC_MD5 0x0022 | 538 | #define OP_PCL_SSL30_DES_CBC_MD5 0x0022 |
| 539 | 539 | ||
| 540 | #define OP_PCL_SSL30_DES40_CBC_SHA 0x0008 | 540 | #define OP_PCL_SSL30_DES40_CBC_SHA 0x0008 |
| 541 | #define OP_PCL_SSL30_DES40_CBC_SHA_2 0x000b | 541 | #define OP_PCL_SSL30_DES40_CBC_SHA_2 0x000b |
| 542 | #define OP_PCL_SSL30_DES40_CBC_SHA_3 0x000e | 542 | #define OP_PCL_SSL30_DES40_CBC_SHA_3 0x000e |
| 543 | #define OP_PCL_SSL30_DES40_CBC_SHA_4 0x0011 | 543 | #define OP_PCL_SSL30_DES40_CBC_SHA_4 0x0011 |
| 544 | #define OP_PCL_SSL30_DES40_CBC_SHA_5 0x0014 | 544 | #define OP_PCL_SSL30_DES40_CBC_SHA_5 0x0014 |
| 545 | #define OP_PCL_SSL30_DES40_CBC_SHA_6 0x0019 | 545 | #define OP_PCL_SSL30_DES40_CBC_SHA_6 0x0019 |
| 546 | #define OP_PCL_SSL30_DES40_CBC_SHA_7 0x0026 | 546 | #define OP_PCL_SSL30_DES40_CBC_SHA_7 0x0026 |
| 547 | 547 | ||
| 548 | #define OP_PCL_SSL30_DES_CBC_SHA 0x001e | 548 | #define OP_PCL_SSL30_DES_CBC_SHA 0x001e |
| 549 | #define OP_PCL_SSL30_DES_CBC_SHA_2 0x0009 | 549 | #define OP_PCL_SSL30_DES_CBC_SHA_2 0x0009 |
| 550 | #define OP_PCL_SSL30_DES_CBC_SHA_3 0x000c | 550 | #define OP_PCL_SSL30_DES_CBC_SHA_3 0x000c |
| 551 | #define OP_PCL_SSL30_DES_CBC_SHA_4 0x000f | 551 | #define OP_PCL_SSL30_DES_CBC_SHA_4 0x000f |
| 552 | #define OP_PCL_SSL30_DES_CBC_SHA_5 0x0012 | 552 | #define OP_PCL_SSL30_DES_CBC_SHA_5 0x0012 |
| 553 | #define OP_PCL_SSL30_DES_CBC_SHA_6 0x0015 | 553 | #define OP_PCL_SSL30_DES_CBC_SHA_6 0x0015 |
| 554 | #define OP_PCL_SSL30_DES_CBC_SHA_7 0x001a | 554 | #define OP_PCL_SSL30_DES_CBC_SHA_7 0x001a |
| 555 | 555 | ||
| 556 | #define OP_PCL_SSL30_RC4_128_MD5 0x0024 | 556 | #define OP_PCL_SSL30_RC4_128_MD5 0x0024 |
| 557 | #define OP_PCL_SSL30_RC4_128_MD5_2 0x0004 | 557 | #define OP_PCL_SSL30_RC4_128_MD5_2 0x0004 |
| 558 | #define OP_PCL_SSL30_RC4_128_MD5_3 0x0018 | 558 | #define OP_PCL_SSL30_RC4_128_MD5_3 0x0018 |
| 559 | 559 | ||
| 560 | #define OP_PCL_SSL30_RC4_40_MD5 0x002b | 560 | #define OP_PCL_SSL30_RC4_40_MD5 0x002b |
| 561 | #define OP_PCL_SSL30_RC4_40_MD5_2 0x0003 | 561 | #define OP_PCL_SSL30_RC4_40_MD5_2 0x0003 |
| 562 | #define OP_PCL_SSL30_RC4_40_MD5_3 0x0017 | 562 | #define OP_PCL_SSL30_RC4_40_MD5_3 0x0017 |
| 563 | 563 | ||
| 564 | #define OP_PCL_SSL30_RC4_128_SHA 0x0020 | 564 | #define OP_PCL_SSL30_RC4_128_SHA 0x0020 |
| 565 | #define OP_PCL_SSL30_RC4_128_SHA_2 0x008a | 565 | #define OP_PCL_SSL30_RC4_128_SHA_2 0x008a |
| 566 | #define OP_PCL_SSL30_RC4_128_SHA_3 0x008e | 566 | #define OP_PCL_SSL30_RC4_128_SHA_3 0x008e |
| 567 | #define OP_PCL_SSL30_RC4_128_SHA_4 0x0092 | 567 | #define OP_PCL_SSL30_RC4_128_SHA_4 0x0092 |
| 568 | #define OP_PCL_SSL30_RC4_128_SHA_5 0x0005 | 568 | #define OP_PCL_SSL30_RC4_128_SHA_5 0x0005 |
| 569 | #define OP_PCL_SSL30_RC4_128_SHA_6 0xc002 | 569 | #define OP_PCL_SSL30_RC4_128_SHA_6 0xc002 |
| 570 | #define OP_PCL_SSL30_RC4_128_SHA_7 0xc007 | 570 | #define OP_PCL_SSL30_RC4_128_SHA_7 0xc007 |
| 571 | #define OP_PCL_SSL30_RC4_128_SHA_8 0xc00c | 571 | #define OP_PCL_SSL30_RC4_128_SHA_8 0xc00c |
| 572 | #define OP_PCL_SSL30_RC4_128_SHA_9 0xc011 | 572 | #define OP_PCL_SSL30_RC4_128_SHA_9 0xc011 |
| 573 | #define OP_PCL_SSL30_RC4_128_SHA_10 0xc016 | 573 | #define OP_PCL_SSL30_RC4_128_SHA_10 0xc016 |
| 574 | 574 | ||
| 575 | #define OP_PCL_SSL30_RC4_40_SHA 0x0028 | 575 | #define OP_PCL_SSL30_RC4_40_SHA 0x0028 |
| 576 | 576 | ||
| 577 | 577 | ||
| 578 | /* For TLS 1.0 - OP_PCLID_TLS10 */ | 578 | /* For TLS 1.0 - OP_PCLID_TLS10 */ |
| 579 | #define OP_PCL_TLS10_AES_128_CBC_SHA 0x002f | 579 | #define OP_PCL_TLS10_AES_128_CBC_SHA 0x002f |
| 580 | #define OP_PCL_TLS10_AES_128_CBC_SHA_2 0x0030 | 580 | #define OP_PCL_TLS10_AES_128_CBC_SHA_2 0x0030 |
| 581 | #define OP_PCL_TLS10_AES_128_CBC_SHA_3 0x0031 | 581 | #define OP_PCL_TLS10_AES_128_CBC_SHA_3 0x0031 |
| 582 | #define OP_PCL_TLS10_AES_128_CBC_SHA_4 0x0032 | 582 | #define OP_PCL_TLS10_AES_128_CBC_SHA_4 0x0032 |
| 583 | #define OP_PCL_TLS10_AES_128_CBC_SHA_5 0x0033 | 583 | #define OP_PCL_TLS10_AES_128_CBC_SHA_5 0x0033 |
| 584 | #define OP_PCL_TLS10_AES_128_CBC_SHA_6 0x0034 | 584 | #define OP_PCL_TLS10_AES_128_CBC_SHA_6 0x0034 |
| 585 | #define OP_PCL_TLS10_AES_128_CBC_SHA_7 0x008c | 585 | #define OP_PCL_TLS10_AES_128_CBC_SHA_7 0x008c |
| 586 | #define OP_PCL_TLS10_AES_128_CBC_SHA_8 0x0090 | 586 | #define OP_PCL_TLS10_AES_128_CBC_SHA_8 0x0090 |
| 587 | #define OP_PCL_TLS10_AES_128_CBC_SHA_9 0x0094 | 587 | #define OP_PCL_TLS10_AES_128_CBC_SHA_9 0x0094 |
| 588 | #define OP_PCL_TLS10_AES_128_CBC_SHA_10 0xc004 | 588 | #define OP_PCL_TLS10_AES_128_CBC_SHA_10 0xc004 |
| 589 | #define OP_PCL_TLS10_AES_128_CBC_SHA_11 0xc009 | 589 | #define OP_PCL_TLS10_AES_128_CBC_SHA_11 0xc009 |
| 590 | #define OP_PCL_TLS10_AES_128_CBC_SHA_12 0xc00e | 590 | #define OP_PCL_TLS10_AES_128_CBC_SHA_12 0xc00e |
| 591 | #define OP_PCL_TLS10_AES_128_CBC_SHA_13 0xc013 | 591 | #define OP_PCL_TLS10_AES_128_CBC_SHA_13 0xc013 |
| 592 | #define OP_PCL_TLS10_AES_128_CBC_SHA_14 0xc018 | 592 | #define OP_PCL_TLS10_AES_128_CBC_SHA_14 0xc018 |
| 593 | #define OP_PCL_TLS10_AES_128_CBC_SHA_15 0xc01d | 593 | #define OP_PCL_TLS10_AES_128_CBC_SHA_15 0xc01d |
| 594 | #define OP_PCL_TLS10_AES_128_CBC_SHA_16 0xc01e | 594 | #define OP_PCL_TLS10_AES_128_CBC_SHA_16 0xc01e |
| 595 | #define OP_PCL_TLS10_AES_128_CBC_SHA_17 0xc01f | 595 | #define OP_PCL_TLS10_AES_128_CBC_SHA_17 0xc01f |
| 596 | 596 | ||
| 597 | #define OP_PCL_TLS10_AES_256_CBC_SHA 0x0035 | 597 | #define OP_PCL_TLS10_AES_256_CBC_SHA 0x0035 |
| 598 | #define OP_PCL_TLS10_AES_256_CBC_SHA_2 0x0036 | 598 | #define OP_PCL_TLS10_AES_256_CBC_SHA_2 0x0036 |
| 599 | #define OP_PCL_TLS10_AES_256_CBC_SHA_3 0x0037 | 599 | #define OP_PCL_TLS10_AES_256_CBC_SHA_3 0x0037 |
| 600 | #define OP_PCL_TLS10_AES_256_CBC_SHA_4 0x0038 | 600 | #define OP_PCL_TLS10_AES_256_CBC_SHA_4 0x0038 |
| 601 | #define OP_PCL_TLS10_AES_256_CBC_SHA_5 0x0039 | 601 | #define OP_PCL_TLS10_AES_256_CBC_SHA_5 0x0039 |
| 602 | #define OP_PCL_TLS10_AES_256_CBC_SHA_6 0x003a | 602 | #define OP_PCL_TLS10_AES_256_CBC_SHA_6 0x003a |
| 603 | #define OP_PCL_TLS10_AES_256_CBC_SHA_7 0x008d | 603 | #define OP_PCL_TLS10_AES_256_CBC_SHA_7 0x008d |
| 604 | #define OP_PCL_TLS10_AES_256_CBC_SHA_8 0x0091 | 604 | #define OP_PCL_TLS10_AES_256_CBC_SHA_8 0x0091 |
| 605 | #define OP_PCL_TLS10_AES_256_CBC_SHA_9 0x0095 | 605 | #define OP_PCL_TLS10_AES_256_CBC_SHA_9 0x0095 |
| 606 | #define OP_PCL_TLS10_AES_256_CBC_SHA_10 0xc005 | 606 | #define OP_PCL_TLS10_AES_256_CBC_SHA_10 0xc005 |
| 607 | #define OP_PCL_TLS10_AES_256_CBC_SHA_11 0xc00a | 607 | #define OP_PCL_TLS10_AES_256_CBC_SHA_11 0xc00a |
| 608 | #define OP_PCL_TLS10_AES_256_CBC_SHA_12 0xc00f | 608 | #define OP_PCL_TLS10_AES_256_CBC_SHA_12 0xc00f |
| 609 | #define OP_PCL_TLS10_AES_256_CBC_SHA_13 0xc014 | 609 | #define OP_PCL_TLS10_AES_256_CBC_SHA_13 0xc014 |
| 610 | #define OP_PCL_TLS10_AES_256_CBC_SHA_14 0xc019 | 610 | #define OP_PCL_TLS10_AES_256_CBC_SHA_14 0xc019 |
| 611 | #define OP_PCL_TLS10_AES_256_CBC_SHA_15 0xc020 | 611 | #define OP_PCL_TLS10_AES_256_CBC_SHA_15 0xc020 |
| 612 | #define OP_PCL_TLS10_AES_256_CBC_SHA_16 0xc021 | 612 | #define OP_PCL_TLS10_AES_256_CBC_SHA_16 0xc021 |
| 613 | #define OP_PCL_TLS10_AES_256_CBC_SHA_17 0xc022 | 613 | #define OP_PCL_TLS10_AES_256_CBC_SHA_17 0xc022 |
| 614 | 614 | ||
| 615 | /* #define OP_PCL_TLS10_3DES_EDE_CBC_MD5 0x0023 */ | 615 | /* #define OP_PCL_TLS10_3DES_EDE_CBC_MD5 0x0023 */ |
| 616 | 616 | ||
| 617 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA 0x001f | 617 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA 0x001f |
| 618 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_2 0x008b | 618 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_2 0x008b |
| 619 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_3 0x008f | 619 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_3 0x008f |
| 620 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_4 0x0093 | 620 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_4 0x0093 |
| 621 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_5 0x000a | 621 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_5 0x000a |
| 622 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_6 0x000d | 622 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_6 0x000d |
| 623 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_7 0x0010 | 623 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_7 0x0010 |
| 624 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_8 0x0013 | 624 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_8 0x0013 |
| 625 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_9 0x0016 | 625 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_9 0x0016 |
| 626 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_10 0x001b | 626 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_10 0x001b |
| 627 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_11 0xc003 | 627 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_11 0xc003 |
| 628 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_12 0xc008 | 628 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_12 0xc008 |
| 629 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_13 0xc00d | 629 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_13 0xc00d |
| 630 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_14 0xc012 | 630 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_14 0xc012 |
| 631 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_15 0xc017 | 631 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_15 0xc017 |
| 632 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_16 0xc01a | 632 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_16 0xc01a |
| 633 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_17 0xc01b | 633 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_17 0xc01b |
| 634 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_18 0xc01c | 634 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA_18 0xc01c |
| 635 | 635 | ||
| 636 | #define OP_PCL_TLS10_DES40_CBC_MD5 0x0029 | 636 | #define OP_PCL_TLS10_DES40_CBC_MD5 0x0029 |
| 637 | 637 | ||
| 638 | #define OP_PCL_TLS10_DES_CBC_MD5 0x0022 | 638 | #define OP_PCL_TLS10_DES_CBC_MD5 0x0022 |
| 639 | 639 | ||
| 640 | #define OP_PCL_TLS10_DES40_CBC_SHA 0x0008 | 640 | #define OP_PCL_TLS10_DES40_CBC_SHA 0x0008 |
| 641 | #define OP_PCL_TLS10_DES40_CBC_SHA_2 0x000b | 641 | #define OP_PCL_TLS10_DES40_CBC_SHA_2 0x000b |
| 642 | #define OP_PCL_TLS10_DES40_CBC_SHA_3 0x000e | 642 | #define OP_PCL_TLS10_DES40_CBC_SHA_3 0x000e |
| 643 | #define OP_PCL_TLS10_DES40_CBC_SHA_4 0x0011 | 643 | #define OP_PCL_TLS10_DES40_CBC_SHA_4 0x0011 |
| 644 | #define OP_PCL_TLS10_DES40_CBC_SHA_5 0x0014 | 644 | #define OP_PCL_TLS10_DES40_CBC_SHA_5 0x0014 |
| 645 | #define OP_PCL_TLS10_DES40_CBC_SHA_6 0x0019 | 645 | #define OP_PCL_TLS10_DES40_CBC_SHA_6 0x0019 |
| 646 | #define OP_PCL_TLS10_DES40_CBC_SHA_7 0x0026 | 646 | #define OP_PCL_TLS10_DES40_CBC_SHA_7 0x0026 |
| 647 | 647 | ||
| 648 | 648 | ||
| 649 | #define OP_PCL_TLS10_DES_CBC_SHA 0x001e | 649 | #define OP_PCL_TLS10_DES_CBC_SHA 0x001e |
| 650 | #define OP_PCL_TLS10_DES_CBC_SHA_2 0x0009 | 650 | #define OP_PCL_TLS10_DES_CBC_SHA_2 0x0009 |
| 651 | #define OP_PCL_TLS10_DES_CBC_SHA_3 0x000c | 651 | #define OP_PCL_TLS10_DES_CBC_SHA_3 0x000c |
| 652 | #define OP_PCL_TLS10_DES_CBC_SHA_4 0x000f | 652 | #define OP_PCL_TLS10_DES_CBC_SHA_4 0x000f |
| 653 | #define OP_PCL_TLS10_DES_CBC_SHA_5 0x0012 | 653 | #define OP_PCL_TLS10_DES_CBC_SHA_5 0x0012 |
| 654 | #define OP_PCL_TLS10_DES_CBC_SHA_6 0x0015 | 654 | #define OP_PCL_TLS10_DES_CBC_SHA_6 0x0015 |
| 655 | #define OP_PCL_TLS10_DES_CBC_SHA_7 0x001a | 655 | #define OP_PCL_TLS10_DES_CBC_SHA_7 0x001a |
| 656 | 656 | ||
| 657 | #define OP_PCL_TLS10_RC4_128_MD5 0x0024 | 657 | #define OP_PCL_TLS10_RC4_128_MD5 0x0024 |
| 658 | #define OP_PCL_TLS10_RC4_128_MD5_2 0x0004 | 658 | #define OP_PCL_TLS10_RC4_128_MD5_2 0x0004 |
| 659 | #define OP_PCL_TLS10_RC4_128_MD5_3 0x0018 | 659 | #define OP_PCL_TLS10_RC4_128_MD5_3 0x0018 |
| 660 | 660 | ||
| 661 | #define OP_PCL_TLS10_RC4_40_MD5 0x002b | 661 | #define OP_PCL_TLS10_RC4_40_MD5 0x002b |
| 662 | #define OP_PCL_TLS10_RC4_40_MD5_2 0x0003 | 662 | #define OP_PCL_TLS10_RC4_40_MD5_2 0x0003 |
| 663 | #define OP_PCL_TLS10_RC4_40_MD5_3 0x0017 | 663 | #define OP_PCL_TLS10_RC4_40_MD5_3 0x0017 |
| 664 | 664 | ||
| 665 | #define OP_PCL_TLS10_RC4_128_SHA 0x0020 | 665 | #define OP_PCL_TLS10_RC4_128_SHA 0x0020 |
| 666 | #define OP_PCL_TLS10_RC4_128_SHA_2 0x008a | 666 | #define OP_PCL_TLS10_RC4_128_SHA_2 0x008a |
| 667 | #define OP_PCL_TLS10_RC4_128_SHA_3 0x008e | 667 | #define OP_PCL_TLS10_RC4_128_SHA_3 0x008e |
| 668 | #define OP_PCL_TLS10_RC4_128_SHA_4 0x0092 | 668 | #define OP_PCL_TLS10_RC4_128_SHA_4 0x0092 |
| 669 | #define OP_PCL_TLS10_RC4_128_SHA_5 0x0005 | 669 | #define OP_PCL_TLS10_RC4_128_SHA_5 0x0005 |
| 670 | #define OP_PCL_TLS10_RC4_128_SHA_6 0xc002 | 670 | #define OP_PCL_TLS10_RC4_128_SHA_6 0xc002 |
| 671 | #define OP_PCL_TLS10_RC4_128_SHA_7 0xc007 | 671 | #define OP_PCL_TLS10_RC4_128_SHA_7 0xc007 |
| 672 | #define OP_PCL_TLS10_RC4_128_SHA_8 0xc00c | 672 | #define OP_PCL_TLS10_RC4_128_SHA_8 0xc00c |
| 673 | #define OP_PCL_TLS10_RC4_128_SHA_9 0xc011 | 673 | #define OP_PCL_TLS10_RC4_128_SHA_9 0xc011 |
| 674 | #define OP_PCL_TLS10_RC4_128_SHA_10 0xc016 | 674 | #define OP_PCL_TLS10_RC4_128_SHA_10 0xc016 |
| 675 | 675 | ||
| 676 | #define OP_PCL_TLS10_RC4_40_SHA 0x0028 | 676 | #define OP_PCL_TLS10_RC4_40_SHA 0x0028 |
| 677 | 677 | ||
| 678 | #define OP_PCL_TLS10_3DES_EDE_CBC_MD5 0xff23 | 678 | #define OP_PCL_TLS10_3DES_EDE_CBC_MD5 0xff23 |
| 679 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA160 0xff30 | 679 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA160 0xff30 |
| 680 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA224 0xff34 | 680 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA224 0xff34 |
| 681 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA256 0xff36 | 681 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA256 0xff36 |
| 682 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA384 0xff33 | 682 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA384 0xff33 |
| 683 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA512 0xff35 | 683 | #define OP_PCL_TLS10_3DES_EDE_CBC_SHA512 0xff35 |
| 684 | #define OP_PCL_TLS10_AES_128_CBC_SHA160 0xff80 | 684 | #define OP_PCL_TLS10_AES_128_CBC_SHA160 0xff80 |
| 685 | #define OP_PCL_TLS10_AES_128_CBC_SHA224 0xff84 | 685 | #define OP_PCL_TLS10_AES_128_CBC_SHA224 0xff84 |
| 686 | #define OP_PCL_TLS10_AES_128_CBC_SHA256 0xff86 | 686 | #define OP_PCL_TLS10_AES_128_CBC_SHA256 0xff86 |
| 687 | #define OP_PCL_TLS10_AES_128_CBC_SHA384 0xff83 | 687 | #define OP_PCL_TLS10_AES_128_CBC_SHA384 0xff83 |
| 688 | #define OP_PCL_TLS10_AES_128_CBC_SHA512 0xff85 | 688 | #define OP_PCL_TLS10_AES_128_CBC_SHA512 0xff85 |
| 689 | #define OP_PCL_TLS10_AES_192_CBC_SHA160 0xff20 | 689 | #define OP_PCL_TLS10_AES_192_CBC_SHA160 0xff20 |
| 690 | #define OP_PCL_TLS10_AES_192_CBC_SHA224 0xff24 | 690 | #define OP_PCL_TLS10_AES_192_CBC_SHA224 0xff24 |
| 691 | #define OP_PCL_TLS10_AES_192_CBC_SHA256 0xff26 | 691 | #define OP_PCL_TLS10_AES_192_CBC_SHA256 0xff26 |
| 692 | #define OP_PCL_TLS10_AES_192_CBC_SHA384 0xff23 | 692 | #define OP_PCL_TLS10_AES_192_CBC_SHA384 0xff23 |
| 693 | #define OP_PCL_TLS10_AES_192_CBC_SHA512 0xff25 | 693 | #define OP_PCL_TLS10_AES_192_CBC_SHA512 0xff25 |
| 694 | #define OP_PCL_TLS10_AES_256_CBC_SHA160 0xff60 | 694 | #define OP_PCL_TLS10_AES_256_CBC_SHA160 0xff60 |
| 695 | #define OP_PCL_TLS10_AES_256_CBC_SHA224 0xff64 | 695 | #define OP_PCL_TLS10_AES_256_CBC_SHA224 0xff64 |
| 696 | #define OP_PCL_TLS10_AES_256_CBC_SHA256 0xff66 | 696 | #define OP_PCL_TLS10_AES_256_CBC_SHA256 0xff66 |
| 697 | #define OP_PCL_TLS10_AES_256_CBC_SHA384 0xff63 | 697 | #define OP_PCL_TLS10_AES_256_CBC_SHA384 0xff63 |
| 698 | #define OP_PCL_TLS10_AES_256_CBC_SHA512 0xff65 | 698 | #define OP_PCL_TLS10_AES_256_CBC_SHA512 0xff65 |
| 699 | 699 | ||
| 700 | 700 | ||
| 701 | 701 | ||
| 702 | /* For TLS 1.1 - OP_PCLID_TLS11 */ | 702 | /* For TLS 1.1 - OP_PCLID_TLS11 */ |
| 703 | #define OP_PCL_TLS11_AES_128_CBC_SHA 0x002f | 703 | #define OP_PCL_TLS11_AES_128_CBC_SHA 0x002f |
| 704 | #define OP_PCL_TLS11_AES_128_CBC_SHA_2 0x0030 | 704 | #define OP_PCL_TLS11_AES_128_CBC_SHA_2 0x0030 |
| 705 | #define OP_PCL_TLS11_AES_128_CBC_SHA_3 0x0031 | 705 | #define OP_PCL_TLS11_AES_128_CBC_SHA_3 0x0031 |
| 706 | #define OP_PCL_TLS11_AES_128_CBC_SHA_4 0x0032 | 706 | #define OP_PCL_TLS11_AES_128_CBC_SHA_4 0x0032 |
| 707 | #define OP_PCL_TLS11_AES_128_CBC_SHA_5 0x0033 | 707 | #define OP_PCL_TLS11_AES_128_CBC_SHA_5 0x0033 |
| 708 | #define OP_PCL_TLS11_AES_128_CBC_SHA_6 0x0034 | 708 | #define OP_PCL_TLS11_AES_128_CBC_SHA_6 0x0034 |
| 709 | #define OP_PCL_TLS11_AES_128_CBC_SHA_7 0x008c | 709 | #define OP_PCL_TLS11_AES_128_CBC_SHA_7 0x008c |
| 710 | #define OP_PCL_TLS11_AES_128_CBC_SHA_8 0x0090 | 710 | #define OP_PCL_TLS11_AES_128_CBC_SHA_8 0x0090 |
| 711 | #define OP_PCL_TLS11_AES_128_CBC_SHA_9 0x0094 | 711 | #define OP_PCL_TLS11_AES_128_CBC_SHA_9 0x0094 |
| 712 | #define OP_PCL_TLS11_AES_128_CBC_SHA_10 0xc004 | 712 | #define OP_PCL_TLS11_AES_128_CBC_SHA_10 0xc004 |
| 713 | #define OP_PCL_TLS11_AES_128_CBC_SHA_11 0xc009 | 713 | #define OP_PCL_TLS11_AES_128_CBC_SHA_11 0xc009 |
| 714 | #define OP_PCL_TLS11_AES_128_CBC_SHA_12 0xc00e | 714 | #define OP_PCL_TLS11_AES_128_CBC_SHA_12 0xc00e |
| 715 | #define OP_PCL_TLS11_AES_128_CBC_SHA_13 0xc013 | 715 | #define OP_PCL_TLS11_AES_128_CBC_SHA_13 0xc013 |
| 716 | #define OP_PCL_TLS11_AES_128_CBC_SHA_14 0xc018 | 716 | #define OP_PCL_TLS11_AES_128_CBC_SHA_14 0xc018 |
| 717 | #define OP_PCL_TLS11_AES_128_CBC_SHA_15 0xc01d | 717 | #define OP_PCL_TLS11_AES_128_CBC_SHA_15 0xc01d |
| 718 | #define OP_PCL_TLS11_AES_128_CBC_SHA_16 0xc01e | 718 | #define OP_PCL_TLS11_AES_128_CBC_SHA_16 0xc01e |
| 719 | #define OP_PCL_TLS11_AES_128_CBC_SHA_17 0xc01f | 719 | #define OP_PCL_TLS11_AES_128_CBC_SHA_17 0xc01f |
| 720 | 720 | ||
| 721 | #define OP_PCL_TLS11_AES_256_CBC_SHA 0x0035 | 721 | #define OP_PCL_TLS11_AES_256_CBC_SHA 0x0035 |
| 722 | #define OP_PCL_TLS11_AES_256_CBC_SHA_2 0x0036 | 722 | #define OP_PCL_TLS11_AES_256_CBC_SHA_2 0x0036 |
| 723 | #define OP_PCL_TLS11_AES_256_CBC_SHA_3 0x0037 | 723 | #define OP_PCL_TLS11_AES_256_CBC_SHA_3 0x0037 |
| 724 | #define OP_PCL_TLS11_AES_256_CBC_SHA_4 0x0038 | 724 | #define OP_PCL_TLS11_AES_256_CBC_SHA_4 0x0038 |
| 725 | #define OP_PCL_TLS11_AES_256_CBC_SHA_5 0x0039 | 725 | #define OP_PCL_TLS11_AES_256_CBC_SHA_5 0x0039 |
| 726 | #define OP_PCL_TLS11_AES_256_CBC_SHA_6 0x003a | 726 | #define OP_PCL_TLS11_AES_256_CBC_SHA_6 0x003a |
| 727 | #define OP_PCL_TLS11_AES_256_CBC_SHA_7 0x008d | 727 | #define OP_PCL_TLS11_AES_256_CBC_SHA_7 0x008d |
| 728 | #define OP_PCL_TLS11_AES_256_CBC_SHA_8 0x0091 | 728 | #define OP_PCL_TLS11_AES_256_CBC_SHA_8 0x0091 |
| 729 | #define OP_PCL_TLS11_AES_256_CBC_SHA_9 0x0095 | 729 | #define OP_PCL_TLS11_AES_256_CBC_SHA_9 0x0095 |
| 730 | #define OP_PCL_TLS11_AES_256_CBC_SHA_10 0xc005 | 730 | #define OP_PCL_TLS11_AES_256_CBC_SHA_10 0xc005 |
| 731 | #define OP_PCL_TLS11_AES_256_CBC_SHA_11 0xc00a | 731 | #define OP_PCL_TLS11_AES_256_CBC_SHA_11 0xc00a |
| 732 | #define OP_PCL_TLS11_AES_256_CBC_SHA_12 0xc00f | 732 | #define OP_PCL_TLS11_AES_256_CBC_SHA_12 0xc00f |
| 733 | #define OP_PCL_TLS11_AES_256_CBC_SHA_13 0xc014 | 733 | #define OP_PCL_TLS11_AES_256_CBC_SHA_13 0xc014 |
| 734 | #define OP_PCL_TLS11_AES_256_CBC_SHA_14 0xc019 | 734 | #define OP_PCL_TLS11_AES_256_CBC_SHA_14 0xc019 |
| 735 | #define OP_PCL_TLS11_AES_256_CBC_SHA_15 0xc020 | 735 | #define OP_PCL_TLS11_AES_256_CBC_SHA_15 0xc020 |
| 736 | #define OP_PCL_TLS11_AES_256_CBC_SHA_16 0xc021 | 736 | #define OP_PCL_TLS11_AES_256_CBC_SHA_16 0xc021 |
| 737 | #define OP_PCL_TLS11_AES_256_CBC_SHA_17 0xc022 | 737 | #define OP_PCL_TLS11_AES_256_CBC_SHA_17 0xc022 |
| 738 | 738 | ||
| 739 | /* #define OP_PCL_TLS11_3DES_EDE_CBC_MD5 0x0023 */ | 739 | /* #define OP_PCL_TLS11_3DES_EDE_CBC_MD5 0x0023 */ |
| 740 | 740 | ||
| 741 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA 0x001f | 741 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA 0x001f |
| 742 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_2 0x008b | 742 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_2 0x008b |
| 743 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_3 0x008f | 743 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_3 0x008f |
| 744 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_4 0x0093 | 744 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_4 0x0093 |
| 745 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_5 0x000a | 745 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_5 0x000a |
| 746 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_6 0x000d | 746 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_6 0x000d |
| 747 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_7 0x0010 | 747 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_7 0x0010 |
| 748 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_8 0x0013 | 748 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_8 0x0013 |
| 749 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_9 0x0016 | 749 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_9 0x0016 |
| 750 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_10 0x001b | 750 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_10 0x001b |
| 751 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_11 0xc003 | 751 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_11 0xc003 |
| 752 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_12 0xc008 | 752 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_12 0xc008 |
| 753 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_13 0xc00d | 753 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_13 0xc00d |
| 754 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_14 0xc012 | 754 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_14 0xc012 |
| 755 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_15 0xc017 | 755 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_15 0xc017 |
| 756 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_16 0xc01a | 756 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_16 0xc01a |
| 757 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_17 0xc01b | 757 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_17 0xc01b |
| 758 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_18 0xc01c | 758 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA_18 0xc01c |
| 759 | 759 | ||
| 760 | #define OP_PCL_TLS11_DES40_CBC_MD5 0x0029 | 760 | #define OP_PCL_TLS11_DES40_CBC_MD5 0x0029 |
| 761 | 761 | ||
| 762 | #define OP_PCL_TLS11_DES_CBC_MD5 0x0022 | 762 | #define OP_PCL_TLS11_DES_CBC_MD5 0x0022 |
| 763 | 763 | ||
| 764 | #define OP_PCL_TLS11_DES40_CBC_SHA 0x0008 | 764 | #define OP_PCL_TLS11_DES40_CBC_SHA 0x0008 |
| 765 | #define OP_PCL_TLS11_DES40_CBC_SHA_2 0x000b | 765 | #define OP_PCL_TLS11_DES40_CBC_SHA_2 0x000b |
| 766 | #define OP_PCL_TLS11_DES40_CBC_SHA_3 0x000e | 766 | #define OP_PCL_TLS11_DES40_CBC_SHA_3 0x000e |
| 767 | #define OP_PCL_TLS11_DES40_CBC_SHA_4 0x0011 | 767 | #define OP_PCL_TLS11_DES40_CBC_SHA_4 0x0011 |
| 768 | #define OP_PCL_TLS11_DES40_CBC_SHA_5 0x0014 | 768 | #define OP_PCL_TLS11_DES40_CBC_SHA_5 0x0014 |
| 769 | #define OP_PCL_TLS11_DES40_CBC_SHA_6 0x0019 | 769 | #define OP_PCL_TLS11_DES40_CBC_SHA_6 0x0019 |
| 770 | #define OP_PCL_TLS11_DES40_CBC_SHA_7 0x0026 | 770 | #define OP_PCL_TLS11_DES40_CBC_SHA_7 0x0026 |
| 771 | 771 | ||
| 772 | #define OP_PCL_TLS11_DES_CBC_SHA 0x001e | 772 | #define OP_PCL_TLS11_DES_CBC_SHA 0x001e |
| 773 | #define OP_PCL_TLS11_DES_CBC_SHA_2 0x0009 | 773 | #define OP_PCL_TLS11_DES_CBC_SHA_2 0x0009 |
| 774 | #define OP_PCL_TLS11_DES_CBC_SHA_3 0x000c | 774 | #define OP_PCL_TLS11_DES_CBC_SHA_3 0x000c |
| 775 | #define OP_PCL_TLS11_DES_CBC_SHA_4 0x000f | 775 | #define OP_PCL_TLS11_DES_CBC_SHA_4 0x000f |
| 776 | #define OP_PCL_TLS11_DES_CBC_SHA_5 0x0012 | 776 | #define OP_PCL_TLS11_DES_CBC_SHA_5 0x0012 |
| 777 | #define OP_PCL_TLS11_DES_CBC_SHA_6 0x0015 | 777 | #define OP_PCL_TLS11_DES_CBC_SHA_6 0x0015 |
| 778 | #define OP_PCL_TLS11_DES_CBC_SHA_7 0x001a | 778 | #define OP_PCL_TLS11_DES_CBC_SHA_7 0x001a |
| 779 | 779 | ||
| 780 | #define OP_PCL_TLS11_RC4_128_MD5 0x0024 | 780 | #define OP_PCL_TLS11_RC4_128_MD5 0x0024 |
| 781 | #define OP_PCL_TLS11_RC4_128_MD5_2 0x0004 | 781 | #define OP_PCL_TLS11_RC4_128_MD5_2 0x0004 |
| 782 | #define OP_PCL_TLS11_RC4_128_MD5_3 0x0018 | 782 | #define OP_PCL_TLS11_RC4_128_MD5_3 0x0018 |
| 783 | 783 | ||
| 784 | #define OP_PCL_TLS11_RC4_40_MD5 0x002b | 784 | #define OP_PCL_TLS11_RC4_40_MD5 0x002b |
| 785 | #define OP_PCL_TLS11_RC4_40_MD5_2 0x0003 | 785 | #define OP_PCL_TLS11_RC4_40_MD5_2 0x0003 |
| 786 | #define OP_PCL_TLS11_RC4_40_MD5_3 0x0017 | 786 | #define OP_PCL_TLS11_RC4_40_MD5_3 0x0017 |
| 787 | 787 | ||
| 788 | #define OP_PCL_TLS11_RC4_128_SHA 0x0020 | 788 | #define OP_PCL_TLS11_RC4_128_SHA 0x0020 |
| 789 | #define OP_PCL_TLS11_RC4_128_SHA_2 0x008a | 789 | #define OP_PCL_TLS11_RC4_128_SHA_2 0x008a |
| 790 | #define OP_PCL_TLS11_RC4_128_SHA_3 0x008e | 790 | #define OP_PCL_TLS11_RC4_128_SHA_3 0x008e |
| 791 | #define OP_PCL_TLS11_RC4_128_SHA_4 0x0092 | 791 | #define OP_PCL_TLS11_RC4_128_SHA_4 0x0092 |
| 792 | #define OP_PCL_TLS11_RC4_128_SHA_5 0x0005 | 792 | #define OP_PCL_TLS11_RC4_128_SHA_5 0x0005 |
| 793 | #define OP_PCL_TLS11_RC4_128_SHA_6 0xc002 | 793 | #define OP_PCL_TLS11_RC4_128_SHA_6 0xc002 |
| 794 | #define OP_PCL_TLS11_RC4_128_SHA_7 0xc007 | 794 | #define OP_PCL_TLS11_RC4_128_SHA_7 0xc007 |
| 795 | #define OP_PCL_TLS11_RC4_128_SHA_8 0xc00c | 795 | #define OP_PCL_TLS11_RC4_128_SHA_8 0xc00c |
| 796 | #define OP_PCL_TLS11_RC4_128_SHA_9 0xc011 | 796 | #define OP_PCL_TLS11_RC4_128_SHA_9 0xc011 |
| 797 | #define OP_PCL_TLS11_RC4_128_SHA_10 0xc016 | 797 | #define OP_PCL_TLS11_RC4_128_SHA_10 0xc016 |
| 798 | 798 | ||
| 799 | #define OP_PCL_TLS11_RC4_40_SHA 0x0028 | 799 | #define OP_PCL_TLS11_RC4_40_SHA 0x0028 |
| 800 | 800 | ||
| 801 | #define OP_PCL_TLS11_3DES_EDE_CBC_MD5 0xff23 | 801 | #define OP_PCL_TLS11_3DES_EDE_CBC_MD5 0xff23 |
| 802 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA160 0xff30 | 802 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA160 0xff30 |
| 803 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA224 0xff34 | 803 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA224 0xff34 |
| 804 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA256 0xff36 | 804 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA256 0xff36 |
| 805 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA384 0xff33 | 805 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA384 0xff33 |
| 806 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA512 0xff35 | 806 | #define OP_PCL_TLS11_3DES_EDE_CBC_SHA512 0xff35 |
| 807 | #define OP_PCL_TLS11_AES_128_CBC_SHA160 0xff80 | 807 | #define OP_PCL_TLS11_AES_128_CBC_SHA160 0xff80 |
| 808 | #define OP_PCL_TLS11_AES_128_CBC_SHA224 0xff84 | 808 | #define OP_PCL_TLS11_AES_128_CBC_SHA224 0xff84 |
| 809 | #define OP_PCL_TLS11_AES_128_CBC_SHA256 0xff86 | 809 | #define OP_PCL_TLS11_AES_128_CBC_SHA256 0xff86 |
| 810 | #define OP_PCL_TLS11_AES_128_CBC_SHA384 0xff83 | 810 | #define OP_PCL_TLS11_AES_128_CBC_SHA384 0xff83 |
| 811 | #define OP_PCL_TLS11_AES_128_CBC_SHA512 0xff85 | 811 | #define OP_PCL_TLS11_AES_128_CBC_SHA512 0xff85 |
| 812 | #define OP_PCL_TLS11_AES_192_CBC_SHA160 0xff20 | 812 | #define OP_PCL_TLS11_AES_192_CBC_SHA160 0xff20 |
| 813 | #define OP_PCL_TLS11_AES_192_CBC_SHA224 0xff24 | 813 | #define OP_PCL_TLS11_AES_192_CBC_SHA224 0xff24 |
| 814 | #define OP_PCL_TLS11_AES_192_CBC_SHA256 0xff26 | 814 | #define OP_PCL_TLS11_AES_192_CBC_SHA256 0xff26 |
| 815 | #define OP_PCL_TLS11_AES_192_CBC_SHA384 0xff23 | 815 | #define OP_PCL_TLS11_AES_192_CBC_SHA384 0xff23 |
| 816 | #define OP_PCL_TLS11_AES_192_CBC_SHA512 0xff25 | 816 | #define OP_PCL_TLS11_AES_192_CBC_SHA512 0xff25 |
| 817 | #define OP_PCL_TLS11_AES_256_CBC_SHA160 0xff60 | 817 | #define OP_PCL_TLS11_AES_256_CBC_SHA160 0xff60 |
| 818 | #define OP_PCL_TLS11_AES_256_CBC_SHA224 0xff64 | 818 | #define OP_PCL_TLS11_AES_256_CBC_SHA224 0xff64 |
| 819 | #define OP_PCL_TLS11_AES_256_CBC_SHA256 0xff66 | 819 | #define OP_PCL_TLS11_AES_256_CBC_SHA256 0xff66 |
| 820 | #define OP_PCL_TLS11_AES_256_CBC_SHA384 0xff63 | 820 | #define OP_PCL_TLS11_AES_256_CBC_SHA384 0xff63 |
| 821 | #define OP_PCL_TLS11_AES_256_CBC_SHA512 0xff65 | 821 | #define OP_PCL_TLS11_AES_256_CBC_SHA512 0xff65 |
| 822 | 822 | ||
| 823 | 823 | ||
| 824 | /* For TLS 1.2 - OP_PCLID_TLS12 */ | 824 | /* For TLS 1.2 - OP_PCLID_TLS12 */ |
| 825 | #define OP_PCL_TLS12_AES_128_CBC_SHA 0x002f | 825 | #define OP_PCL_TLS12_AES_128_CBC_SHA 0x002f |
| 826 | #define OP_PCL_TLS12_AES_128_CBC_SHA_2 0x0030 | 826 | #define OP_PCL_TLS12_AES_128_CBC_SHA_2 0x0030 |
| 827 | #define OP_PCL_TLS12_AES_128_CBC_SHA_3 0x0031 | 827 | #define OP_PCL_TLS12_AES_128_CBC_SHA_3 0x0031 |
| 828 | #define OP_PCL_TLS12_AES_128_CBC_SHA_4 0x0032 | 828 | #define OP_PCL_TLS12_AES_128_CBC_SHA_4 0x0032 |
| 829 | #define OP_PCL_TLS12_AES_128_CBC_SHA_5 0x0033 | 829 | #define OP_PCL_TLS12_AES_128_CBC_SHA_5 0x0033 |
| 830 | #define OP_PCL_TLS12_AES_128_CBC_SHA_6 0x0034 | 830 | #define OP_PCL_TLS12_AES_128_CBC_SHA_6 0x0034 |
| 831 | #define OP_PCL_TLS12_AES_128_CBC_SHA_7 0x008c | 831 | #define OP_PCL_TLS12_AES_128_CBC_SHA_7 0x008c |
| 832 | #define OP_PCL_TLS12_AES_128_CBC_SHA_8 0x0090 | 832 | #define OP_PCL_TLS12_AES_128_CBC_SHA_8 0x0090 |
| 833 | #define OP_PCL_TLS12_AES_128_CBC_SHA_9 0x0094 | 833 | #define OP_PCL_TLS12_AES_128_CBC_SHA_9 0x0094 |
| 834 | #define OP_PCL_TLS12_AES_128_CBC_SHA_10 0xc004 | 834 | #define OP_PCL_TLS12_AES_128_CBC_SHA_10 0xc004 |
| 835 | #define OP_PCL_TLS12_AES_128_CBC_SHA_11 0xc009 | 835 | #define OP_PCL_TLS12_AES_128_CBC_SHA_11 0xc009 |
| 836 | #define OP_PCL_TLS12_AES_128_CBC_SHA_12 0xc00e | 836 | #define OP_PCL_TLS12_AES_128_CBC_SHA_12 0xc00e |
| 837 | #define OP_PCL_TLS12_AES_128_CBC_SHA_13 0xc013 | 837 | #define OP_PCL_TLS12_AES_128_CBC_SHA_13 0xc013 |
| 838 | #define OP_PCL_TLS12_AES_128_CBC_SHA_14 0xc018 | 838 | #define OP_PCL_TLS12_AES_128_CBC_SHA_14 0xc018 |
| 839 | #define OP_PCL_TLS12_AES_128_CBC_SHA_15 0xc01d | 839 | #define OP_PCL_TLS12_AES_128_CBC_SHA_15 0xc01d |
| 840 | #define OP_PCL_TLS12_AES_128_CBC_SHA_16 0xc01e | 840 | #define OP_PCL_TLS12_AES_128_CBC_SHA_16 0xc01e |
| 841 | #define OP_PCL_TLS12_AES_128_CBC_SHA_17 0xc01f | 841 | #define OP_PCL_TLS12_AES_128_CBC_SHA_17 0xc01f |
| 842 | 842 | ||
| 843 | #define OP_PCL_TLS12_AES_256_CBC_SHA 0x0035 | 843 | #define OP_PCL_TLS12_AES_256_CBC_SHA 0x0035 |
| 844 | #define OP_PCL_TLS12_AES_256_CBC_SHA_2 0x0036 | 844 | #define OP_PCL_TLS12_AES_256_CBC_SHA_2 0x0036 |
| 845 | #define OP_PCL_TLS12_AES_256_CBC_SHA_3 0x0037 | 845 | #define OP_PCL_TLS12_AES_256_CBC_SHA_3 0x0037 |
| 846 | #define OP_PCL_TLS12_AES_256_CBC_SHA_4 0x0038 | 846 | #define OP_PCL_TLS12_AES_256_CBC_SHA_4 0x0038 |
| 847 | #define OP_PCL_TLS12_AES_256_CBC_SHA_5 0x0039 | 847 | #define OP_PCL_TLS12_AES_256_CBC_SHA_5 0x0039 |
| 848 | #define OP_PCL_TLS12_AES_256_CBC_SHA_6 0x003a | 848 | #define OP_PCL_TLS12_AES_256_CBC_SHA_6 0x003a |
| 849 | #define OP_PCL_TLS12_AES_256_CBC_SHA_7 0x008d | 849 | #define OP_PCL_TLS12_AES_256_CBC_SHA_7 0x008d |
| 850 | #define OP_PCL_TLS12_AES_256_CBC_SHA_8 0x0091 | 850 | #define OP_PCL_TLS12_AES_256_CBC_SHA_8 0x0091 |
| 851 | #define OP_PCL_TLS12_AES_256_CBC_SHA_9 0x0095 | 851 | #define OP_PCL_TLS12_AES_256_CBC_SHA_9 0x0095 |
| 852 | #define OP_PCL_TLS12_AES_256_CBC_SHA_10 0xc005 | 852 | #define OP_PCL_TLS12_AES_256_CBC_SHA_10 0xc005 |
| 853 | #define OP_PCL_TLS12_AES_256_CBC_SHA_11 0xc00a | 853 | #define OP_PCL_TLS12_AES_256_CBC_SHA_11 0xc00a |
| 854 | #define OP_PCL_TLS12_AES_256_CBC_SHA_12 0xc00f | 854 | #define OP_PCL_TLS12_AES_256_CBC_SHA_12 0xc00f |
| 855 | #define OP_PCL_TLS12_AES_256_CBC_SHA_13 0xc014 | 855 | #define OP_PCL_TLS12_AES_256_CBC_SHA_13 0xc014 |
| 856 | #define OP_PCL_TLS12_AES_256_CBC_SHA_14 0xc019 | 856 | #define OP_PCL_TLS12_AES_256_CBC_SHA_14 0xc019 |
| 857 | #define OP_PCL_TLS12_AES_256_CBC_SHA_15 0xc020 | 857 | #define OP_PCL_TLS12_AES_256_CBC_SHA_15 0xc020 |
| 858 | #define OP_PCL_TLS12_AES_256_CBC_SHA_16 0xc021 | 858 | #define OP_PCL_TLS12_AES_256_CBC_SHA_16 0xc021 |
| 859 | #define OP_PCL_TLS12_AES_256_CBC_SHA_17 0xc022 | 859 | #define OP_PCL_TLS12_AES_256_CBC_SHA_17 0xc022 |
| 860 | 860 | ||
| 861 | /* #define OP_PCL_TLS12_3DES_EDE_CBC_MD5 0x0023 */ | 861 | /* #define OP_PCL_TLS12_3DES_EDE_CBC_MD5 0x0023 */ |
| 862 | 862 | ||
| 863 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA 0x001f | 863 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA 0x001f |
| 864 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_2 0x008b | 864 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_2 0x008b |
| 865 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_3 0x008f | 865 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_3 0x008f |
| 866 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_4 0x0093 | 866 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_4 0x0093 |
| 867 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_5 0x000a | 867 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_5 0x000a |
| 868 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_6 0x000d | 868 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_6 0x000d |
| 869 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_7 0x0010 | 869 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_7 0x0010 |
| 870 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_8 0x0013 | 870 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_8 0x0013 |
| 871 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_9 0x0016 | 871 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_9 0x0016 |
| 872 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_10 0x001b | 872 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_10 0x001b |
| 873 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_11 0xc003 | 873 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_11 0xc003 |
| 874 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_12 0xc008 | 874 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_12 0xc008 |
| 875 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_13 0xc00d | 875 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_13 0xc00d |
| 876 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_14 0xc012 | 876 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_14 0xc012 |
| 877 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_15 0xc017 | 877 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_15 0xc017 |
| 878 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_16 0xc01a | 878 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_16 0xc01a |
| 879 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_17 0xc01b | 879 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_17 0xc01b |
| 880 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_18 0xc01c | 880 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA_18 0xc01c |
| 881 | 881 | ||
| 882 | #define OP_PCL_TLS12_DES40_CBC_MD5 0x0029 | 882 | #define OP_PCL_TLS12_DES40_CBC_MD5 0x0029 |
| 883 | 883 | ||
| 884 | #define OP_PCL_TLS12_DES_CBC_MD5 0x0022 | 884 | #define OP_PCL_TLS12_DES_CBC_MD5 0x0022 |
| 885 | 885 | ||
| 886 | #define OP_PCL_TLS12_DES40_CBC_SHA 0x0008 | 886 | #define OP_PCL_TLS12_DES40_CBC_SHA 0x0008 |
| 887 | #define OP_PCL_TLS12_DES40_CBC_SHA_2 0x000b | 887 | #define OP_PCL_TLS12_DES40_CBC_SHA_2 0x000b |
| 888 | #define OP_PCL_TLS12_DES40_CBC_SHA_3 0x000e | 888 | #define OP_PCL_TLS12_DES40_CBC_SHA_3 0x000e |
| 889 | #define OP_PCL_TLS12_DES40_CBC_SHA_4 0x0011 | 889 | #define OP_PCL_TLS12_DES40_CBC_SHA_4 0x0011 |
| 890 | #define OP_PCL_TLS12_DES40_CBC_SHA_5 0x0014 | 890 | #define OP_PCL_TLS12_DES40_CBC_SHA_5 0x0014 |
| 891 | #define OP_PCL_TLS12_DES40_CBC_SHA_6 0x0019 | 891 | #define OP_PCL_TLS12_DES40_CBC_SHA_6 0x0019 |
| 892 | #define OP_PCL_TLS12_DES40_CBC_SHA_7 0x0026 | 892 | #define OP_PCL_TLS12_DES40_CBC_SHA_7 0x0026 |
| 893 | 893 | ||
| 894 | #define OP_PCL_TLS12_DES_CBC_SHA 0x001e | 894 | #define OP_PCL_TLS12_DES_CBC_SHA 0x001e |
| 895 | #define OP_PCL_TLS12_DES_CBC_SHA_2 0x0009 | 895 | #define OP_PCL_TLS12_DES_CBC_SHA_2 0x0009 |
| 896 | #define OP_PCL_TLS12_DES_CBC_SHA_3 0x000c | 896 | #define OP_PCL_TLS12_DES_CBC_SHA_3 0x000c |
| 897 | #define OP_PCL_TLS12_DES_CBC_SHA_4 0x000f | 897 | #define OP_PCL_TLS12_DES_CBC_SHA_4 0x000f |
| 898 | #define OP_PCL_TLS12_DES_CBC_SHA_5 0x0012 | 898 | #define OP_PCL_TLS12_DES_CBC_SHA_5 0x0012 |
| 899 | #define OP_PCL_TLS12_DES_CBC_SHA_6 0x0015 | 899 | #define OP_PCL_TLS12_DES_CBC_SHA_6 0x0015 |
| 900 | #define OP_PCL_TLS12_DES_CBC_SHA_7 0x001a | 900 | #define OP_PCL_TLS12_DES_CBC_SHA_7 0x001a |
| 901 | 901 | ||
| 902 | #define OP_PCL_TLS12_RC4_128_MD5 0x0024 | 902 | #define OP_PCL_TLS12_RC4_128_MD5 0x0024 |
| 903 | #define OP_PCL_TLS12_RC4_128_MD5_2 0x0004 | 903 | #define OP_PCL_TLS12_RC4_128_MD5_2 0x0004 |
| 904 | #define OP_PCL_TLS12_RC4_128_MD5_3 0x0018 | 904 | #define OP_PCL_TLS12_RC4_128_MD5_3 0x0018 |
| 905 | 905 | ||
| 906 | #define OP_PCL_TLS12_RC4_40_MD5 0x002b | 906 | #define OP_PCL_TLS12_RC4_40_MD5 0x002b |
| 907 | #define OP_PCL_TLS12_RC4_40_MD5_2 0x0003 | 907 | #define OP_PCL_TLS12_RC4_40_MD5_2 0x0003 |
| 908 | #define OP_PCL_TLS12_RC4_40_MD5_3 0x0017 | 908 | #define OP_PCL_TLS12_RC4_40_MD5_3 0x0017 |
| 909 | 909 | ||
| 910 | #define OP_PCL_TLS12_RC4_128_SHA 0x0020 | 910 | #define OP_PCL_TLS12_RC4_128_SHA 0x0020 |
| 911 | #define OP_PCL_TLS12_RC4_128_SHA_2 0x008a | 911 | #define OP_PCL_TLS12_RC4_128_SHA_2 0x008a |
| 912 | #define OP_PCL_TLS12_RC4_128_SHA_3 0x008e | 912 | #define OP_PCL_TLS12_RC4_128_SHA_3 0x008e |
| 913 | #define OP_PCL_TLS12_RC4_128_SHA_4 0x0092 | 913 | #define OP_PCL_TLS12_RC4_128_SHA_4 0x0092 |
| 914 | #define OP_PCL_TLS12_RC4_128_SHA_5 0x0005 | 914 | #define OP_PCL_TLS12_RC4_128_SHA_5 0x0005 |
| 915 | #define OP_PCL_TLS12_RC4_128_SHA_6 0xc002 | 915 | #define OP_PCL_TLS12_RC4_128_SHA_6 0xc002 |
| 916 | #define OP_PCL_TLS12_RC4_128_SHA_7 0xc007 | 916 | #define OP_PCL_TLS12_RC4_128_SHA_7 0xc007 |
| 917 | #define OP_PCL_TLS12_RC4_128_SHA_8 0xc00c | 917 | #define OP_PCL_TLS12_RC4_128_SHA_8 0xc00c |
| 918 | #define OP_PCL_TLS12_RC4_128_SHA_9 0xc011 | 918 | #define OP_PCL_TLS12_RC4_128_SHA_9 0xc011 |
| 919 | #define OP_PCL_TLS12_RC4_128_SHA_10 0xc016 | 919 | #define OP_PCL_TLS12_RC4_128_SHA_10 0xc016 |
| 920 | 920 | ||
| 921 | #define OP_PCL_TLS12_RC4_40_SHA 0x0028 | 921 | #define OP_PCL_TLS12_RC4_40_SHA 0x0028 |
| 922 | 922 | ||
| 923 | /* #define OP_PCL_TLS12_AES_128_CBC_SHA256 0x003c */ | 923 | /* #define OP_PCL_TLS12_AES_128_CBC_SHA256 0x003c */ |
| 924 | #define OP_PCL_TLS12_AES_128_CBC_SHA256_2 0x003e | 924 | #define OP_PCL_TLS12_AES_128_CBC_SHA256_2 0x003e |
| 925 | #define OP_PCL_TLS12_AES_128_CBC_SHA256_3 0x003f | 925 | #define OP_PCL_TLS12_AES_128_CBC_SHA256_3 0x003f |
| 926 | #define OP_PCL_TLS12_AES_128_CBC_SHA256_4 0x0040 | 926 | #define OP_PCL_TLS12_AES_128_CBC_SHA256_4 0x0040 |
| 927 | #define OP_PCL_TLS12_AES_128_CBC_SHA256_5 0x0067 | 927 | #define OP_PCL_TLS12_AES_128_CBC_SHA256_5 0x0067 |
| 928 | #define OP_PCL_TLS12_AES_128_CBC_SHA256_6 0x006c | 928 | #define OP_PCL_TLS12_AES_128_CBC_SHA256_6 0x006c |
| 929 | 929 | ||
| 930 | /* #define OP_PCL_TLS12_AES_256_CBC_SHA256 0x003d */ | 930 | /* #define OP_PCL_TLS12_AES_256_CBC_SHA256 0x003d */ |
| 931 | #define OP_PCL_TLS12_AES_256_CBC_SHA256_2 0x0068 | 931 | #define OP_PCL_TLS12_AES_256_CBC_SHA256_2 0x0068 |
| 932 | #define OP_PCL_TLS12_AES_256_CBC_SHA256_3 0x0069 | 932 | #define OP_PCL_TLS12_AES_256_CBC_SHA256_3 0x0069 |
| 933 | #define OP_PCL_TLS12_AES_256_CBC_SHA256_4 0x006a | 933 | #define OP_PCL_TLS12_AES_256_CBC_SHA256_4 0x006a |
| 934 | #define OP_PCL_TLS12_AES_256_CBC_SHA256_5 0x006b | 934 | #define OP_PCL_TLS12_AES_256_CBC_SHA256_5 0x006b |
| 935 | #define OP_PCL_TLS12_AES_256_CBC_SHA256_6 0x006d | 935 | #define OP_PCL_TLS12_AES_256_CBC_SHA256_6 0x006d |
| 936 | 936 | ||
| 937 | /* AEAD_AES_xxx_CCM/GCM remain to be defined... */ | 937 | /* AEAD_AES_xxx_CCM/GCM remain to be defined... */ |
| 938 | 938 | ||
| 939 | #define OP_PCL_TLS12_3DES_EDE_CBC_MD5 0xff23 | 939 | #define OP_PCL_TLS12_3DES_EDE_CBC_MD5 0xff23 |
| 940 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA160 0xff30 | 940 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA160 0xff30 |
| 941 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA224 0xff34 | 941 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA224 0xff34 |
| 942 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA256 0xff36 | 942 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA256 0xff36 |
| 943 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA384 0xff33 | 943 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA384 0xff33 |
| 944 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA512 0xff35 | 944 | #define OP_PCL_TLS12_3DES_EDE_CBC_SHA512 0xff35 |
| 945 | #define OP_PCL_TLS12_AES_128_CBC_SHA160 0xff80 | 945 | #define OP_PCL_TLS12_AES_128_CBC_SHA160 0xff80 |
| 946 | #define OP_PCL_TLS12_AES_128_CBC_SHA224 0xff84 | 946 | #define OP_PCL_TLS12_AES_128_CBC_SHA224 0xff84 |
| 947 | #define OP_PCL_TLS12_AES_128_CBC_SHA256 0xff86 | 947 | #define OP_PCL_TLS12_AES_128_CBC_SHA256 0xff86 |
| 948 | #define OP_PCL_TLS12_AES_128_CBC_SHA384 0xff83 | 948 | #define OP_PCL_TLS12_AES_128_CBC_SHA384 0xff83 |
| 949 | #define OP_PCL_TLS12_AES_128_CBC_SHA512 0xff85 | 949 | #define OP_PCL_TLS12_AES_128_CBC_SHA512 0xff85 |
| 950 | #define OP_PCL_TLS12_AES_192_CBC_SHA160 0xff20 | 950 | #define OP_PCL_TLS12_AES_192_CBC_SHA160 0xff20 |
| 951 | #define OP_PCL_TLS12_AES_192_CBC_SHA224 0xff24 | 951 | #define OP_PCL_TLS12_AES_192_CBC_SHA224 0xff24 |
| 952 | #define OP_PCL_TLS12_AES_192_CBC_SHA256 0xff26 | 952 | #define OP_PCL_TLS12_AES_192_CBC_SHA256 0xff26 |
| 953 | #define OP_PCL_TLS12_AES_192_CBC_SHA384 0xff23 | 953 | #define OP_PCL_TLS12_AES_192_CBC_SHA384 0xff23 |
| 954 | #define OP_PCL_TLS12_AES_192_CBC_SHA512 0xff25 | 954 | #define OP_PCL_TLS12_AES_192_CBC_SHA512 0xff25 |
| 955 | #define OP_PCL_TLS12_AES_256_CBC_SHA160 0xff60 | 955 | #define OP_PCL_TLS12_AES_256_CBC_SHA160 0xff60 |
| 956 | #define OP_PCL_TLS12_AES_256_CBC_SHA224 0xff64 | 956 | #define OP_PCL_TLS12_AES_256_CBC_SHA224 0xff64 |
| 957 | #define OP_PCL_TLS12_AES_256_CBC_SHA256 0xff66 | 957 | #define OP_PCL_TLS12_AES_256_CBC_SHA256 0xff66 |
| 958 | #define OP_PCL_TLS12_AES_256_CBC_SHA384 0xff63 | 958 | #define OP_PCL_TLS12_AES_256_CBC_SHA384 0xff63 |
| 959 | #define OP_PCL_TLS12_AES_256_CBC_SHA512 0xff65 | 959 | #define OP_PCL_TLS12_AES_256_CBC_SHA512 0xff65 |
| 960 | 960 | ||
| 961 | /* For DTLS - OP_PCLID_DTLS */ | 961 | /* For DTLS - OP_PCLID_DTLS */ |
| 962 | 962 | ||
| 963 | #define OP_PCL_DTLS_AES_128_CBC_SHA 0x002f | 963 | #define OP_PCL_DTLS_AES_128_CBC_SHA 0x002f |
| 964 | #define OP_PCL_DTLS_AES_128_CBC_SHA_2 0x0030 | 964 | #define OP_PCL_DTLS_AES_128_CBC_SHA_2 0x0030 |
| 965 | #define OP_PCL_DTLS_AES_128_CBC_SHA_3 0x0031 | 965 | #define OP_PCL_DTLS_AES_128_CBC_SHA_3 0x0031 |
| 966 | #define OP_PCL_DTLS_AES_128_CBC_SHA_4 0x0032 | 966 | #define OP_PCL_DTLS_AES_128_CBC_SHA_4 0x0032 |
| 967 | #define OP_PCL_DTLS_AES_128_CBC_SHA_5 0x0033 | 967 | #define OP_PCL_DTLS_AES_128_CBC_SHA_5 0x0033 |
| 968 | #define OP_PCL_DTLS_AES_128_CBC_SHA_6 0x0034 | 968 | #define OP_PCL_DTLS_AES_128_CBC_SHA_6 0x0034 |
| 969 | #define OP_PCL_DTLS_AES_128_CBC_SHA_7 0x008c | 969 | #define OP_PCL_DTLS_AES_128_CBC_SHA_7 0x008c |
| 970 | #define OP_PCL_DTLS_AES_128_CBC_SHA_8 0x0090 | 970 | #define OP_PCL_DTLS_AES_128_CBC_SHA_8 0x0090 |
| 971 | #define OP_PCL_DTLS_AES_128_CBC_SHA_9 0x0094 | 971 | #define OP_PCL_DTLS_AES_128_CBC_SHA_9 0x0094 |
| 972 | #define OP_PCL_DTLS_AES_128_CBC_SHA_10 0xc004 | 972 | #define OP_PCL_DTLS_AES_128_CBC_SHA_10 0xc004 |
| 973 | #define OP_PCL_DTLS_AES_128_CBC_SHA_11 0xc009 | 973 | #define OP_PCL_DTLS_AES_128_CBC_SHA_11 0xc009 |
| 974 | #define OP_PCL_DTLS_AES_128_CBC_SHA_12 0xc00e | 974 | #define OP_PCL_DTLS_AES_128_CBC_SHA_12 0xc00e |
| 975 | #define OP_PCL_DTLS_AES_128_CBC_SHA_13 0xc013 | 975 | #define OP_PCL_DTLS_AES_128_CBC_SHA_13 0xc013 |
| 976 | #define OP_PCL_DTLS_AES_128_CBC_SHA_14 0xc018 | 976 | #define OP_PCL_DTLS_AES_128_CBC_SHA_14 0xc018 |
| 977 | #define OP_PCL_DTLS_AES_128_CBC_SHA_15 0xc01d | 977 | #define OP_PCL_DTLS_AES_128_CBC_SHA_15 0xc01d |
| 978 | #define OP_PCL_DTLS_AES_128_CBC_SHA_16 0xc01e | 978 | #define OP_PCL_DTLS_AES_128_CBC_SHA_16 0xc01e |
| 979 | #define OP_PCL_DTLS_AES_128_CBC_SHA_17 0xc01f | 979 | #define OP_PCL_DTLS_AES_128_CBC_SHA_17 0xc01f |
| 980 | 980 | ||
| 981 | #define OP_PCL_DTLS_AES_256_CBC_SHA 0x0035 | 981 | #define OP_PCL_DTLS_AES_256_CBC_SHA 0x0035 |
| 982 | #define OP_PCL_DTLS_AES_256_CBC_SHA_2 0x0036 | 982 | #define OP_PCL_DTLS_AES_256_CBC_SHA_2 0x0036 |
| 983 | #define OP_PCL_DTLS_AES_256_CBC_SHA_3 0x0037 | 983 | #define OP_PCL_DTLS_AES_256_CBC_SHA_3 0x0037 |
| 984 | #define OP_PCL_DTLS_AES_256_CBC_SHA_4 0x0038 | 984 | #define OP_PCL_DTLS_AES_256_CBC_SHA_4 0x0038 |
| 985 | #define OP_PCL_DTLS_AES_256_CBC_SHA_5 0x0039 | 985 | #define OP_PCL_DTLS_AES_256_CBC_SHA_5 0x0039 |
| 986 | #define OP_PCL_DTLS_AES_256_CBC_SHA_6 0x003a | 986 | #define OP_PCL_DTLS_AES_256_CBC_SHA_6 0x003a |
| 987 | #define OP_PCL_DTLS_AES_256_CBC_SHA_7 0x008d | 987 | #define OP_PCL_DTLS_AES_256_CBC_SHA_7 0x008d |
| 988 | #define OP_PCL_DTLS_AES_256_CBC_SHA_8 0x0091 | 988 | #define OP_PCL_DTLS_AES_256_CBC_SHA_8 0x0091 |
| 989 | #define OP_PCL_DTLS_AES_256_CBC_SHA_9 0x0095 | 989 | #define OP_PCL_DTLS_AES_256_CBC_SHA_9 0x0095 |
| 990 | #define OP_PCL_DTLS_AES_256_CBC_SHA_10 0xc005 | 990 | #define OP_PCL_DTLS_AES_256_CBC_SHA_10 0xc005 |
| 991 | #define OP_PCL_DTLS_AES_256_CBC_SHA_11 0xc00a | 991 | #define OP_PCL_DTLS_AES_256_CBC_SHA_11 0xc00a |
| 992 | #define OP_PCL_DTLS_AES_256_CBC_SHA_12 0xc00f | 992 | #define OP_PCL_DTLS_AES_256_CBC_SHA_12 0xc00f |
| 993 | #define OP_PCL_DTLS_AES_256_CBC_SHA_13 0xc014 | 993 | #define OP_PCL_DTLS_AES_256_CBC_SHA_13 0xc014 |
| 994 | #define OP_PCL_DTLS_AES_256_CBC_SHA_14 0xc019 | 994 | #define OP_PCL_DTLS_AES_256_CBC_SHA_14 0xc019 |
| 995 | #define OP_PCL_DTLS_AES_256_CBC_SHA_15 0xc020 | 995 | #define OP_PCL_DTLS_AES_256_CBC_SHA_15 0xc020 |
| 996 | #define OP_PCL_DTLS_AES_256_CBC_SHA_16 0xc021 | 996 | #define OP_PCL_DTLS_AES_256_CBC_SHA_16 0xc021 |
| 997 | #define OP_PCL_DTLS_AES_256_CBC_SHA_17 0xc022 | 997 | #define OP_PCL_DTLS_AES_256_CBC_SHA_17 0xc022 |
| 998 | 998 | ||
| 999 | /* #define OP_PCL_DTLS_3DES_EDE_CBC_MD5 0x0023 */ | 999 | /* #define OP_PCL_DTLS_3DES_EDE_CBC_MD5 0x0023 */ |
| 1000 | 1000 | ||
| 1001 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA 0x001f | 1001 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA 0x001f |
| 1002 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_2 0x008b | 1002 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_2 0x008b |
| 1003 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_3 0x008f | 1003 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_3 0x008f |
| 1004 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_4 0x0093 | 1004 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_4 0x0093 |
| 1005 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_5 0x000a | 1005 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_5 0x000a |
| 1006 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_6 0x000d | 1006 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_6 0x000d |
| 1007 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_7 0x0010 | 1007 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_7 0x0010 |
| 1008 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_8 0x0013 | 1008 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_8 0x0013 |
| 1009 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_9 0x0016 | 1009 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_9 0x0016 |
| 1010 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_10 0x001b | 1010 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_10 0x001b |
| 1011 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_11 0xc003 | 1011 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_11 0xc003 |
| 1012 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_12 0xc008 | 1012 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_12 0xc008 |
| 1013 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_13 0xc00d | 1013 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_13 0xc00d |
| 1014 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_14 0xc012 | 1014 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_14 0xc012 |
| 1015 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_15 0xc017 | 1015 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_15 0xc017 |
| 1016 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_16 0xc01a | 1016 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_16 0xc01a |
| 1017 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_17 0xc01b | 1017 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_17 0xc01b |
| 1018 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_18 0xc01c | 1018 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA_18 0xc01c |
| 1019 | 1019 | ||
| 1020 | #define OP_PCL_DTLS_DES40_CBC_MD5 0x0029 | 1020 | #define OP_PCL_DTLS_DES40_CBC_MD5 0x0029 |
| 1021 | 1021 | ||
| 1022 | #define OP_PCL_DTLS_DES_CBC_MD5 0x0022 | 1022 | #define OP_PCL_DTLS_DES_CBC_MD5 0x0022 |
| 1023 | 1023 | ||
| 1024 | #define OP_PCL_DTLS_DES40_CBC_SHA 0x0008 | 1024 | #define OP_PCL_DTLS_DES40_CBC_SHA 0x0008 |
| 1025 | #define OP_PCL_DTLS_DES40_CBC_SHA_2 0x000b | 1025 | #define OP_PCL_DTLS_DES40_CBC_SHA_2 0x000b |
| 1026 | #define OP_PCL_DTLS_DES40_CBC_SHA_3 0x000e | 1026 | #define OP_PCL_DTLS_DES40_CBC_SHA_3 0x000e |
| 1027 | #define OP_PCL_DTLS_DES40_CBC_SHA_4 0x0011 | 1027 | #define OP_PCL_DTLS_DES40_CBC_SHA_4 0x0011 |
| 1028 | #define OP_PCL_DTLS_DES40_CBC_SHA_5 0x0014 | 1028 | #define OP_PCL_DTLS_DES40_CBC_SHA_5 0x0014 |
| 1029 | #define OP_PCL_DTLS_DES40_CBC_SHA_6 0x0019 | 1029 | #define OP_PCL_DTLS_DES40_CBC_SHA_6 0x0019 |
| 1030 | #define OP_PCL_DTLS_DES40_CBC_SHA_7 0x0026 | 1030 | #define OP_PCL_DTLS_DES40_CBC_SHA_7 0x0026 |
| 1031 | 1031 | ||
| 1032 | 1032 | ||
| 1033 | #define OP_PCL_DTLS_DES_CBC_SHA 0x001e | 1033 | #define OP_PCL_DTLS_DES_CBC_SHA 0x001e |
| 1034 | #define OP_PCL_DTLS_DES_CBC_SHA_2 0x0009 | 1034 | #define OP_PCL_DTLS_DES_CBC_SHA_2 0x0009 |
| 1035 | #define OP_PCL_DTLS_DES_CBC_SHA_3 0x000c | 1035 | #define OP_PCL_DTLS_DES_CBC_SHA_3 0x000c |
| 1036 | #define OP_PCL_DTLS_DES_CBC_SHA_4 0x000f | 1036 | #define OP_PCL_DTLS_DES_CBC_SHA_4 0x000f |
| 1037 | #define OP_PCL_DTLS_DES_CBC_SHA_5 0x0012 | 1037 | #define OP_PCL_DTLS_DES_CBC_SHA_5 0x0012 |
| 1038 | #define OP_PCL_DTLS_DES_CBC_SHA_6 0x0015 | 1038 | #define OP_PCL_DTLS_DES_CBC_SHA_6 0x0015 |
| 1039 | #define OP_PCL_DTLS_DES_CBC_SHA_7 0x001a | 1039 | #define OP_PCL_DTLS_DES_CBC_SHA_7 0x001a |
| 1040 | 1040 | ||
| 1041 | 1041 | ||
| 1042 | #define OP_PCL_DTLS_3DES_EDE_CBC_MD5 0xff23 | 1042 | #define OP_PCL_DTLS_3DES_EDE_CBC_MD5 0xff23 |
| 1043 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA160 0xff30 | 1043 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA160 0xff30 |
| 1044 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA224 0xff34 | 1044 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA224 0xff34 |
| 1045 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA256 0xff36 | 1045 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA256 0xff36 |
| 1046 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA384 0xff33 | 1046 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA384 0xff33 |
| 1047 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA512 0xff35 | 1047 | #define OP_PCL_DTLS_3DES_EDE_CBC_SHA512 0xff35 |
| 1048 | #define OP_PCL_DTLS_AES_128_CBC_SHA160 0xff80 | 1048 | #define OP_PCL_DTLS_AES_128_CBC_SHA160 0xff80 |
| 1049 | #define OP_PCL_DTLS_AES_128_CBC_SHA224 0xff84 | 1049 | #define OP_PCL_DTLS_AES_128_CBC_SHA224 0xff84 |
| 1050 | #define OP_PCL_DTLS_AES_128_CBC_SHA256 0xff86 | 1050 | #define OP_PCL_DTLS_AES_128_CBC_SHA256 0xff86 |
| 1051 | #define OP_PCL_DTLS_AES_128_CBC_SHA384 0xff83 | 1051 | #define OP_PCL_DTLS_AES_128_CBC_SHA384 0xff83 |
| 1052 | #define OP_PCL_DTLS_AES_128_CBC_SHA512 0xff85 | 1052 | #define OP_PCL_DTLS_AES_128_CBC_SHA512 0xff85 |
| 1053 | #define OP_PCL_DTLS_AES_192_CBC_SHA160 0xff20 | 1053 | #define OP_PCL_DTLS_AES_192_CBC_SHA160 0xff20 |
| 1054 | #define OP_PCL_DTLS_AES_192_CBC_SHA224 0xff24 | 1054 | #define OP_PCL_DTLS_AES_192_CBC_SHA224 0xff24 |
| 1055 | #define OP_PCL_DTLS_AES_192_CBC_SHA256 0xff26 | 1055 | #define OP_PCL_DTLS_AES_192_CBC_SHA256 0xff26 |
| 1056 | #define OP_PCL_DTLS_AES_192_CBC_SHA384 0xff23 | 1056 | #define OP_PCL_DTLS_AES_192_CBC_SHA384 0xff23 |
| 1057 | #define OP_PCL_DTLS_AES_192_CBC_SHA512 0xff25 | 1057 | #define OP_PCL_DTLS_AES_192_CBC_SHA512 0xff25 |
| 1058 | #define OP_PCL_DTLS_AES_256_CBC_SHA160 0xff60 | 1058 | #define OP_PCL_DTLS_AES_256_CBC_SHA160 0xff60 |
| 1059 | #define OP_PCL_DTLS_AES_256_CBC_SHA224 0xff64 | 1059 | #define OP_PCL_DTLS_AES_256_CBC_SHA224 0xff64 |
| 1060 | #define OP_PCL_DTLS_AES_256_CBC_SHA256 0xff66 | 1060 | #define OP_PCL_DTLS_AES_256_CBC_SHA256 0xff66 |
| 1061 | #define OP_PCL_DTLS_AES_256_CBC_SHA384 0xff63 | 1061 | #define OP_PCL_DTLS_AES_256_CBC_SHA384 0xff63 |
| 1062 | #define OP_PCL_DTLS_AES_256_CBC_SHA512 0xff65 | 1062 | #define OP_PCL_DTLS_AES_256_CBC_SHA512 0xff65 |
| 1063 | 1063 | ||
| 1064 | /* 802.16 WiMAX protinfos */ | 1064 | /* 802.16 WiMAX protinfos */ |
| 1065 | #define OP_PCL_WIMAX_OFDM 0x0201 | 1065 | #define OP_PCL_WIMAX_OFDM 0x0201 |
| 1066 | #define OP_PCL_WIMAX_OFDMA 0x0231 | 1066 | #define OP_PCL_WIMAX_OFDMA 0x0231 |
| 1067 | 1067 | ||
| 1068 | /* 802.11 WiFi protinfos */ | 1068 | /* 802.11 WiFi protinfos */ |
| 1069 | #define OP_PCL_WIFI 0xac04 | 1069 | #define OP_PCL_WIFI 0xac04 |
| 1070 | 1070 | ||
| 1071 | /* MacSec protinfos */ | 1071 | /* MacSec protinfos */ |
| 1072 | #define OP_PCL_MACSEC 0x0001 | 1072 | #define OP_PCL_MACSEC 0x0001 |
| 1073 | 1073 | ||
| 1074 | /* PKI unidirectional protocol protinfo bits */ | 1074 | /* PKI unidirectional protocol protinfo bits */ |
| 1075 | #define OP_PCL_PKPROT_TEST 0x0008 | 1075 | #define OP_PCL_PKPROT_TEST 0x0008 |
| 1076 | #define OP_PCL_PKPROT_DECRYPT 0x0004 | 1076 | #define OP_PCL_PKPROT_DECRYPT 0x0004 |
| 1077 | #define OP_PCL_PKPROT_ECC 0x0002 | 1077 | #define OP_PCL_PKPROT_ECC 0x0002 |
| 1078 | #define OP_PCL_PKPROT_F2M 0x0001 | 1078 | #define OP_PCL_PKPROT_F2M 0x0001 |
| 1079 | 1079 | ||
| 1080 | /* For non-protocol/alg-only op commands */ | 1080 | /* For non-protocol/alg-only op commands */ |
| 1081 | #define OP_ALG_TYPE_SHIFT 24 | 1081 | #define OP_ALG_TYPE_SHIFT 24 |
| @@ -1181,114 +1181,114 @@ | |||
| 1181 | #define OP_ALG_ENCRYPT 1 | 1181 | #define OP_ALG_ENCRYPT 1 |
| 1182 | 1182 | ||
| 1183 | /* PKHA algorithm type set */ | 1183 | /* PKHA algorithm type set */ |
| 1184 | #define OP_ALG_PK 0x00800000 | 1184 | #define OP_ALG_PK 0x00800000 |
| 1185 | #define OP_ALG_PK_FUN_MASK 0x3f /* clrmem, modmath, or cpymem */ | 1185 | #define OP_ALG_PK_FUN_MASK 0x3f /* clrmem, modmath, or cpymem */ |
| 1186 | 1186 | ||
| 1187 | /* PKHA mode clear memory functions */ | 1187 | /* PKHA mode clear memory functions */ |
| 1188 | #define OP_ALG_PKMODE_A_RAM 0x80000 | 1188 | #define OP_ALG_PKMODE_A_RAM 0x80000 |
| 1189 | #define OP_ALG_PKMODE_B_RAM 0x40000 | 1189 | #define OP_ALG_PKMODE_B_RAM 0x40000 |
| 1190 | #define OP_ALG_PKMODE_E_RAM 0x20000 | 1190 | #define OP_ALG_PKMODE_E_RAM 0x20000 |
| 1191 | #define OP_ALG_PKMODE_N_RAM 0x10000 | 1191 | #define OP_ALG_PKMODE_N_RAM 0x10000 |
| 1192 | #define OP_ALG_PKMODE_CLEARMEM 0x00001 | 1192 | #define OP_ALG_PKMODE_CLEARMEM 0x00001 |
| 1193 | 1193 | ||
| 1194 | /* PKHA mode modular-arithmetic functions */ | 1194 | /* PKHA mode modular-arithmetic functions */ |
| 1195 | #define OP_ALG_PKMODE_MOD_IN_MONTY 0x80000 | 1195 | #define OP_ALG_PKMODE_MOD_IN_MONTY 0x80000 |
| 1196 | #define OP_ALG_PKMODE_MOD_OUT_MONTY 0x40000 | 1196 | #define OP_ALG_PKMODE_MOD_OUT_MONTY 0x40000 |
| 1197 | #define OP_ALG_PKMODE_MOD_F2M 0x20000 | 1197 | #define OP_ALG_PKMODE_MOD_F2M 0x20000 |
| 1198 | #define OP_ALG_PKMODE_MOD_R2_IN 0x10000 | 1198 | #define OP_ALG_PKMODE_MOD_R2_IN 0x10000 |
| 1199 | #define OP_ALG_PKMODE_PRJECTV 0x00800 | 1199 | #define OP_ALG_PKMODE_PRJECTV 0x00800 |
| 1200 | #define OP_ALG_PKMODE_TIME_EQ 0x400 | 1200 | #define OP_ALG_PKMODE_TIME_EQ 0x400 |
| 1201 | #define OP_ALG_PKMODE_OUT_B 0x000 | 1201 | #define OP_ALG_PKMODE_OUT_B 0x000 |
| 1202 | #define OP_ALG_PKMODE_OUT_A 0x100 | 1202 | #define OP_ALG_PKMODE_OUT_A 0x100 |
| 1203 | #define OP_ALG_PKMODE_MOD_ADD 0x002 | 1203 | #define OP_ALG_PKMODE_MOD_ADD 0x002 |
| 1204 | #define OP_ALG_PKMODE_MOD_SUB_AB 0x003 | 1204 | #define OP_ALG_PKMODE_MOD_SUB_AB 0x003 |
| 1205 | #define OP_ALG_PKMODE_MOD_SUB_BA 0x004 | 1205 | #define OP_ALG_PKMODE_MOD_SUB_BA 0x004 |
| 1206 | #define OP_ALG_PKMODE_MOD_MULT 0x005 | 1206 | #define OP_ALG_PKMODE_MOD_MULT 0x005 |
| 1207 | #define OP_ALG_PKMODE_MOD_EXPO 0x006 | 1207 | #define OP_ALG_PKMODE_MOD_EXPO 0x006 |
| 1208 | #define OP_ALG_PKMODE_MOD_REDUCT 0x007 | 1208 | #define OP_ALG_PKMODE_MOD_REDUCT 0x007 |
| 1209 | #define OP_ALG_PKMODE_MOD_INV 0x008 | 1209 | #define OP_ALG_PKMODE_MOD_INV 0x008 |
| 1210 | #define OP_ALG_PKMODE_MOD_ECC_ADD 0x009 | 1210 | #define OP_ALG_PKMODE_MOD_ECC_ADD 0x009 |
| 1211 | #define OP_ALG_PKMODE_MOD_ECC_DBL 0x00a | 1211 | #define OP_ALG_PKMODE_MOD_ECC_DBL 0x00a |
| 1212 | #define OP_ALG_PKMODE_MOD_ECC_MULT 0x00b | 1212 | #define OP_ALG_PKMODE_MOD_ECC_MULT 0x00b |
| 1213 | #define OP_ALG_PKMODE_MOD_MONT_CNST 0x00c | 1213 | #define OP_ALG_PKMODE_MOD_MONT_CNST 0x00c |
| 1214 | #define OP_ALG_PKMODE_MOD_CRT_CNST 0x00d | 1214 | #define OP_ALG_PKMODE_MOD_CRT_CNST 0x00d |
| 1215 | #define OP_ALG_PKMODE_MOD_GCD 0x00e | 1215 | #define OP_ALG_PKMODE_MOD_GCD 0x00e |
| 1216 | #define OP_ALG_PKMODE_MOD_PRIMALITY 0x00f | 1216 | #define OP_ALG_PKMODE_MOD_PRIMALITY 0x00f |
| 1217 | 1217 | ||
| 1218 | /* PKHA mode copy-memory functions */ | 1218 | /* PKHA mode copy-memory functions */ |
| 1219 | #define OP_ALG_PKMODE_SRC_REG_SHIFT 13 | 1219 | #define OP_ALG_PKMODE_SRC_REG_SHIFT 13 |
| 1220 | #define OP_ALG_PKMODE_SRC_REG_MASK (7 << OP_ALG_PKMODE_SRC_REG_SHIFT) | 1220 | #define OP_ALG_PKMODE_SRC_REG_MASK (7 << OP_ALG_PKMODE_SRC_REG_SHIFT) |
| 1221 | #define OP_ALG_PKMODE_DST_REG_SHIFT 10 | 1221 | #define OP_ALG_PKMODE_DST_REG_SHIFT 10 |
| 1222 | #define OP_ALG_PKMODE_DST_REG_MASK (7 << OP_ALG_PKMODE_DST_REG_SHIFT) | 1222 | #define OP_ALG_PKMODE_DST_REG_MASK (7 << OP_ALG_PKMODE_DST_REG_SHIFT) |
| 1223 | #define OP_ALG_PKMODE_SRC_SEG_SHIFT 8 | 1223 | #define OP_ALG_PKMODE_SRC_SEG_SHIFT 8 |
| 1224 | #define OP_ALG_PKMODE_SRC_SEG_MASK (3 << OP_ALG_PKMODE_SRC_SEG_SHIFT) | 1224 | #define OP_ALG_PKMODE_SRC_SEG_MASK (3 << OP_ALG_PKMODE_SRC_SEG_SHIFT) |
| 1225 | #define OP_ALG_PKMODE_DST_SEG_SHIFT 6 | 1225 | #define OP_ALG_PKMODE_DST_SEG_SHIFT 6 |
| 1226 | #define OP_ALG_PKMODE_DST_SEG_MASK (3 << OP_ALG_PKMODE_DST_SEG_SHIFT) | 1226 | #define OP_ALG_PKMODE_DST_SEG_MASK (3 << OP_ALG_PKMODE_DST_SEG_SHIFT) |
| 1227 | 1227 | ||
| 1228 | #define OP_ALG_PKMODE_SRC_REG_A (0 << OP_ALG_PKMODE_SRC_REG_SHIFT) | 1228 | #define OP_ALG_PKMODE_SRC_REG_A (0 << OP_ALG_PKMODE_SRC_REG_SHIFT) |
| 1229 | #define OP_ALG_PKMODE_SRC_REG_B (1 << OP_ALG_PKMODE_SRC_REG_SHIFT) | 1229 | #define OP_ALG_PKMODE_SRC_REG_B (1 << OP_ALG_PKMODE_SRC_REG_SHIFT) |
| 1230 | #define OP_ALG_PKMODE_SRC_REG_N (3 << OP_ALG_PKMODE_SRC_REG_SHIFT) | 1230 | #define OP_ALG_PKMODE_SRC_REG_N (3 << OP_ALG_PKMODE_SRC_REG_SHIFT) |
| 1231 | #define OP_ALG_PKMODE_DST_REG_A (0 << OP_ALG_PKMODE_DST_REG_SHIFT) | 1231 | #define OP_ALG_PKMODE_DST_REG_A (0 << OP_ALG_PKMODE_DST_REG_SHIFT) |
| 1232 | #define OP_ALG_PKMODE_DST_REG_B (1 << OP_ALG_PKMODE_DST_REG_SHIFT) | 1232 | #define OP_ALG_PKMODE_DST_REG_B (1 << OP_ALG_PKMODE_DST_REG_SHIFT) |
| 1233 | #define OP_ALG_PKMODE_DST_REG_E (2 << OP_ALG_PKMODE_DST_REG_SHIFT) | 1233 | #define OP_ALG_PKMODE_DST_REG_E (2 << OP_ALG_PKMODE_DST_REG_SHIFT) |
| 1234 | #define OP_ALG_PKMODE_DST_REG_N (3 << OP_ALG_PKMODE_DST_REG_SHIFT) | 1234 | #define OP_ALG_PKMODE_DST_REG_N (3 << OP_ALG_PKMODE_DST_REG_SHIFT) |
| 1235 | #define OP_ALG_PKMODE_SRC_SEG_0 (0 << OP_ALG_PKMODE_SRC_SEG_SHIFT) | 1235 | #define OP_ALG_PKMODE_SRC_SEG_0 (0 << OP_ALG_PKMODE_SRC_SEG_SHIFT) |
| 1236 | #define OP_ALG_PKMODE_SRC_SEG_1 (1 << OP_ALG_PKMODE_SRC_SEG_SHIFT) | 1236 | #define OP_ALG_PKMODE_SRC_SEG_1 (1 << OP_ALG_PKMODE_SRC_SEG_SHIFT) |
| 1237 | #define OP_ALG_PKMODE_SRC_SEG_2 (2 << OP_ALG_PKMODE_SRC_SEG_SHIFT) | 1237 | #define OP_ALG_PKMODE_SRC_SEG_2 (2 << OP_ALG_PKMODE_SRC_SEG_SHIFT) |
| 1238 | #define OP_ALG_PKMODE_SRC_SEG_3 (3 << OP_ALG_PKMODE_SRC_SEG_SHIFT) | 1238 | #define OP_ALG_PKMODE_SRC_SEG_3 (3 << OP_ALG_PKMODE_SRC_SEG_SHIFT) |
| 1239 | #define OP_ALG_PKMODE_DST_SEG_0 (0 << OP_ALG_PKMODE_DST_SEG_SHIFT) | 1239 | #define OP_ALG_PKMODE_DST_SEG_0 (0 << OP_ALG_PKMODE_DST_SEG_SHIFT) |
| 1240 | #define OP_ALG_PKMODE_DST_SEG_1 (1 << OP_ALG_PKMODE_DST_SEG_SHIFT) | 1240 | #define OP_ALG_PKMODE_DST_SEG_1 (1 << OP_ALG_PKMODE_DST_SEG_SHIFT) |
| 1241 | #define OP_ALG_PKMODE_DST_SEG_2 (2 << OP_ALG_PKMODE_DST_SEG_SHIFT) | 1241 | #define OP_ALG_PKMODE_DST_SEG_2 (2 << OP_ALG_PKMODE_DST_SEG_SHIFT) |
| 1242 | #define OP_ALG_PKMODE_DST_SEG_3 (3 << OP_ALG_PKMODE_DST_SEG_SHIFT) | 1242 | #define OP_ALG_PKMODE_DST_SEG_3 (3 << OP_ALG_PKMODE_DST_SEG_SHIFT) |
| 1243 | #define OP_ALG_PKMODE_CPYMEM_N_SZ 0x80 | 1243 | #define OP_ALG_PKMODE_CPYMEM_N_SZ 0x80 |
| 1244 | #define OP_ALG_PKMODE_CPYMEM_SRC_SZ 0x81 | 1244 | #define OP_ALG_PKMODE_CPYMEM_SRC_SZ 0x81 |
| 1245 | 1245 | ||
| 1246 | /* | 1246 | /* |
| 1247 | * SEQ_IN_PTR Command Constructs | 1247 | * SEQ_IN_PTR Command Constructs |
| 1248 | */ | 1248 | */ |
| 1249 | 1249 | ||
| 1250 | /* Release Buffers */ | 1250 | /* Release Buffers */ |
| 1251 | #define SQIN_RBS 0x04000000 | 1251 | #define SQIN_RBS 0x04000000 |
| 1252 | 1252 | ||
| 1253 | /* Sequence pointer is really a descriptor */ | 1253 | /* Sequence pointer is really a descriptor */ |
| 1254 | #define SQIN_INL 0x02000000 | 1254 | #define SQIN_INL 0x02000000 |
| 1255 | 1255 | ||
| 1256 | /* Sequence pointer is a scatter-gather table */ | 1256 | /* Sequence pointer is a scatter-gather table */ |
| 1257 | #define SQIN_SGF 0x01000000 | 1257 | #define SQIN_SGF 0x01000000 |
| 1258 | 1258 | ||
| 1259 | /* Appends to a previous pointer */ | 1259 | /* Appends to a previous pointer */ |
| 1260 | #define SQIN_PRE 0x00800000 | 1260 | #define SQIN_PRE 0x00800000 |
| 1261 | 1261 | ||
| 1262 | /* Use extended length following pointer */ | 1262 | /* Use extended length following pointer */ |
| 1263 | #define SQIN_EXT 0x00400000 | 1263 | #define SQIN_EXT 0x00400000 |
| 1264 | 1264 | ||
| 1265 | /* Restore sequence with pointer/length */ | 1265 | /* Restore sequence with pointer/length */ |
| 1266 | #define SQIN_RTO 0x00200000 | 1266 | #define SQIN_RTO 0x00200000 |
| 1267 | 1267 | ||
| 1268 | /* Replace job descriptor */ | 1268 | /* Replace job descriptor */ |
| 1269 | #define SQIN_RJD 0x00100000 | 1269 | #define SQIN_RJD 0x00100000 |
| 1270 | 1270 | ||
| 1271 | #define SQIN_LEN_SHIFT 0 | 1271 | #define SQIN_LEN_SHIFT 0 |
| 1272 | #define SQIN_LEN_MASK (0xffff << SQIN_LEN_SHIFT) | 1272 | #define SQIN_LEN_MASK (0xffff << SQIN_LEN_SHIFT) |
| 1273 | 1273 | ||
| 1274 | /* | 1274 | /* |
| 1275 | * SEQ_OUT_PTR Command Constructs | 1275 | * SEQ_OUT_PTR Command Constructs |
| 1276 | */ | 1276 | */ |
| 1277 | 1277 | ||
| 1278 | /* Sequence pointer is a scatter-gather table */ | 1278 | /* Sequence pointer is a scatter-gather table */ |
| 1279 | #define SQOUT_SGF 0x01000000 | 1279 | #define SQOUT_SGF 0x01000000 |
| 1280 | 1280 | ||
| 1281 | /* Appends to a previous pointer */ | 1281 | /* Appends to a previous pointer */ |
| 1282 | #define SQOUT_PRE 0x00800000 | 1282 | #define SQOUT_PRE 0x00800000 |
| 1283 | 1283 | ||
| 1284 | /* Restore sequence with pointer/length */ | 1284 | /* Restore sequence with pointer/length */ |
| 1285 | #define SQOUT_RTO 0x00200000 | 1285 | #define SQOUT_RTO 0x00200000 |
| 1286 | 1286 | ||
| 1287 | /* Use extended length following pointer */ | 1287 | /* Use extended length following pointer */ |
| 1288 | #define SQOUT_EXT 0x00400000 | 1288 | #define SQOUT_EXT 0x00400000 |
| 1289 | 1289 | ||
| 1290 | #define SQOUT_LEN_SHIFT 0 | 1290 | #define SQOUT_LEN_SHIFT 0 |
| 1291 | #define SQOUT_LEN_MASK (0xffff << SQOUT_LEN_SHIFT) | 1291 | #define SQOUT_LEN_MASK (0xffff << SQOUT_LEN_SHIFT) |
| 1292 | 1292 | ||
| 1293 | 1293 | ||
| 1294 | /* | 1294 | /* |
| @@ -1296,196 +1296,196 @@ | |||
| 1296 | */ | 1296 | */ |
| 1297 | 1297 | ||
| 1298 | /* TYPE field is all that's relevant */ | 1298 | /* TYPE field is all that's relevant */ |
| 1299 | #define SIGN_TYPE_SHIFT 16 | 1299 | #define SIGN_TYPE_SHIFT 16 |
| 1300 | #define SIGN_TYPE_MASK (0x0f << SIGN_TYPE_SHIFT) | 1300 | #define SIGN_TYPE_MASK (0x0f << SIGN_TYPE_SHIFT) |
| 1301 | 1301 | ||
| 1302 | #define SIGN_TYPE_FINAL (0x00 << SIGN_TYPE_SHIFT) | 1302 | #define SIGN_TYPE_FINAL (0x00 << SIGN_TYPE_SHIFT) |
| 1303 | #define SIGN_TYPE_FINAL_RESTORE (0x01 << SIGN_TYPE_SHIFT) | 1303 | #define SIGN_TYPE_FINAL_RESTORE (0x01 << SIGN_TYPE_SHIFT) |
| 1304 | #define SIGN_TYPE_FINAL_NONZERO (0x02 << SIGN_TYPE_SHIFT) | 1304 | #define SIGN_TYPE_FINAL_NONZERO (0x02 << SIGN_TYPE_SHIFT) |
| 1305 | #define SIGN_TYPE_IMM_2 (0x0a << SIGN_TYPE_SHIFT) | 1305 | #define SIGN_TYPE_IMM_2 (0x0a << SIGN_TYPE_SHIFT) |
| 1306 | #define SIGN_TYPE_IMM_3 (0x0b << SIGN_TYPE_SHIFT) | 1306 | #define SIGN_TYPE_IMM_3 (0x0b << SIGN_TYPE_SHIFT) |
| 1307 | #define SIGN_TYPE_IMM_4 (0x0c << SIGN_TYPE_SHIFT) | 1307 | #define SIGN_TYPE_IMM_4 (0x0c << SIGN_TYPE_SHIFT) |
| 1308 | 1308 | ||
| 1309 | /* | 1309 | /* |
| 1310 | * MOVE Command Constructs | 1310 | * MOVE Command Constructs |
| 1311 | */ | 1311 | */ |
| 1312 | 1312 | ||
| 1313 | #define MOVE_AUX_SHIFT 25 | 1313 | #define MOVE_AUX_SHIFT 25 |
| 1314 | #define MOVE_AUX_MASK (3 << MOVE_AUX_SHIFT) | 1314 | #define MOVE_AUX_MASK (3 << MOVE_AUX_SHIFT) |
| 1315 | #define MOVE_AUX_MS (2 << MOVE_AUX_SHIFT) | 1315 | #define MOVE_AUX_MS (2 << MOVE_AUX_SHIFT) |
| 1316 | #define MOVE_AUX_LS (1 << MOVE_AUX_SHIFT) | 1316 | #define MOVE_AUX_LS (1 << MOVE_AUX_SHIFT) |
| 1317 | 1317 | ||
| 1318 | #define MOVE_WAITCOMP_SHIFT 24 | 1318 | #define MOVE_WAITCOMP_SHIFT 24 |
| 1319 | #define MOVE_WAITCOMP_MASK (1 << MOVE_WAITCOMP_SHIFT) | 1319 | #define MOVE_WAITCOMP_MASK (1 << MOVE_WAITCOMP_SHIFT) |
| 1320 | #define MOVE_WAITCOMP (1 << MOVE_WAITCOMP_SHIFT) | 1320 | #define MOVE_WAITCOMP (1 << MOVE_WAITCOMP_SHIFT) |
| 1321 | 1321 | ||
| 1322 | #define MOVE_SRC_SHIFT 20 | 1322 | #define MOVE_SRC_SHIFT 20 |
| 1323 | #define MOVE_SRC_MASK (0x0f << MOVE_SRC_SHIFT) | 1323 | #define MOVE_SRC_MASK (0x0f << MOVE_SRC_SHIFT) |
| 1324 | #define MOVE_SRC_CLASS1CTX (0x00 << MOVE_SRC_SHIFT) | 1324 | #define MOVE_SRC_CLASS1CTX (0x00 << MOVE_SRC_SHIFT) |
| 1325 | #define MOVE_SRC_CLASS2CTX (0x01 << MOVE_SRC_SHIFT) | 1325 | #define MOVE_SRC_CLASS2CTX (0x01 << MOVE_SRC_SHIFT) |
| 1326 | #define MOVE_SRC_OUTFIFO (0x02 << MOVE_SRC_SHIFT) | 1326 | #define MOVE_SRC_OUTFIFO (0x02 << MOVE_SRC_SHIFT) |
| 1327 | #define MOVE_SRC_DESCBUF (0x03 << MOVE_SRC_SHIFT) | 1327 | #define MOVE_SRC_DESCBUF (0x03 << MOVE_SRC_SHIFT) |
| 1328 | #define MOVE_SRC_MATH0 (0x04 << MOVE_SRC_SHIFT) | 1328 | #define MOVE_SRC_MATH0 (0x04 << MOVE_SRC_SHIFT) |
| 1329 | #define MOVE_SRC_MATH1 (0x05 << MOVE_SRC_SHIFT) | 1329 | #define MOVE_SRC_MATH1 (0x05 << MOVE_SRC_SHIFT) |
| 1330 | #define MOVE_SRC_MATH2 (0x06 << MOVE_SRC_SHIFT) | 1330 | #define MOVE_SRC_MATH2 (0x06 << MOVE_SRC_SHIFT) |
| 1331 | #define MOVE_SRC_MATH3 (0x07 << MOVE_SRC_SHIFT) | 1331 | #define MOVE_SRC_MATH3 (0x07 << MOVE_SRC_SHIFT) |
| 1332 | #define MOVE_SRC_INFIFO (0x08 << MOVE_SRC_SHIFT) | 1332 | #define MOVE_SRC_INFIFO (0x08 << MOVE_SRC_SHIFT) |
| 1333 | #define MOVE_SRC_INFIFO_CL (0x09 << MOVE_SRC_SHIFT) | 1333 | #define MOVE_SRC_INFIFO_CL (0x09 << MOVE_SRC_SHIFT) |
| 1334 | 1334 | ||
| 1335 | #define MOVE_DEST_SHIFT 16 | 1335 | #define MOVE_DEST_SHIFT 16 |
| 1336 | #define MOVE_DEST_MASK (0x0f << MOVE_DEST_SHIFT) | 1336 | #define MOVE_DEST_MASK (0x0f << MOVE_DEST_SHIFT) |
| 1337 | #define MOVE_DEST_CLASS1CTX (0x00 << MOVE_DEST_SHIFT) | 1337 | #define MOVE_DEST_CLASS1CTX (0x00 << MOVE_DEST_SHIFT) |
| 1338 | #define MOVE_DEST_CLASS2CTX (0x01 << MOVE_DEST_SHIFT) | 1338 | #define MOVE_DEST_CLASS2CTX (0x01 << MOVE_DEST_SHIFT) |
| 1339 | #define MOVE_DEST_OUTFIFO (0x02 << MOVE_DEST_SHIFT) | 1339 | #define MOVE_DEST_OUTFIFO (0x02 << MOVE_DEST_SHIFT) |
| 1340 | #define MOVE_DEST_DESCBUF (0x03 << MOVE_DEST_SHIFT) | 1340 | #define MOVE_DEST_DESCBUF (0x03 << MOVE_DEST_SHIFT) |
| 1341 | #define MOVE_DEST_MATH0 (0x04 << MOVE_DEST_SHIFT) | 1341 | #define MOVE_DEST_MATH0 (0x04 << MOVE_DEST_SHIFT) |
| 1342 | #define MOVE_DEST_MATH1 (0x05 << MOVE_DEST_SHIFT) | 1342 | #define MOVE_DEST_MATH1 (0x05 << MOVE_DEST_SHIFT) |
| 1343 | #define MOVE_DEST_MATH2 (0x06 << MOVE_DEST_SHIFT) | 1343 | #define MOVE_DEST_MATH2 (0x06 << MOVE_DEST_SHIFT) |
| 1344 | #define MOVE_DEST_MATH3 (0x07 << MOVE_DEST_SHIFT) | 1344 | #define MOVE_DEST_MATH3 (0x07 << MOVE_DEST_SHIFT) |
| 1345 | #define MOVE_DEST_CLASS1INFIFO (0x08 << MOVE_DEST_SHIFT) | 1345 | #define MOVE_DEST_CLASS1INFIFO (0x08 << MOVE_DEST_SHIFT) |
| 1346 | #define MOVE_DEST_CLASS2INFIFO (0x09 << MOVE_DEST_SHIFT) | 1346 | #define MOVE_DEST_CLASS2INFIFO (0x09 << MOVE_DEST_SHIFT) |
| 1347 | #define MOVE_DEST_PK_A (0x0c << MOVE_DEST_SHIFT) | 1347 | #define MOVE_DEST_PK_A (0x0c << MOVE_DEST_SHIFT) |
| 1348 | #define MOVE_DEST_CLASS1KEY (0x0d << MOVE_DEST_SHIFT) | 1348 | #define MOVE_DEST_CLASS1KEY (0x0d << MOVE_DEST_SHIFT) |
| 1349 | #define MOVE_DEST_CLASS2KEY (0x0e << MOVE_DEST_SHIFT) | 1349 | #define MOVE_DEST_CLASS2KEY (0x0e << MOVE_DEST_SHIFT) |
| 1350 | 1350 | ||
| 1351 | #define MOVE_OFFSET_SHIFT 8 | 1351 | #define MOVE_OFFSET_SHIFT 8 |
| 1352 | #define MOVE_OFFSET_MASK (0xff << MOVE_OFFSET_SHIFT) | 1352 | #define MOVE_OFFSET_MASK (0xff << MOVE_OFFSET_SHIFT) |
| 1353 | 1353 | ||
| 1354 | #define MOVE_LEN_SHIFT 0 | 1354 | #define MOVE_LEN_SHIFT 0 |
| 1355 | #define MOVE_LEN_MASK (0xff << MOVE_LEN_SHIFT) | 1355 | #define MOVE_LEN_MASK (0xff << MOVE_LEN_SHIFT) |
| 1356 | 1356 | ||
| 1357 | #define MOVELEN_MRSEL_SHIFT 0 | 1357 | #define MOVELEN_MRSEL_SHIFT 0 |
| 1358 | #define MOVELEN_MRSEL_MASK (0x3 << MOVE_LEN_SHIFT) | 1358 | #define MOVELEN_MRSEL_MASK (0x3 << MOVE_LEN_SHIFT) |
| 1359 | 1359 | ||
| 1360 | /* | 1360 | /* |
| 1361 | * MATH Command Constructs | 1361 | * MATH Command Constructs |
| 1362 | */ | 1362 | */ |
| 1363 | 1363 | ||
| 1364 | #define MATH_IFB_SHIFT 26 | 1364 | #define MATH_IFB_SHIFT 26 |
| 1365 | #define MATH_IFB_MASK (1 << MATH_IFB_SHIFT) | 1365 | #define MATH_IFB_MASK (1 << MATH_IFB_SHIFT) |
| 1366 | #define MATH_IFB (1 << MATH_IFB_SHIFT) | 1366 | #define MATH_IFB (1 << MATH_IFB_SHIFT) |
| 1367 | 1367 | ||
| 1368 | #define MATH_NFU_SHIFT 25 | 1368 | #define MATH_NFU_SHIFT 25 |
| 1369 | #define MATH_NFU_MASK (1 << MATH_NFU_SHIFT) | 1369 | #define MATH_NFU_MASK (1 << MATH_NFU_SHIFT) |
| 1370 | #define MATH_NFU (1 << MATH_NFU_SHIFT) | 1370 | #define MATH_NFU (1 << MATH_NFU_SHIFT) |
| 1371 | 1371 | ||
| 1372 | #define MATH_STL_SHIFT 24 | 1372 | #define MATH_STL_SHIFT 24 |
| 1373 | #define MATH_STL_MASK (1 << MATH_STL_SHIFT) | 1373 | #define MATH_STL_MASK (1 << MATH_STL_SHIFT) |
| 1374 | #define MATH_STL (1 << MATH_STL_SHIFT) | 1374 | #define MATH_STL (1 << MATH_STL_SHIFT) |
| 1375 | 1375 | ||
| 1376 | /* Function selectors */ | 1376 | /* Function selectors */ |
| 1377 | #define MATH_FUN_SHIFT 20 | 1377 | #define MATH_FUN_SHIFT 20 |
| 1378 | #define MATH_FUN_MASK (0x0f << MATH_FUN_SHIFT) | 1378 | #define MATH_FUN_MASK (0x0f << MATH_FUN_SHIFT) |
| 1379 | #define MATH_FUN_ADD (0x00 << MATH_FUN_SHIFT) | 1379 | #define MATH_FUN_ADD (0x00 << MATH_FUN_SHIFT) |
| 1380 | #define MATH_FUN_ADDC (0x01 << MATH_FUN_SHIFT) | 1380 | #define MATH_FUN_ADDC (0x01 << MATH_FUN_SHIFT) |
| 1381 | #define MATH_FUN_SUB (0x02 << MATH_FUN_SHIFT) | 1381 | #define MATH_FUN_SUB (0x02 << MATH_FUN_SHIFT) |
| 1382 | #define MATH_FUN_SUBB (0x03 << MATH_FUN_SHIFT) | 1382 | #define MATH_FUN_SUBB (0x03 << MATH_FUN_SHIFT) |
| 1383 | #define MATH_FUN_OR (0x04 << MATH_FUN_SHIFT) | 1383 | #define MATH_FUN_OR (0x04 << MATH_FUN_SHIFT) |
| 1384 | #define MATH_FUN_AND (0x05 << MATH_FUN_SHIFT) | 1384 | #define MATH_FUN_AND (0x05 << MATH_FUN_SHIFT) |
| 1385 | #define MATH_FUN_XOR (0x06 << MATH_FUN_SHIFT) | 1385 | #define MATH_FUN_XOR (0x06 << MATH_FUN_SHIFT) |
| 1386 | #define MATH_FUN_LSHIFT (0x07 << MATH_FUN_SHIFT) | 1386 | #define MATH_FUN_LSHIFT (0x07 << MATH_FUN_SHIFT) |
| 1387 | #define MATH_FUN_RSHIFT (0x08 << MATH_FUN_SHIFT) | 1387 | #define MATH_FUN_RSHIFT (0x08 << MATH_FUN_SHIFT) |
| 1388 | #define MATH_FUN_SHLD (0x09 << MATH_FUN_SHIFT) | 1388 | #define MATH_FUN_SHLD (0x09 << MATH_FUN_SHIFT) |
| 1389 | #define MATH_FUN_ZBYT (0x0a << MATH_FUN_SHIFT) | 1389 | #define MATH_FUN_ZBYT (0x0a << MATH_FUN_SHIFT) |
| 1390 | 1390 | ||
| 1391 | /* Source 0 selectors */ | 1391 | /* Source 0 selectors */ |
| 1392 | #define MATH_SRC0_SHIFT 16 | 1392 | #define MATH_SRC0_SHIFT 16 |
| 1393 | #define MATH_SRC0_MASK (0x0f << MATH_SRC0_SHIFT) | 1393 | #define MATH_SRC0_MASK (0x0f << MATH_SRC0_SHIFT) |
| 1394 | #define MATH_SRC0_REG0 (0x00 << MATH_SRC0_SHIFT) | 1394 | #define MATH_SRC0_REG0 (0x00 << MATH_SRC0_SHIFT) |
| 1395 | #define MATH_SRC0_REG1 (0x01 << MATH_SRC0_SHIFT) | 1395 | #define MATH_SRC0_REG1 (0x01 << MATH_SRC0_SHIFT) |
| 1396 | #define MATH_SRC0_REG2 (0x02 << MATH_SRC0_SHIFT) | 1396 | #define MATH_SRC0_REG2 (0x02 << MATH_SRC0_SHIFT) |
| 1397 | #define MATH_SRC0_REG3 (0x03 << MATH_SRC0_SHIFT) | 1397 | #define MATH_SRC0_REG3 (0x03 << MATH_SRC0_SHIFT) |
| 1398 | #define MATH_SRC0_IMM (0x04 << MATH_SRC0_SHIFT) | 1398 | #define MATH_SRC0_IMM (0x04 << MATH_SRC0_SHIFT) |
| 1399 | #define MATH_SRC0_SEQINLEN (0x08 << MATH_SRC0_SHIFT) | 1399 | #define MATH_SRC0_SEQINLEN (0x08 << MATH_SRC0_SHIFT) |
| 1400 | #define MATH_SRC0_SEQOUTLEN (0x09 << MATH_SRC0_SHIFT) | 1400 | #define MATH_SRC0_SEQOUTLEN (0x09 << MATH_SRC0_SHIFT) |
| 1401 | #define MATH_SRC0_VARSEQINLEN (0x0a << MATH_SRC0_SHIFT) | 1401 | #define MATH_SRC0_VARSEQINLEN (0x0a << MATH_SRC0_SHIFT) |
| 1402 | #define MATH_SRC0_VARSEQOUTLEN (0x0b << MATH_SRC0_SHIFT) | 1402 | #define MATH_SRC0_VARSEQOUTLEN (0x0b << MATH_SRC0_SHIFT) |
| 1403 | #define MATH_SRC0_ZERO (0x0c << MATH_SRC0_SHIFT) | 1403 | #define MATH_SRC0_ZERO (0x0c << MATH_SRC0_SHIFT) |
| 1404 | 1404 | ||
| 1405 | /* Source 1 selectors */ | 1405 | /* Source 1 selectors */ |
| 1406 | #define MATH_SRC1_SHIFT 12 | 1406 | #define MATH_SRC1_SHIFT 12 |
| 1407 | #define MATH_SRC1_MASK (0x0f << MATH_SRC1_SHIFT) | 1407 | #define MATH_SRC1_MASK (0x0f << MATH_SRC1_SHIFT) |
| 1408 | #define MATH_SRC1_REG0 (0x00 << MATH_SRC1_SHIFT) | 1408 | #define MATH_SRC1_REG0 (0x00 << MATH_SRC1_SHIFT) |
| 1409 | #define MATH_SRC1_REG1 (0x01 << MATH_SRC1_SHIFT) | 1409 | #define MATH_SRC1_REG1 (0x01 << MATH_SRC1_SHIFT) |
| 1410 | #define MATH_SRC1_REG2 (0x02 << MATH_SRC1_SHIFT) | 1410 | #define MATH_SRC1_REG2 (0x02 << MATH_SRC1_SHIFT) |
| 1411 | #define MATH_SRC1_REG3 (0x03 << MATH_SRC1_SHIFT) | 1411 | #define MATH_SRC1_REG3 (0x03 << MATH_SRC1_SHIFT) |
| 1412 | #define MATH_SRC1_IMM (0x04 << MATH_SRC1_SHIFT) | 1412 | #define MATH_SRC1_IMM (0x04 << MATH_SRC1_SHIFT) |
| 1413 | #define MATH_SRC1_INFIFO (0x0a << MATH_SRC1_SHIFT) | 1413 | #define MATH_SRC1_INFIFO (0x0a << MATH_SRC1_SHIFT) |
| 1414 | #define MATH_SRC1_OUTFIFO (0x0b << MATH_SRC1_SHIFT) | 1414 | #define MATH_SRC1_OUTFIFO (0x0b << MATH_SRC1_SHIFT) |
| 1415 | #define MATH_SRC1_ONE (0x0c << MATH_SRC1_SHIFT) | 1415 | #define MATH_SRC1_ONE (0x0c << MATH_SRC1_SHIFT) |
| 1416 | 1416 | ||
| 1417 | /* Destination selectors */ | 1417 | /* Destination selectors */ |
| 1418 | #define MATH_DEST_SHIFT 8 | 1418 | #define MATH_DEST_SHIFT 8 |
| 1419 | #define MATH_DEST_MASK (0x0f << MATH_DEST_SHIFT) | 1419 | #define MATH_DEST_MASK (0x0f << MATH_DEST_SHIFT) |
| 1420 | #define MATH_DEST_REG0 (0x00 << MATH_DEST_SHIFT) | 1420 | #define MATH_DEST_REG0 (0x00 << MATH_DEST_SHIFT) |
| 1421 | #define MATH_DEST_REG1 (0x01 << MATH_DEST_SHIFT) | 1421 | #define MATH_DEST_REG1 (0x01 << MATH_DEST_SHIFT) |
| 1422 | #define MATH_DEST_REG2 (0x02 << MATH_DEST_SHIFT) | 1422 | #define MATH_DEST_REG2 (0x02 << MATH_DEST_SHIFT) |
| 1423 | #define MATH_DEST_REG3 (0x03 << MATH_DEST_SHIFT) | 1423 | #define MATH_DEST_REG3 (0x03 << MATH_DEST_SHIFT) |
| 1424 | #define MATH_DEST_SEQINLEN (0x08 << MATH_DEST_SHIFT) | 1424 | #define MATH_DEST_SEQINLEN (0x08 << MATH_DEST_SHIFT) |
| 1425 | #define MATH_DEST_SEQOUTLEN (0x09 << MATH_DEST_SHIFT) | 1425 | #define MATH_DEST_SEQOUTLEN (0x09 << MATH_DEST_SHIFT) |
| 1426 | #define MATH_DEST_VARSEQINLEN (0x0a << MATH_DEST_SHIFT) | 1426 | #define MATH_DEST_VARSEQINLEN (0x0a << MATH_DEST_SHIFT) |
| 1427 | #define MATH_DEST_VARSEQOUTLEN (0x0b << MATH_DEST_SHIFT) | 1427 | #define MATH_DEST_VARSEQOUTLEN (0x0b << MATH_DEST_SHIFT) |
| 1428 | #define MATH_DEST_NONE (0x0f << MATH_DEST_SHIFT) | 1428 | #define MATH_DEST_NONE (0x0f << MATH_DEST_SHIFT) |
| 1429 | 1429 | ||
| 1430 | /* Length selectors */ | 1430 | /* Length selectors */ |
| 1431 | #define MATH_LEN_SHIFT 0 | 1431 | #define MATH_LEN_SHIFT 0 |
| 1432 | #define MATH_LEN_MASK (0x0f << MATH_LEN_SHIFT) | 1432 | #define MATH_LEN_MASK (0x0f << MATH_LEN_SHIFT) |
| 1433 | #define MATH_LEN_1BYTE 0x01 | 1433 | #define MATH_LEN_1BYTE 0x01 |
| 1434 | #define MATH_LEN_2BYTE 0x02 | 1434 | #define MATH_LEN_2BYTE 0x02 |
| 1435 | #define MATH_LEN_4BYTE 0x04 | 1435 | #define MATH_LEN_4BYTE 0x04 |
| 1436 | #define MATH_LEN_8BYTE 0x08 | 1436 | #define MATH_LEN_8BYTE 0x08 |
| 1437 | 1437 | ||
| 1438 | /* | 1438 | /* |
| 1439 | * JUMP Command Constructs | 1439 | * JUMP Command Constructs |
| 1440 | */ | 1440 | */ |
| 1441 | 1441 | ||
| 1442 | #define JUMP_CLASS_SHIFT 25 | 1442 | #define JUMP_CLASS_SHIFT 25 |
| 1443 | #define JUMP_CLASS_MASK (3 << JUMP_CLASS_SHIFT) | 1443 | #define JUMP_CLASS_MASK (3 << JUMP_CLASS_SHIFT) |
| 1444 | #define JUMP_CLASS_NONE 0 | 1444 | #define JUMP_CLASS_NONE 0 |
| 1445 | #define JUMP_CLASS_CLASS1 (1 << JUMP_CLASS_SHIFT) | 1445 | #define JUMP_CLASS_CLASS1 (1 << JUMP_CLASS_SHIFT) |
| 1446 | #define JUMP_CLASS_CLASS2 (2 << JUMP_CLASS_SHIFT) | 1446 | #define JUMP_CLASS_CLASS2 (2 << JUMP_CLASS_SHIFT) |
| 1447 | #define JUMP_CLASS_BOTH (3 << JUMP_CLASS_SHIFT) | 1447 | #define JUMP_CLASS_BOTH (3 << JUMP_CLASS_SHIFT) |
| 1448 | 1448 | ||
| 1449 | #define JUMP_JSL_SHIFT 24 | 1449 | #define JUMP_JSL_SHIFT 24 |
| 1450 | #define JUMP_JSL_MASK (1 << JUMP_JSL_SHIFT) | 1450 | #define JUMP_JSL_MASK (1 << JUMP_JSL_SHIFT) |
| 1451 | #define JUMP_JSL (1 << JUMP_JSL_SHIFT) | 1451 | #define JUMP_JSL (1 << JUMP_JSL_SHIFT) |
| 1452 | 1452 | ||
| 1453 | #define JUMP_TYPE_SHIFT 22 | 1453 | #define JUMP_TYPE_SHIFT 22 |
| 1454 | #define JUMP_TYPE_MASK (0x03 << JUMP_TYPE_SHIFT) | 1454 | #define JUMP_TYPE_MASK (0x03 << JUMP_TYPE_SHIFT) |
| 1455 | #define JUMP_TYPE_LOCAL (0x00 << JUMP_TYPE_SHIFT) | 1455 | #define JUMP_TYPE_LOCAL (0x00 << JUMP_TYPE_SHIFT) |
| 1456 | #define JUMP_TYPE_NONLOCAL (0x01 << JUMP_TYPE_SHIFT) | 1456 | #define JUMP_TYPE_NONLOCAL (0x01 << JUMP_TYPE_SHIFT) |
| 1457 | #define JUMP_TYPE_HALT (0x02 << JUMP_TYPE_SHIFT) | 1457 | #define JUMP_TYPE_HALT (0x02 << JUMP_TYPE_SHIFT) |
| 1458 | #define JUMP_TYPE_HALT_USER (0x03 << JUMP_TYPE_SHIFT) | 1458 | #define JUMP_TYPE_HALT_USER (0x03 << JUMP_TYPE_SHIFT) |
| 1459 | 1459 | ||
| 1460 | #define JUMP_TEST_SHIFT 16 | 1460 | #define JUMP_TEST_SHIFT 16 |
| 1461 | #define JUMP_TEST_MASK (0x03 << JUMP_TEST_SHIFT) | 1461 | #define JUMP_TEST_MASK (0x03 << JUMP_TEST_SHIFT) |
| 1462 | #define JUMP_TEST_ALL (0x00 << JUMP_TEST_SHIFT) | 1462 | #define JUMP_TEST_ALL (0x00 << JUMP_TEST_SHIFT) |
| 1463 | #define JUMP_TEST_INVALL (0x01 << JUMP_TEST_SHIFT) | 1463 | #define JUMP_TEST_INVALL (0x01 << JUMP_TEST_SHIFT) |
| 1464 | #define JUMP_TEST_ANY (0x02 << JUMP_TEST_SHIFT) | 1464 | #define JUMP_TEST_ANY (0x02 << JUMP_TEST_SHIFT) |
| 1465 | #define JUMP_TEST_INVANY (0x03 << JUMP_TEST_SHIFT) | 1465 | #define JUMP_TEST_INVANY (0x03 << JUMP_TEST_SHIFT) |
| 1466 | 1466 | ||
| 1467 | /* Condition codes. JSL bit is factored in */ | 1467 | /* Condition codes. JSL bit is factored in */ |
| 1468 | #define JUMP_COND_SHIFT 8 | 1468 | #define JUMP_COND_SHIFT 8 |
| 1469 | #define JUMP_COND_MASK (0x100ff << JUMP_COND_SHIFT) | 1469 | #define JUMP_COND_MASK (0x100ff << JUMP_COND_SHIFT) |
| 1470 | #define JUMP_COND_PK_0 (0x80 << JUMP_COND_SHIFT) | 1470 | #define JUMP_COND_PK_0 (0x80 << JUMP_COND_SHIFT) |
| 1471 | #define JUMP_COND_PK_GCD_1 (0x40 << JUMP_COND_SHIFT) | 1471 | #define JUMP_COND_PK_GCD_1 (0x40 << JUMP_COND_SHIFT) |
| 1472 | #define JUMP_COND_PK_PRIME (0x20 << JUMP_COND_SHIFT) | 1472 | #define JUMP_COND_PK_PRIME (0x20 << JUMP_COND_SHIFT) |
| 1473 | #define JUMP_COND_MATH_N (0x08 << JUMP_COND_SHIFT) | 1473 | #define JUMP_COND_MATH_N (0x08 << JUMP_COND_SHIFT) |
| 1474 | #define JUMP_COND_MATH_Z (0x04 << JUMP_COND_SHIFT) | 1474 | #define JUMP_COND_MATH_Z (0x04 << JUMP_COND_SHIFT) |
| 1475 | #define JUMP_COND_MATH_C (0x02 << JUMP_COND_SHIFT) | 1475 | #define JUMP_COND_MATH_C (0x02 << JUMP_COND_SHIFT) |
| 1476 | #define JUMP_COND_MATH_NV (0x01 << JUMP_COND_SHIFT) | 1476 | #define JUMP_COND_MATH_NV (0x01 << JUMP_COND_SHIFT) |
| 1477 | 1477 | ||
| 1478 | #define JUMP_COND_JRP ((0x80 << JUMP_COND_SHIFT) | JUMP_JSL) | 1478 | #define JUMP_COND_JRP ((0x80 << JUMP_COND_SHIFT) | JUMP_JSL) |
| 1479 | #define JUMP_COND_SHRD ((0x40 << JUMP_COND_SHIFT) | JUMP_JSL) | 1479 | #define JUMP_COND_SHRD ((0x40 << JUMP_COND_SHIFT) | JUMP_JSL) |
| 1480 | #define JUMP_COND_SELF ((0x20 << JUMP_COND_SHIFT) | JUMP_JSL) | 1480 | #define JUMP_COND_SELF ((0x20 << JUMP_COND_SHIFT) | JUMP_JSL) |
| 1481 | #define JUMP_COND_CALM ((0x10 << JUMP_COND_SHIFT) | JUMP_JSL) | 1481 | #define JUMP_COND_CALM ((0x10 << JUMP_COND_SHIFT) | JUMP_JSL) |
| 1482 | #define JUMP_COND_NIP ((0x08 << JUMP_COND_SHIFT) | JUMP_JSL) | 1482 | #define JUMP_COND_NIP ((0x08 << JUMP_COND_SHIFT) | JUMP_JSL) |
| 1483 | #define JUMP_COND_NIFP ((0x04 << JUMP_COND_SHIFT) | JUMP_JSL) | 1483 | #define JUMP_COND_NIFP ((0x04 << JUMP_COND_SHIFT) | JUMP_JSL) |
| 1484 | #define JUMP_COND_NOP ((0x02 << JUMP_COND_SHIFT) | JUMP_JSL) | 1484 | #define JUMP_COND_NOP ((0x02 << JUMP_COND_SHIFT) | JUMP_JSL) |
| 1485 | #define JUMP_COND_NCP ((0x01 << JUMP_COND_SHIFT) | JUMP_JSL) | 1485 | #define JUMP_COND_NCP ((0x01 << JUMP_COND_SHIFT) | JUMP_JSL) |
| 1486 | 1486 | ||
| 1487 | #define JUMP_OFFSET_SHIFT 0 | 1487 | #define JUMP_OFFSET_SHIFT 0 |
| 1488 | #define JUMP_OFFSET_MASK (0xff << JUMP_OFFSET_SHIFT) | 1488 | #define JUMP_OFFSET_MASK (0xff << JUMP_OFFSET_SHIFT) |
| 1489 | 1489 | ||
| 1490 | /* | 1490 | /* |
| 1491 | * NFIFO ENTRY | 1491 | * NFIFO ENTRY |
| @@ -1500,20 +1500,20 @@ | |||
| 1500 | #define NFIFOENTRY_DEST_BOTH (3 << NFIFOENTRY_DEST_SHIFT) | 1500 | #define NFIFOENTRY_DEST_BOTH (3 << NFIFOENTRY_DEST_SHIFT) |
| 1501 | 1501 | ||
| 1502 | #define NFIFOENTRY_LC2_SHIFT 29 | 1502 | #define NFIFOENTRY_LC2_SHIFT 29 |
| 1503 | #define NFIFOENTRY_LC2_MASK (1 << NFIFOENTRY_LC2_SHIFT) | 1503 | #define NFIFOENTRY_LC2_MASK (1 << NFIFOENTRY_LC2_SHIFT) |
| 1504 | #define NFIFOENTRY_LC2 (1 << NFIFOENTRY_LC2_SHIFT) | 1504 | #define NFIFOENTRY_LC2 (1 << NFIFOENTRY_LC2_SHIFT) |
| 1505 | 1505 | ||
| 1506 | #define NFIFOENTRY_LC1_SHIFT 28 | 1506 | #define NFIFOENTRY_LC1_SHIFT 28 |
| 1507 | #define NFIFOENTRY_LC1_MASK (1 << NFIFOENTRY_LC1_SHIFT) | 1507 | #define NFIFOENTRY_LC1_MASK (1 << NFIFOENTRY_LC1_SHIFT) |
| 1508 | #define NFIFOENTRY_LC1 (1 << NFIFOENTRY_LC1_SHIFT) | 1508 | #define NFIFOENTRY_LC1 (1 << NFIFOENTRY_LC1_SHIFT) |
| 1509 | 1509 | ||
| 1510 | #define NFIFOENTRY_FC2_SHIFT 27 | 1510 | #define NFIFOENTRY_FC2_SHIFT 27 |
| 1511 | #define NFIFOENTRY_FC2_MASK (1 << NFIFOENTRY_FC2_SHIFT) | 1511 | #define NFIFOENTRY_FC2_MASK (1 << NFIFOENTRY_FC2_SHIFT) |
| 1512 | #define NFIFOENTRY_FC2 (1 << NFIFOENTRY_FC2_SHIFT) | 1512 | #define NFIFOENTRY_FC2 (1 << NFIFOENTRY_FC2_SHIFT) |
| 1513 | 1513 | ||
| 1514 | #define NFIFOENTRY_FC1_SHIFT 26 | 1514 | #define NFIFOENTRY_FC1_SHIFT 26 |
| 1515 | #define NFIFOENTRY_FC1_MASK (1 << NFIFOENTRY_FC1_SHIFT) | 1515 | #define NFIFOENTRY_FC1_MASK (1 << NFIFOENTRY_FC1_SHIFT) |
| 1516 | #define NFIFOENTRY_FC1 (1 << NFIFOENTRY_FC1_SHIFT) | 1516 | #define NFIFOENTRY_FC1 (1 << NFIFOENTRY_FC1_SHIFT) |
| 1517 | 1517 | ||
| 1518 | #define NFIFOENTRY_STYPE_SHIFT 24 | 1518 | #define NFIFOENTRY_STYPE_SHIFT 24 |
| 1519 | #define NFIFOENTRY_STYPE_MASK (3 << NFIFOENTRY_STYPE_SHIFT) | 1519 | #define NFIFOENTRY_STYPE_MASK (3 << NFIFOENTRY_STYPE_SHIFT) |
| @@ -1525,60 +1525,59 @@ | |||
| 1525 | #define NFIFOENTRY_DTYPE_SHIFT 20 | 1525 | #define NFIFOENTRY_DTYPE_SHIFT 20 |
| 1526 | #define NFIFOENTRY_DTYPE_MASK (0xF << NFIFOENTRY_DTYPE_SHIFT) | 1526 | #define NFIFOENTRY_DTYPE_MASK (0xF << NFIFOENTRY_DTYPE_SHIFT) |
| 1527 | 1527 | ||
| 1528 | #define NFIFOENTRY_DTYPE_SBOX (0x0 << NFIFOENTRY_DTYPE_SHIFT) | 1528 | #define NFIFOENTRY_DTYPE_SBOX (0x0 << NFIFOENTRY_DTYPE_SHIFT) |
| 1529 | #define NFIFOENTRY_DTYPE_AAD (0x1 << NFIFOENTRY_DTYPE_SHIFT) | 1529 | #define NFIFOENTRY_DTYPE_AAD (0x1 << NFIFOENTRY_DTYPE_SHIFT) |
| 1530 | #define NFIFOENTRY_DTYPE_IV (0x2 << NFIFOENTRY_DTYPE_SHIFT) | 1530 | #define NFIFOENTRY_DTYPE_IV (0x2 << NFIFOENTRY_DTYPE_SHIFT) |
| 1531 | #define NFIFOENTRY_DTYPE_SAD (0x3 << NFIFOENTRY_DTYPE_SHIFT) | 1531 | #define NFIFOENTRY_DTYPE_SAD (0x3 << NFIFOENTRY_DTYPE_SHIFT) |
| 1532 | #define NFIFOENTRY_DTYPE_ICV (0xA << NFIFOENTRY_DTYPE_SHIFT) | 1532 | #define NFIFOENTRY_DTYPE_ICV (0xA << NFIFOENTRY_DTYPE_SHIFT) |
| 1533 | #define NFIFOENTRY_DTYPE_SKIP (0xE << NFIFOENTRY_DTYPE_SHIFT) | 1533 | #define NFIFOENTRY_DTYPE_SKIP (0xE << NFIFOENTRY_DTYPE_SHIFT) |
| 1534 | #define NFIFOENTRY_DTYPE_MSG (0xF << NFIFOENTRY_DTYPE_SHIFT) | 1534 | #define NFIFOENTRY_DTYPE_MSG (0xF << NFIFOENTRY_DTYPE_SHIFT) |
| 1535 | 1535 | ||
| 1536 | #define NFIFOENTRY_DTYPE_PK_A0 (0x0 << NFIFOENTRY_DTYPE_SHIFT) | 1536 | #define NFIFOENTRY_DTYPE_PK_A0 (0x0 << NFIFOENTRY_DTYPE_SHIFT) |
| 1537 | #define NFIFOENTRY_DTYPE_PK_A1 (0x1 << NFIFOENTRY_DTYPE_SHIFT) | 1537 | #define NFIFOENTRY_DTYPE_PK_A1 (0x1 << NFIFOENTRY_DTYPE_SHIFT) |
| 1538 | #define NFIFOENTRY_DTYPE_PK_A2 (0x2 << NFIFOENTRY_DTYPE_SHIFT) | 1538 | #define NFIFOENTRY_DTYPE_PK_A2 (0x2 << NFIFOENTRY_DTYPE_SHIFT) |
| 1539 | #define NFIFOENTRY_DTYPE_PK_A3 (0x3 << NFIFOENTRY_DTYPE_SHIFT) | 1539 | #define NFIFOENTRY_DTYPE_PK_A3 (0x3 << NFIFOENTRY_DTYPE_SHIFT) |
| 1540 | #define NFIFOENTRY_DTYPE_PK_B0 (0x4 << NFIFOENTRY_DTYPE_SHIFT) | 1540 | #define NFIFOENTRY_DTYPE_PK_B0 (0x4 << NFIFOENTRY_DTYPE_SHIFT) |
| 1541 | #define NFIFOENTRY_DTYPE_PK_B1 (0x5 << NFIFOENTRY_DTYPE_SHIFT) | 1541 | #define NFIFOENTRY_DTYPE_PK_B1 (0x5 << NFIFOENTRY_DTYPE_SHIFT) |
| 1542 | #define NFIFOENTRY_DTYPE_PK_B2 (0x6 << NFIFOENTRY_DTYPE_SHIFT) | 1542 | #define NFIFOENTRY_DTYPE_PK_B2 (0x6 << NFIFOENTRY_DTYPE_SHIFT) |
| 1543 | #define NFIFOENTRY_DTYPE_PK_B3 (0x7 << NFIFOENTRY_DTYPE_SHIFT) | 1543 | #define NFIFOENTRY_DTYPE_PK_B3 (0x7 << NFIFOENTRY_DTYPE_SHIFT) |
| 1544 | #define NFIFOENTRY_DTYPE_PK_N (0x8 << NFIFOENTRY_DTYPE_SHIFT) | 1544 | #define NFIFOENTRY_DTYPE_PK_N (0x8 << NFIFOENTRY_DTYPE_SHIFT) |
| 1545 | #define NFIFOENTRY_DTYPE_PK_E (0x9 << NFIFOENTRY_DTYPE_SHIFT) | 1545 | #define NFIFOENTRY_DTYPE_PK_E (0x9 << NFIFOENTRY_DTYPE_SHIFT) |
| 1546 | #define NFIFOENTRY_DTYPE_PK_A (0xC << NFIFOENTRY_DTYPE_SHIFT) | 1546 | #define NFIFOENTRY_DTYPE_PK_A (0xC << NFIFOENTRY_DTYPE_SHIFT) |
| 1547 | #define NFIFOENTRY_DTYPE_PK_B (0xD << NFIFOENTRY_DTYPE_SHIFT) | 1547 | #define NFIFOENTRY_DTYPE_PK_B (0xD << NFIFOENTRY_DTYPE_SHIFT) |
| 1548 | 1548 | ||
| 1549 | 1549 | ||
| 1550 | #define NFIFOENTRY_BND_SHIFT 19 | 1550 | #define NFIFOENTRY_BND_SHIFT 19 |
| 1551 | #define NFIFOENTRY_BND_MASK (1 << NFIFOENTRY_BND_SHIFT) | 1551 | #define NFIFOENTRY_BND_MASK (1 << NFIFOENTRY_BND_SHIFT) |
| 1552 | #define NFIFOENTRY_BND (1 << NFIFOENTRY_BND_SHIFT) | 1552 | #define NFIFOENTRY_BND (1 << NFIFOENTRY_BND_SHIFT) |
| 1553 | 1553 | ||
| 1554 | #define NFIFOENTRY_PTYPE_SHIFT 16 | 1554 | #define NFIFOENTRY_PTYPE_SHIFT 16 |
| 1555 | #define NFIFOENTRY_PTYPE_MASK (0x7 << NFIFOENTRY_PTYPE_SHIFT) | 1555 | #define NFIFOENTRY_PTYPE_MASK (0x7 << NFIFOENTRY_PTYPE_SHIFT) |
| 1556 | 1556 | ||
| 1557 | #define NFIFOENTRY_PTYPE_ZEROS (0x0 << NFIFOENTRY_PTYPE_SHIFT) | 1557 | #define NFIFOENTRY_PTYPE_ZEROS (0x0 << NFIFOENTRY_PTYPE_SHIFT) |
| 1558 | #define NFIFOENTRY_PTYPE_RND_NOZEROS (0x1 << NFIFOENTRY_PTYPE_SHIFT) | 1558 | #define NFIFOENTRY_PTYPE_RND_NOZEROS (0x1 << NFIFOENTRY_PTYPE_SHIFT) |
| 1559 | #define NFIFOENTRY_PTYPE_INCREMENT (0x2 << NFIFOENTRY_PTYPE_SHIFT) | 1559 | #define NFIFOENTRY_PTYPE_INCREMENT (0x2 << NFIFOENTRY_PTYPE_SHIFT) |
| 1560 | #define NFIFOENTRY_PTYPE_RND (0x3 << NFIFOENTRY_PTYPE_SHIFT) | 1560 | #define NFIFOENTRY_PTYPE_RND (0x3 << NFIFOENTRY_PTYPE_SHIFT) |
| 1561 | #define NFIFOENTRY_PTYPE_ZEROS_NZ (0x4 << NFIFOENTRY_PTYPE_SHIFT) | 1561 | #define NFIFOENTRY_PTYPE_ZEROS_NZ (0x4 << NFIFOENTRY_PTYPE_SHIFT) |
| 1562 | #define NFIFOENTRY_PTYPE_RND_NZ_LZ (0x5 << NFIFOENTRY_PTYPE_SHIFT) | 1562 | #define NFIFOENTRY_PTYPE_RND_NZ_LZ (0x5 << NFIFOENTRY_PTYPE_SHIFT) |
| 1563 | #define NFIFOENTRY_PTYPE_N (0x6 << NFIFOENTRY_PTYPE_SHIFT) | 1563 | #define NFIFOENTRY_PTYPE_N (0x6 << NFIFOENTRY_PTYPE_SHIFT) |
| 1564 | #define NFIFOENTRY_PTYPE_RND_NZ_N (0x7 << NFIFOENTRY_PTYPE_SHIFT) | 1564 | #define NFIFOENTRY_PTYPE_RND_NZ_N (0x7 << NFIFOENTRY_PTYPE_SHIFT) |
| 1565 | 1565 | ||
| 1566 | #define NFIFOENTRY_OC_SHIFT 15 | 1566 | #define NFIFOENTRY_OC_SHIFT 15 |
| 1567 | #define NFIFOENTRY_OC_MASK (1 << NFIFOENTRY_OC_SHIFT) | 1567 | #define NFIFOENTRY_OC_MASK (1 << NFIFOENTRY_OC_SHIFT) |
| 1568 | #define NFIFOENTRY_OC (1 << NFIFOENTRY_OC_SHIFT) | 1568 | #define NFIFOENTRY_OC (1 << NFIFOENTRY_OC_SHIFT) |
| 1569 | 1569 | ||
| 1570 | #define NFIFOENTRY_AST_SHIFT 14 | 1570 | #define NFIFOENTRY_AST_SHIFT 14 |
| 1571 | #define NFIFOENTRY_AST_MASK (1 << NFIFOENTRY_OC_SHIFT) | 1571 | #define NFIFOENTRY_AST_MASK (1 << NFIFOENTRY_OC_SHIFT) |
| 1572 | #define NFIFOENTRY_AST (1 << NFIFOENTRY_OC_SHIFT) | 1572 | #define NFIFOENTRY_AST (1 << NFIFOENTRY_OC_SHIFT) |
| 1573 | 1573 | ||
| 1574 | #define NFIFOENTRY_BM_SHIFT 11 | 1574 | #define NFIFOENTRY_BM_SHIFT 11 |
| 1575 | #define NFIFOENTRY_BM_MASK (1 << NFIFOENTRY_BM_SHIFT) | 1575 | #define NFIFOENTRY_BM_MASK (1 << NFIFOENTRY_BM_SHIFT) |
| 1576 | #define NFIFOENTRY_BM (1 << NFIFOENTRY_BM_SHIFT) | 1576 | #define NFIFOENTRY_BM (1 << NFIFOENTRY_BM_SHIFT) |
| 1577 | |||
| 1578 | #define NFIFOENTRY_PS_SHIFT 10 | ||
| 1579 | #define NFIFOENTRY_PS_MASK (1 << NFIFOENTRY_PS_SHIFT) | ||
| 1580 | #define NFIFOENTRY_PS (1 << NFIFOENTRY_PS_SHIFT) | ||
| 1581 | 1577 | ||
| 1578 | #define NFIFOENTRY_PS_SHIFT 10 | ||
| 1579 | #define NFIFOENTRY_PS_MASK (1 << NFIFOENTRY_PS_SHIFT) | ||
| 1580 | #define NFIFOENTRY_PS (1 << NFIFOENTRY_PS_SHIFT) | ||
| 1582 | 1581 | ||
| 1583 | #define NFIFOENTRY_DLEN_SHIFT 0 | 1582 | #define NFIFOENTRY_DLEN_SHIFT 0 |
| 1584 | #define NFIFOENTRY_DLEN_MASK (0xFFF << NFIFOENTRY_DLEN_SHIFT) | 1583 | #define NFIFOENTRY_DLEN_MASK (0xFFF << NFIFOENTRY_DLEN_SHIFT) |
| @@ -1591,15 +1590,15 @@ | |||
| 1591 | */ | 1590 | */ |
| 1592 | 1591 | ||
| 1593 | /* IPSec ESP CBC Encap/Decap Options */ | 1592 | /* IPSec ESP CBC Encap/Decap Options */ |
| 1594 | #define PDBOPTS_ESPCBC_ARSNONE 0x00 /* no antireplay window */ | 1593 | #define PDBOPTS_ESPCBC_ARSNONE 0x00 /* no antireplay window */ |
| 1595 | #define PDBOPTS_ESPCBC_ARS32 0x40 /* 32-entry antireplay window */ | 1594 | #define PDBOPTS_ESPCBC_ARS32 0x40 /* 32-entry antireplay window */ |
| 1596 | #define PDBOPTS_ESPCBC_ARS64 0xc0 /* 64-entry antireplay window */ | 1595 | #define PDBOPTS_ESPCBC_ARS64 0xc0 /* 64-entry antireplay window */ |
| 1597 | #define PDBOPTS_ESPCBC_IVSRC 0x20 /* IV comes from internal random gen */ | 1596 | #define PDBOPTS_ESPCBC_IVSRC 0x20 /* IV comes from internal random gen */ |
| 1598 | #define PDBOPTS_ESPCBC_ESN 0x10 /* extended sequence included */ | 1597 | #define PDBOPTS_ESPCBC_ESN 0x10 /* extended sequence included */ |
| 1599 | #define PDBOPTS_ESPCBC_OUTFMT 0x08 /* output only decapsulation (decap) */ | 1598 | #define PDBOPTS_ESPCBC_OUTFMT 0x08 /* output only decapsulation (decap) */ |
| 1600 | #define PDBOPTS_ESPCBC_IPHDRSRC 0x08 /* IP header comes from PDB (encap) */ | 1599 | #define PDBOPTS_ESPCBC_IPHDRSRC 0x08 /* IP header comes from PDB (encap) */ |
| 1601 | #define PDBOPTS_ESPCBC_INCIPHDR 0x04 /* Prepend IP header to output frame */ | 1600 | #define PDBOPTS_ESPCBC_INCIPHDR 0x04 /* Prepend IP header to output frame */ |
| 1602 | #define PDBOPTS_ESPCBC_IPVSN 0x02 /* process IPv6 header */ | 1601 | #define PDBOPTS_ESPCBC_IPVSN 0x02 /* process IPv6 header */ |
| 1603 | #define PDBOPTS_ESPCBC_TUNNEL 0x01 /* tunnel mode next-header byte */ | 1602 | #define PDBOPTS_ESPCBC_TUNNEL 0x01 /* tunnel mode next-header byte */ |
| 1604 | 1603 | ||
| 1605 | #endif /* DESC_H */ | 1604 | #endif /* DESC_H */ |
diff --git a/drivers/crypto/caam/desc_constr.h b/drivers/crypto/caam/desc_constr.h index 0991323cf3fd..348b882275f0 100644 --- a/drivers/crypto/caam/desc_constr.h +++ b/drivers/crypto/caam/desc_constr.h | |||
| @@ -18,9 +18,10 @@ | |||
| 18 | #define PRINT_POS | 18 | #define PRINT_POS |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | #define SET_OK_PROP_ERRORS (IMMEDIATE | LDST_CLASS_DECO | \ | 21 | #define SET_OK_NO_PROP_ERRORS (IMMEDIATE | LDST_CLASS_DECO | \ |
| 22 | LDST_SRCDST_WORD_DECOCTRL | \ | 22 | LDST_SRCDST_WORD_DECOCTRL | \ |
| 23 | (LDOFF_CHG_SHARE_OK_PROP << LDST_OFFSET_SHIFT)) | 23 | (LDOFF_CHG_SHARE_OK_NO_PROP << \ |
| 24 | LDST_OFFSET_SHIFT)) | ||
| 24 | #define DISABLE_AUTO_INFO_FIFO (IMMEDIATE | LDST_CLASS_DECO | \ | 25 | #define DISABLE_AUTO_INFO_FIFO (IMMEDIATE | LDST_CLASS_DECO | \ |
| 25 | LDST_SRCDST_WORD_DECOCTRL | \ | 26 | LDST_SRCDST_WORD_DECOCTRL | \ |
| 26 | (LDOFF_DISABLE_AUTO_NFIFO << LDST_OFFSET_SHIFT)) | 27 | (LDOFF_DISABLE_AUTO_NFIFO << LDST_OFFSET_SHIFT)) |
diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h index aee394e39056..e9f7a70cdd5e 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h | |||
| @@ -657,7 +657,6 @@ struct caam_full { | |||
| 657 | u64 rsvd[512]; | 657 | u64 rsvd[512]; |
| 658 | struct caam_assurance assure; | 658 | struct caam_assurance assure; |
| 659 | struct caam_queue_if qi; | 659 | struct caam_queue_if qi; |
| 660 | struct caam_deco *deco; | ||
| 661 | }; | 660 | }; |
| 662 | 661 | ||
| 663 | #endif /* REGS_H */ | 662 | #endif /* REGS_H */ |
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c index dcd8babae9eb..597235a2f8f9 100644 --- a/drivers/crypto/mv_cesa.c +++ b/drivers/crypto/mv_cesa.c | |||
| @@ -1128,17 +1128,7 @@ static struct platform_driver marvell_crypto = { | |||
| 1128 | }; | 1128 | }; |
| 1129 | MODULE_ALIAS("platform:mv_crypto"); | 1129 | MODULE_ALIAS("platform:mv_crypto"); |
| 1130 | 1130 | ||
| 1131 | static int __init mv_crypto_init(void) | 1131 | module_platform_driver(marvell_crypto); |
| 1132 | { | ||
| 1133 | return platform_driver_register(&marvell_crypto); | ||
| 1134 | } | ||
| 1135 | module_init(mv_crypto_init); | ||
| 1136 | |||
| 1137 | static void __exit mv_crypto_exit(void) | ||
| 1138 | { | ||
| 1139 | platform_driver_unregister(&marvell_crypto); | ||
| 1140 | } | ||
| 1141 | module_exit(mv_crypto_exit); | ||
| 1142 | 1132 | ||
| 1143 | MODULE_AUTHOR("Sebastian Andrzej Siewior <sebastian@breakpoint.cc>"); | 1133 | MODULE_AUTHOR("Sebastian Andrzej Siewior <sebastian@breakpoint.cc>"); |
| 1144 | MODULE_DESCRIPTION("Support for Marvell's cryptographic engine"); | 1134 | MODULE_DESCRIPTION("Support for Marvell's cryptographic engine"); |
diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c index a2b553eabbdb..58480d009324 100644 --- a/drivers/crypto/picoxcell_crypto.c +++ b/drivers/crypto/picoxcell_crypto.c | |||
| @@ -873,7 +873,7 @@ static int spacc_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *key, | |||
| 873 | * request for any other size (192 bits) then we need to do a software | 873 | * request for any other size (192 bits) then we need to do a software |
| 874 | * fallback. | 874 | * fallback. |
| 875 | */ | 875 | */ |
| 876 | if ((len != AES_KEYSIZE_128 || len != AES_KEYSIZE_256) && | 876 | if (len != AES_KEYSIZE_128 && len != AES_KEYSIZE_256 && |
| 877 | ctx->sw_cipher) { | 877 | ctx->sw_cipher) { |
| 878 | /* | 878 | /* |
| 879 | * Set the fallback transform to use the same request flags as | 879 | * Set the fallback transform to use the same request flags as |
| @@ -886,7 +886,7 @@ static int spacc_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *key, | |||
| 886 | err = crypto_ablkcipher_setkey(ctx->sw_cipher, key, len); | 886 | err = crypto_ablkcipher_setkey(ctx->sw_cipher, key, len); |
| 887 | if (err) | 887 | if (err) |
| 888 | goto sw_setkey_failed; | 888 | goto sw_setkey_failed; |
| 889 | } else if ((len != AES_KEYSIZE_128 || len != AES_KEYSIZE_256) && | 889 | } else if (len != AES_KEYSIZE_128 && len != AES_KEYSIZE_256 && |
| 890 | !ctx->sw_cipher) | 890 | !ctx->sw_cipher) |
| 891 | err = -EINVAL; | 891 | err = -EINVAL; |
| 892 | 892 | ||
| @@ -1854,17 +1854,7 @@ static struct platform_driver spacc_driver = { | |||
| 1854 | .id_table = spacc_id_table, | 1854 | .id_table = spacc_id_table, |
| 1855 | }; | 1855 | }; |
| 1856 | 1856 | ||
| 1857 | static int __init spacc_init(void) | 1857 | module_platform_driver(spacc_driver); |
| 1858 | { | ||
| 1859 | return platform_driver_register(&spacc_driver); | ||
| 1860 | } | ||
| 1861 | module_init(spacc_init); | ||
| 1862 | |||
| 1863 | static void __exit spacc_exit(void) | ||
| 1864 | { | ||
| 1865 | platform_driver_unregister(&spacc_driver); | ||
| 1866 | } | ||
| 1867 | module_exit(spacc_exit); | ||
| 1868 | 1858 | ||
| 1869 | MODULE_LICENSE("GPL"); | 1859 | MODULE_LICENSE("GPL"); |
| 1870 | MODULE_AUTHOR("Jamie Iles"); | 1860 | MODULE_AUTHOR("Jamie Iles"); |
diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c index 8115417a1c93..3376bca200fc 100644 --- a/drivers/crypto/s5p-sss.c +++ b/drivers/crypto/s5p-sss.c | |||
| @@ -683,18 +683,7 @@ static struct platform_driver s5p_aes_crypto = { | |||
| 683 | }, | 683 | }, |
| 684 | }; | 684 | }; |
| 685 | 685 | ||
| 686 | static int __init s5p_aes_mod_init(void) | 686 | module_platform_driver(s5p_aes_crypto); |
| 687 | { | ||
| 688 | return platform_driver_register(&s5p_aes_crypto); | ||
| 689 | } | ||
| 690 | |||
| 691 | static void __exit s5p_aes_mod_exit(void) | ||
| 692 | { | ||
| 693 | platform_driver_unregister(&s5p_aes_crypto); | ||
| 694 | } | ||
| 695 | |||
| 696 | module_init(s5p_aes_mod_init); | ||
| 697 | module_exit(s5p_aes_mod_exit); | ||
| 698 | 687 | ||
| 699 | MODULE_DESCRIPTION("S5PV210 AES hw acceleration support."); | 688 | MODULE_DESCRIPTION("S5PV210 AES hw acceleration support."); |
| 700 | MODULE_LICENSE("GPL v2"); | 689 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index dbe76b5df9cf..2d8c78901686 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
| @@ -99,6 +99,8 @@ struct talitos_request { | |||
| 99 | 99 | ||
| 100 | /* per-channel fifo management */ | 100 | /* per-channel fifo management */ |
| 101 | struct talitos_channel { | 101 | struct talitos_channel { |
| 102 | void __iomem *reg; | ||
| 103 | |||
| 102 | /* request fifo */ | 104 | /* request fifo */ |
| 103 | struct talitos_request *fifo; | 105 | struct talitos_request *fifo; |
| 104 | 106 | ||
| @@ -120,7 +122,7 @@ struct talitos_private { | |||
| 120 | struct device *dev; | 122 | struct device *dev; |
| 121 | struct platform_device *ofdev; | 123 | struct platform_device *ofdev; |
| 122 | void __iomem *reg; | 124 | void __iomem *reg; |
| 123 | int irq; | 125 | int irq[2]; |
| 124 | 126 | ||
| 125 | /* SEC version geometry (from device tree node) */ | 127 | /* SEC version geometry (from device tree node) */ |
| 126 | unsigned int num_channels; | 128 | unsigned int num_channels; |
| @@ -144,7 +146,7 @@ struct talitos_private { | |||
| 144 | atomic_t last_chan ____cacheline_aligned; | 146 | atomic_t last_chan ____cacheline_aligned; |
| 145 | 147 | ||
| 146 | /* request callback tasklet */ | 148 | /* request callback tasklet */ |
| 147 | struct tasklet_struct done_task; | 149 | struct tasklet_struct done_task[2]; |
| 148 | 150 | ||
| 149 | /* list of registered algorithms */ | 151 | /* list of registered algorithms */ |
| 150 | struct list_head alg_list; | 152 | struct list_head alg_list; |
| @@ -157,6 +159,7 @@ struct talitos_private { | |||
| 157 | #define TALITOS_FTR_SRC_LINK_TBL_LEN_INCLUDES_EXTENT 0x00000001 | 159 | #define TALITOS_FTR_SRC_LINK_TBL_LEN_INCLUDES_EXTENT 0x00000001 |
| 158 | #define TALITOS_FTR_HW_AUTH_CHECK 0x00000002 | 160 | #define TALITOS_FTR_HW_AUTH_CHECK 0x00000002 |
| 159 | #define TALITOS_FTR_SHA224_HWINIT 0x00000004 | 161 | #define TALITOS_FTR_SHA224_HWINIT 0x00000004 |
| 162 | #define TALITOS_FTR_HMAC_OK 0x00000008 | ||
| 160 | 163 | ||
| 161 | static void to_talitos_ptr(struct talitos_ptr *talitos_ptr, dma_addr_t dma_addr) | 164 | static void to_talitos_ptr(struct talitos_ptr *talitos_ptr, dma_addr_t dma_addr) |
| 162 | { | 165 | { |
| @@ -196,9 +199,9 @@ static int reset_channel(struct device *dev, int ch) | |||
| 196 | struct talitos_private *priv = dev_get_drvdata(dev); | 199 | struct talitos_private *priv = dev_get_drvdata(dev); |
| 197 | unsigned int timeout = TALITOS_TIMEOUT; | 200 | unsigned int timeout = TALITOS_TIMEOUT; |
| 198 | 201 | ||
| 199 | setbits32(priv->reg + TALITOS_CCCR(ch), TALITOS_CCCR_RESET); | 202 | setbits32(priv->chan[ch].reg + TALITOS_CCCR, TALITOS_CCCR_RESET); |
| 200 | 203 | ||
| 201 | while ((in_be32(priv->reg + TALITOS_CCCR(ch)) & TALITOS_CCCR_RESET) | 204 | while ((in_be32(priv->chan[ch].reg + TALITOS_CCCR) & TALITOS_CCCR_RESET) |
| 202 | && --timeout) | 205 | && --timeout) |
| 203 | cpu_relax(); | 206 | cpu_relax(); |
| 204 | 207 | ||
| @@ -208,12 +211,12 @@ static int reset_channel(struct device *dev, int ch) | |||
| 208 | } | 211 | } |
| 209 | 212 | ||
| 210 | /* set 36-bit addressing, done writeback enable and done IRQ enable */ | 213 | /* set 36-bit addressing, done writeback enable and done IRQ enable */ |
| 211 | setbits32(priv->reg + TALITOS_CCCR_LO(ch), TALITOS_CCCR_LO_EAE | | 214 | setbits32(priv->chan[ch].reg + TALITOS_CCCR_LO, TALITOS_CCCR_LO_EAE | |
| 212 | TALITOS_CCCR_LO_CDWE | TALITOS_CCCR_LO_CDIE); | 215 | TALITOS_CCCR_LO_CDWE | TALITOS_CCCR_LO_CDIE); |
| 213 | 216 | ||
| 214 | /* and ICCR writeback, if available */ | 217 | /* and ICCR writeback, if available */ |
| 215 | if (priv->features & TALITOS_FTR_HW_AUTH_CHECK) | 218 | if (priv->features & TALITOS_FTR_HW_AUTH_CHECK) |
| 216 | setbits32(priv->reg + TALITOS_CCCR_LO(ch), | 219 | setbits32(priv->chan[ch].reg + TALITOS_CCCR_LO, |
| 217 | TALITOS_CCCR_LO_IWSE); | 220 | TALITOS_CCCR_LO_IWSE); |
| 218 | 221 | ||
| 219 | return 0; | 222 | return 0; |
| @@ -223,13 +226,19 @@ static int reset_device(struct device *dev) | |||
| 223 | { | 226 | { |
| 224 | struct talitos_private *priv = dev_get_drvdata(dev); | 227 | struct talitos_private *priv = dev_get_drvdata(dev); |
| 225 | unsigned int timeout = TALITOS_TIMEOUT; | 228 | unsigned int timeout = TALITOS_TIMEOUT; |
| 229 | u32 mcr = TALITOS_MCR_SWR; | ||
| 226 | 230 | ||
| 227 | setbits32(priv->reg + TALITOS_MCR, TALITOS_MCR_SWR); | 231 | setbits32(priv->reg + TALITOS_MCR, mcr); |
| 228 | 232 | ||
| 229 | while ((in_be32(priv->reg + TALITOS_MCR) & TALITOS_MCR_SWR) | 233 | while ((in_be32(priv->reg + TALITOS_MCR) & TALITOS_MCR_SWR) |
| 230 | && --timeout) | 234 | && --timeout) |
| 231 | cpu_relax(); | 235 | cpu_relax(); |
| 232 | 236 | ||
| 237 | if (priv->irq[1]) { | ||
| 238 | mcr = TALITOS_MCR_RCA1 | TALITOS_MCR_RCA3; | ||
| 239 | setbits32(priv->reg + TALITOS_MCR, mcr); | ||
| 240 | } | ||
| 241 | |||
| 233 | if (timeout == 0) { | 242 | if (timeout == 0) { |
| 234 | dev_err(dev, "failed to reset device\n"); | 243 | dev_err(dev, "failed to reset device\n"); |
| 235 | return -EIO; | 244 | return -EIO; |
| @@ -327,8 +336,9 @@ static int talitos_submit(struct device *dev, int ch, struct talitos_desc *desc, | |||
| 327 | 336 | ||
| 328 | /* GO! */ | 337 | /* GO! */ |
| 329 | wmb(); | 338 | wmb(); |
| 330 | out_be32(priv->reg + TALITOS_FF(ch), upper_32_bits(request->dma_desc)); | 339 | out_be32(priv->chan[ch].reg + TALITOS_FF, |
| 331 | out_be32(priv->reg + TALITOS_FF_LO(ch), | 340 | upper_32_bits(request->dma_desc)); |
| 341 | out_be32(priv->chan[ch].reg + TALITOS_FF_LO, | ||
| 332 | lower_32_bits(request->dma_desc)); | 342 | lower_32_bits(request->dma_desc)); |
| 333 | 343 | ||
| 334 | spin_unlock_irqrestore(&priv->chan[ch].head_lock, flags); | 344 | spin_unlock_irqrestore(&priv->chan[ch].head_lock, flags); |
| @@ -397,21 +407,32 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch) | |||
| 397 | /* | 407 | /* |
| 398 | * process completed requests for channels that have done status | 408 | * process completed requests for channels that have done status |
| 399 | */ | 409 | */ |
| 400 | static void talitos_done(unsigned long data) | 410 | #define DEF_TALITOS_DONE(name, ch_done_mask) \ |
| 401 | { | 411 | static void talitos_done_##name(unsigned long data) \ |
| 402 | struct device *dev = (struct device *)data; | 412 | { \ |
| 403 | struct talitos_private *priv = dev_get_drvdata(dev); | 413 | struct device *dev = (struct device *)data; \ |
| 404 | int ch; | 414 | struct talitos_private *priv = dev_get_drvdata(dev); \ |
| 405 | 415 | \ | |
| 406 | for (ch = 0; ch < priv->num_channels; ch++) | 416 | if (ch_done_mask & 1) \ |
| 407 | flush_channel(dev, ch, 0, 0); | 417 | flush_channel(dev, 0, 0, 0); \ |
| 408 | 418 | if (priv->num_channels == 1) \ | |
| 409 | /* At this point, all completed channels have been processed. | 419 | goto out; \ |
| 410 | * Unmask done interrupts for channels completed later on. | 420 | if (ch_done_mask & (1 << 2)) \ |
| 411 | */ | 421 | flush_channel(dev, 1, 0, 0); \ |
| 412 | setbits32(priv->reg + TALITOS_IMR, TALITOS_IMR_INIT); | 422 | if (ch_done_mask & (1 << 4)) \ |
| 413 | setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); | 423 | flush_channel(dev, 2, 0, 0); \ |
| 424 | if (ch_done_mask & (1 << 6)) \ | ||
| 425 | flush_channel(dev, 3, 0, 0); \ | ||
| 426 | \ | ||
| 427 | out: \ | ||
| 428 | /* At this point, all completed channels have been processed */ \ | ||
| 429 | /* Unmask done interrupts for channels completed later on. */ \ | ||
| 430 | setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ | ||
| 431 | setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ | ||
| 414 | } | 432 | } |
| 433 | DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) | ||
| 434 | DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) | ||
| 435 | DEF_TALITOS_DONE(ch1_3, TALITOS_ISR_CH_1_3_DONE) | ||
| 415 | 436 | ||
| 416 | /* | 437 | /* |
| 417 | * locate current (offending) descriptor | 438 | * locate current (offending) descriptor |
| @@ -422,7 +443,7 @@ static u32 current_desc_hdr(struct device *dev, int ch) | |||
| 422 | int tail = priv->chan[ch].tail; | 443 | int tail = priv->chan[ch].tail; |
| 423 | dma_addr_t cur_desc; | 444 | dma_addr_t cur_desc; |
| 424 | 445 | ||
| 425 | cur_desc = in_be32(priv->reg + TALITOS_CDPR_LO(ch)); | 446 | cur_desc = in_be32(priv->chan[ch].reg + TALITOS_CDPR_LO); |
| 426 | 447 | ||
| 427 | while (priv->chan[ch].fifo[tail].dma_desc != cur_desc) { | 448 | while (priv->chan[ch].fifo[tail].dma_desc != cur_desc) { |
| 428 | tail = (tail + 1) & (priv->fifo_len - 1); | 449 | tail = (tail + 1) & (priv->fifo_len - 1); |
| @@ -444,7 +465,7 @@ static void report_eu_error(struct device *dev, int ch, u32 desc_hdr) | |||
| 444 | int i; | 465 | int i; |
| 445 | 466 | ||
| 446 | if (!desc_hdr) | 467 | if (!desc_hdr) |
| 447 | desc_hdr = in_be32(priv->reg + TALITOS_DESCBUF(ch)); | 468 | desc_hdr = in_be32(priv->chan[ch].reg + TALITOS_DESCBUF); |
| 448 | 469 | ||
| 449 | switch (desc_hdr & DESC_HDR_SEL0_MASK) { | 470 | switch (desc_hdr & DESC_HDR_SEL0_MASK) { |
| 450 | case DESC_HDR_SEL0_AFEU: | 471 | case DESC_HDR_SEL0_AFEU: |
| @@ -506,16 +527,15 @@ static void report_eu_error(struct device *dev, int ch, u32 desc_hdr) | |||
| 506 | 527 | ||
| 507 | for (i = 0; i < 8; i++) | 528 | for (i = 0; i < 8; i++) |
| 508 | dev_err(dev, "DESCBUF 0x%08x_%08x\n", | 529 | dev_err(dev, "DESCBUF 0x%08x_%08x\n", |
| 509 | in_be32(priv->reg + TALITOS_DESCBUF(ch) + 8*i), | 530 | in_be32(priv->chan[ch].reg + TALITOS_DESCBUF + 8*i), |
| 510 | in_be32(priv->reg + TALITOS_DESCBUF_LO(ch) + 8*i)); | 531 | in_be32(priv->chan[ch].reg + TALITOS_DESCBUF_LO + 8*i)); |
| 511 | } | 532 | } |
| 512 | 533 | ||
| 513 | /* | 534 | /* |
| 514 | * recover from error interrupts | 535 | * recover from error interrupts |
| 515 | */ | 536 | */ |
| 516 | static void talitos_error(unsigned long data, u32 isr, u32 isr_lo) | 537 | static void talitos_error(struct device *dev, u32 isr, u32 isr_lo) |
| 517 | { | 538 | { |
| 518 | struct device *dev = (struct device *)data; | ||
| 519 | struct talitos_private *priv = dev_get_drvdata(dev); | 539 | struct talitos_private *priv = dev_get_drvdata(dev); |
| 520 | unsigned int timeout = TALITOS_TIMEOUT; | 540 | unsigned int timeout = TALITOS_TIMEOUT; |
| 521 | int ch, error, reset_dev = 0, reset_ch = 0; | 541 | int ch, error, reset_dev = 0, reset_ch = 0; |
| @@ -528,8 +548,8 @@ static void talitos_error(unsigned long data, u32 isr, u32 isr_lo) | |||
| 528 | 548 | ||
| 529 | error = -EINVAL; | 549 | error = -EINVAL; |
| 530 | 550 | ||
| 531 | v = in_be32(priv->reg + TALITOS_CCPSR(ch)); | 551 | v = in_be32(priv->chan[ch].reg + TALITOS_CCPSR); |
| 532 | v_lo = in_be32(priv->reg + TALITOS_CCPSR_LO(ch)); | 552 | v_lo = in_be32(priv->chan[ch].reg + TALITOS_CCPSR_LO); |
| 533 | 553 | ||
| 534 | if (v_lo & TALITOS_CCPSR_LO_DOF) { | 554 | if (v_lo & TALITOS_CCPSR_LO_DOF) { |
| 535 | dev_err(dev, "double fetch fifo overflow error\n"); | 555 | dev_err(dev, "double fetch fifo overflow error\n"); |
| @@ -567,10 +587,10 @@ static void talitos_error(unsigned long data, u32 isr, u32 isr_lo) | |||
| 567 | if (reset_ch) { | 587 | if (reset_ch) { |
| 568 | reset_channel(dev, ch); | 588 | reset_channel(dev, ch); |
| 569 | } else { | 589 | } else { |
| 570 | setbits32(priv->reg + TALITOS_CCCR(ch), | 590 | setbits32(priv->chan[ch].reg + TALITOS_CCCR, |
| 571 | TALITOS_CCCR_CONT); | 591 | TALITOS_CCCR_CONT); |
| 572 | setbits32(priv->reg + TALITOS_CCCR_LO(ch), 0); | 592 | setbits32(priv->chan[ch].reg + TALITOS_CCCR_LO, 0); |
| 573 | while ((in_be32(priv->reg + TALITOS_CCCR(ch)) & | 593 | while ((in_be32(priv->chan[ch].reg + TALITOS_CCCR) & |
| 574 | TALITOS_CCCR_CONT) && --timeout) | 594 | TALITOS_CCCR_CONT) && --timeout) |
| 575 | cpu_relax(); | 595 | cpu_relax(); |
| 576 | if (timeout == 0) { | 596 | if (timeout == 0) { |
| @@ -580,7 +600,7 @@ static void talitos_error(unsigned long data, u32 isr, u32 isr_lo) | |||
| 580 | } | 600 | } |
| 581 | } | 601 | } |
| 582 | } | 602 | } |
| 583 | if (reset_dev || isr & ~TALITOS_ISR_CHERR || isr_lo) { | 603 | if (reset_dev || isr & ~TALITOS_ISR_4CHERR || isr_lo) { |
| 584 | dev_err(dev, "done overflow, internal time out, or rngu error: " | 604 | dev_err(dev, "done overflow, internal time out, or rngu error: " |
| 585 | "ISR 0x%08x_%08x\n", isr, isr_lo); | 605 | "ISR 0x%08x_%08x\n", isr, isr_lo); |
| 586 | 606 | ||
| @@ -593,30 +613,35 @@ static void talitos_error(unsigned long data, u32 isr, u32 isr_lo) | |||
| 593 | } | 613 | } |
| 594 | } | 614 | } |
| 595 | 615 | ||
| 596 | static irqreturn_t talitos_interrupt(int irq, void *data) | 616 | #define DEF_TALITOS_INTERRUPT(name, ch_done_mask, ch_err_mask, tlet) \ |
| 597 | { | 617 | static irqreturn_t talitos_interrupt_##name(int irq, void *data) \ |
| 598 | struct device *dev = data; | 618 | { \ |
| 599 | struct talitos_private *priv = dev_get_drvdata(dev); | 619 | struct device *dev = data; \ |
| 600 | u32 isr, isr_lo; | 620 | struct talitos_private *priv = dev_get_drvdata(dev); \ |
| 601 | 621 | u32 isr, isr_lo; \ | |
| 602 | isr = in_be32(priv->reg + TALITOS_ISR); | 622 | \ |
| 603 | isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); | 623 | isr = in_be32(priv->reg + TALITOS_ISR); \ |
| 604 | /* Acknowledge interrupt */ | 624 | isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ |
| 605 | out_be32(priv->reg + TALITOS_ICR, isr); | 625 | /* Acknowledge interrupt */ \ |
| 606 | out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); | 626 | out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ |
| 607 | 627 | out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ | |
| 608 | if (unlikely((isr & ~TALITOS_ISR_CHDONE) || isr_lo)) | 628 | \ |
| 609 | talitos_error((unsigned long)data, isr, isr_lo); | 629 | if (unlikely((isr & ~TALITOS_ISR_4CHDONE) & ch_err_mask || isr_lo)) \ |
| 610 | else | 630 | talitos_error(dev, isr, isr_lo); \ |
| 611 | if (likely(isr & TALITOS_ISR_CHDONE)) { | 631 | else \ |
| 612 | /* mask further done interrupts. */ | 632 | if (likely(isr & ch_done_mask)) { \ |
| 613 | clrbits32(priv->reg + TALITOS_IMR, TALITOS_IMR_DONE); | 633 | /* mask further done interrupts. */ \ |
| 614 | /* done_task will unmask done interrupts at exit */ | 634 | clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ |
| 615 | tasklet_schedule(&priv->done_task); | 635 | /* done_task will unmask done interrupts at exit */ \ |
| 616 | } | 636 | tasklet_schedule(&priv->done_task[tlet]); \ |
| 617 | 637 | } \ | |
| 618 | return (isr || isr_lo) ? IRQ_HANDLED : IRQ_NONE; | 638 | \ |
| 639 | return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ | ||
| 640 | IRQ_NONE; \ | ||
| 619 | } | 641 | } |
| 642 | DEF_TALITOS_INTERRUPT(4ch, TALITOS_ISR_4CHDONE, TALITOS_ISR_4CHERR, 0) | ||
| 643 | DEF_TALITOS_INTERRUPT(ch0_2, TALITOS_ISR_CH_0_2_DONE, TALITOS_ISR_CH_0_2_ERR, 0) | ||
| 644 | DEF_TALITOS_INTERRUPT(ch1_3, TALITOS_ISR_CH_1_3_DONE, TALITOS_ISR_CH_1_3_ERR, 1) | ||
| 620 | 645 | ||
| 621 | /* | 646 | /* |
| 622 | * hwrng | 647 | * hwrng |
| @@ -1874,6 +1899,97 @@ static int ahash_digest(struct ahash_request *areq) | |||
| 1874 | return ahash_process_req(areq, areq->nbytes); | 1899 | return ahash_process_req(areq, areq->nbytes); |
| 1875 | } | 1900 | } |
| 1876 | 1901 | ||
| 1902 | struct keyhash_result { | ||
| 1903 | struct completion completion; | ||
| 1904 | int err; | ||
| 1905 | }; | ||
| 1906 | |||
| 1907 | static void keyhash_complete(struct crypto_async_request *req, int err) | ||
| 1908 | { | ||
| 1909 | struct keyhash_result *res = req->data; | ||
| 1910 | |||
| 1911 | if (err == -EINPROGRESS) | ||
| 1912 | return; | ||
| 1913 | |||
| 1914 | res->err = err; | ||
| 1915 | complete(&res->completion); | ||
| 1916 | } | ||
| 1917 | |||
| 1918 | static int keyhash(struct crypto_ahash *tfm, const u8 *key, unsigned int keylen, | ||
| 1919 | u8 *hash) | ||
| 1920 | { | ||
| 1921 | struct talitos_ctx *ctx = crypto_tfm_ctx(crypto_ahash_tfm(tfm)); | ||
| 1922 | |||
| 1923 | struct scatterlist sg[1]; | ||
| 1924 | struct ahash_request *req; | ||
| 1925 | struct keyhash_result hresult; | ||
| 1926 | int ret; | ||
| 1927 | |||
| 1928 | init_completion(&hresult.completion); | ||
| 1929 | |||
| 1930 | req = ahash_request_alloc(tfm, GFP_KERNEL); | ||
| 1931 | if (!req) | ||
| 1932 | return -ENOMEM; | ||
| 1933 | |||
| 1934 | /* Keep tfm keylen == 0 during hash of the long key */ | ||
| 1935 | ctx->keylen = 0; | ||
| 1936 | ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, | ||
| 1937 | keyhash_complete, &hresult); | ||
| 1938 | |||
| 1939 | sg_init_one(&sg[0], key, keylen); | ||
| 1940 | |||
| 1941 | ahash_request_set_crypt(req, sg, hash, keylen); | ||
| 1942 | ret = crypto_ahash_digest(req); | ||
| 1943 | switch (ret) { | ||
| 1944 | case 0: | ||
| 1945 | break; | ||
| 1946 | case -EINPROGRESS: | ||
| 1947 | case -EBUSY: | ||
| 1948 | ret = wait_for_completion_interruptible( | ||
| 1949 | &hresult.completion); | ||
| 1950 | if (!ret) | ||
| 1951 | ret = hresult.err; | ||
| 1952 | break; | ||
| 1953 | default: | ||
| 1954 | break; | ||
| 1955 | } | ||
| 1956 | ahash_request_free(req); | ||
| 1957 | |||
| 1958 | return ret; | ||
| 1959 | } | ||
| 1960 | |||
| 1961 | static int ahash_setkey(struct crypto_ahash *tfm, const u8 *key, | ||
| 1962 | unsigned int keylen) | ||
| 1963 | { | ||
| 1964 | struct talitos_ctx *ctx = crypto_tfm_ctx(crypto_ahash_tfm(tfm)); | ||
| 1965 | unsigned int blocksize = | ||
| 1966 | crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm)); | ||
| 1967 | unsigned int digestsize = crypto_ahash_digestsize(tfm); | ||
| 1968 | unsigned int keysize = keylen; | ||
| 1969 | u8 hash[SHA512_DIGEST_SIZE]; | ||
| 1970 | int ret; | ||
| 1971 | |||
| 1972 | if (keylen <= blocksize) | ||
| 1973 | memcpy(ctx->key, key, keysize); | ||
| 1974 | else { | ||
| 1975 | /* Must get the hash of the long key */ | ||
| 1976 | ret = keyhash(tfm, key, keylen, hash); | ||
| 1977 | |||
| 1978 | if (ret) { | ||
| 1979 | crypto_ahash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); | ||
| 1980 | return -EINVAL; | ||
| 1981 | } | ||
| 1982 | |||
| 1983 | keysize = digestsize; | ||
| 1984 | memcpy(ctx->key, hash, digestsize); | ||
| 1985 | } | ||
| 1986 | |||
| 1987 | ctx->keylen = keysize; | ||
| 1988 | |||
| 1989 | return 0; | ||
| 1990 | } | ||
| 1991 | |||
| 1992 | |||
| 1877 | struct talitos_alg_template { | 1993 | struct talitos_alg_template { |
| 1878 | u32 type; | 1994 | u32 type; |
| 1879 | union { | 1995 | union { |
| @@ -2217,6 +2333,138 @@ static struct talitos_alg_template driver_algs[] = { | |||
| 2217 | DESC_HDR_SEL0_MDEUB | | 2333 | DESC_HDR_SEL0_MDEUB | |
| 2218 | DESC_HDR_MODE0_MDEUB_SHA512, | 2334 | DESC_HDR_MODE0_MDEUB_SHA512, |
| 2219 | }, | 2335 | }, |
| 2336 | { .type = CRYPTO_ALG_TYPE_AHASH, | ||
| 2337 | .alg.hash = { | ||
| 2338 | .init = ahash_init, | ||
| 2339 | .update = ahash_update, | ||
| 2340 | .final = ahash_final, | ||
| 2341 | .finup = ahash_finup, | ||
| 2342 | .digest = ahash_digest, | ||
| 2343 | .setkey = ahash_setkey, | ||
| 2344 | .halg.digestsize = MD5_DIGEST_SIZE, | ||
| 2345 | .halg.base = { | ||
| 2346 | .cra_name = "hmac(md5)", | ||
| 2347 | .cra_driver_name = "hmac-md5-talitos", | ||
| 2348 | .cra_blocksize = MD5_BLOCK_SIZE, | ||
| 2349 | .cra_flags = CRYPTO_ALG_TYPE_AHASH | | ||
| 2350 | CRYPTO_ALG_ASYNC, | ||
| 2351 | .cra_type = &crypto_ahash_type | ||
| 2352 | } | ||
| 2353 | }, | ||
| 2354 | .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | | ||
| 2355 | DESC_HDR_SEL0_MDEUA | | ||
| 2356 | DESC_HDR_MODE0_MDEU_MD5, | ||
| 2357 | }, | ||
| 2358 | { .type = CRYPTO_ALG_TYPE_AHASH, | ||
| 2359 | .alg.hash = { | ||
| 2360 | .init = ahash_init, | ||
| 2361 | .update = ahash_update, | ||
| 2362 | .final = ahash_final, | ||
| 2363 | .finup = ahash_finup, | ||
| 2364 | .digest = ahash_digest, | ||
| 2365 | .setkey = ahash_setkey, | ||
| 2366 | .halg.digestsize = SHA1_DIGEST_SIZE, | ||
| 2367 | .halg.base = { | ||
| 2368 | .cra_name = "hmac(sha1)", | ||
| 2369 | .cra_driver_name = "hmac-sha1-talitos", | ||
| 2370 | .cra_blocksize = SHA1_BLOCK_SIZE, | ||
| 2371 | .cra_flags = CRYPTO_ALG_TYPE_AHASH | | ||
| 2372 | CRYPTO_ALG_ASYNC, | ||
| 2373 | .cra_type = &crypto_ahash_type | ||
| 2374 | } | ||
| 2375 | }, | ||
| 2376 | .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | | ||
| 2377 | DESC_HDR_SEL0_MDEUA | | ||
| 2378 | DESC_HDR_MODE0_MDEU_SHA1, | ||
| 2379 | }, | ||
| 2380 | { .type = CRYPTO_ALG_TYPE_AHASH, | ||
| 2381 | .alg.hash = { | ||
| 2382 | .init = ahash_init, | ||
| 2383 | .update = ahash_update, | ||
| 2384 | .final = ahash_final, | ||
| 2385 | .finup = ahash_finup, | ||
| 2386 | .digest = ahash_digest, | ||
| 2387 | .setkey = ahash_setkey, | ||
| 2388 | .halg.digestsize = SHA224_DIGEST_SIZE, | ||
| 2389 | .halg.base = { | ||
| 2390 | .cra_name = "hmac(sha224)", | ||
| 2391 | .cra_driver_name = "hmac-sha224-talitos", | ||
| 2392 | .cra_blocksize = SHA224_BLOCK_SIZE, | ||
| 2393 | .cra_flags = CRYPTO_ALG_TYPE_AHASH | | ||
| 2394 | CRYPTO_ALG_ASYNC, | ||
| 2395 | .cra_type = &crypto_ahash_type | ||
| 2396 | } | ||
| 2397 | }, | ||
| 2398 | .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | | ||
| 2399 | DESC_HDR_SEL0_MDEUA | | ||
| 2400 | DESC_HDR_MODE0_MDEU_SHA224, | ||
| 2401 | }, | ||
| 2402 | { .type = CRYPTO_ALG_TYPE_AHASH, | ||
| 2403 | .alg.hash = { | ||
| 2404 | .init = ahash_init, | ||
| 2405 | .update = ahash_update, | ||
| 2406 | .final = ahash_final, | ||
| 2407 | .finup = ahash_finup, | ||
| 2408 | .digest = ahash_digest, | ||
| 2409 | .setkey = ahash_setkey, | ||
| 2410 | .halg.digestsize = SHA256_DIGEST_SIZE, | ||
| 2411 | .halg.base = { | ||
| 2412 | .cra_name = "hmac(sha256)", | ||
| 2413 | .cra_driver_name = "hmac-sha256-talitos", | ||
| 2414 | .cra_blocksize = SHA256_BLOCK_SIZE, | ||
| 2415 | .cra_flags = CRYPTO_ALG_TYPE_AHASH | | ||
| 2416 | CRYPTO_ALG_ASYNC, | ||
| 2417 | .cra_type = &crypto_ahash_type | ||
| 2418 | } | ||
| 2419 | }, | ||
| 2420 | .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | | ||
| 2421 | DESC_HDR_SEL0_MDEUA | | ||
| 2422 | DESC_HDR_MODE0_MDEU_SHA256, | ||
| 2423 | }, | ||
| 2424 | { .type = CRYPTO_ALG_TYPE_AHASH, | ||
| 2425 | .alg.hash = { | ||
| 2426 | .init = ahash_init, | ||
| 2427 | .update = ahash_update, | ||
| 2428 | .final = ahash_final, | ||
| 2429 | .finup = ahash_finup, | ||
| 2430 | .digest = ahash_digest, | ||
| 2431 | .setkey = ahash_setkey, | ||
| 2432 | .halg.digestsize = SHA384_DIGEST_SIZE, | ||
| 2433 | .halg.base = { | ||
| 2434 | .cra_name = "hmac(sha384)", | ||
| 2435 | .cra_driver_name = "hmac-sha384-talitos", | ||
| 2436 | .cra_blocksize = SHA384_BLOCK_SIZE, | ||
| 2437 | .cra_flags = CRYPTO_ALG_TYPE_AHASH | | ||
| 2438 | CRYPTO_ALG_ASYNC, | ||
| 2439 | .cra_type = &crypto_ahash_type | ||
| 2440 | } | ||
| 2441 | }, | ||
| 2442 | .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | | ||
| 2443 | DESC_HDR_SEL0_MDEUB | | ||
| 2444 | DESC_HDR_MODE0_MDEUB_SHA384, | ||
| 2445 | }, | ||
| 2446 | { .type = CRYPTO_ALG_TYPE_AHASH, | ||
| 2447 | .alg.hash = { | ||
| 2448 | .init = ahash_init, | ||
| 2449 | .update = ahash_update, | ||
| 2450 | .final = ahash_final, | ||
| 2451 | .finup = ahash_finup, | ||
| 2452 | .digest = ahash_digest, | ||
| 2453 | .setkey = ahash_setkey, | ||
| 2454 | .halg.digestsize = SHA512_DIGEST_SIZE, | ||
| 2455 | .halg.base = { | ||
| 2456 | .cra_name = "hmac(sha512)", | ||
| 2457 | .cra_driver_name = "hmac-sha512-talitos", | ||
| 2458 | .cra_blocksize = SHA512_BLOCK_SIZE, | ||
| 2459 | .cra_flags = CRYPTO_ALG_TYPE_AHASH | | ||
| 2460 | CRYPTO_ALG_ASYNC, | ||
| 2461 | .cra_type = &crypto_ahash_type | ||
| 2462 | } | ||
| 2463 | }, | ||
| 2464 | .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | | ||
| 2465 | DESC_HDR_SEL0_MDEUB | | ||
| 2466 | DESC_HDR_MODE0_MDEUB_SHA512, | ||
| 2467 | } | ||
| 2220 | }; | 2468 | }; |
| 2221 | 2469 | ||
| 2222 | struct talitos_crypto_alg { | 2470 | struct talitos_crypto_alg { |
| @@ -2331,12 +2579,15 @@ static int talitos_remove(struct platform_device *ofdev) | |||
| 2331 | 2579 | ||
| 2332 | kfree(priv->chan); | 2580 | kfree(priv->chan); |
| 2333 | 2581 | ||
| 2334 | if (priv->irq != NO_IRQ) { | 2582 | for (i = 0; i < 2; i++) |
| 2335 | free_irq(priv->irq, dev); | 2583 | if (priv->irq[i]) { |
| 2336 | irq_dispose_mapping(priv->irq); | 2584 | free_irq(priv->irq[i], dev); |
| 2337 | } | 2585 | irq_dispose_mapping(priv->irq[i]); |
| 2586 | } | ||
| 2338 | 2587 | ||
| 2339 | tasklet_kill(&priv->done_task); | 2588 | tasklet_kill(&priv->done_task[0]); |
| 2589 | if (priv->irq[1]) | ||
| 2590 | tasklet_kill(&priv->done_task[1]); | ||
| 2340 | 2591 | ||
| 2341 | iounmap(priv->reg); | 2592 | iounmap(priv->reg); |
| 2342 | 2593 | ||
| @@ -2373,8 +2624,14 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, | |||
| 2373 | case CRYPTO_ALG_TYPE_AHASH: | 2624 | case CRYPTO_ALG_TYPE_AHASH: |
| 2374 | alg = &t_alg->algt.alg.hash.halg.base; | 2625 | alg = &t_alg->algt.alg.hash.halg.base; |
| 2375 | alg->cra_init = talitos_cra_init_ahash; | 2626 | alg->cra_init = talitos_cra_init_ahash; |
| 2627 | if (!(priv->features & TALITOS_FTR_HMAC_OK) && | ||
| 2628 | !strncmp(alg->cra_name, "hmac", 4)) { | ||
| 2629 | kfree(t_alg); | ||
| 2630 | return ERR_PTR(-ENOTSUPP); | ||
| 2631 | } | ||
| 2376 | if (!(priv->features & TALITOS_FTR_SHA224_HWINIT) && | 2632 | if (!(priv->features & TALITOS_FTR_SHA224_HWINIT) && |
| 2377 | !strcmp(alg->cra_name, "sha224")) { | 2633 | (!strcmp(alg->cra_name, "sha224") || |
| 2634 | !strcmp(alg->cra_name, "hmac(sha224)"))) { | ||
| 2378 | t_alg->algt.alg.hash.init = ahash_init_sha224_swinit; | 2635 | t_alg->algt.alg.hash.init = ahash_init_sha224_swinit; |
| 2379 | t_alg->algt.desc_hdr_template = | 2636 | t_alg->algt.desc_hdr_template = |
| 2380 | DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | | 2637 | DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | |
| @@ -2397,6 +2654,54 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, | |||
| 2397 | return t_alg; | 2654 | return t_alg; |
| 2398 | } | 2655 | } |
| 2399 | 2656 | ||
| 2657 | static int talitos_probe_irq(struct platform_device *ofdev) | ||
| 2658 | { | ||
| 2659 | struct device *dev = &ofdev->dev; | ||
| 2660 | struct device_node *np = ofdev->dev.of_node; | ||
| 2661 | struct talitos_private *priv = dev_get_drvdata(dev); | ||
| 2662 | int err; | ||
| 2663 | |||
| 2664 | priv->irq[0] = irq_of_parse_and_map(np, 0); | ||
| 2665 | if (!priv->irq[0]) { | ||
| 2666 | dev_err(dev, "failed to map irq\n"); | ||
| 2667 | return -EINVAL; | ||
| 2668 | } | ||
| 2669 | |||
| 2670 | priv->irq[1] = irq_of_parse_and_map(np, 1); | ||
| 2671 | |||
| 2672 | /* get the primary irq line */ | ||
| 2673 | if (!priv->irq[1]) { | ||
| 2674 | err = request_irq(priv->irq[0], talitos_interrupt_4ch, 0, | ||
| 2675 | dev_driver_string(dev), dev); | ||
| 2676 | goto primary_out; | ||
| 2677 | } | ||
| 2678 | |||
| 2679 | err = request_irq(priv->irq[0], talitos_interrupt_ch0_2, 0, | ||
| 2680 | dev_driver_string(dev), dev); | ||
| 2681 | if (err) | ||
| 2682 | goto primary_out; | ||
| 2683 | |||
| 2684 | /* get the secondary irq line */ | ||
| 2685 | err = request_irq(priv->irq[1], talitos_interrupt_ch1_3, 0, | ||
| 2686 | dev_driver_string(dev), dev); | ||
| 2687 | if (err) { | ||
| 2688 | dev_err(dev, "failed to request secondary irq\n"); | ||
| 2689 | irq_dispose_mapping(priv->irq[1]); | ||
| 2690 | priv->irq[1] = 0; | ||
| 2691 | } | ||
| 2692 | |||
| 2693 | return err; | ||
| 2694 | |||
| 2695 | primary_out: | ||
| 2696 | if (err) { | ||
| 2697 | dev_err(dev, "failed to request primary irq\n"); | ||
| 2698 | irq_dispose_mapping(priv->irq[0]); | ||
| 2699 | priv->irq[0] = 0; | ||
| 2700 | } | ||
| 2701 | |||
| 2702 | return err; | ||
| 2703 | } | ||
| 2704 | |||
| 2400 | static int talitos_probe(struct platform_device *ofdev) | 2705 | static int talitos_probe(struct platform_device *ofdev) |
| 2401 | { | 2706 | { |
| 2402 | struct device *dev = &ofdev->dev; | 2707 | struct device *dev = &ofdev->dev; |
| @@ -2413,28 +2718,22 @@ static int talitos_probe(struct platform_device *ofdev) | |||
| 2413 | 2718 | ||
| 2414 | priv->ofdev = ofdev; | 2719 | priv->ofdev = ofdev; |
| 2415 | 2720 | ||
| 2416 | tasklet_init(&priv->done_task, talitos_done, (unsigned long)dev); | 2721 | err = talitos_probe_irq(ofdev); |
| 2417 | 2722 | if (err) | |
| 2418 | INIT_LIST_HEAD(&priv->alg_list); | ||
| 2419 | |||
| 2420 | priv->irq = irq_of_parse_and_map(np, 0); | ||
| 2421 | |||
| 2422 | if (priv->irq == NO_IRQ) { | ||
| 2423 | dev_err(dev, "failed to map irq\n"); | ||
| 2424 | err = -EINVAL; | ||
| 2425 | goto err_out; | 2723 | goto err_out; |
| 2426 | } | ||
| 2427 | 2724 | ||
| 2428 | /* get the irq line */ | 2725 | if (!priv->irq[1]) { |
| 2429 | err = request_irq(priv->irq, talitos_interrupt, 0, | 2726 | tasklet_init(&priv->done_task[0], talitos_done_4ch, |
| 2430 | dev_driver_string(dev), dev); | 2727 | (unsigned long)dev); |
| 2431 | if (err) { | 2728 | } else { |
| 2432 | dev_err(dev, "failed to request irq %d\n", priv->irq); | 2729 | tasklet_init(&priv->done_task[0], talitos_done_ch0_2, |
| 2433 | irq_dispose_mapping(priv->irq); | 2730 | (unsigned long)dev); |
| 2434 | priv->irq = NO_IRQ; | 2731 | tasklet_init(&priv->done_task[1], talitos_done_ch1_3, |
| 2435 | goto err_out; | 2732 | (unsigned long)dev); |
| 2436 | } | 2733 | } |
| 2437 | 2734 | ||
| 2735 | INIT_LIST_HEAD(&priv->alg_list); | ||
| 2736 | |||
| 2438 | priv->reg = of_iomap(np, 0); | 2737 | priv->reg = of_iomap(np, 0); |
| 2439 | if (!priv->reg) { | 2738 | if (!priv->reg) { |
| 2440 | dev_err(dev, "failed to of_iomap\n"); | 2739 | dev_err(dev, "failed to of_iomap\n"); |
| @@ -2471,7 +2770,8 @@ static int talitos_probe(struct platform_device *ofdev) | |||
| 2471 | 2770 | ||
| 2472 | if (of_device_is_compatible(np, "fsl,sec2.1")) | 2771 | if (of_device_is_compatible(np, "fsl,sec2.1")) |
| 2473 | priv->features |= TALITOS_FTR_HW_AUTH_CHECK | | 2772 | priv->features |= TALITOS_FTR_HW_AUTH_CHECK | |
| 2474 | TALITOS_FTR_SHA224_HWINIT; | 2773 | TALITOS_FTR_SHA224_HWINIT | |
| 2774 | TALITOS_FTR_HMAC_OK; | ||
| 2475 | 2775 | ||
| 2476 | priv->chan = kzalloc(sizeof(struct talitos_channel) * | 2776 | priv->chan = kzalloc(sizeof(struct talitos_channel) * |
| 2477 | priv->num_channels, GFP_KERNEL); | 2777 | priv->num_channels, GFP_KERNEL); |
| @@ -2482,6 +2782,12 @@ static int talitos_probe(struct platform_device *ofdev) | |||
| 2482 | } | 2782 | } |
| 2483 | 2783 | ||
| 2484 | for (i = 0; i < priv->num_channels; i++) { | 2784 | for (i = 0; i < priv->num_channels; i++) { |
| 2785 | priv->chan[i].reg = priv->reg + TALITOS_CH_STRIDE * (i + 1); | ||
| 2786 | if (!priv->irq[1] || !(i & 1)) | ||
| 2787 | priv->chan[i].reg += TALITOS_CH_BASE_OFFSET; | ||
| 2788 | } | ||
| 2789 | |||
| 2790 | for (i = 0; i < priv->num_channels; i++) { | ||
| 2485 | spin_lock_init(&priv->chan[i].head_lock); | 2791 | spin_lock_init(&priv->chan[i].head_lock); |
| 2486 | spin_lock_init(&priv->chan[i].tail_lock); | 2792 | spin_lock_init(&priv->chan[i].tail_lock); |
| 2487 | } | 2793 | } |
| @@ -2530,6 +2836,8 @@ static int talitos_probe(struct platform_device *ofdev) | |||
| 2530 | t_alg = talitos_alg_alloc(dev, &driver_algs[i]); | 2836 | t_alg = talitos_alg_alloc(dev, &driver_algs[i]); |
| 2531 | if (IS_ERR(t_alg)) { | 2837 | if (IS_ERR(t_alg)) { |
| 2532 | err = PTR_ERR(t_alg); | 2838 | err = PTR_ERR(t_alg); |
| 2839 | if (err == -ENOTSUPP) | ||
| 2840 | continue; | ||
| 2533 | goto err_out; | 2841 | goto err_out; |
| 2534 | } | 2842 | } |
| 2535 | 2843 | ||
| @@ -2551,12 +2859,13 @@ static int talitos_probe(struct platform_device *ofdev) | |||
| 2551 | dev_err(dev, "%s alg registration failed\n", | 2859 | dev_err(dev, "%s alg registration failed\n", |
| 2552 | name); | 2860 | name); |
| 2553 | kfree(t_alg); | 2861 | kfree(t_alg); |
| 2554 | } else { | 2862 | } else |
| 2555 | list_add_tail(&t_alg->entry, &priv->alg_list); | 2863 | list_add_tail(&t_alg->entry, &priv->alg_list); |
| 2556 | dev_info(dev, "%s\n", name); | ||
| 2557 | } | ||
| 2558 | } | 2864 | } |
| 2559 | } | 2865 | } |
| 2866 | if (!list_empty(&priv->alg_list)) | ||
| 2867 | dev_info(dev, "%s algorithms registered in /proc/crypto\n", | ||
| 2868 | (char *)of_get_property(np, "compatible", NULL)); | ||
| 2560 | 2869 | ||
| 2561 | return 0; | 2870 | return 0; |
| 2562 | 2871 | ||
| @@ -2584,17 +2893,7 @@ static struct platform_driver talitos_driver = { | |||
| 2584 | .remove = talitos_remove, | 2893 | .remove = talitos_remove, |
| 2585 | }; | 2894 | }; |
| 2586 | 2895 | ||
| 2587 | static int __init talitos_init(void) | 2896 | module_platform_driver(talitos_driver); |
| 2588 | { | ||
| 2589 | return platform_driver_register(&talitos_driver); | ||
| 2590 | } | ||
| 2591 | module_init(talitos_init); | ||
| 2592 | |||
| 2593 | static void __exit talitos_exit(void) | ||
| 2594 | { | ||
| 2595 | platform_driver_unregister(&talitos_driver); | ||
| 2596 | } | ||
| 2597 | module_exit(talitos_exit); | ||
| 2598 | 2897 | ||
| 2599 | MODULE_LICENSE("GPL"); | 2898 | MODULE_LICENSE("GPL"); |
| 2600 | MODULE_AUTHOR("Kim Phillips <kim.phillips@freescale.com>"); | 2899 | MODULE_AUTHOR("Kim Phillips <kim.phillips@freescale.com>"); |
diff --git a/drivers/crypto/talitos.h b/drivers/crypto/talitos.h index 0b746aca4587..3c173954ef29 100644 --- a/drivers/crypto/talitos.h +++ b/drivers/crypto/talitos.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Freescale SEC (talitos) device register and descriptor header defines | 2 | * Freescale SEC (talitos) device register and descriptor header defines |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2006-2010 Freescale Semiconductor, Inc. | 4 | * Copyright (c) 2006-2011 Freescale Semiconductor, Inc. |
| 5 | * | 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions |
| @@ -34,28 +34,37 @@ | |||
| 34 | 34 | ||
| 35 | /* global register offset addresses */ | 35 | /* global register offset addresses */ |
| 36 | #define TALITOS_MCR 0x1030 /* master control register */ | 36 | #define TALITOS_MCR 0x1030 /* master control register */ |
| 37 | #define TALITOS_MCR_LO 0x1038 | 37 | #define TALITOS_MCR_RCA0 (1 << 15) /* remap channel 0 */ |
| 38 | #define TALITOS_MCR_RCA1 (1 << 14) /* remap channel 1 */ | ||
| 39 | #define TALITOS_MCR_RCA2 (1 << 13) /* remap channel 2 */ | ||
| 40 | #define TALITOS_MCR_RCA3 (1 << 12) /* remap channel 3 */ | ||
| 38 | #define TALITOS_MCR_SWR 0x1 /* s/w reset */ | 41 | #define TALITOS_MCR_SWR 0x1 /* s/w reset */ |
| 42 | #define TALITOS_MCR_LO 0x1034 | ||
| 39 | #define TALITOS_IMR 0x1008 /* interrupt mask register */ | 43 | #define TALITOS_IMR 0x1008 /* interrupt mask register */ |
| 40 | #define TALITOS_IMR_INIT 0x100ff /* enable channel IRQs */ | 44 | #define TALITOS_IMR_INIT 0x100ff /* enable channel IRQs */ |
| 41 | #define TALITOS_IMR_DONE 0x00055 /* done IRQs */ | 45 | #define TALITOS_IMR_DONE 0x00055 /* done IRQs */ |
| 42 | #define TALITOS_IMR_LO 0x100C | 46 | #define TALITOS_IMR_LO 0x100C |
| 43 | #define TALITOS_IMR_LO_INIT 0x20000 /* allow RNGU error IRQs */ | 47 | #define TALITOS_IMR_LO_INIT 0x20000 /* allow RNGU error IRQs */ |
| 44 | #define TALITOS_ISR 0x1010 /* interrupt status register */ | 48 | #define TALITOS_ISR 0x1010 /* interrupt status register */ |
| 45 | #define TALITOS_ISR_CHERR 0xaa /* channel errors mask */ | 49 | #define TALITOS_ISR_4CHERR 0xaa /* 4 channel errors mask */ |
| 46 | #define TALITOS_ISR_CHDONE 0x55 /* channel done mask */ | 50 | #define TALITOS_ISR_4CHDONE 0x55 /* 4 channel done mask */ |
| 51 | #define TALITOS_ISR_CH_0_2_ERR 0x22 /* channels 0, 2 errors mask */ | ||
| 52 | #define TALITOS_ISR_CH_0_2_DONE 0x11 /* channels 0, 2 done mask */ | ||
| 53 | #define TALITOS_ISR_CH_1_3_ERR 0x88 /* channels 1, 3 errors mask */ | ||
| 54 | #define TALITOS_ISR_CH_1_3_DONE 0x44 /* channels 1, 3 done mask */ | ||
| 47 | #define TALITOS_ISR_LO 0x1014 | 55 | #define TALITOS_ISR_LO 0x1014 |
| 48 | #define TALITOS_ICR 0x1018 /* interrupt clear register */ | 56 | #define TALITOS_ICR 0x1018 /* interrupt clear register */ |
| 49 | #define TALITOS_ICR_LO 0x101C | 57 | #define TALITOS_ICR_LO 0x101C |
| 50 | 58 | ||
| 51 | /* channel register address stride */ | 59 | /* channel register address stride */ |
| 60 | #define TALITOS_CH_BASE_OFFSET 0x1000 /* default channel map base */ | ||
| 52 | #define TALITOS_CH_STRIDE 0x100 | 61 | #define TALITOS_CH_STRIDE 0x100 |
| 53 | 62 | ||
| 54 | /* channel configuration register */ | 63 | /* channel configuration register */ |
| 55 | #define TALITOS_CCCR(ch) (ch * TALITOS_CH_STRIDE + 0x1108) | 64 | #define TALITOS_CCCR 0x8 |
| 56 | #define TALITOS_CCCR_CONT 0x2 /* channel continue */ | 65 | #define TALITOS_CCCR_CONT 0x2 /* channel continue */ |
| 57 | #define TALITOS_CCCR_RESET 0x1 /* channel reset */ | 66 | #define TALITOS_CCCR_RESET 0x1 /* channel reset */ |
| 58 | #define TALITOS_CCCR_LO(ch) (ch * TALITOS_CH_STRIDE + 0x110c) | 67 | #define TALITOS_CCCR_LO 0xc |
| 59 | #define TALITOS_CCCR_LO_IWSE 0x80 /* chan. ICCR writeback enab. */ | 68 | #define TALITOS_CCCR_LO_IWSE 0x80 /* chan. ICCR writeback enab. */ |
| 60 | #define TALITOS_CCCR_LO_EAE 0x20 /* extended address enable */ | 69 | #define TALITOS_CCCR_LO_EAE 0x20 /* extended address enable */ |
| 61 | #define TALITOS_CCCR_LO_CDWE 0x10 /* chan. done writeback enab. */ | 70 | #define TALITOS_CCCR_LO_CDWE 0x10 /* chan. done writeback enab. */ |
| @@ -63,8 +72,8 @@ | |||
| 63 | #define TALITOS_CCCR_LO_CDIE 0x2 /* channel done IRQ enable */ | 72 | #define TALITOS_CCCR_LO_CDIE 0x2 /* channel done IRQ enable */ |
| 64 | 73 | ||
| 65 | /* CCPSR: channel pointer status register */ | 74 | /* CCPSR: channel pointer status register */ |
| 66 | #define TALITOS_CCPSR(ch) (ch * TALITOS_CH_STRIDE + 0x1110) | 75 | #define TALITOS_CCPSR 0x10 |
| 67 | #define TALITOS_CCPSR_LO(ch) (ch * TALITOS_CH_STRIDE + 0x1114) | 76 | #define TALITOS_CCPSR_LO 0x14 |
| 68 | #define TALITOS_CCPSR_LO_DOF 0x8000 /* double FF write oflow error */ | 77 | #define TALITOS_CCPSR_LO_DOF 0x8000 /* double FF write oflow error */ |
| 69 | #define TALITOS_CCPSR_LO_SOF 0x4000 /* single FF write oflow error */ | 78 | #define TALITOS_CCPSR_LO_SOF 0x4000 /* single FF write oflow error */ |
| 70 | #define TALITOS_CCPSR_LO_MDTE 0x2000 /* master data transfer error */ | 79 | #define TALITOS_CCPSR_LO_MDTE 0x2000 /* master data transfer error */ |
| @@ -79,24 +88,24 @@ | |||
| 79 | #define TALITOS_CCPSR_LO_SRL 0x0010 /* scatter return/length error */ | 88 | #define TALITOS_CCPSR_LO_SRL 0x0010 /* scatter return/length error */ |
| 80 | 89 | ||
| 81 | /* channel fetch fifo register */ | 90 | /* channel fetch fifo register */ |
| 82 | #define TALITOS_FF(ch) (ch * TALITOS_CH_STRIDE + 0x1148) | 91 | #define TALITOS_FF 0x48 |
| 83 | #define TALITOS_FF_LO(ch) (ch * TALITOS_CH_STRIDE + 0x114c) | 92 | #define TALITOS_FF_LO 0x4c |
| 84 | 93 | ||
| 85 | /* current descriptor pointer register */ | 94 | /* current descriptor pointer register */ |
| 86 | #define TALITOS_CDPR(ch) (ch * TALITOS_CH_STRIDE + 0x1140) | 95 | #define TALITOS_CDPR 0x40 |
| 87 | #define TALITOS_CDPR_LO(ch) (ch * TALITOS_CH_STRIDE + 0x1144) | 96 | #define TALITOS_CDPR_LO 0x44 |
| 88 | 97 | ||
| 89 | /* descriptor buffer register */ | 98 | /* descriptor buffer register */ |
| 90 | #define TALITOS_DESCBUF(ch) (ch * TALITOS_CH_STRIDE + 0x1180) | 99 | #define TALITOS_DESCBUF 0x80 |
| 91 | #define TALITOS_DESCBUF_LO(ch) (ch * TALITOS_CH_STRIDE + 0x1184) | 100 | #define TALITOS_DESCBUF_LO 0x84 |
| 92 | 101 | ||
| 93 | /* gather link table */ | 102 | /* gather link table */ |
| 94 | #define TALITOS_GATHER(ch) (ch * TALITOS_CH_STRIDE + 0x11c0) | 103 | #define TALITOS_GATHER 0xc0 |
| 95 | #define TALITOS_GATHER_LO(ch) (ch * TALITOS_CH_STRIDE + 0x11c4) | 104 | #define TALITOS_GATHER_LO 0xc4 |
| 96 | 105 | ||
| 97 | /* scatter link table */ | 106 | /* scatter link table */ |
| 98 | #define TALITOS_SCATTER(ch) (ch * TALITOS_CH_STRIDE + 0x11e0) | 107 | #define TALITOS_SCATTER 0xe0 |
| 99 | #define TALITOS_SCATTER_LO(ch) (ch * TALITOS_CH_STRIDE + 0x11e4) | 108 | #define TALITOS_SCATTER_LO 0xe4 |
| 100 | 109 | ||
| 101 | /* execution unit interrupt status registers */ | 110 | /* execution unit interrupt status registers */ |
| 102 | #define TALITOS_DEUISR 0x2030 /* DES unit */ | 111 | #define TALITOS_DEUISR 0x2030 /* DES unit */ |
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index ecc721def10c..418d270e1806 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
| @@ -134,6 +134,7 @@ struct crypto_template *crypto_lookup_template(const char *name); | |||
| 134 | 134 | ||
| 135 | int crypto_register_instance(struct crypto_template *tmpl, | 135 | int crypto_register_instance(struct crypto_template *tmpl, |
| 136 | struct crypto_instance *inst); | 136 | struct crypto_instance *inst); |
| 137 | int crypto_unregister_instance(struct crypto_alg *alg); | ||
| 137 | 138 | ||
| 138 | int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, | 139 | int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, |
| 139 | struct crypto_instance *inst, u32 mask); | 140 | struct crypto_instance *inst, u32 mask); |
diff --git a/include/crypto/lrw.h b/include/crypto/lrw.h new file mode 100644 index 000000000000..25a2c8716375 --- /dev/null +++ b/include/crypto/lrw.h | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | #ifndef _CRYPTO_LRW_H | ||
| 2 | #define _CRYPTO_LRW_H | ||
| 3 | |||
| 4 | #include <crypto/b128ops.h> | ||
| 5 | |||
| 6 | struct scatterlist; | ||
| 7 | struct gf128mul_64k; | ||
| 8 | struct blkcipher_desc; | ||
| 9 | |||
| 10 | #define LRW_BLOCK_SIZE 16 | ||
| 11 | |||
| 12 | struct lrw_table_ctx { | ||
| 13 | /* optimizes multiplying a random (non incrementing, as at the | ||
| 14 | * start of a new sector) value with key2, we could also have | ||
| 15 | * used 4k optimization tables or no optimization at all. In the | ||
| 16 | * latter case we would have to store key2 here */ | ||
| 17 | struct gf128mul_64k *table; | ||
| 18 | /* stores: | ||
| 19 | * key2*{ 0,0,...0,0,0,0,1 }, key2*{ 0,0,...0,0,0,1,1 }, | ||
| 20 | * key2*{ 0,0,...0,0,1,1,1 }, key2*{ 0,0,...0,1,1,1,1 } | ||
| 21 | * key2*{ 0,0,...1,1,1,1,1 }, etc | ||
| 22 | * needed for optimized multiplication of incrementing values | ||
| 23 | * with key2 */ | ||
| 24 | be128 mulinc[128]; | ||
| 25 | }; | ||
| 26 | |||
| 27 | int lrw_init_table(struct lrw_table_ctx *ctx, const u8 *tweak); | ||
| 28 | void lrw_free_table(struct lrw_table_ctx *ctx); | ||
| 29 | |||
| 30 | struct lrw_crypt_req { | ||
| 31 | be128 *tbuf; | ||
| 32 | unsigned int tbuflen; | ||
| 33 | |||
| 34 | struct lrw_table_ctx *table_ctx; | ||
| 35 | void *crypt_ctx; | ||
| 36 | void (*crypt_fn)(void *ctx, u8 *blks, unsigned int nbytes); | ||
| 37 | }; | ||
| 38 | |||
| 39 | int lrw_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 40 | struct scatterlist *src, unsigned int nbytes, | ||
| 41 | struct lrw_crypt_req *req); | ||
| 42 | |||
| 43 | #endif /* _CRYPTO_LRW_H */ | ||
diff --git a/include/crypto/serpent.h b/include/crypto/serpent.h new file mode 100644 index 000000000000..b7e0941eb6fc --- /dev/null +++ b/include/crypto/serpent.h | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | /* | ||
| 2 | * Common values for serpent algorithms | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef _CRYPTO_SERPENT_H | ||
| 6 | #define _CRYPTO_SERPENT_H | ||
| 7 | |||
| 8 | #include <linux/types.h> | ||
| 9 | #include <linux/crypto.h> | ||
| 10 | |||
| 11 | #define SERPENT_MIN_KEY_SIZE 0 | ||
| 12 | #define SERPENT_MAX_KEY_SIZE 32 | ||
| 13 | #define SERPENT_EXPKEY_WORDS 132 | ||
| 14 | #define SERPENT_BLOCK_SIZE 16 | ||
| 15 | |||
| 16 | struct serpent_ctx { | ||
| 17 | u32 expkey[SERPENT_EXPKEY_WORDS]; | ||
| 18 | }; | ||
| 19 | |||
| 20 | int __serpent_setkey(struct serpent_ctx *ctx, const u8 *key, | ||
| 21 | unsigned int keylen); | ||
| 22 | int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen); | ||
| 23 | |||
| 24 | void __serpent_encrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src); | ||
| 25 | void __serpent_decrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src); | ||
| 26 | |||
| 27 | #endif | ||
diff --git a/include/crypto/twofish.h b/include/crypto/twofish.h index c408522595c6..095c901a8af3 100644 --- a/include/crypto/twofish.h +++ b/include/crypto/twofish.h | |||
| @@ -17,6 +17,8 @@ struct twofish_ctx { | |||
| 17 | u32 s[4][256], w[8], k[32]; | 17 | u32 s[4][256], w[8], k[32]; |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | int __twofish_setkey(struct twofish_ctx *ctx, const u8 *key, | ||
| 21 | unsigned int key_len, u32 *flags); | ||
| 20 | int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len); | 22 | int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len); |
| 21 | 23 | ||
| 22 | #endif | 24 | #endif |
diff --git a/include/crypto/xts.h b/include/crypto/xts.h new file mode 100644 index 000000000000..72c09eb56437 --- /dev/null +++ b/include/crypto/xts.h | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | #ifndef _CRYPTO_XTS_H | ||
| 2 | #define _CRYPTO_XTS_H | ||
| 3 | |||
| 4 | #include <crypto/b128ops.h> | ||
| 5 | |||
| 6 | struct scatterlist; | ||
| 7 | struct blkcipher_desc; | ||
| 8 | |||
| 9 | #define XTS_BLOCK_SIZE 16 | ||
| 10 | |||
| 11 | struct xts_crypt_req { | ||
| 12 | be128 *tbuf; | ||
| 13 | unsigned int tbuflen; | ||
| 14 | |||
| 15 | void *tweak_ctx; | ||
| 16 | void (*tweak_fn)(void *ctx, u8* dst, const u8* src); | ||
| 17 | void *crypt_ctx; | ||
| 18 | void (*crypt_fn)(void *ctx, u8 *blks, unsigned int nbytes); | ||
| 19 | }; | ||
| 20 | |||
| 21 | #define XTS_TWEAK_CAST(x) ((void (*)(void *, u8*, const u8*))(x)) | ||
| 22 | |||
| 23 | int xts_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
| 24 | struct scatterlist *src, unsigned int nbytes, | ||
| 25 | struct xts_crypt_req *req); | ||
| 26 | |||
| 27 | #endif /* _CRYPTO_XTS_H */ | ||
