Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
target/ppc: Use aesenc_SB_SR_MC_AK
This implements the VCIPHER instruction.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Jul 8, 2023
1 parent 2cf44f3 commit ce9f5b3
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions target/ppc/int_helper.c
Expand Up @@ -2933,17 +2933,11 @@ void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a)

void helper_vcipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
{
ppc_avr_t result;
int i;
AESState *ad = (AESState *)r;
AESState *st = (AESState *)a;
AESState *rk = (AESState *)b;

VECTOR_FOR_INORDER_I(i, u32) {
result.VsrW(i) = b->VsrW(i) ^
(AES_Te0[a->VsrB(AES_shifts[4 * i + 0])] ^
AES_Te1[a->VsrB(AES_shifts[4 * i + 1])] ^
AES_Te2[a->VsrB(AES_shifts[4 * i + 2])] ^
AES_Te3[a->VsrB(AES_shifts[4 * i + 3])]);
}
*r = result;
aesenc_SB_SR_MC_AK(ad, st, rk, true);
}

void helper_vcipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
Expand Down

0 comments on commit ce9f5b3

Please sign in to comment.