Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
target/i386: Use aesenc_SB_SR_AK
This implements the AESENCLAST instruction.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Jul 8, 2023
1 parent af4cb94 commit cc648f5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions target/i386/ops_sse.h
Expand Up @@ -19,6 +19,7 @@
*/

#include "crypto/aes.h"
#include "crypto/aes-round.h"

#if SHIFT == 0
#define Reg MMXReg
Expand Down Expand Up @@ -2202,12 +2203,12 @@ void glue(helper_aesenc, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s)

void glue(helper_aesenclast, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s)
{
int i;
Reg st = *v;
Reg rk = *s;
for (int i = 0; i < SHIFT; i++) {
AESState *ad = (AESState *)&d->ZMM_X(i);
AESState *st = (AESState *)&v->ZMM_X(i);
AESState *rk = (AESState *)&s->ZMM_X(i);

for (i = 0; i < 8 << SHIFT; i++) {
d->B(i) = rk.B(i) ^ (AES_sbox[st.B(AES_shifts[i & 15] + (i & ~15))]);
aesenc_SB_SR_AK(ad, st, rk, false);
}
}

Expand Down

0 comments on commit cc648f5

Please sign in to comment.