Niels Möller <ni...@lysator.liu.se> writes:

> One other question: In the counter updates,
>
>>     C increase ctr value as input to aes_encrypt
>>     vaddudm S1, S0, CNT1
>>     vaddudm S2, S1, CNT1
>>     vaddudm S3, S2, CNT1
>>     vaddudm S4, S3, CNT1
>>     vaddudm S5, S4, CNT1
>>     vaddudm S6, S5, CNT1
>>     vaddudm S7, S6, CNT1
>
> shouldn't that be vadduwm (32-bit word addition, rather than 64-bit
> dword addition)? As I understand it, gcm uses a 32-bit counter, which
> should wrap around without any carry to higher bits if the initial value
> is just below 2^32.

I've added tests that set the intial counter so that the four counter
bytes wraps around 2^32, and I've verified that if these instructions
should be changed to vadduwm, to get output that agrees with nettle's
other gcm implementations.

Another question on powerpc64 assembly: For the byte swapping, currently
done using the vperm instruction and a mask word, is there any reason to
not use the xxbrd instruction (VSX Vector Byte-Reverse Doubleword)
instead? That applies to more functions than the new gcm-aes code.

Regards,
/Niels

-- 
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.
_______________________________________________
nettle-bugs mailing list -- nettle-bugs@lists.lysator.liu.se
To unsubscribe send an email to nettle-bugs-le...@lists.lysator.liu.se

Reply via email to