Skip to content

Commit 5c947d0

Browse files
committed
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto updates from Herbert Xu: "Algorithms: - Drop alignment requirement for data in aesni - Use synchronous seeding from the /dev/random in DRBG - Reseed nopr DRBGs every 5 minutes from /dev/random - Add KDF algorithms currently used by security/DH - Fix lack of entropy on some AMD CPUs with jitter RNG Drivers: - Add support for the D1 variant in sun8i-ce - Add SEV_INIT_EX support in ccp - PFVF support for GEN4 host driver in qat - Compression support for GEN4 devices in qat - Add cn10k random number generator support" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (145 commits) crypto: af_alg - rewrite NULL pointer check lib/mpi: Add the return value check of kcalloc() crypto: qat - fix definition of ring reset results crypto: hisilicon - cleanup warning in qm_get_qos_value() crypto: kdf - select SHA-256 required for self-test crypto: x86/aesni - don't require alignment of data crypto: ccp - remove unneeded semicolon crypto: stm32/crc32 - Fix kernel BUG triggered in probe() crypto: s390/sha512 - Use macros instead of direct IV numbers crypto: sparc/sha - remove duplicate hash init function crypto: powerpc/sha - remove duplicate hash init function crypto: mips/sha - remove duplicate hash init function crypto: sha256 - remove duplicate generic hash init function crypto: jitter - add oversampling of noise source MAINTAINERS: update SEC2 driver maintainers list crypto: ux500 - Use platform_get_irq() to get the interrupt crypto: hisilicon/qm - disable qm clock-gating crypto: omap-aes - Fix broken pm_runtime_and_get() usage MAINTAINERS: update caam crypto driver maintainers list crypto: octeontx2 - prevent underflow in get_cores_bmap() ...
2 parents 6f38be8 + 5f21d7d commit 5c947d0

142 files changed

Lines changed: 5482 additions & 2642 deletions

File tree

Some content is hidden

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

Documentation/virt/kvm/amd-memory-encryption.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ guests, such as launching, running, snapshotting, migrating and decommissioning.
8585
The KVM_SEV_INIT command is used by the hypervisor to initialize the SEV platform
8686
context. In a typical workflow, this command should be the first command issued.
8787

88+
The firmware can be initialized either by using its own non-volatile storage or
89+
the OS can manage the NV storage for the firmware using the module parameter
90+
``init_ex_path``. The file specified by ``init_ex_path`` must exist. To create
91+
a new NV storage file allocate the file with 32KB bytes of 0xFF as required by
92+
the SEV spec.
93+
8894
Returns: 0 on success, -negative on error
8995

9096
2. KVM_SEV_LAUNCH_START

MAINTAINERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7557,6 +7557,7 @@ F: include/video/
75577557
FREESCALE CAAM (Cryptographic Acceleration and Assurance Module) DRIVER
75587558
M: Horia Geantă <horia.geanta@nxp.com>
75597559
M: Pankaj Gupta <pankaj.gupta@nxp.com>
7560+
M: Gaurav Jain <gaurav.jain@nxp.com>
75607561
L: linux-crypto@vger.kernel.org
75617562
S: Maintained
75627563
F: Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@ -8676,6 +8677,7 @@ F: drivers/scsi/hisi_sas/
86768677

86778678
HISILICON SECURITY ENGINE V2 DRIVER (SEC2)
86788679
M: Zaibo Xu <xuzaibo@huawei.com>
8680+
M: Kai Ye <yekai13@huawei.com>
86798681
L: linux-crypto@vger.kernel.org
86808682
S: Maintained
86818683
F: Documentation/ABI/testing/debugfs-hisi-sec
@@ -9721,7 +9723,6 @@ F: Documentation/devicetree/bindings/crypto/intel,keembay-ocs-ecc.yaml
97219723
F: drivers/crypto/keembay/Kconfig
97229724
F: drivers/crypto/keembay/Makefile
97239725
F: drivers/crypto/keembay/keembay-ocs-ecc.c
9724-
F: drivers/crypto/keembay/ocs-ecc-curve-defs.h
97259726

97269727
INTEL KEEM BAY OCS HCU CRYPTO DRIVER
97279728
M: Daniele Alessandrelli <daniele.alessandrelli@intel.com>

arch/mips/cavium-octeon/crypto/octeon-sha1.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <linux/mm.h>
1717
#include <crypto/sha1.h>
18+
#include <crypto/sha1_base.h>
1819
#include <linux/init.h>
1920
#include <linux/types.h>
2021
#include <linux/module.h>
@@ -71,20 +72,6 @@ static void octeon_sha1_transform(const void *_block)
7172
octeon_sha1_start(block[7]);
7273
}
7374

74-
static int octeon_sha1_init(struct shash_desc *desc)
75-
{
76-
struct sha1_state *sctx = shash_desc_ctx(desc);
77-
78-
sctx->state[0] = SHA1_H0;
79-
sctx->state[1] = SHA1_H1;
80-
sctx->state[2] = SHA1_H2;
81-
sctx->state[3] = SHA1_H3;
82-
sctx->state[4] = SHA1_H4;
83-
sctx->count = 0;
84-
85-
return 0;
86-
}
87-
8875
static void __octeon_sha1_update(struct sha1_state *sctx, const u8 *data,
8976
unsigned int len)
9077
{
@@ -200,7 +187,7 @@ static int octeon_sha1_import(struct shash_desc *desc, const void *in)
200187

201188
static struct shash_alg octeon_sha1_alg = {
202189
.digestsize = SHA1_DIGEST_SIZE,
203-
.init = octeon_sha1_init,
190+
.init = sha1_base_init,
204191
.update = octeon_sha1_update,
205192
.final = octeon_sha1_final,
206193
.export = octeon_sha1_export,

arch/mips/cavium-octeon/crypto/octeon-sha256.c

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <linux/mm.h>
1818
#include <crypto/sha2.h>
19+
#include <crypto/sha256_base.h>
1920
#include <linux/init.h>
2021
#include <linux/types.h>
2122
#include <linux/module.h>
@@ -63,40 +64,6 @@ static void octeon_sha256_transform(const void *_block)
6364
octeon_sha256_start(block[7]);
6465
}
6566

66-
static int octeon_sha224_init(struct shash_desc *desc)
67-
{
68-
struct sha256_state *sctx = shash_desc_ctx(desc);
69-
70-
sctx->state[0] = SHA224_H0;
71-
sctx->state[1] = SHA224_H1;
72-
sctx->state[2] = SHA224_H2;
73-
sctx->state[3] = SHA224_H3;
74-
sctx->state[4] = SHA224_H4;
75-
sctx->state[5] = SHA224_H5;
76-
sctx->state[6] = SHA224_H6;
77-
sctx->state[7] = SHA224_H7;
78-
sctx->count = 0;
79-
80-
return 0;
81-
}
82-
83-
static int octeon_sha256_init(struct shash_desc *desc)
84-
{
85-
struct sha256_state *sctx = shash_desc_ctx(desc);
86-
87-
sctx->state[0] = SHA256_H0;
88-
sctx->state[1] = SHA256_H1;
89-
sctx->state[2] = SHA256_H2;
90-
sctx->state[3] = SHA256_H3;
91-
sctx->state[4] = SHA256_H4;
92-
sctx->state[5] = SHA256_H5;
93-
sctx->state[6] = SHA256_H6;
94-
sctx->state[7] = SHA256_H7;
95-
sctx->count = 0;
96-
97-
return 0;
98-
}
99-
10067
static void __octeon_sha256_update(struct sha256_state *sctx, const u8 *data,
10168
unsigned int len)
10269
{
@@ -224,7 +191,7 @@ static int octeon_sha256_import(struct shash_desc *desc, const void *in)
224191

225192
static struct shash_alg octeon_sha256_algs[2] = { {
226193
.digestsize = SHA256_DIGEST_SIZE,
227-
.init = octeon_sha256_init,
194+
.init = sha256_base_init,
228195
.update = octeon_sha256_update,
229196
.final = octeon_sha256_final,
230197
.export = octeon_sha256_export,
@@ -240,7 +207,7 @@ static struct shash_alg octeon_sha256_algs[2] = { {
240207
}
241208
}, {
242209
.digestsize = SHA224_DIGEST_SIZE,
243-
.init = octeon_sha224_init,
210+
.init = sha224_base_init,
244211
.update = octeon_sha256_update,
245212
.final = octeon_sha224_final,
246213
.descsize = sizeof(struct sha256_state),

arch/mips/cavium-octeon/crypto/octeon-sha512.c

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <linux/mm.h>
1717
#include <crypto/sha2.h>
18+
#include <crypto/sha512_base.h>
1819
#include <linux/init.h>
1920
#include <linux/types.h>
2021
#include <linux/module.h>
@@ -74,40 +75,6 @@ static void octeon_sha512_transform(const void *_block)
7475
octeon_sha512_start(block[15]);
7576
}
7677

77-
static int octeon_sha512_init(struct shash_desc *desc)
78-
{
79-
struct sha512_state *sctx = shash_desc_ctx(desc);
80-
81-
sctx->state[0] = SHA512_H0;
82-
sctx->state[1] = SHA512_H1;
83-
sctx->state[2] = SHA512_H2;
84-
sctx->state[3] = SHA512_H3;
85-
sctx->state[4] = SHA512_H4;
86-
sctx->state[5] = SHA512_H5;
87-
sctx->state[6] = SHA512_H6;
88-
sctx->state[7] = SHA512_H7;
89-
sctx->count[0] = sctx->count[1] = 0;
90-
91-
return 0;
92-
}
93-
94-
static int octeon_sha384_init(struct shash_desc *desc)
95-
{
96-
struct sha512_state *sctx = shash_desc_ctx(desc);
97-
98-
sctx->state[0] = SHA384_H0;
99-
sctx->state[1] = SHA384_H1;
100-
sctx->state[2] = SHA384_H2;
101-
sctx->state[3] = SHA384_H3;
102-
sctx->state[4] = SHA384_H4;
103-
sctx->state[5] = SHA384_H5;
104-
sctx->state[6] = SHA384_H6;
105-
sctx->state[7] = SHA384_H7;
106-
sctx->count[0] = sctx->count[1] = 0;
107-
108-
return 0;
109-
}
110-
11178
static void __octeon_sha512_update(struct sha512_state *sctx, const u8 *data,
11279
unsigned int len)
11380
{
@@ -223,7 +190,7 @@ static int octeon_sha384_final(struct shash_desc *desc, u8 *hash)
223190

224191
static struct shash_alg octeon_sha512_algs[2] = { {
225192
.digestsize = SHA512_DIGEST_SIZE,
226-
.init = octeon_sha512_init,
193+
.init = sha512_base_init,
227194
.update = octeon_sha512_update,
228195
.final = octeon_sha512_final,
229196
.descsize = sizeof(struct sha512_state),
@@ -236,7 +203,7 @@ static struct shash_alg octeon_sha512_algs[2] = { {
236203
}
237204
}, {
238205
.digestsize = SHA384_DIGEST_SIZE,
239-
.init = octeon_sha384_init,
206+
.init = sha384_base_init,
240207
.update = octeon_sha512_update,
241208
.final = octeon_sha384_final,
242209
.descsize = sizeof(struct sha512_state),

arch/powerpc/crypto/sha1-spe-glue.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/mm.h>
1414
#include <linux/types.h>
1515
#include <crypto/sha1.h>
16+
#include <crypto/sha1_base.h>
1617
#include <asm/byteorder.h>
1718
#include <asm/switch_to.h>
1819
#include <linux/hardirq.h>
@@ -55,20 +56,6 @@ static inline void ppc_sha1_clear_context(struct sha1_state *sctx)
5556
do { *ptr++ = 0; } while (--count);
5657
}
5758

58-
static int ppc_spe_sha1_init(struct shash_desc *desc)
59-
{
60-
struct sha1_state *sctx = shash_desc_ctx(desc);
61-
62-
sctx->state[0] = SHA1_H0;
63-
sctx->state[1] = SHA1_H1;
64-
sctx->state[2] = SHA1_H2;
65-
sctx->state[3] = SHA1_H3;
66-
sctx->state[4] = SHA1_H4;
67-
sctx->count = 0;
68-
69-
return 0;
70-
}
71-
7259
static int ppc_spe_sha1_update(struct shash_desc *desc, const u8 *data,
7360
unsigned int len)
7461
{
@@ -168,7 +155,7 @@ static int ppc_spe_sha1_import(struct shash_desc *desc, const void *in)
168155

169156
static struct shash_alg alg = {
170157
.digestsize = SHA1_DIGEST_SIZE,
171-
.init = ppc_spe_sha1_init,
158+
.init = sha1_base_init,
172159
.update = ppc_spe_sha1_update,
173160
.final = ppc_spe_sha1_final,
174161
.export = ppc_spe_sha1_export,

arch/powerpc/crypto/sha1.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,11 @@
1818
#include <linux/mm.h>
1919
#include <linux/types.h>
2020
#include <crypto/sha1.h>
21+
#include <crypto/sha1_base.h>
2122
#include <asm/byteorder.h>
2223

2324
void powerpc_sha_transform(u32 *state, const u8 *src);
2425

25-
static int powerpc_sha1_init(struct shash_desc *desc)
26-
{
27-
struct sha1_state *sctx = shash_desc_ctx(desc);
28-
29-
*sctx = (struct sha1_state){
30-
.state = { SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 },
31-
};
32-
33-
return 0;
34-
}
35-
3626
static int powerpc_sha1_update(struct shash_desc *desc, const u8 *data,
3727
unsigned int len)
3828
{
@@ -114,7 +104,7 @@ static int powerpc_sha1_import(struct shash_desc *desc, const void *in)
114104

115105
static struct shash_alg alg = {
116106
.digestsize = SHA1_DIGEST_SIZE,
117-
.init = powerpc_sha1_init,
107+
.init = sha1_base_init,
118108
.update = powerpc_sha1_update,
119109
.final = powerpc_sha1_final,
120110
.export = powerpc_sha1_export,

arch/powerpc/crypto/sha256-spe-glue.c

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/mm.h>
1515
#include <linux/types.h>
1616
#include <crypto/sha2.h>
17+
#include <crypto/sha256_base.h>
1718
#include <asm/byteorder.h>
1819
#include <asm/switch_to.h>
1920
#include <linux/hardirq.h>
@@ -56,40 +57,6 @@ static inline void ppc_sha256_clear_context(struct sha256_state *sctx)
5657
do { *ptr++ = 0; } while (--count);
5758
}
5859

59-
static int ppc_spe_sha256_init(struct shash_desc *desc)
60-
{
61-
struct sha256_state *sctx = shash_desc_ctx(desc);
62-
63-
sctx->state[0] = SHA256_H0;
64-
sctx->state[1] = SHA256_H1;
65-
sctx->state[2] = SHA256_H2;
66-
sctx->state[3] = SHA256_H3;
67-
sctx->state[4] = SHA256_H4;
68-
sctx->state[5] = SHA256_H5;
69-
sctx->state[6] = SHA256_H6;
70-
sctx->state[7] = SHA256_H7;
71-
sctx->count = 0;
72-
73-
return 0;
74-
}
75-
76-
static int ppc_spe_sha224_init(struct shash_desc *desc)
77-
{
78-
struct sha256_state *sctx = shash_desc_ctx(desc);
79-
80-
sctx->state[0] = SHA224_H0;
81-
sctx->state[1] = SHA224_H1;
82-
sctx->state[2] = SHA224_H2;
83-
sctx->state[3] = SHA224_H3;
84-
sctx->state[4] = SHA224_H4;
85-
sctx->state[5] = SHA224_H5;
86-
sctx->state[6] = SHA224_H6;
87-
sctx->state[7] = SHA224_H7;
88-
sctx->count = 0;
89-
90-
return 0;
91-
}
92-
9360
static int ppc_spe_sha256_update(struct shash_desc *desc, const u8 *data,
9461
unsigned int len)
9562
{
@@ -214,7 +181,7 @@ static int ppc_spe_sha256_import(struct shash_desc *desc, const void *in)
214181

215182
static struct shash_alg algs[2] = { {
216183
.digestsize = SHA256_DIGEST_SIZE,
217-
.init = ppc_spe_sha256_init,
184+
.init = sha256_base_init,
218185
.update = ppc_spe_sha256_update,
219186
.final = ppc_spe_sha256_final,
220187
.export = ppc_spe_sha256_export,
@@ -230,7 +197,7 @@ static struct shash_alg algs[2] = { {
230197
}
231198
}, {
232199
.digestsize = SHA224_DIGEST_SIZE,
233-
.init = ppc_spe_sha224_init,
200+
.init = sha224_base_init,
234201
.update = ppc_spe_sha256_update,
235202
.final = ppc_spe_sha224_final,
236203
.export = ppc_spe_sha256_export,

arch/s390/crypto/sha512_s390.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ static int sha512_init(struct shash_desc *desc)
2222
{
2323
struct s390_sha_ctx *ctx = shash_desc_ctx(desc);
2424

25-
*(__u64 *)&ctx->state[0] = 0x6a09e667f3bcc908ULL;
26-
*(__u64 *)&ctx->state[2] = 0xbb67ae8584caa73bULL;
27-
*(__u64 *)&ctx->state[4] = 0x3c6ef372fe94f82bULL;
28-
*(__u64 *)&ctx->state[6] = 0xa54ff53a5f1d36f1ULL;
29-
*(__u64 *)&ctx->state[8] = 0x510e527fade682d1ULL;
30-
*(__u64 *)&ctx->state[10] = 0x9b05688c2b3e6c1fULL;
31-
*(__u64 *)&ctx->state[12] = 0x1f83d9abfb41bd6bULL;
32-
*(__u64 *)&ctx->state[14] = 0x5be0cd19137e2179ULL;
25+
*(__u64 *)&ctx->state[0] = SHA512_H0;
26+
*(__u64 *)&ctx->state[2] = SHA512_H1;
27+
*(__u64 *)&ctx->state[4] = SHA512_H2;
28+
*(__u64 *)&ctx->state[6] = SHA512_H3;
29+
*(__u64 *)&ctx->state[8] = SHA512_H4;
30+
*(__u64 *)&ctx->state[10] = SHA512_H5;
31+
*(__u64 *)&ctx->state[12] = SHA512_H6;
32+
*(__u64 *)&ctx->state[14] = SHA512_H7;
3333
ctx->count = 0;
3434
ctx->func = CPACF_KIMD_SHA_512;
3535

@@ -87,14 +87,14 @@ static int sha384_init(struct shash_desc *desc)
8787
{
8888
struct s390_sha_ctx *ctx = shash_desc_ctx(desc);
8989

90-
*(__u64 *)&ctx->state[0] = 0xcbbb9d5dc1059ed8ULL;
91-
*(__u64 *)&ctx->state[2] = 0x629a292a367cd507ULL;
92-
*(__u64 *)&ctx->state[4] = 0x9159015a3070dd17ULL;
93-
*(__u64 *)&ctx->state[6] = 0x152fecd8f70e5939ULL;
94-
*(__u64 *)&ctx->state[8] = 0x67332667ffc00b31ULL;
95-
*(__u64 *)&ctx->state[10] = 0x8eb44a8768581511ULL;
96-
*(__u64 *)&ctx->state[12] = 0xdb0c2e0d64f98fa7ULL;
97-
*(__u64 *)&ctx->state[14] = 0x47b5481dbefa4fa4ULL;
90+
*(__u64 *)&ctx->state[0] = SHA384_H0;
91+
*(__u64 *)&ctx->state[2] = SHA384_H1;
92+
*(__u64 *)&ctx->state[4] = SHA384_H2;
93+
*(__u64 *)&ctx->state[6] = SHA384_H3;
94+
*(__u64 *)&ctx->state[8] = SHA384_H4;
95+
*(__u64 *)&ctx->state[10] = SHA384_H5;
96+
*(__u64 *)&ctx->state[12] = SHA384_H6;
97+
*(__u64 *)&ctx->state[14] = SHA384_H7;
9898
ctx->count = 0;
9999
ctx->func = CPACF_KIMD_SHA_512;
100100

0 commit comments

Comments
 (0)