From: Aurelien Jarno Date: Mon, 27 Oct 2014 16:25:52 +0000 (+0100) Subject: target-ppc: simplify AES emulation X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~482^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=36cbde7c30ead127dcd7c03b96d4dabf10a6d6c5;p=sdk%2Femulator%2Fqemu.git target-ppc: simplify AES emulation This patch simplifies the AES code, by directly accessing the newly added S-Box, InvS-Box tables instead of recreating them by using the AES_Te and AES_Td tables. Cc: Alexander Graf Cc: Paolo Bonzini Signed-off-by: Aurelien Jarno Reviewed-by: Paolo Bonzini Tested-by: Tom Musta Signed-off-by: Alexander Graf --- diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index 83c1ad0..1c7e0f1 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -2352,7 +2352,7 @@ void helper_vcipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) int i; VECTOR_FOR_INORDER_I(i, u8) { - r->AVRB(i) = b->AVRB(i) ^ (AES_Te4[a->AVRB(AES_shifts[i])] & 0xFF); + r->AVRB(i) = b->AVRB(i) ^ (AES_sbox[a->AVRB(AES_shifts[i])]); } } @@ -2381,7 +2381,7 @@ void helper_vncipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) int i; VECTOR_FOR_INORDER_I(i, u8) { - r->AVRB(i) = b->AVRB(i) ^ (AES_Td4[a->AVRB(AES_ishifts[i])] & 0xFF); + r->AVRB(i) = b->AVRB(i) ^ (AES_isbox[a->AVRB(AES_ishifts[i])]); } }