Commit c054a076a1bd4731820a9c4d638b13d5c9bf5935

Authored by Herbert Xu
1 parent 14bd342e25

crypto: padlock - Fix AES-CBC handling on odd-block-sized input

On certain VIA chipsets AES-CBC requires the input/output to be
a multiple of 64 bytes.  We had a workaround for this but it was
buggy as it sent the whole input for processing when it is meant
to only send the initial number of blocks which makes the rest
a multiple of 64 bytes.

As expected this causes memory corruption whenever the workaround
kicks in.

Reported-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

drivers/crypto/padlock-aes.c
... ... @@ -286,7 +286,7 @@
286 286 if (initial)
287 287 asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */
288 288 : "+S" (input), "+D" (output), "+a" (iv)
289   - : "d" (control_word), "b" (key), "c" (count));
  289 + : "d" (control_word), "b" (key), "c" (initial));
290 290  
291 291 asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */
292 292 : "+S" (input), "+D" (output), "+a" (iv)