projects/linux·commit 37dc7956

Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

37dc7956 · Linus Torvalds <[email protected]> · 2017-11-14 10:52:09 -08:00

Pull crypto updates from Herbert Xu:
 "Here is the crypto update for 4.15:

  API:

   - Disambiguate EBUSY when queueing crypto request by adding ENOSPC.
     This change touches code outside the crypto API.
   - Reset settings when empty string is written to rng_current.

  Algorithms:

   - Add OSCCA SM3 secure hash.

  Drivers:

   - Remove old mv_cesa driver (replaced by marvell/cesa).
   - Enable rfc3686/ecb/cfb/ofb AES in crypto4xx.
   - Add ccm/gcm AES in crypto4xx.
   - Add support for BCM7278 in iproc-rng200.
   - Add hash support on Exynos in s5p-sss.
   - Fix fallback-induced error in vmx.
   - Fix output IV in atmel-aes.
   - Fix empty GCM hash in mediatek.

  Others:

   - Fix DoS potential in lib/mpi.
   - Fix potential out-of-order issues with padata"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (162 commits)
  lib/mpi: call cond_resched() from mpi_powm() loop
  crypto: stm32/hash - Fix return issue on update
  crypto: dh - Remove pointless checks for NULL 'p' and 'g'
  crypto: qat - Clean up error handling in qat_dh_set_secret()
  crypto: dh - Don't permit 'key' or 'g' size longer than 'p'
  crypto: dh - Don't permit 'p' to be 0
  crypto: dh - Fix double free of ctx->p
  hwrng: iproc-rng200 - Add support for BCM7278
  dt-bindings: rng: Document BCM7278 RNG200 compatible
  crypto: chcr - Replace _manual_ swap with swap macro
  crypto: marvell - Add a NULL entry at the end of mv_cesa_plat_id_table[]
  hwrng: virtio - Virtio RNG devices need to be re-registered after suspend/resume
  crypto: atmel - remove empty functions
  crypto: ecdh - remove empty exit()
  MAINTAINERS: update maintainer for qat
  crypto: caam - remove unused param of ctx_map_to_sec4_sg()
  crypto: caam - remove unneeded edesc zeroization
  crypto: atmel-aes - Reset the controller before each use
  crypto: atmel-aes - properly set IV after {en,de}crypt
  hwrng: core - Reset user selected rng by writing "" to rng_current
  ...
Commit
37dc79565c4b7e735f190eaa6ed5bb6eb3d3968a
Parents
894025f2 · 1d9ddde1

Merge commit. Changes below are compared with the first parent: 894025f2.

Changes

135 files changed · +5701 −4648

FileStatusAddDelContent
Documentation/crypto/api-samples.rstmodified+10−42View file
Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt → Documentation/devicetree/bindings/crypto/samsung,exynos-rng4.txtrenamed+0−0View file
Documentation/devicetree/bindings/rng/brcm,iproc-rng200.txtmodified+3−1View file
MAINTAINERSmodified+2−3View file
arch/arm/configs/dove_defconfigmodified+1−1View file
arch/arm/configs/multi_v5_defconfigmodified+1−1View file
arch/arm/configs/orion5x_defconfigmodified+1−1View file
arch/x86/crypto/aesni-intel_glue.cmodified+6−4View file
arch/x86/crypto/crc32-pclmul_asm.Smodified+6−11View file
crypto/Kconfigmodified+11−0View file
crypto/Makefilemodified+1−0View file
crypto/af_alg.cmodified+0−27View file
crypto/ahash.cmodified+3−9View file
crypto/algapi.cmodified+4−2View file
crypto/algboss.cmodified+0−1View file
crypto/algif_aead.cmodified+4−4View file
crypto/algif_hash.cmodified+14−16View file
crypto/algif_skcipher.cmodified+4−5View file
crypto/api.cmodified+13−0View file
crypto/asymmetric_keys/public_key.cmodified+4−24View file
crypto/cryptd.cmodified+1−3View file
crypto/cts.cmodified+2−4View file
crypto/dh.cmodified+13−23View file
crypto/dh_helper.cmodified+18−2View file
crypto/drbg.cmodified+9−27View file
crypto/ecdh.cmodified+0−6View file
crypto/ecdh_helper.cmodified+1−1View file
crypto/gcm.cmodified+18−37View file
crypto/gf128mul.cmodified+13−0View file
crypto/keywrap.cmodified+26−58View file
crypto/lrw.cmodified+8−9View file
crypto/rmd128.cmodified+0−2View file
crypto/rmd160.cmodified+0−2View file
crypto/rmd256.cmodified+0−2View file
crypto/rmd320.cmodified+0−2View file
crypto/rsa-pkcs1pad.cmodified+4−12View file
crypto/sm3_generic.cadded+210−0View file
crypto/tcrypt.cmodified+91−118View file
crypto/testmgr.cmodified+72−138View file
crypto/testmgr.hmodified+67−0View file
crypto/xts.cmodified+2−6View file
drivers/char/hw_random/Kconfigmodified+3−3View file
drivers/char/hw_random/core.cmodified+33−20View file
drivers/char/hw_random/iproc-rng200.cmodified+1−0View file
drivers/char/hw_random/pseries-rng.cmodified+1−1View file
drivers/char/hw_random/timeriomem-rng.cmodified+0−7View file
drivers/char/hw_random/virtio-rng.cmodified+20−1View file
drivers/crypto/Kconfigmodified+21−19View file
drivers/crypto/Makefilemodified+0−1View file
drivers/crypto/amcc/Makefilemodified+1−1View file
drivers/crypto/amcc/crypto4xx_alg.cmodified+438−74View file
drivers/crypto/amcc/crypto4xx_core.cmodified+476−355View file
drivers/crypto/amcc/crypto4xx_core.hmodified+118−81View file
drivers/crypto/amcc/crypto4xx_reg_def.hmodified+3−0View file
drivers/crypto/amcc/crypto4xx_sa.cdeleted+0−85View before deletion
drivers/crypto/amcc/crypto4xx_sa.hmodified+87−12View file
drivers/crypto/atmel-aes.cmodified+44−36View file
drivers/crypto/atmel-sha.cmodified+1−4View file
drivers/crypto/atmel-tdes.cmodified+1−22View file
drivers/crypto/bcm/cipher.cmodified+52−64View file
drivers/crypto/bcm/cipher.hmodified+1−2View file
drivers/crypto/bcm/util.cmodified+7−7View file
drivers/crypto/caam/caamalg.cmodified+5−5View file
drivers/crypto/caam/caamalg_qi.cmodified+6−1View file
drivers/crypto/caam/caamhash.cmodified+4−8View file
drivers/crypto/caam/compat.hmodified+1−0View file
drivers/crypto/caam/desc.hmodified+1−1View file
drivers/crypto/cavium/nitrox/nitrox_hal.cmodified+1−1View file
drivers/crypto/ccp/ccp-crypto-aes-galois.cmodified+4−5View file
drivers/crypto/ccp/ccp-crypto-main.cmodified+3−5View file
drivers/crypto/ccp/ccp-dev-v5.cmodified+1−2View file
drivers/crypto/ccp/ccp-dev.cmodified+5−2View file
drivers/crypto/ccp/ccp-dmaengine.cmodified+2−3View file
drivers/crypto/chelsio/chcr_algo.cmodified+1045−753View file
drivers/crypto/chelsio/chcr_algo.hmodified+15−42View file
drivers/crypto/chelsio/chcr_core.cmodified+5−5View file
drivers/crypto/chelsio/chcr_core.hmodified+1−1View file
drivers/crypto/chelsio/chcr_crypto.hmodified+86−35View file
drivers/crypto/inside-secure/safexcel_hash.cmodified+2−4View file
drivers/crypto/ixp4xx_crypto.cmodified+0−1View file
drivers/crypto/marvell/cesa.cmodified+13−16View file
drivers/crypto/marvell/cesa.hmodified+14−13View file
drivers/crypto/marvell/cipher.cmodified+233−243View file
drivers/crypto/marvell/tdma.cmodified+1−4View file
drivers/crypto/mediatek/mtk-aes.cmodified+12−27View file
drivers/crypto/mv_cesa.cdeleted+0−1216View before deletion
drivers/crypto/mv_cesa.hdeleted+0−151View before deletion
drivers/crypto/n2_core.cmodified+4−8View file
drivers/crypto/nx/nx-842-pseries.cmodified+1−1View file
drivers/crypto/nx/nx-aes-gcm.cmodified+5−4View file
drivers/crypto/nx/nx.cmodified+1−1View file
drivers/crypto/omap-aes-gcm.cmodified+6−5View file
drivers/crypto/omap-aes.cmodified+5−7View file
drivers/crypto/omap-des.cmodified+2−5View file
drivers/crypto/omap-sham.cmodified+2−5View file
drivers/crypto/padlock-aes.cmodified+1−1View file
drivers/crypto/padlock-sha.cmodified+1−1View file
drivers/crypto/qat/qat_common/adf_dev_mgr.cmodified+0−3View file
drivers/crypto/qat/qat_common/qat_asym_algs.cmodified+8−10View file
drivers/crypto/qat/qat_common/qat_uclo.cmodified+9−6View file
drivers/crypto/qce/ablkcipher.cmodified+1−4View file
drivers/crypto/qce/sha.cmodified+4−26View file
drivers/crypto/s5p-sss.cmodified+1491−105View file
drivers/crypto/stm32/stm32-hash.cmodified+5−15View file
drivers/crypto/talitos.cmodified+356−226View file
drivers/crypto/talitos.hmodified+5−2View file
drivers/crypto/ux500/cryp/cryp_core.cmodified+0−1View file
drivers/crypto/virtio/virtio_crypto_algs.cmodified+1−1View file
drivers/crypto/vmx/aes_ctr.cmodified+17−16View file
drivers/md/dm-verity-target.cmodified+20−61View file
drivers/md/dm-verity.hmodified+0−5View file
drivers/net/ethernet/chelsio/cxgb4/sge.cmodified+7−1View file
fs/cifs/smb2ops.cmodified+4−26View file
fs/crypto/crypto.cmodified+4−24View file
fs/crypto/fname.cmodified+6−30View file
fs/crypto/fscrypt_private.hmodified+0−10View file
fs/crypto/keyinfo.cmodified+3−18View file
include/crypto/dh.hmodified+1−1View file
include/crypto/drbg.hmodified+1−2View file
include/crypto/ecdh.hmodified+1−1View file
include/crypto/gcm.hadded+8−0View file
include/crypto/gf128mul.hmodified+1−1View file
include/crypto/hash.hmodified+16−12View file
include/crypto/if_alg.hmodified+1−14View file
include/crypto/sm3.hadded+40−0View file
include/crypto/sm3_base.hadded+117−0View file
include/linux/crypto.hmodified+40−0View file
include/linux/padata.hmodified+4−0View file
kernel/padata.cmodified+68−3View file
lib/mpi/mpi-pow.cmodified+2−0View file
net/ipv4/ah4.cmodified+1−1View file
net/ipv4/esp4.cmodified+1−1View file
net/ipv6/ah6.cmodified+1−1View file
net/ipv6/esp6.cmodified+1−1View file
security/integrity/ima/ima_crypto.cmodified+17−39View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/crypto/api-samples.rst

View file
diff --git a/Documentation/crypto/api-samples.rst b/Documentation/crypto/api-samples.rst
index 2531948..006827e 100644
--- a/Documentation/crypto/api-samples.rst
+++ b/Documentation/crypto/api-samples.rst
@@ -7,59 +7,27 @@ Code Example For Symmetric Key Cipher Operation
::
- struct tcrypt_result {
- struct completion completion;
- int err;
- };
-
/* tie all data structures together */
struct skcipher_def {
struct scatterlist sg;
struct crypto_skcipher *tfm;
struct skcipher_request *req;
- struct tcrypt_result result;
+ struct crypto_wait wait;
};
- /* Callback function */
- static void test_skcipher_cb(struct crypto_async_request *req, int error)
- {
- struct tcrypt_result *result = req->data;
-
- if (error == -EINPROGRESS)
- return;
- result->err = error;
- complete(&result->completion);
- pr_info("Encryption finished successfully\n");
- }
-
/* Perform cipher operation */
static unsigned int test_skcipher_encdec(struct skcipher_def *sk,
int enc)
{
- int rc = 0;
+ int rc;
if (enc)
- rc = crypto_skcipher_encrypt(sk->req);
+ rc = crypto_wait_req(crypto_skcipher_encrypt(sk->req), &sk->wait);
else
- rc = crypto_skcipher_decrypt(sk->req);
-
- switch (rc) {
- case 0:
- break;
- case -EINPROGRESS:
- case -EBUSY:
- rc = wait_for_completion_interruptible(
- &sk->result.completion);
- if (!rc && !sk->result.err) {
- reinit_completion(&sk->result.completion);
- break;
- }
- default:
- pr_info("skcipher encrypt returned with %d result %d\n",
- rc, sk->result.err);
- break;
- }
- init_completion(&sk->result.completion);
+ rc = crypto_wait_req(crypto_skcipher_decrypt(sk->req), &sk->wait);
+
+ if (rc)
+ pr_info("skcipher encrypt returned with result %d\n", rc);
return rc;
}
@@ -89,8 +57,8 @@ Code Example For Symmetric Key Cipher Operation
}
skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
- test_skcipher_cb,
- &sk.result);
+ crypto_req_done,
+ &sk.wait);
/* AES 256 with random key */
get_random_bytes(&key, 32);
@@ -122,7 +90,7 @@ Code Example For Symmetric Key Cipher Operation
/* We encrypt one block */
sg_init_one(&sk.sg, scratchpad, 16);
skcipher_request_set_crypt(req, &sk.sg, &sk.sg, 16, ivdata);
- init_completion(&sk.result.completion);
+ crypto_init_wait(&sk.wait);
/* encrypt data */
ret = test_skcipher_encdec(&sk, 1);

Documentation/devicetree/bindings/crypto/samsung,exynos-rng4.txt

View file
diff --git a/Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt b/Documentation/devicetree/bindings/crypto/samsung,exynos-rng4.txt
similarity index 100%
rename from Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt
rename to Documentation/devicetree/bindings/crypto/samsung,exynos-rng4.txt

Documentation/devicetree/bindings/rng/brcm,iproc-rng200.txt

View file
diff --git a/Documentation/devicetree/bindings/rng/brcm,iproc-rng200.txt b/Documentation/devicetree/bindings/rng/brcm,iproc-rng200.txt
index e25a456..0014da9 100644
--- a/Documentation/devicetree/bindings/rng/brcm,iproc-rng200.txt
+++ b/Documentation/devicetree/bindings/rng/brcm,iproc-rng200.txt
@@ -1,7 +1,9 @@
HWRNG support for the iproc-rng200 driver
Required properties:
-- compatible : "brcm,iproc-rng200"
+- compatible : Must be one of:
+ "brcm,bcm7278-rng200"
+ "brcm,iproc-rng200"
- reg : base address and size of control register block
Example:

MAINTAINERS

View file
diff --git a/MAINTAINERS b/MAINTAINERS
index 650aa0e..9a9343a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5484,7 +5484,7 @@ F: include/uapi/linux/fb.h
FREESCALE CAAM (Cryptographic Acceleration and Assurance Module) DRIVER
M: Horia Geantă <[email protected]>
-M: Dan Douglass <[email protected]>
+M: Aymen Sghaier <[email protected]>
S: Maintained
F: drivers/crypto/caam/
@@ -11060,7 +11060,6 @@ F: drivers/mtd/nand/pxa3xx_nand.c
QAT DRIVER
M: Giovanni Cabiddu <[email protected]>
-M: Salvatore Benedetto <[email protected]>
S: Supported
F: drivers/crypto/qat/
@@ -11793,7 +11792,7 @@ L: [email protected]
S: Maintained
F: drivers/crypto/exynos-rng.c
-F: Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt
+F: Documentation/devicetree/bindings/crypto/samsung,exynos-rng4.txt
SAMSUNG FRAMEBUFFER DRIVER
M: Jingoo Han <[email protected]>

arch/arm/configs/dove_defconfig

View file
diff --git a/arch/arm/configs/dove_defconfig b/arch/arm/configs/dove_defconfig
index a93cc2f..2f01e84 100644
--- a/arch/arm/configs/dove_defconfig
+++ b/arch/arm/configs/dove_defconfig
@@ -140,6 +140,6 @@ CONFIG_CRYPTO_TWOFISH=y
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_LZO=y
# CONFIG_CRYPTO_ANSI_CPRNG is not set
-CONFIG_CRYPTO_DEV_MV_CESA=y
+CONFIG_CRYPTO_DEV_MARVELL_CESA=y
CONFIG_CRC_CCITT=y
CONFIG_LIBCRC32C=y

arch/arm/configs/multi_v5_defconfig

View file
diff --git a/arch/arm/configs/multi_v5_defconfig b/arch/arm/configs/multi_v5_defconfig
index 69a4bd1..7c41bee 100644
--- a/arch/arm/configs/multi_v5_defconfig
+++ b/arch/arm/configs/multi_v5_defconfig
@@ -279,6 +279,6 @@ CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_USER=y
CONFIG_CRYPTO_CBC=m
CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_DEV_MV_CESA=y
+CONFIG_CRYPTO_DEV_MARVELL_CESA=y
CONFIG_CRC_CCITT=y
CONFIG_LIBCRC32C=y

arch/arm/configs/orion5x_defconfig

View file
diff --git a/arch/arm/configs/orion5x_defconfig b/arch/arm/configs/orion5x_defconfig
index e39ee28..b831bad 100644
--- a/arch/arm/configs/orion5x_defconfig
+++ b/arch/arm/configs/orion5x_defconfig
@@ -163,5 +163,5 @@ CONFIG_CRYPTO_CBC=m
CONFIG_CRYPTO_ECB=m
CONFIG_CRYPTO_PCBC=m
# CONFIG_CRYPTO_ANSI_CPRNG is not set
-CONFIG_CRYPTO_DEV_MV_CESA=y
+CONFIG_CRYPTO_DEV_MARVELL_CESA=y
CONFIG_CRC_T10DIF=y

arch/x86/crypto/aesni-intel_glue.c

View file
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
index 5c15d6b..3bf3dcf 100644
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ b/arch/x86/crypto/aesni-intel_glue.c
@@ -28,6 +28,7 @@
#include <crypto/cryptd.h>
#include <crypto/ctr.h>
#include <crypto/b128ops.h>
+#include <crypto/gcm.h>
#include <crypto/xts.h>
#include <asm/cpu_device_id.h>
#include <asm/fpu/api.h>
@@ -1067,9 +1068,10 @@ static struct skcipher_alg aesni_skciphers[] = {
}
};
+static
struct simd_skcipher_alg *aesni_simd_skciphers[ARRAY_SIZE(aesni_skciphers)];
-struct {
+static struct {
const char *algname;
const char *drvname;
const char *basename;
@@ -1131,7 +1133,7 @@ static struct aead_alg aesni_aead_algs[] = { {
.setauthsize = common_rfc4106_set_authsize,
.encrypt = helper_rfc4106_encrypt,
.decrypt = helper_rfc4106_decrypt,
- .ivsize = 8,
+ .ivsize = GCM_RFC4106_IV_SIZE,
.maxauthsize = 16,
.base = {
.cra_name = "__gcm-aes-aesni",
@@ -1149,7 +1151,7 @@ static struct aead_alg aesni_aead_algs[] = { {
.setauthsize = rfc4106_set_authsize,
.encrypt = rfc4106_encrypt,
.decrypt = rfc4106_decrypt,
- .ivsize = 8,
+ .ivsize = GCM_RFC4106_IV_SIZE,
.maxauthsize = 16,
.base = {
.cra_name = "rfc4106(gcm(aes))",
@@ -1165,7 +1167,7 @@ static struct aead_alg aesni_aead_algs[] = { {
.setauthsize = generic_gcmaes_set_authsize,
.encrypt = generic_gcmaes_encrypt,
.decrypt = generic_gcmaes_decrypt,
- .ivsize = 12,
+ .ivsize = GCM_AES_IV_SIZE,
.maxauthsize = 16,
.base = {
.cra_name = "gcm(aes)",

arch/x86/crypto/crc32-pclmul_asm.S

View file
diff --git a/arch/x86/crypto/crc32-pclmul_asm.S b/arch/x86/crypto/crc32-pclmul_asm.S
index f247304..1c099dc 100644
--- a/arch/x86/crypto/crc32-pclmul_asm.S
+++ b/arch/x86/crypto/crc32-pclmul_asm.S
@@ -41,6 +41,7 @@
#include <asm/inst.h>
+.section .rodata
.align 16
/*
* [x4*128+32 mod P(x) << 32)]' << 1 = 0x154442bd4
@@ -111,19 +112,13 @@ ENTRY(crc32_pclmul_le_16) /* buffer and buffer size are 16 bytes aligned */
pxor CONSTANT, %xmm1
sub $0x40, LEN
add $0x40, BUF
-#ifndef __x86_64__
- /* This is for position independent code(-fPIC) support for 32bit */
- call delta
-delta:
- pop %ecx
-#endif
cmp $0x40, LEN
jb less_64
#ifdef __x86_64__
movdqa .Lconstant_R2R1(%rip), CONSTANT
#else
- movdqa .Lconstant_R2R1 - delta(%ecx), CONSTANT
+ movdqa .Lconstant_R2R1, CONSTANT
#endif
loop_64:/* 64 bytes Full cache line folding */
@@ -172,7 +167,7 @@ less_64:/* Folding cache line into 128bit */
#ifdef __x86_64__
movdqa .Lconstant_R4R3(%rip), CONSTANT
#else
- movdqa .Lconstant_R4R3 - delta(%ecx), CONSTANT
+ movdqa .Lconstant_R4R3, CONSTANT
#endif
prefetchnta (BUF)
@@ -220,8 +215,8 @@ fold_64:
movdqa .Lconstant_R5(%rip), CONSTANT
movdqa .Lconstant_mask32(%rip), %xmm3
#else
- movdqa .Lconstant_R5 - delta(%ecx), CONSTANT
- movdqa .Lconstant_mask32 - delta(%ecx), %xmm3
+ movdqa .Lconstant_R5, CONSTANT
+ movdqa .Lconstant_mask32, %xmm3
#endif
psrldq $0x04, %xmm2
pand %xmm3, %xmm1
@@ -232,7 +227,7 @@ fold_64:
#ifdef __x86_64__
movdqa .Lconstant_RUpoly(%rip), CONSTANT
#else
- movdqa .Lconstant_RUpoly - delta(%ecx), CONSTANT
+ movdqa .Lconstant_RUpoly, CONSTANT
#endif
movdqa %xmm1, %xmm2
pand %xmm3, %xmm1

crypto/Kconfig

View file
diff --git a/crypto/Kconfig b/crypto/Kconfig
index ac5fb37..f791196 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -860,6 +860,17 @@ config CRYPTO_SHA3
References:
http://keccak.noekeon.org/
+config CRYPTO_SM3
+ tristate "SM3 digest algorithm"
+ select CRYPTO_HASH
+ help
+ SM3 secure hash function as defined by OSCCA GM/T 0004-2012 SM3).
+ It is part of the Chinese Commercial Cryptography suite.
+
+ References:
+ http://www.oscca.gov.cn/UpFile/20101222141857786.pdf
+ https://datatracker.ietf.org/doc/html/draft-shen-sm3-hash
+
config CRYPTO_TGR192
tristate "Tiger digest algorithms"
select CRYPTO_HASH

crypto/Makefile

View file
diff --git a/crypto/Makefile b/crypto/Makefile
index da190be..d674884 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -71,6 +71,7 @@ obj-$(CONFIG_CRYPTO_SHA1) += sha1_generic.o
obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o
obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o
obj-$(CONFIG_CRYPTO_SHA3) += sha3_generic.o
+obj-$(CONFIG_CRYPTO_SM3) += sm3_generic.o
obj-$(CONFIG_CRYPTO_WP512) += wp512.o
CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
obj-$(CONFIG_CRYPTO_TGR192) += tgr192.o

crypto/af_alg.c

View file
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 337cf38..85cea9d 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -481,33 +481,6 @@ int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con)
}
EXPORT_SYMBOL_GPL(af_alg_cmsg_send);
-int af_alg_wait_for_completion(int err, struct af_alg_completion *completion)
-{
- switch (err) {
- case -EINPROGRESS:
- case -EBUSY:
- wait_for_completion(&completion->completion);
- reinit_completion(&completion->completion);
- err = completion->err;
- break;
- };
-
- return err;
-}
-EXPORT_SYMBOL_GPL(af_alg_wait_for_completion);
-
-void af_alg_complete(struct crypto_async_request *req, int err)
-{
- struct af_alg_completion *completion = req->data;
-
- if (err == -EINPROGRESS)
- return;
-
- completion->err = err;
- complete(&completion->completion);
-}
-EXPORT_SYMBOL_GPL(af_alg_complete);
-
/**
* af_alg_alloc_tsgl - allocate the TX SGL
*

crypto/ahash.c

View file
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 5e8666e..3a35d67 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -334,9 +334,7 @@ static int ahash_op_unaligned(struct ahash_request *req,
return err;
err = op(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EBUSY)
return err;
ahash_restore_req(req, err);
@@ -394,9 +392,7 @@ static int ahash_def_finup_finish1(struct ahash_request *req, int err)
req->base.complete = ahash_def_finup_done2;
err = crypto_ahash_reqtfm(req)->final(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EBUSY)
return err;
out:
@@ -432,9 +428,7 @@ static int ahash_def_finup(struct ahash_request *req)
return err;
err = tfm->update(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EBUSY)
return err;
return ahash_def_finup_finish1(req, err);

crypto/algapi.c

View file
diff --git a/crypto/algapi.c b/crypto/algapi.c
index aa699ff..60d7366 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -897,9 +897,11 @@ int crypto_enqueue_request(struct crypto_queue *queue,
int err = -EINPROGRESS;
if (unlikely(queue->qlen >= queue->max_qlen)) {
- err = -EBUSY;
- if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) {
+ err = -ENOSPC;
goto out;
+ }
+ err = -EBUSY;
if (queue->backlog == &queue->list)
queue->backlog = &request->list;
}

crypto/algboss.c

View file
diff --git a/crypto/algboss.c b/crypto/algboss.c
index 960d854..5e6df2a 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -122,7 +122,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
int notnum = 0;
name = ++p;
- len = 0;
for (; isalnum(*p) || *p == '-' || *p == '_'; p++)
notnum |= !isdigit(*p);

crypto/algif_aead.c

View file
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
index 516b38c..aacae08 100644
--- a/crypto/algif_aead.c
+++ b/crypto/algif_aead.c
@@ -278,11 +278,11 @@ static int _aead_recvmsg(struct socket *sock, struct msghdr *msg,
/* Synchronous operation */
aead_request_set_callback(&areq->cra_u.aead_req,
CRYPTO_TFM_REQ_MAY_BACKLOG,
- af_alg_complete, &ctx->completion);
- err = af_alg_wait_for_completion(ctx->enc ?
+ crypto_req_done, &ctx->wait);
+ err = crypto_wait_req(ctx->enc ?
crypto_aead_encrypt(&areq->cra_u.aead_req) :
crypto_aead_decrypt(&areq->cra_u.aead_req),
- &ctx->completion);
+ &ctx->wait);
}
/* AIO operation in progress */
@@ -554,7 +554,7 @@ static int aead_accept_parent_nokey(void *private, struct sock *sk)
ctx->merge = 0;
ctx->enc = 0;
ctx->aead_assoclen = 0;
- af_alg_init_completion(&ctx->completion);
+ crypto_init_wait(&ctx->wait);
ask->private = ctx;

crypto/algif_hash.c

View file
diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index 5e92bd2..76d2e71 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -26,7 +26,7 @@ struct hash_ctx {
u8 *result;
- struct af_alg_completion completion;
+ struct crypto_wait wait;
unsigned int len;
bool more;
@@ -88,8 +88,7 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg,
if ((msg->msg_flags & MSG_MORE))
hash_free_result(sk, ctx);
- err = af_alg_wait_for_completion(crypto_ahash_init(&ctx->req),
- &ctx->completion);
+ err = crypto_wait_req(crypto_ahash_init(&ctx->req), &ctx->wait);
if (err)
goto unlock;
}
@@ -110,8 +109,8 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg,
ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, NULL, len);
- err = af_alg_wait_for_completion(crypto_ahash_update(&ctx->req),
- &ctx->completion);
+ err = crypto_wait_req(crypto_ahash_update(&ctx->req),
+ &ctx->wait);
af_alg_free_sg(&ctx->sgl);
if (err)
goto unlock;
@@ -129,8 +128,8 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg,
goto unlock;
ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0);
- err = af_alg_wait_for_completion(crypto_ahash_final(&ctx->req),
- &ctx->completion);
+ err = crypto_wait_req(crypto_ahash_final(&ctx->req),
+ &ctx->wait);
}
unlock:
@@ -171,7 +170,7 @@ static ssize_t hash_sendpage(struct socket *sock, struct page *page,
} else {
if (!ctx->more) {
err = crypto_ahash_init(&ctx->req);
- err = af_alg_wait_for_completion(err, &ctx->completion);
+ err = crypto_wait_req(err, &ctx->wait);
if (err)
goto unlock;
}
@@ -179,7 +178,7 @@ static ssize_t hash_sendpage(struct socket *sock, struct page *page,
err = crypto_ahash_update(&ctx->req);
}
- err = af_alg_wait_for_completion(err, &ctx->completion);
+ err = crypto_wait_req(err, &ctx->wait);
if (err)
goto unlock;
@@ -215,17 +214,16 @@ static int hash_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0);
if (!result && !ctx->more) {
- err = af_alg_wait_for_completion(
- crypto_ahash_init(&ctx->req),
- &ctx->completion);
+ err = crypto_wait_req(crypto_ahash_init(&ctx->req),
+ &ctx->wait);
if (err)
goto unlock;
}
if (!result || ctx->more) {
ctx->more = 0;
- err = af_alg_wait_for_completion(crypto_ahash_final(&ctx->req),
- &ctx->completion);
+ err = crypto_wait_req(crypto_ahash_final(&ctx->req),
+ &ctx->wait);
if (err)
goto unlock;
}
@@ -476,13 +474,13 @@ static int hash_accept_parent_nokey(void *private, struct sock *sk)
ctx->result = NULL;
ctx->len = len;
ctx->more = 0;
- af_alg_init_completion(&ctx->completion);
+ crypto_init_wait(&ctx->wait);
ask->private = ctx;
ahash_request_set_tfm(&ctx->req, hash);
ahash_request_set_callback(&ctx->req, CRYPTO_TFM_REQ_MAY_BACKLOG,
- af_alg_complete, &ctx->completion);
+ crypto_req_done, &ctx->wait);
sk->sk_destruct = hash_sock_destruct;

crypto/algif_skcipher.c

View file
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index 8ae4170..9954b07 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -129,12 +129,11 @@ static int _skcipher_recvmsg(struct socket *sock, struct msghdr *msg,
skcipher_request_set_callback(&areq->cra_u.skcipher_req,
CRYPTO_TFM_REQ_MAY_SLEEP |
CRYPTO_TFM_REQ_MAY_BACKLOG,
- af_alg_complete,
- &ctx->completion);
- err = af_alg_wait_for_completion(ctx->enc ?
+ crypto_req_done, &ctx->wait);
+ err = crypto_wait_req(ctx->enc ?
crypto_skcipher_encrypt(&areq->cra_u.skcipher_req) :
crypto_skcipher_decrypt(&areq->cra_u.skcipher_req),
- &ctx->completion);
+ &ctx->wait);
}
/* AIO operation in progress */
@@ -388,7 +387,7 @@ static int skcipher_accept_parent_nokey(void *private, struct sock *sk)
ctx->more = 0;
ctx->merge = 0;
ctx->enc = 0;
- af_alg_init_completion(&ctx->completion);
+ crypto_init_wait(&ctx->wait);
ask->private = ctx;

crypto/api.c

View file
diff --git a/crypto/api.c b/crypto/api.c
index 941cd4c..2a2479d 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -24,6 +24,7 @@
#include <linux/sched/signal.h>
#include <linux/slab.h>
#include <linux/string.h>
+#include <linux/completion.h>
#include "internal.h"
LIST_HEAD(crypto_alg_list);
@@ -595,5 +596,17 @@ int crypto_has_alg(const char *name, u32 type, u32 mask)
}
EXPORT_SYMBOL_GPL(crypto_has_alg);

This diff is incomplete. Download the complete patch.

crypto/asymmetric_keys/public_key.c

View file

This diff is incomplete. Download the complete patch.

crypto/cryptd.c

View file

This diff is incomplete. Download the complete patch.

crypto/cts.c

View file

This diff is incomplete. Download the complete patch.

crypto/dh.c

View file

This diff is incomplete. Download the complete patch.

crypto/dh_helper.c

View file

This diff is incomplete. Download the complete patch.

crypto/drbg.c

View file

This diff is incomplete. Download the complete patch.

crypto/ecdh.c

View file

This diff is incomplete. Download the complete patch.

crypto/ecdh_helper.c

View file

This diff is incomplete. Download the complete patch.

crypto/gcm.c

View file

This diff is incomplete. Download the complete patch.

crypto/gf128mul.c

View file

This diff is incomplete. Download the complete patch.

crypto/keywrap.c

View file

This diff is incomplete. Download the complete patch.

crypto/lrw.c

View file

This diff is incomplete. Download the complete patch.

crypto/rmd128.c

View file

This diff is incomplete. Download the complete patch.

crypto/rmd160.c

View file

This diff is incomplete. Download the complete patch.

crypto/rmd256.c

View file

This diff is incomplete. Download the complete patch.

crypto/rmd320.c

View file

This diff is incomplete. Download the complete patch.

crypto/rsa-pkcs1pad.c

View file

This diff is incomplete. Download the complete patch.

crypto/sm3_generic.c

View file

This diff is incomplete. Download the complete patch.

crypto/tcrypt.c

View file

This diff is incomplete. Download the complete patch.

crypto/testmgr.c

View file

This diff is incomplete. Download the complete patch.

crypto/testmgr.h

View file

This diff is incomplete. Download the complete patch.

crypto/xts.c

View file

This diff is incomplete. Download the complete patch.

drivers/char/hw_random/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/char/hw_random/core.c

View file

This diff is incomplete. Download the complete patch.

drivers/char/hw_random/iproc-rng200.c

View file

This diff is incomplete. Download the complete patch.

drivers/char/hw_random/pseries-rng.c

View file

This diff is incomplete. Download the complete patch.

drivers/char/hw_random/timeriomem-rng.c

View file

This diff is incomplete. Download the complete patch.

drivers/char/hw_random/virtio-rng.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/amcc/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/amcc/crypto4xx_alg.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/amcc/crypto4xx_core.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/amcc/crypto4xx_core.h

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/amcc/crypto4xx_reg_def.h

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/amcc/crypto4xx_sa.c

View before deletion

This diff is incomplete. Download the complete patch.

drivers/crypto/amcc/crypto4xx_sa.h

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/atmel-aes.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/atmel-sha.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/atmel-tdes.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/bcm/cipher.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/bcm/cipher.h

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/bcm/util.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/caam/caamalg.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/caam/caamalg_qi.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/caam/caamhash.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/caam/compat.h

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/caam/desc.h

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/cavium/nitrox/nitrox_hal.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/ccp/ccp-crypto-aes-galois.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/ccp/ccp-crypto-main.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/ccp/ccp-dev-v5.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/ccp/ccp-dev.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/ccp/ccp-dmaengine.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/chelsio/chcr_algo.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/chelsio/chcr_algo.h

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/chelsio/chcr_core.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/chelsio/chcr_core.h

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/chelsio/chcr_crypto.h

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/inside-secure/safexcel_hash.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/ixp4xx_crypto.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/marvell/cesa.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/marvell/cesa.h

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/marvell/cipher.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/marvell/tdma.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/mediatek/mtk-aes.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/mv_cesa.c

View before deletion

This diff is incomplete. Download the complete patch.

drivers/crypto/mv_cesa.h

View before deletion

This diff is incomplete. Download the complete patch.

drivers/crypto/n2_core.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/nx/nx-842-pseries.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/nx/nx-aes-gcm.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/nx/nx.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/omap-aes-gcm.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/omap-aes.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/omap-des.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/omap-sham.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/padlock-aes.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/padlock-sha.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/qat/qat_common/adf_dev_mgr.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/qat/qat_common/qat_asym_algs.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/qat/qat_common/qat_uclo.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/qce/ablkcipher.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/qce/sha.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/s5p-sss.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/stm32/stm32-hash.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/talitos.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/talitos.h

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/ux500/cryp/cryp_core.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/virtio/virtio_crypto_algs.c

View file

This diff is incomplete. Download the complete patch.

drivers/crypto/vmx/aes_ctr.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/dm-verity-target.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/dm-verity.h

View file

This diff is incomplete. Download the complete patch.

drivers/net/ethernet/chelsio/cxgb4/sge.c

View file

This diff is incomplete. Download the complete patch.

fs/cifs/smb2ops.c

View file

This diff is incomplete. Download the complete patch.

fs/crypto/crypto.c

View file

This diff is incomplete. Download the complete patch.

fs/crypto/fname.c

View file

This diff is incomplete. Download the complete patch.

fs/crypto/fscrypt_private.h

View file

This diff is incomplete. Download the complete patch.

fs/crypto/keyinfo.c

View file

This diff is incomplete. Download the complete patch.

include/crypto/dh.h

View file

This diff is incomplete. Download the complete patch.

include/crypto/drbg.h

View file

This diff is incomplete. Download the complete patch.

include/crypto/ecdh.h

View file

This diff is incomplete. Download the complete patch.

include/crypto/gcm.h

View file

This diff is incomplete. Download the complete patch.

include/crypto/gf128mul.h

View file

This diff is incomplete. Download the complete patch.

include/crypto/hash.h

View file

This diff is incomplete. Download the complete patch.

include/crypto/if_alg.h

View file

This diff is incomplete. Download the complete patch.

include/crypto/sm3.h

View file

This diff is incomplete. Download the complete patch.

include/crypto/sm3_base.h

View file

This diff is incomplete. Download the complete patch.

include/linux/crypto.h

View file

This diff is incomplete. Download the complete patch.

include/linux/padata.h

View file

This diff is incomplete. Download the complete patch.

kernel/padata.c

View file

This diff is incomplete. Download the complete patch.

lib/mpi/mpi-pow.c

View file

This diff is incomplete. Download the complete patch.

net/ipv4/ah4.c

View file

This diff is incomplete. Download the complete patch.

net/ipv4/esp4.c

View file

This diff is incomplete. Download the complete patch.

net/ipv6/ah6.c

View file

This diff is incomplete. Download the complete patch.

net/ipv6/esp6.c

View file

This diff is incomplete. Download the complete patch.

security/integrity/ima/ima_crypto.c

View file

This diff is incomplete. Download the complete patch.