Skip to content

Commit 562f477

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (29 commits) crypto: sha512-s390 - Add missing block size hwrng: timeriomem - Breaks an allyesconfig build on s390: nlattr: Fix build error with NET off crypto: testmgr - add zlib test crypto: zlib - New zlib crypto module, using pcomp crypto: testmgr - Add support for the pcomp interface crypto: compress - Add pcomp interface netlink: Move netlink attribute parsing support to lib crypto: Fix dead links hwrng: timeriomem - New driver crypto: chainiv - Use kcrypto_wq instead of keventd_wq crypto: cryptd - Per-CPU thread implementation based on kcrypto_wq crypto: api - Use dedicated workqueue for crypto subsystem crypto: testmgr - Test skciphers with no IVs crypto: aead - Avoid infinite loop when nivaead fails selftest crypto: skcipher - Avoid infinite loop when cipher fails selftest crypto: api - Fix crypto_alloc_tfm/create_create_tfm return convention crypto: api - crypto_alg_mod_lookup either tested or untested crypto: amcc - Add crypt4xx driver crypto: ansi_cprng - Add maintainer ...
2 parents ada19a3 + 949abe5 commit 562f477

61 files changed

Lines changed: 5506 additions & 264 deletions

Some content is hidden

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

‎MAINTAINERS‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,12 @@ L: linux-crypto@vger.kernel.org
12691269
T: git kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6.git
12701270
S: Maintained
12711271

1272+
CRYPTOGRAPHIC RANDOM NUMBER GENERATOR
1273+
P: Neil Horman
1274+
M: nhorman@tuxdriver.com
1275+
L: linux-crypto@vger.kernel.org
1276+
S: Maintained
1277+
12721278
CS5535 Audio ALSA driver
12731279
P: Jaya Kumar
12741280
M: jayakumar.alsa@gmail.com

‎arch/powerpc/boot/dts/canyonlands.dts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@
127127
dcr-reg = <0x010 0x002>;
128128
};
129129

130+
CRYPTO: crypto@180000 {
131+
compatible = "amcc,ppc460ex-crypto", "amcc,ppc4xx-crypto";
132+
reg = <4 0x00180000 0x80400>;
133+
interrupt-parent = <&UIC0>;
134+
interrupts = <0x1d 0x4>;
135+
};
136+
130137
MAL0: mcmal {
131138
compatible = "ibm,mcmal-460ex", "ibm,mcmal2";
132139
dcr-reg = <0x180 0x062>;

‎arch/powerpc/boot/dts/kilauea.dts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@
9797
0x6 0x4>; /* ECC SEC Error */
9898
};
9999

100+
CRYPTO: crypto@ef700000 {
101+
compatible = "amcc,ppc405ex-crypto", "amcc,ppc4xx-crypto";
102+
reg = <0xef700000 0x80400>;
103+
interrupt-parent = <&UIC0>;
104+
interrupts = <0x17 0x2>;
105+
};
106+
100107
MAL0: mcmal {
101108
compatible = "ibm,mcmal-405ex", "ibm,mcmal2";
102109
dcr-reg = <0x180 0x062>;

‎arch/s390/crypto/sha.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ struct s390_sha_ctx {
2929
int func; /* KIMD function to use */
3030
};
3131

32-
void s390_sha_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len);
33-
void s390_sha_final(struct crypto_tfm *tfm, u8 *out);
32+
struct shash_desc;
33+
34+
int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len);
35+
int s390_sha_final(struct shash_desc *desc, u8 *out);
3436

3537
#endif

‎arch/s390/crypto/sha1_s390.c‎

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
* any later version.
2424
*
2525
*/
26+
#include <crypto/internal/hash.h>
2627
#include <linux/init.h>
2728
#include <linux/module.h>
28-
#include <linux/crypto.h>
2929
#include <crypto/sha.h>
3030

3131
#include "crypt_s390.h"
3232
#include "sha.h"
3333

34-
static void sha1_init(struct crypto_tfm *tfm)
34+
static int sha1_init(struct shash_desc *desc)
3535
{
36-
struct s390_sha_ctx *sctx = crypto_tfm_ctx(tfm);
36+
struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
3737

3838
sctx->state[0] = SHA1_H0;
3939
sctx->state[1] = SHA1_H1;
@@ -42,34 +42,36 @@ static void sha1_init(struct crypto_tfm *tfm)
4242
sctx->state[4] = SHA1_H4;
4343
sctx->count = 0;
4444
sctx->func = KIMD_SHA_1;
45+
46+
return 0;
4547
}
4648

47-
static struct crypto_alg alg = {
48-
.cra_name = "sha1",
49-
.cra_driver_name= "sha1-s390",
50-
.cra_priority = CRYPT_S390_PRIORITY,
51-
.cra_flags = CRYPTO_ALG_TYPE_DIGEST,
52-
.cra_blocksize = SHA1_BLOCK_SIZE,
53-
.cra_ctxsize = sizeof(struct s390_sha_ctx),
54-
.cra_module = THIS_MODULE,
55-
.cra_list = LIST_HEAD_INIT(alg.cra_list),
56-
.cra_u = { .digest = {
57-
.dia_digestsize = SHA1_DIGEST_SIZE,
58-
.dia_init = sha1_init,
59-
.dia_update = s390_sha_update,
60-
.dia_final = s390_sha_final } }
49+
static struct shash_alg alg = {
50+
.digestsize = SHA1_DIGEST_SIZE,
51+
.init = sha1_init,
52+
.update = s390_sha_update,
53+
.final = s390_sha_final,
54+
.descsize = sizeof(struct s390_sha_ctx),
55+
.base = {
56+
.cra_name = "sha1",
57+
.cra_driver_name= "sha1-s390",
58+
.cra_priority = CRYPT_S390_PRIORITY,
59+
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
60+
.cra_blocksize = SHA1_BLOCK_SIZE,
61+
.cra_module = THIS_MODULE,
62+
}
6163
};
6264

6365
static int __init sha1_s390_init(void)
6466
{
6567
if (!crypt_s390_func_available(KIMD_SHA_1))
6668
return -EOPNOTSUPP;
67-
return crypto_register_alg(&alg);
69+
return crypto_register_shash(&alg);
6870
}
6971

7072
static void __exit sha1_s390_fini(void)
7173
{
72-
crypto_unregister_alg(&alg);
74+
crypto_unregister_shash(&alg);
7375
}
7476

7577
module_init(sha1_s390_init);

‎arch/s390/crypto/sha256_s390.c‎

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
* any later version.
1717
*
1818
*/
19+
#include <crypto/internal/hash.h>
1920
#include <linux/init.h>
2021
#include <linux/module.h>
21-
#include <linux/crypto.h>
2222
#include <crypto/sha.h>
2323

2424
#include "crypt_s390.h"
2525
#include "sha.h"
2626

27-
static void sha256_init(struct crypto_tfm *tfm)
27+
static int sha256_init(struct shash_desc *desc)
2828
{
29-
struct s390_sha_ctx *sctx = crypto_tfm_ctx(tfm);
29+
struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
3030

3131
sctx->state[0] = SHA256_H0;
3232
sctx->state[1] = SHA256_H1;
@@ -38,35 +38,37 @@ static void sha256_init(struct crypto_tfm *tfm)
3838
sctx->state[7] = SHA256_H7;
3939
sctx->count = 0;
4040
sctx->func = KIMD_SHA_256;
41+
42+
return 0;
4143
}
4244

43-
static struct crypto_alg alg = {
44-
.cra_name = "sha256",
45-
.cra_driver_name = "sha256-s390",
46-
.cra_priority = CRYPT_S390_PRIORITY,
47-
.cra_flags = CRYPTO_ALG_TYPE_DIGEST,
48-
.cra_blocksize = SHA256_BLOCK_SIZE,
49-
.cra_ctxsize = sizeof(struct s390_sha_ctx),
50-
.cra_module = THIS_MODULE,
51-
.cra_list = LIST_HEAD_INIT(alg.cra_list),
52-
.cra_u = { .digest = {
53-
.dia_digestsize = SHA256_DIGEST_SIZE,
54-
.dia_init = sha256_init,
55-
.dia_update = s390_sha_update,
56-
.dia_final = s390_sha_final } }
45+
static struct shash_alg alg = {
46+
.digestsize = SHA256_DIGEST_SIZE,
47+
.init = sha256_init,
48+
.update = s390_sha_update,
49+
.final = s390_sha_final,
50+
.descsize = sizeof(struct s390_sha_ctx),
51+
.base = {
52+
.cra_name = "sha256",
53+
.cra_driver_name= "sha256-s390",
54+
.cra_priority = CRYPT_S390_PRIORITY,
55+
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
56+
.cra_blocksize = SHA256_BLOCK_SIZE,
57+
.cra_module = THIS_MODULE,
58+
}
5759
};
5860

5961
static int sha256_s390_init(void)
6062
{
6163
if (!crypt_s390_func_available(KIMD_SHA_256))
6264
return -EOPNOTSUPP;
6365

64-
return crypto_register_alg(&alg);
66+
return crypto_register_shash(&alg);
6567
}
6668

6769
static void __exit sha256_s390_fini(void)
6870
{
69-
crypto_unregister_alg(&alg);
71+
crypto_unregister_shash(&alg);
7072
}
7173

7274
module_init(sha256_s390_init);

‎arch/s390/crypto/sha512_s390.c‎

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
* any later version.
1313
*
1414
*/
15+
#include <crypto/internal/hash.h>
1516
#include <linux/init.h>
1617
#include <linux/module.h>
17-
#include <linux/crypto.h>
1818

1919
#include "sha.h"
2020
#include "crypt_s390.h"
2121

22-
static void sha512_init(struct crypto_tfm *tfm)
22+
static int sha512_init(struct shash_desc *desc)
2323
{
24-
struct s390_sha_ctx *ctx = crypto_tfm_ctx(tfm);
24+
struct s390_sha_ctx *ctx = shash_desc_ctx(desc);
2525

2626
*(__u64 *)&ctx->state[0] = 0x6a09e667f3bcc908ULL;
2727
*(__u64 *)&ctx->state[2] = 0xbb67ae8584caa73bULL;
@@ -33,29 +33,31 @@ static void sha512_init(struct crypto_tfm *tfm)
3333
*(__u64 *)&ctx->state[14] = 0x5be0cd19137e2179ULL;
3434
ctx->count = 0;
3535
ctx->func = KIMD_SHA_512;
36+
37+
return 0;
3638
}
3739

38-
static struct crypto_alg sha512_alg = {
39-
.cra_name = "sha512",
40-
.cra_driver_name = "sha512-s390",
41-
.cra_priority = CRYPT_S390_PRIORITY,
42-
.cra_flags = CRYPTO_ALG_TYPE_DIGEST,
43-
.cra_blocksize = SHA512_BLOCK_SIZE,
44-
.cra_ctxsize = sizeof(struct s390_sha_ctx),
45-
.cra_module = THIS_MODULE,
46-
.cra_list = LIST_HEAD_INIT(sha512_alg.cra_list),
47-
.cra_u = { .digest = {
48-
.dia_digestsize = SHA512_DIGEST_SIZE,
49-
.dia_init = sha512_init,
50-
.dia_update = s390_sha_update,
51-
.dia_final = s390_sha_final } }
40+
static struct shash_alg sha512_alg = {
41+
.digestsize = SHA512_DIGEST_SIZE,
42+
.init = sha512_init,
43+
.update = s390_sha_update,
44+
.final = s390_sha_final,
45+
.descsize = sizeof(struct s390_sha_ctx),
46+
.base = {
47+
.cra_name = "sha512",
48+
.cra_driver_name= "sha512-s390",
49+
.cra_priority = CRYPT_S390_PRIORITY,
50+
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
51+
.cra_blocksize = SHA512_BLOCK_SIZE,
52+
.cra_module = THIS_MODULE,
53+
}
5254
};
5355

5456
MODULE_ALIAS("sha512");
5557

56-
static void sha384_init(struct crypto_tfm *tfm)
58+
static int sha384_init(struct shash_desc *desc)
5759
{
58-
struct s390_sha_ctx *ctx = crypto_tfm_ctx(tfm);
60+
struct s390_sha_ctx *ctx = shash_desc_ctx(desc);
5961

6062
*(__u64 *)&ctx->state[0] = 0xcbbb9d5dc1059ed8ULL;
6163
*(__u64 *)&ctx->state[2] = 0x629a292a367cd507ULL;
@@ -67,22 +69,25 @@ static void sha384_init(struct crypto_tfm *tfm)
6769
*(__u64 *)&ctx->state[14] = 0x47b5481dbefa4fa4ULL;
6870
ctx->count = 0;
6971
ctx->func = KIMD_SHA_512;
72+
73+
return 0;
7074
}
7175

72-
static struct crypto_alg sha384_alg = {
73-
.cra_name = "sha384",
74-
.cra_driver_name = "sha384-s390",
75-
.cra_priority = CRYPT_S390_PRIORITY,
76-
.cra_flags = CRYPTO_ALG_TYPE_DIGEST,
77-
.cra_blocksize = SHA384_BLOCK_SIZE,
78-
.cra_ctxsize = sizeof(struct s390_sha_ctx),
79-
.cra_module = THIS_MODULE,
80-
.cra_list = LIST_HEAD_INIT(sha384_alg.cra_list),
81-
.cra_u = { .digest = {
82-
.dia_digestsize = SHA384_DIGEST_SIZE,
83-
.dia_init = sha384_init,
84-
.dia_update = s390_sha_update,
85-
.dia_final = s390_sha_final } }
76+
static struct shash_alg sha384_alg = {
77+
.digestsize = SHA384_DIGEST_SIZE,
78+
.init = sha384_init,
79+
.update = s390_sha_update,
80+
.final = s390_sha_final,
81+
.descsize = sizeof(struct s390_sha_ctx),
82+
.base = {
83+
.cra_name = "sha384",
84+
.cra_driver_name= "sha384-s390",
85+
.cra_priority = CRYPT_S390_PRIORITY,
86+
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
87+
.cra_blocksize = SHA384_BLOCK_SIZE,
88+
.cra_ctxsize = sizeof(struct s390_sha_ctx),
89+
.cra_module = THIS_MODULE,
90+
}
8691
};
8792

8893
MODULE_ALIAS("sha384");
@@ -93,18 +98,18 @@ static int __init init(void)
9398

9499
if (!crypt_s390_func_available(KIMD_SHA_512))
95100
return -EOPNOTSUPP;
96-
if ((ret = crypto_register_alg(&sha512_alg)) < 0)
101+
if ((ret = crypto_register_shash(&sha512_alg)) < 0)
97102
goto out;
98-
if ((ret = crypto_register_alg(&sha384_alg)) < 0)
99-
crypto_unregister_alg(&sha512_alg);
103+
if ((ret = crypto_register_shash(&sha384_alg)) < 0)
104+
crypto_unregister_shash(&sha512_alg);
100105
out:
101106
return ret;
102107
}
103108

104109
static void __exit fini(void)
105110
{
106-
crypto_unregister_alg(&sha512_alg);
107-
crypto_unregister_alg(&sha384_alg);
111+
crypto_unregister_shash(&sha512_alg);
112+
crypto_unregister_shash(&sha384_alg);
108113
}
109114

110115
module_init(init);

‎arch/s390/crypto/sha_common.c‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
*
1414
*/
1515

16-
#include <linux/crypto.h>
16+
#include <crypto/internal/hash.h>
1717
#include "sha.h"
1818
#include "crypt_s390.h"
1919

20-
void s390_sha_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
20+
int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len)
2121
{
22-
struct s390_sha_ctx *ctx = crypto_tfm_ctx(tfm);
23-
unsigned int bsize = crypto_tfm_alg_blocksize(tfm);
22+
struct s390_sha_ctx *ctx = shash_desc_ctx(desc);
23+
unsigned int bsize = crypto_shash_blocksize(desc->tfm);
2424
unsigned int index;
2525
int ret;
2626

@@ -51,13 +51,15 @@ void s390_sha_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
5151
store:
5252
if (len)
5353
memcpy(ctx->buf + index , data, len);
54+
55+
return 0;
5456
}
5557
EXPORT_SYMBOL_GPL(s390_sha_update);
5658

57-
void s390_sha_final(struct crypto_tfm *tfm, u8 *out)
59+
int s390_sha_final(struct shash_desc *desc, u8 *out)
5860
{
59-
struct s390_sha_ctx *ctx = crypto_tfm_ctx(tfm);
60-
unsigned int bsize = crypto_tfm_alg_blocksize(tfm);
61+
struct s390_sha_ctx *ctx = shash_desc_ctx(desc);
62+
unsigned int bsize = crypto_shash_blocksize(desc->tfm);
6163
u64 bits;
6264
unsigned int index, end, plen;
6365
int ret;
@@ -87,9 +89,11 @@ void s390_sha_final(struct crypto_tfm *tfm, u8 *out)
8789
BUG_ON(ret != end);
8890

8991
/* copy digest to out */
90-
memcpy(out, ctx->state, crypto_hash_digestsize(crypto_hash_cast(tfm)));
92+
memcpy(out, ctx->state, crypto_shash_digestsize(desc->tfm));
9193
/* wipe context */
9294
memset(ctx, 0, sizeof *ctx);
95+
96+
return 0;
9397
}
9498
EXPORT_SYMBOL_GPL(s390_sha_final);
9599

‎arch/x86/crypto/Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ obj-$(CONFIG_CRYPTO_SALSA20_586) += salsa20-i586.o
99
obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o
1010
obj-$(CONFIG_CRYPTO_TWOFISH_X86_64) += twofish-x86_64.o
1111
obj-$(CONFIG_CRYPTO_SALSA20_X86_64) += salsa20-x86_64.o
12+
obj-$(CONFIG_CRYPTO_AES_NI_INTEL) += aesni-intel.o
1213

1314
obj-$(CONFIG_CRYPTO_CRC32C_INTEL) += crc32c-intel.o
1415

@@ -19,3 +20,5 @@ salsa20-i586-y := salsa20-i586-asm_32.o salsa20_glue.o
1920
aes-x86_64-y := aes-x86_64-asm_64.o aes_glue.o
2021
twofish-x86_64-y := twofish-x86_64-asm_64.o twofish_glue.o
2122
salsa20-x86_64-y := salsa20-x86_64-asm_64.o salsa20_glue.o
23+
24+
aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o

0 commit comments

Comments
 (0)