Padlock: fix byte swapping assembly for AES-192 and 256
authorValdikSS <iam@valdikss.org.ru>
Wed, 18 Jan 2023 17:14:48 +0000 (20:14 +0300)
committerHugo Landau <hlandau@openssl.org>
Fri, 20 Jan 2023 07:32:55 +0000 (07:32 +0000)
commit2bcf8e69bd92e33d84c48e7d108d3d46b22f8a6d
tree5d5dfff81745400cd60c39908f5b18b091eefcd8
parentd90907dfed17f7075ca48ab1e9a730eab6476e3b
Padlock: fix byte swapping assembly for AES-192 and 256

Byte swapping code incorrectly uses the number of AES rounds to swap expanded
AES key, while swapping only a single dword in a loop, resulting in swapped
key and partially swapped expanded keys, breaking AES encryption and
decryption on VIA Padlock hardware.

This commit correctly sets the number of swapping loops to be done.

Fixes #20073

CLA: trivial

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20077)

(cherry picked from commit 7331e7ef79fe4499d81cc92249e9c97e9ff9291a)
engines/asm/e_padlock-x86.pl
engines/asm/e_padlock-x86_64.pl