qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [PATCH] target-ppc: simplify AES emulation


From: Tom Musta
Subject: Re: [Qemu-ppc] [PATCH] target-ppc: simplify AES emulation
Date: Mon, 27 Oct 2014 13:27:13 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 10/27/2014 11:25 AM, Aurelien Jarno wrote:
> 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 <address@hidden>
> Cc: Paolo Bonzini <address@hidden>
> Signed-off-by: Aurelien Jarno <address@hidden>
> ---
>  target-ppc/int_helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Note: This has been requested by Paolo Bonzini, but I have no way to
> test it, so it is only compile tested.

I do and did on both Power and Intel hosts.

Tested-by: Tom Musta <address@hidden>
> 
> diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c
> index 713d777..e67a5ee 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])]);
>      }
>  }
>  
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]