diff options
42 files changed, 9373 insertions, 1668 deletions
diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt index bd7ce120bc13..fc9ce6f1688c 100644 --- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt +++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt | |||
| @@ -54,7 +54,8 @@ PROPERTIES | |||
| 54 | - compatible | 54 | - compatible |
| 55 | Usage: required | 55 | Usage: required |
| 56 | Value type: <string> | 56 | Value type: <string> |
| 57 | Definition: Must include "fsl,sec-v4.0" | 57 | Definition: Must include "fsl,sec-v4.0". Also includes SEC |
| 58 | ERA versions (optional) with which the device is compatible. | ||
| 58 | 59 | ||
| 59 | - #address-cells | 60 | - #address-cells |
| 60 | Usage: required | 61 | Usage: required |
| @@ -106,7 +107,7 @@ PROPERTIES | |||
| 106 | 107 | ||
| 107 | EXAMPLE | 108 | EXAMPLE |
| 108 | crypto@300000 { | 109 | crypto@300000 { |
| 109 | compatible = "fsl,sec-v4.0"; | 110 | compatible = "fsl,sec-v4.0", "fsl,sec-era-v2.0"; |
| 110 | #address-cells = <1>; | 111 | #address-cells = <1>; |
| 111 | #size-cells = <1>; | 112 | #size-cells = <1>; |
| 112 | reg = <0x300000 0x10000>; | 113 | reg = <0x300000 0x10000>; |
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile index 5bacb4a226ac..e0ca7c9ac383 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile | |||
| @@ -12,6 +12,7 @@ obj-$(CONFIG_CRYPTO_SERPENT_SSE2_586) += serpent-sse2-i586.o | |||
| 12 | 12 | ||
| 13 | obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o | 13 | obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o |
| 14 | obj-$(CONFIG_CRYPTO_CAMELLIA_X86_64) += camellia-x86_64.o | 14 | obj-$(CONFIG_CRYPTO_CAMELLIA_X86_64) += camellia-x86_64.o |
| 15 | obj-$(CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64) += camellia-aesni-avx-x86_64.o | ||
| 15 | obj-$(CONFIG_CRYPTO_CAST5_AVX_X86_64) += cast5-avx-x86_64.o | 16 | obj-$(CONFIG_CRYPTO_CAST5_AVX_X86_64) += cast5-avx-x86_64.o |
| 16 | obj-$(CONFIG_CRYPTO_CAST6_AVX_X86_64) += cast6-avx-x86_64.o | 17 | obj-$(CONFIG_CRYPTO_CAST6_AVX_X86_64) += cast6-avx-x86_64.o |
| 17 | obj-$(CONFIG_CRYPTO_BLOWFISH_X86_64) += blowfish-x86_64.o | 18 | obj-$(CONFIG_CRYPTO_BLOWFISH_X86_64) += blowfish-x86_64.o |
| @@ -34,6 +35,8 @@ serpent-sse2-i586-y := serpent-sse2-i586-asm_32.o serpent_sse2_glue.o | |||
| 34 | 35 | ||
| 35 | aes-x86_64-y := aes-x86_64-asm_64.o aes_glue.o | 36 | aes-x86_64-y := aes-x86_64-asm_64.o aes_glue.o |
| 36 | camellia-x86_64-y := camellia-x86_64-asm_64.o camellia_glue.o | 37 | camellia-x86_64-y := camellia-x86_64-asm_64.o camellia_glue.o |
| 38 | camellia-aesni-avx-x86_64-y := camellia-aesni-avx-asm_64.o \ | ||
| 39 | camellia_aesni_avx_glue.o | ||
| 37 | cast5-avx-x86_64-y := cast5-avx-x86_64-asm_64.o cast5_avx_glue.o | 40 | cast5-avx-x86_64-y := cast5-avx-x86_64-asm_64.o cast5_avx_glue.o |
| 38 | cast6-avx-x86_64-y := cast6-avx-x86_64-asm_64.o cast6_avx_glue.o | 41 | cast6-avx-x86_64-y := cast6-avx-x86_64-asm_64.o cast6_avx_glue.o |
| 39 | blowfish-x86_64-y := blowfish-x86_64-asm_64.o blowfish_glue.o | 42 | blowfish-x86_64-y := blowfish-x86_64-asm_64.o blowfish_glue.o |
| @@ -47,3 +50,5 @@ serpent-avx-x86_64-y := serpent-avx-x86_64-asm_64.o serpent_avx_glue.o | |||
| 47 | aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o | 50 | aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o |
| 48 | ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o | 51 | ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o |
| 49 | sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o | 52 | sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o |
| 53 | crc32c-intel-y := crc32c-intel_glue.o | ||
| 54 | crc32c-intel-$(CONFIG_CRYPTO_CRC32C_X86_64) += crc32c-pcl-intel-asm_64.o | ||
diff --git a/arch/x86/crypto/camellia-aesni-avx-asm_64.S b/arch/x86/crypto/camellia-aesni-avx-asm_64.S new file mode 100644 index 000000000000..2306d2e4816f --- /dev/null +++ b/arch/x86/crypto/camellia-aesni-avx-asm_64.S | |||
| @@ -0,0 +1,1102 @@ | |||
| 1 | /* | ||
| 2 | * x86_64/AVX/AES-NI assembler implementation of Camellia | ||
| 3 | * | ||
| 4 | * Copyright © 2012 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | */ | ||
| 12 | |||
| 13 | /* | ||
| 14 | * Version licensed under 2-clause BSD License is available at: | ||
| 15 | * http://koti.mbnet.fi/axh/crypto/camellia-BSD-1.2.0-aesni1.tar.xz | ||
| 16 | */ | ||
| 17 | |||
| 18 | #define CAMELLIA_TABLE_BYTE_LEN 272 | ||
| 19 | |||
| 20 | /* struct camellia_ctx: */ | ||
| 21 | #define key_table 0 | ||
| 22 | #define key_length CAMELLIA_TABLE_BYTE_LEN | ||
| 23 | |||
| 24 | /* register macros */ | ||
| 25 | #define CTX %rdi | ||
| 26 | |||
| 27 | /********************************************************************** | ||
| 28 | 16-way camellia | ||
| 29 | **********************************************************************/ | ||
| 30 | #define filter_8bit(x, lo_t, hi_t, mask4bit, tmp0) \ | ||
| 31 | vpand x, mask4bit, tmp0; \ | ||
| 32 | vpandn x, mask4bit, x; \ | ||
| 33 | vpsrld $4, x, x; \ | ||
| 34 | \ | ||
| 35 | vpshufb tmp0, lo_t, tmp0; \ | ||
| 36 | vpshufb x, hi_t, x; \ | ||
| 37 | vpxor tmp0, x, x; | ||
| 38 | |||
| 39 | /* | ||
| 40 | * IN: | ||
| 41 | * x0..x7: byte-sliced AB state | ||
| 42 | * mem_cd: register pointer storing CD state | ||
| 43 | * key: index for key material | ||
| 44 | * OUT: | ||
| 45 | * x0..x7: new byte-sliced CD state | ||
| 46 | */ | ||
| 47 | #define roundsm16(x0, x1, x2, x3, x4, x5, x6, x7, t0, t1, t2, t3, t4, t5, t6, \ | ||
| 48 | t7, mem_cd, key) \ | ||
| 49 | /* \ | ||
| 50 | * S-function with AES subbytes \ | ||
| 51 | */ \ | ||
| 52 | vmovdqa .Linv_shift_row, t4; \ | ||
| 53 | vbroadcastss .L0f0f0f0f, t7; \ | ||
| 54 | vmovdqa .Lpre_tf_lo_s1, t0; \ | ||
| 55 | vmovdqa .Lpre_tf_hi_s1, t1; \ | ||
| 56 | \ | ||
| 57 | /* AES inverse shift rows */ \ | ||
| 58 | vpshufb t4, x0, x0; \ | ||
| 59 | vpshufb t4, x7, x7; \ | ||
| 60 | vpshufb t4, x1, x1; \ | ||
| 61 | vpshufb t4, x4, x4; \ | ||
| 62 | vpshufb t4, x2, x2; \ | ||
| 63 | vpshufb t4, x5, x5; \ | ||
| 64 | vpshufb t4, x3, x3; \ | ||
| 65 | vpshufb t4, x6, x6; \ | ||
| 66 | \ | ||
| 67 | /* prefilter sboxes 1, 2 and 3 */ \ | ||
| 68 | vmovdqa .Lpre_tf_lo_s4, t2; \ | ||
| 69 | |||
