On 05/04/2012 03:05 PM, Thomas DuBuisson wrote:
Vincent uses gcc header files to get the AES instructions:
Header files of:
#include<wmmintrin.h>
#include<tmmintrin.h>
And later calls of:
x = _mm_aesenc_si128(m, K1);
But currently you must know you have AESNI and use a flag:
cabal install cryptocipher -faesni
But if you are wrong:
Illegal instruction (core dumped)
Of course that's expected as of now, since it's not finished and i had to push a
new release (related to some significant performance improvement for
RSA/DH/DSA), the code is there as a "technology preview".
But the goal is to turn unconditionally the AESNI "flag" when arch is x86 or
x86_64, which in this case the implementation would rely on the runtime cpuid
check to use the aesni fastpath or not.
This is a great place to be - now we just take the CPU checking from
intel-aes, make a switch between Vincent's C and Gladman (in haskell
or out, I doesn't matter to me), graft on Ctr mode as specified then
it's all about matching the current 'random' API.
Please don't take the intel-aes test implementation. it's skewed to just support
Intel,
since it basically testing for the cpu string "GenuineIntel".
The only necessary test is the cpuid 1 with ecx having the 25th bit set.
It should just work providing cpus other than intel have matching cpuid 1 layout
(which as far i'm concerned seems to be the case in most cases)
--
Vincent
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe