diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-16 16:37:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-16 16:37:26 -0400 |
commit | ae5d68be42cd0275a91faf56d2b527b448c3caf4 (patch) | |
tree | a0a812a082e9cfcabcd797ce707fe49e23fab919 | |
parent | c39378fc65cc83a65e8aed958bcbd18c113c6a74 (diff) | |
parent | a0118c8b2be9297aed8e915c60b4013326b256d4 (diff) |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu:
"This fixes the following issues:
- Missing ULL suffixes for 64-bit constants in sha3.
- Two caam AEAD regressions.
- Bogus setkey hooks in non-hmac caam hashes.
- Missing kbuild dependency for powerpc crc32c"
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: caam - fix non-hmac hashes
crypto: powerpc - CRYPT_CRC32C_VPMSUM should depend on ALTIVEC
crypto: caam - defer aead_set_sh_desc in case of zero authsize
crypto: caam - fix echainiv(authenc) encrypt shared descriptor
crypto: sha3 - Add missing ULL suffixes for 64-bit constants
-rw-r--r-- | crypto/Kconfig | 2 | ||||
-rw-r--r-- | crypto/sha3_generic.c | 16 | ||||
-rw-r--r-- | drivers/crypto/caam/caamalg.c | 13 | ||||
-rw-r--r-- | drivers/crypto/caam/caamhash.c | 1 |
4 files changed, 18 insertions, 14 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig index a9377bef25e3..84d71482bf08 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
@@ -439,7 +439,7 @@ config CRYPTO_CRC32C_INTEL | |||
439 | 439 | ||
440 | config CRYPT_CRC32C_VPMSUM | 440 | config CRYPT_CRC32C_VPMSUM |
441 | tristate "CRC32c CRC algorithm (powerpc64)" | 441 | tristate "CRC32c CRC algorithm (powerpc64)" |
442 | depends on PPC64 | 442 | depends on PPC64 && ALTIVEC |
443 | select CRYPTO_HASH | 443 | select CRYPTO_HASH |
444 | select CRC32 | 444 | select CRC32 |
445 | help | 445 | help |
diff --git a/crypto/sha3_generic.c b/crypto/sha3_generic.c index 62264397a2d2..7e8ed96236ce 100644 --- a/crypto/sha3_generic.c +++ b/crypto/sha3_generic.c | |||
@@ -24,14 +24,14 @@ | |||
24 | #define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y)))) | 24 | #define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y)))) |
25 | 25 | ||
26 | static const u64 keccakf_rndc[24] = { | 26 | static const u64 keccakf_rndc[24] = { |
27 | 0x0000000000000001, 0x0000000000008082, 0x800000000000808a, | 27 | 0x0000000000000001ULL, 0x0000000000008082ULL, 0x800000000000808aULL, |
28 | 0x8000000080008000, 0x000000000000808b, 0x0000000080000001, | 28 | 0x8000000080008000ULL, 0x000000000000808bULL, 0x0000000080000001ULL, |
29 | 0x8000000080008081, 0x8000000000008009, 0x000000000000008a, | 29 | 0x8000000080008081ULL, 0x8000000000008009ULL, 0x000000000000008aULL, |
30 | 0x0000000000000088, 0x0000000080008009, 0x000000008000000a, | 30 | 0x0000000000000088ULL, 0x0000000080008009ULL, 0x000000008000000aULL, |
31 | 0x000000008000808b, 0x800000000000008b, 0x8000000000008089, | 31 | 0x000000008000808bULL, 0x800000000000008bULL, 0x8000000000008089ULL, |
32 | 0x8000000000008003, 0x8000000000008002, 0x8000000000000080, | 32 | 0x8000000000008003ULL, 0x8000000000008002ULL, 0x8000000000000080ULL, |
33 | 0x000000000000800a, 0x800000008000000a, 0x8000000080008081, | 33 | 0x000000000000800aULL, 0x800000008000000aULL, 0x8000000080008081ULL, |
34 | 0x8000000000008080, 0x0000000080000001, 0x8000000080008008 | 34 | 0x8000000000008080ULL, 0x0000000080000001ULL, 0x8000000080008008ULL |
35 | }; | 35 | }; |
36 | 36 | ||
37 | static const int keccakf_rotc[24] = { | 37 | static const int keccakf_rotc[24] = { |
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index ea8189f4b021..6dc597126b79 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
@@ -441,6 +441,9 @@ static int aead_set_sh_desc(struct crypto_aead *aead) | |||
441 | OP_ALG_AAI_CTR_MOD128); | 441 | OP_ALG_AAI_CTR_MOD128); |
442 | const bool is_rfc3686 = alg->caam.rfc3686; | 442 | const bool is_rfc3686 = alg->caam.rfc3686; |
443 | 443 | ||
444 | if (!ctx->authsize) | ||
445 | return 0; | ||
446 | |||
444 | /* NULL encryption / decryption */ | 447 | /* NULL encryption / decryption */ |
445 | if (!ctx->enckeylen) | 448 | if (!ctx->enckeylen) |
446 | return aead_null_set_sh_desc(aead); | 449 | return aead_null_set_sh_desc(aead); |
@@ -614,7 +617,7 @@ skip_enc: | |||
614 | keys_fit_inline = true; | 617 | keys_fit_inline = true; |
615 | 618 | ||
616 | /* aead_givencrypt shared descriptor */ | 619 | /* aead_givencrypt shared descriptor */ |
617 | desc = ctx->sh_desc_givenc; | 620 | desc = ctx->sh_desc_enc; |
618 | 621 | ||
619 | /* Note: Context registers are saved. */ | 622 | /* Note: Context registers are saved. */ |
620 | init_sh_desc_key_aead(desc, ctx, keys_fit_inline, is_rfc3686); | 623 | init_sh_desc_key_aead(desc, ctx, keys_fit_inline, is_rfc3686); |
@@ -645,13 +648,13 @@ copy_iv: | |||
645 | append_operation(desc, ctx->class2_alg_type | | 648 | append_operation(desc, ctx->class2_alg_type | |
646 | OP_ALG_AS_INITFINAL | OP_ALG_ENCRYPT); | 649 | OP_ALG_AS_INITFINAL | OP_ALG_ENCRYPT); |
647 | 650 | ||
648 | /* ivsize + cryptlen = seqoutlen - authsize */ | ||
649 | append_math_sub_imm_u32(desc, REG3, SEQOUTLEN, IMM, ctx->authsize); | ||
650 | |||
651 | /* Read and write assoclen bytes */ | 651 | /* Read and write assoclen bytes */ |
652 | append_math_add(desc, VARSEQINLEN, ZERO, REG3, CAAM_CMD_SZ); | 652 | append_math_add(desc, VARSEQINLEN, ZERO, REG3, CAAM_CMD_SZ); |
653 | append_math_add(desc, VARSEQOUTLEN, ZERO, REG3, CAAM_CMD_SZ); | 653 | append_math_add(desc, VARSEQOUTLEN, ZERO, REG3, CAAM_CMD_SZ); |
654 | 654 | ||
655 | /* ivsize + cryptlen = seqoutlen - authsize */ | ||
656 | append_math_sub_imm_u32(desc, REG3, SEQOUTLEN, IMM, ctx->authsize); | ||
657 | |||
655 | /* Skip assoc data */ | 658 | /* Skip assoc data */ |
656 | append_seq_fifo_store(desc, 0, FIFOST_TYPE_SKIP | FIFOLDST_VLF); | 659 | append_seq_fifo_store(desc, 0, FIFOST_TYPE_SKIP | FIFOLDST_VLF); |
657 | 660 | ||
@@ -697,7 +700,7 @@ copy_iv: | |||
697 | ctx->sh_desc_enc_dma = dma_map_single(jrdev, desc, | 700 | ctx->sh_desc_enc_dma = dma_map_single(jrdev, desc, |
698 | desc_bytes(desc), | 701 | desc_bytes(desc), |
699 | DMA_TO_DEVICE); | 702 | DMA_TO_DEVICE); |
700 | if (dma_mapping_error(jrdev, ctx->sh_desc_givenc_dma)) { | 703 | if (dma_mapping_error(jrdev, ctx->sh_desc_enc_dma)) { |
701 | dev_err(jrdev, "unable to map shared descriptor\n"); | 704 | dev_err(jrdev, "unable to map shared descriptor\n"); |
702 | return -ENOMEM; | 705 | return -ENOMEM; |
703 | } | 706 | } |
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index f1ecc8df8d41..36365b3efdfd 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c | |||
@@ -1898,6 +1898,7 @@ caam_hash_alloc(struct caam_hash_template *template, | |||
1898 | template->name); | 1898 | template->name); |
1899 | snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", | 1899 | snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", |
1900 | template->driver_name); | 1900 | template->driver_name); |
1901 | t_alg->ahash_alg.setkey = NULL; | ||
1901 | } | 1902 | } |
1902 | alg->cra_module = THIS_MODULE; | 1903 | alg->cra_module = THIS_MODULE; |
1903 | alg->cra_init = caam_hash_cra_init; | 1904 | alg->cra_init = caam_hash_cra_init; |