On 2/24/2014 11:59 AM, Richard Henderson wrote:
> On 02/12/2014 01:23 PM, Tom Musta wrote:
>> +static uint8_t SBOX[256] = {
> 
> I'm not keen on yet another copy of AES data.
> 
> Please reuse "qemu/aes.h" as much as possible.  Please see how we use those in
> target-i386; from a quick reading, these insns should match up:
> 
>   aesenc      vcipher
>   aesenclast  vcipherlast
>   aesdec      vncipher
>   aesdeclast  vncipherlast
> 
> It does look like the aes_shifts/aes_ishifts arrays should be moved from i386
> specific code.  Which would also be good since ops_sse.h is included multiple
> times and thus we have unnecessary multiple copies of this data.
> 
> There's more data that should be moved out to common code in
> target-arm/crypto_helper.c.  The most pertinent of which is a copy of your 
> SBOX
> and InvSBOX arrays, which you'll still need for the vsbox insn.
> 
> I'll also note that arm contains a second copy of the aes_{i,}shifts arrays.
> So after those are moved to common code, we avoid that duplication too.
> 
> 
> r~
> 

Richard,

Thanks for the feedback ... this is a good suggestion.

I see one problem with the PowerPC vncipher instruction.  This instruction is
not equivalent the aesdec.  Moreover, the AddRoundKey (XOR) is performed 
*before*
applying the InvMixColumns operation.  So the AES_Te4 mapping is not correct
for PPC.


Reply via email to