From 11d2fa5bb0140e463a38fd875cbaac00e9f289d9 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 9 Dec 2022 20:57:01 +0100 Subject: [PATCH] Add AEGIS-128L software support --- .../msvc/vs2010/libsodium/libsodium.vcxproj | 7 + .../libsodium/libsodium.vcxproj.filters | 27 ++ .../msvc/vs2012/libsodium/libsodium.vcxproj | 7 + .../libsodium/libsodium.vcxproj.filters | 27 ++ .../msvc/vs2013/libsodium/libsodium.vcxproj | 7 + .../libsodium/libsodium.vcxproj.filters | 27 ++ .../msvc/vs2015/libsodium/libsodium.vcxproj | 7 + .../libsodium/libsodium.vcxproj.filters | 27 ++ .../msvc/vs2017/libsodium/libsodium.vcxproj | 7 + .../libsodium/libsodium.vcxproj.filters | 27 ++ .../msvc/vs2019/libsodium/libsodium.vcxproj | 7 + .../libsodium/libsodium.vcxproj.filters | 27 ++ .../msvc/vs2022/libsodium/libsodium.vcxproj | 7 + .../libsodium/libsodium.vcxproj.filters | 27 ++ dist-build/emscripten-symbols.def | 43 ++- dist-build/emscripten.sh | 2 +- libsodium.vcxproj | 7 + libsodium.vcxproj.filters | 21 ++ src/libsodium/Makefile.am | 11 +- .../crypto_aead/aegis128l/aead_aegis128l.c | 114 +++++--- .../crypto_aead/aegis128l/aead_aegis128l.h | 16 ++ .../aegis128l/aesni/aead_aegis128l_aesni.c | 133 +++------ .../aegis128l/aesni/aead_aegis128l_aesni.h | 6 + .../armcrypto/aead_aegis128l_armcrypto.c | 134 +++------ .../armcrypto/aead_aegis128l_armcrypto.h | 6 + .../aegis128l/soft/aead_aegis128l_soft.c | 258 ++++++++++++++++++ .../aegis128l/soft/aead_aegis128l_soft.h | 7 + src/libsodium/crypto_core/softaes/softaes.c | 137 ++++++++++ .../include/sodium/crypto_aead_aegis128l.h | 5 +- .../include/sodium/private/implementations.h | 1 + src/libsodium/include/sodium/private/quirks.h | 1 + .../include/sodium/private/softaes.h | 56 ++++ src/libsodium/sodium/core.c | 1 + test/default/aead_aegis128l.c | 4 +- test/symbols/all-symbols.txt | 1 - 35 files changed, 951 insertions(+), 251 deletions(-) create mode 100644 src/libsodium/crypto_aead/aegis128l/aead_aegis128l.h create mode 100644 src/libsodium/crypto_aead/aegis128l/aesni/aead_aegis128l_aesni.h create mode 100644 src/libsodium/crypto_aead/aegis128l/armcrypto/aead_aegis128l_armcrypto.h create mode 100644 src/libsodium/crypto_aead/aegis128l/soft/aead_aegis128l_soft.c create mode 100644 src/libsodium/crypto_aead/aegis128l/soft/aead_aegis128l_soft.h create mode 100644 src/libsodium/crypto_core/softaes/softaes.c create mode 100644 src/libsodium/include/sodium/private/softaes.h diff --git a/builds/msvc/vs2010/libsodium/libsodium.vcxproj b/builds/msvc/vs2010/libsodium/libsodium.vcxproj index db42c9b2..2ad83338 100644 --- a/builds/msvc/vs2010/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2010/libsodium/libsodium.vcxproj @@ -176,6 +176,7 @@ + @@ -189,6 +190,7 @@ + @@ -270,6 +272,7 @@ + @@ -321,6 +324,10 @@ + + + + diff --git a/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters index cd37679d..389276fb 100644 --- a/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters @@ -321,6 +321,9 @@ crypto_aead\aegis128l\aesni + + crypto_aead\aegis128l\soft + crypto_aead\aegis128l\armcrypto @@ -360,6 +363,9 @@ crypto_core\hsalsa20\ref2 + + crypto_core\softaes + crypto_core\ed25519 @@ -599,6 +605,9 @@ include\sodium\private + + include\sodium\private + include\sodium\private @@ -752,6 +761,18 @@ crypto_stream\salsa20\xmm6 + + crypto_aead\aegis128l + + + crypto_aead\aegis128l\aesni + + + crypto_aead\aegis128l\soft + + + crypto_aead\aegis128l\armcrypto + crypto_core\ed25519 @@ -793,6 +814,9 @@ {2abca274-f068-3cf1-bd4e-5bfc5ee81de6} + + {f606c11a-a160-3619-b842-8e8cce100ba7} + {6897a4cc-0091-3970-b712-c0ac75c16b67} @@ -874,6 +898,9 @@ {eb259fd9-56f0-32db-a903-6bc1549a7326} + + {05997596-e3d7-3bf1-ad4d-39e4c5fd56f6} + {e53b6258-fcdd-34c8-96c5-44510a34a390} diff --git a/builds/msvc/vs2012/libsodium/libsodium.vcxproj b/builds/msvc/vs2012/libsodium/libsodium.vcxproj index 14c0ca22..2db4a75e 100644 --- a/builds/msvc/vs2012/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2012/libsodium/libsodium.vcxproj @@ -176,6 +176,7 @@ + @@ -189,6 +190,7 @@ + @@ -270,6 +272,7 @@ + @@ -321,6 +324,10 @@ + + + + diff --git a/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters index cd37679d..389276fb 100644 --- a/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters @@ -321,6 +321,9 @@ crypto_aead\aegis128l\aesni + + crypto_aead\aegis128l\soft + crypto_aead\aegis128l\armcrypto @@ -360,6 +363,9 @@ crypto_core\hsalsa20\ref2 + + crypto_core\softaes + crypto_core\ed25519 @@ -599,6 +605,9 @@ include\sodium\private + + include\sodium\private + include\sodium\private @@ -752,6 +761,18 @@ crypto_stream\salsa20\xmm6 + + crypto_aead\aegis128l + + + crypto_aead\aegis128l\aesni + + + crypto_aead\aegis128l\soft + + + crypto_aead\aegis128l\armcrypto + crypto_core\ed25519 @@ -793,6 +814,9 @@ {2abca274-f068-3cf1-bd4e-5bfc5ee81de6} + + {f606c11a-a160-3619-b842-8e8cce100ba7} + {6897a4cc-0091-3970-b712-c0ac75c16b67} @@ -874,6 +898,9 @@ {eb259fd9-56f0-32db-a903-6bc1549a7326} + + {05997596-e3d7-3bf1-ad4d-39e4c5fd56f6} + {e53b6258-fcdd-34c8-96c5-44510a34a390} diff --git a/builds/msvc/vs2013/libsodium/libsodium.vcxproj b/builds/msvc/vs2013/libsodium/libsodium.vcxproj index a1ab3e78..8bcef354 100644 --- a/builds/msvc/vs2013/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2013/libsodium/libsodium.vcxproj @@ -176,6 +176,7 @@ + @@ -189,6 +190,7 @@ + @@ -270,6 +272,7 @@ + @@ -321,6 +324,10 @@ + + + + diff --git a/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters index cd37679d..389276fb 100644 --- a/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters @@ -321,6 +321,9 @@ crypto_aead\aegis128l\aesni + + crypto_aead\aegis128l\soft + crypto_aead\aegis128l\armcrypto @@ -360,6 +363,9 @@ crypto_core\hsalsa20\ref2 + + crypto_core\softaes + crypto_core\ed25519 @@ -599,6 +605,9 @@ include\sodium\private + + include\sodium\private + include\sodium\private @@ -752,6 +761,18 @@ crypto_stream\salsa20\xmm6 + + crypto_aead\aegis128l + + + crypto_aead\aegis128l\aesni + + + crypto_aead\aegis128l\soft + + + crypto_aead\aegis128l\armcrypto + crypto_core\ed25519 @@ -793,6 +814,9 @@ {2abca274-f068-3cf1-bd4e-5bfc5ee81de6} + + {f606c11a-a160-3619-b842-8e8cce100ba7} + {6897a4cc-0091-3970-b712-c0ac75c16b67} @@ -874,6 +898,9 @@ {eb259fd9-56f0-32db-a903-6bc1549a7326} + + {05997596-e3d7-3bf1-ad4d-39e4c5fd56f6} + {e53b6258-fcdd-34c8-96c5-44510a34a390} diff --git a/builds/msvc/vs2015/libsodium/libsodium.vcxproj b/builds/msvc/vs2015/libsodium/libsodium.vcxproj index 3cd94db3..8bb767fb 100644 --- a/builds/msvc/vs2015/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2015/libsodium/libsodium.vcxproj @@ -176,6 +176,7 @@ + @@ -189,6 +190,7 @@ + @@ -270,6 +272,7 @@ + @@ -321,6 +324,10 @@ + + + + diff --git a/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters index cd37679d..389276fb 100644 --- a/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters @@ -321,6 +321,9 @@ crypto_aead\aegis128l\aesni + + crypto_aead\aegis128l\soft + crypto_aead\aegis128l\armcrypto @@ -360,6 +363,9 @@ crypto_core\hsalsa20\ref2 + + crypto_core\softaes + crypto_core\ed25519 @@ -599,6 +605,9 @@ include\sodium\private + + include\sodium\private + include\sodium\private @@ -752,6 +761,18 @@ crypto_stream\salsa20\xmm6 + + crypto_aead\aegis128l + + + crypto_aead\aegis128l\aesni + + + crypto_aead\aegis128l\soft + + + crypto_aead\aegis128l\armcrypto + crypto_core\ed25519 @@ -793,6 +814,9 @@ {2abca274-f068-3cf1-bd4e-5bfc5ee81de6} + + {f606c11a-a160-3619-b842-8e8cce100ba7} + {6897a4cc-0091-3970-b712-c0ac75c16b67} @@ -874,6 +898,9 @@ {eb259fd9-56f0-32db-a903-6bc1549a7326} + + {05997596-e3d7-3bf1-ad4d-39e4c5fd56f6} + {e53b6258-fcdd-34c8-96c5-44510a34a390} diff --git a/builds/msvc/vs2017/libsodium/libsodium.vcxproj b/builds/msvc/vs2017/libsodium/libsodium.vcxproj index 6f173664..b17ef144 100644 --- a/builds/msvc/vs2017/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2017/libsodium/libsodium.vcxproj @@ -176,6 +176,7 @@ + @@ -189,6 +190,7 @@ + @@ -270,6 +272,7 @@ + @@ -321,6 +324,10 @@ + + + + diff --git a/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters index cd37679d..389276fb 100644 --- a/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters @@ -321,6 +321,9 @@ crypto_aead\aegis128l\aesni + + crypto_aead\aegis128l\soft + crypto_aead\aegis128l\armcrypto @@ -360,6 +363,9 @@ crypto_core\hsalsa20\ref2 + + crypto_core\softaes + crypto_core\ed25519 @@ -599,6 +605,9 @@ include\sodium\private + + include\sodium\private + include\sodium\private @@ -752,6 +761,18 @@ crypto_stream\salsa20\xmm6 + + crypto_aead\aegis128l + + + crypto_aead\aegis128l\aesni + + + crypto_aead\aegis128l\soft + + + crypto_aead\aegis128l\armcrypto + crypto_core\ed25519 @@ -793,6 +814,9 @@ {2abca274-f068-3cf1-bd4e-5bfc5ee81de6} + + {f606c11a-a160-3619-b842-8e8cce100ba7} + {6897a4cc-0091-3970-b712-c0ac75c16b67} @@ -874,6 +898,9 @@ {eb259fd9-56f0-32db-a903-6bc1549a7326} + + {05997596-e3d7-3bf1-ad4d-39e4c5fd56f6} + {e53b6258-fcdd-34c8-96c5-44510a34a390} diff --git a/builds/msvc/vs2019/libsodium/libsodium.vcxproj b/builds/msvc/vs2019/libsodium/libsodium.vcxproj index 14bcf8db..9ac766d2 100644 --- a/builds/msvc/vs2019/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2019/libsodium/libsodium.vcxproj @@ -200,6 +200,7 @@ + @@ -213,6 +214,7 @@ + @@ -294,6 +296,7 @@ + @@ -345,6 +348,10 @@ + + + + diff --git a/builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters index cd37679d..389276fb 100644 --- a/builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters @@ -321,6 +321,9 @@ crypto_aead\aegis128l\aesni + + crypto_aead\aegis128l\soft + crypto_aead\aegis128l\armcrypto @@ -360,6 +363,9 @@ crypto_core\hsalsa20\ref2 + + crypto_core\softaes + crypto_core\ed25519 @@ -599,6 +605,9 @@ include\sodium\private + + include\sodium\private + include\sodium\private @@ -752,6 +761,18 @@ crypto_stream\salsa20\xmm6 + + crypto_aead\aegis128l + + + crypto_aead\aegis128l\aesni + + + crypto_aead\aegis128l\soft + + + crypto_aead\aegis128l\armcrypto + crypto_core\ed25519 @@ -793,6 +814,9 @@ {2abca274-f068-3cf1-bd4e-5bfc5ee81de6} + + {f606c11a-a160-3619-b842-8e8cce100ba7} + {6897a4cc-0091-3970-b712-c0ac75c16b67} @@ -874,6 +898,9 @@ {eb259fd9-56f0-32db-a903-6bc1549a7326} + + {05997596-e3d7-3bf1-ad4d-39e4c5fd56f6} + {e53b6258-fcdd-34c8-96c5-44510a34a390} diff --git a/builds/msvc/vs2022/libsodium/libsodium.vcxproj b/builds/msvc/vs2022/libsodium/libsodium.vcxproj index 5f0a777d..2fb84695 100644 --- a/builds/msvc/vs2022/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2022/libsodium/libsodium.vcxproj @@ -129,6 +129,7 @@ + @@ -142,6 +143,7 @@ + @@ -223,6 +225,7 @@ + @@ -274,6 +277,10 @@ + + + + diff --git a/builds/msvc/vs2022/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2022/libsodium/libsodium.vcxproj.filters index cd37679d..389276fb 100644 --- a/builds/msvc/vs2022/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2022/libsodium/libsodium.vcxproj.filters @@ -321,6 +321,9 @@ crypto_aead\aegis128l\aesni + + crypto_aead\aegis128l\soft + crypto_aead\aegis128l\armcrypto @@ -360,6 +363,9 @@ crypto_core\hsalsa20\ref2 + + crypto_core\softaes + crypto_core\ed25519 @@ -599,6 +605,9 @@ include\sodium\private + + include\sodium\private + include\sodium\private @@ -752,6 +761,18 @@ crypto_stream\salsa20\xmm6 + + crypto_aead\aegis128l + + + crypto_aead\aegis128l\aesni + + + crypto_aead\aegis128l\soft + + + crypto_aead\aegis128l\armcrypto + crypto_core\ed25519 @@ -793,6 +814,9 @@ {2abca274-f068-3cf1-bd4e-5bfc5ee81de6} + + {f606c11a-a160-3619-b842-8e8cce100ba7} + {6897a4cc-0091-3970-b712-c0ac75c16b67} @@ -874,6 +898,9 @@ {eb259fd9-56f0-32db-a903-6bc1549a7326} + + {05997596-e3d7-3bf1-ad4d-39e4c5fd56f6} + {e53b6258-fcdd-34c8-96c5-44510a34a390} diff --git a/dist-build/emscripten-symbols.def b/dist-build/emscripten-symbols.def index ddefeac9..e45d8704 100644 --- a/dist-build/emscripten-symbols.def +++ b/dist-build/emscripten-symbols.def @@ -1,25 +1,24 @@ -_crypto_aead_aegis128l_abytes 0 0 -_crypto_aead_aegis128l_decrypt 0 0 -_crypto_aead_aegis128l_decrypt_detached 0 0 -_crypto_aead_aegis128l_encrypt 0 0 -_crypto_aead_aegis128l_encrypt_detached 0 0 -_crypto_aead_aegis128l_is_available 0 0 -_crypto_aead_aegis128l_keybytes 0 0 -_crypto_aead_aegis128l_keygen 0 0 -_crypto_aead_aegis128l_messagebytes_max 0 0 -_crypto_aead_aegis128l_npubbytes 0 0 -_crypto_aead_aegis128l_nsecbytes 0 0 -_crypto_aead_aegis256_abytes 0 0 -_crypto_aead_aegis256_decrypt 0 0 -_crypto_aead_aegis256_decrypt_detached 0 0 -_crypto_aead_aegis256_encrypt 0 0 -_crypto_aead_aegis256_encrypt_detached 0 0 -_crypto_aead_aegis256_is_available 0 0 -_crypto_aead_aegis256_keybytes 0 0 -_crypto_aead_aegis256_keygen 0 0 -_crypto_aead_aegis256_messagebytes_max 0 0 -_crypto_aead_aegis256_npubbytes 0 0 -_crypto_aead_aegis256_nsecbytes 0 0 +_crypto_aead_aegis128l_abytes 0 1 +_crypto_aead_aegis128l_decrypt 0 1 +_crypto_aead_aegis128l_decrypt_detached 0 1 +_crypto_aead_aegis128l_encrypt 0 1 +_crypto_aead_aegis128l_encrypt_detached 0 1 +_crypto_aead_aegis128l_keybytes 0 1 +_crypto_aead_aegis128l_keygen 0 1 +_crypto_aead_aegis128l_messagebytes_max 0 1 +_crypto_aead_aegis128l_npubbytes 0 1 +_crypto_aead_aegis128l_nsecbytes 0 1 +_crypto_aead_aegis256_abytes 0 1 +_crypto_aead_aegis256_decrypt 0 1 +_crypto_aead_aegis256_decrypt_detached 0 1 +_crypto_aead_aegis256_encrypt 0 1 +_crypto_aead_aegis256_encrypt_detached 0 1 +_crypto_aead_aegis256_is_available 0 1 +_crypto_aead_aegis256_keybytes 0 1 +_crypto_aead_aegis256_keygen 0 1 +_crypto_aead_aegis256_messagebytes_max 0 1 +_crypto_aead_aegis256_npubbytes 0 1 +_crypto_aead_aegis256_nsecbytes 0 1 _crypto_aead_aes256gcm_abytes 0 0 _crypto_aead_aes256gcm_beforenm 0 0 _crypto_aead_aes256gcm_decrypt 0 0 diff --git a/dist-build/emscripten.sh b/dist-build/emscripten.sh index 2f79f150..24bb45ea 100755 --- a/dist-build/emscripten.sh +++ b/dist-build/emscripten.sh @@ -2,7 +2,7 @@ export MAKE_FLAGS='-j4' export EXPORTED_FUNCTIONS_STANDARD='["_malloc","_free","_crypto_aead_chacha20poly1305_abytes","_crypto_aead_chacha20poly1305_decrypt","_crypto_aead_chacha20poly1305_decrypt_detached","_crypto_aead_chacha20poly1305_encrypt","_crypto_aead_chacha20poly1305_encrypt_detached","_crypto_aead_chacha20poly1305_ietf_abytes","_crypto_aead_chacha20poly1305_ietf_decrypt","_crypto_aead_chacha20poly1305_ietf_decrypt_detached","_crypto_aead_chacha20poly1305_ietf_encrypt","_crypto_aead_chacha20poly1305_ietf_encrypt_detached","_crypto_aead_chacha20poly1305_ietf_keybytes","_crypto_aead_chacha20poly1305_ietf_keygen","_crypto_aead_chacha20poly1305_ietf_messagebytes_max","_crypto_aead_chacha20poly1305_ietf_npubbytes","_crypto_aead_chacha20poly1305_ietf_nsecbytes","_crypto_aead_chacha20poly1305_keybytes","_crypto_aead_chacha20poly1305_keygen","_crypto_aead_chacha20poly1305_messagebytes_max","_crypto_aead_chacha20poly1305_npubbytes","_crypto_aead_chacha20poly1305_nsecbytes","_crypto_aead_xchacha20poly1305_ietf_abytes","_crypto_aead_xchacha20poly1305_ietf_decrypt","_crypto_aead_xchacha20poly1305_ietf_decrypt_detached","_crypto_aead_xchacha20poly1305_ietf_encrypt","_crypto_aead_xchacha20poly1305_ietf_encrypt_detached","_crypto_aead_xchacha20poly1305_ietf_keybytes","_crypto_aead_xchacha20poly1305_ietf_keygen","_crypto_aead_xchacha20poly1305_ietf_messagebytes_max","_crypto_aead_xchacha20poly1305_ietf_npubbytes","_crypto_aead_xchacha20poly1305_ietf_nsecbytes","_crypto_auth","_crypto_auth_bytes","_crypto_auth_keybytes","_crypto_auth_keygen","_crypto_auth_verify","_crypto_box_beforenm","_crypto_box_beforenmbytes","_crypto_box_detached","_crypto_box_detached_afternm","_crypto_box_easy","_crypto_box_easy_afternm","_crypto_box_keypair","_crypto_box_macbytes","_crypto_box_messagebytes_max","_crypto_box_noncebytes","_crypto_box_open_detached","_crypto_box_open_detached_afternm","_crypto_box_open_easy","_crypto_box_open_easy_afternm","_crypto_box_publickeybytes","_crypto_box_seal","_crypto_box_seal_open","_crypto_box_sealbytes","_crypto_box_secretkeybytes","_crypto_box_seed_keypair","_crypto_box_seedbytes","_crypto_generichash","_crypto_generichash_bytes","_crypto_generichash_bytes_max","_crypto_generichash_bytes_min","_crypto_generichash_final","_crypto_generichash_init","_crypto_generichash_keybytes","_crypto_generichash_keybytes_max","_crypto_generichash_keybytes_min","_crypto_generichash_keygen","_crypto_generichash_statebytes","_crypto_generichash_update","_crypto_hash","_crypto_hash_bytes","_crypto_kdf_bytes_max","_crypto_kdf_bytes_min","_crypto_kdf_contextbytes","_crypto_kdf_derive_from_key","_crypto_kdf_keybytes","_crypto_kdf_keygen","_crypto_kx_client_session_keys","_crypto_kx_keypair","_crypto_kx_publickeybytes","_crypto_kx_secretkeybytes","_crypto_kx_seed_keypair","_crypto_kx_seedbytes","_crypto_kx_server_session_keys","_crypto_kx_sessionkeybytes","_crypto_pwhash","_crypto_pwhash_alg_argon2i13","_crypto_pwhash_alg_argon2id13","_crypto_pwhash_alg_default","_crypto_pwhash_bytes_max","_crypto_pwhash_bytes_min","_crypto_pwhash_memlimit_interactive","_crypto_pwhash_memlimit_max","_crypto_pwhash_memlimit_min","_crypto_pwhash_memlimit_moderate","_crypto_pwhash_memlimit_sensitive","_crypto_pwhash_opslimit_interactive","_crypto_pwhash_opslimit_max","_crypto_pwhash_opslimit_min","_crypto_pwhash_opslimit_moderate","_crypto_pwhash_opslimit_sensitive","_crypto_pwhash_passwd_max","_crypto_pwhash_passwd_min","_crypto_pwhash_saltbytes","_crypto_pwhash_str","_crypto_pwhash_str_alg","_crypto_pwhash_str_needs_rehash","_crypto_pwhash_str_verify","_crypto_pwhash_strbytes","_crypto_pwhash_strprefix","_crypto_scalarmult","_crypto_scalarmult_base","_crypto_scalarmult_bytes","_crypto_scalarmult_scalarbytes","_crypto_secretbox_detached","_crypto_secretbox_easy","_crypto_secretbox_keybytes","_crypto_secretbox_keygen","_crypto_secretbox_macbytes","_crypto_secretbox_messagebytes_max","_crypto_secretbox_noncebytes","_crypto_secretbox_open_detached","_crypto_secretbox_open_easy","_crypto_secretstream_xchacha20poly1305_abytes","_crypto_secretstream_xchacha20poly1305_headerbytes","_crypto_secretstream_xchacha20poly1305_init_pull","_crypto_secretstream_xchacha20poly1305_init_push","_crypto_secretstream_xchacha20poly1305_keybytes","_crypto_secretstream_xchacha20poly1305_keygen","_crypto_secretstream_xchacha20poly1305_messagebytes_max","_crypto_secretstream_xchacha20poly1305_pull","_crypto_secretstream_xchacha20poly1305_push","_crypto_secretstream_xchacha20poly1305_rekey","_crypto_secretstream_xchacha20poly1305_statebytes","_crypto_secretstream_xchacha20poly1305_tag_final","_crypto_secretstream_xchacha20poly1305_tag_message","_crypto_secretstream_xchacha20poly1305_tag_push","_crypto_secretstream_xchacha20poly1305_tag_rekey","_crypto_shorthash","_crypto_shorthash_bytes","_crypto_shorthash_keybytes","_crypto_shorthash_keygen","_crypto_sign","_crypto_sign_bytes","_crypto_sign_detached","_crypto_sign_ed25519_pk_to_curve25519","_crypto_sign_ed25519_sk_to_curve25519","_crypto_sign_final_create","_crypto_sign_final_verify","_crypto_sign_init","_crypto_sign_keypair","_crypto_sign_messagebytes_max","_crypto_sign_open","_crypto_sign_publickeybytes","_crypto_sign_secretkeybytes","_crypto_sign_seed_keypair","_crypto_sign_seedbytes","_crypto_sign_statebytes","_crypto_sign_update","_crypto_sign_verify_detached","_randombytes","_randombytes_buf","_randombytes_buf_deterministic","_randombytes_close","_randombytes_random","_randombytes_seedbytes","_randombytes_stir","_randombytes_uniform","_sodium_base642bin","_sodium_base64_encoded_len","_sodium_bin2base64","_sodium_bin2hex","_sodium_hex2bin","_sodium_init","_sodium_library_minimal","_sodium_library_version_major","_sodium_library_version_minor","_sodium_pad","_sodium_unpad","_sodium_version_string"]' -export EXPORTED_FUNCTIONS_SUMO='["_malloc","_free","_crypto_aead_chacha20poly1305_abytes","_crypto_aead_chacha20poly1305_decrypt","_crypto_aead_chacha20poly1305_decrypt_detached","_crypto_aead_chacha20poly1305_encrypt","_crypto_aead_chacha20poly1305_encrypt_detached","_crypto_aead_chacha20poly1305_ietf_abytes","_crypto_aead_chacha20poly1305_ietf_decrypt","_crypto_aead_chacha20poly1305_ietf_decrypt_detached","_crypto_aead_chacha20poly1305_ietf_encrypt","_crypto_aead_chacha20poly1305_ietf_encrypt_detached","_crypto_aead_chacha20poly1305_ietf_keybytes","_crypto_aead_chacha20poly1305_ietf_keygen","_crypto_aead_chacha20poly1305_ietf_messagebytes_max","_crypto_aead_chacha20poly1305_ietf_npubbytes","_crypto_aead_chacha20poly1305_ietf_nsecbytes","_crypto_aead_chacha20poly1305_keybytes","_crypto_aead_chacha20poly1305_keygen","_crypto_aead_chacha20poly1305_messagebytes_max","_crypto_aead_chacha20poly1305_npubbytes","_crypto_aead_chacha20poly1305_nsecbytes","_crypto_aead_xchacha20poly1305_ietf_abytes","_crypto_aead_xchacha20poly1305_ietf_decrypt","_crypto_aead_xchacha20poly1305_ietf_decrypt_detached","_crypto_aead_xchacha20poly1305_ietf_encrypt","_crypto_aead_xchacha20poly1305_ietf_encrypt_detached","_crypto_aead_xchacha20poly1305_ietf_keybytes","_crypto_aead_xchacha20poly1305_ietf_keygen","_crypto_aead_xchacha20poly1305_ietf_messagebytes_max","_crypto_aead_xchacha20poly1305_ietf_npubbytes","_crypto_aead_xchacha20poly1305_ietf_nsecbytes","_crypto_auth","_crypto_auth_bytes","_crypto_auth_hmacsha256","_crypto_auth_hmacsha256_bytes","_crypto_auth_hmacsha256_final","_crypto_auth_hmacsha256_init","_crypto_auth_hmacsha256_keybytes","_crypto_auth_hmacsha256_keygen","_crypto_auth_hmacsha256_statebytes","_crypto_auth_hmacsha256_update","_crypto_auth_hmacsha256_verify","_crypto_auth_hmacsha512","_crypto_auth_hmacsha512256","_crypto_auth_hmacsha512256_bytes","_crypto_auth_hmacsha512256_final","_crypto_auth_hmacsha512256_init","_crypto_auth_hmacsha512256_keybytes","_crypto_auth_hmacsha512256_keygen","_crypto_auth_hmacsha512256_statebytes","_crypto_auth_hmacsha512256_update","_crypto_auth_hmacsha512256_verify","_crypto_auth_hmacsha512_bytes","_crypto_auth_hmacsha512_final","_crypto_auth_hmacsha512_init","_crypto_auth_hmacsha512_keybytes","_crypto_auth_hmacsha512_keygen","_crypto_auth_hmacsha512_statebytes","_crypto_auth_hmacsha512_update","_crypto_auth_hmacsha512_verify","_crypto_auth_keybytes","_crypto_auth_keygen","_crypto_auth_primitive","_crypto_auth_verify","_crypto_box","_crypto_box_afternm","_crypto_box_beforenm","_crypto_box_beforenmbytes","_crypto_box_boxzerobytes","_crypto_box_curve25519xchacha20poly1305_beforenm","_crypto_box_curve25519xchacha20poly1305_beforenmbytes","_crypto_box_curve25519xchacha20poly1305_detached","_crypto_box_curve25519xchacha20poly1305_detached_afternm","_crypto_box_curve25519xchacha20poly1305_easy","_crypto_box_curve25519xchacha20poly1305_easy_afternm","_crypto_box_curve25519xchacha20poly1305_keypair","_crypto_box_curve25519xchacha20poly1305_macbytes","_crypto_box_curve25519xchacha20poly1305_messagebytes_max","_crypto_box_curve25519xchacha20poly1305_noncebytes","_crypto_box_curve25519xchacha20poly1305_open_detached","_crypto_box_curve25519xchacha20poly1305_open_detached_afternm","_crypto_box_curve25519xchacha20poly1305_open_easy","_crypto_box_curve25519xchacha20poly1305_open_easy_afternm","_crypto_box_curve25519xchacha20poly1305_publickeybytes","_crypto_box_curve25519xchacha20poly1305_seal","_crypto_box_curve25519xchacha20poly1305_seal_open","_crypto_box_curve25519xchacha20poly1305_sealbytes","_crypto_box_curve25519xchacha20poly1305_secretkeybytes","_crypto_box_curve25519xchacha20poly1305_seed_keypair","_crypto_box_curve25519xchacha20poly1305_seedbytes","_crypto_box_curve25519xsalsa20poly1305","_crypto_box_curve25519xsalsa20poly1305_afternm","_crypto_box_curve25519xsalsa20poly1305_beforenm","_crypto_box_curve25519xsalsa20poly1305_beforenmbytes","_crypto_box_curve25519xsalsa20poly1305_boxzerobytes","_crypto_box_curve25519xsalsa20poly1305_keypair","_crypto_box_curve25519xsalsa20poly1305_macbytes","_crypto_box_curve25519xsalsa20poly1305_messagebytes_max","_crypto_box_curve25519xsalsa20poly1305_noncebytes","_crypto_box_curve25519xsalsa20poly1305_open","_crypto_box_curve25519xsalsa20poly1305_open_afternm","_crypto_box_curve25519xsalsa20poly1305_publickeybytes","_crypto_box_curve25519xsalsa20poly1305_secretkeybytes","_crypto_box_curve25519xsalsa20poly1305_seed_keypair","_crypto_box_curve25519xsalsa20poly1305_seedbytes","_crypto_box_curve25519xsalsa20poly1305_zerobytes","_crypto_box_detached","_crypto_box_detached_afternm","_crypto_box_easy","_crypto_box_easy_afternm","_crypto_box_keypair","_crypto_box_macbytes","_crypto_box_messagebytes_max","_crypto_box_noncebytes","_crypto_box_open","_crypto_box_open_afternm","_crypto_box_open_detached","_crypto_box_open_detached_afternm","_crypto_box_open_easy","_crypto_box_open_easy_afternm","_crypto_box_primitive","_crypto_box_publickeybytes","_crypto_box_seal","_crypto_box_seal_open","_crypto_box_sealbytes","_crypto_box_secretkeybytes","_crypto_box_seed_keypair","_crypto_box_seedbytes","_crypto_box_zerobytes","_crypto_core_ed25519_add","_crypto_core_ed25519_bytes","_crypto_core_ed25519_from_string","_crypto_core_ed25519_from_string_ro","_crypto_core_ed25519_from_uniform","_crypto_core_ed25519_hashbytes","_crypto_core_ed25519_is_valid_point","_crypto_core_ed25519_nonreducedscalarbytes","_crypto_core_ed25519_random","_crypto_core_ed25519_scalar_add","_crypto_core_ed25519_scalar_complement","_crypto_core_ed25519_scalar_invert","_crypto_core_ed25519_scalar_is_canonical","_crypto_core_ed25519_scalar_mul","_crypto_core_ed25519_scalar_negate","_crypto_core_ed25519_scalar_random","_crypto_core_ed25519_scalar_reduce","_crypto_core_ed25519_scalar_sub","_crypto_core_ed25519_scalarbytes","_crypto_core_ed25519_sub","_crypto_core_ed25519_uniformbytes","_crypto_core_hchacha20","_crypto_core_hchacha20_constbytes","_crypto_core_hchacha20_inputbytes","_crypto_core_hchacha20_keybytes","_crypto_core_hchacha20_outputbytes","_crypto_core_hsalsa20","_crypto_core_hsalsa20_constbytes","_crypto_core_hsalsa20_inputbytes","_crypto_core_hsalsa20_keybytes","_crypto_core_hsalsa20_outputbytes","_crypto_core_ristretto255_add","_crypto_core_ristretto255_bytes","_crypto_core_ristretto255_from_hash","_crypto_core_ristretto255_from_string","_crypto_core_ristretto255_from_string_ro","_crypto_core_ristretto255_hashbytes","_crypto_core_ristretto255_is_valid_point","_crypto_core_ristretto255_nonreducedscalarbytes","_crypto_core_ristretto255_random","_crypto_core_ristretto255_scalar_add","_crypto_core_ristretto255_scalar_complement","_crypto_core_ristretto255_scalar_invert","_crypto_core_ristretto255_scalar_is_canonical","_crypto_core_ristretto255_scalar_mul","_crypto_core_ristretto255_scalar_negate","_crypto_core_ristretto255_scalar_random","_crypto_core_ristretto255_scalar_reduce","_crypto_core_ristretto255_scalar_sub","_crypto_core_ristretto255_scalarbytes","_crypto_core_ristretto255_sub","_crypto_core_salsa20","_crypto_core_salsa2012","_crypto_core_salsa2012_constbytes","_crypto_core_salsa2012_inputbytes","_crypto_core_salsa2012_keybytes","_crypto_core_salsa2012_outputbytes","_crypto_core_salsa208","_crypto_core_salsa208_constbytes","_crypto_core_salsa208_inputbytes","_crypto_core_salsa208_keybytes","_crypto_core_salsa208_outputbytes","_crypto_core_salsa20_constbytes","_crypto_core_salsa20_inputbytes","_crypto_core_salsa20_keybytes","_crypto_core_salsa20_outputbytes","_crypto_generichash","_crypto_generichash_blake2b","_crypto_generichash_blake2b_bytes","_crypto_generichash_blake2b_bytes_max","_crypto_generichash_blake2b_bytes_min","_crypto_generichash_blake2b_final","_crypto_generichash_blake2b_init","_crypto_generichash_blake2b_init_salt_personal","_crypto_generichash_blake2b_keybytes","_crypto_generichash_blake2b_keybytes_max","_crypto_generichash_blake2b_keybytes_min","_crypto_generichash_blake2b_keygen","_crypto_generichash_blake2b_personalbytes","_crypto_generichash_blake2b_salt_personal","_crypto_generichash_blake2b_saltbytes","_crypto_generichash_blake2b_statebytes","_crypto_generichash_blake2b_update","_crypto_generichash_bytes","_crypto_generichash_bytes_max","_crypto_generichash_bytes_min","_crypto_generichash_final","_crypto_generichash_init","_crypto_generichash_keybytes","_crypto_generichash_keybytes_max","_crypto_generichash_keybytes_min","_crypto_generichash_keygen","_crypto_generichash_primitive","_crypto_generichash_statebytes","_crypto_generichash_update","_crypto_hash","_crypto_hash_bytes","_crypto_hash_primitive","_crypto_hash_sha256","_crypto_hash_sha256_bytes","_crypto_hash_sha256_final","_crypto_hash_sha256_init","_crypto_hash_sha256_statebytes","_crypto_hash_sha256_update","_crypto_hash_sha512","_crypto_hash_sha512_bytes","_crypto_hash_sha512_final","_crypto_hash_sha512_init","_crypto_hash_sha512_statebytes","_crypto_hash_sha512_update","_crypto_kdf_blake2b_bytes_max","_crypto_kdf_blake2b_bytes_min","_crypto_kdf_blake2b_contextbytes","_crypto_kdf_blake2b_derive_from_key","_crypto_kdf_blake2b_keybytes","_crypto_kdf_bytes_max","_crypto_kdf_bytes_min","_crypto_kdf_contextbytes","_crypto_kdf_derive_from_key","_crypto_kdf_hkdf_sha256_bytes_max","_crypto_kdf_hkdf_sha256_bytes_min","_crypto_kdf_hkdf_sha256_expand","_crypto_kdf_hkdf_sha256_extract","_crypto_kdf_hkdf_sha256_keybytes","_crypto_kdf_hkdf_sha256_keygen","_crypto_kdf_hkdf_sha512_bytes_max","_crypto_kdf_hkdf_sha512_bytes_min","_crypto_kdf_hkdf_sha512_expand","_crypto_kdf_hkdf_sha512_extract","_crypto_kdf_hkdf_sha512_keybytes","_crypto_kdf_hkdf_sha512_keygen","_crypto_kdf_keybytes","_crypto_kdf_keygen","_crypto_kdf_primitive","_crypto_kx_client_session_keys","_crypto_kx_keypair","_crypto_kx_primitive","_crypto_kx_publickeybytes","_crypto_kx_secretkeybytes","_crypto_kx_seed_keypair","_crypto_kx_seedbytes","_crypto_kx_server_session_keys","_crypto_kx_sessionkeybytes","_crypto_onetimeauth","_crypto_onetimeauth_bytes","_crypto_onetimeauth_final","_crypto_onetimeauth_init","_crypto_onetimeauth_keybytes","_crypto_onetimeauth_keygen","_crypto_onetimeauth_poly1305","_crypto_onetimeauth_poly1305_bytes","_crypto_onetimeauth_poly1305_final","_crypto_onetimeauth_poly1305_init","_crypto_onetimeauth_poly1305_keybytes","_crypto_onetimeauth_poly1305_keygen","_crypto_onetimeauth_poly1305_statebytes","_crypto_onetimeauth_poly1305_update","_crypto_onetimeauth_poly1305_verify","_crypto_onetimeauth_primitive","_crypto_onetimeauth_statebytes","_crypto_onetimeauth_update","_crypto_onetimeauth_verify","_crypto_pwhash","_crypto_pwhash_alg_argon2i13","_crypto_pwhash_alg_argon2id13","_crypto_pwhash_alg_default","_crypto_pwhash_argon2i","_crypto_pwhash_argon2i_alg_argon2i13","_crypto_pwhash_argon2i_bytes_max","_crypto_pwhash_argon2i_bytes_min","_crypto_pwhash_argon2i_memlimit_interactive","_crypto_pwhash_argon2i_memlimit_max","_crypto_pwhash_argon2i_memlimit_min","_crypto_pwhash_argon2i_memlimit_moderate","_crypto_pwhash_argon2i_memlimit_sensitive","_crypto_pwhash_argon2i_opslimit_interactive","_crypto_pwhash_argon2i_opslimit_max","_crypto_pwhash_argon2i_opslimit_min","_crypto_pwhash_argon2i_opslimit_moderate","_crypto_pwhash_argon2i_opslimit_sensitive","_crypto_pwhash_argon2i_passwd_max","_crypto_pwhash_argon2i_passwd_min","_crypto_pwhash_argon2i_saltbytes","_crypto_pwhash_argon2i_str","_crypto_pwhash_argon2i_str_needs_rehash","_crypto_pwhash_argon2i_str_verify","_crypto_pwhash_argon2i_strbytes","_crypto_pwhash_argon2i_strprefix","_crypto_pwhash_argon2id","_crypto_pwhash_argon2id_alg_argon2id13","_crypto_pwhash_argon2id_bytes_max","_crypto_pwhash_argon2id_bytes_min","_crypto_pwhash_argon2id_memlimit_interactive","_crypto_pwhash_argon2id_memlimit_max","_crypto_pwhash_argon2id_memlimit_min","_crypto_pwhash_argon2id_memlimit_moderate","_crypto_pwhash_argon2id_memlimit_sensitive","_crypto_pwhash_argon2id_opslimit_interactive","_crypto_pwhash_argon2id_opslimit_max","_crypto_pwhash_argon2id_opslimit_min","_crypto_pwhash_argon2id_opslimit_moderate","_crypto_pwhash_argon2id_opslimit_sensitive","_crypto_pwhash_argon2id_passwd_max","_crypto_pwhash_argon2id_passwd_min","_crypto_pwhash_argon2id_saltbytes","_crypto_pwhash_argon2id_str","_crypto_pwhash_argon2id_str_needs_rehash","_crypto_pwhash_argon2id_str_verify","_crypto_pwhash_argon2id_strbytes","_crypto_pwhash_argon2id_strprefix","_crypto_pwhash_bytes_max","_crypto_pwhash_bytes_min","_crypto_pwhash_memlimit_interactive","_crypto_pwhash_memlimit_max","_crypto_pwhash_memlimit_min","_crypto_pwhash_memlimit_moderate","_crypto_pwhash_memlimit_sensitive","_crypto_pwhash_opslimit_interactive","_crypto_pwhash_opslimit_max","_crypto_pwhash_opslimit_min","_crypto_pwhash_opslimit_moderate","_crypto_pwhash_opslimit_sensitive","_crypto_pwhash_passwd_max","_crypto_pwhash_passwd_min","_crypto_pwhash_primitive","_crypto_pwhash_saltbytes","_crypto_pwhash_scryptsalsa208sha256","_crypto_pwhash_scryptsalsa208sha256_bytes_max","_crypto_pwhash_scryptsalsa208sha256_bytes_min","_crypto_pwhash_scryptsalsa208sha256_ll","_crypto_pwhash_scryptsalsa208sha256_memlimit_interactive","_crypto_pwhash_scryptsalsa208sha256_memlimit_max","_crypto_pwhash_scryptsalsa208sha256_memlimit_min","_crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive","_crypto_pwhash_scryptsalsa208sha256_opslimit_interactive","_crypto_pwhash_scryptsalsa208sha256_opslimit_max","_crypto_pwhash_scryptsalsa208sha256_opslimit_min","_crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive","_crypto_pwhash_scryptsalsa208sha256_passwd_max","_crypto_pwhash_scryptsalsa208sha256_passwd_min","_crypto_pwhash_scryptsalsa208sha256_saltbytes","_crypto_pwhash_scryptsalsa208sha256_str","_crypto_pwhash_scryptsalsa208sha256_str_needs_rehash","_crypto_pwhash_scryptsalsa208sha256_str_verify","_crypto_pwhash_scryptsalsa208sha256_strbytes","_crypto_pwhash_scryptsalsa208sha256_strprefix","_crypto_pwhash_str","_crypto_pwhash_str_alg","_crypto_pwhash_str_needs_rehash","_crypto_pwhash_str_verify","_crypto_pwhash_strbytes","_crypto_pwhash_strprefix","_crypto_scalarmult","_crypto_scalarmult_base","_crypto_scalarmult_bytes","_crypto_scalarmult_curve25519","_crypto_scalarmult_curve25519_base","_crypto_scalarmult_curve25519_bytes","_crypto_scalarmult_curve25519_scalarbytes","_crypto_scalarmult_ed25519","_crypto_scalarmult_ed25519_base","_crypto_scalarmult_ed25519_base_noclamp","_crypto_scalarmult_ed25519_bytes","_crypto_scalarmult_ed25519_noclamp","_crypto_scalarmult_ed25519_scalarbytes","_crypto_scalarmult_primitive","_crypto_scalarmult_ristretto255","_crypto_scalarmult_ristretto255_base","_crypto_scalarmult_ristretto255_bytes","_crypto_scalarmult_ristretto255_scalarbytes","_crypto_scalarmult_scalarbytes","_crypto_secretbox","_crypto_secretbox_boxzerobytes","_crypto_secretbox_detached","_crypto_secretbox_easy","_crypto_secretbox_keybytes","_crypto_secretbox_keygen","_crypto_secretbox_macbytes","_crypto_secretbox_messagebytes_max","_crypto_secretbox_noncebytes","_crypto_secretbox_open","_crypto_secretbox_open_detached","_crypto_secretbox_open_easy","_crypto_secretbox_primitive","_crypto_secretbox_xchacha20poly1305_detached","_crypto_secretbox_xchacha20poly1305_easy","_crypto_secretbox_xchacha20poly1305_keybytes","_crypto_secretbox_xchacha20poly1305_macbytes","_crypto_secretbox_xchacha20poly1305_messagebytes_max","_crypto_secretbox_xchacha20poly1305_noncebytes","_crypto_secretbox_xchacha20poly1305_open_detached","_crypto_secretbox_xchacha20poly1305_open_easy","_crypto_secretbox_xsalsa20poly1305","_crypto_secretbox_xsalsa20poly1305_boxzerobytes","_crypto_secretbox_xsalsa20poly1305_keybytes","_crypto_secretbox_xsalsa20poly1305_keygen","_crypto_secretbox_xsalsa20poly1305_macbytes","_crypto_secretbox_xsalsa20poly1305_messagebytes_max","_crypto_secretbox_xsalsa20poly1305_noncebytes","_crypto_secretbox_xsalsa20poly1305_open","_crypto_secretbox_xsalsa20poly1305_zerobytes","_crypto_secretbox_zerobytes","_crypto_secretstream_xchacha20poly1305_abytes","_crypto_secretstream_xchacha20poly1305_headerbytes","_crypto_secretstream_xchacha20poly1305_init_pull","_crypto_secretstream_xchacha20poly1305_init_push","_crypto_secretstream_xchacha20poly1305_keybytes","_crypto_secretstream_xchacha20poly1305_keygen","_crypto_secretstream_xchacha20poly1305_messagebytes_max","_crypto_secretstream_xchacha20poly1305_pull","_crypto_secretstream_xchacha20poly1305_push","_crypto_secretstream_xchacha20poly1305_rekey","_crypto_secretstream_xchacha20poly1305_statebytes","_crypto_secretstream_xchacha20poly1305_tag_final","_crypto_secretstream_xchacha20poly1305_tag_message","_crypto_secretstream_xchacha20poly1305_tag_push","_crypto_secretstream_xchacha20poly1305_tag_rekey","_crypto_shorthash","_crypto_shorthash_bytes","_crypto_shorthash_keybytes","_crypto_shorthash_keygen","_crypto_shorthash_primitive","_crypto_shorthash_siphash24","_crypto_shorthash_siphash24_bytes","_crypto_shorthash_siphash24_keybytes","_crypto_shorthash_siphashx24","_crypto_shorthash_siphashx24_bytes","_crypto_shorthash_siphashx24_keybytes","_crypto_sign","_crypto_sign_bytes","_crypto_sign_detached","_crypto_sign_ed25519","_crypto_sign_ed25519_bytes","_crypto_sign_ed25519_detached","_crypto_sign_ed25519_keypair","_crypto_sign_ed25519_messagebytes_max","_crypto_sign_ed25519_open","_crypto_sign_ed25519_pk_to_curve25519","_crypto_sign_ed25519_publickeybytes","_crypto_sign_ed25519_secretkeybytes","_crypto_sign_ed25519_seed_keypair","_crypto_sign_ed25519_seedbytes","_crypto_sign_ed25519_sk_to_curve25519","_crypto_sign_ed25519_sk_to_pk","_crypto_sign_ed25519_sk_to_seed","_crypto_sign_ed25519_verify_detached","_crypto_sign_ed25519ph_final_create","_crypto_sign_ed25519ph_final_verify","_crypto_sign_ed25519ph_init","_crypto_sign_ed25519ph_statebytes","_crypto_sign_ed25519ph_update","_crypto_sign_final_create","_crypto_sign_final_verify","_crypto_sign_init","_crypto_sign_keypair","_crypto_sign_messagebytes_max","_crypto_sign_open","_crypto_sign_primitive","_crypto_sign_publickeybytes","_crypto_sign_secretkeybytes","_crypto_sign_seed_keypair","_crypto_sign_seedbytes","_crypto_sign_statebytes","_crypto_sign_update","_crypto_sign_verify_detached","_crypto_stream","_crypto_stream_chacha20","_crypto_stream_chacha20_ietf","_crypto_stream_chacha20_ietf_keybytes","_crypto_stream_chacha20_ietf_keygen","_crypto_stream_chacha20_ietf_messagebytes_max","_crypto_stream_chacha20_ietf_noncebytes","_crypto_stream_chacha20_ietf_xor","_crypto_stream_chacha20_ietf_xor_ic","_crypto_stream_chacha20_keybytes","_crypto_stream_chacha20_keygen","_crypto_stream_chacha20_messagebytes_max","_crypto_stream_chacha20_noncebytes","_crypto_stream_chacha20_xor","_crypto_stream_chacha20_xor_ic","_crypto_stream_keybytes","_crypto_stream_keygen","_crypto_stream_messagebytes_max","_crypto_stream_noncebytes","_crypto_stream_primitive","_crypto_stream_salsa20","_crypto_stream_salsa2012","_crypto_stream_salsa2012_keybytes","_crypto_stream_salsa2012_keygen","_crypto_stream_salsa2012_messagebytes_max","_crypto_stream_salsa2012_noncebytes","_crypto_stream_salsa2012_xor","_crypto_stream_salsa208","_crypto_stream_salsa208_keybytes","_crypto_stream_salsa208_keygen","_crypto_stream_salsa208_messagebytes_max","_crypto_stream_salsa208_noncebytes","_crypto_stream_salsa208_xor","_crypto_stream_salsa20_keybytes","_crypto_stream_salsa20_keygen","_crypto_stream_salsa20_messagebytes_max","_crypto_stream_salsa20_noncebytes","_crypto_stream_salsa20_xor","_crypto_stream_salsa20_xor_ic","_crypto_stream_xchacha20","_crypto_stream_xchacha20_keybytes","_crypto_stream_xchacha20_keygen","_crypto_stream_xchacha20_messagebytes_max","_crypto_stream_xchacha20_noncebytes","_crypto_stream_xchacha20_xor","_crypto_stream_xchacha20_xor_ic","_crypto_stream_xor","_crypto_stream_xsalsa20","_crypto_stream_xsalsa20_keybytes","_crypto_stream_xsalsa20_keygen","_crypto_stream_xsalsa20_messagebytes_max","_crypto_stream_xsalsa20_noncebytes","_crypto_stream_xsalsa20_xor","_crypto_stream_xsalsa20_xor_ic","_crypto_verify_16","_crypto_verify_16_bytes","_crypto_verify_32","_crypto_verify_32_bytes","_crypto_verify_64","_crypto_verify_64_bytes","_randombytes","_randombytes_buf","_randombytes_buf_deterministic","_randombytes_close","_randombytes_implementation_name","_randombytes_random","_randombytes_seedbytes","_randombytes_stir","_randombytes_uniform","_sodium_base642bin","_sodium_base64_encoded_len","_sodium_bin2base64","_sodium_bin2hex","_sodium_hex2bin","_sodium_init","_sodium_library_minimal","_sodium_library_version_major","_sodium_library_version_minor","_sodium_pad","_sodium_unpad","_sodium_version_string"]' +export EXPORTED_FUNCTIONS_SUMO='["_malloc","_free","_crypto_aead_aegis128l_abytes","_crypto_aead_aegis128l_decrypt","_crypto_aead_aegis128l_decrypt_detached","_crypto_aead_aegis128l_encrypt","_crypto_aead_aegis128l_encrypt_detached","_crypto_aead_aegis128l_keybytes","_crypto_aead_aegis128l_keygen","_crypto_aead_aegis128l_messagebytes_max","_crypto_aead_aegis128l_npubbytes","_crypto_aead_aegis128l_nsecbytes","_crypto_aead_aegis256_abytes","_crypto_aead_aegis256_decrypt","_crypto_aead_aegis256_decrypt_detached","_crypto_aead_aegis256_encrypt","_crypto_aead_aegis256_encrypt_detached","_crypto_aead_aegis256_is_available","_crypto_aead_aegis256_keybytes","_crypto_aead_aegis256_keygen","_crypto_aead_aegis256_messagebytes_max","_crypto_aead_aegis256_npubbytes","_crypto_aead_aegis256_nsecbytes","_crypto_aead_chacha20poly1305_abytes","_crypto_aead_chacha20poly1305_decrypt","_crypto_aead_chacha20poly1305_decrypt_detached","_crypto_aead_chacha20poly1305_encrypt","_crypto_aead_chacha20poly1305_encrypt_detached","_crypto_aead_chacha20poly1305_ietf_abytes","_crypto_aead_chacha20poly1305_ietf_decrypt","_crypto_aead_chacha20poly1305_ietf_decrypt_detached","_crypto_aead_chacha20poly1305_ietf_encrypt","_crypto_aead_chacha20poly1305_ietf_encrypt_detached","_crypto_aead_chacha20poly1305_ietf_keybytes","_crypto_aead_chacha20poly1305_ietf_keygen","_crypto_aead_chacha20poly1305_ietf_messagebytes_max","_crypto_aead_chacha20poly1305_ietf_npubbytes","_crypto_aead_chacha20poly1305_ietf_nsecbytes","_crypto_aead_chacha20poly1305_keybytes","_crypto_aead_chacha20poly1305_keygen","_crypto_aead_chacha20poly1305_messagebytes_max","_crypto_aead_chacha20poly1305_npubbytes","_crypto_aead_chacha20poly1305_nsecbytes","_crypto_aead_xchacha20poly1305_ietf_abytes","_crypto_aead_xchacha20poly1305_ietf_decrypt","_crypto_aead_xchacha20poly1305_ietf_decrypt_detached","_crypto_aead_xchacha20poly1305_ietf_encrypt","_crypto_aead_xchacha20poly1305_ietf_encrypt_detached","_crypto_aead_xchacha20poly1305_ietf_keybytes","_crypto_aead_xchacha20poly1305_ietf_keygen","_crypto_aead_xchacha20poly1305_ietf_messagebytes_max","_crypto_aead_xchacha20poly1305_ietf_npubbytes","_crypto_aead_xchacha20poly1305_ietf_nsecbytes","_crypto_auth","_crypto_auth_bytes","_crypto_auth_hmacsha256","_crypto_auth_hmacsha256_bytes","_crypto_auth_hmacsha256_final","_crypto_auth_hmacsha256_init","_crypto_auth_hmacsha256_keybytes","_crypto_auth_hmacsha256_keygen","_crypto_auth_hmacsha256_statebytes","_crypto_auth_hmacsha256_update","_crypto_auth_hmacsha256_verify","_crypto_auth_hmacsha512","_crypto_auth_hmacsha512256","_crypto_auth_hmacsha512256_bytes","_crypto_auth_hmacsha512256_final","_crypto_auth_hmacsha512256_init","_crypto_auth_hmacsha512256_keybytes","_crypto_auth_hmacsha512256_keygen","_crypto_auth_hmacsha512256_statebytes","_crypto_auth_hmacsha512256_update","_crypto_auth_hmacsha512256_verify","_crypto_auth_hmacsha512_bytes","_crypto_auth_hmacsha512_final","_crypto_auth_hmacsha512_init","_crypto_auth_hmacsha512_keybytes","_crypto_auth_hmacsha512_keygen","_crypto_auth_hmacsha512_statebytes","_crypto_auth_hmacsha512_update","_crypto_auth_hmacsha512_verify","_crypto_auth_keybytes","_crypto_auth_keygen","_crypto_auth_primitive","_crypto_auth_verify","_crypto_box","_crypto_box_afternm","_crypto_box_beforenm","_crypto_box_beforenmbytes","_crypto_box_boxzerobytes","_crypto_box_curve25519xchacha20poly1305_beforenm","_crypto_box_curve25519xchacha20poly1305_beforenmbytes","_crypto_box_curve25519xchacha20poly1305_detached","_crypto_box_curve25519xchacha20poly1305_detached_afternm","_crypto_box_curve25519xchacha20poly1305_easy","_crypto_box_curve25519xchacha20poly1305_easy_afternm","_crypto_box_curve25519xchacha20poly1305_keypair","_crypto_box_curve25519xchacha20poly1305_macbytes","_crypto_box_curve25519xchacha20poly1305_messagebytes_max","_crypto_box_curve25519xchacha20poly1305_noncebytes","_crypto_box_curve25519xchacha20poly1305_open_detached","_crypto_box_curve25519xchacha20poly1305_open_detached_afternm","_crypto_box_curve25519xchacha20poly1305_open_easy","_crypto_box_curve25519xchacha20poly1305_open_easy_afternm","_crypto_box_curve25519xchacha20poly1305_publickeybytes","_crypto_box_curve25519xchacha20poly1305_seal","_crypto_box_curve25519xchacha20poly1305_seal_open","_crypto_box_curve25519xchacha20poly1305_sealbytes","_crypto_box_curve25519xchacha20poly1305_secretkeybytes","_crypto_box_curve25519xchacha20poly1305_seed_keypair","_crypto_box_curve25519xchacha20poly1305_seedbytes","_crypto_box_curve25519xsalsa20poly1305","_crypto_box_curve25519xsalsa20poly1305_afternm","_crypto_box_curve25519xsalsa20poly1305_beforenm","_crypto_box_curve25519xsalsa20poly1305_beforenmbytes","_crypto_box_curve25519xsalsa20poly1305_boxzerobytes","_crypto_box_curve25519xsalsa20poly1305_keypair","_crypto_box_curve25519xsalsa20poly1305_macbytes","_crypto_box_curve25519xsalsa20poly1305_messagebytes_max","_crypto_box_curve25519xsalsa20poly1305_noncebytes","_crypto_box_curve25519xsalsa20poly1305_open","_crypto_box_curve25519xsalsa20poly1305_open_afternm","_crypto_box_curve25519xsalsa20poly1305_publickeybytes","_crypto_box_curve25519xsalsa20poly1305_secretkeybytes","_crypto_box_curve25519xsalsa20poly1305_seed_keypair","_crypto_box_curve25519xsalsa20poly1305_seedbytes","_crypto_box_curve25519xsalsa20poly1305_zerobytes","_crypto_box_detached","_crypto_box_detached_afternm","_crypto_box_easy","_crypto_box_easy_afternm","_crypto_box_keypair","_crypto_box_macbytes","_crypto_box_messagebytes_max","_crypto_box_noncebytes","_crypto_box_open","_crypto_box_open_afternm","_crypto_box_open_detached","_crypto_box_open_detached_afternm","_crypto_box_open_easy","_crypto_box_open_easy_afternm","_crypto_box_primitive","_crypto_box_publickeybytes","_crypto_box_seal","_crypto_box_seal_open","_crypto_box_sealbytes","_crypto_box_secretkeybytes","_crypto_box_seed_keypair","_crypto_box_seedbytes","_crypto_box_zerobytes","_crypto_core_ed25519_add","_crypto_core_ed25519_bytes","_crypto_core_ed25519_from_string","_crypto_core_ed25519_from_string_ro","_crypto_core_ed25519_from_uniform","_crypto_core_ed25519_hashbytes","_crypto_core_ed25519_is_valid_point","_crypto_core_ed25519_nonreducedscalarbytes","_crypto_core_ed25519_random","_crypto_core_ed25519_scalar_add","_crypto_core_ed25519_scalar_complement","_crypto_core_ed25519_scalar_invert","_crypto_core_ed25519_scalar_is_canonical","_crypto_core_ed25519_scalar_mul","_crypto_core_ed25519_scalar_negate","_crypto_core_ed25519_scalar_random","_crypto_core_ed25519_scalar_reduce","_crypto_core_ed25519_scalar_sub","_crypto_core_ed25519_scalarbytes","_crypto_core_ed25519_sub","_crypto_core_ed25519_uniformbytes","_crypto_core_hchacha20","_crypto_core_hchacha20_constbytes","_crypto_core_hchacha20_inputbytes","_crypto_core_hchacha20_keybytes","_crypto_core_hchacha20_outputbytes","_crypto_core_hsalsa20","_crypto_core_hsalsa20_constbytes","_crypto_core_hsalsa20_inputbytes","_crypto_core_hsalsa20_keybytes","_crypto_core_hsalsa20_outputbytes","_crypto_core_ristretto255_add","_crypto_core_ristretto255_bytes","_crypto_core_ristretto255_from_hash","_crypto_core_ristretto255_from_string","_crypto_core_ristretto255_from_string_ro","_crypto_core_ristretto255_hashbytes","_crypto_core_ristretto255_is_valid_point","_crypto_core_ristretto255_nonreducedscalarbytes","_crypto_core_ristretto255_random","_crypto_core_ristretto255_scalar_add","_crypto_core_ristretto255_scalar_complement","_crypto_core_ristretto255_scalar_invert","_crypto_core_ristretto255_scalar_is_canonical","_crypto_core_ristretto255_scalar_mul","_crypto_core_ristretto255_scalar_negate","_crypto_core_ristretto255_scalar_random","_crypto_core_ristretto255_scalar_reduce","_crypto_core_ristretto255_scalar_sub","_crypto_core_ristretto255_scalarbytes","_crypto_core_ristretto255_sub","_crypto_core_salsa20","_crypto_core_salsa2012","_crypto_core_salsa2012_constbytes","_crypto_core_salsa2012_inputbytes","_crypto_core_salsa2012_keybytes","_crypto_core_salsa2012_outputbytes","_crypto_core_salsa208","_crypto_core_salsa208_constbytes","_crypto_core_salsa208_inputbytes","_crypto_core_salsa208_keybytes","_crypto_core_salsa208_outputbytes","_crypto_core_salsa20_constbytes","_crypto_core_salsa20_inputbytes","_crypto_core_salsa20_keybytes","_crypto_core_salsa20_outputbytes","_crypto_generichash","_crypto_generichash_blake2b","_crypto_generichash_blake2b_bytes","_crypto_generichash_blake2b_bytes_max","_crypto_generichash_blake2b_bytes_min","_crypto_generichash_blake2b_final","_crypto_generichash_blake2b_init","_crypto_generichash_blake2b_init_salt_personal","_crypto_generichash_blake2b_keybytes","_crypto_generichash_blake2b_keybytes_max","_crypto_generichash_blake2b_keybytes_min","_crypto_generichash_blake2b_keygen","_crypto_generichash_blake2b_personalbytes","_crypto_generichash_blake2b_salt_personal","_crypto_generichash_blake2b_saltbytes","_crypto_generichash_blake2b_statebytes","_crypto_generichash_blake2b_update","_crypto_generichash_bytes","_crypto_generichash_bytes_max","_crypto_generichash_bytes_min","_crypto_generichash_final","_crypto_generichash_init","_crypto_generichash_keybytes","_crypto_generichash_keybytes_max","_crypto_generichash_keybytes_min","_crypto_generichash_keygen","_crypto_generichash_primitive","_crypto_generichash_statebytes","_crypto_generichash_update","_crypto_hash","_crypto_hash_bytes","_crypto_hash_primitive","_crypto_hash_sha256","_crypto_hash_sha256_bytes","_crypto_hash_sha256_final","_crypto_hash_sha256_init","_crypto_hash_sha256_statebytes","_crypto_hash_sha256_update","_crypto_hash_sha512","_crypto_hash_sha512_bytes","_crypto_hash_sha512_final","_crypto_hash_sha512_init","_crypto_hash_sha512_statebytes","_crypto_hash_sha512_update","_crypto_kdf_blake2b_bytes_max","_crypto_kdf_blake2b_bytes_min","_crypto_kdf_blake2b_contextbytes","_crypto_kdf_blake2b_derive_from_key","_crypto_kdf_blake2b_keybytes","_crypto_kdf_bytes_max","_crypto_kdf_bytes_min","_crypto_kdf_contextbytes","_crypto_kdf_derive_from_key","_crypto_kdf_hkdf_sha256_bytes_max","_crypto_kdf_hkdf_sha256_bytes_min","_crypto_kdf_hkdf_sha256_expand","_crypto_kdf_hkdf_sha256_extract","_crypto_kdf_hkdf_sha256_keybytes","_crypto_kdf_hkdf_sha256_keygen","_crypto_kdf_hkdf_sha512_bytes_max","_crypto_kdf_hkdf_sha512_bytes_min","_crypto_kdf_hkdf_sha512_expand","_crypto_kdf_hkdf_sha512_extract","_crypto_kdf_hkdf_sha512_keybytes","_crypto_kdf_hkdf_sha512_keygen","_crypto_kdf_keybytes","_crypto_kdf_keygen","_crypto_kdf_primitive","_crypto_kx_client_session_keys","_crypto_kx_keypair","_crypto_kx_primitive","_crypto_kx_publickeybytes","_crypto_kx_secretkeybytes","_crypto_kx_seed_keypair","_crypto_kx_seedbytes","_crypto_kx_server_session_keys","_crypto_kx_sessionkeybytes","_crypto_onetimeauth","_crypto_onetimeauth_bytes","_crypto_onetimeauth_final","_crypto_onetimeauth_init","_crypto_onetimeauth_keybytes","_crypto_onetimeauth_keygen","_crypto_onetimeauth_poly1305","_crypto_onetimeauth_poly1305_bytes","_crypto_onetimeauth_poly1305_final","_crypto_onetimeauth_poly1305_init","_crypto_onetimeauth_poly1305_keybytes","_crypto_onetimeauth_poly1305_keygen","_crypto_onetimeauth_poly1305_statebytes","_crypto_onetimeauth_poly1305_update","_crypto_onetimeauth_poly1305_verify","_crypto_onetimeauth_primitive","_crypto_onetimeauth_statebytes","_crypto_onetimeauth_update","_crypto_onetimeauth_verify","_crypto_pwhash","_crypto_pwhash_alg_argon2i13","_crypto_pwhash_alg_argon2id13","_crypto_pwhash_alg_default","_crypto_pwhash_argon2i","_crypto_pwhash_argon2i_alg_argon2i13","_crypto_pwhash_argon2i_bytes_max","_crypto_pwhash_argon2i_bytes_min","_crypto_pwhash_argon2i_memlimit_interactive","_crypto_pwhash_argon2i_memlimit_max","_crypto_pwhash_argon2i_memlimit_min","_crypto_pwhash_argon2i_memlimit_moderate","_crypto_pwhash_argon2i_memlimit_sensitive","_crypto_pwhash_argon2i_opslimit_interactive","_crypto_pwhash_argon2i_opslimit_max","_crypto_pwhash_argon2i_opslimit_min","_crypto_pwhash_argon2i_opslimit_moderate","_crypto_pwhash_argon2i_opslimit_sensitive","_crypto_pwhash_argon2i_passwd_max","_crypto_pwhash_argon2i_passwd_min","_crypto_pwhash_argon2i_saltbytes","_crypto_pwhash_argon2i_str","_crypto_pwhash_argon2i_str_needs_rehash","_crypto_pwhash_argon2i_str_verify","_crypto_pwhash_argon2i_strbytes","_crypto_pwhash_argon2i_strprefix","_crypto_pwhash_argon2id","_crypto_pwhash_argon2id_alg_argon2id13","_crypto_pwhash_argon2id_bytes_max","_crypto_pwhash_argon2id_bytes_min","_crypto_pwhash_argon2id_memlimit_interactive","_crypto_pwhash_argon2id_memlimit_max","_crypto_pwhash_argon2id_memlimit_min","_crypto_pwhash_argon2id_memlimit_moderate","_crypto_pwhash_argon2id_memlimit_sensitive","_crypto_pwhash_argon2id_opslimit_interactive","_crypto_pwhash_argon2id_opslimit_max","_crypto_pwhash_argon2id_opslimit_min","_crypto_pwhash_argon2id_opslimit_moderate","_crypto_pwhash_argon2id_opslimit_sensitive","_crypto_pwhash_argon2id_passwd_max","_crypto_pwhash_argon2id_passwd_min","_crypto_pwhash_argon2id_saltbytes","_crypto_pwhash_argon2id_str","_crypto_pwhash_argon2id_str_needs_rehash","_crypto_pwhash_argon2id_str_verify","_crypto_pwhash_argon2id_strbytes","_crypto_pwhash_argon2id_strprefix","_crypto_pwhash_bytes_max","_crypto_pwhash_bytes_min","_crypto_pwhash_memlimit_interactive","_crypto_pwhash_memlimit_max","_crypto_pwhash_memlimit_min","_crypto_pwhash_memlimit_moderate","_crypto_pwhash_memlimit_sensitive","_crypto_pwhash_opslimit_interactive","_crypto_pwhash_opslimit_max","_crypto_pwhash_opslimit_min","_crypto_pwhash_opslimit_moderate","_crypto_pwhash_opslimit_sensitive","_crypto_pwhash_passwd_max","_crypto_pwhash_passwd_min","_crypto_pwhash_primitive","_crypto_pwhash_saltbytes","_crypto_pwhash_scryptsalsa208sha256","_crypto_pwhash_scryptsalsa208sha256_bytes_max","_crypto_pwhash_scryptsalsa208sha256_bytes_min","_crypto_pwhash_scryptsalsa208sha256_ll","_crypto_pwhash_scryptsalsa208sha256_memlimit_interactive","_crypto_pwhash_scryptsalsa208sha256_memlimit_max","_crypto_pwhash_scryptsalsa208sha256_memlimit_min","_crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive","_crypto_pwhash_scryptsalsa208sha256_opslimit_interactive","_crypto_pwhash_scryptsalsa208sha256_opslimit_max","_crypto_pwhash_scryptsalsa208sha256_opslimit_min","_crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive","_crypto_pwhash_scryptsalsa208sha256_passwd_max","_crypto_pwhash_scryptsalsa208sha256_passwd_min","_crypto_pwhash_scryptsalsa208sha256_saltbytes","_crypto_pwhash_scryptsalsa208sha256_str","_crypto_pwhash_scryptsalsa208sha256_str_needs_rehash","_crypto_pwhash_scryptsalsa208sha256_str_verify","_crypto_pwhash_scryptsalsa208sha256_strbytes","_crypto_pwhash_scryptsalsa208sha256_strprefix","_crypto_pwhash_str","_crypto_pwhash_str_alg","_crypto_pwhash_str_needs_rehash","_crypto_pwhash_str_verify","_crypto_pwhash_strbytes","_crypto_pwhash_strprefix","_crypto_scalarmult","_crypto_scalarmult_base","_crypto_scalarmult_bytes","_crypto_scalarmult_curve25519","_crypto_scalarmult_curve25519_base","_crypto_scalarmult_curve25519_bytes","_crypto_scalarmult_curve25519_scalarbytes","_crypto_scalarmult_ed25519","_crypto_scalarmult_ed25519_base","_crypto_scalarmult_ed25519_base_noclamp","_crypto_scalarmult_ed25519_bytes","_crypto_scalarmult_ed25519_noclamp","_crypto_scalarmult_ed25519_scalarbytes","_crypto_scalarmult_primitive","_crypto_scalarmult_ristretto255","_crypto_scalarmult_ristretto255_base","_crypto_scalarmult_ristretto255_bytes","_crypto_scalarmult_ristretto255_scalarbytes","_crypto_scalarmult_scalarbytes","_crypto_secretbox","_crypto_secretbox_boxzerobytes","_crypto_secretbox_detached","_crypto_secretbox_easy","_crypto_secretbox_keybytes","_crypto_secretbox_keygen","_crypto_secretbox_macbytes","_crypto_secretbox_messagebytes_max","_crypto_secretbox_noncebytes","_crypto_secretbox_open","_crypto_secretbox_open_detached","_crypto_secretbox_open_easy","_crypto_secretbox_primitive","_crypto_secretbox_xchacha20poly1305_detached","_crypto_secretbox_xchacha20poly1305_easy","_crypto_secretbox_xchacha20poly1305_keybytes","_crypto_secretbox_xchacha20poly1305_macbytes","_crypto_secretbox_xchacha20poly1305_messagebytes_max","_crypto_secretbox_xchacha20poly1305_noncebytes","_crypto_secretbox_xchacha20poly1305_open_detached","_crypto_secretbox_xchacha20poly1305_open_easy","_crypto_secretbox_xsalsa20poly1305","_crypto_secretbox_xsalsa20poly1305_boxzerobytes","_crypto_secretbox_xsalsa20poly1305_keybytes","_crypto_secretbox_xsalsa20poly1305_keygen","_crypto_secretbox_xsalsa20poly1305_macbytes","_crypto_secretbox_xsalsa20poly1305_messagebytes_max","_crypto_secretbox_xsalsa20poly1305_noncebytes","_crypto_secretbox_xsalsa20poly1305_open","_crypto_secretbox_xsalsa20poly1305_zerobytes","_crypto_secretbox_zerobytes","_crypto_secretstream_xchacha20poly1305_abytes","_crypto_secretstream_xchacha20poly1305_headerbytes","_crypto_secretstream_xchacha20poly1305_init_pull","_crypto_secretstream_xchacha20poly1305_init_push","_crypto_secretstream_xchacha20poly1305_keybytes","_crypto_secretstream_xchacha20poly1305_keygen","_crypto_secretstream_xchacha20poly1305_messagebytes_max","_crypto_secretstream_xchacha20poly1305_pull","_crypto_secretstream_xchacha20poly1305_push","_crypto_secretstream_xchacha20poly1305_rekey","_crypto_secretstream_xchacha20poly1305_statebytes","_crypto_secretstream_xchacha20poly1305_tag_final","_crypto_secretstream_xchacha20poly1305_tag_message","_crypto_secretstream_xchacha20poly1305_tag_push","_crypto_secretstream_xchacha20poly1305_tag_rekey","_crypto_shorthash","_crypto_shorthash_bytes","_crypto_shorthash_keybytes","_crypto_shorthash_keygen","_crypto_shorthash_primitive","_crypto_shorthash_siphash24","_crypto_shorthash_siphash24_bytes","_crypto_shorthash_siphash24_keybytes","_crypto_shorthash_siphashx24","_crypto_shorthash_siphashx24_bytes","_crypto_shorthash_siphashx24_keybytes","_crypto_sign","_crypto_sign_bytes","_crypto_sign_detached","_crypto_sign_ed25519","_crypto_sign_ed25519_bytes","_crypto_sign_ed25519_detached","_crypto_sign_ed25519_keypair","_crypto_sign_ed25519_messagebytes_max","_crypto_sign_ed25519_open","_crypto_sign_ed25519_pk_to_curve25519","_crypto_sign_ed25519_publickeybytes","_crypto_sign_ed25519_secretkeybytes","_crypto_sign_ed25519_seed_keypair","_crypto_sign_ed25519_seedbytes","_crypto_sign_ed25519_sk_to_curve25519","_crypto_sign_ed25519_sk_to_pk","_crypto_sign_ed25519_sk_to_seed","_crypto_sign_ed25519_verify_detached","_crypto_sign_ed25519ph_final_create","_crypto_sign_ed25519ph_final_verify","_crypto_sign_ed25519ph_init","_crypto_sign_ed25519ph_statebytes","_crypto_sign_ed25519ph_update","_crypto_sign_final_create","_crypto_sign_final_verify","_crypto_sign_init","_crypto_sign_keypair","_crypto_sign_messagebytes_max","_crypto_sign_open","_crypto_sign_primitive","_crypto_sign_publickeybytes","_crypto_sign_secretkeybytes","_crypto_sign_seed_keypair","_crypto_sign_seedbytes","_crypto_sign_statebytes","_crypto_sign_update","_crypto_sign_verify_detached","_crypto_stream","_crypto_stream_chacha20","_crypto_stream_chacha20_ietf","_crypto_stream_chacha20_ietf_keybytes","_crypto_stream_chacha20_ietf_keygen","_crypto_stream_chacha20_ietf_messagebytes_max","_crypto_stream_chacha20_ietf_noncebytes","_crypto_stream_chacha20_ietf_xor","_crypto_stream_chacha20_ietf_xor_ic","_crypto_stream_chacha20_keybytes","_crypto_stream_chacha20_keygen","_crypto_stream_chacha20_messagebytes_max","_crypto_stream_chacha20_noncebytes","_crypto_stream_chacha20_xor","_crypto_stream_chacha20_xor_ic","_crypto_stream_keybytes","_crypto_stream_keygen","_crypto_stream_messagebytes_max","_crypto_stream_noncebytes","_crypto_stream_primitive","_crypto_stream_salsa20","_crypto_stream_salsa2012","_crypto_stream_salsa2012_keybytes","_crypto_stream_salsa2012_keygen","_crypto_stream_salsa2012_messagebytes_max","_crypto_stream_salsa2012_noncebytes","_crypto_stream_salsa2012_xor","_crypto_stream_salsa208","_crypto_stream_salsa208_keybytes","_crypto_stream_salsa208_keygen","_crypto_stream_salsa208_messagebytes_max","_crypto_stream_salsa208_noncebytes","_crypto_stream_salsa208_xor","_crypto_stream_salsa20_keybytes","_crypto_stream_salsa20_keygen","_crypto_stream_salsa20_messagebytes_max","_crypto_stream_salsa20_noncebytes","_crypto_stream_salsa20_xor","_crypto_stream_salsa20_xor_ic","_crypto_stream_xchacha20","_crypto_stream_xchacha20_keybytes","_crypto_stream_xchacha20_keygen","_crypto_stream_xchacha20_messagebytes_max","_crypto_stream_xchacha20_noncebytes","_crypto_stream_xchacha20_xor","_crypto_stream_xchacha20_xor_ic","_crypto_stream_xor","_crypto_stream_xsalsa20","_crypto_stream_xsalsa20_keybytes","_crypto_stream_xsalsa20_keygen","_crypto_stream_xsalsa20_messagebytes_max","_crypto_stream_xsalsa20_noncebytes","_crypto_stream_xsalsa20_xor","_crypto_stream_xsalsa20_xor_ic","_crypto_verify_16","_crypto_verify_16_bytes","_crypto_verify_32","_crypto_verify_32_bytes","_crypto_verify_64","_crypto_verify_64_bytes","_randombytes","_randombytes_buf","_randombytes_buf_deterministic","_randombytes_close","_randombytes_implementation_name","_randombytes_random","_randombytes_seedbytes","_randombytes_stir","_randombytes_uniform","_sodium_base642bin","_sodium_base64_encoded_len","_sodium_bin2base64","_sodium_bin2hex","_sodium_hex2bin","_sodium_init","_sodium_library_minimal","_sodium_library_version_major","_sodium_library_version_minor","_sodium_pad","_sodium_unpad","_sodium_version_string"]' export EXPORTED_RUNTIME_METHODS='["UTF8ToString","getValue","setValue"]' export MAX_MEMORY=16777216 export MAX_MEMORY_SUMO=16777216 diff --git a/libsodium.vcxproj b/libsodium.vcxproj index c82f5cbf..4e7c20f2 100644 --- a/libsodium.vcxproj +++ b/libsodium.vcxproj @@ -414,6 +414,7 @@ + @@ -427,6 +428,7 @@ + @@ -508,6 +510,7 @@ + @@ -559,6 +562,10 @@ + + + + diff --git a/libsodium.vcxproj.filters b/libsodium.vcxproj.filters index 7c72d364..ae641960 100644 --- a/libsodium.vcxproj.filters +++ b/libsodium.vcxproj.filters @@ -312,6 +312,9 @@ Source Files + + Source Files + Source Files @@ -351,6 +354,9 @@ Source Files + + Source Files + Source Files @@ -590,6 +596,9 @@ Header Files + + Header Files + Header Files @@ -743,6 +752,18 @@ Header Files + + Header Files + + + Header Files + + + Header Files + + + Header Files + Header Files diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 59c6e814..dc839823 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -3,6 +3,9 @@ lib_LTLIBRARIES = \ libsodium_la_SOURCES = \ crypto_aead/aegis128l/aead_aegis128l.c \ + crypto_aead/aegis128l/aead_aegis128l.h \ + crypto_aead/aegis128l/soft/aead_aegis128l_soft.c \ + crypto_aead/aegis128l/soft/aead_aegis128l_soft.h \ crypto_aead/aegis256/aead_aegis256.c \ crypto_aead/aes256gcm/aead_aes256gcm.c \ crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c \ @@ -22,6 +25,7 @@ libsodium_la_SOURCES = \ crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c \ crypto_core/hsalsa20/core_hsalsa20.c \ crypto_core/salsa/ref/core_salsa_ref.c \ + crypto_core/softaes/softaes.c \ crypto_generichash/crypto_generichash.c \ crypto_generichash/blake2b/generichash_blake2.c \ crypto_generichash/blake2b/ref/blake2.h \ @@ -93,6 +97,7 @@ libsodium_la_SOURCES = \ include/sodium/private/implementations.h \ include/sodium/private/mutex.h \ include/sodium/private/sse2_64_32.h \ + include/sodium/private/softaes.h \ include/sodium/private/quirks.h \ randombytes/randombytes.c \ sodium/codecs.c \ @@ -224,6 +229,7 @@ libarmcrypto_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \ @CFLAGS_ARMCRYPTO@ libarmcrypto_la_SOURCES = \ crypto_aead/aegis128l/armcrypto/aead_aegis128l_armcrypto.c \ + crypto_aead/aegis128l/armcrypto/aead_aegis128l_armcrypto.h \ crypto_aead/aegis256/armcrypto/aead_aegis256_armcrypto.c \ crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c @@ -231,9 +237,10 @@ libaesni_la_LDFLAGS = $(libsodium_la_LDFLAGS) libaesni_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \ @CFLAGS_SSE2@ @CFLAGS_SSSE3@ @CFLAGS_AESNI@ @CFLAGS_PCLMUL@ libaesni_la_SOURCES = \ - crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c \ crypto_aead/aegis128l/aesni/aead_aegis128l_aesni.c \ - crypto_aead/aegis256/aesni/aead_aegis256_aesni.c + crypto_aead/aegis128l/aesni/aead_aegis128l_aesni.h \ + crypto_aead/aegis256/aesni/aead_aegis256_aesni.c \ + crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c libsse2_la_LDFLAGS = $(libsodium_la_LDFLAGS) libsse2_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \ diff --git a/src/libsodium/crypto_aead/aegis128l/aead_aegis128l.c b/src/libsodium/crypto_aead/aegis128l/aead_aegis128l.c index a07f881d..2de17845 100644 --- a/src/libsodium/crypto_aead/aegis128l/aead_aegis128l.c +++ b/src/libsodium/crypto_aead/aegis128l/aead_aegis128l.c @@ -2,9 +2,27 @@ #include #include +#include "core.h" #include "crypto_aead_aegis128l.h" #include "private/common.h" +#include "private/implementations.h" #include "randombytes.h" +#include "runtime.h" + +#include "aead_aegis128l.h" + +#include "soft/aead_aegis128l_soft.h" + +#if defined(HAVE_ARMCRYPTO) && defined(NATIVE_LITTLE_ENDIAN) +#include "armcrypto/aead_aegis128l_armcrypto.h" +#endif + +#if defined(HAVE_TMMINTRIN_H) && defined(HAVE_WMMINTRIN_H) +#include "aesni/aead_aegis128l_aesni.h" +#endif + +static const crypto_aead_aegis128l_implementation *implementation = + &crypto_aead_aegis128l_soft_implementation; size_t crypto_aead_aegis128l_keybytes(void) @@ -42,42 +60,27 @@ crypto_aead_aegis128l_keygen(unsigned char k[crypto_aead_aegis128l_KEYBYTES]) randombytes_buf(k, crypto_aead_aegis128l_KEYBYTES); } -#if !((defined(HAVE_TMMINTRIN_H) && defined(HAVE_WMMINTRIN_H)) || \ - (defined(HAVE_ARMCRYPTO) && defined(NATIVE_LITTLE_ENDIAN))) - -#ifndef ENOSYS -# define ENOSYS ENXIO -#endif - -int -crypto_aead_aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac, - unsigned long long *maclen_p, const unsigned char *m, - unsigned long long mlen, const unsigned char *ad, - unsigned long long adlen, const unsigned char *nsec, - const unsigned char *npub, const unsigned char *k) -{ - errno = ENOSYS; - return -1; -} - int crypto_aead_aegis128l_encrypt(unsigned char *c, unsigned long long *clen_p, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k) { - errno = ENOSYS; - return -1; -} + unsigned long long clen = 0ULL; + int ret; -int -crypto_aead_aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, const unsigned char *c, - unsigned long long clen, const unsigned char *mac, - const unsigned char *ad, unsigned long long adlen, - const unsigned char *npub, const unsigned char *k) -{ - errno = ENOSYS; - return -1; + if (mlen > crypto_aead_aegis128l_MESSAGEBYTES_MAX) { + sodium_misuse(); + } + ret = crypto_aead_aegis128l_encrypt_detached(c, c + mlen, NULL, m, mlen, ad, adlen, nsec, npub, + k); + if (clen_p != NULL) { + if (ret == 0) { + clen = mlen + 16ULL; + } + *clen_p = clen; + } + return ret; } int @@ -86,14 +89,59 @@ crypto_aead_aegis128l_decrypt(unsigned char *m, unsigned long long *mlen_p, unsi const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k) { - errno = ENOSYS; - return -1; + unsigned long long mlen = 0ULL; + int ret = -1; + + if (clen >= 16ULL) { + ret = crypto_aead_aegis128l_decrypt_detached(m, nsec, c, clen - 16ULL, c + clen - 16ULL, ad, + adlen, npub, k); + } + if (mlen_p != NULL) { + if (ret == 0) { + mlen = clen - 16ULL; + } + *mlen_p = mlen; + } + return ret; } int -crypto_aead_aegis128l_is_available(void) +crypto_aead_aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac, + unsigned long long *maclen_p, const unsigned char *m, + unsigned long long mlen, const unsigned char *ad, + unsigned long long adlen, const unsigned char *nsec, + const unsigned char *npub, const unsigned char *k) { - return 0; + return implementation->encrypt_detached(c, mac, maclen_p, m, mlen, ad, adlen, nsec, npub, k); } +int +crypto_aead_aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, + const unsigned char *c, unsigned long long clen, + const unsigned char *mac, const unsigned char *ad, + unsigned long long adlen, const unsigned char *npub, + const unsigned char *k) +{ + return implementation->decrypt_detached(m, nsec, c, clen, mac, ad, adlen, npub, k); +} + +int +_crypto_aead_aegis128l_pick_best_implementation(void) +{ + implementation = &crypto_aead_aegis128l_soft_implementation; + +#if defined(HAVE_ARMCRYPTO) && defined(NATIVE_LITTLE_ENDIAN) + if (sodium_runtime_has_armcrypto()) { + implementation = &crypto_aead_aegis128l_armcrypto_implementation; + return 0; + } #endif + +#if defined(HAVE_TMMINTRIN_H) && defined(HAVE_WMMINTRIN_H) + if (sodium_runtime_has_aesni()) { + implementation = &crypto_aead_aegis128l_aesni_implementation; + return 0; + } +#endif + return 0; /* LCOV_EXCL_LINE */ +} diff --git a/src/libsodium/crypto_aead/aegis128l/aead_aegis128l.h b/src/libsodium/crypto_aead/aegis128l/aead_aegis128l.h new file mode 100644 index 00000000..d112c8f4 --- /dev/null +++ b/src/libsodium/crypto_aead/aegis128l/aead_aegis128l.h @@ -0,0 +1,16 @@ +#ifndef aead_aegis128l_H +#define aead_aegis128l_H + +typedef struct crypto_aead_aegis128l_implementation { + int (*encrypt_detached)(unsigned char *c, unsigned char *mac, unsigned long long *maclen_p, + const unsigned char *m, unsigned long long mlen, + const unsigned char *ad, unsigned long long adlen, + const unsigned char *nsec, const unsigned char *npub, + const unsigned char *k); + int (*decrypt_detached)(unsigned char *m, unsigned char *nsec, const unsigned char *c, + unsigned long long clen, const unsigned char *mac, + const unsigned char *ad, unsigned long long adlen, + const unsigned char *npub, const unsigned char *k); +} crypto_aead_aegis128l_implementation; + +#endif diff --git a/src/libsodium/crypto_aead/aegis128l/aesni/aead_aegis128l_aesni.c b/src/libsodium/crypto_aead/aegis128l/aesni/aead_aegis128l_aesni.c index 635dfdef..cb69a91e 100644 --- a/src/libsodium/crypto_aead/aegis128l/aesni/aead_aegis128l_aesni.c +++ b/src/libsodium/crypto_aead/aegis128l/aesni/aead_aegis128l_aesni.c @@ -7,7 +7,6 @@ #include #include "core.h" -#include "crypto_aead_aegis128l.h" #include "crypto_verify_16.h" #include "export.h" #include "randombytes.h" @@ -16,6 +15,8 @@ #include "private/common.h" +#include "aead_aegis128l_aesni.h" + #if defined(HAVE_TMMINTRIN_H) && defined(HAVE_WMMINTRIN_H) #ifdef __GNUC__ @@ -36,7 +37,7 @@ typedef __m128i aes_block_t; #define AES_ENC(A, B) _mm_aesenc_si128((A), (B)) static inline void -crypto_aead_aegis128l_update(aes_block_t *const state, const aes_block_t d1, const aes_block_t d2) +aegis128l_update(aes_block_t *const state, const aes_block_t d1, const aes_block_t d2) { aes_block_t tmp; @@ -55,8 +56,7 @@ crypto_aead_aegis128l_update(aes_block_t *const state, const aes_block_t d1, con } static void -crypto_aead_aegis128l_init(const unsigned char *key, const unsigned char *nonce, - aes_block_t *const state) +aegis128l_init(const unsigned char *key, const unsigned char *nonce, aes_block_t *const state) { static CRYPTO_ALIGN(16) const uint8_t c0_[] = { 0xdb, 0x3d, 0x18, 0x55, 0x6d, 0xc2, 0x2f, 0xf1, @@ -82,13 +82,13 @@ crypto_aead_aegis128l_init(const unsigned char *key, const unsigned char *nonce, state[6] = AES_BLOCK_XOR(k, c0); state[7] = AES_BLOCK_XOR(k, c1); for (i = 0; i < 10; i++) { - crypto_aead_aegis128l_update(state, n, k); + aegis128l_update(state, n, k); } } static void -crypto_aead_aegis128l_mac(unsigned char *mac, unsigned long long adlen, unsigned long long mlen, - aes_block_t *const state) +aegis128l_mac(unsigned char *mac, unsigned long long adlen, unsigned long long mlen, + aes_block_t *const state) { aes_block_t tmp; int i; @@ -97,7 +97,7 @@ crypto_aead_aegis128l_mac(unsigned char *mac, unsigned long long adlen, unsigned tmp = AES_BLOCK_XOR(tmp, state[2]); for (i = 0; i < 7; i++) { - crypto_aead_aegis128l_update(state, tmp, tmp); + aegis128l_update(state, tmp, tmp); } tmp = AES_BLOCK_XOR(state[6], state[5]); @@ -111,18 +111,17 @@ crypto_aead_aegis128l_mac(unsigned char *mac, unsigned long long adlen, unsigned } static inline void -crypto_aead_aegis128l_absorb(const unsigned char *const src, aes_block_t *const state) +aegis128l_absorb(const unsigned char *const src, aes_block_t *const state) { aes_block_t msg0, msg1; msg0 = AES_BLOCK_LOAD(src); msg1 = AES_BLOCK_LOAD(src + 16); - crypto_aead_aegis128l_update(state, msg0, msg1); + aegis128l_update(state, msg0, msg1); } static void -crypto_aead_aegis128l_enc(unsigned char *const dst, const unsigned char *const src, - aes_block_t *const state) +aegis128l_enc(unsigned char *const dst, const unsigned char *const src, aes_block_t *const state) { aes_block_t msg0, msg1; aes_block_t tmp0, tmp1; @@ -138,12 +137,11 @@ crypto_aead_aegis128l_enc(unsigned char *const dst, const unsigned char *const s AES_BLOCK_STORE((aes_block_t *) (void *) dst, tmp0); AES_BLOCK_STORE((aes_block_t *) (void *) (dst + 16), tmp1); - crypto_aead_aegis128l_update(state, msg0, msg1); + aegis128l_update(state, msg0, msg1); } static void -crypto_aead_aegis128l_dec(unsigned char *const dst, const unsigned char *const src, - aes_block_t *const state) +aegis128l_dec(unsigned char *const dst, const unsigned char *const src, aes_block_t *const state) { aes_block_t msg0, msg1; @@ -158,15 +156,14 @@ crypto_aead_aegis128l_dec(unsigned char *const dst, const unsigned char *const s AES_BLOCK_STORE((aes_block_t *) (void *) dst, msg0); AES_BLOCK_STORE((aes_block_t *) (void *) (dst + 16), msg1); - crypto_aead_aegis128l_update(state, msg0, msg1); + aegis128l_update(state, msg0, msg1); } -int -crypto_aead_aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac, - unsigned long long *maclen_p, const unsigned char *m, - unsigned long long mlen, const unsigned char *ad, - unsigned long long adlen, const unsigned char *nsec, - const unsigned char *npub, const unsigned char *k) +static int +aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac, unsigned long long *maclen_p, + const unsigned char *m, unsigned long long mlen, const unsigned char *ad, + unsigned long long adlen, const unsigned char *nsec, + const unsigned char *npub, const unsigned char *k) { aes_block_t state[8]; CRYPTO_ALIGN(16) unsigned char src[32]; @@ -174,27 +171,27 @@ crypto_aead_aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac, unsigned long long i; (void) nsec; - crypto_aead_aegis128l_init(k, npub, state); + aegis128l_init(k, npub, state); for (i = 0ULL; i + 32ULL <= adlen; i += 32ULL) { - crypto_aead_aegis128l_absorb(ad + i, state); + aegis128l_absorb(ad + i, state); } if (adlen & 0x1f) { memset(src, 0, 32); memcpy(src, ad + i, adlen & 0x1f); - crypto_aead_aegis128l_absorb(src, state); + aegis128l_absorb(src, state); } for (i = 0ULL; i + 32ULL <= mlen; i += 32ULL) { - crypto_aead_aegis128l_enc(c + i, m + i, state); + aegis128l_enc(c + i, m + i, state); } if (mlen & 0x1f) { memset(src, 0, 32); memcpy(src, m + i, mlen & 0x1f); - crypto_aead_aegis128l_enc(dst, src, state); + aegis128l_enc(dst, src, state); memcpy(c + i, dst, mlen & 0x1f); } - crypto_aead_aegis128l_mac(mac, adlen, mlen, state); + aegis128l_mac(mac, adlen, mlen, state); sodium_memzero(state, sizeof state); sodium_memzero(src, sizeof src); sodium_memzero(dst, sizeof dst); @@ -205,35 +202,11 @@ crypto_aead_aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac, return 0; } -int -crypto_aead_aegis128l_encrypt(unsigned char *c, unsigned long long *clen_p, const unsigned char *m, - unsigned long long mlen, const unsigned char *ad, - unsigned long long adlen, const unsigned char *nsec, - const unsigned char *npub, const unsigned char *k) -{ - unsigned long long clen = 0ULL; - int ret; - - if (mlen > crypto_aead_aegis128l_MESSAGEBYTES_MAX) { - sodium_misuse(); - } - ret = crypto_aead_aegis128l_encrypt_detached(c, c + mlen, NULL, m, mlen, ad, adlen, nsec, npub, - k); - if (clen_p != NULL) { - if (ret == 0) { - clen = mlen + 16ULL; - } - *clen_p = clen; - } - return ret; -} - -int -crypto_aead_aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, - const unsigned char *c, unsigned long long clen, - const unsigned char *mac, const unsigned char *ad, - unsigned long long adlen, const unsigned char *npub, - const unsigned char *k) +static int +aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, const unsigned char *c, + unsigned long long clen, const unsigned char *mac, + const unsigned char *ad, unsigned long long adlen, + const unsigned char *npub, const unsigned char *k) { aes_block_t state[8]; CRYPTO_ALIGN(16) unsigned char src[32]; @@ -245,29 +218,29 @@ crypto_aead_aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, (void) nsec; mlen = clen; - crypto_aead_aegis128l_init(k, npub, state); + aegis128l_init(k, npub, state); for (i = 0ULL; i + 32ULL <= adlen; i += 32ULL) { - crypto_aead_aegis128l_absorb(ad + i, state); + aegis128l_absorb(ad + i, state); } if (adlen & 0x1f) { memset(src, 0, 32); memcpy(src, ad + i, adlen & 0x1f); - crypto_aead_aegis128l_absorb(src, state); + aegis128l_absorb(src, state); } if (m != NULL) { for (i = 0ULL; i + 32ULL <= mlen; i += 32ULL) { - crypto_aead_aegis128l_dec(m + i, c + i, state); + aegis128l_dec(m + i, c + i, state); } } else { for (i = 0ULL; i + 32ULL <= mlen; i += 32ULL) { - crypto_aead_aegis128l_dec(dst, c + i, state); + aegis128l_dec(dst, c + i, state); } } if (mlen & 0x1f) { memset(src, 0, 32); memcpy(src, c + i, mlen & 0x1f); - crypto_aead_aegis128l_dec(dst, src, state); + aegis128l_dec(dst, src, state); if (m != NULL) { memcpy(m + i, dst, mlen & 0x1f); } @@ -278,7 +251,7 @@ crypto_aead_aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, AES_BLOCK_LOAD((const aes_block_t *) (const void *) (dst + 16))); } - crypto_aead_aegis128l_mac(computed_mac, adlen, mlen, state); + aegis128l_mac(computed_mac, adlen, mlen, state); sodium_memzero(state, sizeof state); sodium_memzero(src, sizeof src); sodium_memzero(dst, sizeof dst); @@ -294,32 +267,8 @@ crypto_aead_aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, return 0; } -int -crypto_aead_aegis128l_decrypt(unsigned char *m, unsigned long long *mlen_p, unsigned char *nsec, - const unsigned char *c, unsigned long long clen, - const unsigned char *ad, unsigned long long adlen, - const unsigned char *npub, const unsigned char *k) -{ - unsigned long long mlen = 0ULL; - int ret = -1; - - if (clen >= 16ULL) { - ret = crypto_aead_aegis128l_decrypt_detached(m, nsec, c, clen - 16ULL, c + clen - 16ULL, ad, - adlen, npub, k); - } - if (mlen_p != NULL) { - if (ret == 0) { - mlen = clen - 16ULL; - } - *mlen_p = mlen; - } - return ret; -} - -int -crypto_aead_aegis128l_is_available(void) -{ - return sodium_runtime_has_aesni(); -} - +struct crypto_aead_aegis128l_implementation crypto_aead_aegis128l_aesni_implementation = { + SODIUM_C99(.encrypt_detached =) aegis128l_encrypt_detached, + SODIUM_C99(.decrypt_detached =) aegis128l_decrypt_detached +}; #endif diff --git a/src/libsodium/crypto_aead/aegis128l/aesni/aead_aegis128l_aesni.h b/src/libsodium/crypto_aead/aegis128l/aesni/aead_aegis128l_aesni.h new file mode 100644 index 00000000..1b747c7f --- /dev/null +++ b/src/libsodium/crypto_aead/aegis128l/aesni/aead_aegis128l_aesni.h @@ -0,0 +1,6 @@ +#include + +#include "../aead_aegis128l.h" +#include "crypto_aead_aegis128l.h" + +extern struct crypto_aead_aegis128l_implementation crypto_aead_aegis128l_aesni_implementation; diff --git a/src/libsodium/crypto_aead/aegis128l/armcrypto/aead_aegis128l_armcrypto.c b/src/libsodium/crypto_aead/aegis128l/armcrypto/aead_aegis128l_armcrypto.c index e3468ac9..98ec55ac 100644 --- a/src/libsodium/crypto_aead/aegis128l/armcrypto/aead_aegis128l_armcrypto.c +++ b/src/libsodium/crypto_aead/aegis128l/armcrypto/aead_aegis128l_armcrypto.c @@ -12,6 +12,8 @@ #include "private/common.h" +#include "aead_aegis128l_armcrypto.h" + #if defined(HAVE_ARMCRYPTO) && defined(NATIVE_LITTLE_ENDIAN) #include @@ -25,7 +27,7 @@ typedef uint8x16_t aes_block_t; #define AES_ENC(A, B) veorq_u8(vaesmcq_u8(vaeseq_u8((A), vmovq_n_u8(0))), (B)) static inline void -crypto_aead_aegis128l_update(aes_block_t *const state, const aes_block_t d1, const aes_block_t d2) +aegis128l_update(aes_block_t *const state, const aes_block_t d1, const aes_block_t d2) { aes_block_t tmp; @@ -44,8 +46,7 @@ crypto_aead_aegis128l_update(aes_block_t *const state, const aes_block_t d1, con } static void -crypto_aead_aegis128l_init(const unsigned char *key, const unsigned char *nonce, - aes_block_t *const state) +aegis128l_init(const unsigned char *key, const unsigned char *nonce, aes_block_t *const state) { static CRYPTO_ALIGN(16) const unsigned char c0_[] = { 0xdb, 0x3d, 0x18, 0x55, 0x6d, 0xc2, 0x2f, 0xf1, @@ -71,13 +72,13 @@ crypto_aead_aegis128l_init(const unsigned char *key, const unsigned char *nonce, state[6] = AES_BLOCK_XOR(k, c0); state[7] = AES_BLOCK_XOR(k, c1); for (i = 0; i < 10; i++) { - crypto_aead_aegis128l_update(state, n, k); + aegis128l_update(state, n, k); } } static void -crypto_aead_aegis128l_mac(unsigned char *mac, unsigned long long adlen, unsigned long long mlen, - aes_block_t *const state) +aegis128l_mac(unsigned char *mac, unsigned long long adlen, unsigned long long mlen, + aes_block_t *const state) { aes_block_t tmp; int i; @@ -86,7 +87,7 @@ crypto_aead_aegis128l_mac(unsigned char *mac, unsigned long long adlen, unsigned tmp = AES_BLOCK_XOR(tmp, state[2]); for (i = 0; i < 7; i++) { - crypto_aead_aegis128l_update(state, tmp, tmp); + aegis128l_update(state, tmp, tmp); } tmp = AES_BLOCK_XOR(state[6], state[5]); @@ -100,19 +101,17 @@ crypto_aead_aegis128l_mac(unsigned char *mac, unsigned long long adlen, unsigned } static inline void -crypto_aead_aegis128l_absorb(const unsigned char *const src, aes_block_t *const state) +aegis128l_absorb(const unsigned char *const src, aes_block_t *const state) { aes_block_t msg0, msg1; msg0 = AES_BLOCK_LOAD(src); msg1 = AES_BLOCK_LOAD(src + 16); - crypto_aead_aegis128l_update(state, msg0, msg1); + aegis128l_update(state, msg0, msg1); } static void -crypto_aead_aegis128l_enc(unsigned char *const dst, - const unsigned char *const src, - aes_block_t *const state) +aegis128l_enc(unsigned char *const dst, const unsigned char *const src, aes_block_t *const state) { aes_block_t msg0, msg1; aes_block_t tmp0, tmp1; @@ -128,13 +127,11 @@ crypto_aead_aegis128l_enc(unsigned char *const dst, AES_BLOCK_STORE(dst, tmp0); AES_BLOCK_STORE(dst + 16, tmp1); - crypto_aead_aegis128l_update(state, msg0, msg1); + aegis128l_update(state, msg0, msg1); } static void -crypto_aead_aegis128l_dec(unsigned char *const dst, - const unsigned char *const src, - aes_block_t *const state) +aegis128l_dec(unsigned char *const dst, const unsigned char *const src, aes_block_t *const state) { aes_block_t msg0, msg1; @@ -149,15 +146,14 @@ crypto_aead_aegis128l_dec(unsigned char *const dst, AES_BLOCK_STORE(dst, msg0); AES_BLOCK_STORE(dst + 16, msg1); - crypto_aead_aegis128l_update(state, msg0, msg1); + aegis128l_update(state, msg0, msg1); } -int -crypto_aead_aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac, - unsigned long long *maclen_p, const unsigned char *m, - unsigned long long mlen, const unsigned char *ad, - unsigned long long adlen, const unsigned char *nsec, - const unsigned char *npub, const unsigned char *k) +static int +aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac, unsigned long long *maclen_p, + const unsigned char *m, unsigned long long mlen, const unsigned char *ad, + unsigned long long adlen, const unsigned char *nsec, + const unsigned char *npub, const unsigned char *k) { aes_block_t state[8]; CRYPTO_ALIGN(16) unsigned char src[32]; @@ -165,27 +161,27 @@ crypto_aead_aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac, unsigned long long i; (void) nsec; - crypto_aead_aegis128l_init(k, npub, state); + aegis128l_init(k, npub, state); for (i = 0ULL; i + 32ULL <= adlen; i += 32ULL) { - crypto_aead_aegis128l_absorb(ad + i, state); + aegis128l_absorb(ad + i, state); } if (adlen & 0x1f) { memset(src, 0, 32); memcpy(src, ad + i, adlen & 0x1f); - crypto_aead_aegis128l_absorb(src, state); + aegis128l_absorb(src, state); } for (i = 0ULL; i + 32ULL <= mlen; i += 32ULL) { - crypto_aead_aegis128l_enc(c + i, m + i, state); + aegis128l_enc(c + i, m + i, state); } if (mlen & 0x1f) { memset(src, 0, 32); memcpy(src, m + i, mlen & 0x1f); - crypto_aead_aegis128l_enc(dst, src, state); + aegis128l_enc(dst, src, state); memcpy(c + i, dst, mlen & 0x1f); } - crypto_aead_aegis128l_mac(mac, adlen, mlen, state); + aegis128l_mac(mac, adlen, mlen, state); sodium_memzero(state, sizeof state); sodium_memzero(src, sizeof src); sodium_memzero(dst, sizeof dst); @@ -196,35 +192,11 @@ crypto_aead_aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac, return 0; } -int -crypto_aead_aegis128l_encrypt(unsigned char *c, unsigned long long *clen_p, const unsigned char *m, - unsigned long long mlen, const unsigned char *ad, - unsigned long long adlen, const unsigned char *nsec, - const unsigned char *npub, const unsigned char *k) -{ - unsigned long long clen = 0ULL; - int ret; - - if (mlen > crypto_aead_aegis128l_MESSAGEBYTES_MAX) { - sodium_misuse(); - } - ret = crypto_aead_aegis128l_encrypt_detached(c, c + mlen, NULL, m, mlen, ad, adlen, nsec, npub, - k); - if (clen_p != NULL) { - if (ret == 0) { - clen = mlen + 16ULL; - } - *clen_p = clen; - } - return ret; -} - -int -crypto_aead_aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, - const unsigned char *c, unsigned long long clen, - const unsigned char *mac, const unsigned char *ad, - unsigned long long adlen, const unsigned char *npub, - const unsigned char *k) +static int +aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, const unsigned char *c, + unsigned long long clen, const unsigned char *mac, + const unsigned char *ad, unsigned long long adlen, + const unsigned char *npub, const unsigned char *k) { aes_block_t state[8]; CRYPTO_ALIGN(16) unsigned char src[32]; @@ -236,29 +208,29 @@ crypto_aead_aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, (void) nsec; mlen = clen; - crypto_aead_aegis128l_init(k, npub, state); + aegis128l_init(k, npub, state); for (i = 0ULL; i + 32ULL <= adlen; i += 32ULL) { - crypto_aead_aegis128l_absorb(ad + i, state); + aegis128l_absorb(ad + i, state); } if (adlen & 0x1f) { memset(src, 0, 32); memcpy(src, ad + i, adlen & 0x1f); - crypto_aead_aegis128l_absorb(src, state); + aegis128l_absorb(src, state); } if (m != NULL) { for (i = 0ULL; i + 32ULL <= mlen; i += 32ULL) { - crypto_aead_aegis128l_dec(m + i, c + i, state); + aegis128l_dec(m + i, c + i, state); } } else { for (i = 0ULL; i + 32ULL <= mlen; i += 32ULL) { - crypto_aead_aegis128l_dec(dst, c + i, state); + aegis128l_dec(dst, c + i, state); } } if (mlen & 0x1f) { memset(src, 0, 32); memcpy(src, c + i, mlen & 0x1f); - crypto_aead_aegis128l_dec(dst, src, state); + aegis128l_dec(dst, src, state); if (m != NULL) { memcpy(m + i, dst, mlen & 0x1f); } @@ -267,7 +239,7 @@ crypto_aead_aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, state[4] = AES_BLOCK_XOR(state[4], AES_BLOCK_LOAD(dst + 16)); } - crypto_aead_aegis128l_mac(computed_mac, adlen, mlen, state); + aegis128l_mac(computed_mac, adlen, mlen, state); sodium_memzero(state, sizeof state); sodium_memzero(src, sizeof src); sodium_memzero(dst, sizeof dst); @@ -283,32 +255,8 @@ crypto_aead_aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, return 0; } -int -crypto_aead_aegis128l_decrypt(unsigned char *m, unsigned long long *mlen_p, unsigned char *nsec, - const unsigned char *c, unsigned long long clen, - const unsigned char *ad, unsigned long long adlen, - const unsigned char *npub, const unsigned char *k) -{ - unsigned long long mlen = 0ULL; - int ret = -1; - - if (clen >= 16ULL) { - ret = crypto_aead_aegis128l_decrypt_detached(m, nsec, c, clen - 16ULL, c + clen - 16ULL, ad, - adlen, npub, k); - } - if (mlen_p != NULL) { - if (ret == 0) { - mlen = clen - 16ULL; - } - *mlen_p = mlen; - } - return ret; -} - -int -crypto_aead_aegis128l_is_available(void) -{ - return sodium_runtime_has_armcrypto(); -} - +struct crypto_aead_aegis128l_implementation crypto_aead_aegis128l_armcrypto_implementation = { + SODIUM_C99(.encrypt_detached =) aegis128l_encrypt_detached, + SODIUM_C99(.decrypt_detached =) aegis128l_decrypt_detached +}; #endif diff --git a/src/libsodium/crypto_aead/aegis128l/armcrypto/aead_aegis128l_armcrypto.h b/src/libsodium/crypto_aead/aegis128l/armcrypto/aead_aegis128l_armcrypto.h new file mode 100644 index 00000000..715da68d --- /dev/null +++ b/src/libsodium/crypto_aead/aegis128l/armcrypto/aead_aegis128l_armcrypto.h @@ -0,0 +1,6 @@ +#include + +#include "../aead_aegis128l.h" +#include "crypto_aead_aegis128l.h" + +extern struct crypto_aead_aegis128l_implementation crypto_aead_aegis128l_armcrypto_implementation; diff --git a/src/libsodium/crypto_aead/aegis128l/soft/aead_aegis128l_soft.c b/src/libsodium/crypto_aead/aegis128l/soft/aead_aegis128l_soft.c new file mode 100644 index 00000000..31f57aef --- /dev/null +++ b/src/libsodium/crypto_aead/aegis128l/soft/aead_aegis128l_soft.c @@ -0,0 +1,258 @@ +#include +#include +#include + +#include "core.h" +#include "crypto_aead_aegis128l.h" +#include "crypto_verify_16.h" +#include "export.h" +#include "randombytes.h" +#include "runtime.h" +#include "utils.h" + +#include "private/common.h" +#include "private/softaes.h" + +#include "aead_aegis128l_soft.h" + +typedef SoftAesBlock aes_block_t; +#define AES_BLOCK_XOR(A, B) softaes_block_xor((A), (B)) +#define AES_BLOCK_AND(A, B) softaes_block_and((A), (B)) +#define AES_BLOCK_LOAD(A) softaes_block_load(A) +#define AES_BLOCK_LOAD_64x2(A, B) softaes_block_load64x2((A), (B)) +#define AES_BLOCK_STORE(A, B) softaes_block_store((A), (B)) +#define AES_ENC(A, B) softaes_block_encrypt((A), (B)) + +static inline void +aegis128l_update(aes_block_t *const state, const aes_block_t d1, const aes_block_t d2) +{ + aes_block_t tmp; + + tmp = state[7]; + state[7] = AES_ENC(state[6], state[7]); + state[6] = AES_ENC(state[5], state[6]); + state[5] = AES_ENC(state[4], state[5]); + state[4] = AES_ENC(state[3], state[4]); + state[3] = AES_ENC(state[2], state[3]); + state[2] = AES_ENC(state[1], state[2]); + state[1] = AES_ENC(state[0], state[1]); + state[0] = AES_ENC(tmp, state[0]); + + state[0] = AES_BLOCK_XOR(state[0], d1); + state[4] = AES_BLOCK_XOR(state[4], d2); +} + +static void +aegis128l_init(const unsigned char *key, const unsigned char *nonce, aes_block_t *const state) +{ + static CRYPTO_ALIGN(16) + const unsigned char c0_[] = { 0xdb, 0x3d, 0x18, 0x55, 0x6d, 0xc2, 0x2f, 0xf1, + 0x20, 0x11, 0x31, 0x42, 0x73, 0xb5, 0x28, 0xdd }; + static CRYPTO_ALIGN(16) + const unsigned char c1_[] = { 0x00, 0x01, 0x01, 0x02, 0x03, 0x05, 0x08, 0x0d, + 0x15, 0x22, 0x37, 0x59, 0x90, 0xe9, 0x79, 0x62 }; + const aes_block_t c0 = AES_BLOCK_LOAD(c0_); + const aes_block_t c1 = AES_BLOCK_LOAD(c1_); + aes_block_t k; + aes_block_t n; + int i; + + k = AES_BLOCK_LOAD(key); + n = AES_BLOCK_LOAD(nonce); + + state[0] = AES_BLOCK_XOR(k, n); + state[1] = c0; + state[2] = c1; + state[3] = c0; + state[4] = AES_BLOCK_XOR(k, n); + state[5] = AES_BLOCK_XOR(k, c1); + state[6] = AES_BLOCK_XOR(k, c0); + state[7] = AES_BLOCK_XOR(k, c1); + for (i = 0; i < 10; i++) { + aegis128l_update(state, n, k); + } +} + +static void +aegis128l_mac(unsigned char *mac, unsigned long long adlen, unsigned long long mlen, + aes_block_t *const state) +{ + aes_block_t tmp; + int i; + + tmp = AES_BLOCK_LOAD_64x2(mlen << 3, adlen << 3); + tmp = AES_BLOCK_XOR(tmp, state[2]); + + for (i = 0; i < 7; i++) { + aegis128l_update(state, tmp, tmp); + } + + tmp = AES_BLOCK_XOR(state[6], state[5]); + tmp = AES_BLOCK_XOR(tmp, state[4]); + tmp = AES_BLOCK_XOR(tmp, state[3]); + tmp = AES_BLOCK_XOR(tmp, state[2]); + tmp = AES_BLOCK_XOR(tmp, state[1]); + tmp = AES_BLOCK_XOR(tmp, state[0]); + + AES_BLOCK_STORE(mac, tmp); +} + +static inline void +aegis128l_absorb(const unsigned char *const src, aes_block_t *const state) +{ + aes_block_t msg0, msg1; + + msg0 = AES_BLOCK_LOAD(src); + msg1 = AES_BLOCK_LOAD(src + 16); + aegis128l_update(state, msg0, msg1); +} + +static void +aegis128l_enc(unsigned char *const dst, const unsigned char *const src, aes_block_t *const state) +{ + aes_block_t msg0, msg1; + aes_block_t tmp0, tmp1; + + msg0 = AES_BLOCK_LOAD(src); + msg1 = AES_BLOCK_LOAD(src + 16); + tmp0 = AES_BLOCK_XOR(msg0, state[6]); + tmp0 = AES_BLOCK_XOR(tmp0, state[1]); + tmp1 = AES_BLOCK_XOR(msg1, state[2]); + tmp1 = AES_BLOCK_XOR(tmp1, state[5]); + tmp0 = AES_BLOCK_XOR(tmp0, AES_BLOCK_AND(state[2], state[3])); + tmp1 = AES_BLOCK_XOR(tmp1, AES_BLOCK_AND(state[6], state[7])); + AES_BLOCK_STORE(dst, tmp0); + AES_BLOCK_STORE(dst + 16, tmp1); + + aegis128l_update(state, msg0, msg1); +} + +static void +aegis128l_dec(unsigned char *const dst, const unsigned char *const src, aes_block_t *const state) +{ + aes_block_t msg0, msg1; + + msg0 = AES_BLOCK_LOAD(src); + msg1 = AES_BLOCK_LOAD(src + 16); + msg0 = AES_BLOCK_XOR(msg0, state[6]); + msg0 = AES_BLOCK_XOR(msg0, state[1]); + msg1 = AES_BLOCK_XOR(msg1, state[2]); + msg1 = AES_BLOCK_XOR(msg1, state[5]); + msg0 = AES_BLOCK_XOR(msg0, AES_BLOCK_AND(state[2], state[3])); + msg1 = AES_BLOCK_XOR(msg1, AES_BLOCK_AND(state[6], state[7])); + AES_BLOCK_STORE(dst, msg0); + AES_BLOCK_STORE(dst + 16, msg1); + + aegis128l_update(state, msg0, msg1); +} + +static int +aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac, unsigned long long *maclen_p, + const unsigned char *m, unsigned long long mlen, const unsigned char *ad, + unsigned long long adlen, const unsigned char *nsec, + const unsigned char *npub, const unsigned char *k) +{ + aes_block_t state[8]; + CRYPTO_ALIGN(16) unsigned char src[32]; + CRYPTO_ALIGN(16) unsigned char dst[32]; + unsigned long long i; + + (void) nsec; + aegis128l_init(k, npub, state); + + for (i = 0ULL; i + 32ULL <= adlen; i += 32ULL) { + aegis128l_absorb(ad + i, state); + } + if (adlen & 0x1f) { + memset(src, 0, 32); + memcpy(src, ad + i, adlen & 0x1f); + aegis128l_absorb(src, state); + } + for (i = 0ULL; i + 32ULL <= mlen; i += 32ULL) { + aegis128l_enc(c + i, m + i, state); + } + if (mlen & 0x1f) { + memset(src, 0, 32); + memcpy(src, m + i, mlen & 0x1f); + aegis128l_enc(dst, src, state); + memcpy(c + i, dst, mlen & 0x1f); + } + + aegis128l_mac(mac, adlen, mlen, state); + sodium_memzero(state, sizeof state); + sodium_memzero(src, sizeof src); + sodium_memzero(dst, sizeof dst); + + if (maclen_p != NULL) { + *maclen_p = 16ULL; + } + return 0; +} + +static int +aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec, const unsigned char *c, + unsigned long long clen, const unsigned char *mac, + const unsigned char *ad, unsigned long long adlen, + const unsigned char *npub, const unsigned char *k) +{ + aes_block_t state[8]; + CRYPTO_ALIGN(16) unsigned char src[32]; + CRYPTO_ALIGN(16) unsigned char dst[32]; + CRYPTO_ALIGN(16) unsigned char computed_mac[16]; + unsigned long long i; + unsigned long long mlen; + int ret; + + (void) nsec; + mlen = clen; + aegis128l_init(k, npub, state); + + for (i = 0ULL; i + 32ULL <= adlen; i += 32ULL) { + aegis128l_absorb(ad + i, state); + } + if (adlen & 0x1f) { + memset(src, 0, 32); + memcpy(src, ad + i, adlen & 0x1f); + aegis128l_absorb(src, state); + } + if (m != NULL) { + for (i = 0ULL; i + 32ULL <= mlen; i += 32ULL) { + aegis128l_dec(m + i, c + i, state); + } + } else { + for (i = 0ULL; i + 32ULL <= mlen; i += 32ULL) { + aegis128l_dec(dst, c + i, state); + } + } + if (mlen & 0x1f) { + memset(src, 0, 32); + memcpy(src, c + i, mlen & 0x1f); + aegis128l_dec(dst, src, state); + if (m != NULL) { + memcpy(m + i, dst, mlen & 0x1f); + } + memset(dst, 0, mlen & 0x1f); + state[0] = AES_BLOCK_XOR(state[0], AES_BLOCK_LOAD(dst)); + state[4] = AES_BLOCK_XOR(state[4], AES_BLOCK_LOAD(dst + 16)); + } + + aegis128l_mac(computed_mac, adlen, mlen, state); + sodium_memzero(state, sizeof state); + sodium_memzero(src, sizeof src); + sodium_memzero(dst, sizeof dst); + ret = crypto_verify_16(computed_mac, mac); + sodium_memzero(computed_mac, sizeof computed_mac); + if (m == NULL) { + return ret; + } + if (ret != 0) { + memset(m, 0, mlen); + return -1; + } + return 0; +} + +struct crypto_aead_aegis128l_implementation crypto_aead_aegis128l_soft_implementation = { + SODIUM_C99(.encrypt_detached =) aegis128l_encrypt_detached, + SODIUM_C99(.decrypt_detached =) aegis128l_decrypt_detached +}; diff --git a/src/libsodium/crypto_aead/aegis128l/soft/aead_aegis128l_soft.h b/src/libsodium/crypto_aead/aegis128l/soft/aead_aegis128l_soft.h new file mode 100644 index 00000000..aa070ff8 --- /dev/null +++ b/src/libsodium/crypto_aead/aegis128l/soft/aead_aegis128l_soft.h @@ -0,0 +1,7 @@ +#include + +#include "../aead_aegis128l.h" +#include "crypto_aead_aegis128l.h" + +extern struct crypto_aead_aegis128l_implementation + crypto_aead_aegis128l_soft_implementation; diff --git a/src/libsodium/crypto_core/softaes/softaes.c b/src/libsodium/crypto_core/softaes/softaes.c new file mode 100644 index 00000000..385a103f --- /dev/null +++ b/src/libsodium/crypto_core/softaes/softaes.c @@ -0,0 +1,137 @@ +#include +#include +#include +#include + +#include "private/common.h" +#include "private/softaes.h" + +static const uint32_t LUT[256] = { + 0xa56363c6, 0x847c7cf8, 0x997777ee, 0x8d7b7bf6, 0x0df2f2ff, 0xbd6b6bd6, 0xb16f6fde, 0x54c5c591, + 0x50303060, 0x03010102, 0xa96767ce, 0x7d2b2b56, 0x19fefee7, 0x62d7d7b5, 0xe6abab4d, 0x9a7676ec, + 0x45caca8f, 0x9d82821f, 0x40c9c989, 0x877d7dfa, 0x15fafaef, 0xeb5959b2, 0xc947478e, 0x0bf0f0fb, + 0xecadad41, 0x67d4d4b3, 0xfda2a25f, 0xeaafaf45, 0xbf9c9c23, 0xf7a4a453, 0x967272e4, 0x5bc0c09b, + 0xc2b7b775, 0x1cfdfde1, 0xae93933d, 0x6a26264c, 0x5a36366c, 0x413f3f7e, 0x02f7f7f5, 0x4fcccc83, + 0x5c343468, 0xf4a5a551, 0x34e5e5d1, 0x08f1f1f9, 0x937171e2, 0x73d8d8ab, 0x53313162, 0x3f15152a, + 0x0c040408, 0x52c7c795, 0x65232346, 0x5ec3c39d, 0x28181830, 0xa1969637, 0x0f05050a, 0xb59a9a2f, + 0x0907070e, 0x36121224, 0x9b80801b, 0x3de2e2df, 0x26ebebcd, 0x6927274e, 0xcdb2b27f, 0x9f7575ea, + 0x1b090912, 0x9e83831d, 0x742c2c58, 0x2e1a1a34, 0x2d1b1b36, 0xb26e6edc, 0xee5a5ab4, 0xfba0a05b, + 0xf65252a4, 0x4d3b3b76, 0x61d6d6b7, 0xceb3b37d, 0x7b292952, 0x3ee3e3dd, 0x712f2f5e, 0x97848413, + 0xf55353a6, 0x68d1d1b9, 0x00000000, 0x2cededc1, 0x60202040, 0x1ffcfce3, 0xc8b1b179, 0xed5b5bb6, + 0xbe6a6ad4, 0x46cbcb8d, 0xd9bebe67, 0x4b393972, 0xde4a4a94, 0xd44c4c98, 0xe85858b0, 0x4acfcf85, + 0x6bd0d0bb, 0x2aefefc5, 0xe5aaaa4f, 0x16fbfbed, 0xc5434386, 0xd74d4d9a, 0x55333366, 0x94858511, + 0xcf45458a, 0x10f9f9e9, 0x06020204, 0x817f7ffe, 0xf05050a0, 0x443c3c78, 0xba9f9f25, 0xe3a8a84b, + 0xf35151a2, 0xfea3a35d, 0xc0404080, 0x8a8f8f05, 0xad92923f, 0xbc9d9d21, 0x48383870, 0x04f5f5f1, + 0xdfbcbc63, 0xc1b6b677, 0x75dadaaf, 0x63212142, 0x30101020, 0x1affffe5, 0x0ef3f3fd, 0x6dd2d2bf, + 0x4ccdcd81, 0x140c0c18, 0x35131326, 0x2fececc3, 0xe15f5fbe, 0xa2979735, 0xcc444488, 0x3917172e, + 0x57c4c493, 0xf2a7a755, 0x827e7efc, 0x473d3d7a, 0xac6464c8, 0xe75d5dba, 0x2b191932, 0x957373e6, + 0xa06060c0, 0x98818119, 0xd14f4f9e, 0x7fdcdca3, 0x66222244, 0x7e2a2a54, 0xab90903b, 0x8388880b, + 0xca46468c, 0x29eeeec7, 0xd3b8b86b, 0x3c141428, 0x79dedea7, 0xe25e5ebc, 0x1d0b0b16, 0x76dbdbad, + 0x3be0e0db, 0x56323264, 0x4e3a3a74, 0x1e0a0a14, 0xdb494992, 0x0a06060c, 0x6c242448, 0xe45c5cb8, + 0x5dc2c29f, 0x6ed3d3bd, 0xefacac43, 0xa66262c4, 0xa8919139, 0xa4959531, 0x37e4e4d3, 0x8b7979f2, + 0x32e7e7d5, 0x43c8c88b, 0x5937376e, 0xb76d6dda, 0x8c8d8d01, 0x64d5d5b1, 0xd24e4e9c, 0xe0a9a949, + 0xb46c6cd8, 0xfa5656ac, 0x07f4f4f3, 0x25eaeacf, 0xaf6565ca, 0x8e7a7af4, 0xe9aeae47, 0x18080810, + 0xd5baba6f, 0x887878f0, 0x6f25254a, 0x722e2e5c, 0x241c1c38, 0xf1a6a657, 0xc7b4b473, 0x51c6c697, + 0x23e8e8cb, 0x7cdddda1, 0x9c7474e8, 0x211f1f3e, 0xdd4b4b96, 0xdcbdbd61, 0x868b8b0d, 0x858a8a0f, + 0x907070e0, 0x423e3e7c, 0xc4b5b571, 0xaa6666cc, 0xd8484890, 0x05030306, 0x01f6f6f7, 0x120e0e1c, + 0xa36161c2, 0x5f35356a, 0xf95757ae, 0xd0b9b969, 0x91868617, 0x58c1c199, 0x271d1d3a, 0xb99e9e27, + 0x38e1e1d9, 0x13f8f8eb, 0xb398982b, 0x33111122, 0xbb6969d2, 0x70d9d9a9, 0x898e8e07, 0xa7949433, + 0xb69b9b2d, 0x221e1e3c, 0x92878715, 0x20e9e9c9, 0x49cece87, 0xff5555aa, 0x78282850, 0x7adfdfa5, + 0x8f8c8c03, 0xf8a1a159, 0x80898909, 0x170d0d1a, 0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0, + 0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e, 0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c +}; + +#ifndef SOFTAES_STRIDE +#define SOFTAES_STRIDE 16 +#endif + +static SoftAesBlock +_encrypt(const uint8_t ix0[4], const uint8_t ix1[4], const uint8_t ix2[4], const uint8_t ix3[4]) +{ + CRYPTO_ALIGN(64) uint32_t t[4][4][256 / SOFTAES_STRIDE]; + CRYPTO_ALIGN(64) uint8_t of[4][4]; + SoftAesBlock out; + size_t i; + size_t j; + + for (j = 0; j < 4; j++) { + of[j][0] = ix0[j] % SOFTAES_STRIDE; + of[j][1] = ix1[j] % SOFTAES_STRIDE; + of[j][2] = ix2[j] % SOFTAES_STRIDE; + of[j][3] = ix3[j] % SOFTAES_STRIDE; + } + for (i = 0; i < 256 / SOFTAES_STRIDE; i++) { + for (j = 0; j < 4; j++) { + t[j][0][i] = LUT[(i * SOFTAES_STRIDE) | of[j][0]]; + t[j][1][i] = LUT[(i * SOFTAES_STRIDE) | of[j][1]]; + t[j][2][i] = LUT[(i * SOFTAES_STRIDE) | of[j][2]]; + t[j][3][i] = LUT[(i * SOFTAES_STRIDE) | of[j][3]]; + } + } + +#ifdef HAVE_INLINE_ASM + __asm__ __volatile__("" : : "r"(t) : "memory"); +#endif + + out.w0 = t[0][0][ix0[0] / SOFTAES_STRIDE]; + out.w0 ^= ROTL32(t[0][1][ix1[0] / SOFTAES_STRIDE], 8); + out.w0 ^= ROTL32(t[0][2][ix2[0] / SOFTAES_STRIDE], 16); + out.w0 ^= ROTL32(t[0][3][ix3[0] / SOFTAES_STRIDE], 24); + + out.w1 = t[1][0][ix0[1] / SOFTAES_STRIDE]; + out.w1 ^= ROTL32(t[1][1][ix1[1] / SOFTAES_STRIDE], 8); + out.w1 ^= ROTL32(t[1][2][ix2[1] / SOFTAES_STRIDE], 16); + out.w1 ^= ROTL32(t[1][3][ix3[1] / SOFTAES_STRIDE], 24); + + out.w2 = t[2][0][ix0[2] / SOFTAES_STRIDE]; + out.w2 ^= ROTL32(t[2][1][ix1[2] / SOFTAES_STRIDE], 8); + out.w2 ^= ROTL32(t[2][2][ix2[2] / SOFTAES_STRIDE], 16); + out.w2 ^= ROTL32(t[2][3][ix3[2] / SOFTAES_STRIDE], 24); + + out.w3 = t[3][0][ix0[3] / SOFTAES_STRIDE]; + out.w3 ^= ROTL32(t[3][1][ix1[3] / SOFTAES_STRIDE], 8); + out.w3 ^= ROTL32(t[3][2][ix2[3] / SOFTAES_STRIDE], 16); + out.w3 ^= ROTL32(t[3][3][ix3[3] / SOFTAES_STRIDE], 24); + + return out; +} + +SoftAesBlock +softaes_block_encrypt(const SoftAesBlock block, const SoftAesBlock rk) +{ + SoftAesBlock out; + CRYPTO_ALIGN(64) uint8_t ix0[4], ix1[4], ix2[4], ix3[4]; + const uint32_t s0 = block.w0; + const uint32_t s1 = block.w1; + const uint32_t s2 = block.w2; + const uint32_t s3 = block.w3; + + ix0[0] = (uint8_t) s0; + ix0[1] = (uint8_t) s1; + ix0[2] = (uint8_t) s2; + ix0[3] = (uint8_t) s3; + + ix1[0] = (uint8_t) (s1 >> 8); + ix1[1] = (uint8_t) (s2 >> 8); + ix1[2] = (uint8_t) (s3 >> 8); + ix1[3] = (uint8_t) (s0 >> 8); + + ix2[0] = (uint8_t) (s2 >> 16); + ix2[1] = (uint8_t) (s3 >> 16); + ix2[2] = (uint8_t) (s0 >> 16); + ix2[3] = (uint8_t) (s1 >> 16); + + ix3[0] = (uint8_t) (s3 >> 24); + ix3[1] = (uint8_t) (s0 >> 24); + ix3[2] = (uint8_t) (s1 >> 24); + ix3[3] = (uint8_t) (s2 >> 24); + + out = _encrypt(ix0, ix1, ix2, ix3); + + out.w0 ^= rk.w0; + out.w1 ^= rk.w1; + out.w2 ^= rk.w2; + out.w3 ^= rk.w3; + + return out; +} diff --git a/src/libsodium/include/sodium/crypto_aead_aegis128l.h b/src/libsodium/include/sodium/crypto_aead_aegis128l.h index ed8d2f2b..6c553f90 100644 --- a/src/libsodium/include/sodium/crypto_aead_aegis128l.h +++ b/src/libsodium/include/sodium/crypto_aead_aegis128l.h @@ -11,10 +11,7 @@ extern "C" { #endif -SODIUM_EXPORT -int crypto_aead_aegis128l_is_available(void); - -#define crypto_aead_aegis128l_KEYBYTES 16U +#define crypto_aead_aegis128l_KEYBYTES 16U SODIUM_EXPORT size_t crypto_aead_aegis128l_keybytes(void); diff --git a/src/libsodium/include/sodium/private/implementations.h b/src/libsodium/include/sodium/private/implementations.h index 613bf780..e2753f23 100644 --- a/src/libsodium/include/sodium/private/implementations.h +++ b/src/libsodium/include/sodium/private/implementations.h @@ -9,5 +9,6 @@ int _crypto_pwhash_argon2_pick_best_implementation(void); int _crypto_scalarmult_curve25519_pick_best_implementation(void); int _crypto_stream_chacha20_pick_best_implementation(void); int _crypto_stream_salsa20_pick_best_implementation(void); +int _crypto_aead_aegis128l_pick_best_implementation(void); #endif diff --git a/src/libsodium/include/sodium/private/quirks.h b/src/libsodium/include/sodium/private/quirks.h index a04484f7..fa474b7c 100644 --- a/src/libsodium/include/sodium/private/quirks.h +++ b/src/libsodium/include/sodium/private/quirks.h @@ -78,6 +78,7 @@ #define sc25519_mul _sodium_sc25519_mul #define sc25519_muladd _sodium_sc25519_muladd #define sc25519_reduce _sodium_sc25519_reduce +#define softaes_block_encrypt _sodium_softaes_block_encrypt #endif #endif diff --git a/src/libsodium/include/sodium/private/softaes.h b/src/libsodium/include/sodium/private/softaes.h new file mode 100644 index 00000000..863219e7 --- /dev/null +++ b/src/libsodium/include/sodium/private/softaes.h @@ -0,0 +1,56 @@ +#ifndef softaes_H +#define softaes_H 1 + +#include + +#include "private/common.h" + +typedef struct CRYPTO_ALIGN(64) SoftAesBlock { + uint32_t w0; + uint32_t w1; + uint32_t w2; + uint32_t w3; +} SoftAesBlock; + +SoftAesBlock softaes_block_encrypt(const SoftAesBlock block, const SoftAesBlock rk); + +static inline SoftAesBlock +softaes_block_load(const uint8_t in[16]) +{ + const SoftAesBlock out = { LOAD32_LE(in + 0), LOAD32_LE(in + 4), LOAD32_LE(in + 8), + LOAD32_LE(in + 12) }; + return out; +} + +static inline SoftAesBlock +softaes_block_load64x2(const uint64_t a, const uint64_t b) +{ + const SoftAesBlock out = { (uint32_t) b, (uint32_t) (b >> 32), (uint32_t) a, + (uint32_t) (a >> 32) }; + return out; +} + +static inline void +softaes_block_store(uint8_t out[16], const SoftAesBlock in) +{ + STORE32_LE(out + 0, in.w0); + STORE32_LE(out + 4, in.w1); + STORE32_LE(out + 8, in.w2); + STORE32_LE(out + 12, in.w3); +} + +static inline SoftAesBlock +softaes_block_xor(const SoftAesBlock a, const SoftAesBlock b) +{ + const SoftAesBlock out = { a.w0 ^ b.w0, a.w1 ^ b.w1, a.w2 ^ b.w2, a.w3 ^ b.w3 }; + return out; +} + +static inline SoftAesBlock +softaes_block_and(const SoftAesBlock a, const SoftAesBlock b) +{ + const SoftAesBlock out = { a.w0 & b.w0, a.w1 & b.w1, a.w2 & b.w2, a.w3 & b.w3 }; + return out; +} + +#endif diff --git a/src/libsodium/sodium/core.c b/src/libsodium/sodium/core.c index c8791d01..d448b738 100644 --- a/src/libsodium/sodium/core.c +++ b/src/libsodium/sodium/core.c @@ -45,6 +45,7 @@ sodium_init(void) _crypto_scalarmult_curve25519_pick_best_implementation(); _crypto_stream_chacha20_pick_best_implementation(); _crypto_stream_salsa20_pick_best_implementation(); + _crypto_aead_aegis128l_pick_best_implementation(); initialized = 1; if (sodium_crit_leave() != 0) { return -1; /* LCOV_EXCL_LINE */ diff --git a/test/default/aead_aegis128l.c b/test/default/aead_aegis128l.c index 46f338f6..b170b80b 100644 --- a/test/default/aead_aegis128l.c +++ b/test/default/aead_aegis128l.c @@ -657,9 +657,7 @@ tv(void) int main(void) { - if (crypto_aead_aegis128l_is_available()) { - tv(); - } + tv(); assert(crypto_aead_aegis128l_keybytes() == crypto_aead_aegis128l_KEYBYTES); assert(crypto_aead_aegis128l_nsecbytes() == crypto_aead_aegis128l_NSECBYTES); assert(crypto_aead_aegis128l_npubbytes() == crypto_aead_aegis128l_NPUBBYTES); diff --git a/test/symbols/all-symbols.txt b/test/symbols/all-symbols.txt index ee069f10..f7ce18cf 100644 --- a/test/symbols/all-symbols.txt +++ b/test/symbols/all-symbols.txt @@ -38,7 +38,6 @@ crypto_aead_aegis128l_decrypt crypto_aead_aegis128l_decrypt_detached crypto_aead_aegis128l_encrypt crypto_aead_aegis128l_encrypt_detached -crypto_aead_aegis128l_is_available crypto_aead_aegis128l_keybytes crypto_aead_aegis128l_keygen crypto_aead_aegis128l_messagebytes_max