Skip to content

Commit d8dc121

Browse files
committed
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: - Regression fix in drbg due to missing self-test for new default algorithm - Add ratelimit on user-triggerable message in qat - Fix build failure due to missing dependency in sl3516 - Remove obsolete PageSlab checks - Fix bogus hardware register writes on Kunpeng920 in hisilicon/sec * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: hisilicon/sec - fix the process of disabling sva prefetching crypto: sl3516 - Add dependency on ARCH_GEMINI crypto: sl3516 - Typo s/Stormlink/Storlink/ crypto: drbg - self test for HMAC(SHA-512) crypto: omap - Drop obsolete PageSlab check crypto: scatterwalk - Remove obsolete PageSlab check crypto: qat - ratelimit invalid ioctl message and print the invalid cmd
2 parents 9b76d71 + 66192b2 commit d8dc121

File tree

9 files changed

+64
-15
lines changed

9 files changed

+64
-15
lines changed

crypto/testmgr.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -4686,8 +4686,11 @@ static const struct alg_test_desc alg_test_descs[] = {
46864686
.test = alg_test_null,
46874687
}, {
46884688
.alg = "drbg_nopr_hmac_sha512",
4689-
.test = alg_test_null,
4689+
.test = alg_test_drbg,
46904690
.fips_allowed = 1,
4691+
.suite = {
4692+
.drbg = __VECS(drbg_nopr_hmac_sha512_tv_template)
4693+
}
46914694
}, {
46924695
.alg = "drbg_nopr_sha1",
46934696
.fips_allowed = 1,

crypto/testmgr.h

+49
Original file line numberDiff line numberDiff line change
@@ -21984,6 +21984,55 @@ static const struct drbg_testvec drbg_nopr_hmac_sha256_tv_template[] = {
2198421984
},
2198521985
};
2198621986

21987+
/* Test vector obtained during NIST ACVP testing */
21988+
static const struct drbg_testvec drbg_nopr_hmac_sha512_tv_template[] = {
21989+
{
21990+
.entropy = (unsigned char *)
21991+
"\xDF\xB0\xF2\x18\xF0\x78\x07\x01\x29\xA4\x29\x26"
21992+
"\x2F\x8A\x34\xCB\x37\xEF\xEE\x41\xE6\x96\xF7\xFF"
21993+
"\x61\x47\xD3\xED\x41\x97\xEF\x64\x0C\x48\x56\x5A"
21994+
"\xE6\x40\x6E\x4A\x3B\x9E\x7F\xAC\x08\xEC\x25\xAE"
21995+
"\x0B\x51\x0E\x2C\x44\x2E\xBD\xDB\x57\xD0\x4A\x6D"
21996+
"\x80\x3E\x37\x0F",
21997+
.entropylen = 64,
21998+
.expected = (unsigned char *)
21999+
"\x48\xc6\xa8\xdb\x09\xae\xde\x5d\x8c\x77\xf3\x52"
22000+
"\x92\x71\xa7\xb9\x6d\x53\x6d\xa3\x73\xe3\x55\xb8"
22001+
"\x39\xd6\x44\x2b\xee\xcb\xe1\x32\x15\x30\xbe\x4e"
22002+
"\x9b\x1e\x06\xd1\x6b\xbf\xd5\x3e\xea\x7c\xf5\xaa"
22003+
"\x4b\x05\xb5\xd3\xa7\xb2\xc4\xfe\xe7\x1b\xda\x11"
22004+
"\x43\x98\x03\x70\x90\xbf\x6e\x43\x9b\xe4\x14\xef"
22005+
"\x71\xa3\x2a\xef\x9f\x0d\xb9\xe3\x52\xf2\x89\xc9"
22006+
"\x66\x9a\x60\x60\x99\x60\x62\x4c\xd6\x45\x52\x54"
22007+
"\xe6\x32\xb2\x1b\xd4\x48\xb5\xa6\xf9\xba\xd3\xff"
22008+
"\x29\xc5\x21\xe0\x91\x31\xe0\x38\x8c\x93\x0f\x3c"
22009+
"\x30\x7b\x53\xa3\xc0\x7f\x2d\xc1\x39\xec\x69\x0e"
22010+
"\xf2\x4a\x3c\x65\xcc\xed\x07\x2a\xf2\x33\x83\xdb"
22011+
"\x10\x74\x96\x40\xa7\xc5\x1b\xde\x81\xca\x0b\x8f"
22012+
"\x1e\x0a\x1a\x7a\xbf\x3c\x4a\xb8\x8c\xaf\x7b\x80"
22013+
"\xb7\xdc\x5d\x0f\xef\x1b\x97\x6e\x3d\x17\x23\x5a"
22014+
"\x31\xb9\x19\xcf\x5a\xc5\x00\x2a\xb6\xf3\x99\x34"
22015+
"\x65\xee\xe9\x1c\x55\xa0\x3b\x07\x60\xc9\xc4\xe4"
22016+
"\xf7\x57\x5c\x34\x9f\xc6\x31\x30\x3f\x23\xb2\x89"
22017+
"\xc0\xe7\x50\xf3\xde\x59\xd1\x0e\xb3\x0f\x78\xcc"
22018+
"\x7e\x54\x5e\x61\xf6\x86\x3d\xb3\x11\x94\x36\x3e"
22019+
"\x61\x5c\x48\x99\xf6\x7b\x02\x9a\xdc\x6a\x28\xe6"
22020+
"\xd1\xa7\xd1\xa3",
22021+
.expectedlen = 256,
22022+
.addtla = (unsigned char *)
22023+
"\x6B\x0F\x4A\x48\x0B\x12\x85\xE4\x72\x23\x7F\x7F"
22024+
"\x94\x7C\x24\x69\x14\x9F\xDC\x72\xA6\x33\xAD\x3C"
22025+
"\x8C\x72\xC1\x88\x49\x59\x82\xC5",
22026+
.addtlb = (unsigned char *)
22027+
"\xC4\xAF\x36\x3D\xB8\x5D\x9D\xFA\x92\xF5\xC3\x3C"
22028+
"\x2D\x1E\x22\x2A\xBD\x8B\x05\x6F\xA3\xFC\xBF\x16"
22029+
"\xED\xAA\x75\x8D\x73\x9A\xF6\xEC",
22030+
.addtllen = 32,
22031+
.pers = NULL,
22032+
.perslen = 0,
22033+
}
22034+
};
22035+
2198722036
static const struct drbg_testvec drbg_nopr_ctr_aes192_tv_template[] = {
2198822037
{
2198922038
.entropy = (unsigned char *)

drivers/crypto/Kconfig

+3-3
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,14 @@ config CRYPTO_DEV_NIAGARA2
267267
checksumming, and raw copies.
268268

269269
config CRYPTO_DEV_SL3516
270-
tristate "Stormlink SL3516 crypto offloader"
271-
depends on HAS_IOMEM
270+
tristate "Storlink SL3516 crypto offloader"
271+
depends on ARCH_GEMINI || COMPILE_TEST
272+
depends on HAS_IOMEM && PM
272273
select CRYPTO_SKCIPHER
273274
select CRYPTO_ENGINE
274275
select CRYPTO_ECB
275276
select CRYPTO_AES
276277
select HW_RANDOM
277-
depends on PM
278278
help
279279
This option allows you to have support for SL3516 crypto offloader.
280280

drivers/crypto/gemini/sl3516-ce-cipher.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/*
3-
* sl3516-ce-cipher.c - hardware cryptographic offloader for Stormlink SL3516 SoC
3+
* sl3516-ce-cipher.c - hardware cryptographic offloader for Storlink SL3516 SoC
44
*
55
* Copyright (C) 2021 Corentin LABBE <[email protected]>
66
*

drivers/crypto/gemini/sl3516-ce-core.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/*
3-
* sl3516-ce-core.c - hardware cryptographic offloader for Stormlink SL3516 SoC
3+
* sl3516-ce-core.c - hardware cryptographic offloader for Storlink SL3516 SoC
44
*
55
* Copyright (C) 2021 Corentin Labbe <[email protected]>
66
*

drivers/crypto/hisilicon/sec2/sec_main.c

+3
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,9 @@ static void sec_close_sva_prefetch(struct hisi_qm *qm)
364364
u32 val;
365365
int ret;
366366

367+
if (qm->ver < QM_HW_V3)
368+
return;
369+
367370
val = readl_relaxed(qm->io_base + SEC_PREFETCH_CFG);
368371
val |= SEC_PREFETCH_DISABLE;
369372
writel(val, qm->io_base + SEC_PREFETCH_CFG);

drivers/crypto/omap-crypto.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ static void omap_crypto_copy_data(struct scatterlist *src,
183183

184184
memcpy(dstb, srcb, amt);
185185

186-
if (!PageSlab(sg_page(dst)))
187-
flush_kernel_dcache_page(sg_page(dst));
186+
flush_dcache_page(sg_page(dst));
188187

189188
kunmap_atomic(srcb);
190189
kunmap_atomic(dstb);

drivers/crypto/qat/qat_common/adf_ctl_drv.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ static long adf_ctl_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
406406
ret = adf_ctl_ioctl_get_status(fp, cmd, arg);
407407
break;
408408
default:
409-
pr_err("QAT: Invalid ioctl\n");
409+
pr_err_ratelimited("QAT: Invalid ioctl %d\n", cmd);
410410
ret = -EFAULT;
411411
break;
412412
}

include/crypto/scatterwalk.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,7 @@ static inline void scatterwalk_pagedone(struct scatter_walk *walk, int out,
8181
struct page *page;
8282

8383
page = sg_page(walk->sg) + ((walk->offset - 1) >> PAGE_SHIFT);
84-
/* Test ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE first as
85-
* PageSlab cannot be optimised away per se due to
86-
* use of volatile pointer.
87-
*/
88-
if (ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE && !PageSlab(page))
89-
flush_dcache_page(page);
84+
flush_dcache_page(page);
9085
}
9186

9287
if (more && walk->offset >= walk->sg->offset + walk->sg->length)

0 commit comments

Comments
 (0)