Skip to content

Commit

Permalink
target/ppc: Use aesdec_ISB_ISR_AK_IMC
Browse files Browse the repository at this point in the history
This implements the VNCIPHER 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 ce9f5b3 commit af4cb94
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions target/ppc/int_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2947,22 +2947,11 @@ void helper_vcipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)

void helper_vncipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
{
/* This differs from what is written in ISA V2.07. The RTL is */
/* incorrect and will be fixed in V2.07B. */
int i;
ppc_avr_t tmp;

VECTOR_FOR_INORDER_I(i, u8) {
tmp.VsrB(i) = b->VsrB(i) ^ AES_isbox[a->VsrB(AES_ishifts[i])];
}
AESState *ad = (AESState *)r;
AESState *st = (AESState *)a;
AESState *rk = (AESState *)b;

VECTOR_FOR_INORDER_I(i, u32) {
r->VsrW(i) =
AES_imc[tmp.VsrB(4 * i + 0)][0] ^
AES_imc[tmp.VsrB(4 * i + 1)][1] ^
AES_imc[tmp.VsrB(4 * i + 2)][2] ^
AES_imc[tmp.VsrB(4 * i + 3)][3];
}
aesdec_ISB_ISR_AK_IMC(ad, st, rk, true);
}

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

0 comments on commit af4cb94

Please sign in to comment.