• Breaking News

    Monday, February 19, 2018

    Cryptography A decent introduction to Cryptography

    Cryptography A decent introduction to Cryptography


    A decent introduction to Cryptography

    Posted: 18 Feb 2018 09:11 PM PST

    How can we select algorithms in Libsodium?

    Posted: 18 Feb 2018 08:15 AM PST

    I'm currently trying to benchmark Libsodium in various settings (mostly to compare it to Monocypher). It would seem I do not have the control I want over the compilation options. Here's the options I'm interested in:

    • Best possible performance, using non-portable implementations if need be.
    • Portable C only, compiled with default compilation options.
    • Portable C only, compiled with -O3 -march=native
    • Portable C only, compiled with -O2
    • Portable C only, compiled with -Os

    The first, I think I have been able to achieve thus:

    $ ./configure --enable-opt $ make 

    For the other 4, I tried to do this (with make clean before, of course):

    $ ./configure --disable-asm $ make $ ./configure --disable-asm $ make CFLAGS="-O3 march=native" $ ./configure --disable-asm $ make CFLAGS=-O2 $ ./configure --disable-asm $ make CFLAGS=-Os 

    The CFLAGS variable seems to have the right effect, but some algorithms (most notably X25519) are still faster than expected on my 64-bit intel laptop (that is, way faster than Monocyhper, while it has the same speed on the Raspberry Pi). Moreover, Ed25519 recently benefited from a huge speed up on platform that support 128-bit arithmetic, and this speed up is observable even when using --disable-asm.

    It seems --disable-asm does not disable all non portable options, only intrinsics. 128-bit arithmetic, and the algorithms that rely on it, are likely still active on the average 64-bit platform. Worse, my web searches so far suggest CFLAGS is not enough to control the compilation options. This prevents me from performing an accurate benchmark, and with that a fair comparison with Monocypher.

    Does Libsodium have a reliable way to disable all non-portable implementations, and stick to standard C? Reading the documentation and searching the web didn't help so far. I've also asked Libsodium's mailing list, I'm waiting for their answer.

    submitted by /u/loup-vaillant
    [link] [comments]

    No comments:

    Post a Comment