Skip to content

Commit 32dc43e

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto update from Herbert Xu: "Here is the crypto update for 3.9: - Added accelerated implementation of crc32 using pclmulqdq. - Added test vector for fcrypt. - Added support for OMAP4/AM33XX cipher and hash. - Fixed loose crypto_user input checks. - Misc fixes" * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (43 commits) crypto: user - ensure user supplied strings are nul-terminated crypto: user - fix empty string test in report API crypto: user - fix info leaks in report API crypto: caam - Added property fsl,sec-era in SEC4.0 device tree binding. crypto: use ERR_CAST crypto: atmel-aes - adjust duplicate test crypto: crc32-pclmul - Kill warning on x86-32 crypto: x86/twofish - assembler clean-ups: use ENTRY/ENDPROC, localize jump labels crypto: x86/sha1 - assembler clean-ups: use ENTRY/ENDPROC crypto: x86/serpent - use ENTRY/ENDPROC for assember functions and localize jump targets crypto: x86/salsa20 - assembler cleanup, use ENTRY/ENDPROC for assember functions and rename ECRYPT_* to salsa20_* crypto: x86/ghash - assembler clean-up: use ENDPROC at end of assember functions crypto: x86/crc32c - assembler clean-up: use ENTRY/ENDPROC crypto: cast6-avx: use ENTRY()/ENDPROC() for assembler functions crypto: cast5-avx: use ENTRY()/ENDPROC() for assembler functions and localize jump targets crypto: camellia-x86_64/aes-ni: use ENTRY()/ENDPROC() for assembler functions and localize jump targets crypto: blowfish-x86_64: use ENTRY()/ENDPROC() for assembler functions and localize jump targets crypto: aesni-intel - add ENDPROC statements for assembler functions crypto: x86/aes - assembler clean-ups: use ENTRY/ENDPROC, localize jump targets crypto: testmgr - add test vector for fcrypt ...
2 parents d414c10 + 8fd61d3 commit 32dc43e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2146
-765
lines changed

Documentation/devicetree/bindings/crypto/fsl-sec4.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ PROPERTIES
113113
EXAMPLE
114114
crypto@300000 {
115115
compatible = "fsl,sec-v4.0";
116-
fsl,sec-era = <0x2>;
116+
fsl,sec-era = <2>;
117117
#address-cells = <1>;
118118
#size-cells = <1>;
119119
reg = <0x300000 0x10000>;

arch/x86/crypto/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) += ghash-clmulni-intel.o
2727

2828
obj-$(CONFIG_CRYPTO_CRC32C_INTEL) += crc32c-intel.o
2929
obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o
30+
obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o
3031

3132
aes-i586-y := aes-i586-asm_32.o aes_glue.o
3233
twofish-i586-y := twofish-i586-asm_32.o twofish_glue.o
@@ -52,3 +53,4 @@ ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o
5253
sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o
5354
crc32c-intel-y := crc32c-intel_glue.o
5455
crc32c-intel-$(CONFIG_CRYPTO_CRC32C_X86_64) += crc32c-pcl-intel-asm_64.o
56+
crc32-pclmul-y := crc32-pclmul_asm.o crc32-pclmul_glue.o

arch/x86/crypto/aes-i586-asm_32.S

+5-10
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
.file "aes-i586-asm.S"
3737
.text
3838

39+
#include <linux/linkage.h>
3940
#include <asm/asm-offsets.h>
4041

4142
#define tlen 1024 // length of each of 4 'xor' arrays (256 32-bit words)
@@ -219,14 +220,10 @@
219220
// AES (Rijndael) Encryption Subroutine
220221
/* void aes_enc_blk(struct crypto_aes_ctx *ctx, u8 *out_blk, const u8 *in_blk) */
221222

222-
.global aes_enc_blk
223-
224223
.extern crypto_ft_tab
225224
.extern crypto_fl_tab
226225

227-
.align 4
228-
229-
aes_enc_blk:
226+
ENTRY(aes_enc_blk)
230227
push %ebp
231228
mov ctx(%esp),%ebp
232229

@@ -290,18 +287,15 @@ aes_enc_blk:
290287
mov %r0,(%ebp)
291288
pop %ebp
292289
ret
290+
ENDPROC(aes_enc_blk)
293291

294292
// AES (Rijndael) Decryption Subroutine
295293
/* void aes_dec_blk(struct crypto_aes_ctx *ctx, u8 *out_blk, const u8 *in_blk) */
296294

297-
.global aes_dec_blk
298-
299295
.extern crypto_it_tab
300296
.extern crypto_il_tab
301297

302-
.align 4
303-
304-
aes_dec_blk:
298+
ENTRY(aes_dec_blk)
305299
push %ebp
306300
mov ctx(%esp),%ebp
307301

@@ -365,3 +359,4 @@ aes_dec_blk:
365359
mov %r0,(%ebp)
366360
pop %ebp
367361
ret
362+
ENDPROC(aes_dec_blk)

arch/x86/crypto/aes-x86_64-asm_64.S

+15-15
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
.text
1717

18+
#include <linux/linkage.h>
1819
#include <asm/asm-offsets.h>
1920

2021
#define R1 %rax
@@ -49,10 +50,8 @@
4950
#define R11 %r11
5051

5152
#define prologue(FUNC,KEY,B128,B192,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11) \
52-
.global FUNC; \
53-
.type FUNC,@function; \
54-
.align 8; \
55-
FUNC: movq r1,r2; \
53+
ENTRY(FUNC); \
54+
movq r1,r2; \
5655
movq r3,r4; \
5756
leaq KEY+48(r8),r9; \
5857
movq r10,r11; \
@@ -71,14 +70,15 @@ FUNC: movq r1,r2; \
7170
je B192; \
7271
leaq 32(r9),r9;
7372

74-
#define epilogue(r1,r2,r3,r4,r5,r6,r7,r8,r9) \
73+
#define epilogue(FUNC,r1,r2,r3,r4,r5,r6,r7,r8,r9) \
7574
movq r1,r2; \
7675
movq r3,r4; \
7776
movl r5 ## E,(r9); \
7877
movl r6 ## E,4(r9); \
7978
movl r7 ## E,8(r9); \
8079
movl r8 ## E,12(r9); \
81-
ret;
80+
ret; \
81+
ENDPROC(FUNC);
8282

8383
#define round(TAB,OFFSET,r1,r2,r3,r4,r5,r6,r7,r8,ra,rb,rc,rd) \
8484
movzbl r2 ## H,r5 ## E; \
@@ -133,7 +133,7 @@ FUNC: movq r1,r2; \
133133
#define entry(FUNC,KEY,B128,B192) \
134134
prologue(FUNC,KEY,B128,B192,R2,R8,R7,R9,R1,R3,R4,R6,R10,R5,R11)
135135

136-
#define return epilogue(R8,R2,R9,R7,R5,R6,R3,R4,R11)
136+
#define return(FUNC) epilogue(FUNC,R8,R2,R9,R7,R5,R6,R3,R4,R11)
137137

138138
#define encrypt_round(TAB,OFFSET) \
139139
round(TAB,OFFSET,R1,R2,R3,R4,R5,R6,R7,R10,R5,R6,R3,R4) \
@@ -151,12 +151,12 @@ FUNC: movq r1,r2; \
151151

152152
/* void aes_enc_blk(stuct crypto_tfm *tfm, u8 *out, const u8 *in) */
153153

154-
entry(aes_enc_blk,0,enc128,enc192)
154+
entry(aes_enc_blk,0,.Le128,.Le192)
155155
encrypt_round(crypto_ft_tab,-96)
156156
encrypt_round(crypto_ft_tab,-80)
157-
enc192: encrypt_round(crypto_ft_tab,-64)
157+
.Le192: encrypt_round(crypto_ft_tab,-64)
158158
encrypt_round(crypto_ft_tab,-48)
159-
enc128: encrypt_round(crypto_ft_tab,-32)
159+
.Le128: encrypt_round(crypto_ft_tab,-32)
160160
encrypt_round(crypto_ft_tab,-16)
161161
encrypt_round(crypto_ft_tab, 0)
162162
encrypt_round(crypto_ft_tab, 16)
@@ -166,16 +166,16 @@ enc128: encrypt_round(crypto_ft_tab,-32)
166166
encrypt_round(crypto_ft_tab, 80)
167167
encrypt_round(crypto_ft_tab, 96)
168168
encrypt_final(crypto_fl_tab,112)
169-
return
169+
return(aes_enc_blk)
170170

171171
/* void aes_dec_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in) */
172172

173-
entry(aes_dec_blk,240,dec128,dec192)
173+
entry(aes_dec_blk,240,.Ld128,.Ld192)
174174
decrypt_round(crypto_it_tab,-96)
175175
decrypt_round(crypto_it_tab,-80)
176-
dec192: decrypt_round(crypto_it_tab,-64)
176+
.Ld192: decrypt_round(crypto_it_tab,-64)
177177
decrypt_round(crypto_it_tab,-48)
178-
dec128: decrypt_round(crypto_it_tab,-32)
178+
.Ld128: decrypt_round(crypto_it_tab,-32)
179179
decrypt_round(crypto_it_tab,-16)
180180
decrypt_round(crypto_it_tab, 0)
181181
decrypt_round(crypto_it_tab, 16)
@@ -185,4 +185,4 @@ dec128: decrypt_round(crypto_it_tab,-32)
185185
decrypt_round(crypto_it_tab, 80)
186186
decrypt_round(crypto_it_tab, 96)
187187
decrypt_final(crypto_il_tab,112)
188-
return
188+
return(aes_dec_blk)

arch/x86/crypto/aesni-intel_asm.S

+22-1
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,6 @@ TMP7 XMM1 XMM2 XMM3 XMM4 XMMDst
12621262
* poly = x^128 + x^127 + x^126 + x^121 + 1
12631263
*
12641264
*****************************************************************************/
1265-
12661265
ENTRY(aesni_gcm_dec)
12671266
push %r12
12681267
push %r13
@@ -1437,6 +1436,7 @@ _return_T_done_decrypt:
14371436
pop %r13
14381437
pop %r12
14391438
ret
1439+
ENDPROC(aesni_gcm_dec)
14401440

14411441

14421442
/*****************************************************************************
@@ -1700,10 +1700,12 @@ _return_T_done_encrypt:
17001700
pop %r13
17011701
pop %r12
17021702
ret
1703+
ENDPROC(aesni_gcm_enc)
17031704

17041705
#endif
17051706

17061707

1708+
.align 4
17071709
_key_expansion_128:
17081710
_key_expansion_256a:
17091711
pshufd $0b11111111, %xmm1, %xmm1
@@ -1715,6 +1717,8 @@ _key_expansion_256a:
17151717
movaps %xmm0, (TKEYP)
17161718
add $0x10, TKEYP
17171719
ret
1720+
ENDPROC(_key_expansion_128)
1721+
ENDPROC(_key_expansion_256a)
17181722

17191723
.align 4
17201724
_key_expansion_192a:
@@ -1739,6 +1743,7 @@ _key_expansion_192a:
17391743
movaps %xmm1, 0x10(TKEYP)
17401744
add $0x20, TKEYP
17411745
ret
1746+
ENDPROC(_key_expansion_192a)
17421747

17431748
.align 4
17441749
_key_expansion_192b:
@@ -1758,6 +1763,7 @@ _key_expansion_192b:
17581763
movaps %xmm0, (TKEYP)
17591764
add $0x10, TKEYP
17601765
ret
1766+
ENDPROC(_key_expansion_192b)
17611767

17621768
.align 4
17631769
_key_expansion_256b:
@@ -1770,6 +1776,7 @@ _key_expansion_256b:
17701776
movaps %xmm2, (TKEYP)
17711777
add $0x10, TKEYP
17721778
ret
1779+
ENDPROC(_key_expansion_256b)
17731780

17741781
/*
17751782
* int aesni_set_key(struct crypto_aes_ctx *ctx, const u8 *in_key,
@@ -1882,6 +1889,7 @@ ENTRY(aesni_set_key)
18821889
popl KEYP
18831890
#endif
18841891
ret
1892+
ENDPROC(aesni_set_key)
18851893

18861894
/*
18871895
* void aesni_enc(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
@@ -1903,6 +1911,7 @@ ENTRY(aesni_enc)
19031911
popl KEYP
19041912
#endif
19051913
ret
1914+
ENDPROC(aesni_enc)
19061915

19071916
/*
19081917
* _aesni_enc1: internal ABI
@@ -1960,6 +1969,7 @@ _aesni_enc1:
19601969
movaps 0x70(TKEYP), KEY
19611970
AESENCLAST KEY STATE
19621971
ret
1972+
ENDPROC(_aesni_enc1)
19631973

19641974
/*
19651975
* _aesni_enc4: internal ABI
@@ -2068,6 +2078,7 @@ _aesni_enc4:
20682078
AESENCLAST KEY STATE3
20692079
AESENCLAST KEY STATE4
20702080
ret
2081+
ENDPROC(_aesni_enc4)
20712082

20722083
/*
20732084
* void aesni_dec (struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
@@ -2090,6 +2101,7 @@ ENTRY(aesni_dec)
20902101
popl KEYP
20912102
#endif
20922103
ret
2104+
ENDPROC(aesni_dec)
20932105

20942106
/*
20952107
* _aesni_dec1: internal ABI
@@ -2147,6 +2159,7 @@ _aesni_dec1:
21472159
movaps 0x70(TKEYP), KEY
21482160
AESDECLAST KEY STATE
21492161
ret
2162+
ENDPROC(_aesni_dec1)
21502163

21512164
/*
21522165
* _aesni_dec4: internal ABI
@@ -2255,6 +2268,7 @@ _aesni_dec4:
22552268
AESDECLAST KEY STATE3
22562269
AESDECLAST KEY STATE4
22572270
ret
2271+
ENDPROC(_aesni_dec4)
22582272

22592273
/*
22602274
* void aesni_ecb_enc(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
@@ -2312,6 +2326,7 @@ ENTRY(aesni_ecb_enc)
23122326
popl LEN
23132327
#endif
23142328
ret
2329+
ENDPROC(aesni_ecb_enc)
23152330

23162331
/*
23172332
* void aesni_ecb_dec(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
@@ -2370,6 +2385,7 @@ ENTRY(aesni_ecb_dec)
23702385
popl LEN
23712386
#endif
23722387
ret
2388+
ENDPROC(aesni_ecb_dec)
23732389

23742390
/*
23752391
* void aesni_cbc_enc(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
@@ -2411,6 +2427,7 @@ ENTRY(aesni_cbc_enc)
24112427
popl IVP
24122428
#endif
24132429
ret
2430+
ENDPROC(aesni_cbc_enc)
24142431

24152432
/*
24162433
* void aesni_cbc_dec(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
@@ -2501,6 +2518,7 @@ ENTRY(aesni_cbc_dec)
25012518
popl IVP
25022519
#endif
25032520
ret
2521+
ENDPROC(aesni_cbc_dec)
25042522

25052523
#ifdef __x86_64__
25062524
.align 16
@@ -2527,6 +2545,7 @@ _aesni_inc_init:
25272545
MOVQ_R64_XMM TCTR_LOW INC
25282546
MOVQ_R64_XMM CTR TCTR_LOW
25292547
ret
2548+
ENDPROC(_aesni_inc_init)
25302549

25312550
/*
25322551
* _aesni_inc: internal ABI
@@ -2555,6 +2574,7 @@ _aesni_inc:
25552574
movaps CTR, IV
25562575
PSHUFB_XMM BSWAP_MASK IV
25572576
ret
2577+
ENDPROC(_aesni_inc)
25582578

25592579
/*
25602580
* void aesni_ctr_enc(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
@@ -2615,4 +2635,5 @@ ENTRY(aesni_ctr_enc)
26152635
movups IV, (IVP)
26162636
.Lctr_enc_just_ret:
26172637
ret
2638+
ENDPROC(aesni_ctr_enc)
26182639
#endif

0 commit comments

Comments
 (0)