crypto: ccm - honour alignmask of subordinate MAC cipher
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Sat, 11 Feb 2017 19:25:21 +0000 (19:25 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 15 Feb 2017 05:23:45 +0000 (13:23 +0800)
commit5338ad7065c0a4cb55e949638b1fdba6b09dc5a2
treecb27a7354999fe514c521ff01bdd34ef75cae95c
parent944c3d4dca34403e802287a1e7e9d02c06dce0d5
crypto: ccm - honour alignmask of subordinate MAC cipher

The CCM driver was recently updated to defer the MAC part of the algorithm
to a dedicated crypto transform, and a template for instantiating such
transforms was added at the same time.

However, this new cbcmac template fails to take the alignmask of the
encapsulated cipher into account, which may result in buffer addresses
being passed down that are not sufficiently aligned.

So update the code to ensure that the digest buffer in the desc ctx
appears at a sufficiently aligned offset, and tweak the code so that all
calls to crypto_cipher_encrypt_one() operate on this buffer exclusively.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/ccm.c