aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-10-13 13:18:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-10-13 13:18:54 -0400
commit6006d4521b158e5ef48620e8c9028bba91bf985d (patch)
tree0513b2a3acb5c536fc815a2c6055f1ee2af7a341
parent75542253127d4e4003a5542189c53ff85e4b27b2 (diff)
parent8996eafdcbad149ac0f772fb1649fbb75c482a6a (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: "This fixes the following issues: - Fix AVX detection to prevent use of non-existent AESNI. - Some SPARC ciphers did not set their IV size which may lead to memory corruption" * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: ahash - ensure statesize is non-zero crypto: camellia_aesni_avx - Fix CPU feature checks crypto: sparc - initialize blkcipher.ivsize
-rw-r--r--arch/sparc/crypto/aes_glue.c2
-rw-r--r--arch/sparc/crypto/camellia_glue.c1
-rw-r--r--arch/sparc/crypto/des_glue.c2
-rw-r--r--arch/x86/crypto/camellia_aesni_avx_glue.c5
-rw-r--r--crypto/ahash.c3
5 files changed, 12 insertions, 1 deletions
diff --git a/arch/sparc/crypto/aes_glue.c b/arch/sparc/crypto/aes_glue.c
index 2e48eb8813ff..c90930de76ba 100644
--- a/arch/sparc/crypto/aes_glue.c
+++ b/arch/sparc/crypto/aes_glue.c
@@ -433,6 +433,7 @@ static struct crypto_alg algs[] = { {
433 .blkcipher = { 433 .blkcipher = {
434 .min_keysize = AES_MIN_KEY_SIZE, 434 .min_keysize = AES_MIN_KEY_SIZE,
435 .max_keysize = AES_MAX_KEY_SIZE, 435 .max_keysize = AES_MAX_KEY_SIZE,
436 .ivsize = AES_BLOCK_SIZE,
436 .setkey = aes_set_key, 437 .setkey = aes_set_key,
437 .encrypt = cbc_encrypt, 438 .encrypt = cbc_encrypt,
438 .decrypt = cbc_decrypt, 439 .decrypt = cbc_decrypt,
@@ -452,6 +453,7 @@ static struct crypto_alg algs[] = { {
452 .blkcipher = { 453 .blkcipher = {
453 .min_keysize = AES_MIN_KEY_SIZE, 454 .min_keysize = AES_MIN_KEY_SIZE,
454 .max_keysize = AES_MAX_KEY_SIZE, 455 .max_keysize = AES_MAX_KEY_SIZE,
456 .ivsize = AES_BLOCK_SIZE,
455 .setkey = aes_set_key, 457 .setkey = aes_set_key,
456 .encrypt = ctr_crypt, 458 .encrypt = ctr_crypt,
457 .decrypt = ctr_crypt, 459 .decrypt = ctr_crypt,
diff --git a/arch/sparc/crypto/camellia_glue.c b/arch/sparc/crypto/camellia_glue.c
index 6bf2479a12fb..561a84d93cf6 100644
--- a/arch/sparc/crypto/camellia_glue.c
+++ b/arch/sparc/crypto/camellia_glue.c
@@ -274,6 +274,7 @@ static struct crypto_alg algs[] = { {
274 .blkcipher = { 274 .blkcipher = {
275 .min_keysize = CAMELLIA_MIN_KEY_SIZE, 275 .min_keysize = CAMELLIA_MIN_KEY_SIZE,
276 .max_keysize = CAMELLIA_MAX_KEY_SIZE, 276 .max_keysize = CAMELLIA_MAX_KEY_SIZE,
277 .ivsize = CAMELLIA_BLOCK_SIZE,
277 .setkey = camellia_set_key, 278 .setkey = camellia_set_key,
278 .encrypt = cbc_encrypt, 279 .encrypt = cbc_encrypt,
279 .decrypt = cbc_decrypt, 280 .decrypt = cbc_decrypt,
diff --git a/arch/sparc/crypto/des_glue.c b/arch/sparc/crypto/des_glue.c
index dd6a34fa6e19..61af794aa2d3 100644
--- a/arch/sparc/crypto/des_glue.c
+++ b/arch/sparc/crypto/des_glue.c
@@ -429,6 +429,7 @@ static struct crypto_alg algs[] = { {
429 .blkcipher = { 429 .blkcipher = {
430 .min_keysize = DES_KEY_SIZE, 430 .min_keysize = DES_KEY_SIZE,
431 .max_keysize = DES_KEY_SIZE, 431 .max_keysize = DES_KEY_SIZE,
432 .ivsize = DES_BLOCK_SIZE,
432 .setkey = des_set_key, 433 .setkey = des_set_key,
433 .encrypt = cbc_encrypt, 434 .encrypt = cbc_encrypt,
434 .decrypt = cbc_decrypt, 435 .decrypt = cbc_decrypt,
@@ -485,6 +486,7 @@ static struct crypto_alg algs[] = { {
485 .blkcipher = { 486 .blkcipher = {
486 .min_keysize = DES3_EDE_KEY_SIZE, 487 .min_keysize = DES3_EDE_KEY_SIZE,
487 .max_keysize = DES3_EDE_KEY_SIZE, 488 .max_keysize = DES3_EDE_KEY_SIZE,
489 .ivsize = DES3_EDE_BLOCK_SIZE,
488 .setkey = des3_ede_set_key, 490 .setkey = des3_ede_set_key,
489 .encrypt = cbc3_encrypt, 491 .encrypt = cbc3_encrypt,
490 .decrypt = cbc3_decrypt, 492 .decrypt = cbc3_decrypt,
diff --git a/arch/x86/crypto/camellia_aesni_avx_glue.c b/arch/x86/crypto/camellia_aesni_avx_glue.c
index 80a0e4389c9a..bacaa13acac5 100644
--- a/arch/x86/crypto/camellia_aesni_avx_glue.c
+++ b/arch/x86/crypto/camellia_aesni_avx_glue.c
@@ -554,6 +554,11 @@ static int __init camellia_aesni_init(void)
554{ 554{
555 const char *feature_name; 555 const char *feature_name;
556 556
557 if (!cpu_has_avx || !cpu_has_aes || !cpu_has_osxsave) {
558 pr_info("AVX or AES-NI instructions are not detected.\n");
559 return -ENODEV;
560 }
561
557 if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) { 562 if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
558 pr_info("CPU feature '%s' is not supported.\n", feature_name); 563 pr_info("CPU feature '%s' is not supported.\n", feature_name);
559 return -ENODEV; 564 return -ENODEV;
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 8acb886032ae..9c1dc8d6106a 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -544,7 +544,8 @@ static int ahash_prepare_alg(struct ahash_alg *alg)
544 struct crypto_alg *base = &alg->halg.base; 544 struct crypto_alg *base = &alg->halg.base;
545 545
546 if (alg->halg.digestsize > PAGE_SIZE / 8 || 546 if (alg->halg.digestsize > PAGE_SIZE / 8 ||
547 alg->halg.statesize > PAGE_SIZE / 8) 547 alg->halg.statesize > PAGE_SIZE / 8 ||
548 alg->halg.statesize == 0)
548 return -EINVAL; 549 return -EINVAL;
549 550
550 base->cra_type = &crypto_ahash_type; 551 base->cra_type = &crypto_ahash_type;