]> git.karo-electronics.de Git - karo-tx-linux.git/commit
crypto: arm64/aes - don't use IV buffer to return final keystream block
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 2 Feb 2017 11:38:55 +0000 (11:38 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 3 Feb 2017 10:16:20 +0000 (18:16 +0800)
commit88a3f582bea9e1da0346ea412950bbbdc3125cc1
tree37b29ebed0b653696165a69098dd344e837b293c
parent12fcd92305880504c9827c99ea128fecf1c99f0d
crypto: arm64/aes - don't use IV buffer to return final keystream block

The arm64 bit sliced AES core code uses the IV buffer to pass the final
keystream block back to the glue code if the input is not a multiple of
the block size, so that the asm code does not have to deal with anything
except 16 byte blocks. This is done under the assumption that the outgoing
IV is meaningless anyway in this case, given that chaining is no longer
possible under these circumstances.

However, as it turns out, the CCM driver does expect the IV to retain
a value that is equal to the original IV except for the counter value,
and even interprets byte zero as a length indicator, which may result
in memory corruption if the IV is overwritten with something else.

So use a separate buffer to return the final keystream block.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/arm64/crypto/aes-neonbs-core.S
arch/arm64/crypto/aes-neonbs-glue.c