]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: keembay-ocs-aes - Fix 'q' assignment during CCM B0 generation
authorDaniele Alessandrelli <daniele.alessandrelli@intel.com>
Wed, 3 Feb 2021 15:42:10 +0000 (15:42 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 10 Feb 2021 06:55:59 +0000 (17:55 +1100)
commit844be6bba2198f6231493bcdbcb49e9b7a93cce2
tree66a1a3c0561a72d86e6a4b96d5e86b5210e9fa63
parente323223029fb497eb910f26139c82e6937a870bb
crypto: keembay-ocs-aes - Fix 'q' assignment during CCM B0 generation

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@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/keembay/ocs-aes.c