memxor
Niels Möller
nisse at lysator.liu.se
Tue Sep 13 13:17:34 CEST 2011
Nikos Mavrogiannopoulos <n.mavrogiannopoulos at gmail.com> writes:
> if I run .bootstrap from the lsh dir it succeeds but running configure
> prints the warnings below and make fails.
Strange. I'm not sure what the warnings mean, but make definitely
shouldn't fail. I take it you have checked it out from cvs? Exactly what
did you do? I'd expect the following to work:
cvs ... co lsh
cd lsh
./.bootstrap
cd nettle
./configure
make
Then you shouldn't need to bother about the lsh directory again. You
have a symlink to the shared aclocal.m4 (and to some other shared
files).
> Anyway, I attach an untested patch that shows how SSE2 or other cpu
> version specific optimizations can be enabled at run-time.
Thanks. I'll have to think some more on how to organize this. Some
properties I'd like to have:
1. Don't require users to call any init function.
One could define memxor to jump via a function pointer, and have an
initial value for that pointer which jumps to the routine to set the
pointer to the right function, and then use it. Overwriting the
pointer should be atomic, so no locking needed even for multithreaded
programs.
Or for library formats that support that, hook in the initialization
in the same way as C++ constructors for global data.
2. Have configure options like
--enable-x86-sse2/--disable-x86-sse2
which omits that wrapper function and its function pointer.
3. Avoid using gcc-specific things, including inline asm, in the C
source files.
Other obvious uses for cpu detection in nettle:
* The AES code could check for the special aes instructions.
* The serpent code can use %xmm and %ymm registers, when present. On
x86_64, as far as I'm aware all current implementations have sse2,
but one could check for, and make use of, the 256-bit %ymm
registers.
Regards,
/Niels
--
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
More information about the nettle-bugs
mailing list