diff mbox series

[2/2] crypto: ccm - drop unnecessary minimum 32-bit alignment

Message ID 1486841122-1686-2-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit 5ba8e2a05ed6695f38f3961ca8cb5cfc1063a842
Headers show
Series [1/2] crypto: ccm - honour alignmask of subordinate MAC cipher | expand

Commit Message

Ard Biesheuvel Feb. 11, 2017, 7:25 p.m. UTC
The CCM driver forces 32-bit alignment even if the underlying ciphers
don't care about alignment. This is because crypto_xor() used to require
this, but since this is no longer the case, drop the hardcoded minimum
of 32 bits.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 crypto/ccm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.7.4

Comments

Herbert Xu Feb. 15, 2017, 5:34 a.m. UTC | #1
On Sat, Feb 11, 2017 at 07:25:22PM +0000, Ard Biesheuvel wrote:
> The CCM driver forces 32-bit alignment even if the underlying ciphers

> don't care about alignment. This is because crypto_xor() used to require

> this, but since this is no longer the case, drop the hardcoded minimum

> of 32 bits.

> 

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff mbox series

Patch

diff --git a/crypto/ccm.c b/crypto/ccm.c
index 24c26ab052ca..442848807a52 100644
--- a/crypto/ccm.c
+++ b/crypto/ccm.c
@@ -525,8 +525,7 @@  static int crypto_ccm_create_common(struct crypto_template *tmpl,
 				       ctr->base.cra_priority) / 2;
 	inst->alg.base.cra_blocksize = 1;
 	inst->alg.base.cra_alignmask = mac->base.cra_alignmask |
-				       ctr->base.cra_alignmask |
-				       (__alignof__(u32) - 1);
+				       ctr->base.cra_alignmask;
 	inst->alg.ivsize = 16;
 	inst->alg.chunksize = crypto_skcipher_alg_chunksize(ctr);
 	inst->alg.maxauthsize = 16;