Re: [PATCH] crypto: keembay-ocs-aes - Fix 'q' assignment during CCM B0 generation

From: Herbert Xu
Date: Wed Feb 10 2021 - 02:26:02 EST


On Wed, Feb 03, 2021 at 03:42:10PM +0000, Daniele Alessandrelli wrote:
> From: Daniele Alessandrelli <daniele.alessandrelli@xxxxxxxxx>
>
> In ocs_aes_ccm_write_b0(), 'q' (the octet length of the binary
> representation of the octet length of the payload) is set to 'iv[0]',
> while it should be set to 'iv[0] & 0x7' (i.e., only the last 3
> bits of iv[0] should be used), as documented in NIST Special Publication
> 800-38C:
> https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38c.pdf
>
> In practice, this is not an issue, since 'iv[0]' is checked to be in the
> range [1-7] by ocs_aes_validate_inputs(), but let's fix the assignment
> anyway, in order to make the code more robust.
>
> Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@xxxxxxxxx>
> ---
> drivers/crypto/keembay/ocs-aes.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)

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