[SRU][Artful][Bionic][PATCH 0/1] crypto: vmx - Use skcipher for ctr fallback

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU][Artful][Bionic][PATCH 0/1] crypto: vmx - Use skcipher for ctr fallback

Joseph Salisbury-3
BugLink: http://bugs.launchpad.net/bugs/1732978

== SRU Justification ==
Artful uses the 4.13 kernel which has an issue with the fallback cipher for
CTR mode. Commit e666d4e9ceec fixes this problem by using a new structure
for the generic ciphers.

This commit is also needed in Bionic until it gets rebased to 4.15.

Commit e666d4e9ceec was added to mainline in v4.15-rc2

== Fix ==
commit e666d4e9ceec94c0a88c94b7db31d56474da43b3
Author: Paulo Flabiano Smorigo <[hidden email]>
Date:   Mon Oct 16 20:54:19 2017 -0200

    crypto: vmx - Use skcipher for ctr fallback

== Regression Potential ==
This commit is specific to crypto, and adds a new structure for the generic ciphers.

== Test Case ==
A test kernel was built with this patch and tested by the original bug reporter.
The bug reporter states the test kernel resolved the bug.



Paulo Flabiano Smorigo (1):
  crypto: vmx - Use skcipher for ctr fallback

 drivers/crypto/vmx/aes_ctr.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Artful][Bionic][PATCH 1/1] crypto: vmx - Use skcipher for ctr fallback

Joseph Salisbury-3
From: Paulo Flabiano Smorigo <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1732978

Signed-off-by: Paulo Flabiano Smorigo <[hidden email]>
Signed-off-by: Herbert Xu <[hidden email]>
(cherry picked from commit e666d4e9ceec94c0a88c94b7db31d56474da43b3)
Signed-off-by: Joseph Salisbury <[hidden email]>
---
 drivers/crypto/vmx/aes_ctr.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/crypto/vmx/aes_ctr.c b/drivers/crypto/vmx/aes_ctr.c
index 9c26d9e..27ce09c 100644
--- 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,11 +51,11 @@ static int p8_aes_ctr_init(struct crypto_tfm *tfm)
  return PTR_ERR(fallback);
  }
  printk(KERN_INFO "Using '%s' as fallback implementation.\n",
-       crypto_tfm_alg_driver_name((struct crypto_tfm *) fallback));
+ crypto_skcipher_driver_name(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;
@@ -64,7 +66,7 @@ static void p8_aes_ctr_exit(struct crypto_tfm *tfm)
  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;
  }
 }
@@ -83,7 +85,7 @@ static int p8_aes_ctr_setkey(struct crypto_tfm *tfm, const u8 *key,
  pagefault_enable();
  preempt_enable();
 
- ret += crypto_blkcipher_setkey(ctx->fallback, key, keylen);
+ ret += crypto_skcipher_setkey(ctx->fallback, key, keylen);
  return ret;
 }
 
@@ -118,15 +120,14 @@ static int p8_aes_ctr_crypt(struct blkcipher_desc *desc,
  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);
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [SRU][Artful][Bionic][PATCH 0/1] crypto: vmx - Use skcipher for ctr fallback

Marcelo Henrique Cerri
In reply to this post by Joseph Salisbury-3
Acked-by: Marcelo Henrique Cerri <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

ACK/APPLIED[B]: [SRU][Artful][Bionic][PATCH 0/1] crypto: vmx - Use skcipher for ctr fallback

Seth Forshee
In reply to this post by Joseph Salisbury-3
On Thu, Dec 14, 2017 at 09:49:49AM -0500, Joseph Salisbury wrote:

> BugLink: http://bugs.launchpad.net/bugs/1732978
>
> == SRU Justification ==
> Artful uses the 4.13 kernel which has an issue with the fallback cipher for
> CTR mode. Commit e666d4e9ceec fixes this problem by using a new structure
> for the generic ciphers.
>
> This commit is also needed in Bionic until it gets rebased to 4.15.
>
> Commit e666d4e9ceec was added to mainline in v4.15-rc2
>
> == Fix ==
> commit e666d4e9ceec94c0a88c94b7db31d56474da43b3
> Author: Paulo Flabiano Smorigo <[hidden email]>
> Date:   Mon Oct 16 20:54:19 2017 -0200
>
>     crypto: vmx - Use skcipher for ctr fallback
>
> == Regression Potential ==
> This commit is specific to crypto, and adds a new structure for the generic ciphers.
>
> == Test Case ==
> A test kernel was built with this patch and tested by the original bug reporter.
> The bug reporter states the test kernel resolved the bug.

Acked-by: Seth Forshee <[hidden email]>

Applied to bionic, thanks!

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED[A]: [SRU][Artful][Bionic][PATCH 0/1] crypto: vmx - Use skcipher for ctr fallback

Khalid Elmously
In reply to this post by Joseph Salisbury-3
Applied to Artful

On 2017-12-14 09:49:49 , Joseph Salisbury wrote:

> BugLink: http://bugs.launchpad.net/bugs/1732978
>
> == SRU Justification ==
> Artful uses the 4.13 kernel which has an issue with the fallback cipher for
> CTR mode. Commit e666d4e9ceec fixes this problem by using a new structure
> for the generic ciphers.
>
> This commit is also needed in Bionic until it gets rebased to 4.15.
>
> Commit e666d4e9ceec was added to mainline in v4.15-rc2
>
> == Fix ==
> commit e666d4e9ceec94c0a88c94b7db31d56474da43b3
> Author: Paulo Flabiano Smorigo <[hidden email]>
> Date:   Mon Oct 16 20:54:19 2017 -0200
>
>     crypto: vmx - Use skcipher for ctr fallback
>
> == Regression Potential ==
> This commit is specific to crypto, and adds a new structure for the generic ciphers.
>
> == Test Case ==
> A test kernel was built with this patch and tested by the original bug reporter.
> The bug reporter states the test kernel resolved the bug.
>
>
>
> Paulo Flabiano Smorigo (1):
>   crypto: vmx - Use skcipher for ctr fallback
>
>  drivers/crypto/vmx/aes_ctr.c | 33 +++++++++++++++++----------------
>  1 file changed, 17 insertions(+), 16 deletions(-)
>
> --
> 2.7.4
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team