]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: padlock-aes - Fix Nano workaround data corruption
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 13 Jul 2018 08:12:32 +0000 (16:12 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 20 Jul 2018 05:47:42 +0000 (13:47 +0800)
commit4441383ffd3d488d04af056b34a268d455f3b8e1
tree3c1d6b4111feb002b39f27cea7039a9d8090ffb0
parent047b206f29009ecd9a1d035bfc918afe02f36012
crypto: padlock-aes - Fix Nano workaround data corruption

This was detected by the self-test thanks to Ard's chunking patch.

I finally got around to testing this out on my ancient Via box.  It
turns out that the workaround got the assembly wrong and we end up
doing count + initial cycles of the loop instead of just count.

This obviously causes corruption, either by overwriting the source
that is yet to be processed, or writing over the end of the buffer.

On CPUs that don't require the workaround only ECB is affected.
On Nano CPUs both ECB and CBC are affected.

This patch fixes it by doing the subtraction prior to the assembly.

Fixes: fad57efdac7c ("crypto: padlock-aes - work around Nano CPU...")
Cc: <stable@vger.kernel.org>
Reported-by: Jamie Heilman <jamie@audible.transient.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/padlock-aes.c