target-arm: crypto: fix BE host support
commitb449ca3c1874418d948878d5417a32fc0dbf9fea
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 16 Jan 2015 11:54:29 +0000 (16 11:54 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 16 Jan 2015 11:54:29 +0000 (16 11:54 +0000)
treedc0743d5264659b3f9bf07f701dd857d27db368d
parente68cba36360a2ab5bf0576b66df4d0eb0d822f8d
target-arm: crypto: fix BE host support

The crypto emulation code in target-arm/crypto_helper.c never worked
correctly on big endian hosts, due to the fact that it uses a union
of array types to convert between the native VFP register size (64
bits) and the types used in the algorithms (bytes and 32 bit words)

We cannot just swab between LE and BE when reading and writing the
registers, as the SHA code performs word additions, so instead, add
array accessors for the CRYPTO_STATE type whose LE and BE specific
implementations ensure that the correct array elements are referenced.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1420208303-24111-1-git-send-email-ard.biesheuvel@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target-arm/crypto_helper.c