jedisct1 / libsodium

A modern, portable, easy to use crypto library.

Home Page:https://libsodium.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SIGILL on AMD Athlon(tm) II X2 240

niXman opened this issue · comments

hi,

I use AEGIS-256 (https://github.com/jedisct1/libsodium/blob/master/src/libsodium/include/sodium/crypto_aead_aegis256.h) to encrypt/decrypt data.
the code works successfully on core-i5/i7 CPUs, but when I tried to execute the program on AMD Athlon(tm) II X2 240 I get SIGILL signal in crypto_aead_aegis256_init() function.

the last four frames look like this:

crypto_aead_aegis256_init (key=key@entry=0x5555557bcd78 "\253\024,\216\207\037\343\240.?O\036\061\374\201A\244N\024\354\026z\020\063tK\376\356\365\241", <incomplete sequence \346>, 
    nonce=nonce@entry=0x5555557bce08 "N\377:\235\374\300\240R\277\325X\031\232,!\"\267>Wb?\236~\257_\365ԇ*\321rC", state=state@entry=0x7fffffffd5f0) at crypto_aead/aegis256/aesni/aead_aegis256_aesni.c:68
68	crypto_aead/aegis256/aesni/aead_aegis256_aesni.c: No such file or directory.
(gdb) bt full
#0  crypto_aead_aegis256_init (key=key@entry=0x5555557bcd78 "\253\024,\216\207\037\343\240.?O\036\061\374\201A\244N\024\354\026z\020\063tK\376\356\365\241", <incomplete sequence \346>, 
    nonce=nonce@entry=0x5555557bce08 "N\377:\235\374\300\240R\277\325X\031\232,!\"\267>Wb?\236~\257_\365ԇ*\321rC", state=state@entry=0x7fffffffd5f0) at crypto_aead/aegis256/aesni/aead_aegis256_aesni.c:68
        c0 = <optimized out>
        c1 = <optimized out>
        k1 = <optimized out>
        k2 = <optimized out>
        kxn1 = <optimized out>
        kxn2 = <optimized out>
        i = 0
#1  0x0000555555569959 in crypto_aead_aegis256_decrypt_detached (m=0x5555557bd298 "", nsec=<optimized out>, c=0x5555557bcbad "\215\377\207\fY(]E\241\207\361\240T\373\300\030", clen=clen@entry=0, 
    mac=0x5555557bcbad "\215\377\207\fY(]E\241\207\361\240T\373\300\030", ad=0x5555557bcb78 "\273}\367q\202\070\273\001\001", adlen=53, npub=0x5555557bce08 "N\377:\235\374\300\240R\277\325X\031\232,!\"\267>Wb?\236~\257_\365ԇ*\321rC", 
    k=0x5555557bcd78 "\253\024,\216\207\037\343\240.?O\036\061\374\201A\244N\024\354\026z\020\063tK\376\356\365\241", <incomplete sequence \346>) at crypto_aead/aegis256/aesni/aead_aegis256_aesni.c:214
        state = {{0, 25}, {12884901888, 7}, {48, 93824994615320}, {80, -144}, {0, 206158430211}, {0, 0}}
        src = "\000\000\000\000\000\000\000\000|\000\000\000w\000\000"
        dst = "n\000\000\000[\000\000\000\023+R\367\377\177\000"
        computed_mac = "\000\000\000\000\000\000\000\000\031\000\000\000\000\000\000"
        i = <optimized out>
        mlen = 0
        ret = <optimized out>
#2  0x0000555555569dd5 in crypto_aead_aegis256_decrypt (m=<optimized out>, mlen_p=0x7fffffffd760, nsec=<optimized out>, c=<optimized out>, clen=16, ad=<optimized out>, adlen=53, 
    npub=0x5555557bce08 "N\377:\235\374\300\240R\277\325X\031\232,!\"\267>Wb?\236~\257_\365ԇ*\321rC", 
    k=0x5555557bcd78 "\253\024,\216\207\037\343\240.?O\036\061\374\201A\244N\024\354\026z\020\063tK\376\356\365\241", <incomplete sequence \346>) at crypto_aead/aegis256/aesni/aead_aegis256_aesni.c:271
        mlen = 0
        ret = -1
#3  0x000055555555ee9a in unpack_packet(packet_type*, unsigned short*, QByteArray*, unsigned char, QByteArray const&, QByteArray const&, QByteArray const&) ()

my question is, is AEGIS-256 supposed to run on the processor I specified?

thanks!

What does crypto_aead_aegis256_is_available() return on that host?

it returns 0 :(

thank you!

I will probably add a software implementation for platforms without hardware AES support.

But performance isn't going to be as great.