]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Aug 2018 06:45:43 +0000 (08:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Aug 2018 06:45:43 +0000 (08:45 +0200)
added patches:
crypto-vmx-use-skcipher-for-ctr-fallback.patch

queue-4.14/crypto-vmx-use-skcipher-for-ctr-fallback.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/crypto-vmx-use-skcipher-for-ctr-fallback.patch b/queue-4.14/crypto-vmx-use-skcipher-for-ctr-fallback.patch
new file mode 100644 (file)
index 0000000..51a3ab3
--- /dev/null
@@ -0,0 +1,100 @@
+From e666d4e9ceec94c0a88c94b7db31d56474da43b3 Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
+Date: Mon, 16 Oct 2017 20:54:19 -0200
+Subject: crypto: vmx - Use skcipher for ctr fallback
+
+From: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
+
+commit e666d4e9ceec94c0a88c94b7db31d56474da43b3 upstream.
+
+Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+
+---
+ drivers/crypto/vmx/aes_ctr.c |   31 ++++++++++++++++---------------
+ 1 file changed, 16 insertions(+), 15 deletions(-)
+
+--- a/drivers/crypto/vmx/aes_ctr.c
++++ b/drivers/crypto/vmx/aes_ctr.c
+@@ -27,21 +27,23 @@
+ #include <asm/switch_to.h>
+ #include <crypto/aes.h>
+ #include <crypto/scatterwalk.h>
++#include <crypto/skcipher.h>
++
+ #include "aesp8-ppc.h"
+ struct p8_aes_ctr_ctx {
+-      struct crypto_blkcipher *fallback;
++      struct crypto_skcipher *fallback;
+       struct aes_key enc_key;
+ };
+ static int p8_aes_ctr_init(struct crypto_tfm *tfm)
+ {
+       const char *alg = crypto_tfm_alg_name(tfm);
+-      struct crypto_blkcipher *fallback;
++      struct crypto_skcipher *fallback;
+       struct p8_aes_ctr_ctx *ctx = crypto_tfm_ctx(tfm);
+-      fallback =
+-          crypto_alloc_blkcipher(alg, 0, CRYPTO_ALG_NEED_FALLBACK);
++      fallback = crypto_alloc_skcipher(alg, 0,
++                      CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK);
+       if (IS_ERR(fallback)) {
+               printk(KERN_ERR
+                      "Failed to allocate transformation for '%s': %ld\n",
+@@ -49,9 +51,9 @@ static int p8_aes_ctr_init(struct crypto
+               return PTR_ERR(fallback);
+       }
+-      crypto_blkcipher_set_flags(
++      crypto_skcipher_set_flags(
+               fallback,
+-              crypto_blkcipher_get_flags((struct crypto_blkcipher *)tfm));
++              crypto_skcipher_get_flags((struct crypto_skcipher *)tfm));
+       ctx->fallback = fallback;
+       return 0;
+@@ -62,7 +64,7 @@ static void p8_aes_ctr_exit(struct crypt
+       struct p8_aes_ctr_ctx *ctx = crypto_tfm_ctx(tfm);
+       if (ctx->fallback) {
+-              crypto_free_blkcipher(ctx->fallback);
++              crypto_free_skcipher(ctx->fallback);
+               ctx->fallback = NULL;
+       }
+ }
+@@ -81,7 +83,7 @@ static int p8_aes_ctr_setkey(struct cryp
+       pagefault_enable();
+       preempt_enable();
+-      ret += crypto_blkcipher_setkey(ctx->fallback, key, keylen);
++      ret += crypto_skcipher_setkey(ctx->fallback, key, keylen);
+       return ret;
+ }
+@@ -115,15 +117,14 @@ static int p8_aes_ctr_crypt(struct blkci
+       struct blkcipher_walk walk;
+       struct p8_aes_ctr_ctx *ctx =
+               crypto_tfm_ctx(crypto_blkcipher_tfm(desc->tfm));
+-      struct blkcipher_desc fallback_desc = {
+-              .tfm = ctx->fallback,
+-              .info = desc->info,
+-              .flags = desc->flags
+-      };
+       if (in_interrupt()) {
+-              ret = crypto_blkcipher_encrypt(&fallback_desc, dst, src,
+-                                             nbytes);
++              SKCIPHER_REQUEST_ON_STACK(req, ctx->fallback);
++              skcipher_request_set_tfm(req, ctx->fallback);
++              skcipher_request_set_callback(req, desc->flags, NULL, NULL);
++              skcipher_request_set_crypt(req, src, dst, nbytes, desc->info);
++              ret = crypto_skcipher_encrypt(req);
++              skcipher_request_zero(req);
+       } else {
+               blkcipher_walk_init(&walk, dst, src, nbytes);
+               ret = blkcipher_walk_virt_block(desc, &walk, AES_BLOCK_SIZE);
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..77393f22b278d723e09219e7fe051f09fd5a570a 100644 (file)
@@ -0,0 +1 @@
+crypto-vmx-use-skcipher-for-ctr-fallback.patch