diff -Nru libsodium-1.0.17/appveyor.yml libsodium-1.0.18/appveyor.yml --- libsodium-1.0.17/appveyor.yml 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/appveyor.yml 2019-05-30 20:13:18.000000000 +0000 @@ -1,6 +1,6 @@ -version: 1.0.10.{build} +version: 1.0.18.{build} -os: Visual Studio 2015 +os: Visual Studio 2017 environment: matrix: @@ -16,8 +16,7 @@ matrix: fast_finish: false -init: - msbuild /version +init: msbuild /version build: parallel: true diff -Nru libsodium-1.0.17/AUTHORS libsodium-1.0.18/AUTHORS --- libsodium-1.0.17/AUTHORS 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/AUTHORS 2019-05-30 20:13:18.000000000 +0000 @@ -28,6 +28,13 @@ poly1305 Daniel J. Bernstein +ristretto Mike Hamburg + Henry de Valence + Jack Grigg + George Tankersley + Filippo Valsorda + Isis Lovecruft + salsa20 Daniel J. Bernstein scrypt Colin Percival @@ -56,6 +63,7 @@ crypto_core/ed25519 Daniel J. Bernstein Adam Langley + Frank Denis crypto_core/hchacha20 Frank Denis @@ -93,6 +101,8 @@ crypto_scalarmult/ed25519 Frank Denis +crypto_scalarmult/ristretto255 Frank Denis + crypto_secretbox/xsalsa20poly1305 Daniel J. Bernstein crypto_secretbox/xchacha20poly1305 Frank Denis diff -Nru libsodium-1.0.17/autogen.sh libsodium-1.0.18/autogen.sh --- libsodium-1.0.17/autogen.sh 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/autogen.sh 2019-05-30 20:13:18.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh -if glibtoolize --version > /dev/null 2>&1; then +if glibtoolize --version >/dev/null 2>&1; then LIBTOOLIZE='glibtoolize' else LIBTOOLIZE='libtoolize' @@ -26,11 +26,28 @@ exit 1 } -if autoreconf --version > /dev/null 2>&1 ; then - exec autoreconf -ivf +if autoreconf --version >/dev/null 2>&1; then + autoreconf -ivf +else + $LIBTOOLIZE && + aclocal && + automake --add-missing --force-missing --include-deps && + autoconf fi -$LIBTOOLIZE && \ -aclocal && \ -automake --add-missing --force-missing --include-deps && \ -autoconf +[ -z "$DO_NOT_UPDATE_CONFIG_SCRIPTS" ] && + command -v curl >/dev/null 2>&1 && { + echo "Downloading config.guess and config.sub..." + + curl -sL -o config.guess \ + 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' && + mv -f config.guess build-aux/config.guess + + curl -sL -o config.sub \ + 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' && + mv -f config.sub build-aux/config.sub + + echo "Done." +} + +rm -f config.guess config.sub diff -Nru libsodium-1.0.17/azure-pipelines.yml libsodium-1.0.18/azure-pipelines.yml --- libsodium-1.0.17/azure-pipelines.yml 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/azure-pipelines.yml 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,153 @@ +trigger: + - stable + - next + +pr: none + +jobs: + - job: "wasi" + pool: + vmImage: "ubuntu-16.04" + steps: + - script: | + sudo apt-get install build-essential curl cmake + displayName: Install system packages + - script: | + curl https://sh.rustup.rs -sSf | sh -s -- -y + source ${HOME}/.cargo/env + git clone --recursive https://github.com/wasmerio/wasmer.git + (cd wasmer && cargo install --path .) + displayName: Install wasmer + - script: | + curl -sL -o wasi-sdk.deb https://github.com/CraneStation/wasi-sdk/releases/download/wasi-sdk-5/wasi-sdk_5.0_amd64.deb + sudo dpkg -i wasi-sdk.deb && rm -f wasi-sdk.deb + sudo ln -s /opt/wasi-sdk/share/*sysroot* /opt/wasi-sysroot + displayName: Install the WASI SDK + - script: | + env PATH=/opt/wasi-sdk/bin:${HOME}/.cargo/bin:$PATH dist-build/wasm32-wasi.sh + displayName: Compile libsodium + - task: PublishBuildArtifacts@1 + condition: not(canceled()) + inputs: + pathToPublish: libsodium-wasm32-wasi + artifactName: libsodium-wasm32-wasi + + - job: "windows" + pool: + vmImage: "windows-2019" + steps: + - powershell: | + cd builds\msvc\build + & .\buildbase.bat ..\vs2019\libsodium.sln 16 + displayName: Compile it all + - powershell: | + mkdir bin\include\sodium + Copy-Item "src\libsodium\include\sodium\*.h" -Destination "bin\include\sodium" -Recurse + Copy-Item "src\libsodium\include\*.h" -Destination "bin\include\" + displayName: Copy header files + - task: PublishBuildArtifacts@1 + condition: not(canceled()) + inputs: + pathToPublish: bin + artifactName: libsodium + + - job: "windows_old" + pool: + vmImage: "vs2017-win2016" + steps: + - powershell: | + cd builds\msvc\build + & .\buildbase.bat ..\vs2017\libsodium.sln 15 + displayName: Compile it all + - task: PublishBuildArtifacts@1 + condition: not(canceled()) + inputs: + pathToPublish: bin + artifactName: libsodium + + - job: "windows_reallyold" + pool: + vmImage: "vs2015-win2012r2" + steps: + - powershell: | + cd builds\msvc\build + & .\buildbase.bat ..\vs2015\libsodium.sln 14 + & .\buildbase.bat ..\vs2013\libsodium.sln 12 + & .\buildbase.bat ..\vs2012\libsodium.sln 11 + & .\buildbase.bat ..\vs2010\libsodium.sln 10 + displayName: Compile it all + - task: PublishBuildArtifacts@1 + condition: not(canceled()) + inputs: + pathToPublish: bin + artifactName: libsodium + + - job: mingw64 + pool: + vmImage: "windows-2019" + steps: + - script: | + git clone https://github.com/msys2/msys2-ci-base.git %CD:~0,2%\msys64 + %CD:~0,2%\msys64\usr\bin\rm -rf %CD:~0,2%\msys64\.git + displayName: Install MSYS2 + - script: | + set PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem + %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Syyuu + %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Syuu + displayName: Update MSYS2 + - script: | + set PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem + %CD:~0,2%\msys64\usr\bin\pacman --noconfirm --needed -S base-devel mingw-w64-x86_64-toolchain + %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Scc + %CD:~0,2%\msys64\usr\bin\sed -i "s|#CacheDir.*|CacheDir=/c/Users/%USERNAME%/AppData/Local/Temp|g" /etc/pacman.conf + displayName: Install Toolchain + - script: | + set PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;%CD:~0,2%\msys64\usr\bin;%CD:~0,2%\msys64\bin + set MSYS2_ROOT=%CD:~0,2%\msys64 + set MSYSTEM=MINGW64 + %MSYS2_ROOT%\cmd\msystem MINGW64 + %CD:~0,2%\msys64\usr\bin\bash -lc dist-build/msys2-win64.sh + env: + CHERE_INVOKING: yes + MSYS2_ARCH: x86_64 + displayName: Compile libsodium + - task: PublishBuildArtifacts@1 + condition: not(canceled()) + inputs: + pathToPublish: libsodium-win64 + artifactName: libsodium-win64 + + - job: mingw32 + pool: + vmImage: "windows-2019" + steps: + - script: | + git clone https://github.com/msys2/msys2-ci-base.git %CD:~0,2%\msys64 + %CD:~0,2%\msys64\usr\bin\rm -rf %CD:~0,2%\msys64\.git + displayName: Install MSYS2 + - script: | + set PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem + %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Syyuu + %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Syuu + displayName: Update MSYS2 + - script: | + set PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem + %CD:~0,2%\msys64\usr\bin\pacman --noconfirm --needed -S base-devel mingw-w64-i686-toolchain + %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Scc + %CD:~0,2%\msys64\usr\bin\sed -i "s|#CacheDir.*|CacheDir=/c/Users/%USERNAME%/AppData/Local/Temp|g" /etc/pacman.conf + displayName: Install Toolchain + - script: | + set PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;%CD:~0,2%\msys64\usr\bin;%CD:~0,2%\msys64\bin + set MSYS2_ROOT=%CD:~0,2%\msys64 + set MSYSTEM=MINGW32 + %MSYS2_ROOT%\cmd\msystem MINGW32 + %CD:~0,2%\msys64\usr\bin\bash -lc dist-build/msys2-win32.sh + env: + CHERE_INVOKING: yes + MSYS2_ARCH: x86_64 + displayName: Compile libsodium + - task: PublishBuildArtifacts@1 + condition: not(canceled()) + inputs: + pathToPublish: libsodium-win32 + artifactName: libsodium-win32 diff -Nru libsodium-1.0.17/builds/Makefile.am libsodium-1.0.18/builds/Makefile.am --- libsodium-1.0.17/builds/Makefile.am 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/Makefile.am 2019-05-30 20:13:18.000000000 +0000 @@ -62,4 +62,11 @@ msvc/vs2017/libsodium/libsodium.xml \ msvc/vs2017/libsodium.import.props \ msvc/vs2017/libsodium.import.xml \ - msvc/vs2017/libsodium.sln + msvc/vs2017/libsodium.sln \ + msvc/vs2019/libsodium/libsodium.props \ + msvc/vs2019/libsodium/libsodium.vcxproj \ + msvc/vs2019/libsodium/libsodium.vcxproj.filters \ + msvc/vs2019/libsodium/libsodium.xml \ + msvc/vs2019/libsodium.import.props \ + msvc/vs2019/libsodium.import.xml \ + msvc/vs2019/libsodium.sln diff -Nru libsodium-1.0.17/builds/msvc/build/buildall.bat libsodium-1.0.18/builds/msvc/build/buildall.bat --- libsodium-1.0.17/builds/msvc/build/buildall.bat 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/build/buildall.bat 2019-05-30 20:13:18.000000000 +0000 @@ -1,5 +1,7 @@ @ECHO OFF +CALL buildbase.bat ..\vs2019\libsodium.sln 16 +ECHO. CALL buildbase.bat ..\vs2017\libsodium.sln 15 ECHO. CALL buildbase.bat ..\vs2015\libsodium.sln 14 diff -Nru libsodium-1.0.17/builds/msvc/build/buildbase.bat libsodium-1.0.18/builds/msvc/build/buildbase.bat --- libsodium-1.0.17/builds/msvc/build/buildbase.bat 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/build/buildbase.bat 2019-05-30 20:13:18.000000000 +0000 @@ -1,18 +1,44 @@ @ECHO OFF -REM Usage: [buildbase.bat ..\vs2013\mysolution.sln 12] +REM Usage: [buildbase.bat ..\vs2019\mysolution.sln 16] + +SETLOCAL enabledelayedexpansion SET solution=%1 SET version=%2 SET log=build_%version%.log SET tools=Microsoft Visual Studio %version%.0\VC\vcvarsall.bat -IF %version% == 15 SET tools=Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat -SET environment="%programfiles(x86)%\%tools%" -IF NOT EXIST %environment% SET environment="%programfiles%\%tools%" -IF NOT EXIST %environment% GOTO no_tools + +IF %version% == 16 ( + SET tools=Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat + SET environment="%programfiles%\!tools!" + IF NOT EXIST !environment! ( + SET environment="%programfiles(x86)%\!tools!" + IF NOT EXIST !environment! ( + SET tools=Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat + ) + ) +) + +IF %version% == 15 ( + SET tools=Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat + SET environment="%programfiles%\!tools!" + IF NOT EXIST !environment! ( + SET environment="%programfiles(x86)%\!tools!" + IF NOT EXIST !environment! ( + SET tools=Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat + ) + ) +) +SET environment="%programfiles%\!tools!" +IF NOT EXIST !environment! SET environment="%programfiles(x86)%\!tools!" + +ECHO Environment: !environment! + +IF NOT EXIST !environment! GOTO no_tools ECHO Building: %solution% -CALL %environment% x86 > nul +CALL !environment! x86 > nul ECHO Platform=x86 ECHO Configuration=DynDebug @@ -34,7 +60,7 @@ msbuild /m /v:n /p:Configuration=StaticRelease /p:Platform=Win32 %solution% >> %log% IF errorlevel 1 GOTO error -CALL %environment% x86_amd64 > nul +CALL !environment! x86_amd64 > nul ECHO Platform=x64 ECHO Configuration=DynDebug @@ -64,7 +90,7 @@ GOTO end :no_tools -ECHO *** ERROR, build tools not found: %tools% +ECHO *** ERROR, build tools not found: !tools! :end diff -Nru libsodium-1.0.17/builds/msvc/resource.rc libsodium-1.0.18/builds/msvc/resource.rc --- libsodium-1.0.17/builds/msvc/resource.rc 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/resource.rc 2019-05-30 20:13:18.000000000 +0000 @@ -4,8 +4,8 @@ #include "windows.h" //specify the version numbers for the dll's -#define LIBSODIUM_VERSION_STRING "1.0.17.0" -#define LIBSODIUM_VERSION_BIN 1,0,17,0 +#define LIBSODIUM_VERSION_STRING "1.0.18.0" +#define LIBSODIUM_VERSION_BIN 1,0,18,0 //specify the product name for the dlls based on the platform we are compiling for #if defined(x64) diff -Nru libsodium-1.0.17/builds/msvc/version.h libsodium-1.0.18/builds/msvc/version.h --- libsodium-1.0.17/builds/msvc/version.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/version.h 2019-05-30 20:13:18.000000000 +0000 @@ -4,10 +4,10 @@ #include "export.h" -#define SODIUM_VERSION_STRING "1.0.17" +#define SODIUM_VERSION_STRING "1.0.18" #define SODIUM_LIBRARY_VERSION_MAJOR 10 -#define SODIUM_LIBRARY_VERSION_MINOR 2 +#define SODIUM_LIBRARY_VERSION_MINOR 3 #ifdef __cplusplus extern "C" { diff -Nru libsodium-1.0.17/builds/msvc/vs2010/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2010/libsodium/libsodium.vcxproj --- libsodium-1.0.17/builds/msvc/vs2010/libsodium/libsodium.vcxproj 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2010/libsodium/libsodium.vcxproj 2019-05-30 20:13:18.000000000 +0000 @@ -126,6 +126,7 @@ + @@ -138,8 +139,7 @@ - - + @@ -181,6 +181,7 @@ + @@ -200,7 +201,6 @@ - @@ -210,6 +210,7 @@ + @@ -217,6 +218,7 @@ + @@ -227,7 +229,6 @@ - @@ -246,6 +247,7 @@ + diff -Nru libsodium-1.0.17/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters --- libsodium-1.0.17/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters 2019-05-30 20:13:18.000000000 +0000 @@ -171,6 +171,9 @@ crypto_scalarmult + + crypto_scalarmult\ristretto255\ref10 + crypto_scalarmult\ed25519\ref10 @@ -207,11 +210,8 @@ randombytes\sysrandom - - randombytes\salsa20 - - - randombytes\nativeclient + + randombytes\internal crypto_box @@ -336,6 +336,9 @@ crypto_core\ed25519 + + crypto_core\ed25519 + crypto_core\ed25519\ref10 @@ -389,9 +392,6 @@ include\sodium - - include\sodium - include\sodium @@ -419,6 +419,9 @@ include\sodium + + include\sodium + include\sodium @@ -440,6 +443,9 @@ include\sodium + + include\sodium + include\sodium @@ -470,9 +476,6 @@ include\sodium - - include\sodium - include\sodium @@ -527,6 +530,9 @@ include\sodium + + include\sodium + include\sodium @@ -880,6 +886,12 @@ {834d4827-81e4-3de3-baa1-a216763f11d6} + + {52bf28eb-7ffd-399a-be35-0df3e8e99c15} + + + {39cc576f-4b54-3d71-b14c-27445bc4b138} + {b9b02bee-5c1f-36d2-b97d-983f865a4cc6} @@ -973,11 +985,8 @@ {ef090484-4db4-3dc2-aca7-c59bab1db23b} - - {fd98b90f-ba7b-3aa0-a505-935c82ca8023} - - - {7450ec6e-c197-3798-9434-1b46c8c4d9af} + + {14c126fd-bb91-37ea-b807-b60c386be601} {ac56c38f-7e17-3b79-bf47-58e9476b3b89} diff -Nru libsodium-1.0.17/builds/msvc/vs2012/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2012/libsodium/libsodium.vcxproj --- libsodium-1.0.17/builds/msvc/vs2012/libsodium/libsodium.vcxproj 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2012/libsodium/libsodium.vcxproj 2019-05-30 20:13:18.000000000 +0000 @@ -126,6 +126,7 @@ + @@ -138,8 +139,7 @@ - - + @@ -181,6 +181,7 @@ + @@ -200,7 +201,6 @@ - @@ -210,6 +210,7 @@ + @@ -217,6 +218,7 @@ + @@ -227,7 +229,6 @@ - @@ -246,6 +247,7 @@ + diff -Nru libsodium-1.0.17/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters --- libsodium-1.0.17/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters 2019-05-30 20:13:18.000000000 +0000 @@ -171,6 +171,9 @@ crypto_scalarmult + + crypto_scalarmult\ristretto255\ref10 + crypto_scalarmult\ed25519\ref10 @@ -207,11 +210,8 @@ randombytes\sysrandom - - randombytes\salsa20 - - - randombytes\nativeclient + + randombytes\internal crypto_box @@ -336,6 +336,9 @@ crypto_core\ed25519 + + crypto_core\ed25519 + crypto_core\ed25519\ref10 @@ -389,9 +392,6 @@ include\sodium - - include\sodium - include\sodium @@ -419,6 +419,9 @@ include\sodium + + include\sodium + include\sodium @@ -440,6 +443,9 @@ include\sodium + + include\sodium + include\sodium @@ -470,9 +476,6 @@ include\sodium - - include\sodium - include\sodium @@ -527,6 +530,9 @@ include\sodium + + include\sodium + include\sodium @@ -880,6 +886,12 @@ {834d4827-81e4-3de3-baa1-a216763f11d6} + + {52bf28eb-7ffd-399a-be35-0df3e8e99c15} + + + {39cc576f-4b54-3d71-b14c-27445bc4b138} + {b9b02bee-5c1f-36d2-b97d-983f865a4cc6} @@ -973,11 +985,8 @@ {ef090484-4db4-3dc2-aca7-c59bab1db23b} - - {fd98b90f-ba7b-3aa0-a505-935c82ca8023} - - - {7450ec6e-c197-3798-9434-1b46c8c4d9af} + + {14c126fd-bb91-37ea-b807-b60c386be601} {ac56c38f-7e17-3b79-bf47-58e9476b3b89} diff -Nru libsodium-1.0.17/builds/msvc/vs2013/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2013/libsodium/libsodium.vcxproj --- libsodium-1.0.17/builds/msvc/vs2013/libsodium/libsodium.vcxproj 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2013/libsodium/libsodium.vcxproj 2019-05-30 20:13:18.000000000 +0000 @@ -126,6 +126,7 @@ + @@ -138,8 +139,7 @@ - - + @@ -181,6 +181,7 @@ + @@ -200,7 +201,6 @@ - @@ -210,6 +210,7 @@ + @@ -217,6 +218,7 @@ + @@ -227,7 +229,6 @@ - @@ -246,6 +247,7 @@ + diff -Nru libsodium-1.0.17/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters --- libsodium-1.0.17/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters 2019-05-30 20:13:18.000000000 +0000 @@ -171,6 +171,9 @@ crypto_scalarmult + + crypto_scalarmult\ristretto255\ref10 + crypto_scalarmult\ed25519\ref10 @@ -207,11 +210,8 @@ randombytes\sysrandom - - randombytes\salsa20 - - - randombytes\nativeclient + + randombytes\internal crypto_box @@ -336,6 +336,9 @@ crypto_core\ed25519 + + crypto_core\ed25519 + crypto_core\ed25519\ref10 @@ -389,9 +392,6 @@ include\sodium - - include\sodium - include\sodium @@ -419,6 +419,9 @@ include\sodium + + include\sodium + include\sodium @@ -440,6 +443,9 @@ include\sodium + + include\sodium + include\sodium @@ -470,9 +476,6 @@ include\sodium - - include\sodium - include\sodium @@ -527,6 +530,9 @@ include\sodium + + include\sodium + include\sodium @@ -880,6 +886,12 @@ {834d4827-81e4-3de3-baa1-a216763f11d6} + + {52bf28eb-7ffd-399a-be35-0df3e8e99c15} + + + {39cc576f-4b54-3d71-b14c-27445bc4b138} + {b9b02bee-5c1f-36d2-b97d-983f865a4cc6} @@ -973,11 +985,8 @@ {ef090484-4db4-3dc2-aca7-c59bab1db23b} - - {fd98b90f-ba7b-3aa0-a505-935c82ca8023} - - - {7450ec6e-c197-3798-9434-1b46c8c4d9af} + + {14c126fd-bb91-37ea-b807-b60c386be601} {ac56c38f-7e17-3b79-bf47-58e9476b3b89} diff -Nru libsodium-1.0.17/builds/msvc/vs2015/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2015/libsodium/libsodium.vcxproj --- libsodium-1.0.17/builds/msvc/vs2015/libsodium/libsodium.vcxproj 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2015/libsodium/libsodium.vcxproj 2019-05-30 20:13:18.000000000 +0000 @@ -126,6 +126,7 @@ + @@ -138,8 +139,7 @@ - - + @@ -181,6 +181,7 @@ + @@ -200,7 +201,6 @@ - @@ -210,6 +210,7 @@ + @@ -217,6 +218,7 @@ + @@ -227,7 +229,6 @@ - @@ -246,6 +247,7 @@ + diff -Nru libsodium-1.0.17/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters --- libsodium-1.0.17/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters 2019-05-30 20:13:18.000000000 +0000 @@ -171,6 +171,9 @@ crypto_scalarmult + + crypto_scalarmult\ristretto255\ref10 + crypto_scalarmult\ed25519\ref10 @@ -207,11 +210,8 @@ randombytes\sysrandom - - randombytes\salsa20 - - - randombytes\nativeclient + + randombytes\internal crypto_box @@ -336,6 +336,9 @@ crypto_core\ed25519 + + crypto_core\ed25519 + crypto_core\ed25519\ref10 @@ -389,9 +392,6 @@ include\sodium - - include\sodium - include\sodium @@ -419,6 +419,9 @@ include\sodium + + include\sodium + include\sodium @@ -440,6 +443,9 @@ include\sodium + + include\sodium + include\sodium @@ -470,9 +476,6 @@ include\sodium - - include\sodium - include\sodium @@ -527,6 +530,9 @@ include\sodium + + include\sodium + include\sodium @@ -880,6 +886,12 @@ {834d4827-81e4-3de3-baa1-a216763f11d6} + + {52bf28eb-7ffd-399a-be35-0df3e8e99c15} + + + {39cc576f-4b54-3d71-b14c-27445bc4b138} + {b9b02bee-5c1f-36d2-b97d-983f865a4cc6} @@ -973,11 +985,8 @@ {ef090484-4db4-3dc2-aca7-c59bab1db23b} - - {fd98b90f-ba7b-3aa0-a505-935c82ca8023} - - - {7450ec6e-c197-3798-9434-1b46c8c4d9af} + + {14c126fd-bb91-37ea-b807-b60c386be601} {ac56c38f-7e17-3b79-bf47-58e9476b3b89} diff -Nru libsodium-1.0.17/builds/msvc/vs2017/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2017/libsodium/libsodium.vcxproj --- libsodium-1.0.17/builds/msvc/vs2017/libsodium/libsodium.vcxproj 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2017/libsodium/libsodium.vcxproj 2019-05-30 20:13:18.000000000 +0000 @@ -126,6 +126,7 @@ + @@ -138,8 +139,7 @@ - - + @@ -181,6 +181,7 @@ + @@ -200,7 +201,6 @@ - @@ -210,6 +210,7 @@ + @@ -217,6 +218,7 @@ + @@ -227,7 +229,6 @@ - @@ -246,6 +247,7 @@ + diff -Nru libsodium-1.0.17/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters --- libsodium-1.0.17/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters 2019-05-30 20:13:18.000000000 +0000 @@ -171,6 +171,9 @@ crypto_scalarmult + + crypto_scalarmult\ristretto255\ref10 + crypto_scalarmult\ed25519\ref10 @@ -207,11 +210,8 @@ randombytes\sysrandom - - randombytes\salsa20 - - - randombytes\nativeclient + + randombytes\internal crypto_box @@ -336,6 +336,9 @@ crypto_core\ed25519 + + crypto_core\ed25519 + crypto_core\ed25519\ref10 @@ -389,9 +392,6 @@ include\sodium - - include\sodium - include\sodium @@ -419,6 +419,9 @@ include\sodium + + include\sodium + include\sodium @@ -440,6 +443,9 @@ include\sodium + + include\sodium + include\sodium @@ -470,9 +476,6 @@ include\sodium - - include\sodium - include\sodium @@ -527,6 +530,9 @@ include\sodium + + include\sodium + include\sodium @@ -880,6 +886,12 @@ {834d4827-81e4-3de3-baa1-a216763f11d6} + + {52bf28eb-7ffd-399a-be35-0df3e8e99c15} + + + {39cc576f-4b54-3d71-b14c-27445bc4b138} + {b9b02bee-5c1f-36d2-b97d-983f865a4cc6} @@ -973,11 +985,8 @@ {ef090484-4db4-3dc2-aca7-c59bab1db23b} - - {fd98b90f-ba7b-3aa0-a505-935c82ca8023} - - - {7450ec6e-c197-3798-9434-1b46c8c4d9af} + + {14c126fd-bb91-37ea-b807-b60c386be601} {ac56c38f-7e17-3b79-bf47-58e9476b3b89} diff -Nru libsodium-1.0.17/builds/msvc/vs2019/libsodium/libsodium.props libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.props --- libsodium-1.0.17/builds/msvc/vs2019/libsodium/libsodium.props 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.props 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,48 @@ + + + + + <_PropertySheetDisplayName>Libsodium Common Settings + AllRules.ruleset + false + + + + + + + + + + + + + copy "$(BuildRoot)version.h" "$(RepoRoot)src\libsodium\include\sodium\" + + + $(RepoRoot)src\libsodium\include;$(RepoRoot)src\libsodium\include\sodium\;%(AdditionalIncludeDirectories) + 4146;4244;%(DisableSpecificWarnings) + false + inline=__inline;NATIVE_LITTLE_ENDIAN;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + SODIUM_STATIC;%(PreprocessorDefinitions) + SODIUM_DLL_EXPORT;%(PreprocessorDefinitions) + HAVE_AMD64_ASM;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + advapi32.lib + + + diff -Nru libsodium-1.0.17/builds/msvc/vs2019/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.vcxproj --- libsodium-1.0.17/builds/msvc/vs2019/libsodium/libsodium.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.vcxproj 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,327 @@ + + + + {A185B162-6CB6-4502-B03F-B56F7699A8D9} + libsodium + v142 + + + + DebugDLL + Win32 + + + ReleaseDLL + Win32 + + + DebugDLL + x64 + + + ReleaseDLL + x64 + + + DebugLTCG + Win32 + + + ReleaseLTCG + Win32 + + + DebugLTCG + x64 + + + ReleaseLTCG + x64 + + + DebugLIB + Win32 + + + ReleaseLIB + Win32 + + + DebugLIB + x64 + + + ReleaseLIB + x64 + + + + StaticLibrary + DynamicLibrary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru libsodium-1.0.17/builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters --- libsodium-1.0.17/builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,998 @@ + + + + + packaging + + + packaging + + + packaging + + + packaging + + + packaging + + + packaging + + + + + + + + crypto_generichash + + + crypto_generichash\blake2b + + + crypto_generichash\blake2b\ref + + + crypto_generichash\blake2b\ref + + + crypto_generichash\blake2b\ref + + + crypto_generichash\blake2b\ref + + + crypto_generichash\blake2b\ref + + + crypto_generichash\blake2b\ref + + + crypto_kx + + + crypto_sign + + + crypto_sign\ed25519 + + + crypto_sign\ed25519\ref10 + + + crypto_sign\ed25519\ref10 + + + crypto_sign\ed25519\ref10 + + + crypto_sign\ed25519\ref10 + + + crypto_secretbox + + + crypto_secretbox + + + crypto_secretbox\xsalsa20poly1305 + + + crypto_secretbox\xchacha20poly1305 + + + crypto_pwhash + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\scryptsalsa208sha256 + + + crypto_pwhash\scryptsalsa208sha256 + + + crypto_pwhash\scryptsalsa208sha256 + + + crypto_pwhash\scryptsalsa208sha256 + + + crypto_pwhash\scryptsalsa208sha256\nosse + + + crypto_pwhash\scryptsalsa208sha256\sse + + + crypto_verify\sodium + + + crypto_auth + + + crypto_auth\hmacsha512 + + + crypto_auth\hmacsha512256 + + + crypto_auth\hmacsha256 + + + crypto_kdf + + + crypto_kdf\blake2b + + + crypto_shorthash + + + crypto_shorthash\siphash24 + + + crypto_shorthash\siphash24 + + + crypto_shorthash\siphash24\ref + + + crypto_shorthash\siphash24\ref + + + crypto_scalarmult + + + crypto_scalarmult\ristretto255\ref10 + + + crypto_scalarmult\ed25519\ref10 + + + crypto_scalarmult\curve25519 + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\ref10 + + + crypto_onetimeauth + + + crypto_onetimeauth\poly1305 + + + crypto_onetimeauth\poly1305\donna + + + crypto_onetimeauth\poly1305\sse2 + + + randombytes + + + randombytes\sysrandom + + + randombytes\internal + + + crypto_box + + + crypto_box + + + crypto_box + + + crypto_box\curve25519xsalsa20poly1305 + + + crypto_box\curve25519xchacha20poly1305 + + + crypto_box\curve25519xchacha20poly1305 + + + sodium + + + sodium + + + sodium + + + sodium + + + sodium + + + crypto_stream + + + crypto_stream\xchacha20 + + + crypto_stream\chacha20 + + + crypto_stream\chacha20\ref + + + crypto_stream\chacha20\dolbeau + + + crypto_stream\chacha20\dolbeau + + + crypto_stream\salsa20 + + + crypto_stream\salsa20\ref + + + crypto_stream\salsa20\xmm6int + + + crypto_stream\salsa20\xmm6int + + + crypto_stream\salsa20\xmm6 + + + crypto_stream\salsa2012 + + + crypto_stream\salsa2012\ref + + + crypto_stream\salsa208 + + + crypto_stream\salsa208\ref + + + crypto_stream\xsalsa20 + + + crypto_hash + + + crypto_hash\sha512 + + + crypto_hash\sha512\cp + + + crypto_hash\sha256 + + + crypto_hash\sha256\cp + + + crypto_aead\xchacha20poly1305\sodium + + + crypto_aead\aes256gcm\aesni + + + crypto_aead\chacha20poly1305\sodium + + + crypto_secretstream\xchacha20poly1305 + + + crypto_core\salsa\ref + + + crypto_core\hchacha20 + + + crypto_core\hsalsa20 + + + crypto_core\hsalsa20\ref2 + + + crypto_core\ed25519 + + + crypto_core\ed25519 + + + crypto_core\ed25519\ref10 + + + + + crypto_generichash\blake2b\ref + + + crypto_generichash\blake2b\ref + + + crypto_generichash\blake2b\ref + + + crypto_generichash\blake2b\ref + + + crypto_generichash\blake2b\ref + + + crypto_generichash\blake2b\ref + + + crypto_generichash\blake2b\ref + + + crypto_sign\ed25519\ref10 + + + include + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium + + + include\sodium\private + + + include\sodium\private + + + include\sodium\private + + + include\sodium\private + + + include\sodium\private + + + include\sodium\private + + + include\sodium\private + + + include\sodium\private + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\argon2 + + + crypto_pwhash\scryptsalsa208sha256 + + + crypto_pwhash\scryptsalsa208sha256 + + + crypto_shorthash\siphash24\ref + + + crypto_scalarmult\curve25519 + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\sandy2x + + + crypto_scalarmult\curve25519\ref10 + + + crypto_onetimeauth\poly1305 + + + crypto_onetimeauth\poly1305\donna + + + crypto_onetimeauth\poly1305\donna + + + crypto_onetimeauth\poly1305\donna + + + crypto_onetimeauth\poly1305\sse2 + + + crypto_stream\chacha20 + + + crypto_stream\chacha20\ref + + + crypto_stream\chacha20\dolbeau + + + crypto_stream\chacha20\dolbeau + + + crypto_stream\chacha20\dolbeau + + + crypto_stream\chacha20\dolbeau + + + crypto_stream\chacha20\dolbeau + + + crypto_stream\chacha20\dolbeau + + + crypto_stream\salsa20 + + + crypto_stream\salsa20\ref + + + crypto_stream\salsa20\xmm6int + + + crypto_stream\salsa20\xmm6int + + + crypto_stream\salsa20\xmm6int + + + crypto_stream\salsa20\xmm6int + + + crypto_stream\salsa20\xmm6int + + + crypto_stream\salsa20\xmm6int + + + crypto_stream\salsa20\xmm6 + + + crypto_core\ed25519\ref10\fe_25_5 + + + crypto_core\ed25519\ref10\fe_25_5 + + + crypto_core\ed25519\ref10\fe_25_5 + + + crypto_core\ed25519\ref10\fe_25_5 + + + crypto_core\ed25519\ref10\fe_51 + + + crypto_core\ed25519\ref10\fe_51 + + + crypto_core\ed25519\ref10\fe_51 + + + crypto_core\ed25519\ref10\fe_51 + + + + + {a6837e41-3751-38c9-bb90-dd59d5f4af7b} + + + {3e53394c-b59c-30cc-ae69-a4f46f9edfa3} + + + {7eb51140-a50f-3f50-b379-83677a82496c} + + + {1f4d6dd1-517f-3eeb-b974-2304ada5e67a} + + + {b145288f-68ad-3e79-93cb-e36537b20e26} + + + {3122f223-e6c2-3ab1-ad85-ca289b47419e} + + + {2720c2c8-c517-356e-83ed-c2997ab782c3} + + + {0a3af0f3-56f7-3551-a64e-6284feccc423} + + + {64e89b4f-eec9-38c9-90f2-4881bf5e84c0} + + + {0c0b4001-ae11-3d0f-8e73-75ac9b6e1ae8} + + + {f5065d74-beda-3e1e-819a-f606279c7fe9} + + + {f7aedb93-94a6-3ede-9374-ff41daca4841} + + + {0e7473c9-9c69-36b3-ab6c-d953647a15a6} + + + {d75db64c-eb08-3f10-9b99-1b6e6827f348} + + + {73194d5d-588a-342f-bee6-f28b4486f20b} + + + {7c5e6f81-e4ce-3018-a776-a1f125072d73} + + + {76990c08-d692-367f-b286-c728a8cad6bf} + + + {bf04f786-7862-3bde-aeba-ed82ee59ca22} + + + {98b6126a-3725-3707-a4cc-ff3af657cba0} + + + {8b704d11-af1f-30c0-9981-479da6d88dc3} + + + {342e684b-4e18-311c-953c-8391a544a04f} + + + {c6b8e28c-7c54-3af7-bee3-2948ba7b2082} + + + {4e9a1d6b-ee07-3bbc-ad78-6d0ba0e6d9d3} + + + {eb259fd9-56f0-32db-a903-6bc1549a7326} + + + {e53b6258-fcdd-34c8-96c5-44510a34a390} + + + {8bd3b558-2d08-3c3a-81ca-22677dde943b} + + + {16a8dd41-b0ab-39a7-80c8-3052d8b63811} + + + {d7ec3690-bae7-3653-8c53-66a3142cfcfa} + + + {722ef422-8c03-3008-ba2a-3a7e91c6647c} + + + {8c7d8b62-7b4f-3eb9-85b7-18e8d925be14} + + + {8fb6a906-dbd6-3746-9b0f-f49e7028daec} + + + {f2d6a22b-dd67-3561-90a4-88696169cb7b} + + + {aaf59186-1c0d-33cf-a34d-93e14bb87226} + + + {3d42d2a2-b192-33dd-9162-508916414707} + + + {898b6bd5-1360-3a34-adcd-0fade7561685} + + + {323c0a15-3c1d-39b2-9ec1-299deb299497} + + + {52c2080d-37c0-34c2-864a-c201c728e5d8} + + + {ff618a41-caeb-3a18-ad36-d34b049a8f50} + + + {ffc3712d-dfe0-3b51-8257-f5ffc9c9cea3} + + + {f54b65b6-71cf-3ab3-9c8c-f89c81846836} + + + {1bd97a78-befa-3805-8e9c-80d7c1aff37b} + + + {e785f104-1212-37bf-8511-cc518b9ace66} + + + {447b993f-59fb-3efd-8c59-a1712c97dfe8} + + + {cdb8d233-06b0-3872-a62b-c1ccf4cb4314} + + + {402a1c5a-d499-333a-a2fa-acd0e6a3c2b2} + + + {77f5a2e9-2ef1-3a72-b63c-88e8e4b92678} + + + {6c9c7c30-0808-3fad-8a88-944d7645e5d5} + + + {5d2fb1a2-f063-32db-a81a-41f79e36fd23} + + + {7bec6074-fbc7-330b-9e18-7dc3e868569a} + + + {834d4827-81e4-3de3-baa1-a216763f11d6} + + + {52bf28eb-7ffd-399a-be35-0df3e8e99c15} + + + {39cc576f-4b54-3d71-b14c-27445bc4b138} + + + {b9b02bee-5c1f-36d2-b97d-983f865a4cc6} + + + {41f1f35b-4639-3424-be85-7dfba02f3c5e} + + + {8bf11d29-2f5a-3f10-8ae6-82229d19c5b0} + + + {62f7ae38-4ce6-3976-acc3-47c462db4fbe} + + + {e07a28cd-775a-3798-bfdb-97842d3614d6} + + + {bb073c16-adc8-3cff-80b9-99cf5a28de6c} + + + {63de0ec8-ecde-35e3-8b97-6e9e4da342ee} + + + {29925210-53eb-342c-8527-7ebc173e668f} + + + {b2f989b6-87a6-3388-a35c-2d0d59cb4236} + + + {bc6466a1-57b0-3a35-9973-ad488a4bef8c} + + + {5599d9ab-b5b2-3310-b541-ae0fb70eecf1} + + + {eaedd08a-46f8-3d12-9e8d-bb3ee3ead5f6} + + + {806b6ff3-578b-308a-a359-0f5ed8472ecc} + + + {5a1d852e-67bb-3dc1-9ec5-99ef74b7faca} + + + {33e45d9c-e12a-3e76-9ef2-4f5510244a5b} + + + {048ba2a8-b22b-346c-9886-668b63c88c68} + + + {f08a312f-f8a3-350b-87ab-1f79d33e513f} + + + {c403f690-cd22-3ed4-9cc7-3f46e73081fd} + + + {c34d03f5-cf47-39fe-a5ad-5eb917006203} + + + {4da0c5ca-33d1-34e0-9689-12e69ae2dbd6} + + + {dd6b294c-5871-386c-92ec-aa46fcc411d4} + + + {07aca978-0547-329a-b70b-29aa579cacc5} + + + {f171fa05-35c4-32a0-b035-b5d6680ab714} + + + {ede2279c-1ba7-3d62-8345-733c6c1965e7} + + + {9c15151b-10dc-3dfe-b97b-a7d8c6b58920} + + + {49fb9272-ffe2-3993-b562-b19d5f2c9b40} + + + {80669cf5-3c9c-3c60-b409-9d8fb305bc77} + + + {96da72eb-3aa0-3850-83eb-32788f91e5bd} + + + {56bb40fc-d381-3a9e-925b-681774c48dde} + + + {fde88485-0fe6-3b22-9480-1d2b49fade53} + + + {ef090484-4db4-3dc2-aca7-c59bab1db23b} + + + {14c126fd-bb91-37ea-b807-b60c386be601} + + + {ac56c38f-7e17-3b79-bf47-58e9476b3b89} + + + {5dfc520b-f690-3d5f-a86a-8b667f2e7490} + + + diff -Nru libsodium-1.0.17/builds/msvc/vs2019/libsodium/libsodium.xml libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.xml --- libsodium-1.0.17/builds/msvc/vs2019/libsodium/libsodium.xml 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.xml 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libsodium-1.0.17/builds/msvc/vs2019/libsodium.import.props libsodium-1.0.18/builds/msvc/vs2019/libsodium.import.props --- libsodium-1.0.17/builds/msvc/vs2019/libsodium.import.props 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2019/libsodium.import.props 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + <_PropertySheetDisplayName>Libsodium Import Settings + + + + + + + + + + + + + $(ProjectDir)..\..\..\..\..\libsodium\src\libsodium\include;$(ProjectDir)..\..\..\..\..\libsodium\src\libsodium\include\sodium\;%(AdditionalIncludeDirectories) + SODIUM_STATIC;%(PreprocessorDefinitions) + + + advapi32.lib;libsodium.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\..\..\libsodium\bin\$(PlatformName)\Debug\$(PlatformToolset)\$(Linkage-libsodium)\;%(AdditionalLibraryDirectories) + $(ProjectDir)..\..\..\..\..\libsodium\bin\$(PlatformName)\Release\$(PlatformToolset)\$(Linkage-libsodium)\;%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libsodium-1.0.17/builds/msvc/vs2019/libsodium.import.xml libsodium-1.0.18/builds/msvc/vs2019/libsodium.import.xml --- libsodium-1.0.17/builds/msvc/vs2019/libsodium.import.xml 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2019/libsodium.import.xml 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libsodium-1.0.17/builds/msvc/vs2019/libsodium.sln libsodium-1.0.18/builds/msvc/vs2019/libsodium.sln --- libsodium-1.0.17/builds/msvc/vs2019/libsodium.sln 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/builds/msvc/vs2019/libsodium.sln 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26228.4 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsodium", "libsodium\libsodium.vcxproj", "{A185B162-6CB6-4502-B03F-B56F7699A8D9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + DynDebug|Win32 = DynDebug|Win32 + DynDebug|x64 = DynDebug|x64 + DynRelease|Win32 = DynRelease|Win32 + DynRelease|x64 = DynRelease|x64 + LtcgDebug|Win32 = LtcgDebug|Win32 + LtcgDebug|x64 = LtcgDebug|x64 + LtcgRelease|Win32 = LtcgRelease|Win32 + LtcgRelease|x64 = LtcgRelease|x64 + StaticDebug|Win32 = StaticDebug|Win32 + StaticDebug|x64 = StaticDebug|x64 + StaticRelease|Win32 = StaticRelease|Win32 + StaticRelease|x64 = StaticRelease|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynDebug|Win32.ActiveCfg = DebugDLL|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynDebug|Win32.Build.0 = DebugDLL|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynDebug|x64.ActiveCfg = DebugDLL|x64 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynDebug|x64.Build.0 = DebugDLL|x64 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynRelease|Win32.ActiveCfg = ReleaseDLL|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynRelease|Win32.Build.0 = ReleaseDLL|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynRelease|x64.ActiveCfg = ReleaseDLL|x64 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynRelease|x64.Build.0 = ReleaseDLL|x64 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgDebug|Win32.ActiveCfg = DebugLTCG|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgDebug|Win32.Build.0 = DebugLTCG|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgDebug|x64.ActiveCfg = DebugLTCG|x64 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgDebug|x64.Build.0 = DebugLTCG|x64 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgRelease|Win32.ActiveCfg = ReleaseLTCG|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgRelease|Win32.Build.0 = ReleaseLTCG|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgRelease|x64.ActiveCfg = ReleaseLTCG|x64 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgRelease|x64.Build.0 = ReleaseLTCG|x64 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticDebug|Win32.ActiveCfg = DebugLIB|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticDebug|Win32.Build.0 = DebugLIB|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticDebug|x64.ActiveCfg = DebugLIB|x64 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticDebug|x64.Build.0 = DebugLIB|x64 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticRelease|Win32.ActiveCfg = ReleaseLIB|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticRelease|Win32.Build.0 = ReleaseLIB|Win32 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticRelease|x64.ActiveCfg = ReleaseLIB|x64 + {A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticRelease|x64.Build.0 = ReleaseLIB|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -Nru libsodium-1.0.17/ChangeLog libsodium-1.0.18/ChangeLog --- libsodium-1.0.17/ChangeLog 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/ChangeLog 2019-05-30 20:13:18.000000000 +0000 @@ -1,4 +1,33 @@ +* Version 1.0.18 + - The Enterprise versions of Visual Studio are now supported. + - Visual Studio 2019 is now supported. + - 32-bit binaries for Visual Studio 2010 are now provided. + - A test that didn't work properly on Linux systems with overcommit +memory turned on has been removed. This fixes Ansible builds. + - Emscripten: `print` and `printErr` functions are overridden to send +errors to the console, if there is one. + - Emscripten: `UTF8ToString()` is now exported since `Pointer_stringify()` +has been deprecated. + - Libsodium version detection has been fixed in the CMake recipe. + - Generic hashing got a 10% speedup on AVX2. + - New target: WebAssembly/WASI (compile with `dist-builds/wasm32-wasi.sh`). + - New functions to map a hash to an edwards25519 point or get a random point: +`core_ed25519_from_hash()` and `core_ed25519_random()`. + - `crypto_core_ed25519_scalar_mul()` has been implemented for `scalar*scalar` +`(mod L)` multiplication. + - Support for the Ristretto group has been implemented, for compatibility +with wasm-crypto. + - Improvements have been made to the test suite. + - Portability improvements has been made. + - `getentropy()` is now used on systems providing this system call. + - `randombytes_salsa20 has been renamed to `randombytes_internal`. + - Support for (p)nacl has been removed. + - Most `((nonnull))` attributes have been relaxed to allow 0-length inputs +to be `NULL`. + - The `-ftree-vectorize` and `-ftree-slp-vectorize` compiler switches are +now used, if available, for optimized builds. + * Version 1.0.17 - Bug fix: `sodium_pad()` didn't properly support block sizes >= 256 bytes. - JS/WebAssembly: some old iOS versions can't instantiate the WebAssembly diff -Nru libsodium-1.0.17/configure.ac libsodium-1.0.18/configure.ac --- libsodium-1.0.17/configure.ac 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/configure.ac 2019-05-30 20:13:18.000000000 +0000 @@ -1,5 +1,5 @@ AC_PREREQ([2.65]) -AC_INIT([libsodium],[1.0.17], +AC_INIT([libsodium],[1.0.18], [https://github.com/jedisct1/libsodium/issues], [libsodium], [https://github.com/jedisct1/libsodium]) @@ -15,9 +15,9 @@ AC_SUBST(VERSION) SODIUM_LIBRARY_VERSION_MAJOR=10 -SODIUM_LIBRARY_VERSION_MINOR=2 -DLL_VERSION=23 -SODIUM_LIBRARY_VERSION=25:0:2 +SODIUM_LIBRARY_VERSION_MINOR=3 +DLL_VERSION=24 +SODIUM_LIBRARY_VERSION=26:0:3 # | | | # +------+ | +---+ # | | | @@ -36,6 +36,7 @@ AC_LANG_ASSERT(C) LX_CFLAGS=${CFLAGS-NONE} +PKGCONFIG_LIBS_PRIVATE="" dnl Path check @@ -59,7 +60,7 @@ ]) AC_ARG_ENABLE(asm, -[AS_HELP_STRING(--disable-asm,[Do not compile assembly code -- As a side effect, this disables CPU-specific implementations on non-Windows platforms. Only for use with targets such as WebAssembly and NativeClient.])], +[AS_HELP_STRING(--disable-asm,[Do not compile assembly code -- As a side effect, this disables CPU-specific implementations on non-Windows platforms. Only for use with targets such as WebAssembly.])], [ AS_IF([test "x$enableval" = "xno"], [ enable_asm="no" @@ -81,10 +82,6 @@ unset EMSCRIPTEN ]) ]) -AS_IF([test "$host_os" = "nacl" -o "$host_os" = "pnacl"], [ - enable_asm="no" - AC_MSG_WARN([compiling to Native Client - asm implementations disabled]) -]) AC_ARG_ENABLE(pie, [AS_HELP_STRING(--disable-pie,Do not produce position independent executables)], @@ -124,11 +121,25 @@ AS_IF([test "x$withval" = "xyes"], [ AX_PTHREAD([ - AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files]) - with_threads="yes" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - CC="$PTHREAD_CC"]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include + ]], [[ + pthread_mutex_t mutex; + + pthread_mutex_lock(&mutex); + pthread_mutex_unlock(&mutex) + ]] + )], [ + AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files]) + with_threads="yes" + LIBS="$PTHREAD_LIBS $LIBS" + PKGCONFIG_LIBS_PRIVATE="$PTHREAD_LIBS $PTHREAD_CFLAGS $PKGCONFIG_LIBS_PRIVATE" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + CC="$PTHREAD_CC" + ]) + ], + [ AC_MSG_NOTICE(pthread mutexes are not available) ] + ) ], [with_threads="no"]) AC_ARG_WITH(safecode, @@ -185,12 +196,15 @@ [ AS_IF([test "x$enableval" = "xyes"], [ AX_CHECK_COMPILE_FLAG([-Ofast], [CFLAGS="$CFLAGS -Ofast"]) + AX_CHECK_COMPILE_FLAG([-ftree-vectorize], [CFLAGS="$CFLAGS -ftree-vectorize"]) + AX_CHECK_COMPILE_FLAG([-ftree-slp-vectorize], [CFLAGS="$CFLAGS -ftree-slp-vectorize"]) AX_CHECK_COMPILE_FLAG([-fomit-frame-pointer], [CFLAGS="$CFLAGS -fomit-frame-pointer"]) AX_CHECK_COMPILE_FLAG([-march=native], [CFLAGS="$CFLAGS -march=native"]) ]) ]) -AC_SUBST([MAINT]) +AC_SUBST(MAINT) +AC_SUBST(PKGCONFIG_LIBS_PRIVATE) AX_VALGRIND_CHECK @@ -201,7 +215,7 @@ AC_USE_SYSTEM_EXTENSIONS AC_C_VARARRAYS -AC_CHECK_DEFINE([__native_client__], [NATIVECLIENT="yes"], []) +AC_CHECK_DEFINE([__wasi__], [WASI="yes"], []) AC_CHECK_DEFINE([_FORTIFY_SOURCE], [], [ AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2], @@ -273,7 +287,7 @@ AS_IF([test "x$enable_ssp" != "xno"],[ AS_CASE([$host_os], - [cygwin*|mingw*|msys|pw32*|cegcc*|haiku], [ ], + [cygwin*|mingw*|msys|pw32*|cegcc*|haiku|none], [ ], [*], [ AX_CHECK_COMPILE_FLAG([-fstack-protector], [ AX_CHECK_LINK_FLAG([-fstack-protector], @@ -350,7 +364,7 @@ dnl Checks for headers -AS_IF([test "x$EMSCRIPTEN" = "x" -a "$host_os" != "pnacl"], [ +AS_IF([test "x$EMSCRIPTEN" = "x"], [ oldcflags="$CFLAGS" AX_CHECK_COMPILE_FLAG([-mmmx], [CFLAGS="$CFLAGS -mmmx"]) @@ -426,9 +440,6 @@ AX_CHECK_COMPILE_FLAG([-mavx], [CFLAGS="$CFLAGS -mavx"]) AC_MSG_CHECKING(for AVX instructions set) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding AVX opcodes -#endif #pragma GCC target("avx") #include ]], [[ _mm256_zeroall(); ]])], @@ -442,9 +453,6 @@ AX_CHECK_COMPILE_FLAG([-mavx2], [CFLAGS="$CFLAGS -mavx2"]) AC_MSG_CHECKING(for AVX2 instructions set) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding AVX2 opcodes -#endif #pragma GCC target("avx2") #include ]], [[ @@ -457,9 +465,6 @@ AX_CHECK_COMPILE_FLAG([-mavx2], [CFLAGS_AVX2="-mavx2"]) AC_MSG_CHECKING(if _mm256_broadcastsi128_si256 is correctly defined) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding AVX2 opcodes -#endif #pragma GCC target("avx2") #include ]], [[ __m256i y = _mm256_broadcastsi128_si256(_mm_setzero_si128()); ]])], @@ -475,9 +480,6 @@ AX_CHECK_COMPILE_FLAG([-mavx512f], [CFLAGS="$CFLAGS -mavx512f"]) AC_MSG_CHECKING(for AVX512F instructions set) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding AVX512F opcodes -#endif #pragma GCC target("avx512f") #include ]], [[ @@ -511,9 +513,6 @@ AX_CHECK_COMPILE_FLAG([-mpclmul], [CFLAGS="$CFLAGS -mpclmul"]) AC_MSG_CHECKING(for AESNI instructions set and PCLMULQDQ) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding AESNI opcodes -#endif #pragma GCC target("aes") #pragma GCC target("pclmul") #include @@ -531,9 +530,6 @@ AX_CHECK_COMPILE_FLAG([-mrdrnd], [CFLAGS="$CFLAGS -mrdrnd"]) AC_MSG_CHECKING(for RDRAND) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding RDRAND opcodes -#endif #pragma GCC target("rdrnd") #include ]], [[ unsigned long long x; _rdrand64_step(&x); ]])], @@ -558,7 +554,7 @@ AC_SUBST(CFLAGS_PCLMUL) AC_SUBST(CFLAGS_RDRAND) -AC_CHECK_HEADERS([sys/mman.h intrin.h]) +AC_CHECK_HEADERS([sys/mman.h sys/random.h intrin.h]) AC_MSG_CHECKING([if _xgetbv() is available]) AC_LINK_IFELSE( @@ -696,7 +692,7 @@ AC_SUBST(HAVE_TI_MODE_V) HAVE_CPUID_V=0 -AS_IF([test "$enable_asm" != "no" -o "$host_alias" = "x86_64-nacl"],[ +AS_IF([test "$enable_asm" != "no"],[ AC_MSG_CHECKING(for cpuid instruction) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ unsigned int cpu_info[4]; @@ -713,7 +709,7 @@ AC_SUBST(HAVE_CPUID_V) asm_hide_symbol="unsupported" -AS_IF([test "$enable_asm" != "no" -o "$host_os" = "nacl"],[ +AS_IF([test "$enable_asm" != "no"],[ AC_MSG_CHECKING(if the .private_extern asm directive is supported) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[ __asm__ __volatile__ (".private_extern dummy_symbol \n" @@ -799,9 +795,50 @@ AC_FUNC_ALLOCA AS_IF([test "x$EMSCRIPTEN" = "x"],[ AC_CHECK_FUNCS([arc4random arc4random_buf]) - AC_CHECK_FUNCS([mmap mlock madvise mprotect memset_s explicit_bzero explicit_memset nanosleep]) + AC_CHECK_FUNCS([mmap mlock madvise mprotect]) + + AC_MSG_CHECKING(for getrandom with a standard API) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SYS_RANDOM_H +# include +#endif +]], [[ +unsigned char buf; +(void) getrandom((void *) &buf, 1U, 0U); + ]])], + [AC_MSG_RESULT(yes) + AC_CHECK_FUNCS([getrandom])], + [AC_MSG_RESULT(no) + ]) + + AC_MSG_CHECKING(for getentropy with a standard API) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SYS_RANDOM_H +# include +#endif +]], [[ +#ifdef __APPLE__ +# error getentropy() is currently disabled on Apple operating systems +#endif + +unsigned char buf; +(void) getentropy((void *) &buf, 1U); + ]])], + [AC_MSG_RESULT(yes) + AC_CHECK_FUNCS([getentropy])], + [AC_MSG_RESULT(no) + ]) ]) -AC_CHECK_FUNCS([posix_memalign getpid]) +AC_CHECK_FUNCS([posix_memalign getpid nanosleep]) +AC_CHECK_FUNCS([memset_s explicit_bzero explicit_memset]) AC_SUBST([LIBTOOL_EXTRA_FLAGS]) @@ -812,8 +849,7 @@ ]) AC_SUBST(TEST_LDFLAGS) AM_CONDITIONAL([EMSCRIPTEN], [test "x$EMSCRIPTEN" != "x"]) - -AM_CONDITIONAL([NATIVECLIENT], [test "x$NATIVECLIENT" != "x"]) +AM_CONDITIONAL([WASI], [test "x$WASI" != "x"]) AC_DEFINE([CONFIGURED], [1], [the build system was properly configured]) diff -Nru libsodium-1.0.17/contrib/Findsodium.cmake libsodium-1.0.18/contrib/Findsodium.cmake --- libsodium-1.0.17/contrib/Findsodium.cmake 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/contrib/Findsodium.cmake 2019-05-30 20:13:18.000000000 +0000 @@ -1,107 +1,101 @@ # Written in 2016 by Henrik Steffen Gaßmann # -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. +# To the extent possible under law, the author(s) have dedicated all copyright +# and related and neighboring rights to this software to the public domain +# worldwide. This software is distributed without any warranty. # -# You should have received a copy of the CC0 Public Domain Dedication -# along with this software. If not, see +# You should have received a copy of the CC0 Public Domain Dedication along with +# this software. If not, see # -# http://creativecommons.org/publicdomain/zero/1.0/ +# http://creativecommons.org/publicdomain/zero/1.0/ # -######################################################################## +# ############################################################################## # Tries to find the local libsodium installation. # -# On Windows the sodium_DIR environment variable is used as a default -# hint which can be overridden by setting the corresponding cmake variable. +# On Windows the sodium_DIR environment variable is used as a default hint which +# can be overridden by setting the corresponding cmake variable. # # Once done the following variables will be defined: # -# sodium_FOUND -# sodium_INCLUDE_DIR -# sodium_LIBRARY_DEBUG -# sodium_LIBRARY_RELEASE -# +# sodium_FOUND sodium_INCLUDE_DIR sodium_LIBRARY_DEBUG sodium_LIBRARY_RELEASE +# sodium_VERSION_STRING # # Furthermore an imported "sodium" target is created. # -if (CMAKE_C_COMPILER_ID STREQUAL "GNU" - OR CMAKE_C_COMPILER_ID STREQUAL "Clang") - set(_GCC_COMPATIBLE 1) +if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") + set(_GCC_COMPATIBLE 1) endif() # static library option -if (NOT DEFINED sodium_USE_STATIC_LIBS) - option(sodium_USE_STATIC_LIBS "enable to statically link against sodium" OFF) +if(NOT DEFINED sodium_USE_STATIC_LIBS) + option(sodium_USE_STATIC_LIBS "enable to statically link against sodium" OFF) endif() if(NOT (sodium_USE_STATIC_LIBS EQUAL sodium_USE_STATIC_LIBS_LAST)) - unset(sodium_LIBRARY CACHE) - unset(sodium_LIBRARY_DEBUG CACHE) - unset(sodium_LIBRARY_RELEASE CACHE) - unset(sodium_DLL_DEBUG CACHE) - unset(sodium_DLL_RELEASE CACHE) - set(sodium_USE_STATIC_LIBS_LAST ${sodium_USE_STATIC_LIBS} CACHE INTERNAL "internal change tracking variable") + unset(sodium_LIBRARY CACHE) + unset(sodium_LIBRARY_DEBUG CACHE) + unset(sodium_LIBRARY_RELEASE CACHE) + unset(sodium_DLL_DEBUG CACHE) + unset(sodium_DLL_RELEASE CACHE) + set(sodium_USE_STATIC_LIBS_LAST + ${sodium_USE_STATIC_LIBS} + CACHE INTERNAL "internal change tracking variable") endif() - -######################################################################## +# ############################################################################## # UNIX -if (UNIX) - # import pkg-config - find_package(PkgConfig QUIET) - if (PKG_CONFIG_FOUND) - pkg_check_modules(sodium_PKG QUIET libsodium) - endif() - - if(sodium_USE_STATIC_LIBS) - if (sodium_PKG_STATIC_LIBRARIES) - foreach(_libname ${sodium_PKG_STATIC_LIBRARIES}) - if (NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending with .a - list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a") - endif() - endforeach() - list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES) - else() - # if pkgconfig for libsodium doesn't provide - # static lib info, then override PKG_STATIC here.. - set(sodium_PKG_STATIC_LIBRARIES libsodium.a) +if(UNIX) + # import pkg-config + find_package(PkgConfig QUIET) + if(PKG_CONFIG_FOUND) + pkg_check_modules(sodium_PKG QUIET libsodium) + endif() + + if(sodium_USE_STATIC_LIBS) + if(sodium_PKG_STATIC_LIBRARIES) + foreach(_libname ${sodium_PKG_STATIC_LIBRARIES}) + if(NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending + # with .a + list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a") endif() - - set(XPREFIX sodium_PKG_STATIC) + endforeach() + list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES) else() - if (sodium_PKG_LIBRARIES STREQUAL "") - set(sodium_PKG_LIBRARIES sodium) - endif() + # if pkgconfig for libsodium doesn't provide static lib info, then + # override PKG_STATIC here.. + set(sodium_PKG_STATIC_LIBRARIES libsodium.a) + endif() - set(XPREFIX sodium_PKG) + set(XPREFIX sodium_PKG_STATIC) + else() + if(sodium_PKG_LIBRARIES STREQUAL "") + set(sodium_PKG_LIBRARIES sodium) endif() - find_path(sodium_INCLUDE_DIR sodium.h - HINTS ${${XPREFIX}_INCLUDE_DIRS} - ) - find_library(sodium_LIBRARY_DEBUG NAMES ${${XPREFIX}_LIBRARIES} - HINTS ${${XPREFIX}_LIBRARY_DIRS} - ) - find_library(sodium_LIBRARY_RELEASE NAMES ${${XPREFIX}_LIBRARIES} - HINTS ${${XPREFIX}_LIBRARY_DIRS} - ) - - -######################################################################## -# Windows -elseif (WIN32) - set(sodium_DIR "$ENV{sodium_DIR}" CACHE FILEPATH "sodium install directory") - mark_as_advanced(sodium_DIR) - - find_path(sodium_INCLUDE_DIR sodium.h - HINTS ${sodium_DIR} - PATH_SUFFIXES include - ) - - if (MSVC) - # detect target architecture - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arch.c" [=[ + set(XPREFIX sodium_PKG) + endif() + + find_path(sodium_INCLUDE_DIR sodium.h HINTS ${${XPREFIX}_INCLUDE_DIRS}) + find_library(sodium_LIBRARY_DEBUG + NAMES ${${XPREFIX}_LIBRARIES} + HINTS ${${XPREFIX}_LIBRARY_DIRS}) + find_library(sodium_LIBRARY_RELEASE + NAMES ${${XPREFIX}_LIBRARIES} + HINTS ${${XPREFIX}_LIBRARY_DIRS}) + + # ############################################################################ + # Windows +elseif(WIN32) + set(sodium_DIR "$ENV{sodium_DIR}" CACHE FILEPATH "sodium install directory") + mark_as_advanced(sodium_DIR) + + find_path(sodium_INCLUDE_DIR sodium.h + HINTS ${sodium_DIR} + PATH_SUFFIXES include) + + if(MSVC) + # detect target architecture + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arch.c" [=[ #if defined _M_IX86 #error ARCH_VALUE x86_32 #elif defined _M_X64 @@ -109,180 +103,191 @@ #endif #error ARCH_VALUE unknown ]=]) - try_compile(_UNUSED_VAR "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/arch.c" - OUTPUT_VARIABLE _COMPILATION_LOG + try_compile(_UNUSED_VAR "${CMAKE_CURRENT_BINARY_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}/arch.c" + OUTPUT_VARIABLE _COMPILATION_LOG) + string(REGEX + REPLACE ".*ARCH_VALUE ([a-zA-Z0-9_]+).*" + "\\1" + _TARGET_ARCH + "${_COMPILATION_LOG}") + + # construct library path + if(_TARGET_ARCH STREQUAL "x86_32") + string(APPEND _PLATFORM_PATH "Win32") + elseif(_TARGET_ARCH STREQUAL "x86_64") + string(APPEND _PLATFORM_PATH "x64") + else() + message( + FATAL_ERROR + "the ${_TARGET_ARCH} architecture is not supported by Findsodium.cmake." ) - string(REGEX REPLACE ".*ARCH_VALUE ([a-zA-Z0-9_]+).*" "\\1" _TARGET_ARCH "${_COMPILATION_LOG}") - - # construct library path - if (_TARGET_ARCH STREQUAL "x86_32") - string(APPEND _PLATFORM_PATH "Win32") - elseif(_TARGET_ARCH STREQUAL "x86_64") - string(APPEND _PLATFORM_PATH "x64") - else() - message(FATAL_ERROR "the ${_TARGET_ARCH} architecture is not supported by Findsodium.cmake.") - endif() - string(APPEND _PLATFORM_PATH "/$$CONFIG$$") - - if (MSVC_VERSION LESS 1900) - math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 60") - else() - math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 50") - endif() - string(APPEND _PLATFORM_PATH "/v${_VS_VERSION}") + endif() + string(APPEND _PLATFORM_PATH "/$$CONFIG$$") - if (sodium_USE_STATIC_LIBS) - string(APPEND _PLATFORM_PATH "/static") - else() - string(APPEND _PLATFORM_PATH "/dynamic") - endif() + if(MSVC_VERSION LESS 1900) + math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 60") + else() + math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 50") + endif() + string(APPEND _PLATFORM_PATH "/v${_VS_VERSION}") - string(REPLACE "$$CONFIG$$" "Debug" _DEBUG_PATH_SUFFIX "${_PLATFORM_PATH}") - string(REPLACE "$$CONFIG$$" "Release" _RELEASE_PATH_SUFFIX "${_PLATFORM_PATH}") + if(sodium_USE_STATIC_LIBS) + string(APPEND _PLATFORM_PATH "/static") + else() + string(APPEND _PLATFORM_PATH "/dynamic") + endif() - find_library(sodium_LIBRARY_DEBUG libsodium.lib - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX} - ) - find_library(sodium_LIBRARY_RELEASE libsodium.lib - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX} - ) - if (NOT sodium_USE_STATIC_LIBS) - set(CMAKE_FIND_LIBRARY_SUFFIXES_BCK ${CMAKE_FIND_LIBRARY_SUFFIXES}) - set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll") - find_library(sodium_DLL_DEBUG libsodium - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX} - ) - find_library(sodium_DLL_RELEASE libsodium - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX} - ) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BCK}) - endif() + string(REPLACE "$$CONFIG$$" + "Debug" + _DEBUG_PATH_SUFFIX + "${_PLATFORM_PATH}") + string(REPLACE "$$CONFIG$$" + "Release" + _RELEASE_PATH_SUFFIX + "${_PLATFORM_PATH}") + + find_library(sodium_LIBRARY_DEBUG libsodium.lib + HINTS ${sodium_DIR} + PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX}) + find_library(sodium_LIBRARY_RELEASE libsodium.lib + HINTS ${sodium_DIR} + PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX}) + if(NOT sodium_USE_STATIC_LIBS) + set(CMAKE_FIND_LIBRARY_SUFFIXES_BCK ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll") + find_library(sodium_DLL_DEBUG libsodium + HINTS ${sodium_DIR} + PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX}) + find_library(sodium_DLL_RELEASE libsodium + HINTS ${sodium_DIR} + PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX}) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BCK}) + endif() - elseif(_GCC_COMPATIBLE) - if (sodium_USE_STATIC_LIBS) - find_library(sodium_LIBRARY_DEBUG libsodium.a - HINTS ${sodium_DIR} - PATH_SUFFIXES lib - ) - find_library(sodium_LIBRARY_RELEASE libsodium.a - HINTS ${sodium_DIR} - PATH_SUFFIXES lib - ) - else() - find_library(sodium_LIBRARY_DEBUG libsodium.dll.a - HINTS ${sodium_DIR} - PATH_SUFFIXES lib - ) - find_library(sodium_LIBRARY_RELEASE libsodium.dll.a - HINTS ${sodium_DIR} - PATH_SUFFIXES lib - ) - - file(GLOB _DLL - LIST_DIRECTORIES false - RELATIVE "${sodium_DIR}/bin" - "${sodium_DIR}/bin/libsodium*.dll" - ) - find_library(sodium_DLL_DEBUG ${_DLL} libsodium - HINTS ${sodium_DIR} - PATH_SUFFIXES bin - ) - find_library(sodium_DLL_RELEASE ${_DLL} libsodium - HINTS ${sodium_DIR} - PATH_SUFFIXES bin - ) - endif() + elseif(_GCC_COMPATIBLE) + if(sodium_USE_STATIC_LIBS) + find_library(sodium_LIBRARY_DEBUG libsodium.a + HINTS ${sodium_DIR} + PATH_SUFFIXES lib) + find_library(sodium_LIBRARY_RELEASE libsodium.a + HINTS ${sodium_DIR} + PATH_SUFFIXES lib) else() - message(FATAL_ERROR "this platform is not supported by FindSodium.cmake") + find_library(sodium_LIBRARY_DEBUG libsodium.dll.a + HINTS ${sodium_DIR} + PATH_SUFFIXES lib) + find_library(sodium_LIBRARY_RELEASE libsodium.dll.a + HINTS ${sodium_DIR} + PATH_SUFFIXES lib) + + file(GLOB _DLL + LIST_DIRECTORIES false + RELATIVE "${sodium_DIR}/bin" + "${sodium_DIR}/bin/libsodium*.dll") + find_library(sodium_DLL_DEBUG ${_DLL} libsodium + HINTS ${sodium_DIR} + PATH_SUFFIXES bin) + find_library(sodium_DLL_RELEASE ${_DLL} libsodium + HINTS ${sodium_DIR} + PATH_SUFFIXES bin) endif() + else() + message(FATAL_ERROR "this platform is not supported by FindSodium.cmake") + endif() - -######################################################################## -# unsupported + # ############################################################################ + # unsupported else() - message(FATAL_ERROR "this platform is not supported by FindSodium.cmake") + message(FATAL_ERROR "this platform is not supported by FindSodium.cmake") endif() - -######################################################################## +# ############################################################################## # common stuff # extract sodium version -if (sodium_INCLUDE_DIR) - set(_VERSION_HEADER "${_INCLUDE_DIR}/sodium/version.h") - if (EXISTS _VERSION_HEADER) - file(READ "${_VERSION_HEADER}" _VERSION_HEADER_CONTENT) - string(REGEX REPLACE ".*#[ \t]*define[ \t]*SODIUM_VERSION_STRING[ \t]*\"([^\n]*)\".*" "\\1" - sodium_VERSION "${_VERSION_HEADER_CONTENT}") - set(sodium_VERSION "${sodium_VERSION}" PARENT_SCOPE) - endif() +if(sodium_INCLUDE_DIR) + set(_VERSION_HEADER "${sodium_INCLUDE_DIR}/sodium/version.h") + if(EXISTS "${_VERSION_HEADER}") + file(READ "${_VERSION_HEADER}" _VERSION_HEADER_CONTENT) + string( + REGEX + REPLACE + ".*#[ \t]*define[ \t]*sodium_VERSION_STRING_STRING[ \t]*\"([^\n]*)\".*" + "\\1" + sodium_VERSION_STRING + "${_VERSION_HEADER_CONTENT}") + set(sodium_VERSION_STRING "${sodium_VERSION_STRING}") + endif() endif() # communicate results include(FindPackageHandleStandardArgs) find_package_handle_standard_args(sodium - REQUIRED_VARS - sodium_LIBRARY_RELEASE - sodium_LIBRARY_DEBUG - sodium_INCLUDE_DIR - VERSION_VAR - sodium_VERSION -) + REQUIRED_VARS + sodium_LIBRARY_RELEASE + sodium_LIBRARY_DEBUG + sodium_INCLUDE_DIR + VERSION_VAR + sodium_VERSION_STRING) # mark file paths as advanced mark_as_advanced(sodium_INCLUDE_DIR) mark_as_advanced(sodium_LIBRARY_DEBUG) mark_as_advanced(sodium_LIBRARY_RELEASE) -if (WIN32) - mark_as_advanced(sodium_DLL_DEBUG) - mark_as_advanced(sodium_DLL_RELEASE) +if(WIN32) + mark_as_advanced(sodium_DLL_DEBUG) + mark_as_advanced(sodium_DLL_RELEASE) endif() # create imported target if(sodium_USE_STATIC_LIBS) - set(_LIB_TYPE STATIC) + set(_LIB_TYPE STATIC) else() - set(_LIB_TYPE SHARED) + set(_LIB_TYPE SHARED) endif() add_library(sodium ${_LIB_TYPE} IMPORTED) -set_target_properties(sodium PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${sodium_INCLUDE_DIR}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" -) - -if (sodium_USE_STATIC_LIBS) - set_target_properties(sodium PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "SODIUM_STATIC" - IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}" - IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}" - ) +set_target_properties(sodium + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${sodium_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES + "C") + +if(sodium_USE_STATIC_LIBS) + set_target_properties(sodium + PROPERTIES INTERFACE_COMPILE_DEFINITIONS + "SODIUM_STATIC" + IMPORTED_LOCATION + "${sodium_LIBRARY_RELEASE}" + IMPORTED_LOCATION_DEBUG + "${sodium_LIBRARY_DEBUG}") else() - if (UNIX) - set_target_properties(sodium PROPERTIES - IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}" - IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}" - ) - elseif (WIN32) - set_target_properties(sodium PROPERTIES - IMPORTED_IMPLIB "${sodium_LIBRARY_RELEASE}" - IMPORTED_IMPLIB_DEBUG "${sodium_LIBRARY_DEBUG}" - ) - if (NOT (sodium_DLL_DEBUG MATCHES ".*-NOTFOUND")) - set_target_properties(sodium PROPERTIES - IMPORTED_LOCATION_DEBUG "${sodium_DLL_DEBUG}" - ) - endif() - if (NOT (sodium_DLL_RELEASE MATCHES ".*-NOTFOUND")) - set_target_properties(sodium PROPERTIES - IMPORTED_LOCATION_RELWITHDEBINFO "${sodium_DLL_RELEASE}" - IMPORTED_LOCATION_MINSIZEREL "${sodium_DLL_RELEASE}" - IMPORTED_LOCATION_RELEASE "${sodium_DLL_RELEASE}" - ) - endif() + if(UNIX) + set_target_properties(sodium + PROPERTIES IMPORTED_LOCATION + "${sodium_LIBRARY_RELEASE}" + IMPORTED_LOCATION_DEBUG + "${sodium_LIBRARY_DEBUG}") + elseif(WIN32) + set_target_properties(sodium + PROPERTIES IMPORTED_IMPLIB + "${sodium_LIBRARY_RELEASE}" + IMPORTED_IMPLIB_DEBUG + "${sodium_LIBRARY_DEBUG}") + if(NOT (sodium_DLL_DEBUG MATCHES ".*-NOTFOUND")) + set_target_properties(sodium + PROPERTIES IMPORTED_LOCATION_DEBUG + "${sodium_DLL_DEBUG}") + endif() + if(NOT (sodium_DLL_RELEASE MATCHES ".*-NOTFOUND")) + set_target_properties(sodium + PROPERTIES IMPORTED_LOCATION_RELWITHDEBINFO + "${sodium_DLL_RELEASE}" + IMPORTED_LOCATION_MINSIZEREL + "${sodium_DLL_RELEASE}" + IMPORTED_LOCATION_RELEASE + "${sodium_DLL_RELEASE}") endif() + endif() endif() diff -Nru libsodium-1.0.17/debian/changelog libsodium-1.0.18/debian/changelog --- libsodium-1.0.17/debian/changelog 2019-01-19 06:07:46.000000000 +0000 +++ libsodium-1.0.18/debian/changelog 2019-10-24 06:39:50.000000000 +0000 @@ -1,20 +1,27 @@ -libsodium (1.0.17-0.1+ubuntu18.04.1+deb.sury.org+1) bionic; urgency=medium +libsodium (1.0.18-1+ubuntu18.04.1+deb.sury.org+1) bionic; urgency=medium * No-change backport to bionic - -- Ondřej Surý Sat, 19 Jan 2019 06:07:46 +0000 + -- Ondřej Surý Thu, 24 Oct 2019 08:39:50 +0200 -libsodium (1.0.17-0.1) unstable; urgency=medium +libsodium (1.0.18-1) unstable; urgency=medium - * Update symbols for libsodium 1.0.17 + * New upstream release. + * Update libsodium23.symbols . + * Refer CC0 license via path in common licenses (closes: #882633). + * Update Standards-Version to 4.4.0 . - -- Ondřej Surý Sat, 19 Jan 2019 06:07:06 +0000 + -- Laszlo Boszormenyi (GCS) Sun, 18 Aug 2019 11:58:00 +0000 -libsodium (1.0.17-0) unstable; urgency=medium +libsodium (1.0.17-1) unstable; urgency=medium - * New upstream version 1.0.17 + * New upstream release. + * Update libsodium23.symbols . + * Don't specify parallel to debhelper. + * Update watch file. + * Update Standards-Version to 4.3.0 . - -- Ondřej Surý Sat, 19 Jan 2019 05:58:40 +0000 + -- Laszlo Boszormenyi (GCS) Thu, 24 Jan 2019 18:51:58 +0100 libsodium (1.0.16-2) unstable; urgency=medium diff -Nru libsodium-1.0.17/debian/control libsodium-1.0.18/debian/control --- libsodium-1.0.17/debian/control 2019-01-19 06:07:06.000000000 +0000 +++ libsodium-1.0.18/debian/control 2019-08-18 11:58:00.000000000 +0000 @@ -3,7 +3,7 @@ Priority: optional Build-Depends: debhelper (>= 9), dh-autoreconf, autotools-dev, pkg-config Maintainer: Laszlo Boszormenyi (GCS) -Standards-Version: 4.1.2 +Standards-Version: 4.4.0 Vcs-Git: https://salsa.debian.org/ondrej/libsodium.git Vcs-Browser: https://salsa.debian.org/ondrej/libsodium Homepage: https://www.libsodium.org/ diff -Nru libsodium-1.0.17/debian/copyright libsodium-1.0.18/debian/copyright --- libsodium-1.0.17/debian/copyright 2019-01-19 06:07:06.000000000 +0000 +++ libsodium-1.0.18/debian/copyright 2019-08-18 11:58:00.000000000 +0000 @@ -1,4 +1,4 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: sodium Upstream-Contact: Frank Denis Source: https://github.com/jedisct1/libsodium @@ -118,7 +118,7 @@ GNU General Public License for more details. . You should have received a copy of the GNU General Public License - along with this program. If not, see + along with this program. If not, see . On Debian systems, the complete text of the GNU General Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". @@ -156,4 +156,6 @@ worldwide. This software is distributed without any warranty. . You should have received a copy of the CC0 Public Domain Dedication along with - this software. If not, see + this software. If not, see + On Debian systems, the complete text of the CC0 Public Domain Dedication + License can be found in "/usr/share/common-licenses/CC0-1.0". diff -Nru libsodium-1.0.17/debian/gbp.conf libsodium-1.0.18/debian/gbp.conf --- libsodium-1.0.17/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/debian/gbp.conf 2019-08-18 11:58:00.000000000 +0000 @@ -0,0 +1,10 @@ +[DEFAULT] +debian-branch = master +upstream-branch = upstream +pristine-tar = True + +[dch] +meta = 1 + +[import-orig] +filter = ['.gitignore'] diff -Nru libsodium-1.0.17/debian/libsodium23.symbols libsodium-1.0.18/debian/libsodium23.symbols --- libsodium-1.0.17/debian/libsodium23.symbols 2019-01-19 06:07:06.000000000 +0000 +++ libsodium-1.0.18/debian/libsodium23.symbols 2019-08-18 11:58:00.000000000 +0000 @@ -146,12 +146,16 @@ crypto_box_zerobytes@Base 0.6.0 crypto_core_ed25519_add@Base 1.0.16 crypto_core_ed25519_bytes@Base 1.0.16 + crypto_core_ed25519_from_hash@Base 1.0.18 crypto_core_ed25519_from_uniform@Base 1.0.16 + crypto_core_ed25519_hashbytes@Base 1.0.18 crypto_core_ed25519_is_valid_point@Base 1.0.16 crypto_core_ed25519_nonreducedscalarbytes@Base 1.0.17 + crypto_core_ed25519_random@Base 1.0.18 crypto_core_ed25519_scalar_add@Base 1.0.17 crypto_core_ed25519_scalar_complement@Base 1.0.17 crypto_core_ed25519_scalar_invert@Base 1.0.17 + crypto_core_ed25519_scalar_mul@Base 1.0.18 crypto_core_ed25519_scalar_negate@Base 1.0.17 crypto_core_ed25519_scalar_random@Base 1.0.17 crypto_core_ed25519_scalar_reduce@Base 1.0.17 @@ -169,6 +173,23 @@ crypto_core_hsalsa20_inputbytes@Base 0.6.0 crypto_core_hsalsa20_keybytes@Base 0.6.0 crypto_core_hsalsa20_outputbytes@Base 0.6.0 + crypto_core_ristretto255_add@Base 1.0.18 + crypto_core_ristretto255_bytes@Base 1.0.18 + crypto_core_ristretto255_from_hash@Base 1.0.18 + crypto_core_ristretto255_hashbytes@Base 1.0.18 + crypto_core_ristretto255_is_valid_point@Base 1.0.18 + crypto_core_ristretto255_nonreducedscalarbytes@Base 1.0.18 + crypto_core_ristretto255_random@Base 1.0.18 + crypto_core_ristretto255_scalar_add@Base 1.0.18 + crypto_core_ristretto255_scalar_complement@Base 1.0.18 + crypto_core_ristretto255_scalar_invert@Base 1.0.18 + crypto_core_ristretto255_scalar_mul@Base 1.0.18 + crypto_core_ristretto255_scalar_negate@Base 1.0.18 + crypto_core_ristretto255_scalar_random@Base 1.0.18 + crypto_core_ristretto255_scalar_reduce@Base 1.0.18 + crypto_core_ristretto255_scalar_sub@Base 1.0.18 + crypto_core_ristretto255_scalarbytes@Base 1.0.18 + crypto_core_ristretto255_sub@Base 1.0.18 crypto_core_salsa2012@Base 0.6.0 crypto_core_salsa2012_constbytes@Base 0.6.0 crypto_core_salsa2012_inputbytes@Base 0.6.0 @@ -372,6 +393,10 @@ crypto_scalarmult_ed25519_noclamp@Base 1.0.17 crypto_scalarmult_ed25519_scalarbytes@Base 1.0.16 crypto_scalarmult_primitive@Base 0.6.0 + crypto_scalarmult_ristretto255@Base 1.0.18 + crypto_scalarmult_ristretto255_base@Base 1.0.18 + crypto_scalarmult_ristretto255_bytes@Base 1.0.18 + crypto_scalarmult_ristretto255_scalarbytes@Base 1.0.18 crypto_scalarmult_scalarbytes@Base 0.6.0 crypto_secretbox@Base 0.6.0 crypto_secretbox_boxzerobytes@Base 0.6.0 @@ -535,8 +560,8 @@ randombytes_buf_deterministic@Base 1.0.12 randombytes_close@Base 0.6.0 randombytes_implementation_name@Base 0.6.0 + randombytes_internal_implementation@Base 1.0.18 randombytes_random@Base 0.6.0 - randombytes_salsa20_implementation@Base 0.6.0 randombytes_seedbytes@Base 1.0.12 randombytes_set_implementation@Base 0.6.0 randombytes_stir@Base 0.6.0 diff -Nru libsodium-1.0.17/debian/watch libsodium-1.0.18/debian/watch --- libsodium-1.0.17/debian/watch 2019-01-19 06:07:06.000000000 +0000 +++ libsodium-1.0.18/debian/watch 2019-08-18 11:58:00.000000000 +0000 @@ -1,3 +1,3 @@ -version=3 +version=4 opts="filenamemangle=s/^.*\/(.*)/libsodium-$1/" \ - https://github.com/jedisct1/libsodium/tags .*/(\d[\d\.]*)\.tar\.gz + https://github.com/jedisct1/libsodium/tags .*/(\d[\d\.]*)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) diff -Nru libsodium-1.0.17/dist-build/android-build.sh libsodium-1.0.18/dist-build/android-build.sh --- libsodium-1.0.17/dist-build/android-build.sh 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/dist-build/android-build.sh 2019-05-30 20:13:18.000000000 +0000 @@ -34,6 +34,12 @@ rm -rf "${TOOLCHAIN_DIR}" "${PREFIX}" echo +echo "Warnings related to headers being present but not usable are due to functions" +echo "that didn't exist in the specified minimum API version level." +echo "They can be safely ignored." +echo + +echo if [ "$NDK_PLATFORM" != "$NDK_PLATFORM_COMPAT" ]; then echo "Building for platform [${NDK_PLATFORM}], retaining compatibility with platform [${NDK_PLATFORM_COMPAT}]" else diff -Nru libsodium-1.0.17/dist-build/emscripten.sh libsodium-1.0.18/dist-build/emscripten.sh --- libsodium-1.0.17/dist-build/emscripten.sh 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/dist-build/emscripten.sh 2019-05-30 20:13:18.000000000 +0000 @@ -2,11 +2,11 @@ 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_uniform","_crypto_core_ed25519_is_valid_point","_crypto_core_ed25519_nonreducedscalarbytes","_crypto_core_ed25519_scalar_add","_crypto_core_ed25519_scalar_complement","_crypto_core_ed25519_scalar_invert","_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_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_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_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='["Pointer_stringify","getValue","setValue"]' -export TOTAL_MEMORY=16777216 -export TOTAL_MEMORY_SUMO=16777216 -export TOTAL_MEMORY_TESTS=16777216 +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_hash","_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_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_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_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_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 +export MAX_MEMORY_TESTS=16777216 export LDFLAGS="-s RESERVED_FUNCTION_POINTERS=8" export LDFLAGS="${LDFLAGS} -s ALLOW_MEMORY_GROWTH=1" export LDFLAGS="${LDFLAGS} -s SINGLE_FILE=1" @@ -19,7 +19,7 @@ echo if [ "x$1" = "x--standard" ]; then export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_STANDARD" - export LDFLAGS="${LDFLAGS} ${LDFLAGS_DIST} -s TOTAL_MEMORY=${TOTAL_MEMORY}" + export LDFLAGS="${LDFLAGS} ${LDFLAGS_DIST} -s TOTAL_MEMORY=${MAX_MEMORY}" export PREFIX="$(pwd)/libsodium-js" export DONE_FILE="$(pwd)/js.done" export CONFIG_EXTRA="--enable-minimal" @@ -27,14 +27,14 @@ echo "Building a standard distribution in [${PREFIX}]" elif [ "x$1" = "x--sumo" ]; then export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_SUMO" - export LDFLAGS="${LDFLAGS} ${LDFLAGS_DIST} -s TOTAL_MEMORY=${TOTAL_MEMORY_SUMO}" + export LDFLAGS="${LDFLAGS} ${LDFLAGS_DIST} -s TOTAL_MEMORY=${MAX_MEMORY_SUMO}" export PREFIX="$(pwd)/libsodium-js-sumo" export DONE_FILE="$(pwd)/js-sumo.done" export DIST='yes' echo "Building a sumo distribution in [${PREFIX}]" elif [ "x$1" = "x--browser-tests" ]; then export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_SUMO" - export LDFLAGS="${LDFLAGS} -s TOTAL_MEMORY=${TOTAL_MEMORY_TESTS}" + export LDFLAGS="${LDFLAGS} -s TOTAL_MEMORY=${MAX_MEMORY_TESTS}" export PREFIX="$(pwd)/libsodium-js-tests" export DONE_FILE="$(pwd)/js-tests-browser.done" export BROWSER_TESTS='yes' @@ -44,7 +44,7 @@ echo "Building for testing" export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_SUMO" export CPPFLAGS="${CPPFLAGS} -DBENCHMARKS -DITERATIONS=10" - export LDFLAGS="${LDFLAGS} -s TOTAL_MEMORY=${TOTAL_MEMORY_TESTS}" + export LDFLAGS="${LDFLAGS} -s TOTAL_MEMORY=${MAX_MEMORY_TESTS}" export PREFIX="$(pwd)/libsodium-js-tests" export DONE_FILE="$(pwd)/js-tests.done" export DIST='no' @@ -99,6 +99,12 @@ Module.ready = new Promise(function(resolve, reject) { var Module = _Module; Module.onAbort = reject; + Module.print = function(what) { + typeof(console) !== 'undefined' && console.log(what); + } + Module.printErr = function(what) { + typeof(console) !== 'undefined' && console.warn(what); + } Module.onRuntimeInitialized = function() { try { /* Test arbitrary wasm function */ diff -Nru libsodium-1.0.17/dist-build/emscripten-symbols.def libsodium-1.0.18/dist-build/emscripten-symbols.def --- libsodium-1.0.17/dist-build/emscripten-symbols.def 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/dist-build/emscripten-symbols.def 2019-05-30 20:13:18.000000000 +0000 @@ -145,12 +145,16 @@ _crypto_box_zerobytes 0 1 _crypto_core_ed25519_add 0 1 _crypto_core_ed25519_bytes 0 1 +_crypto_core_ed25519_from_hash 0 1 _crypto_core_ed25519_from_uniform 0 1 +_crypto_core_ed25519_hashbytes 0 1 _crypto_core_ed25519_is_valid_point 0 1 _crypto_core_ed25519_nonreducedscalarbytes 0 1 +_crypto_core_ed25519_random 0 1 _crypto_core_ed25519_scalar_add 0 1 _crypto_core_ed25519_scalar_complement 0 1 _crypto_core_ed25519_scalar_invert 0 1 +_crypto_core_ed25519_scalar_mul 0 1 _crypto_core_ed25519_scalar_negate 0 1 _crypto_core_ed25519_scalar_random 0 1 _crypto_core_ed25519_scalar_reduce 0 1 @@ -168,6 +172,24 @@ _crypto_core_hsalsa20_inputbytes 0 1 _crypto_core_hsalsa20_keybytes 0 1 _crypto_core_hsalsa20_outputbytes 0 1 +_crypto_core_ristretto255_add 0 1 +_crypto_core_ristretto255_bytes 0 1 +_crypto_core_ristretto255_from_hash 0 1 +_crypto_core_ristretto255_hashbytes 0 1 +_crypto_core_ristretto255_is_valid_point 0 1 +_crypto_core_ristretto255_nonreducedscalarbytes 0 1 +_crypto_core_ristretto255_random 0 1 +_crypto_core_ristretto255_scalar_add 0 1 +_crypto_core_ristretto255_scalar_complement 0 1 +_crypto_core_ristretto255_scalar_invert 0 1 +_crypto_core_ristretto255_scalar_mul 0 1 +_crypto_core_ristretto255_scalar_negate 0 1 +_crypto_core_ristretto255_scalar_random 0 1 +_crypto_core_ristretto255_scalar_reduce 0 1 +_crypto_core_ristretto255_scalar_sub 0 1 +_crypto_core_ristretto255_scalarbytes 0 1 +_crypto_core_ristretto255_sub 0 1 +_crypto_core_ristretto255_uniformbytes 0 1 _crypto_core_salsa20 0 1 _crypto_core_salsa2012 0 1 _crypto_core_salsa2012_constbytes 0 1 @@ -371,6 +393,10 @@ _crypto_scalarmult_ed25519_noclamp 0 1 _crypto_scalarmult_ed25519_scalarbytes 0 1 _crypto_scalarmult_primitive 0 1 +_crypto_scalarmult_ristretto255 0 1 +_crypto_scalarmult_ristretto255_base 0 1 +_crypto_scalarmult_ristretto255_bytes 0 1 +_crypto_scalarmult_ristretto255_scalarbytes 0 1 _crypto_scalarmult_scalarbytes 1 1 _crypto_secretbox 0 1 _crypto_secretbox_boxzerobytes 0 1 diff -Nru libsodium-1.0.17/dist-build/ios.sh libsodium-1.0.18/dist-build/ios.sh --- libsodium-1.0.17/dist-build/ios.sh 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/dist-build/ios.sh 2019-05-30 20:13:18.000000000 +0000 @@ -20,6 +20,12 @@ export IOS_SIMULATOR_VERSION_MIN=${IOS_SIMULATOR_VERSION_MIN-"6.0.0"} export IOS_VERSION_MIN=${IOS_VERSION_MIN-"6.0.0"} +echo +echo "Warnings related to headers being present but not usable are due to functions" +echo "that didn't exist in the specified minimum iOS version level." +echo "They can be safely ignored." +echo + mkdir -p $SIMULATOR32_PREFIX $SIMULATOR64_PREFIX $IOS32_PREFIX $IOS32s_PREFIX $IOS64_PREFIX || exit 1 # Build for the simulator diff -Nru libsodium-1.0.17/dist-build/Makefile.am libsodium-1.0.18/dist-build/Makefile.am --- libsodium-1.0.17/dist-build/Makefile.am 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/dist-build/Makefile.am 2019-05-30 20:13:18.000000000 +0000 @@ -12,7 +12,5 @@ ios.sh \ msys2-win32.sh \ msys2-win64.sh \ - nativeclient-pnacl.sh \ - nativeclient-x86.sh \ - nativeclient-x86_64.sh \ - watchos.sh + watchos.sh \ + wasm32-wasi.sh diff -Nru libsodium-1.0.17/dist-build/nativeclient-pnacl.sh libsodium-1.0.18/dist-build/nativeclient-pnacl.sh --- libsodium-1.0.17/dist-build/nativeclient-pnacl.sh 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/dist-build/nativeclient-pnacl.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -#! /bin/sh - -export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_49"} -export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_pnacl"} -export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"} -export PREFIX="$(pwd)/libsodium-nativeclient" -export PATH="${NACL_BIN}:$PATH" -export AR=${AR-"pnacl-ar"} -export AS=${AS-"pnacl-as"} -export CC=${CC-"pnacl-clang"} -export LD=${LD-"pnacl-ld"} -export NM=${NM-"pnacl-nm"} -export RANLIB=${RANLIB-"pnacl-ranlib"} -export PNACL_FINALIZE=${PNACL_FINALIZE-"pnacl-finalize"} -export PNACL_TRANSLATE=${PNACL_TRANSLATE-"pnacl-translate"} -export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr" - -mkdir -p $PREFIX || exit 1 - -make distclean > /dev/null - -if [ -z "$LIBSODIUM_FULL_BUILD" ]; then - export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal" -else - export LIBSODIUM_ENABLE_MINIMAL_FLAG="" -fi - -./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \ - --host=nacl \ - --disable-ssp --without-pthreads \ - --prefix="$PREFIX" || exit 1 - - -NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null) -PROCESSORS=${NPROCESSORS:-3} - -make -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1 diff -Nru libsodium-1.0.17/dist-build/nativeclient-x86_64.sh libsodium-1.0.18/dist-build/nativeclient-x86_64.sh --- libsodium-1.0.17/dist-build/nativeclient-x86_64.sh 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/dist-build/nativeclient-x86_64.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -#! /bin/sh - -export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_49"} -export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_x86_glibc"} -export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"} -export PREFIX="$(pwd)/libsodium-nativeclient-x86_64" -export PATH="${NACL_BIN}:$PATH" -export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr" - -mkdir -p $PREFIX || exit 1 - -make distclean > /dev/null - -if [ -z "$LIBSODIUM_FULL_BUILD" ]; then - export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal" -else - export LIBSODIUM_ENABLE_MINIMAL_FLAG="" -fi - -./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \ - --host=x86_64-nacl \ - --disable-ssp --without-pthreads \ - --prefix="$PREFIX" || exit 1 - - -NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null) -PROCESSORS=${NPROCESSORS:-3} - -make -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1 diff -Nru libsodium-1.0.17/dist-build/nativeclient-x86.sh libsodium-1.0.18/dist-build/nativeclient-x86.sh --- libsodium-1.0.17/dist-build/nativeclient-x86.sh 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/dist-build/nativeclient-x86.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -#! /bin/sh - -export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_49"} -export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_x86_glibc"} -export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"} -export PREFIX="$(pwd)/libsodium-nativeclient-x86" -export PATH="${NACL_BIN}:$PATH" -export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr" - -mkdir -p $PREFIX || exit 1 - -make distclean > /dev/null - -if [ -z "$LIBSODIUM_FULL_BUILD" ]; then - export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal" -else - export LIBSODIUM_ENABLE_MINIMAL_FLAG="" -fi - - -./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \ - --host=i686-nacl \ - --disable-ssp --without-pthreads \ - --prefix="$PREFIX" || exit 1 - -NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null) -PROCESSORS=${NPROCESSORS:-3} - -make -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1 diff -Nru libsodium-1.0.17/dist-build/wasm32-wasi.sh libsodium-1.0.18/dist-build/wasm32-wasi.sh --- libsodium-1.0.17/dist-build/wasm32-wasi.sh 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/dist-build/wasm32-wasi.sh 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,49 @@ +#! /bin/sh + +if [ -z "$WASI_SYSROOT" ]; then + export WASI_SYSROOT="/opt/wasi-sysroot" +fi + +export PATH="/usr/local/opt/llvm/bin:$PATH" + +export PREFIX="$(pwd)/libsodium-wasm32-wasi" + +mkdir -p $PREFIX || exit 1 + +export CC="clang" +export CFLAGS="-DED25519_NONDETERMINISTIC=1 --target=wasm32-wasi --sysroot=${WASI_SYSROOT} -O2" +export LDFLAGS="-s -Wl,--no-threads" +export NM="llvm-nm" +export AR="llvm-ar" +export RANLIB="llvm-ranlib" +export STRIP="llvm-strip" + +make distclean > /dev/null + +grep -q -F -- 'wasi' build-aux/config.sub || \ + sed -i -e 's/-nacl\*)/-nacl*|-wasi)/' build-aux/config.sub + +if [ "x$1" = "x--bench" ]; then + export BENCHMARKS=1 + export CPPFLAGS="-DBENCHMARKS -DITERATIONS=100" +fi + +if [ -n "$LIBSODIUM_MINIMAL_BUILD" ]; then + export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal" +else + export LIBSODIUM_ENABLE_MINIMAL_FLAG="" +fi + +./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \ + --prefix="$PREFIX" --with-sysroot="$WASI_SYSROOT" \ + --host=wasm32-wasi \ + --disable-ssp --disable-shared || exit 1 + +NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null) +PROCESSORS=${NPROCESSORS:-3} + +if [ -z "$BENCHMARKS" ]; then + make -j${PROCESSORS} check && make install && make distclean > /dev/null +else + make -j${PROCESSORS} && make check +fi diff -Nru libsodium-1.0.17/.gitignore libsodium-1.0.18/.gitignore --- libsodium-1.0.17/.gitignore 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/.gitignore 2019-05-30 20:13:18.000000000 +0000 @@ -58,6 +58,7 @@ libsodium-nativeclient-* libsodium-osx libsodium-uninstalled.pc +libsodium-wasm32-wasi libsodium-win32 libsodium-win64 libsodium.pc @@ -76,7 +77,6 @@ src/libsodium/include/sodium/version.h stamp-* test-driver -test/default/browser test/default/*.asm.js test/default/*.res test/default/*.trs @@ -99,15 +99,17 @@ test/default/box_easy2 test/default/box_seal test/default/box_seed +test/default/browser test/default/chacha20 test/default/codecs -test/default/core_ed25519 test/default/core1 test/default/core2 test/default/core3 test/default/core4 test/default/core5 test/default/core6 +test/default/core_ed25519 +test/default/core_ristretto255 test/default/ed25519_convert test/default/generichash test/default/generichash2 @@ -128,12 +130,13 @@ test/default/pwhash_scrypt_ll test/default/randombytes test/default/scalarmult -test/default/scalarmult_ed25519 test/default/scalarmult2 test/default/scalarmult5 test/default/scalarmult6 test/default/scalarmult7 test/default/scalarmult8 +test/default/scalarmult_ed25519 +test/default/scalarmult_ristretto255 test/default/secretbox test/default/secretbox2 test/default/secretbox7 diff -Nru libsodium-1.0.17/libsodium.pc.in libsodium-1.0.18/libsodium.pc.in --- libsodium-1.0.17/libsodium.pc.in 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/libsodium.pc.in 2019-05-30 20:13:18.000000000 +0000 @@ -8,4 +8,5 @@ Description: A modern and easy-to-use crypto library Libs: -L${libdir} -lsodium +Libs.private: @PKGCONFIG_LIBS_PRIVATE@ Cflags: -I${includedir} diff -Nru libsodium-1.0.17/libsodium-uninstalled.pc.in libsodium-1.0.18/libsodium-uninstalled.pc.in --- libsodium-1.0.17/libsodium-uninstalled.pc.in 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/libsodium-uninstalled.pc.in 2019-05-30 20:13:18.000000000 +0000 @@ -3,4 +3,5 @@ Description: A modern and easy-to-use crypto library Libs: -L${pcfiledir}/src/libsodium -lsodium +Libs.private: @PKGCONFIG_LIBS_PRIVATE@ Cflags: -I${pcfiledir}/src/libsodium/include -I@top_srcdir@/src/libsodium/include -I@top_srcdir@/src/libsodium/include/sodium diff -Nru libsodium-1.0.17/libsodium.vcxproj libsodium-1.0.18/libsodium.vcxproj --- libsodium-1.0.17/libsodium.vcxproj 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/libsodium.vcxproj 2019-05-30 20:13:18.000000000 +0000 @@ -364,6 +364,7 @@ + @@ -376,8 +377,7 @@ - - + @@ -419,6 +419,7 @@ + @@ -438,7 +439,6 @@ - @@ -448,6 +448,7 @@ + @@ -455,6 +456,7 @@ + @@ -465,7 +467,6 @@ - @@ -484,6 +485,7 @@ + diff -Nru libsodium-1.0.17/libsodium.vcxproj.filters libsodium-1.0.18/libsodium.vcxproj.filters --- libsodium-1.0.17/libsodium.vcxproj.filters 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/libsodium.vcxproj.filters 2019-05-30 20:13:18.000000000 +0000 @@ -162,6 +162,9 @@ Source Files + + Source Files + Source Files @@ -198,10 +201,7 @@ Source Files - - Source Files - - + Source Files @@ -327,6 +327,9 @@ Source Files + + Source Files + Source Files @@ -380,9 +383,6 @@ Header Files - - Header Files - Header Files @@ -410,6 +410,9 @@ Header Files + + Header Files + Header Files @@ -431,6 +434,9 @@ Header Files + + Header Files + Header Files @@ -461,9 +467,6 @@ Header Files - - Header Files - Header Files @@ -518,6 +521,9 @@ Header Files + + Header Files + Header Files Binary files /tmp/tmpvegMIq/7snpS6upSF/libsodium-1.0.17/logo.png and /tmp/tmpvegMIq/raElP3SdrR/libsodium-1.0.18/logo.png differ diff -Nru libsodium-1.0.17/msvc-scripts/process.bat libsodium-1.0.18/msvc-scripts/process.bat --- libsodium-1.0.17/msvc-scripts/process.bat 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/msvc-scripts/process.bat 2019-05-30 20:13:18.000000000 +0000 @@ -1,5 +1,5 @@ -cscript msvc-scripts/rep.vbs //Nologo s/@VERSION@/1.0.17/ < src\libsodium\include\sodium\version.h.in > tmp +cscript msvc-scripts/rep.vbs //Nologo s/@VERSION@/1.0.18/ < src\libsodium\include\sodium\version.h.in > tmp cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MAJOR@/10/ < tmp > tmp2 -cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MINOR@/2/ < tmp2 > tmp3 +cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MINOR@/3/ < tmp2 > tmp3 cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_MINIMAL_DEF@// < tmp3 > src\libsodium\include\sodium\version.h del tmp tmp2 tmp3 diff -Nru libsodium-1.0.17/packaging/dotnet-core/prepare.py libsodium-1.0.18/packaging/dotnet-core/prepare.py --- libsodium-1.0.17/packaging/dotnet-core/prepare.py 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/packaging/dotnet-core/prepare.py 2019-05-30 20:13:18.000000000 +0000 @@ -5,240 +5,298 @@ import sys WINDOWS = [ - # --------------------- ----------------- # - # Runtime ID Platform # - # --------------------- ----------------- # - ( 'win-x64', 'x64' ), - ( 'win-x86', 'Win32' ), - # --------------------- ----------------- # + # --------------------- ----------------- # + # Runtime ID Platform # + # --------------------- ----------------- # + ("win-x64", "x64"), + ("win-x86", "Win32"), + # --------------------- ----------------- # ] MACOS = [ - # --------------------- ----------------- # - # Runtime ID Codename # - # --------------------- ----------------- # - ( 'osx-x64', 'sierra' ), - # --------------------- ----------------- # + # --------------------- ----------------- # + # Runtime ID Codename # + # --------------------- ----------------- # + ("osx-x64", "mojave"), + # --------------------- ----------------- # ] LINUX = [ - # --------------------- ----------------- # - # Runtime ID Docker Image # - # --------------------- ----------------- # - ( 'linux-x64', 'debian:stretch' ), - # --------------------- ----------------- # + # --------------------- ----------------- # + # Runtime ID Docker Image # + # --------------------- ----------------- # + ("linux-x64", "debian:stretch"), + # --------------------- ----------------- # ] -EXTRAS = [ 'LICENSE', 'AUTHORS', 'ChangeLog' ] +EXTRAS = ["LICENSE", "AUTHORS", "ChangeLog"] -PROPSFILE = 'libsodium.props' -MAKEFILE = 'Makefile' -BUILDDIR = 'build' -CACHEDIR = 'cache' -TEMPDIR = 'temp' +PROPSFILE = "libsodium.props" +MAKEFILE = "Makefile" +BUILDDIR = "build" +CACHEDIR = "cache" +TEMPDIR = "temp" -PACKAGE = 'libsodium' -LIBRARY = 'libsodium' +PACKAGE = "libsodium" +LIBRARY = "libsodium" + +DOCKER = "sudo docker" -DOCKER = 'sudo docker' class Version: + def __init__(self, libsodium_version, package_version): + self.libsodium_version = libsodium_version + self.package_version = package_version + + self.builddir = os.path.join(BUILDDIR, libsodium_version) + self.tempdir = os.path.join(TEMPDIR, libsodium_version) + self.projfile = os.path.join( + self.builddir, "{0}.{1}.pkgproj".format(PACKAGE, package_version) + ) + self.propsfile = os.path.join(self.builddir, "{0}.props".format(PACKAGE)) + self.pkgfile = os.path.join( + BUILDDIR, "{0}.{1}.nupkg".format(PACKAGE, package_version) + ) - def __init__(self, libsodium_version, package_version): - self.libsodium_version = libsodium_version - self.package_version = package_version - - self.builddir = os.path.join(BUILDDIR, libsodium_version) - self.tempdir = os.path.join(TEMPDIR, libsodium_version) - self.projfile = os.path.join(self.builddir, '{0}.{1}.pkgproj'.format(PACKAGE, package_version)) - self.propsfile = os.path.join(self.builddir, '{0}.props'.format(PACKAGE)) - self.pkgfile = os.path.join(BUILDDIR, '{0}.{1}.nupkg'.format(PACKAGE, package_version)) class WindowsItem: + def __init__(self, version, rid, platform): + self.url = "https://download.libsodium.org/libsodium/releases/libsodium-{0}-stable-msvc.zip".format( + version.libsodium_version + ) + self.cachefile = os.path.join(CACHEDIR, re.sub(r"[^A-Za-z0-9.]", "-", self.url)) + self.packfile = os.path.join( + version.builddir, "runtimes", rid, "native", LIBRARY + ".dll" + ) + self.itemfile = "{0}/Release/v140/dynamic/libsodium.dll".format(platform) + self.tempdir = os.path.join(version.tempdir, rid) + self.tempfile = os.path.join(self.tempdir, os.path.normpath(self.itemfile)) + + def make(self, f): + f.write("\n") + f.write("{0}: {1}\n".format(self.packfile, self.tempfile)) + f.write("\t@mkdir -p $(dir $@)\n") + f.write("\tcp -f $< $@\n") + f.write("\n") + f.write("{0}: {1}\n".format(self.tempfile, self.cachefile)) + f.write("\t@mkdir -p $(dir $@)\n") + f.write( + "\tcd {0} && unzip -q -DD -o {1} '{2}'\n".format( + self.tempdir, + os.path.relpath(self.cachefile, self.tempdir), + self.itemfile, + ) + ) - def __init__(self, version, rid, platform): - self.url = 'https://download.libsodium.org/libsodium/releases/libsodium-{0}-msvc.zip'.format(version.libsodium_version) - self.cachefile = os.path.join(CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url)) - self.packfile = os.path.join(version.builddir, 'runtimes', rid, 'native', LIBRARY + '.dll') - self.itemfile = '{0}/Release/v140/dynamic/libsodium.dll'.format(platform) - self.tempdir = os.path.join(version.tempdir, rid) - self.tempfile = os.path.join(self.tempdir, os.path.normpath(self.itemfile)) - - def make(self, f): - f.write('\n') - f.write('{0}: {1}\n'.format(self.packfile, self.tempfile)) - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\tcp -f $< $@\n') - f.write('\n') - f.write('{0}: {1}\n'.format(self.tempfile, self.cachefile)) - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\tcd {0} && unzip -q -DD -o {1} \'{2}\'\n'.format( - self.tempdir, - os.path.relpath(self.cachefile, self.tempdir), - self.itemfile - )) class MacOSItem: + def __init__(self, version, rid, codename): + self.url = "https://bintray.com/homebrew/bottles/download_file?file_path=libsodium-{0}.{1}.bottle.tar.gz".format( + version.libsodium_version, codename + ) + self.cachefile = os.path.join(CACHEDIR, re.sub(r"[^A-Za-z0-9.]", "-", self.url)) + self.packfile = os.path.join( + version.builddir, "runtimes", rid, "native", LIBRARY + ".dylib" + ) + self.itemfile = "libsodium/{0}/lib/libsodium.dylib".format( + version.libsodium_version + ) + self.tempdir = os.path.join(version.tempdir, rid) + self.tempfile = os.path.join(self.tempdir, os.path.normpath(self.itemfile)) + + def make(self, f): + f.write("\n") + f.write("{0}: {1}\n".format(self.packfile, self.tempfile)) + f.write("\t@mkdir -p $(dir $@)\n") + f.write("\tcp -f $< $@\n") + f.write("\n") + f.write("{0}: {1}\n".format(self.tempfile, self.cachefile)) + f.write("\t@mkdir -p $(dir $@)\n") + f.write( + "\tcd {0} && tar xzmf {1} '{2}'\n".format( + self.tempdir, + os.path.relpath(self.cachefile, self.tempdir), + os.path.dirname(self.itemfile), + ) + ) - def __init__(self, version, rid, codename): - self.url = 'https://bintray.com/homebrew/bottles/download_file?file_path=libsodium-{0}.{1}.bottle.tar.gz'.format(version.libsodium_version, codename) - self.cachefile = os.path.join(CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url)) - self.packfile = os.path.join(version.builddir, 'runtimes', rid, 'native', LIBRARY + '.dylib') - self.itemfile = 'libsodium/{0}/lib/libsodium.dylib'.format(version.libsodium_version) - self.tempdir = os.path.join(version.tempdir, rid) - self.tempfile = os.path.join(self.tempdir, os.path.normpath(self.itemfile)) - - def make(self, f): - f.write('\n') - f.write('{0}: {1}\n'.format(self.packfile, self.tempfile)) - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\tcp -f $< $@\n') - f.write('\n') - f.write('{0}: {1}\n'.format(self.tempfile, self.cachefile)) - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\tcd {0} && tar xzmf {1} \'{2}\'\n'.format( - self.tempdir, - os.path.relpath(self.cachefile, self.tempdir), - os.path.dirname(self.itemfile) - )) class LinuxItem: + def __init__(self, version, rid, docker_image): + self.url = "https://download.libsodium.org/libsodium/releases/libsodium-{0}.tar.gz".format( + version.libsodium_version + ) + self.cachefile = os.path.join(CACHEDIR, re.sub(r"[^A-Za-z0-9.]", "-", self.url)) + self.packfile = os.path.join( + version.builddir, "runtimes", rid, "native", LIBRARY + ".so" + ) + self.tempdir = os.path.join(version.tempdir, rid) + self.tempfile = os.path.join(self.tempdir, "libsodium.so") + self.docker_image = docker_image + self.recipe = rid + + def make(self, f): + recipe = self.recipe + while not os.path.exists(os.path.join("recipes", recipe)): + m = re.fullmatch(r"([^.-]+)((([.][^.-]+)*)[.][^.-]+)?([-].*)?", recipe) + if m.group(5) is None: + recipe = "build" + break + elif m.group(2) is None: + recipe = m.group(1) + else: + recipe = m.group(1) + m.group(3) + m.group(5) + + f.write("\n") + f.write("{0}: {1}\n".format(self.packfile, self.tempfile)) + f.write("\t@mkdir -p $(dir $@)\n") + f.write("\tcp -f $< $@\n") + f.write("\n") + f.write("{0}: {1}\n".format(self.tempfile, self.cachefile)) + f.write("\t@mkdir -p $(dir $@)\n") + f.write( + "\t{0} run --rm ".format(DOCKER) + + "-v $(abspath recipes):/io/recipes " + + "-v $(abspath $<):/io/libsodium.tar.gz " + + "-v $(abspath $(dir $@)):/io/output " + + "{0} sh -x -e /io/recipes/{1}\n".format(self.docker_image, recipe) + ) - def __init__(self, version, rid, docker_image): - self.url = 'https://download.libsodium.org/libsodium/releases/libsodium-{0}.tar.gz'.format(version.libsodium_version) - self.cachefile = os.path.join(CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url)) - self.packfile = os.path.join(version.builddir, 'runtimes', rid, 'native', LIBRARY + '.so') - self.tempdir = os.path.join(version.tempdir, rid) - self.tempfile = os.path.join(self.tempdir, 'libsodium.so') - self.docker_image = docker_image - self.recipe = rid - - def make(self, f): - recipe = self.recipe - while not os.path.exists(os.path.join('recipes', recipe)): - m = re.fullmatch(r'([^.-]+)((([.][^.-]+)*)[.][^.-]+)?([-].*)?', recipe) - if m.group(5) is None: - recipe = 'build' - break - elif m.group(2) is None: - recipe = m.group(1) - else: - recipe = m.group(1) + m.group(3) + m.group(5) - - f.write('\n') - f.write('{0}: {1}\n'.format(self.packfile, self.tempfile)) - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\tcp -f $< $@\n') - f.write('\n') - f.write('{0}: {1}\n'.format(self.tempfile, self.cachefile)) - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\t{0} run --rm '.format(DOCKER) + - '-v $(abspath recipes):/io/recipes ' + - '-v $(abspath $<):/io/libsodium.tar.gz ' + - '-v $(abspath $(dir $@)):/io/output ' + - '{0} sh -x -e /io/recipes/{1}\n'.format(self.docker_image, recipe)) class ExtraItem: + def __init__(self, version, filename): + self.url = "https://download.libsodium.org/libsodium/releases/libsodium-{0}.tar.gz".format( + version.libsodium_version + ) + self.cachefile = os.path.join(CACHEDIR, re.sub(r"[^A-Za-z0-9.]", "-", self.url)) + self.packfile = os.path.join(version.builddir, filename) + self.itemfile = "libsodium-{0}/{1}".format(version.libsodium_version, filename) + self.tempdir = os.path.join(version.tempdir, "extras") + self.tempfile = os.path.join(self.tempdir, os.path.normpath(self.itemfile)) + + def make(self, f): + f.write("\n") + f.write("{0}: {1}\n".format(self.packfile, self.tempfile)) + f.write("\t@mkdir -p $(dir $@)\n") + f.write("\tcp -f $< $@\n") + f.write("\n") + f.write("{0}: {1}\n".format(self.tempfile, self.cachefile)) + f.write("\t@mkdir -p $(dir $@)\n") + f.write( + "\tcd {0} && tar xzmf {1} '{2}'\n".format( + self.tempdir, + os.path.relpath(self.cachefile, self.tempdir), + self.itemfile, + ) + ) - def __init__(self, version, filename): - self.url = 'https://download.libsodium.org/libsodium/releases/libsodium-{0}.tar.gz'.format(version.libsodium_version) - self.cachefile = os.path.join(CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url)) - self.packfile = os.path.join(version.builddir, filename) - self.itemfile = 'libsodium-{0}/{1}'.format(version.libsodium_version, filename) - self.tempdir = os.path.join(version.tempdir, 'extras') - self.tempfile = os.path.join(self.tempdir, os.path.normpath(self.itemfile)) - - def make(self, f): - f.write('\n') - f.write('{0}: {1}\n'.format(self.packfile, self.tempfile)) - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\tcp -f $< $@\n') - f.write('\n') - f.write('{0}: {1}\n'.format(self.tempfile, self.cachefile)) - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\tcd {0} && tar xzmf {1} \'{2}\'\n'.format( - self.tempdir, - os.path.relpath(self.cachefile, self.tempdir), - self.itemfile - )) def main(args): - m = re.fullmatch(r'((\d+\.\d+\.\d+)(\.\d+)?)(?:-(\w+(?:[_.-]\w+)*))?', args[1]) if len(args) == 2 else None + m = ( + re.fullmatch(r"((\d+\.\d+\.\d+)(\.\d+)?)(?:-(\w+(?:[_.-]\w+)*))?", args[1]) + if len(args) == 2 + else None + ) + + if m is None: + print("Usage:") + print(" python3 prepare.py ") + print() + print("Examples:") + print(" python3 prepare.py 1.0.18-preview-01") + print(" python3 prepare.py 1.0.18-preview-02") + print(" python3 prepare.py 1.0.18-preview-03") + print(" python3 prepare.py 1.0.18") + print(" python3 prepare.py 1.0.18.1-preview-01") + print(" python3 prepare.py 1.0.18.1") + print(" python3 prepare.py 1.0.18.2") + return 1 + + version = Version(m.group(2), m.group(0)) + + items = ( + [WindowsItem(version, rid, platform) for (rid, platform) in WINDOWS] + + [MacOSItem(version, rid, codename) for (rid, codename) in MACOS] + + [LinuxItem(version, rid, docker_image) for (rid, docker_image) in LINUX] + + [ExtraItem(version, filename) for filename in EXTRAS] + ) + + downloads = {item.cachefile: item.url for item in items} + + with open(MAKEFILE, "w") as f: + f.write("all: {0}\n".format(version.pkgfile)) + + for download in sorted(downloads): + f.write("\n") + f.write("{0}:\n".format(download)) + f.write("\t@mkdir -p $(dir $@)\n") + f.write("\tcurl -f#Lo $@ '{0}'\n".format(downloads[download])) + + for item in items: + item.make(f) + + f.write("\n") + f.write("{0}: {1}\n".format(version.propsfile, PROPSFILE)) + f.write("\t@mkdir -p $(dir $@)\n") + f.write("\tcp -f $< $@\n") + + f.write("\n") + f.write("{0}: {1}\n".format(version.projfile, version.propsfile)) + f.write("\t@mkdir -p $(dir $@)\n") + f.write( + "\techo '" + + '' + + ''.format( + os.path.relpath(version.propsfile, os.path.dirname(version.projfile)) + ) + + "" + + "{0}".format(version.package_version) + + "" + + "' > $@\n" + ) + + f.write("\n") + f.write("{0}:".format(version.pkgfile)) + f.write(" \\\n\t\t{0}".format(version.projfile)) + f.write(" \\\n\t\t{0}".format(version.propsfile)) + for item in items: + f.write(" \\\n\t\t{0}".format(item.packfile)) + f.write("\n") + f.write("\t@mkdir -p $(dir $@)\n") + f.write( + "\t{0} run --rm ".format(DOCKER) + + "-v $(abspath recipes):/io/recipes " + + "-v $(abspath $(dir $<)):/io/input " + + "-v $(abspath $(dir $@)):/io/output " + + "{0} sh -x -e /io/recipes/{1} {2}\n".format( + "microsoft/dotnet:2.0-sdk", + "pack", + os.path.relpath(version.projfile, version.builddir), + ) + ) + + f.write("\n") + f.write("test: {0}\n".format(version.pkgfile)) + f.write( + "\t{0} run --rm ".format(DOCKER) + + "-v $(abspath recipes):/io/recipes " + + "-v $(abspath $(dir $<)):/io/packages " + + '{0} sh -x -e /io/recipes/{1} "{2}"\n'.format( + "microsoft/dotnet:2.0-sdk", "test", version.package_version + ) + ) + + print( + "prepared", + MAKEFILE, + "to make", + version.pkgfile, + "for libsodium", + version.libsodium_version, + ) + return 0 - if m is None: - print('Usage:') - print(' python3 prepare.py ') - print() - print('Examples:') - print(' python3 prepare.py 1.0.17-preview-01') - print(' python3 prepare.py 1.0.17-preview-02') - print(' python3 prepare.py 1.0.17-preview-03') - print(' python3 prepare.py 1.0.17') - print(' python3 prepare.py 1.0.17.1-preview-01') - print(' python3 prepare.py 1.0.17.1') - print(' python3 prepare.py 1.0.17.2') - return 1 - - version = Version(m.group(2), m.group(0)) - - items = [ WindowsItem(version, rid, platform) for (rid, platform) in WINDOWS ] + \ - [ MacOSItem(version, rid, codename) for (rid, codename) in MACOS ] + \ - [ LinuxItem(version, rid, docker_image) for (rid, docker_image) in LINUX ] + \ - [ ExtraItem(version, filename) for filename in EXTRAS ] - - downloads = {item.cachefile: item.url for item in items} - - with open(MAKEFILE, 'w') as f: - f.write('all: {0}\n'.format(version.pkgfile)) - - for download in sorted(downloads): - f.write('\n') - f.write('{0}:\n'.format(download)) - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\tcurl -f#Lo $@ \'{0}\'\n'.format(downloads[download])) - - for item in items: - item.make(f) - - f.write('\n') - f.write('{0}: {1}\n'.format(version.propsfile, PROPSFILE)) - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\tcp -f $< $@\n') - - f.write('\n') - f.write('{0}: {1}\n'.format(version.projfile, version.propsfile)) - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\techo \'' + - '' + - ''.format(os.path.relpath(version.propsfile, os.path.dirname(version.projfile))) + - '' + - '{0}'.format(version.package_version) + - '' + - '\' > $@\n') - - f.write('\n') - f.write('{0}:'.format(version.pkgfile)) - f.write(' \\\n\t\t{0}'.format(version.projfile)) - f.write(' \\\n\t\t{0}'.format(version.propsfile)) - for item in items: - f.write(' \\\n\t\t{0}'.format(item.packfile)) - f.write('\n') - f.write('\t@mkdir -p $(dir $@)\n') - f.write('\t{0} run --rm '.format(DOCKER) + - '-v $(abspath recipes):/io/recipes ' + - '-v $(abspath $(dir $<)):/io/input ' + - '-v $(abspath $(dir $@)):/io/output ' + - '{0} sh -x -e /io/recipes/{1} {2}\n'.format('microsoft/dotnet:2.0-sdk', 'pack', os.path.relpath(version.projfile, version.builddir))) - - f.write('\n') - f.write('test: {0}\n'.format(version.pkgfile)) - f.write('\t{0} run --rm '.format(DOCKER) + - '-v $(abspath recipes):/io/recipes ' + - '-v $(abspath $(dir $<)):/io/packages ' + - '{0} sh -x -e /io/recipes/{1} "{2}"\n'.format('microsoft/dotnet:2.0-sdk', 'test', version.package_version)) - print('prepared', MAKEFILE, 'to make', version.pkgfile, 'for libsodium', version.libsodium_version) - return 0 +if __name__ == "__main__": + sys.exit(main(sys.argv)) -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff -Nru libsodium-1.0.17/packaging/dotnet-core/README.md libsodium-1.0.18/packaging/dotnet-core/README.md --- libsodium-1.0.17/packaging/dotnet-core/README.md 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/packaging/dotnet-core/README.md 2019-05-30 20:13:18.000000000 +0000 @@ -31,15 +31,15 @@ It may be necessary to release more than one package for a libsodium version, e.g., when adding support for a new platform or if a release contains a broken binary. In this case, a package revision number is added as a fourth part to - the libsodium version, starting at `1`. For example, `1.0.17` is the initial - release of the package for libsodium 1.0.17 and `1.0.17.5` is the fifth + the libsodium version, starting at `1`. For example, `1.0.18` is the initial + release of the package for libsodium 1.0.18 and `1.0.18.5` is the fifth revision (sixth release) of that package. * *pre-release label* If a package is a pre-release, a label is appended to the version number in `-preview-##` format where `##` is the number of the pre-release, starting at - `01`. For example, `1.0.17-preview-01` is the first pre-release of the package - for libsodium 1.0.17 and `1.0.17.5-preview-02` the second pre-release of the - fifth revision of the package for libsodium 1.0.17. + `01`. For example, `1.0.18-preview-01` is the first pre-release of the package + for libsodium 1.0.18 and `1.0.18.5-preview-02` the second pre-release of the + fifth revision of the package for libsodium 1.0.18. **Making a release** diff -Nru libsodium-1.0.17/packaging/nuget/package.config libsodium-1.0.18/packaging/nuget/package.config --- libsodium-1.0.17/packaging/nuget/package.config 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/packaging/nuget/package.config 2019-05-30 20:13:18.000000000 +0000 @@ -1,4 +1,4 @@ - + diff -Nru libsodium-1.0.17/README.markdown libsodium-1.0.18/README.markdown --- libsodium-1.0.17/README.markdown 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/README.markdown 2019-05-30 20:13:18.000000000 +0000 @@ -1,6 +1,7 @@ [![Build Status](https://travis-ci.org/jedisct1/libsodium.svg?branch=master)](https://travis-ci.org/jedisct1/libsodium?branch=master) [![Windows build status](https://ci.appveyor.com/api/projects/status/fu8s2elx25il98hj?svg=true)](https://ci.appveyor.com/project/jedisct1/libsodium) [![Coverity Scan Build Status](https://scan.coverity.com/projects/2397/badge.svg)](https://scan.coverity.com/projects/2397) +[![Azure build status](https://jedisct1.visualstudio.com/Libsodium/_apis/build/status/jedisct1.libsodium?branchName=stable)](https://jedisct1.visualstudio.com/Libsodium/_build/latest?definitionId=3&branchName=stable) ![libsodium](https://raw.github.com/jedisct1/libsodium/master/logo.png) ============ diff -Nru libsodium-1.0.17/regen-msvc/regen-msvc.py libsodium-1.0.18/regen-msvc/regen-msvc.py --- libsodium-1.0.17/regen-msvc/regen-msvc.py 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/regen-msvc/regen-msvc.py 2019-05-30 20:13:18.000000000 +0000 @@ -9,49 +9,47 @@ tlv1 = "" for file in glob.iglob("src/libsodium/**/*.c", recursive=True): file = file.replace("/", "\\") - tlv1 = tlv1 + " \r\n".format(file) + tlv1 = tlv1 + ' \r\n'.format(file) tlv2 = "" for file in glob.iglob("src/libsodium/**/*.h", recursive=True): file = file.replace("/", "\\") - tlv2 = tlv2 + " \r\n".format(file) + tlv2 = tlv2 + ' \r\n'.format(file) tlf1 = "" for file in glob.iglob("src/libsodium/**/*.c", recursive=True): file = file.replace("/", "\\") - tlf1 = tlf1 + " \r\n".format(file) + tlf1 = tlf1 + ' \r\n'.format(file) tlf1 = tlf1 + " Source Files\r\n" tlf1 = tlf1 + " \r\n" tlf2 = "" for file in glob.iglob("src/libsodium/**/*.h", recursive=True): file = file.replace("/", "\\") - tlf2 = tlf2 + " \r\n".format(file) + tlf2 = tlf2 + ' \r\n'.format(file) tlf2 = tlf2 + " Header Files\r\n" tlf2 = tlf2 + " \r\n" v1 = "" for file in glob.iglob("src/libsodium/**/*.c", recursive=True): file = file.replace("/", "\\") - v1 = v1 + \ - " \r\n".format(file) + v1 = v1 + ' \r\n'.format(file) v2 = "" for file in glob.iglob("src/libsodium/**/*.h", recursive=True): file = file.replace("/", "\\") - v2 = v2 + \ - " \r\n".format(file) + v2 = v2 + ' \r\n'.format(file) f1 = "" for file in glob.iglob("src/libsodium/**/*.c", recursive=True): basedir = os.path.dirname(file).replace("src/libsodium/", "") t = basedir - while t != '': + while t != "": dirs.add(t) t = os.path.dirname(t) basedir = basedir.replace("/", "\\") file = file.replace("/", "\\") - f1 = f1 + " \r\n".format(file) + f1 = f1 + ' \r\n'.format(file) f1 = f1 + " {}\r\n".format(basedir) f1 = f1 + " \r\n" @@ -59,12 +57,12 @@ for file in glob.iglob("src/libsodium/**/*.h", recursive=True): basedir = os.path.dirname(file).replace("src/libsodium/", "") t = basedir - while t != '': + while t != "": dirs.add(t) t = os.path.dirname(t) basedir = basedir.replace("/", "\\") file = file.replace("/", "\\") - f2 = f2 + " \r\n".format(file) + f2 = f2 + ' \r\n'.format(file) f2 = f2 + " {}\r\n".format(basedir) f2 = f2 + " \r\n" @@ -73,63 +71,115 @@ dirs.sort() for dir in dirs: dir = dir.replace("/", "\\") - uid = uuid.uuid3(uuid.UUID(bytes=b'LibSodiumMSVCUID'), dir) - fd = fd + " \r\n".format(dir) - fd = fd + \ - " {{{}}}\r\n".format(uid) + uid = uuid.uuid3(uuid.UUID(bytes=b"LibSodiumMSVCUID"), dir) + fd = fd + ' \r\n'.format(dir) + fd = fd + " {{{}}}\r\n".format(uid) fd = fd + " \r\n" def apply_template(tplfile, outfile, sbox): tpl = "" - with open(tplfile, 'rb') as fd: + with open(tplfile, "rb") as fd: tpl = fd.read() for s in sbox.keys(): - tpl = tpl.replace(str.encode( - "{{" + s + "}}", "utf8"), str.encode(str.strip(sbox[s]), "utf8")) + tpl = tpl.replace( + str.encode("{{" + s + "}}", "utf8"), str.encode(str.strip(sbox[s]), "utf8") + ) - with open(outfile, 'wb') as fd: + with open(outfile, "wb") as fd: fd.write(tpl) -sbox = {"tlv1": tlv1, "tlv2": tlv2, "tlf1": tlf1, "tlf2": tlf2, "v1": v1, - "v2": v2, "f1": f1, "f2": f2, "fd": fd} + +sbox = { + "tlv1": tlv1, + "tlv2": tlv2, + "tlf1": tlf1, + "tlf2": tlf2, + "v1": v1, + "v2": v2, + "f1": f1, + "f2": f2, + "fd": fd, +} sd = os.path.dirname(os.path.realpath(__file__)) -apply_template(sd + "/tl_libsodium.vcxproj.filters.tpl", - "libsodium.vcxproj.filters", sbox) +apply_template( + sd + "/tl_libsodium.vcxproj.filters.tpl", "libsodium.vcxproj.filters", sbox +) sbox.update({"platform": "v140"}) -apply_template(sd + "/tl_libsodium.vcxproj.tpl", - "libsodium.vcxproj", sbox) +apply_template(sd + "/tl_libsodium.vcxproj.tpl", "libsodium.vcxproj", sbox) -apply_template(sd + "/libsodium.vcxproj.filters.tpl", - "builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters", sbox) -apply_template(sd + "/libsodium.vcxproj.filters.tpl", - "builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters", sbox) -apply_template(sd + "/libsodium.vcxproj.filters.tpl", - "builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters", sbox) -apply_template(sd + "/libsodium.vcxproj.filters.tpl", - "builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters", sbox) -apply_template(sd + "/libsodium.vcxproj.filters.tpl", - "builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters", sbox) +apply_template( + sd + "/libsodium.vcxproj.filters.tpl", + "builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters", + sbox, +) +apply_template( + sd + "/libsodium.vcxproj.filters.tpl", + "builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters", + sbox, +) +apply_template( + sd + "/libsodium.vcxproj.filters.tpl", + "builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters", + sbox, +) +apply_template( + sd + "/libsodium.vcxproj.filters.tpl", + "builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters", + sbox, +) +apply_template( + sd + "/libsodium.vcxproj.filters.tpl", + "builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters", + sbox, +) +apply_template( + sd + "/libsodium.vcxproj.filters.tpl", + "builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters", + sbox, +) + +sbox.update({"platform": "v142"}) +apply_template( + sd + "/libsodium.vcxproj.tpl", + "builds/msvc/vs2019/libsodium/libsodium.vcxproj", + sbox, +) sbox.update({"platform": "v141"}) -apply_template(sd + "/libsodium.vcxproj.tpl", - "builds/msvc/vs2017/libsodium/libsodium.vcxproj", sbox) +apply_template( + sd + "/libsodium.vcxproj.tpl", + "builds/msvc/vs2017/libsodium/libsodium.vcxproj", + sbox, +) sbox.update({"platform": "v140"}) -apply_template(sd + "/libsodium.vcxproj.tpl", - "builds/msvc/vs2015/libsodium/libsodium.vcxproj", sbox) +apply_template( + sd + "/libsodium.vcxproj.tpl", + "builds/msvc/vs2015/libsodium/libsodium.vcxproj", + sbox, +) sbox.update({"platform": "v120"}) -apply_template(sd + "/libsodium.vcxproj.tpl", - "builds/msvc/vs2013/libsodium/libsodium.vcxproj", sbox) +apply_template( + sd + "/libsodium.vcxproj.tpl", + "builds/msvc/vs2013/libsodium/libsodium.vcxproj", + sbox, +) sbox.update({"platform": "v110"}) -apply_template(sd + "/libsodium.vcxproj.tpl", - "builds/msvc/vs2012/libsodium/libsodium.vcxproj", sbox) +apply_template( + sd + "/libsodium.vcxproj.tpl", + "builds/msvc/vs2012/libsodium/libsodium.vcxproj", + sbox, +) sbox.update({"platform": "v100"}) -apply_template(sd + "/libsodium.vcxproj.tpl", - "builds/msvc/vs2010/libsodium/libsodium.vcxproj", sbox) +apply_template( + sd + "/libsodium.vcxproj.tpl", + "builds/msvc/vs2010/libsodium/libsodium.vcxproj", + sbox, +) diff -Nru libsodium-1.0.17/src/libsodium/crypto_core/ed25519/core_ed25519.c libsodium-1.0.18/src/libsodium/crypto_core/ed25519/core_ed25519.c --- libsodium-1.0.17/src/libsodium/crypto_core/ed25519/core_ed25519.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_core/ed25519/core_ed25519.c 2019-05-30 20:13:18.000000000 +0000 @@ -67,7 +67,24 @@ { ge25519_from_uniform(p, r); - return - ge25519_has_small_order(p); + return 0; +} + +int +crypto_core_ed25519_from_hash(unsigned char *p, const unsigned char *h) +{ + ge25519_from_hash(p, h); + + return 0; +} + +void +crypto_core_ed25519_random(unsigned char *p) +{ + unsigned char h[crypto_core_ed25519_HASHBYTES]; + + randombytes_buf(h, sizeof h); + (void) crypto_core_ed25519_from_hash(p, h); } void @@ -159,6 +176,13 @@ } void +crypto_core_ed25519_scalar_mul(unsigned char *z, const unsigned char *x, + const unsigned char *y) +{ + sc25519_mul(z, x, y); +} + +void crypto_core_ed25519_scalar_reduce(unsigned char *r, const unsigned char *s) { @@ -189,6 +213,12 @@ } size_t +crypto_core_ed25519_hashbytes(void) +{ + return crypto_core_ed25519_HASHBYTES; +} + +size_t crypto_core_ed25519_scalarbytes(void) { return crypto_core_ed25519_SCALARBYTES; diff -Nru libsodium-1.0.17/src/libsodium/crypto_core/ed25519/core_ristretto255.c libsodium-1.0.18/src/libsodium/crypto_core/ed25519/core_ristretto255.c --- libsodium-1.0.17/src/libsodium/crypto_core/ed25519/core_ristretto255.c 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_core/ed25519/core_ristretto255.c 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,156 @@ + +#include + +#include "crypto_core_ed25519.h" +#include "crypto_core_ristretto255.h" +#include "private/common.h" +#include "private/ed25519_ref10.h" +#include "randombytes.h" +#include "utils.h" + +int +crypto_core_ristretto255_is_valid_point(const unsigned char *p) +{ + ge25519_p3 p_p3; + + if (ristretto255_frombytes(&p_p3, p) != 0) { + return 0; + } + return 1; +} + +int +crypto_core_ristretto255_add(unsigned char *r, + const unsigned char *p, const unsigned char *q) +{ + ge25519_p3 p_p3, q_p3, r_p3; + ge25519_p1p1 r_p1p1; + ge25519_cached q_cached; + + if (ristretto255_frombytes(&p_p3, p) != 0 || + ristretto255_frombytes(&q_p3, q) != 0) { + return -1; + } + ge25519_p3_to_cached(&q_cached, &q_p3); + ge25519_add(&r_p1p1, &p_p3, &q_cached); + ge25519_p1p1_to_p3(&r_p3, &r_p1p1); + ristretto255_p3_tobytes(r, &r_p3); + + return 0; +} + +int +crypto_core_ristretto255_sub(unsigned char *r, + const unsigned char *p, const unsigned char *q) +{ + ge25519_p3 p_p3, q_p3, r_p3; + ge25519_p1p1 r_p1p1; + ge25519_cached q_cached; + + if (ristretto255_frombytes(&p_p3, p) != 0 || + ristretto255_frombytes(&q_p3, q) != 0) { + return -1; + } + ge25519_p3_to_cached(&q_cached, &q_p3); + ge25519_sub(&r_p1p1, &p_p3, &q_cached); + ge25519_p1p1_to_p3(&r_p3, &r_p1p1); + ristretto255_p3_tobytes(r, &r_p3); + + return 0; +} + +int +crypto_core_ristretto255_from_hash(unsigned char *p, const unsigned char *r) +{ + ristretto255_from_hash(p, r); + + return 0; +} + +void +crypto_core_ristretto255_random(unsigned char *p) +{ + unsigned char h[crypto_core_ristretto255_HASHBYTES]; + + randombytes_buf(h, sizeof h); + (void) crypto_core_ristretto255_from_hash(p, h); +} + +void +crypto_core_ristretto255_scalar_random(unsigned char *r) +{ + crypto_core_ed25519_scalar_random(r); +} + +int +crypto_core_ristretto255_scalar_invert(unsigned char *recip, + const unsigned char *s) +{ + return crypto_core_ed25519_scalar_invert(recip, s); +} + +void +crypto_core_ristretto255_scalar_negate(unsigned char *neg, + const unsigned char *s) +{ + crypto_core_ed25519_scalar_negate(neg, s); +} + +void +crypto_core_ristretto255_scalar_complement(unsigned char *comp, + const unsigned char *s) +{ + crypto_core_ed25519_scalar_complement(comp, s); +} + +void +crypto_core_ristretto255_scalar_add(unsigned char *z, const unsigned char *x, + const unsigned char *y) +{ + crypto_core_ed25519_scalar_add(z, x, y); +} + +void +crypto_core_ristretto255_scalar_sub(unsigned char *z, const unsigned char *x, + const unsigned char *y) +{ + crypto_core_ed25519_scalar_sub(z, x, y); +} + +void +crypto_core_ristretto255_scalar_mul(unsigned char *z, const unsigned char *x, + const unsigned char *y) +{ + sc25519_mul(z, x, y); +} + +void +crypto_core_ristretto255_scalar_reduce(unsigned char *r, + const unsigned char *s) +{ + crypto_core_ed25519_scalar_reduce(r, s); +} + +size_t +crypto_core_ristretto255_bytes(void) +{ + return crypto_core_ristretto255_BYTES; +} + +size_t +crypto_core_ristretto255_nonreducedscalarbytes(void) +{ + return crypto_core_ristretto255_NONREDUCEDSCALARBYTES; +} + +size_t +crypto_core_ristretto255_hashbytes(void) +{ + return crypto_core_ristretto255_HASHBYTES; +} + +size_t +crypto_core_ristretto255_scalarbytes(void) +{ + return crypto_core_ristretto255_SCALARBYTES; +} diff -Nru libsodium-1.0.17/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c libsodium-1.0.18/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c --- libsodium-1.0.17/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c 2019-05-30 20:13:18.000000000 +0000 @@ -163,6 +163,22 @@ fe25519_mul(out, t0, z); } +static inline void +fe25519_cneg(fe25519 h, const fe25519 f, unsigned int b) +{ + fe25519 negf; + + fe25519_neg(negf, f); + fe25519_copy(h, f); + fe25519_cmov(h, negf, b); +} + +static inline void +fe25519_abs(fe25519 h, const fe25519 f) +{ + fe25519_cneg(h, f, fe25519_isnegative(f)); +} + /* r = p + q */ @@ -513,7 +529,7 @@ unsigned char ub = b; unsigned char uc = c; unsigned char x = ub ^ uc; /* 0: yes; 1..255: no */ - uint32_t y = x; /* 0: yes; 1..255: no */ + uint32_t y = (uint32_t) x; /* 0: yes; 1..255: no */ y -= 1; /* 4294967295: yes; 0..254: no */ y >>= 31; /* 1: yes; 0: no */ @@ -550,7 +566,7 @@ } static void -ge25519_select(ge25519_precomp *t, const ge25519_precomp precomp[8], const signed char b) +ge25519_cmov8(ge25519_precomp *t, const ge25519_precomp precomp[8], const signed char b) { ge25519_precomp minust; const unsigned char bnegative = negative(b); @@ -572,7 +588,7 @@ } static void -ge25519_select_base(ge25519_precomp *t, const int pos, const signed char b) +ge25519_cmov8_base(ge25519_precomp *t, const int pos, const signed char b) { static const ge25519_precomp base[32][8] = { /* base[i][j] = (j+1)*256^i*B */ #ifdef HAVE_TI_MODE @@ -581,11 +597,11 @@ # include "fe_25_5/base.h" #endif }; - ge25519_select(t, base[pos], b); + ge25519_cmov8(t, base[pos], b); } static void -ge25519_select_cached(ge25519_cached *t, const ge25519_cached cached[8], const signed char b) +ge25519_cmov8_cached(ge25519_cached *t, const ge25519_cached cached[8], const signed char b) { ge25519_cached minust; const unsigned char bnegative = negative(b); @@ -811,7 +827,7 @@ ge25519_p3_0(h); for (i = 63; i != 0; i--) { - ge25519_select_cached(&t, pi, e[i]); + ge25519_cmov8_cached(&t, pi, e[i]); ge25519_add(&r, h, &t); ge25519_p1p1_to_p2(&s, &r); @@ -825,7 +841,7 @@ ge25519_p1p1_to_p3(h, &r); /* *16 */ } - ge25519_select_cached(&t, pi, e[i]); + ge25519_cmov8_cached(&t, pi, e[i]); ge25519_add(&r, h, &t); ge25519_p1p1_to_p3(h, &r); @@ -871,7 +887,7 @@ ge25519_p3_0(h); for (i = 1; i < 64; i += 2) { - ge25519_select_base(&t, i / 2, e[i]); + ge25519_cmov8_base(&t, i / 2, e[i]); ge25519_madd(&r, h, &t); ge25519_p1p1_to_p3(h, &r); } @@ -886,7 +902,7 @@ ge25519_p1p1_to_p3(h, &r); for (i = 0; i < 64; i += 2) { - ge25519_select_base(&t, i / 2, e[i]); + ge25519_cmov8_base(&t, i / 2, e[i]); ge25519_madd(&r, h, &t); ge25519_p1p1_to_p3(h, &r); } @@ -1065,7 +1081,7 @@ where l = 2^252 + 27742317777372353535851937790883648493. */ -static void +void sc25519_mul(unsigned char s[32], const unsigned char a[32], const unsigned char b[32]) { int64_t a0 = 2097151 & load_3(a); @@ -2509,27 +2525,19 @@ fe25519_mul(out, t1, t0); } -void -ge25519_from_uniform(unsigned char s[32], const unsigned char r[32]) +static void +ge25519_elligator2(unsigned char s[32], const fe25519 r, const unsigned char x_sign) { - fe25519 e; - fe25519 negx; - fe25519 rr2; - fe25519 x, x2, x3; - ge25519_p3 p3; - ge25519_p1p1 p1; - ge25519_p2 p2; - unsigned int e_is_minus_1; - unsigned char x_sign; + fe25519 e; + fe25519 negx; + fe25519 rr2; + fe25519 x, x2, x3; + ge25519_p3 p3; + ge25519_p1p1 p1; + ge25519_p2 p2; + unsigned int e_is_minus_1; - memcpy(s, r, 32); - x_sign = s[31] & 0x80; - s[31] &= 0x7f; - - fe25519_frombytes(rr2, s); - - /* elligator */ - fe25519_sq2(rr2, rr2); + fe25519_sq2(rr2, r); rr2[0]++; fe25519_invert(rr2, rr2); fe25519_mul(x, curve25519_A, rr2); @@ -2583,3 +2591,276 @@ ge25519_p3_tobytes(s, &p3); } + +void +ge25519_from_uniform(unsigned char s[32], const unsigned char r[32]) +{ + fe25519 r_fe; + unsigned char x_sign; + + memcpy(s, r, 32); + x_sign = s[31] & 0x80; + s[31] &= 0x7f; + fe25519_frombytes(r_fe, s); + ge25519_elligator2(s, r_fe, x_sign); +} + +void +ge25519_from_hash(unsigned char s[32], const unsigned char h[64]) +{ + unsigned char fl[32]; + unsigned char gl[32]; + fe25519 fe_f; + fe25519 fe_g; + size_t i; + unsigned char x_sign; + + x_sign = h[0] & 0x80; + for (i = 0; i < 32; i++) { + fl[i] = h[63 - i]; + gl[i] = h[31 - i]; + } + fl[31] &= 0x7f; + gl[31] &= 0x7f; + fe25519_frombytes(fe_f, fl); + fe25519_frombytes(fe_g, gl); + fe_f[0] += (h[32] >> 7) * 19; + for (i = 0; i < sizeof (fe25519) / sizeof fe_f[0]; i++) { + fe_f[i] += 38 * fe_g[i]; + } + fe25519_reduce(fe_f, fe_f); + ge25519_elligator2(s, fe_f, x_sign); +} + +/* Ristretto group */ + +static int +ristretto255_sqrt_ratio_m1(fe25519 x, const fe25519 u, const fe25519 v) +{ + fe25519 v3; + fe25519 vxx; + fe25519 m_root_check, p_root_check, f_root_check; + fe25519 x_sqrtm1; + int has_m_root, has_p_root, has_f_root; + + fe25519_sq(v3, v); + fe25519_mul(v3, v3, v); /* v3 = v^3 */ + fe25519_sq(x, v3); + fe25519_mul(x, x, v); + fe25519_mul(x, x, u); /* x = uv^7 */ + + fe25519_pow22523(x, x); /* x = (uv^7)^((q-5)/8) */ + fe25519_mul(x, x, v3); + fe25519_mul(x, x, u); /* x = uv^3(uv^7)^((q-5)/8) */ + + fe25519_sq(vxx, x); + fe25519_mul(vxx, vxx, v); /* vx^2 */ + fe25519_sub(m_root_check, vxx, u); /* vx^2-u */ + fe25519_add(p_root_check, vxx, u); /* vx^2+u */ + fe25519_mul(f_root_check, u, sqrtm1); /* u*sqrt(-1) */ + fe25519_add(f_root_check, vxx, f_root_check); /* vx^2+u*sqrt(-1) */ + has_m_root = fe25519_iszero(m_root_check); + has_p_root = fe25519_iszero(p_root_check); + has_f_root = fe25519_iszero(f_root_check); + fe25519_mul(x_sqrtm1, x, sqrtm1); /* x*sqrt(-1) */ + + fe25519_cmov(x, x_sqrtm1, has_p_root | has_f_root); + fe25519_abs(x, x); + + return has_m_root | has_p_root; +} + +static int +ristretto255_is_canonical(const unsigned char *s) +{ + unsigned char c; + unsigned char d; + unsigned int i; + + c = (s[31] & 0x7f) ^ 0x7f; + for (i = 30; i > 0; i--) { + c |= s[i] ^ 0xff; + } + c = (((unsigned int) c) - 1U) >> 8; + d = (0xed - 1U - (unsigned int) s[0]) >> 8; + + return 1 - (((c & d) | s[0]) & 1); +} + +int +ristretto255_frombytes(ge25519_p3 *h, const unsigned char *s) +{ + fe25519 inv_sqrt; + fe25519 one; + fe25519 s_; + fe25519 ss; + fe25519 u1, u2; + fe25519 u1u1, u2u2; + fe25519 v; + fe25519 v_u2u2; + int was_square; + + if (ristretto255_is_canonical(s) == 0) { + return -1; + } + fe25519_frombytes(s_, s); + fe25519_sq(ss, s_); /* ss = s^2 */ + + fe25519_1(u1); + fe25519_sub(u1, u1, ss); /* u1 = 1-ss */ + fe25519_sq(u1u1, u1); /* u1u1 = u1^2 */ + + fe25519_1(u2); + fe25519_add(u2, u2, ss); /* u2 = 1+ss */ + fe25519_sq(u2u2, u2); /* u2u2 = u2^2 */ + + fe25519_mul(v, d, u1u1); /* v = d*u1^2 */ + fe25519_neg(v, v); /* v = -d*u1^2 */ + fe25519_sub(v, v, u2u2); /* v = -(d*u1^2)-u2^2 */ + + fe25519_mul(v_u2u2, v, u2u2); /* v_u2u2 = v*u2^2 */ + + fe25519_1(one); + was_square = ristretto255_sqrt_ratio_m1(inv_sqrt, one, v_u2u2); + fe25519_mul(h->X, inv_sqrt, u2); + fe25519_mul(h->Y, inv_sqrt, h->X); + fe25519_mul(h->Y, h->Y, v); + + fe25519_mul(h->X, h->X, s_); + fe25519_add(h->X, h->X, h->X); + fe25519_abs(h->X, h->X); + fe25519_mul(h->Y, u1, h->Y); + fe25519_1(h->Z); + fe25519_mul(h->T, h->X, h->Y); + + return - ((1 - was_square) | + fe25519_isnegative(h->T) | fe25519_iszero(h->Y)); +} + +void +ristretto255_p3_tobytes(unsigned char *s, const ge25519_p3 *h) +{ + fe25519 den1, den2; + fe25519 den_inv; + fe25519 eden; + fe25519 inv_sqrt; + fe25519 ix, iy; + fe25519 one; + fe25519 s_; + fe25519 t_z_inv; + fe25519 u1, u2; + fe25519 u1_u2u2; + fe25519 x_, y_; + fe25519 x_z_inv; + fe25519 z_inv; + fe25519 zmy; + int rotate; + + fe25519_add(u1, h->Z, h->Y); /* u1 = Z+Y */ + fe25519_sub(zmy, h->Z, h->Y); /* zmy = Z-Y */ + fe25519_mul(u1, u1, zmy); /* u1 = (Z+Y)*(Z-Y) */ + fe25519_mul(u2, h->X, h->Y); /* u2 = X*Y */ + + fe25519_sq(u1_u2u2, u2); /* u1_u2u2 = u2^2 */ + fe25519_mul(u1_u2u2, u1, u1_u2u2); /* u1_u2u2 = u1*u2^2 */ + + fe25519_1(one); + (void) ristretto255_sqrt_ratio_m1(inv_sqrt, one, u1_u2u2); + fe25519_mul(den1, inv_sqrt, u1); /* den1 = inv_sqrt*u1 */ + fe25519_mul(den2, inv_sqrt, u2); /* den2 = inv_sqrt*u2 */ + fe25519_mul(z_inv, den1, den2); /* z_inv = den1*den2 */ + fe25519_mul(z_inv, z_inv, h->T); /* z_inv = den1*den2*T */ + + fe25519_mul(ix, h->X, sqrtm1); /* ix = X*sqrt(-1) */ + fe25519_mul(iy, h->Y, sqrtm1); /* iy = Y*sqrt(-1) */ + fe25519_mul(eden, den1, invsqrtamd); /* eden = den1*sqrt(a-d) */ + + fe25519_mul(t_z_inv, h->T, z_inv); /* t_z_inv = T*z_inv */ + rotate = fe25519_isnegative(t_z_inv); + + fe25519_copy(x_, h->X); + fe25519_copy(y_, h->Y); + fe25519_copy(den_inv, den2); + + fe25519_cmov(x_, iy, rotate); + fe25519_cmov(y_, ix, rotate); + fe25519_cmov(den_inv, eden, rotate); + + fe25519_mul(x_z_inv, x_, z_inv); + fe25519_cneg(y_, y_, fe25519_isnegative(x_z_inv)); + + fe25519_sub(s_, h->Z, y_); + fe25519_mul(s_, den_inv, s_); + fe25519_abs(s_, s_); + fe25519_tobytes(s, s_); +} + +static void +ristretto255_elligator(ge25519_p3 *p, const fe25519 t) +{ + fe25519 c; + fe25519 n; + fe25519 one; + fe25519 r; + fe25519 rpd; + fe25519 s, s_prime; + fe25519 ss; + fe25519 u, v; + fe25519 w0, w1, w2, w3; + int wasnt_square; + + fe25519_1(one); + fe25519_sq(r, t); /* r = t^2 */ + fe25519_mul(r, sqrtm1, r); /* r = sqrt(-1)*t^2 */ + fe25519_add(u, r, one); /* u = r+1 */ + fe25519_mul(u, u, onemsqd); /* u = (r+1)*(1-d^2) */ + fe25519_1(c); + fe25519_neg(c, c); /* c = -1 */ + fe25519_add(rpd, r, d); /* rpd = r*d */ + fe25519_mul(v, r, d); /* v = r*d */ + fe25519_sub(v, c, v); /* v = c-r*d */ + fe25519_mul(v, v, rpd); /* v = (c-r*d)*(r+d) */ + + wasnt_square = 1 - ristretto255_sqrt_ratio_m1(s, u, v); + fe25519_mul(s_prime, s, t); + fe25519_abs(s_prime, s_prime); + fe25519_neg(s_prime, s_prime); /* s_prime = -|s*t| */ + fe25519_cmov(s, s_prime, wasnt_square); + fe25519_cmov(c, r, wasnt_square); + + fe25519_sub(n, r, one); /* n = r-1 */ + fe25519_mul(n, n, c); /* n = c*(r-1) */ + fe25519_mul(n, n, sqdmone); /* n = c*(r-1)*(d-1)^2 */ + fe25519_sub(n, n, v); /* n = c*(r-1)*(d-1)^2-v */ + + fe25519_add(w0, s, s); /* w0 = 2s */ + fe25519_mul(w0, w0, v); /* w0 = 2s*v */ + fe25519_mul(w1, n, sqrtadm1); /* w1 = n*sqrt(ad-1) */ + fe25519_sq(ss, s); /* ss = s^2 */ + fe25519_sub(w2, one, ss); /* w2 = 1-s^2 */ + fe25519_add(w3, one, ss); /* w3 = 1+s^2 */ + + fe25519_mul(p->X, w0, w3); + fe25519_mul(p->Y, w2, w1); + fe25519_mul(p->Z, w1, w3); + fe25519_mul(p->T, w0, w2); +} + +void +ristretto255_from_hash(unsigned char s[32], const unsigned char h[64]) +{ + fe25519 r0, r1; + ge25519_cached p1_cached; + ge25519_p1p1 p_p1p1; + ge25519_p3 p0, p1; + ge25519_p3 p; + + fe25519_frombytes(r0, h); + fe25519_frombytes(r1, h + 32); + ristretto255_elligator(&p0, r0); + ristretto255_elligator(&p1, r1); + ge25519_p3_to_cached(&p1_cached, &p1); + ge25519_add(&p_p1p1, &p0, &p1_cached); + ge25519_p1p1_to_p3(&p, &p_p1p1); + ristretto255_p3_tobytes(s, &p); +} diff -Nru libsodium-1.0.17/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h libsodium-1.0.18/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h --- libsodium-1.0.17/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h 2019-05-30 20:13:18.000000000 +0000 @@ -18,3 +18,23 @@ static const fe25519 curve25519_A = { 486662, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +/* sqrt(ad - 1) with a = -1 (mod p) */ +static const fe25519 sqrtadm1 = { + 24849947, -153582, -23613485, 6347715, -21072328, -667138, -25271143, -15367704, -870347, 14525639 +}; + +/* 1 / sqrt(a - d) */ +static const fe25519 invsqrtamd = { + 6111485, 4156064, -27798727, 12243468, -25904040, 120897, 20826367, -7060776, 6093568, -1986012 +}; + +/* 1 - d ^ 2 */ +static const fe25519 onemsqd = { + 6275446, -16617371, -22938544, -3773710, 11667077, 7397348, -27922721, 1766195, -24433858, 672203 +}; + +/* (d - 1) ^ 2 */ +static const fe25519 sqdmone = { + 15551795, -11097455, -13425098, -10125071, -11896535, 10178284, -26634327, 4729244, -5282110, -10116402 +}; diff -Nru libsodium-1.0.17/src/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h libsodium-1.0.18/src/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h --- libsodium-1.0.17/src/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h 2019-05-30 20:13:18.000000000 +0000 @@ -19,3 +19,23 @@ static const fe25519 curve25519_A = { 486662, 0, 0, 0, 0 }; + +/* sqrt(ad - 1) with a = -1 (mod p) */ +static const fe25519 sqrtadm1 = { + 2241493124984347, 425987919032274, 2207028919301688, 1220490630685848, 974799131293748 +}; + +/* 1 / sqrt(a - d) */ +static const fe25519 invsqrtamd = { + 278908739862762, 821645201101625, 8113234426968, 1777959178193151, 2118520810568447 +}; + +/* 1 - d ^ 2 */ +static const fe25519 onemsqd = { + 1136626929484150, 1998550399581263, 496427632559748, 118527312129759, 45110755273534 +}; + +/* (d - 1) ^ 2 */ +static const fe25519 sqdmone = { + 1507062230895904, 1572317787530805, 683053064812840, 317374165784489, 1572899562415810 +}; diff -Nru libsodium-1.0.17/src/libsodium/crypto_core/salsa/ref/core_salsa_ref.c libsodium-1.0.18/src/libsodium/crypto_core/salsa/ref/core_salsa_ref.c --- libsodium-1.0.17/src/libsodium/crypto_core/salsa/ref/core_salsa_ref.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_core/salsa/ref/core_salsa_ref.c 2019-05-30 20:13:18.000000000 +0000 @@ -127,7 +127,7 @@ } #ifndef MINIMAL - +/* LCOV_EXCL_START */ int crypto_core_salsa2012(unsigned char *out, const unsigned char *in, const unsigned char *k, const unsigned char *c) @@ -191,5 +191,5 @@ { return crypto_core_salsa208_CONSTBYTES; } - +/* LCOV_EXCL_END */ #endif diff -Nru libsodium-1.0.17/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h --- libsodium-1.0.17/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h 2019-05-30 20:13:18.000000000 +0000 @@ -68,17 +68,17 @@ #define BLAKE2B_DIAG_V1(a, b, c, d) \ do { \ - d = _mm256_permute4x64_epi64(d, _MM_SHUFFLE(2, 1, 0, 3)); \ - c = _mm256_permute4x64_epi64(c, _MM_SHUFFLE(1, 0, 3, 2)); \ - b = _mm256_permute4x64_epi64(b, _MM_SHUFFLE(0, 3, 2, 1)); \ - } while (0) + a = _mm256_permute4x64_epi64(a, _MM_SHUFFLE(2, 1, 0, 3)); \ + d = _mm256_permute4x64_epi64(d, _MM_SHUFFLE(1, 0, 3, 2)); \ + c = _mm256_permute4x64_epi64(c, _MM_SHUFFLE(0, 3, 2, 1)); \ + } while(0) #define BLAKE2B_UNDIAG_V1(a, b, c, d) \ do { \ - d = _mm256_permute4x64_epi64(d, _MM_SHUFFLE(0, 3, 2, 1)); \ - c = _mm256_permute4x64_epi64(c, _MM_SHUFFLE(1, 0, 3, 2)); \ - b = _mm256_permute4x64_epi64(b, _MM_SHUFFLE(2, 1, 0, 3)); \ - } while (0) + a = _mm256_permute4x64_epi64(a, _MM_SHUFFLE(0, 3, 2, 1)); \ + d = _mm256_permute4x64_epi64(d, _MM_SHUFFLE(1, 0, 3, 2)); \ + c = _mm256_permute4x64_epi64(c, _MM_SHUFFLE(2, 1, 0, 3)); \ + } while(0) #include "blake2b-load-avx2.h" diff -Nru libsodium-1.0.17/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c --- libsodium-1.0.17/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c 2019-05-30 20:13:18.000000000 +0000 @@ -35,7 +35,7 @@ int i; for (i = 0; i < 16; ++i) { - m[i] = LOAD64_LE(block + i * sizeof(m[i])); + m[i] = LOAD64_LE(block + i * sizeof m[i]); } for (i = 0; i < 8; ++i) { v[i] = S->h[i]; @@ -48,16 +48,16 @@ v[13] = S->t[1] ^ blake2b_IV[5]; v[14] = S->f[0] ^ blake2b_IV[6]; v[15] = S->f[1] ^ blake2b_IV[7]; -#define G(r, i, a, b, c, d) \ - do { \ - a = a + b + m[blake2b_sigma[r][2 * i + 0]]; \ - d = ROTR64(d ^ a, 32); \ - c = c + d; \ - b = ROTR64(b ^ c, 24); \ - a = a + b + m[blake2b_sigma[r][2 * i + 1]]; \ - d = ROTR64(d ^ a, 16); \ - c = c + d; \ - b = ROTR64(b ^ c, 63); \ +#define G(r, i, a, b, c, d) \ + do { \ + a += b + m[blake2b_sigma[r][2 * i + 0]]; \ + d = ROTR64(d ^ a, 32); \ + c += d; \ + b = ROTR64(b ^ c, 24); \ + a += b + m[blake2b_sigma[r][2 * i + 1]]; \ + d = ROTR64(d ^ a, 16); \ + c += d; \ + b = ROTR64(b ^ c, 63); \ } while (0) #define ROUND(r) \ do { \ diff -Nru libsodium-1.0.17/src/libsodium/crypto_generichash/blake2b/ref/blake2b-load-avx2.h libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-load-avx2.h --- libsodium-1.0.17/src/libsodium/crypto_generichash/blake2b/ref/blake2b-load-avx2.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-load-avx2.h 2019-05-30 20:13:18.000000000 +0000 @@ -17,15 +17,15 @@ #define BLAKE2B_LOAD_MSG_0_3(b0) \ do { \ - t0 = _mm256_unpacklo_epi64(m4, m5); \ - t1 = _mm256_unpacklo_epi64(m6, m7); \ + t0 = _mm256_unpacklo_epi64(m7, m4); \ + t1 = _mm256_unpacklo_epi64(m5, m6); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) #define BLAKE2B_LOAD_MSG_0_4(b0) \ do { \ - t0 = _mm256_unpackhi_epi64(m4, m5); \ - t1 = _mm256_unpackhi_epi64(m6, m7); \ + t0 = _mm256_unpackhi_epi64(m7, m4); \ + t1 = _mm256_unpackhi_epi64(m5, m6); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) @@ -43,17 +43,17 @@ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) -#define BLAKE2B_LOAD_MSG_1_3(b0) \ - do { \ - t0 = _mm256_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); \ - t1 = _mm256_unpackhi_epi64(m5, m2); \ - b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ +#define BLAKE2B_LOAD_MSG_1_3(b0) \ + do { \ + t0 = _mm256_unpackhi_epi64(m2, m0); \ + t1 = _mm256_blend_epi32(m5, m0, 0x33); \ + b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) #define BLAKE2B_LOAD_MSG_1_4(b0) \ do { \ - t0 = _mm256_unpacklo_epi64(m6, m1); \ - t1 = _mm256_unpackhi_epi64(m3, m1); \ + t0 = _mm256_alignr_epi8(m6, m1, 8); \ + t1 = _mm256_blend_epi32(m3, m1, 0x33); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) @@ -73,15 +73,15 @@ #define BLAKE2B_LOAD_MSG_2_3(b0) \ do { \ - t0 = _mm256_blend_epi32(m1, m5, 0x33); \ - t1 = _mm256_unpackhi_epi64(m3, m4); \ + t0 = _mm256_alignr_epi8(m5, m4, 8); \ + t1 = _mm256_unpackhi_epi64(m1, m3); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) #define BLAKE2B_LOAD_MSG_2_4(b0) \ do { \ - t0 = _mm256_unpacklo_epi64(m7, m3); \ - t1 = _mm256_alignr_epi8(m2, m0, 8); \ + t0 = _mm256_unpacklo_epi64(m2, m7); \ + t1 = _mm256_blend_epi32(m0, m3, 0x33); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) @@ -99,17 +99,17 @@ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) -#define BLAKE2B_LOAD_MSG_3_3(b0) \ - do { \ - t0 = _mm256_blend_epi32(m2, m1, 0x33); \ - t1 = _mm256_blend_epi32(m7, m2, 0x33); \ - b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ +#define BLAKE2B_LOAD_MSG_3_3(b0) \ + do { \ + t0 = _mm256_alignr_epi8(m1, m7, 8); \ + t1 = _mm256_shuffle_epi32(m2, _MM_SHUFFLE(1, 0, 3, 2)); \ + b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) #define BLAKE2B_LOAD_MSG_3_4(b0) \ do { \ - t0 = _mm256_unpacklo_epi64(m3, m5); \ - t1 = _mm256_unpacklo_epi64(m0, m4); \ + t0 = _mm256_unpacklo_epi64(m4, m3); \ + t1 = _mm256_unpacklo_epi64(m5, m0); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) @@ -129,15 +129,15 @@ #define BLAKE2B_LOAD_MSG_4_3(b0) \ do { \ - t0 = _mm256_blend_epi32(m5, m7, 0x33); \ - t1 = _mm256_blend_epi32(m1, m3, 0x33); \ + t0 = _mm256_alignr_epi8(m7, m1, 8); \ + t1 = _mm256_alignr_epi8(m3, m5, 8); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) #define BLAKE2B_LOAD_MSG_4_4(b0) \ do { \ - t0 = _mm256_alignr_epi8(m6, m0, 8); \ - t1 = _mm256_blend_epi32(m6, m4, 0x33); \ + t0 = _mm256_unpackhi_epi64(m6, m0); \ + t1 = _mm256_unpacklo_epi64(m6, m4); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) @@ -157,15 +157,15 @@ #define BLAKE2B_LOAD_MSG_5_3(b0) \ do { \ - t0 = _mm256_blend_epi32(m3, m2, 0x33); \ - t1 = _mm256_unpackhi_epi64(m7, m0); \ + t0 = _mm256_alignr_epi8(m2, m0, 8); \ + t1 = _mm256_unpackhi_epi64(m3, m7); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) #define BLAKE2B_LOAD_MSG_5_4(b0) \ do { \ - t0 = _mm256_unpackhi_epi64(m6, m2); \ - t1 = _mm256_blend_epi32(m4, m7, 0x33); \ + t0 = _mm256_unpackhi_epi64(m4, m6); \ + t1 = _mm256_alignr_epi8(m7, m2, 8); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) @@ -183,20 +183,20 @@ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) -#define BLAKE2B_LOAD_MSG_6_3(b0) \ - do { \ - t0 = _mm256_unpacklo_epi64(m0, m3); \ - t1 = _mm256_shuffle_epi32(m4, _MM_SHUFFLE(1, 0, 3, 2)); \ - b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ - } while (0) - -#define BLAKE2B_LOAD_MSG_6_4(b0) \ +#define BLAKE2B_LOAD_MSG_6_3(b0) \ do { \ - t0 = _mm256_unpackhi_epi64(m3, m1); \ - t1 = _mm256_blend_epi32(m5, m1, 0x33); \ + t0 = _mm256_unpacklo_epi64(m4, m0); \ + t1 = _mm256_blend_epi32(m4, m3, 0x33); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) +#define BLAKE2B_LOAD_MSG_6_4(b0) \ + do { \ + t0 = _mm256_unpackhi_epi64(m5, m3); \ + t1 = _mm256_shuffle_epi32(m1, _MM_SHUFFLE(1, 0, 3, 2)); \ + b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ + } while (0) + #define BLAKE2B_LOAD_MSG_7_1(b0) \ do { \ t0 = _mm256_unpackhi_epi64(m6, m3); \ @@ -213,15 +213,15 @@ #define BLAKE2B_LOAD_MSG_7_3(b0) \ do { \ - t0 = _mm256_unpackhi_epi64(m2, m7); \ - t1 = _mm256_unpacklo_epi64(m4, m1); \ + t0 = _mm256_blend_epi32(m2, m1, 0x33); \ + t1 = _mm256_alignr_epi8(m4, m7, 8); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) #define BLAKE2B_LOAD_MSG_7_4(b0) \ do { \ - t0 = _mm256_unpacklo_epi64(m0, m2); \ - t1 = _mm256_unpacklo_epi64(m3, m5); \ + t0 = _mm256_unpacklo_epi64(m5, m0); \ + t1 = _mm256_unpacklo_epi64(m2, m3); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) @@ -241,15 +241,15 @@ #define BLAKE2B_LOAD_MSG_8_3(b0) \ do { \ - t0 = m6; \ - t1 = _mm256_alignr_epi8(m5, m0, 8); \ + t0 = _mm256_unpacklo_epi64(m5, m6); \ + t1 = _mm256_unpackhi_epi64(m6, m0); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) #define BLAKE2B_LOAD_MSG_8_4(b0) \ do { \ - t0 = _mm256_blend_epi32(m3, m1, 0x33); \ - t1 = m2; \ + t0 = _mm256_alignr_epi8(m1, m2, 8); \ + t1 = _mm256_alignr_epi8(m2, m3, 8); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) @@ -269,15 +269,15 @@ #define BLAKE2B_LOAD_MSG_9_3(b0) \ do { \ - t0 = _mm256_unpackhi_epi64(m7, m4); \ - t1 = _mm256_unpackhi_epi64(m1, m6); \ + t0 = _mm256_unpackhi_epi64(m6, m7); \ + t1 = _mm256_unpackhi_epi64(m4, m1); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) #define BLAKE2B_LOAD_MSG_9_4(b0) \ do { \ - t0 = _mm256_alignr_epi8(m7, m5, 8); \ - t1 = _mm256_unpacklo_epi64(m6, m0); \ + t0 = _mm256_blend_epi32(m5, m0, 0x33); \ + t1 = _mm256_unpacklo_epi64(m7, m6); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) @@ -297,15 +297,15 @@ #define BLAKE2B_LOAD_MSG_10_3(b0) \ do { \ - t0 = _mm256_unpacklo_epi64(m4, m5); \ - t1 = _mm256_unpacklo_epi64(m6, m7); \ + t0 = _mm256_unpacklo_epi64(m7, m4); \ + t1 = _mm256_unpacklo_epi64(m5, m6); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) #define BLAKE2B_LOAD_MSG_10_4(b0) \ do { \ - t0 = _mm256_unpackhi_epi64(m4, m5); \ - t1 = _mm256_unpackhi_epi64(m6, m7); \ + t0 = _mm256_unpackhi_epi64(m7, m4); \ + t1 = _mm256_unpackhi_epi64(m5, m6); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) @@ -323,17 +323,17 @@ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) -#define BLAKE2B_LOAD_MSG_11_3(b0) \ - do { \ - t0 = _mm256_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); \ - t1 = _mm256_unpackhi_epi64(m5, m2); \ - b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ +#define BLAKE2B_LOAD_MSG_11_3(b0) \ + do { \ + t0 = _mm256_unpackhi_epi64(m2, m0); \ + t1 = _mm256_blend_epi32(m5, m0, 0x33); \ + b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) #define BLAKE2B_LOAD_MSG_11_4(b0) \ do { \ - t0 = _mm256_unpacklo_epi64(m6, m1); \ - t1 = _mm256_unpackhi_epi64(m3, m1); \ + t0 = _mm256_alignr_epi8(m6, m1, 8); \ + t1 = _mm256_blend_epi32(m3, m1, 0x33); \ b0 = _mm256_blend_epi32(t0, t1, 0xF0); \ } while (0) diff -Nru libsodium-1.0.17/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h libsodium-1.0.18/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h --- libsodium-1.0.17/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h 2019-05-30 20:13:18.000000000 +0000 @@ -41,7 +41,7 @@ t1 = LOAD64_LE(&key[8]); /* wiped after finalization */ - st->r[0] = (t0) &0xffc0fffffff; + st->r[0] = (t0) & 0xffc0fffffff; st->r[1] = ((t0 >> 44) | (t1 << 20)) & 0xfffffc0ffff; st->r[2] = ((t1 >> 24)) & 0x00ffffffc0f; @@ -88,8 +88,8 @@ t0 = LOAD64_LE(&m[0]); t1 = LOAD64_LE(&m[8]); - h0 += ((t0) &0xfffffffffff); - h1 += (((t0 >> 44) | (t1 << 20)) & 0xfffffffffff); + h0 += t0 & 0xfffffffffff; + h1 += ((t0 >> 44) | (t1 << 20)) & 0xfffffffffff; h2 += (((t1 >> 24)) & 0x3ffffffffff) | hibit; /* h *= r */ @@ -138,6 +138,7 @@ unsigned long long h0, h1, h2, c; unsigned long long g0, g1, g2; unsigned long long t0, t1; + unsigned long long mask; /* process the remaining block */ if (st->leftover) { @@ -157,43 +158,43 @@ h1 = st->h[1]; h2 = st->h[2]; - c = (h1 >> 44); + c = h1 >> 44; h1 &= 0xfffffffffff; h2 += c; - c = (h2 >> 42); + c = h2 >> 42; h2 &= 0x3ffffffffff; h0 += c * 5; - c = (h0 >> 44); + c = h0 >> 44; h0 &= 0xfffffffffff; h1 += c; - c = (h1 >> 44); + c = h1 >> 44; h1 &= 0xfffffffffff; h2 += c; - c = (h2 >> 42); + c = h2 >> 42; h2 &= 0x3ffffffffff; h0 += c * 5; - c = (h0 >> 44); + c = h0 >> 44; h0 &= 0xfffffffffff; h1 += c; /* compute h + -p */ g0 = h0 + 5; - c = (g0 >> 44); + c = g0 >> 44; g0 &= 0xfffffffffff; g1 = h1 + c; - c = (g1 >> 44); + c = g1 >> 44; g1 &= 0xfffffffffff; g2 = h2 + c - (1ULL << 42); /* select h if h < p, or h + -p if h >= p */ - c = (g2 >> ((sizeof(unsigned long long) * 8) - 1)) - 1; - g0 &= c; - g1 &= c; - g2 &= c; - c = ~c; - h0 = (h0 & c) | g0; - h1 = (h1 & c) | g1; - h2 = (h2 & c) | g2; + mask = (g2 >> ((sizeof(unsigned long long) * 8) - 1)) - 1; + g0 &= mask; + g1 &= mask; + g2 &= mask; + mask = ~mask; + h0 = (h0 & mask) | g0; + h1 = (h1 & mask) | g1; + h2 = (h2 & mask) | g2; /* h = (h + pad) */ t0 = st->pad[0]; @@ -209,8 +210,8 @@ h2 &= 0x3ffffffffff; /* mac = h % (2^128) */ - h0 = ((h0) | (h1 << 44)); - h1 = ((h1 >> 20) | (h2 << 24)); + h0 = (h0) | (h1 << 44); + h1 = (h1 >> 20) | (h2 << 24); STORE64_LE(&mac[0], h0); STORE64_LE(&mac[8], h1); diff -Nru libsodium-1.0.17/src/libsodium/crypto_pwhash/argon2/argon2-core.c libsodium-1.0.18/src/libsodium/crypto_pwhash/argon2/argon2-core.c --- libsodium-1.0.17/src/libsodium/crypto_pwhash/argon2/argon2-core.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_pwhash/argon2/argon2-core.c 2019-05-30 20:13:18.000000000 +0000 @@ -113,9 +113,11 @@ } #endif if (base == NULL) { + /* LCOV_EXCL_START */ free(*region); *region = NULL; - return ARGON2_MEMORY_ALLOCATION_ERROR; /* LCOV_EXCL_LINE */ + return ARGON2_MEMORY_ALLOCATION_ERROR; + /* LCOV_EXCL_STOP */ } (*region)->base = base; (*region)->memory = memory; diff -Nru libsodium-1.0.17/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c libsodium-1.0.18/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c --- libsodium-1.0.17/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c 2019-05-30 20:13:18.000000000 +0000 @@ -305,6 +305,10 @@ uint32_t i; /* Sanity-check parameters. */ + if (r == 0 || p == 0) { + errno = EINVAL; + return -1; + } #if SIZE_MAX > UINT32_MAX if (buflen > (((uint64_t)(1) << 32) - 1) * 32) { errno = EFBIG; diff -Nru libsodium-1.0.17/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c libsodium-1.0.18/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c --- libsodium-1.0.17/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c 2019-05-30 20:13:18.000000000 +0000 @@ -317,6 +317,10 @@ uint32_t i; /* Sanity-check parameters. */ + if (r == 0 || p == 0) { + errno = EINVAL; + return -1; + } # if SIZE_MAX > UINT32_MAX /* LCOV_EXCL_START */ if (buflen > (((uint64_t)(1) << 32) - 1) * 32) { diff -Nru libsodium-1.0.17/src/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c libsodium-1.0.18/src/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c --- libsodium-1.0.17/src/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c 2019-05-30 20:13:18.000000000 +0000 @@ -24,7 +24,6 @@ _crypto_scalarmult_ed25519_clamp(unsigned char k[32]) { k[0] &= 248; - k[31] &= 127; k[31] |= 64; } @@ -47,6 +46,8 @@ if (clamp != 0) { _crypto_scalarmult_ed25519_clamp(t); } + t[31] &= 127; + ge25519_scalarmult(&Q, t, &P); ge25519_p3_tobytes(q, &Q); if (_crypto_scalarmult_ed25519_is_inf(q) != 0 || sodium_is_zero(n, 32)) { @@ -83,6 +84,8 @@ if (clamp != 0) { _crypto_scalarmult_ed25519_clamp(t); } + t[31] &= 127; + ge25519_scalarmult_base(&Q, t); ge25519_p3_tobytes(q, &Q); if (_crypto_scalarmult_ed25519_is_inf(q) != 0 || sodium_is_zero(n, 32)) { diff -Nru libsodium-1.0.17/src/libsodium/crypto_scalarmult/ristretto255/ref10/scalarmult_ristretto255_ref10.c libsodium-1.0.18/src/libsodium/crypto_scalarmult/ristretto255/ref10/scalarmult_ristretto255_ref10.c --- libsodium-1.0.17/src/libsodium/crypto_scalarmult/ristretto255/ref10/scalarmult_ristretto255_ref10.c 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_scalarmult/ristretto255/ref10/scalarmult_ristretto255_ref10.c 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,63 @@ + +#include + +#include "crypto_scalarmult_ed25519.h" +#include "crypto_scalarmult_ristretto255.h" +#include "private/ed25519_ref10.h" +#include "utils.h" + +int +crypto_scalarmult_ristretto255(unsigned char *q, const unsigned char *n, + const unsigned char *p) +{ + unsigned char *t = q; + ge25519_p3 Q; + ge25519_p3 P; + unsigned int i; + + if (ristretto255_frombytes(&P, p) != 0) { + return -1; + } + for (i = 0; i < 32; ++i) { + t[i] = n[i]; + } + t[31] &= 127; + ge25519_scalarmult(&Q, t, &P); + ristretto255_p3_tobytes(q, &Q); + if (sodium_is_zero(q, 32)) { + return -1; + } + return 0; +} + +int +crypto_scalarmult_ristretto255_base(unsigned char *q, + const unsigned char *n) +{ + unsigned char *t = q; + ge25519_p3 Q; + unsigned int i; + + for (i = 0; i < 32; ++i) { + t[i] = n[i]; + } + t[31] &= 127; + ge25519_scalarmult_base(&Q, t); + ristretto255_p3_tobytes(q, &Q); + if (sodium_is_zero(q, 32)) { + return -1; + } + return 0; +} + +size_t +crypto_scalarmult_ristretto255_bytes(void) +{ + return crypto_scalarmult_ristretto255_BYTES; +} + +size_t +crypto_scalarmult_ristretto255_scalarbytes(void) +{ + return crypto_scalarmult_ristretto255_SCALARBYTES; +} diff -Nru libsodium-1.0.17/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c --- libsodium-1.0.17/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c 2019-05-30 20:13:18.000000000 +0000 @@ -10,6 +10,7 @@ #include "randombytes.h" #include "utils.h" +/* LCOV_EXCL_START */ int crypto_sign_edwards25519sha512batch_keypair(unsigned char *pk, unsigned char *sk) @@ -114,3 +115,4 @@ return 0; } +/* LCOV_EXCL_END */ diff -Nru libsodium-1.0.17/src/libsodium/crypto_sign/ed25519/ref10/sign.c libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/ref10/sign.c --- libsodium-1.0.17/src/libsodium/crypto_sign/ed25519/ref10/sign.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/ref10/sign.c 2019-05-30 20:13:18.000000000 +0000 @@ -76,7 +76,7 @@ crypto_hash_sha512(az, sk, 32); #ifdef ED25519_NONDETERMINISTIC - _crypto_sign_ed25519_synthetic_r_hv(&hs, nonce, az); + _crypto_sign_ed25519_synthetic_r_hv(&hs, nonce /* Z */, az); #else crypto_hash_sha512_update(&hs, az + 32, 32); #endif diff -Nru libsodium-1.0.17/src/libsodium/include/Makefile.am libsodium-1.0.18/src/libsodium/include/Makefile.am --- libsodium-1.0.17/src/libsodium/include/Makefile.am 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/Makefile.am 2019-05-30 20:13:18.000000000 +0000 @@ -13,6 +13,7 @@ sodium/crypto_box_curve25519xchacha20poly1305.h \ sodium/crypto_box_curve25519xsalsa20poly1305.h \ sodium/crypto_core_ed25519.h \ + sodium/crypto_core_ristretto255.h \ sodium/crypto_core_hchacha20.h \ sodium/crypto_core_hsalsa20.h \ sodium/crypto_core_salsa20.h \ @@ -35,6 +36,7 @@ sodium/crypto_scalarmult.h \ sodium/crypto_scalarmult_curve25519.h \ sodium/crypto_scalarmult_ed25519.h \ + sodium/crypto_scalarmult_ristretto255.h \ sodium/crypto_secretbox.h \ sodium/crypto_secretbox_xchacha20poly1305.h \ sodium/crypto_secretbox_xsalsa20poly1305.h \ @@ -56,16 +58,11 @@ sodium/crypto_verify_64.h \ sodium/export.h \ sodium/randombytes.h \ - sodium/randombytes_salsa20_random.h \ + sodium/randombytes_internal_random.h \ sodium/randombytes_sysrandom.h \ sodium/runtime.h \ sodium/utils.h -if NATIVECLIENT -SODIUM_EXPORT += \ - sodium/randombytes_nativeclient.h -endif - EXTRA_SRC = $(SODIUM_EXPORT) \ sodium/version.h.in diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_aead_aes256gcm.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_aead_aes256gcm.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_aead_aes256gcm.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_aead_aes256gcm.h 2019-05-30 20:13:18.000000000 +0000 @@ -56,7 +56,7 @@ SODIUM_EXPORT size_t crypto_aead_aes256gcm_messagebytes_max(void); -typedef CRYPTO_ALIGN(16) struct crypto_aead_aes256gcm_state_ { +typedef struct CRYPTO_ALIGN(16) crypto_aead_aes256gcm_state_ { unsigned char opaque[512]; } crypto_aead_aes256gcm_state; diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h 2019-05-30 20:13:18.000000000 +0000 @@ -79,7 +79,7 @@ unsigned long long adlen, const unsigned char *npub, const unsigned char *k) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 9, 9))); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9))); SODIUM_EXPORT void crypto_aead_xchacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchacha20poly1305_ietf_KEYBYTES]) diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_auth.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_auth.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth.h 2019-05-30 20:13:18.000000000 +0000 @@ -28,12 +28,12 @@ SODIUM_EXPORT int crypto_auth(unsigned char *out, const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_auth_verify(const unsigned char *h, const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT void crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES]) diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_auth_hmacsha256.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth_hmacsha256.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_auth_hmacsha256.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth_hmacsha256.h 2019-05-30 20:13:18.000000000 +0000 @@ -24,14 +24,14 @@ int crypto_auth_hmacsha256(unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *k) __attribute__ ((nonnull)); + const unsigned char *k) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_auth_hmacsha256_verify(const unsigned char *h, const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); /* ------------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ int crypto_auth_hmacsha256_update(crypto_auth_hmacsha256_state *state, const unsigned char *in, unsigned long long inlen) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state *state, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h 2019-05-30 20:13:18.000000000 +0000 @@ -21,15 +21,17 @@ size_t crypto_auth_hmacsha512256_keybytes(void); SODIUM_EXPORT -int crypto_auth_hmacsha512256(unsigned char *out, const unsigned char *in, - unsigned long long inlen,const unsigned char *k); +int crypto_auth_hmacsha512256(unsigned char *out, + const unsigned char *in, + unsigned long long inlen, + const unsigned char *k) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_auth_hmacsha512256_verify(const unsigned char *h, const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); /* ------------------------------------------------------------------------- */ @@ -46,7 +48,7 @@ SODIUM_EXPORT int crypto_auth_hmacsha512256_update(crypto_auth_hmacsha512256_state *state, const unsigned char *in, - unsigned long long inlen) __attribute__ ((nonnull)); + unsigned long long inlen) __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state *state, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_auth_hmacsha512.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth_hmacsha512.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_auth_hmacsha512.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth_hmacsha512.h 2019-05-30 20:13:18.000000000 +0000 @@ -24,14 +24,14 @@ int crypto_auth_hmacsha512(unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *k) __attribute__ ((nonnull)); + const unsigned char *k) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_auth_hmacsha512_verify(const unsigned char *h, const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); /* ------------------------------------------------------------------------- */ @@ -51,7 +51,7 @@ SODIUM_EXPORT int crypto_auth_hmacsha512_update(crypto_auth_hmacsha512_state *state, const unsigned char *in, - unsigned long long inlen) __attribute__ ((nonnull)); + unsigned long long inlen) __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_auth_hmacsha512_final(crypto_auth_hmacsha512_state *state, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h 2019-05-30 20:13:18.000000000 +0000 @@ -60,7 +60,7 @@ const unsigned char *n, const unsigned char *pk, const unsigned char *sk) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6))); SODIUM_EXPORT int crypto_box_curve25519xchacha20poly1305_open_easy(unsigned char *m, @@ -79,7 +79,7 @@ const unsigned char *n, const unsigned char *pk, const unsigned char *sk) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 2, 5, 6, 7))); SODIUM_EXPORT int crypto_box_curve25519xchacha20poly1305_open_detached(unsigned char *m, @@ -105,7 +105,7 @@ unsigned long long mlen, const unsigned char *n, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4, 5))); SODIUM_EXPORT int crypto_box_curve25519xchacha20poly1305_open_easy_afternm(unsigned char *m, @@ -122,7 +122,7 @@ unsigned long long mlen, const unsigned char *n, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 2, 5, 6))); SODIUM_EXPORT int crypto_box_curve25519xchacha20poly1305_open_detached_afternm(unsigned char *m, @@ -147,7 +147,7 @@ const unsigned char *m, unsigned long long mlen, const unsigned char *pk) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_box_curve25519xchacha20poly1305_seal_open(unsigned char *m, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h 2019-05-30 20:13:18.000000000 +0000 @@ -78,7 +78,7 @@ const unsigned char *n, const unsigned char *pk, const unsigned char *sk) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6))); SODIUM_EXPORT int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m, @@ -95,7 +95,7 @@ unsigned long long mlen, const unsigned char *n, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4, 5))); SODIUM_EXPORT int crypto_box_curve25519xsalsa20poly1305_open_afternm(unsigned char *m, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_box.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_box.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_box.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_box.h 2019-05-30 20:13:18.000000000 +0000 @@ -61,7 +61,7 @@ int crypto_box_easy(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, const unsigned char *pk, const unsigned char *sk) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6))); SODIUM_EXPORT int crypto_box_open_easy(unsigned char *m, const unsigned char *c, @@ -74,7 +74,7 @@ const unsigned char *m, unsigned long long mlen, const unsigned char *n, const unsigned char *pk, const unsigned char *sk) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 2, 5, 6, 7))); SODIUM_EXPORT int crypto_box_open_detached(unsigned char *m, const unsigned char *c, @@ -99,7 +99,7 @@ SODIUM_EXPORT int crypto_box_easy_afternm(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, - const unsigned char *k) __attribute__ ((nonnull)); + const unsigned char *k) __attribute__ ((nonnull(1, 4, 5))); SODIUM_EXPORT int crypto_box_open_easy_afternm(unsigned char *m, const unsigned char *c, @@ -111,7 +111,7 @@ int crypto_box_detached_afternm(unsigned char *c, unsigned char *mac, const unsigned char *m, unsigned long long mlen, const unsigned char *n, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 2, 5, 6))); SODIUM_EXPORT int crypto_box_open_detached_afternm(unsigned char *m, const unsigned char *c, @@ -129,7 +129,7 @@ SODIUM_EXPORT int crypto_box_seal(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *pk) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_box_seal_open(unsigned char *m, const unsigned char *c, @@ -151,7 +151,7 @@ int crypto_box(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, const unsigned char *pk, const unsigned char *sk) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6))); SODIUM_EXPORT int crypto_box_open(unsigned char *m, const unsigned char *c, @@ -162,7 +162,7 @@ SODIUM_EXPORT int crypto_box_afternm(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, - const unsigned char *k) __attribute__ ((nonnull)); + const unsigned char *k) __attribute__ ((nonnull(1, 4, 5))); SODIUM_EXPORT int crypto_box_open_afternm(unsigned char *m, const unsigned char *c, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_core_ed25519.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_ed25519.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_core_ed25519.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_ed25519.h 2019-05-30 20:13:18.000000000 +0000 @@ -16,6 +16,10 @@ SODIUM_EXPORT size_t crypto_core_ed25519_uniformbytes(void); +#define crypto_core_ed25519_HASHBYTES 64 +SODIUM_EXPORT +size_t crypto_core_ed25519_hashbytes(void); + #define crypto_core_ed25519_SCALARBYTES 32 SODIUM_EXPORT size_t crypto_core_ed25519_scalarbytes(void); @@ -43,6 +47,14 @@ __attribute__ ((nonnull)); SODIUM_EXPORT +int crypto_core_ed25519_from_hash(unsigned char *p, const unsigned char *h) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +void crypto_core_ed25519_random(unsigned char *p) + __attribute__ ((nonnull)); + +SODIUM_EXPORT void crypto_core_ed25519_scalar_random(unsigned char *r) __attribute__ ((nonnull)); @@ -68,6 +80,11 @@ const unsigned char *y) __attribute__ ((nonnull)); +SODIUM_EXPORT +void crypto_core_ed25519_scalar_mul(unsigned char *z, const unsigned char *x, + const unsigned char *y) + __attribute__ ((nonnull)); + /* * The interval `s` is sampled from should be at least 317 bits to ensure almost * uniformity of `r` over `L`. diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_core_ristretto255.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_ristretto255.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_core_ristretto255.h 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_ristretto255.h 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,100 @@ +#ifndef crypto_core_ristretto255_H +#define crypto_core_ristretto255_H + +#include +#include "export.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define crypto_core_ristretto255_BYTES 32 +SODIUM_EXPORT +size_t crypto_core_ristretto255_bytes(void); + +#define crypto_core_ristretto255_HASHBYTES 64 +SODIUM_EXPORT +size_t crypto_core_ristretto255_hashbytes(void); + +#define crypto_core_ristretto255_SCALARBYTES 32 +SODIUM_EXPORT +size_t crypto_core_ristretto255_scalarbytes(void); + +#define crypto_core_ristretto255_NONREDUCEDSCALARBYTES 64 +SODIUM_EXPORT +size_t crypto_core_ristretto255_nonreducedscalarbytes(void); + +SODIUM_EXPORT +int crypto_core_ristretto255_is_valid_point(const unsigned char *p) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_core_ristretto255_add(unsigned char *r, + const unsigned char *p, const unsigned char *q) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_core_ristretto255_sub(unsigned char *r, + const unsigned char *p, const unsigned char *q) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_core_ristretto255_from_hash(unsigned char *p, + const unsigned char *r) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +void crypto_core_ristretto255_random(unsigned char *p) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +void crypto_core_ristretto255_scalar_random(unsigned char *r) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_core_ristretto255_scalar_invert(unsigned char *recip, + const unsigned char *s) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +void crypto_core_ristretto255_scalar_negate(unsigned char *neg, + const unsigned char *s) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +void crypto_core_ristretto255_scalar_complement(unsigned char *comp, + const unsigned char *s) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +void crypto_core_ristretto255_scalar_add(unsigned char *z, + const unsigned char *x, + const unsigned char *y) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +void crypto_core_ristretto255_scalar_sub(unsigned char *z, + const unsigned char *x, + const unsigned char *y) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +void crypto_core_ristretto255_scalar_mul(unsigned char *z, + const unsigned char *x, + const unsigned char *y) + __attribute__ ((nonnull)); + +/* + * The interval `s` is sampled from should be at least 317 bits to ensure almost + * uniformity of `r` over `L`. + */ +SODIUM_EXPORT +void crypto_core_ristretto255_scalar_reduce(unsigned char *r, + const unsigned char *s) + __attribute__ ((nonnull)); + +#ifdef __cplusplus +} +#endif + +#endif diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_generichash_blake2b.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_generichash_blake2b.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_generichash_blake2b.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_generichash_blake2b.h 2019-05-30 20:13:18.000000000 +0000 @@ -100,7 +100,7 @@ int crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state, const unsigned char *in, unsigned long long inlen) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_generichash.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_generichash.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_generichash.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_generichash.h 2019-05-30 20:13:18.000000000 +0000 @@ -66,7 +66,7 @@ int crypto_generichash_update(crypto_generichash_state *state, const unsigned char *in, unsigned long long inlen) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_generichash_final(crypto_generichash_state *state, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_hash.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_hash.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_hash.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_hash.h 2019-05-30 20:13:18.000000000 +0000 @@ -26,7 +26,7 @@ SODIUM_EXPORT int crypto_hash(unsigned char *out, const unsigned char *in, - unsigned long long inlen) __attribute__ ((nonnull)); + unsigned long long inlen) __attribute__ ((nonnull(1))); #define crypto_hash_PRIMITIVE "sha512" SODIUM_EXPORT diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_hash_sha256.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_hash_sha256.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_hash_sha256.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_hash_sha256.h 2019-05-30 20:13:18.000000000 +0000 @@ -36,7 +36,7 @@ SODIUM_EXPORT int crypto_hash_sha256(unsigned char *out, const unsigned char *in, - unsigned long long inlen) __attribute__ ((nonnull)); + unsigned long long inlen) __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_hash_sha256_init(crypto_hash_sha256_state *state) @@ -46,7 +46,7 @@ int crypto_hash_sha256_update(crypto_hash_sha256_state *state, const unsigned char *in, unsigned long long inlen) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_hash_sha256_final(crypto_hash_sha256_state *state, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_hash_sha512.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_hash_sha512.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_hash_sha512.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_hash_sha512.h 2019-05-30 20:13:18.000000000 +0000 @@ -36,7 +36,7 @@ SODIUM_EXPORT int crypto_hash_sha512(unsigned char *out, const unsigned char *in, - unsigned long long inlen) __attribute__ ((nonnull)); + unsigned long long inlen) __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_hash_sha512_init(crypto_hash_sha512_state *state) @@ -46,7 +46,7 @@ int crypto_hash_sha512_update(crypto_hash_sha512_state *state, const unsigned char *in, unsigned long long inlen) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_hash_sha512_final(crypto_hash_sha512_state *state, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_onetimeauth.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_onetimeauth.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_onetimeauth.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_onetimeauth.h 2019-05-30 20:13:18.000000000 +0000 @@ -33,12 +33,12 @@ SODIUM_EXPORT int crypto_onetimeauth(unsigned char *out, const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_onetimeauth_init(crypto_onetimeauth_state *state, @@ -48,7 +48,7 @@ int crypto_onetimeauth_update(crypto_onetimeauth_state *state, const unsigned char *in, unsigned long long inlen) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_onetimeauth_final(crypto_onetimeauth_state *state, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h 2019-05-30 20:13:18.000000000 +0000 @@ -36,14 +36,14 @@ const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_onetimeauth_poly1305_verify(const unsigned char *h, const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state, @@ -54,7 +54,7 @@ int crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state, const unsigned char *in, unsigned long long inlen) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h 2019-05-30 20:13:18.000000000 +0000 @@ -18,7 +18,7 @@ size_t crypto_scalarmult_curve25519_scalarbytes(void); /* - * NOTE: Do not use the result of this function directly. + * NOTE: Do not use the result of this function directly for key exchange. * * Hash the result with the public keys in order to compute a shared * secret key: H(q || client_pk || server_pk) diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h 2019-05-30 20:13:18.000000000 +0000 @@ -19,7 +19,7 @@ size_t crypto_scalarmult_ed25519_scalarbytes(void); /* - * NOTE: Do not use the result of this function directly. + * NOTE: Do not use the result of this function directly for key exchange. * * Hash the result with the public keys in order to compute a shared * secret key: H(q || client_pk || server_pk) diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_scalarmult.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_scalarmult.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult.h 2019-05-30 20:13:18.000000000 +0000 @@ -27,7 +27,7 @@ __attribute__ ((nonnull)); /* - * NOTE: Do not use the result of this function directly. + * NOTE: Do not use the result of this function directly for key exchange. * * Hash the result with the public keys in order to compute a shared * secret key: H(q || client_pk || server_pk) diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,43 @@ + +#ifndef crypto_scalarmult_ristretto255_H +#define crypto_scalarmult_ristretto255_H + +#include + +#include "export.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define crypto_scalarmult_ristretto255_BYTES 32U +SODIUM_EXPORT +size_t crypto_scalarmult_ristretto255_bytes(void); + +#define crypto_scalarmult_ristretto255_SCALARBYTES 32U +SODIUM_EXPORT +size_t crypto_scalarmult_ristretto255_scalarbytes(void); + +/* + * NOTE: Do not use the result of this function directly for key exchange. + * + * Hash the result with the public keys in order to compute a shared + * secret key: H(q || client_pk || server_pk) + * + * Or unless this is not an option, use the crypto_kx() API instead. + */ +SODIUM_EXPORT +int crypto_scalarmult_ristretto255(unsigned char *q, const unsigned char *n, + const unsigned char *p) + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_scalarmult_ristretto255_base(unsigned char *q, + const unsigned char *n) + __attribute__ ((nonnull)); + +#ifdef __cplusplus +} +#endif + +#endif diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_secretbox.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_secretbox.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox.h 2019-05-30 20:13:18.000000000 +0000 @@ -36,7 +36,7 @@ SODIUM_EXPORT int crypto_secretbox_easy(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, - const unsigned char *k) __attribute__ ((nonnull)); + const unsigned char *k) __attribute__ ((nonnull(1, 4, 5))); SODIUM_EXPORT int crypto_secretbox_open_easy(unsigned char *m, const unsigned char *c, @@ -50,7 +50,7 @@ unsigned long long mlen, const unsigned char *n, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 2, 5, 6))); SODIUM_EXPORT int crypto_secretbox_open_detached(unsigned char *m, @@ -78,7 +78,7 @@ SODIUM_EXPORT int crypto_secretbox(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, - const unsigned char *k) __attribute__ ((nonnull)); + const unsigned char *k) __attribute__ ((nonnull(1, 4, 5))); SODIUM_EXPORT int crypto_secretbox_open(unsigned char *m, const unsigned char *c, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h 2019-05-30 20:13:18.000000000 +0000 @@ -35,7 +35,7 @@ unsigned long long mlen, const unsigned char *n, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4, 5))); SODIUM_EXPORT int crypto_secretbox_xchacha20poly1305_open_easy(unsigned char *m, @@ -52,7 +52,7 @@ unsigned long long mlen, const unsigned char *n, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 2, 5, 6))); SODIUM_EXPORT int crypto_secretbox_xchacha20poly1305_open_detached(unsigned char *m, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h 2019-05-30 20:13:18.000000000 +0000 @@ -36,7 +36,7 @@ unsigned long long mlen, const unsigned char *n, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4, 5))); SODIUM_EXPORT int crypto_secretbox_xsalsa20poly1305_open(unsigned char *m, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_shorthash.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_shorthash.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_shorthash.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_shorthash.h 2019-05-30 20:13:18.000000000 +0000 @@ -28,7 +28,7 @@ SODIUM_EXPORT int crypto_shorthash(unsigned char *out, const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES]) diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_shorthash_siphash24.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_shorthash_siphash24.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_shorthash_siphash24.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_shorthash_siphash24.h 2019-05-30 20:13:18.000000000 +0000 @@ -24,7 +24,7 @@ SODIUM_EXPORT int crypto_shorthash_siphash24(unsigned char *out, const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4))); #ifndef SODIUM_LIBRARY_MINIMAL /* -- 128-bit output -- */ @@ -40,7 +40,7 @@ SODIUM_EXPORT int crypto_shorthash_siphashx24(unsigned char *out, const unsigned char *in, unsigned long long inlen, const unsigned char *k) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 4))); #endif #ifdef __cplusplus diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_sign_ed25519.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_sign_ed25519.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_sign_ed25519.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_sign_ed25519.h 2019-05-30 20:13:18.000000000 +0000 @@ -43,7 +43,7 @@ int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p, const unsigned char *m, unsigned long long mlen, const unsigned char *sk) - __attribute__ ((nonnull(1, 3, 5))); + __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p, @@ -57,14 +57,14 @@ const unsigned char *m, unsigned long long mlen, const unsigned char *sk) - __attribute__ ((nonnull(1, 3))); + __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_ed25519_verify_detached(const unsigned char *sig, const unsigned char *m, unsigned long long mlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk) @@ -102,14 +102,14 @@ int crypto_sign_ed25519ph_update(crypto_sign_ed25519ph_state *state, const unsigned char *m, unsigned long long mlen) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_sign_ed25519ph_final_create(crypto_sign_ed25519ph_state *state, unsigned char *sig, unsigned long long *siglen_p, const unsigned char *sk) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1, 2, 4))); SODIUM_EXPORT int crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state *state, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h 2019-05-30 20:13:18.000000000 +0000 @@ -33,7 +33,7 @@ const unsigned char *m, unsigned long long mlen, const unsigned char *sk) - __attribute__ ((deprecated)) __attribute__ ((nonnull(1, 3, 5))); + __attribute__ ((deprecated)) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_edwards25519sha512batch_open(unsigned char *m, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/crypto_sign.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_sign.h --- libsodium-1.0.17/src/libsodium/include/sodium/crypto_sign.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_sign.h 2019-05-30 20:13:18.000000000 +0000 @@ -61,7 +61,7 @@ SODIUM_EXPORT int crypto_sign(unsigned char *sm, unsigned long long *smlen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk) __attribute__ ((nonnull(1, 3, 5))); + const unsigned char *sk) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_open(unsigned char *m, unsigned long long *mlen_p, @@ -72,14 +72,14 @@ SODIUM_EXPORT int crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk) __attribute__ ((nonnull(1, 3, 5))); + const unsigned char *sk) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m, unsigned long long mlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_sign_init(crypto_sign_state *state); @@ -87,7 +87,7 @@ SODIUM_EXPORT int crypto_sign_update(crypto_sign_state *state, const unsigned char *m, unsigned long long mlen) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_sign_final_create(crypto_sign_state *state, unsigned char *sig, diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/private/common.h libsodium-1.0.18/src/libsodium/include/sodium/private/common.h --- libsodium-1.0.17/src/libsodium/include/sodium/private/common.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/private/common.h 2019-05-30 20:13:18.000000000 +0000 @@ -1,7 +1,7 @@ #ifndef common_H #define common_H 1 -#if !defined(_MSC_VER) && 0 +#if !defined(_MSC_VER) && !defined(DEV_MODE) && 0 # warning *** This is unstable, untested, development code. # warning It might not compile. It might not work as expected. # warning It might be totally insecure. diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/private/ed25519_ref10.h libsodium-1.0.18/src/libsodium/include/sodium/private/ed25519_ref10.h --- libsodium-1.0.17/src/libsodium/include/sodium/private/ed25519_ref10.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/private/ed25519_ref10.h 2019-05-30 20:13:18.000000000 +0000 @@ -110,6 +110,18 @@ void ge25519_from_uniform(unsigned char s[32], const unsigned char r[32]); +void ge25519_from_hash(unsigned char s[32], const unsigned char h[64]); + +/* + Ristretto group + */ + +int ristretto255_frombytes(ge25519_p3 *h, const unsigned char *s); + +void ristretto255_p3_tobytes(unsigned char *s, const ge25519_p3 *h); + +void ristretto255_from_hash(unsigned char s[32], const unsigned char h[64]); + /* The set of scalars is \Z/l where l = 2^252 + 27742317777372353535851937790883648493. @@ -119,6 +131,9 @@ void sc25519_reduce(unsigned char s[64]); +void sc25519_mul(unsigned char s[32], const unsigned char a[32], + const unsigned char b[32]); + void sc25519_muladd(unsigned char s[32], const unsigned char a[32], const unsigned char b[32], const unsigned char c[32]); diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/randombytes_internal_random.h libsodium-1.0.18/src/libsodium/include/sodium/randombytes_internal_random.h --- libsodium-1.0.17/src/libsodium/include/sodium/randombytes_internal_random.h 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/randombytes_internal_random.h 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,22 @@ + +#ifndef randombytes_internal_random_H +#define randombytes_internal_random_H + +#include "export.h" +#include "randombytes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +SODIUM_EXPORT +extern struct randombytes_implementation randombytes_internal_implementation; + +/* Backwards compatibility with libsodium < 1.0.18 */ +#define randombytes_salsa20_implementation randombytes_internal_implementation + +#ifdef __cplusplus +} +#endif + +#endif diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/randombytes_nativeclient.h libsodium-1.0.18/src/libsodium/include/sodium/randombytes_nativeclient.h --- libsodium-1.0.17/src/libsodium/include/sodium/randombytes_nativeclient.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/randombytes_nativeclient.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ - -#ifndef randombytes_nativeclient_H -#define randombytes_nativeclient_H - -#ifdef __native_client__ - -# include "export.h" -# include "randombytes.h" - -# ifdef __cplusplus -extern "C" { -# endif - -SODIUM_EXPORT -extern struct randombytes_implementation randombytes_nativeclient_implementation; - -# ifdef __cplusplus -} -# endif - -#endif - -#endif diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/randombytes_salsa20_random.h libsodium-1.0.18/src/libsodium/include/sodium/randombytes_salsa20_random.h --- libsodium-1.0.17/src/libsodium/include/sodium/randombytes_salsa20_random.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/randombytes_salsa20_random.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - -#ifndef randombytes_salsa20_random_H -#define randombytes_salsa20_random_H - -#include "export.h" -#include "randombytes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -SODIUM_EXPORT -extern struct randombytes_implementation randombytes_salsa20_implementation; - -#ifdef __cplusplus -} -#endif - -#endif diff -Nru libsodium-1.0.17/src/libsodium/include/sodium/utils.h libsodium-1.0.18/src/libsodium/include/sodium/utils.h --- libsodium-1.0.17/src/libsodium/include/sodium/utils.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium/utils.h 2019-05-30 20:13:18.000000000 +0000 @@ -19,7 +19,7 @@ #endif SODIUM_EXPORT -void sodium_memzero(void * const pnt, const size_t len) __attribute__ ((nonnull)); +void sodium_memzero(void * const pnt, const size_t len); SODIUM_EXPORT void sodium_stackzero(const size_t len); @@ -32,7 +32,7 @@ */ SODIUM_EXPORT int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + __attribute__ ((warn_unused_result)); /* * sodium_compare() returns -1 if b1_ < b2_, 1 if b1_ > b2_ and 0 if b1_ == b2_ @@ -42,8 +42,7 @@ */ SODIUM_EXPORT int sodium_compare(const unsigned char *b1_, const unsigned char *b2_, - size_t len) - __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); + size_t len) __attribute__ ((warn_unused_result)); SODIUM_EXPORT int sodium_is_zero(const unsigned char *n, const size_t nlen); @@ -52,24 +51,22 @@ void sodium_increment(unsigned char *n, const size_t nlen); SODIUM_EXPORT -void sodium_add(unsigned char *a, const unsigned char *b, const size_t len) - __attribute__ ((nonnull)); +void sodium_add(unsigned char *a, const unsigned char *b, const size_t len); SODIUM_EXPORT -void sodium_sub(unsigned char *a, const unsigned char *b, const size_t len) - __attribute__ ((nonnull)); +void sodium_sub(unsigned char *a, const unsigned char *b, const size_t len); SODIUM_EXPORT char *sodium_bin2hex(char * const hex, const size_t hex_maxlen, const unsigned char * const bin, const size_t bin_len) - __attribute__ ((nonnull)); + __attribute__ ((nonnull(1))); SODIUM_EXPORT int sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen, const char * const hex, const size_t hex_len, const char * const ignore, size_t * const bin_len, const char ** const hex_end) - __attribute__ ((nonnull(1, 3))); + __attribute__ ((nonnull(1))); #define sodium_base64_VARIANT_ORIGINAL 1 #define sodium_base64_VARIANT_ORIGINAL_NO_PADDING 3 @@ -91,14 +88,14 @@ SODIUM_EXPORT char *sodium_bin2base64(char * const b64, const size_t b64_maxlen, const unsigned char * const bin, const size_t bin_len, - const int variant) __attribute__ ((nonnull)); + const int variant) __attribute__ ((nonnull(1))); SODIUM_EXPORT int sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen, const char * const b64, const size_t b64_len, const char * const ignore, size_t * const bin_len, const char ** const b64_end, const int variant) - __attribute__ ((nonnull(1, 3))); + __attribute__ ((nonnull(1))); SODIUM_EXPORT int sodium_mlock(void * const addr, const size_t len) diff -Nru libsodium-1.0.17/src/libsodium/include/sodium.h libsodium-1.0.18/src/libsodium/include/sodium.h --- libsodium-1.0.17/src/libsodium/include/sodium.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/include/sodium.h 2019-05-30 20:13:18.000000000 +0000 @@ -48,10 +48,7 @@ #include "sodium/crypto_verify_32.h" #include "sodium/crypto_verify_64.h" #include "sodium/randombytes.h" -#ifdef __native_client__ -# include "sodium/randombytes_nativeclient.h" -#endif -#include "sodium/randombytes_salsa20_random.h" +#include "sodium/randombytes_internal_random.h" #include "sodium/randombytes_sysrandom.h" #include "sodium/runtime.h" #include "sodium/utils.h" @@ -59,7 +56,9 @@ #ifndef SODIUM_LIBRARY_MINIMAL # include "sodium/crypto_box_curve25519xchacha20poly1305.h" # include "sodium/crypto_core_ed25519.h" +# include "sodium/crypto_core_ristretto255.h" # include "sodium/crypto_scalarmult_ed25519.h" +# include "sodium/crypto_scalarmult_ristretto255.h" # include "sodium/crypto_secretbox_xchacha20poly1305.h" # include "sodium/crypto_pwhash_scryptsalsa208sha256.h" # include "sodium/crypto_stream_salsa2012.h" diff -Nru libsodium-1.0.17/src/libsodium/Makefile.am libsodium-1.0.18/src/libsodium/Makefile.am --- libsodium-1.0.17/src/libsodium/Makefile.am 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/Makefile.am 2019-05-30 20:13:18.000000000 +0000 @@ -152,6 +152,7 @@ crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c \ crypto_box/curve25519xchacha20poly1305/box_seal_curve25519xchacha20poly1305.c \ crypto_core/ed25519/core_ed25519.c \ + crypto_core/ed25519/core_ristretto255.c \ crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c \ crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h \ crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c \ @@ -160,6 +161,7 @@ crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c \ crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c \ crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c \ + crypto_scalarmult/ristretto255/ref10/scalarmult_ristretto255_ref10.c \ crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c \ crypto_shorthash/siphash24/shorthash_siphashx24.c \ crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c \ @@ -171,7 +173,7 @@ crypto_stream/xchacha20/stream_xchacha20.c endif -randombytes_salsa20_randombytes_salsa20_random_CFLAGS = @CFLAGS_RDRAND@ +randombytes_internal_randombytes_internal_random_CFLAGS = @CFLAGS_RDRAND@ libsodium_la_LDFLAGS = \ $(AM_LDFLAGS) \ @@ -202,22 +204,16 @@ librdrand_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \ @CFLAGS_RDRAND@ librdrand_la_SOURCES = \ - randombytes/salsa20/randombytes_salsa20_random.c + randombytes/internal/randombytes_internal_random.c if !EMSCRIPTEN libsodium_la_LIBADD += librdrand.la noinst_LTLIBRARIES += librdrand.la -if NATIVECLIENT -libsodium_la_SOURCES += \ - randombytes/nativeclient/randombytes_nativeclient.c -else libsodium_la_SOURCES += \ randombytes/sysrandom/randombytes_sysrandom.c endif -endif - libaesni_la_LDFLAGS = $(libsodium_la_LDFLAGS) libaesni_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \ @CFLAGS_SSE2@ @CFLAGS_SSSE3@ @CFLAGS_AESNI@ @CFLAGS_PCLMUL@ diff -Nru libsodium-1.0.17/src/libsodium/randombytes/internal/randombytes_internal_random.c libsodium-1.0.18/src/libsodium/randombytes/internal/randombytes_internal_random.c --- libsodium-1.0.17/src/libsodium/randombytes/internal/randombytes_internal_random.c 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/randombytes/internal/randombytes_internal_random.c 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,631 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#if !defined(_MSC_VER) && !defined(__BORLANDC__) +# include +#endif + +#include +#ifndef _WIN32 +# include +# include +#endif +#ifdef __linux__ +# define _LINUX_SOURCE +#endif +#ifdef HAVE_SYS_RANDOM_H +# include +#endif +#ifdef __linux__ +# ifdef HAVE_GETRANDOM +# define HAVE_LINUX_COMPATIBLE_GETRANDOM +# else +# include +# if defined(SYS_getrandom) && defined(__NR_getrandom) +# define getrandom(B, S, F) syscall(SYS_getrandom, (B), (int) (S), (F)) +# define HAVE_LINUX_COMPATIBLE_GETRANDOM +# endif +# endif +#elif defined(__FreeBSD__) +# include +# if defined(__FreeBSD_version) && __FreeBSD_version >= 1200000 +# define HAVE_LINUX_COMPATIBLE_GETRANDOM +# endif +#endif +#if !defined(NO_BLOCKING_RANDOM_POLL) && defined(__linux__) +# define BLOCK_ON_DEV_RANDOM +#endif +#ifdef BLOCK_ON_DEV_RANDOM +# include +#endif +#ifdef HAVE_RDRAND +# pragma GCC target("rdrnd") +# include +#endif + +#include "core.h" +#include "crypto_core_hchacha20.h" +#include "crypto_stream_chacha20.h" +#include "private/common.h" +#include "randombytes.h" +#include "randombytes_internal_random.h" +#include "runtime.h" +#include "utils.h" + +#ifdef _WIN32 +# include +# include +# define RtlGenRandom SystemFunction036 +# if defined(__cplusplus) +extern "C" +# endif +BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength); +# pragma comment(lib, "advapi32.lib") +# ifdef __BORLANDC__ +# define _ftime ftime +# define _timeb timeb +# endif +#endif + +#define INTERNAL_RANDOM_BLOCK_SIZE crypto_core_hchacha20_OUTPUTBYTES + +#if defined(__OpenBSD__) || defined(__CloudABI__) || defined(__wasi__) +# define HAVE_SAFE_ARC4RANDOM 1 +#endif +#if defined(__CloudABI__) || defined(__wasm__) +# define NONEXISTENT_DEV_RANDOM 1 +#endif + +#ifndef SSIZE_MAX +# define SSIZE_MAX (SIZE_MAX / 2 - 1) +#endif +#ifndef S_ISNAM +# ifdef __COMPCERT__ +# define S_ISNAM(X) 1 +# else +# define S_ISNAM(X) 0 +# endif +#endif + +#ifndef TLS +# ifdef _WIN32 +# define TLS __declspec(thread) +# else +# define TLS +# endif +#endif + +typedef struct InternalRandomGlobal_ { + int initialized; + int random_data_source_fd; + int getentropy_available; + int getrandom_available; + int rdrand_available; +#ifdef HAVE_GETPID + pid_t pid; +#endif +} InternalRandomGlobal; + +typedef struct InternalRandom_ { + int initialized; + size_t rnd32_outleft; + unsigned char key[crypto_stream_chacha20_KEYBYTES]; + unsigned char rnd32[16U * INTERNAL_RANDOM_BLOCK_SIZE]; + uint64_t nonce; +} InternalRandom; + +static InternalRandomGlobal global = { + SODIUM_C99(.initialized =) 0, + SODIUM_C99(.random_data_source_fd =) -1 +}; + +static TLS InternalRandom stream = { + SODIUM_C99(.initialized =) 0, + SODIUM_C99(.rnd32_outleft =) (size_t) 0U +}; + + +/* + * Get a high-resolution timestamp, as a uint64_t value + */ + +#ifdef _WIN32 +static uint64_t +sodium_hrtime(void) +{ + struct _timeb tb; +# pragma warning(push) +# pragma warning(disable: 4996) + _ftime(&tb); +# pragma warning(pop) + return ((uint64_t) tb.time) * 1000000U + ((uint64_t) tb.millitm) * 1000U; +} + +#else /* _WIN32 */ + +static uint64_t +sodium_hrtime(void) +{ + struct timeval tv; + + if (gettimeofday(&tv, NULL) != 0) { + sodium_misuse(); /* LCOV_EXCL_LINE */ + } + return ((uint64_t) tv.tv_sec) * 1000000U + (uint64_t) tv.tv_usec; +} +#endif /* _WIN32 */ + +/* + * Initialize the entropy source + */ + +#ifdef _WIN32 + +static void +randombytes_internal_random_init(void) +{ + global.rdrand_available = sodium_runtime_has_rdrand(); +} + +#else /* _WIN32 */ + +# ifdef HAVE_GETENTROPY +static int +_randombytes_getentropy(void * const buf, const size_t size) +{ + assert(size <= 256U); + if (getentropy(buf, size) != 0) { + return -1; /* LCOV_EXCL_LINE */ + } + return 0; +} + +static int +randombytes_getentropy(void * const buf_, size_t size) +{ + unsigned char *buf = (unsigned char *) buf_; + size_t chunk_size = 256U; + + do { + if (size < chunk_size) { + chunk_size = size; + assert(chunk_size > (size_t) 0U); + } + if (_randombytes_getentropy(buf, chunk_size) != 0) { + return -1; /* LCOV_EXCL_LINE */ + } + size -= chunk_size; + buf += chunk_size; + } while (size > (size_t) 0U); + + return 0; +} + +# elif defined(HAVE_LINUX_COMPATIBLE_GETRANDOM) + +static int +_randombytes_linux_getrandom(void * const buf, const size_t size) +{ + int readnb; + + assert(size <= 256U); + do { + readnb = getrandom(buf, size, 0); + } while (readnb < 0 && (errno == EINTR || errno == EAGAIN)); + + return (readnb == (int) size) - 1; +} + +static int +randombytes_linux_getrandom(void * const buf_, size_t size) +{ + unsigned char *buf = (unsigned char *) buf_; + size_t chunk_size = 256U; + + do { + if (size < chunk_size) { + chunk_size = size; + assert(chunk_size > (size_t) 0U); + } + if (_randombytes_linux_getrandom(buf, chunk_size) != 0) { + return -1; + } + size -= chunk_size; + buf += chunk_size; + } while (size > (size_t) 0U); + + return 0; +} +# endif + +# ifndef NONEXISTENT_DEV_RANDOM + +# ifdef BLOCK_ON_DEV_RANDOM +static int +randombytes_block_on_dev_random(void) +{ + struct pollfd pfd; + int fd; + int pret; + + fd = open("/dev/random", O_RDONLY); + if (fd == -1) { + return 0; + } + pfd.fd = fd; + pfd.events = POLLIN; + pfd.revents = 0; + do { + pret = poll(&pfd, 1, -1); + } while (pret < 0 && (errno == EINTR || errno == EAGAIN)); + if (pret != 1) { + (void) close(fd); + errno = EIO; + return -1; + } + return close(fd); +} +# endif + +/* LCOV_EXCL_START */ +static int +randombytes_internal_random_random_dev_open(void) +{ + struct stat st; + static const char *devices[] = { +# ifndef USE_BLOCKING_RANDOM + "/dev/urandom", +# endif + "/dev/random", NULL + }; + const char **device = devices; + int fd; + +# ifdef BLOCK_ON_DEV_RANDOM + if (randombytes_block_on_dev_random() != 0) { + return -1; + } +# endif + do { + fd = open(*device, O_RDONLY); + if (fd != -1) { + if (fstat(fd, &st) == 0 && (S_ISNAM(st.st_mode) || S_ISCHR(st.st_mode))) { +# if defined(F_SETFD) && defined(FD_CLOEXEC) + (void) fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); +# endif + return fd; + } + (void) close(fd); + } else if (errno == EINTR) { + continue; + } + device++; + } while (*device != NULL); + + errno = EIO; + return -1; +} +/* LCOV_EXCL_STOP */ + +static ssize_t +safe_read(const int fd, void * const buf_, size_t size) +{ + unsigned char *buf = (unsigned char *) buf_; + ssize_t readnb; + + assert(size > (size_t) 0U); + assert(size <= SSIZE_MAX); + do { + while ((readnb = read(fd, buf, size)) < (ssize_t) 0 && + (errno == EINTR || errno == EAGAIN)); /* LCOV_EXCL_LINE */ + if (readnb < (ssize_t) 0) { + return readnb; /* LCOV_EXCL_LINE */ + } + if (readnb == (ssize_t) 0) { + break; /* LCOV_EXCL_LINE */ + } + size -= (size_t) readnb; + buf += readnb; + } while (size > (ssize_t) 0); + + return (ssize_t) (buf - (unsigned char *) buf_); +} + +# endif /* !NONEXISTENT_DEV_RANDOM */ + +static void +randombytes_internal_random_init(void) +{ + const int errno_save = errno; + + global.rdrand_available = sodium_runtime_has_rdrand(); + global.getentropy_available = 0; + global.getrandom_available = 0; + +# ifdef HAVE_GETENTROPY + { + unsigned char fodder[16]; + + if (randombytes_getentropy(fodder, sizeof fodder) == 0) { + global.getentropy_available = 1; + errno = errno_save; + return; + } + } +# elif defined(HAVE_LINUX_COMPATIBLE_GETRANDOM) + { + unsigned char fodder[16]; + + if (randombytes_linux_getrandom(fodder, sizeof fodder) == 0) { + global.getrandom_available = 1; + errno = errno_save; + return; + } + } +# endif +/* LCOV_EXCL_START */ +# if !defined(NONEXISTENT_DEV_RANDOM) + assert((global.getentropy_available | global.getrandom_available) == 0); + if ((global.random_data_source_fd = + randombytes_internal_random_random_dev_open()) == -1) { + sodium_misuse(); /* LCOV_EXCL_LINE */ + } + errno = errno_save; + return; +# endif +/* LCOV_EXCL_STOP */ +# ifndef HAVE_SAFE_ARC4RANDOM + sodium_misuse(); +# endif +} + +#endif /* _WIN32 */ + +/* + * (Re)seed the generator using the entropy source + */ + +static void +randombytes_internal_random_stir(void) +{ + stream.nonce = sodium_hrtime(); + assert(stream.nonce != (uint64_t) 0U); + memset(stream.rnd32, 0, sizeof stream.rnd32); + stream.rnd32_outleft = (size_t) 0U; + if (global.initialized == 0) { + randombytes_internal_random_init(); + global.initialized = 1; + } +#ifdef HAVE_GETPID + global.pid = getpid(); +#endif + +#ifndef _WIN32 + +# ifdef HAVE_GETENTROPY + if (global.getentropy_available != 0) { + if (randombytes_getentropy(stream.key, sizeof stream.key) != 0) { + sodium_misuse(); /* LCOV_EXCL_LINE */ + } + } +# elif defined(HAVE_LINUX_COMPATIBLE_GETRANDOM) + if (global.getrandom_available != 0) { + if (randombytes_linux_getrandom(stream.key, sizeof stream.key) != 0) { + sodium_misuse(); /* LCOV_EXCL_LINE */ + } + } +# elif defined(NONEXISTENT_DEV_RANDOM) && defined(HAVE_SAFE_ARC4RANDOM) + arc4random_buf(stream.key, sizeof stream.key); +# elif !defined(NONEXISTENT_DEV_RANDOM) + if (global.random_data_source_fd == -1 || + safe_read(global.random_data_source_fd, stream.key, + sizeof stream.key) != (ssize_t) sizeof stream.key) { + sodium_misuse(); /* LCOV_EXCL_LINE */ + } +# else + sodium_misuse(); +# endif + +#else /* _WIN32 */ + if (! RtlGenRandom((PVOID) stream.key, (ULONG) sizeof stream.key)) { + sodium_misuse(); /* LCOV_EXCL_LINE */ + } +#endif + + stream.initialized = 1; +} + +/* + * Reseed the generator if it hasn't been initialized yet + */ + +static void +randombytes_internal_random_stir_if_needed(void) +{ +#ifdef HAVE_GETPID + if (stream.initialized == 0) { + randombytes_internal_random_stir(); + } else if (global.pid != getpid()) { + sodium_misuse(); /* LCOV_EXCL_LINE */ + } +#else + if (stream.initialized == 0) { + randombytes_internal_random_stir(); + } +#endif +} + +/* + * Close the stream, free global resources + */ + +#ifdef _WIN32 +static int +randombytes_internal_random_close(void) +{ + int ret = -1; + + if (global.initialized != 0) { + global.initialized = 0; + ret = 0; + } + sodium_memzero(&stream, sizeof stream); + + return ret; +} +#else +static int +randombytes_internal_random_close(void) +{ + int ret = -1; + +# ifdef HAVE_GETENTROPY + if (global.getentropy_available != 0) { + ret = 0; + } +# elif defined(HAVE_LINUX_COMPATIBLE_GETRANDOM) + if (global.getrandom_available != 0) { + ret = 0; + } +# elif !defined(NONEXISTENT_DEV_RANDOM) && defined(HAVE_SAFE_ARC4RANDOM) + ret = 0; +# else + if (global.random_data_source_fd != -1 && + close(global.random_data_source_fd) == 0) { + global.random_data_source_fd = -1; + global.initialized = 0; +# ifdef HAVE_GETPID + global.pid = (pid_t) 0; +# endif + ret = 0; + } +# endif + + sodium_memzero(&stream, sizeof stream); + + return ret; +} +#endif + +/* + * RDRAND is only used to mitigate prediction if a key is compromised + */ + +static void +randombytes_internal_random_xorhwrand(void) +{ +/* LCOV_EXCL_START */ +#ifdef HAVE_RDRAND + unsigned int r; + + if (global.rdrand_available == 0) { + return; + } + (void) _rdrand32_step(&r); + * (uint32_t *) (void *) + &stream.key[crypto_stream_chacha20_KEYBYTES - 4] ^= (uint32_t) r; +#endif +/* LCOV_EXCL_STOP */ +} + +/* + * XOR the key with another same-length secret + */ + +static inline void +randombytes_internal_random_xorkey(const unsigned char * const mix) +{ + unsigned char *key = stream.key; + size_t i; + + for (i = (size_t) 0U; i < sizeof stream.key; i++) { + key[i] ^= mix[i]; + } +} + +/* + * Put `size` random bytes into `buf` and overwrite the key + */ + +static void +randombytes_internal_random_buf(void * const buf, const size_t size) +{ + size_t i; + int ret; + + randombytes_internal_random_stir_if_needed(); + COMPILER_ASSERT(sizeof stream.nonce == crypto_stream_chacha20_NONCEBYTES); +#if defined(ULLONG_MAX) && defined(SIZE_MAX) +# if SIZE_MAX > ULLONG_MAX + /* coverity[result_independent_of_operands] */ + assert(size <= ULLONG_MAX); +# endif +#endif + ret = crypto_stream_chacha20((unsigned char *) buf, (unsigned long long) size, + (unsigned char *) &stream.nonce, stream.key); + assert(ret == 0); + for (i = 0U; i < sizeof size; i++) { + stream.key[i] ^= ((const unsigned char *) (const void *) &size)[i]; + } + randombytes_internal_random_xorhwrand(); + stream.nonce++; + crypto_stream_chacha20_xor(stream.key, stream.key, sizeof stream.key, + (unsigned char *) &stream.nonce, stream.key); +} + +/* + * Pop a 32-bit value from the random pool + * + * Overwrite the key after the pool gets refilled. + */ + +static uint32_t +randombytes_internal_random(void) +{ + uint32_t val; + int ret; + + COMPILER_ASSERT(sizeof stream.rnd32 >= (sizeof stream.key) + (sizeof val)); + COMPILER_ASSERT(((sizeof stream.rnd32) - (sizeof stream.key)) + % sizeof val == (size_t) 0U); + if (stream.rnd32_outleft <= (size_t) 0U) { + randombytes_internal_random_stir_if_needed(); + COMPILER_ASSERT(sizeof stream.nonce == crypto_stream_chacha20_NONCEBYTES); + ret = crypto_stream_chacha20((unsigned char *) stream.rnd32, + (unsigned long long) sizeof stream.rnd32, + (unsigned char *) &stream.nonce, + stream.key); + assert(ret == 0); + stream.rnd32_outleft = (sizeof stream.rnd32) - (sizeof stream.key); + randombytes_internal_random_xorhwrand(); + randombytes_internal_random_xorkey(&stream.rnd32[stream.rnd32_outleft]); + memset(&stream.rnd32[stream.rnd32_outleft], 0, sizeof stream.key); + stream.nonce++; + } + stream.rnd32_outleft -= sizeof val; + memcpy(&val, &stream.rnd32[stream.rnd32_outleft], sizeof val); + memset(&stream.rnd32[stream.rnd32_outleft], 0, sizeof val); + + return val; +} + +static const char * +randombytes_internal_implementation_name(void) +{ + return "internal"; +} + +struct randombytes_implementation randombytes_internal_implementation = { + SODIUM_C99(.implementation_name =) randombytes_internal_implementation_name, + SODIUM_C99(.random =) randombytes_internal_random, + SODIUM_C99(.stir =) randombytes_internal_random_stir, + SODIUM_C99(.uniform =) NULL, + SODIUM_C99(.buf =) randombytes_internal_random_buf, + SODIUM_C99(.close =) randombytes_internal_random_close +}; diff -Nru libsodium-1.0.17/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c libsodium-1.0.18/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c --- libsodium-1.0.17/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ - -#include -#include -#include - -#ifdef __native_client__ -# include - -# include "core.h" -# include "utils.h" -# include "randombytes.h" -# include "randombytes_nativeclient.h" - -static void -randombytes_nativeclient_buf(void * const buf, const size_t size) -{ - unsigned char *buf_ = (unsigned char *) buf; - struct nacl_irt_random rand_intf; - size_t readnb = (size_t) 0U; - size_t toread = size; - - if (nacl_interface_query(NACL_IRT_RANDOM_v0_1, &rand_intf, - sizeof rand_intf) != sizeof rand_intf) { - sodium_misuse(); - } - while (toread > (size_t) 0U) { - if (rand_intf.get_random_bytes(buf_, size, &readnb) != 0 || - readnb > size) { - sodium_misuse(); - } - toread -= readnb; - buf_ += readnb; - } -} - -static uint32_t -randombytes_nativeclient_random(void) -{ - uint32_t r; - - randombytes_nativeclient_buf(&r, sizeof r); - - return r; -} - -static const char * -randombytes_nativeclient_implementation_name(void) -{ - return "nativeclient"; -} - -struct randombytes_implementation randombytes_nativeclient_implementation = { - SODIUM_C99(.implementation_name =) randombytes_nativeclient_implementation_name, - SODIUM_C99(.random =) randombytes_nativeclient_random, - SODIUM_C99(.stir =) NULL, - SODIUM_C99(.uniform =) NULL, - SODIUM_C99(.buf =) randombytes_nativeclient_buf, - SODIUM_C99(.close =) NULL -}; - -#endif diff -Nru libsodium-1.0.17/src/libsodium/randombytes/randombytes.c libsodium-1.0.18/src/libsodium/randombytes/randombytes.c --- libsodium-1.0.17/src/libsodium/randombytes/randombytes.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/randombytes/randombytes.c 2019-05-30 20:13:18.000000000 +0000 @@ -13,14 +13,11 @@ #include "core.h" #include "crypto_stream_chacha20.h" #include "randombytes.h" -#ifdef RANDOMBYTES_DEFAULT_IMPLEMENTATION -# include "randombytes_default.h" -#else -# ifdef __native_client__ -# include "randombytes_nativeclient.h" -# else -# include "randombytes_sysrandom.h" +#ifndef RANDOMBYTES_CUSTOM_IMPLEMENTATION +# ifdef RANDOMBYTES_DEFAULT_IMPLEMENTATION +# include "randombytes_internal.h" # endif +# include "randombytes_sysrandom.h" #endif #include "private/common.h" @@ -33,11 +30,7 @@ # ifdef __EMSCRIPTEN__ # define RANDOMBYTES_DEFAULT_IMPLEMENTATION NULL # else -# ifdef __native_client__ -# define RANDOMBYTES_DEFAULT_IMPLEMENTATION &randombytes_nativeclient_implementation; -# else -# define RANDOMBYTES_DEFAULT_IMPLEMENTATION &randombytes_sysrandom_implementation; -# endif +# define RANDOMBYTES_DEFAULT_IMPLEMENTATION &randombytes_sysrandom_implementation; # endif #endif diff -Nru libsodium-1.0.17/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c libsodium-1.0.18/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c --- libsodium-1.0.17/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,569 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#include -#include -#if !defined(_MSC_VER) && !defined(__BORLANDC__) -# include -#endif - -#include -#ifndef _WIN32 -# include -# include -#endif -#ifdef __linux__ -# ifdef __dietlibc__ -# define _LINUX_SOURCE -# include -# define HAVE_LINUX_COMPATIBLE_GETRANDOM -# else /* __dietlibc__ */ -# include -# if defined(SYS_getrandom) && defined(__NR_getrandom) -# define getrandom(B, S, F) syscall(SYS_getrandom, (B), (int) (S), (F)) -# define HAVE_LINUX_COMPATIBLE_GETRANDOM -# endif -# endif /* __dietlibc__ */ -#elif defined(__FreeBSD__) -# include -# if defined(__FreeBSD_version) && __FreeBSD_version >= 1200000 -# include -# define HAVE_LINUX_COMPATIBLE_GETRANDOM -# endif -#endif -#if !defined(NO_BLOCKING_RANDOM_POLL) && defined(__linux__) -# define BLOCK_ON_DEV_RANDOM -#endif -#ifdef BLOCK_ON_DEV_RANDOM -# include -#endif -#ifdef HAVE_RDRAND -# pragma GCC target("rdrnd") -# include -#endif - -#include "core.h" -#include "crypto_core_salsa20.h" -#include "crypto_stream_salsa20.h" -#include "private/common.h" -#include "randombytes.h" -#include "randombytes_salsa20_random.h" -#include "runtime.h" -#include "utils.h" - -#ifdef _WIN32 -# include -# include -# define RtlGenRandom SystemFunction036 -# if defined(__cplusplus) -extern "C" -# endif -BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength); -# pragma comment(lib, "advapi32.lib") -# ifdef __BORLANDC__ -# define _ftime ftime -# define _timeb timeb -# endif -#endif - -#define SALSA20_RANDOM_BLOCK_SIZE crypto_core_salsa20_OUTPUTBYTES - -#if defined(__OpenBSD__) || defined(__CloudABI__) -# define HAVE_SAFE_ARC4RANDOM 1 -#endif - -#ifndef SSIZE_MAX -# define SSIZE_MAX (SIZE_MAX / 2 - 1) -#endif -#ifndef S_ISNAM -# ifdef __COMPCERT__ -# define S_ISNAM(X) 1 -# else -# define S_ISNAM(X) 0 -# endif -#endif - -#ifndef TLS -# ifdef _WIN32 -# define TLS __declspec(thread) -# else -# define TLS -# endif -#endif - -typedef struct Salsa20RandomGlobal_ { - int initialized; - int random_data_source_fd; - int getrandom_available; - int rdrand_available; -#ifdef HAVE_GETPID - pid_t pid; -#endif -} Salsa20RandomGlobal; - -typedef struct Salsa20Random_ { - int initialized; - size_t rnd32_outleft; - unsigned char key[crypto_stream_salsa20_KEYBYTES]; - unsigned char rnd32[16U * SALSA20_RANDOM_BLOCK_SIZE]; - uint64_t nonce; -} Salsa20Random; - -static Salsa20RandomGlobal global = { - SODIUM_C99(.initialized =) 0, - SODIUM_C99(.random_data_source_fd =) -1 -}; - -static TLS Salsa20Random stream = { - SODIUM_C99(.initialized =) 0, - SODIUM_C99(.rnd32_outleft =) (size_t) 0U -}; - - -/* - * Get a high-resolution timestamp, as a uint64_t value - */ - -#ifdef _WIN32 -static uint64_t -sodium_hrtime(void) -{ - struct _timeb tb; -# pragma warning(push) -# pragma warning(disable: 4996) - _ftime(&tb); -# pragma warning(pop) - return ((uint64_t) tb.time) * 1000000U + ((uint64_t) tb.millitm) * 1000U; -} - -#else /* _WIN32 */ - -static uint64_t -sodium_hrtime(void) -{ - struct timeval tv; - - if (gettimeofday(&tv, NULL) != 0) { - sodium_misuse(); /* LCOV_EXCL_LINE */ - } - return ((uint64_t) tv.tv_sec) * 1000000U + (uint64_t) tv.tv_usec; -} -#endif - -/* - * Initialize the entropy source - */ - -#ifdef _WIN32 - -static void -randombytes_salsa20_random_init(void) -{ - global.rdrand_available = sodium_runtime_has_rdrand(); -} - -#else /* _WIN32 */ - -static ssize_t -safe_read(const int fd, void * const buf_, size_t size) -{ - unsigned char *buf = (unsigned char *) buf_; - ssize_t readnb; - - assert(size > (size_t) 0U); - assert(size <= SSIZE_MAX); - do { - while ((readnb = read(fd, buf, size)) < (ssize_t) 0 && - (errno == EINTR || errno == EAGAIN)); /* LCOV_EXCL_LINE */ - if (readnb < (ssize_t) 0) { - return readnb; /* LCOV_EXCL_LINE */ - } - if (readnb == (ssize_t) 0) { - break; /* LCOV_EXCL_LINE */ - } - size -= (size_t) readnb; - buf += readnb; - } while (size > (ssize_t) 0); - - return (ssize_t) (buf - (unsigned char *) buf_); -} - -# ifdef BLOCK_ON_DEV_RANDOM -static int -randombytes_block_on_dev_random(void) -{ - struct pollfd pfd; - int fd; - int pret; - - fd = open("/dev/random", O_RDONLY); - if (fd == -1) { - return 0; - } - pfd.fd = fd; - pfd.events = POLLIN; - pfd.revents = 0; - do { - pret = poll(&pfd, 1, -1); - } while (pret < 0 && (errno == EINTR || errno == EAGAIN)); - if (pret != 1) { - (void) close(fd); - errno = EIO; - return -1; - } - return close(fd); -} -# endif - -# ifndef HAVE_SAFE_ARC4RANDOM -static int -randombytes_salsa20_random_random_dev_open(void) -{ -/* LCOV_EXCL_START */ - struct stat st; - static const char *devices[] = { -# ifndef USE_BLOCKING_RANDOM - "/dev/urandom", -# endif - "/dev/random", NULL - }; - const char **device = devices; - int fd; - -# ifdef BLOCK_ON_DEV_RANDOM - if (randombytes_block_on_dev_random() != 0) { - return -1; - } -# endif - do { - fd = open(*device, O_RDONLY); - if (fd != -1) { - if (fstat(fd, &st) == 0 && (S_ISNAM(st.st_mode) || S_ISCHR(st.st_mode))) { -# if defined(F_SETFD) && defined(FD_CLOEXEC) - (void) fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); -# endif - return fd; - } - (void) close(fd); - } else if (errno == EINTR) { - continue; - } - device++; - } while (*device != NULL); - - errno = EIO; - return -1; -/* LCOV_EXCL_STOP */ -} -# endif - -# ifdef HAVE_LINUX_COMPATIBLE_GETRANDOM -static int -_randombytes_linux_getrandom(void * const buf, const size_t size) -{ - int readnb; - - assert(size <= 256U); - do { - readnb = getrandom(buf, size, 0); - } while (readnb < 0 && (errno == EINTR || errno == EAGAIN)); - - return (readnb == (int) size) - 1; -} - -static int -randombytes_linux_getrandom(void * const buf_, size_t size) -{ - unsigned char *buf = (unsigned char *) buf_; - size_t chunk_size = 256U; - - do { - if (size < chunk_size) { - chunk_size = size; - assert(chunk_size > (size_t) 0U); - } - if (_randombytes_linux_getrandom(buf, chunk_size) != 0) { - return -1; - } - size -= chunk_size; - buf += chunk_size; - } while (size > (size_t) 0U); - - return 0; -} -# endif - -static void -randombytes_salsa20_random_init(void) -{ - const int errno_save = errno; - - global.rdrand_available = sodium_runtime_has_rdrand(); - -# ifdef HAVE_SAFE_ARC4RANDOM - errno = errno_save; -# else - -# ifdef HAVE_LINUX_COMPATIBLE_GETRANDOM - { - unsigned char fodder[16]; - - if (randombytes_linux_getrandom(fodder, sizeof fodder) == 0) { - global.getrandom_available = 1; - errno = errno_save; - return; - } - global.getrandom_available = 0; - } -# endif /* HAVE_LINUX_COMPATIBLE_GETRANDOM */ - - if ((global.random_data_source_fd = - randombytes_salsa20_random_random_dev_open()) == -1) { - sodium_misuse(); /* LCOV_EXCL_LINE */ - } - errno = errno_save; -# endif /* HAVE_SAFE_ARC4RANDOM */ -} - -#endif /* _WIN32 */ - -/* - * (Re)seed the generator using the entropy source - */ - -static void -randombytes_salsa20_random_stir(void) -{ - stream.nonce = sodium_hrtime(); - assert(stream.nonce != (uint64_t) 0U); - memset(stream.rnd32, 0, sizeof stream.rnd32); - stream.rnd32_outleft = (size_t) 0U; - if (global.initialized == 0) { - randombytes_salsa20_random_init(); - global.initialized = 1; - } -#ifdef HAVE_GETPID - global.pid = getpid(); -#endif - -#ifndef _WIN32 - -# ifdef HAVE_SAFE_ARC4RANDOM - arc4random_buf(stream.key, sizeof stream.key); -# elif defined(HAVE_LINUX_COMPATIBLE_GETRANDOM) - if (global.getrandom_available != 0) { - if (randombytes_linux_getrandom(stream.key, sizeof stream.key) != 0) { - sodium_misuse(); /* LCOV_EXCL_LINE */ - } - } else if (global.random_data_source_fd == -1 || - safe_read(global.random_data_source_fd, stream.key, - sizeof stream.key) != (ssize_t) sizeof stream.key) { - sodium_misuse(); /* LCOV_EXCL_LINE */ - } -# else - if (global.random_data_source_fd == -1 || - safe_read(global.random_data_source_fd, stream.key, - sizeof stream.key) != (ssize_t) sizeof stream.key) { - sodium_misuse(); /* LCOV_EXCL_LINE */ - } -# endif - -#else /* _WIN32 */ - if (! RtlGenRandom((PVOID) stream.key, (ULONG) sizeof stream.key)) { - sodium_misuse(); /* LCOV_EXCL_LINE */ - } -#endif - - stream.initialized = 1; -} - -/* - * Reseed the generator if it hasn't been initialized yet - */ - -static void -randombytes_salsa20_random_stir_if_needed(void) -{ -#ifdef HAVE_GETPID - if (stream.initialized == 0) { - randombytes_salsa20_random_stir(); - } else if (global.pid != getpid()) { - sodium_misuse(); /* LCOV_EXCL_LINE */ - } -#else - if (stream.initialized == 0) { - randombytes_salsa20_random_stir(); - } -#endif -} - -/* - * Close the stream, free global resources - */ - -#ifdef _WIN32 -static int -randombytes_salsa20_random_close(void) -{ - int ret = -1; - - if (global.initialized != 0) { - global.initialized = 0; - ret = 0; - } - sodium_memzero(&stream, sizeof stream); - - return ret; -} -#else -static int -randombytes_salsa20_random_close(void) -{ - int ret = -1; - - if (global.random_data_source_fd != -1 && - close(global.random_data_source_fd) == 0) { - global.random_data_source_fd = -1; - global.initialized = 0; -# ifdef HAVE_GETPID - global.pid = (pid_t) 0; -# endif - ret = 0; - } - -# ifdef HAVE_SAFE_ARC4RANDOM - ret = 0; -# endif - -# ifdef HAVE_LINUX_COMPATIBLE_GETRANDOM - if (global.getrandom_available != 0) { - ret = 0; - } -# endif - - sodium_memzero(&stream, sizeof stream); - - return ret; -} -#endif - -/* - * RDRAND is only used to mitigate prediction if a key is compromised - */ - -static void -randombytes_salsa20_random_xorhwrand(void) -{ -/* LCOV_EXCL_START */ -#ifdef HAVE_RDRAND - unsigned int r; - - if (global.rdrand_available == 0) { - return; - } - (void) _rdrand32_step(&r); - * (uint32_t *) (void *) - &stream.key[crypto_stream_salsa20_KEYBYTES - 4] ^= (uint32_t) r; -#endif -/* LCOV_EXCL_STOP */ -} - -/* - * XOR the key with another same-length secret - */ - -static inline void -randombytes_salsa20_random_xorkey(const unsigned char * const mix) -{ - unsigned char *key = stream.key; - size_t i; - - for (i = (size_t) 0U; i < sizeof stream.key; i++) { - key[i] ^= mix[i]; - } -} - -/* - * Put `size` random bytes into `buf` and overwrite the key - */ - -static void -randombytes_salsa20_random_buf(void * const buf, const size_t size) -{ - size_t i; - int ret; - - randombytes_salsa20_random_stir_if_needed(); - COMPILER_ASSERT(sizeof stream.nonce == crypto_stream_salsa20_NONCEBYTES); -#if defined(ULLONG_MAX) && defined(SIZE_MAX) -# if SIZE_MAX > ULLONG_MAX - /* coverity[result_independent_of_operands] */ - assert(size <= ULLONG_MAX); -# endif -#endif - ret = crypto_stream_salsa20((unsigned char *) buf, (unsigned long long) size, - (unsigned char *) &stream.nonce, stream.key); - assert(ret == 0); - for (i = 0U; i < sizeof size; i++) { - stream.key[i] ^= ((const unsigned char *) (const void *) &size)[i]; - } - randombytes_salsa20_random_xorhwrand(); - stream.nonce++; - crypto_stream_salsa20_xor(stream.key, stream.key, sizeof stream.key, - (unsigned char *) &stream.nonce, stream.key); -} - -/* - * Pop a 32-bit value from the random pool - * - * Overwrite the key after the pool gets refilled. - */ - -static uint32_t -randombytes_salsa20_random(void) -{ - uint32_t val; - int ret; - - COMPILER_ASSERT(sizeof stream.rnd32 >= (sizeof stream.key) + (sizeof val)); - COMPILER_ASSERT(((sizeof stream.rnd32) - (sizeof stream.key)) - % sizeof val == (size_t) 0U); - if (stream.rnd32_outleft <= (size_t) 0U) { - randombytes_salsa20_random_stir_if_needed(); - COMPILER_ASSERT(sizeof stream.nonce == crypto_stream_salsa20_NONCEBYTES); - ret = crypto_stream_salsa20((unsigned char *) stream.rnd32, - (unsigned long long) sizeof stream.rnd32, - (unsigned char *) &stream.nonce, - stream.key); - assert(ret == 0); - stream.rnd32_outleft = (sizeof stream.rnd32) - (sizeof stream.key); - randombytes_salsa20_random_xorhwrand(); - randombytes_salsa20_random_xorkey(&stream.rnd32[stream.rnd32_outleft]); - memset(&stream.rnd32[stream.rnd32_outleft], 0, sizeof stream.key); - stream.nonce++; - } - stream.rnd32_outleft -= sizeof val; - memcpy(&val, &stream.rnd32[stream.rnd32_outleft], sizeof val); - memset(&stream.rnd32[stream.rnd32_outleft], 0, sizeof val); - - return val; -} - -static const char * -randombytes_salsa20_implementation_name(void) -{ - return "salsa20"; -} - -struct randombytes_implementation randombytes_salsa20_implementation = { - SODIUM_C99(.implementation_name =) randombytes_salsa20_implementation_name, - SODIUM_C99(.random =) randombytes_salsa20_random, - SODIUM_C99(.stir =) randombytes_salsa20_random_stir, - SODIUM_C99(.uniform =) NULL, - SODIUM_C99(.buf =) randombytes_salsa20_random_buf, - SODIUM_C99(.close =) randombytes_salsa20_random_close -}; diff -Nru libsodium-1.0.17/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c libsodium-1.0.18/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c --- libsodium-1.0.17/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c 2019-05-30 20:13:18.000000000 +0000 @@ -8,29 +8,32 @@ #ifndef _WIN32 # include #endif - #include + #include #ifndef _WIN32 # include # include #endif #ifdef __linux__ -# ifdef __dietlibc__ -# define _LINUX_SOURCE -# include +# define _LINUX_SOURCE +#endif +#ifdef HAVE_SYS_RANDOM_H +# include +#endif +#ifdef __linux__ +# ifdef HAVE_GETRANDOM # define HAVE_LINUX_COMPATIBLE_GETRANDOM -# else /* __dietlibc__ */ +# else # include # if defined(SYS_getrandom) && defined(__NR_getrandom) # define getrandom(B, S, F) syscall(SYS_getrandom, (B), (int) (S), (F)) # define HAVE_LINUX_COMPATIBLE_GETRANDOM # endif -# endif /* __dietlibc */ +# endif #elif defined(__FreeBSD__) # include # if defined(__FreeBSD_version) && __FreeBSD_version >= 1200000 -# include # define HAVE_LINUX_COMPATIBLE_GETRANDOM # endif #endif @@ -72,7 +75,7 @@ # pragma comment(lib, "advapi32.lib") #endif -#if defined(__OpenBSD__) || defined(__CloudABI__) +#if defined(__OpenBSD__) || defined(__CloudABI__) || defined(__wasi__) # define HAVE_SAFE_ARC4RANDOM 1 #endif @@ -105,7 +108,7 @@ return 0; } -#else /* __OpenBSD__ */ +#else /* HAVE_SAFE_ARC4RANDOM */ typedef struct SysRandom_ { int random_data_source_fd; @@ -375,7 +378,7 @@ return r; } -#endif /* __OpenBSD__ */ +#endif /* HAVE_SAFE_ARC4RANDOM */ static const char * randombytes_sysrandom_implementation_name(void) diff -Nru libsodium-1.0.17/src/libsodium/sodium/core.c libsodium-1.0.18/src/libsodium/sodium/core.c --- libsodium-1.0.17/src/libsodium/sodium/core.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/sodium/core.c 2019-05-30 20:13:18.000000000 +0000 @@ -136,7 +136,7 @@ return pthread_mutex_unlock(&_sodium_lock); } -#elif defined(HAVE_ATOMIC_OPS) && !defined(__EMSCRIPTEN__) && !defined(__native_client__) +#elif defined(HAVE_ATOMIC_OPS) && !defined(__EMSCRIPTEN__) static volatile int _sodium_lock; diff -Nru libsodium-1.0.17/src/libsodium/sodium/runtime.c libsodium-1.0.18/src/libsodium/sodium/runtime.c --- libsodium-1.0.17/src/libsodium/sodium/runtime.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/sodium/runtime.c 2019-05-30 20:13:18.000000000 +0000 @@ -203,11 +203,13 @@ unsigned int cpu_info7[4]; _cpuid(cpu_info7, 0x00000007); + /* LCOV_EXCL_START */ if ((cpu_info7[1] & CPUID_EBX_AVX512F) == CPUID_EBX_AVX512F && (xcr0 & (XCR0_OPMASK | XCR0_ZMM_HI256 | XCR0_HI16_ZMM)) == (XCR0_OPMASK | XCR0_ZMM_HI256 | XCR0_HI16_ZMM)) { cpu_features->has_avx512f = 1; } + /* LCOV_EXCL_STOP */ } #endif diff -Nru libsodium-1.0.17/src/libsodium/sodium/utils.c libsodium-1.0.18/src/libsodium/sodium/utils.c --- libsodium-1.0.17/src/libsodium/sodium/utils.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/src/libsodium/sodium/utils.c 2019-05-30 20:13:18.000000000 +0000 @@ -100,7 +100,7 @@ /* LCOV_EXCL_STOP */ void -sodium_memzero(void *const pnt, const size_t len) +sodium_memzero(void * const pnt, const size_t len) { #ifdef _WIN32 SecureZeroMemory(pnt, len); @@ -113,8 +113,10 @@ #elif defined(HAVE_EXPLICIT_MEMSET) explicit_memset(pnt, 0, len); #elif HAVE_WEAK_SYMBOLS - memset(pnt, 0, len); - _sodium_dummy_symbol_to_prevent_memzero_lto(pnt, len); + if (len > 0U) { + memset(pnt, 0, len); + _sodium_dummy_symbol_to_prevent_memzero_lto(pnt, len); + } # ifdef HAVE_INLINE_ASM __asm__ __volatile__ ("" : : "r"(pnt) : "memory"); # endif @@ -481,10 +483,12 @@ __attribute__((noreturn)) static void _out_of_bounds(void) { -# ifdef SIGSEGV +# ifndef __wasm__ +# ifdef SIGSEGV raise(SIGSEGV); -# elif defined(SIGKILL) +# elif defined(SIGKILL) raise(SIGKILL); +# endif # endif abort(); /* not something we want any higher-level API to catch */ } /* LCOV_EXCL_LINE */ diff -Nru libsodium-1.0.17/test/constcheck.sh libsodium-1.0.18/test/constcheck.sh --- libsodium-1.0.17/test/constcheck.sh 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/constcheck.sh 2019-05-30 20:13:18.000000000 +0000 @@ -13,6 +13,7 @@ done echo "return 0; }" >> "$CT" +CPPFLAGS="${CPPFLAGS} -Wno-deprecated-declarations" ${CC:-cc} "$CT" $CPPFLAGS $CFLAGS $LDFLAGS -lsodium || exit 1 ./a.out || exit 1 rm -f a.out "$CT" diff -Nru libsodium-1.0.17/test/default/aead_xchacha20poly1305.c libsodium-1.0.18/test/default/aead_xchacha20poly1305.c --- libsodium-1.0.17/test/default/aead_xchacha20poly1305.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/aead_xchacha20poly1305.c 2019-05-30 20:13:18.000000000 +0000 @@ -20,7 +20,7 @@ }; #undef MESSAGE #define MESSAGE "Ladies and Gentlemen of the class of '99: If I could offer you " \ -"only one tip for the future, sunscreen would be it." + "only one tip for the future, sunscreen would be it." unsigned char *m = (unsigned char *) sodium_malloc(MLEN); static const unsigned char nonce[crypto_aead_xchacha20poly1305_ietf_NPUBBYTES] = { 0x07, 0x00, 0x00, 0x00, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, @@ -64,6 +64,10 @@ printf("detached ciphertext is bogus\n"); } + if (crypto_aead_xchacha20poly1305_ietf_decrypt(NULL, 0, NULL, c, CLEN, ad, + ADLEN, nonce, firstkey) != 0) { + printf("crypto_aead_xchacha20poly1305_ietf_decrypt() tag-only verification failed\n"); + } if (crypto_aead_xchacha20poly1305_ietf_decrypt(m2, &m2len, NULL, c, CLEN, ad, ADLEN, nonce, firstkey) != 0) { printf("crypto_aead_xchacha20poly1305_ietf_decrypt() failed\n"); diff -Nru libsodium-1.0.17/test/default/auth3.c libsodium-1.0.18/test/default/auth3.c --- libsodium-1.0.17/test/default/auth3.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/auth3.c 2019-05-30 20:13:18.000000000 +0000 @@ -25,7 +25,12 @@ int main(void) { + static unsigned char a2[crypto_auth_hmacsha256_BYTES]; + printf("%d\n", crypto_auth_hmacsha256_verify(a, c, sizeof c, key)); + crypto_auth_hmacsha256(a2, guard_page, 0U, key); + assert(crypto_auth_hmacsha256_verify(a2, guard_page, 0U, key) == 0); + return 0; } diff -Nru libsodium-1.0.17/test/default/auth5.c libsodium-1.0.18/test/default/auth5.c --- libsodium-1.0.17/test/default/auth5.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/auth5.c 2019-05-30 20:13:18.000000000 +0000 @@ -32,5 +32,10 @@ } } } + + crypto_auth_keygen(key); + crypto_auth(a, guard_page, 0U, key); + assert(crypto_auth_verify(a, guard_page, 0U, key) == 0); + return 0; } diff -Nru libsodium-1.0.17/test/default/auth7.c libsodium-1.0.18/test/default/auth7.c --- libsodium-1.0.17/test/default/auth7.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/auth7.c 2019-05-30 20:13:18.000000000 +0000 @@ -32,5 +32,10 @@ } } } + + crypto_auth_keygen(key); + crypto_auth_hmacsha512(a, guard_page, 0U, key); + assert(crypto_auth_hmacsha512_verify(a, guard_page, 0U, key) == 0); + return 0; } diff -Nru libsodium-1.0.17/test/default/auth.c libsodium-1.0.18/test/default/auth.c --- libsodium-1.0.17/test/default/auth.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/auth.c 2019-05-30 20:13:18.000000000 +0000 @@ -14,12 +14,14 @@ static unsigned char a[crypto_auth_BYTES]; static unsigned char a2[crypto_auth_hmacsha512_BYTES]; +static unsigned char a3[crypto_auth_hmacsha512_BYTES]; int main(void) { crypto_auth_hmacsha512_state st; crypto_auth_hmacsha256_state st256; + crypto_auth_hmacsha512256_state st512_256; size_t i; assert(crypto_auth_hmacsha512_statebytes() == @@ -65,6 +67,60 @@ printf("\n"); } + /* Empty message tests: HMAC-SHA512 */ + memset(a2, 0, sizeof a2); + crypto_auth_hmacsha512_init(&st, key, sizeof key); + crypto_auth_hmacsha512_final(&st, a2); + + memset(a3, 0, sizeof a3); + crypto_auth_hmacsha512_init(&st, key, sizeof key); + crypto_auth_hmacsha512_update(&st, a2, 0U); + crypto_auth_hmacsha512_final(&st, a3); + assert(sodium_memcmp(a2, a3, sizeof a2) == 0); + + memset(a3, 0, sizeof a3); + crypto_auth_hmacsha512_init(&st, key, sizeof key); + crypto_auth_hmacsha512_update(&st, guard_page, 0U); + crypto_auth_hmacsha512_final(&st, a3); + assert(sodium_memcmp(a2, a3, sizeof a2) == 0); + + /* Empty message tests: HMAC-SHA512-256 */ + memset(a2, 0, sizeof a2); + crypto_auth_hmacsha512256_init(&st512_256, key, sizeof key); + crypto_auth_hmacsha512256_final(&st512_256, a2); + + memset(a3, 0, sizeof a3); + crypto_auth_hmacsha512256_init(&st512_256, key, sizeof key); + crypto_auth_hmacsha512256_update(&st512_256, a2, 0U); + crypto_auth_hmacsha512256_final(&st512_256, a3); + assert(sodium_memcmp(a2, a3, sizeof a2) == 0); + + memset(a3, 0, sizeof a3); + crypto_auth_hmacsha512256_init(&st512_256, key, sizeof key); + crypto_auth_hmacsha512256_update(&st512_256, guard_page, 0U); + crypto_auth_hmacsha512256_final(&st512_256, a3); + assert(sodium_memcmp(a2, a3, sizeof a2) == 0); + + /* Empty message tests: HMAC-SHA256 */ + + memset(a2, 0, sizeof a2); + crypto_auth_hmacsha256_init(&st256, key, sizeof key); + crypto_auth_hmacsha256_final(&st256, a2); + + memset(a3, 0, sizeof a3); + crypto_auth_hmacsha256_init(&st256, key, sizeof key); + crypto_auth_hmacsha256_update(&st256, a2, 0U); + crypto_auth_hmacsha256_final(&st256, a3); + assert(sodium_memcmp(a2, a3, sizeof a2) == 0); + + memset(a3, 0, sizeof a3); + crypto_auth_hmacsha256_init(&st256, key, sizeof key); + crypto_auth_hmacsha256_update(&st256, guard_page, 0U); + crypto_auth_hmacsha256_final(&st256, a3); + assert(sodium_memcmp(a2, a3, sizeof a2) == 0); + + /* --- */ + assert(crypto_auth_bytes() > 0U); assert(crypto_auth_keybytes() > 0U); assert(strcmp(crypto_auth_primitive(), "hmacsha512256") == 0); diff -Nru libsodium-1.0.17/test/default/box_easy.c libsodium-1.0.18/test/default/box_easy.c --- libsodium-1.0.17/test/default/box_easy.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/box_easy.c 2019-05-30 20:13:18.000000000 +0000 @@ -50,12 +50,13 @@ /* Null message */ - ret = crypto_box_easy(c, c, 0, nonce, bobpk, alicesk); + ret = crypto_box_easy(c, guard_page, 0, nonce, bobpk, alicesk); assert(ret == 0); for (i = 0; i < 1 + crypto_box_MACBYTES; ++i) { printf(",0x%02x", (unsigned int) c[i]); } printf("\n"); + ret = crypto_box_open_easy(c, c, crypto_box_MACBYTES, nonce, bobpk, alicesk); assert(ret == 0); diff -Nru libsodium-1.0.17/test/default/box_seal.c libsodium-1.0.18/test/default/box_seal.c --- libsodium-1.0.17/test/default/box_seal.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/box_seal.c 2019-05-30 20:13:18.000000000 +0000 @@ -2,8 +2,8 @@ #define TEST_NAME "box_seal" #include "cmptest.h" -int -main(void) +static +void tv1(void) { unsigned char pk[crypto_box_PUBLICKEYBYTES]; unsigned char sk[crypto_box_SECRETKEYBYTES]; @@ -22,11 +22,11 @@ randombytes_buf(m, m_len); if (crypto_box_seal(c, m, m_len, pk) != 0) { printf("crypto_box_seal() failure\n"); - return 1; + return; } if (crypto_box_seal_open(m2, c, c_len, pk, sk) != 0) { printf("crypto_box_seal_open() failure\n"); - return 1; + return; } printf("%d\n", memcmp(m, m2, m_len)); @@ -39,6 +39,63 @@ sodium_free(m2); assert(crypto_box_sealbytes() == crypto_box_SEALBYTES); +} + +#ifndef SODIUM_LIBRARY_MINIMAL +static +void tv2(void) +{ + unsigned char pk[crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES]; + unsigned char sk[crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES]; + unsigned char *c; + unsigned char *m; + unsigned char *m2; + size_t m_len; + size_t c_len; + + crypto_box_curve25519xchacha20poly1305_keypair(pk, sk); + m_len = (size_t) randombytes_uniform(1000); + c_len = crypto_box_curve25519xchacha20poly1305_SEALBYTES + m_len; + m = (unsigned char *) sodium_malloc(m_len); + m2 = (unsigned char *) sodium_malloc(m_len); + c = (unsigned char *) sodium_malloc(c_len); + randombytes_buf(m, m_len); + if (crypto_box_curve25519xchacha20poly1305_seal(c, m, m_len, pk) != 0) { + printf("crypto_box_curve25519xchacha20poly1305_seal() failure\n"); + return; + } + if (crypto_box_curve25519xchacha20poly1305_seal_open(m2, c, c_len, pk, sk) != 0) { + printf("crypto_box_curve25519xchacha20poly1305_seal_open() failure\n"); + return; + } + printf("%d\n", memcmp(m, m2, m_len)); + + printf("%d\n", crypto_box_curve25519xchacha20poly1305_seal_open(m, c, 0U, pk, sk)); + printf("%d\n", crypto_box_curve25519xchacha20poly1305_seal_open(m, c, c_len - 1U, pk, sk)); + printf("%d\n", crypto_box_curve25519xchacha20poly1305_seal_open(m, c, c_len, sk, pk)); + + sodium_free(c); + sodium_free(m); + sodium_free(m2); + + assert(crypto_box_curve25519xchacha20poly1305_sealbytes() == + crypto_box_curve25519xchacha20poly1305_SEALBYTES); +} + +#else + +static +void tv2(void) +{ + printf("0\n-1\n-1\n-1\n"); +} +#endif + +int +main(void) +{ + tv1(); + tv2(); return 0; } diff -Nru libsodium-1.0.17/test/default/box_seal.exp libsodium-1.0.18/test/default/box_seal.exp --- libsodium-1.0.17/test/default/box_seal.exp 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/box_seal.exp 2019-05-30 20:13:18.000000000 +0000 @@ -2,3 +2,7 @@ -1 -1 -1 +0 +-1 +-1 +-1 diff -Nru libsodium-1.0.17/test/default/cmptest.h libsodium-1.0.18/test/default/cmptest.h --- libsodium-1.0.17/test/default/cmptest.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/cmptest.h 2019-05-30 20:13:18.000000000 +0000 @@ -178,11 +178,15 @@ if (sodium_init() != 0) { return 99; } +# if defined(__EMSCRIPTEN__) || defined(__SANITIZE_ADDRESS__) + guard_page = _guard_page = NULL; +#else if ((_guard_page = (unsigned char *) sodium_malloc(0)) == NULL) { perror("sodium_malloc()"); return 99; } guard_page = _guard_page + 1; +#endif if (xmain() != 0) { return 99; } diff -Nru libsodium-1.0.17/test/default/codecs.c libsodium-1.0.18/test/default/codecs.c --- libsodium-1.0.17/test/default/codecs.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/codecs.c 2019-05-30 20:13:18.000000000 +0000 @@ -20,6 +20,11 @@ printf("%s\n", sodium_bin2hex(buf3, 33U, (const unsigned char *) "0123456789ABCDEF", 16U)); + printf("bin2hex(..., guard_page, 0):%s\n", + sodium_bin2hex(buf3, sizeof buf3, guard_page, 0U)); + printf("bin2hex(..., \"\", 0):%s\n", + sodium_bin2hex(buf3, sizeof buf3, (const unsigned char *) "", 0U)); + hex = "Cafe : 6942"; sodium_hex2bin(buf4, sizeof buf4, hex, strlen(hex), ": ", &bin_len, &hex_end); @@ -79,6 +84,13 @@ printf("sodium_hex2bin() with an extra character and no end pointer\n"); } + assert(sodium_hex2bin(buf4, sizeof buf4, (const char *) guard_page, 0U, + NULL, &bin_len, NULL) == 0); + assert(bin_len == 0); + + assert(sodium_hex2bin(buf4, sizeof buf4, "", 0U, NULL, &bin_len, NULL) == 0); + assert(bin_len == 0); + printf("%s\n", sodium_bin2base64(buf3, 31U, (const unsigned char *) "\xfb\xf0\xf1" "0123456789ABCDEFab", 21U, sodium_base64_VARIANT_ORIGINAL)); @@ -201,6 +213,14 @@ assert(sodium_base642bin(buf1, sizeof buf1, "ka*w*=*", (size_t) 7U, "*~", NULL, NULL, sodium_base64_VARIANT_ORIGINAL) == 0); + assert(sodium_base642bin(buf1, sizeof buf1, (const char *) guard_page, 0U, + NULL, &bin_len, NULL, sodium_base64_VARIANT_ORIGINAL) == 0); + assert(bin_len == 0); + + assert(sodium_base642bin(buf1, sizeof buf1, "", 0U, NULL, &bin_len, NULL, + sodium_base64_VARIANT_ORIGINAL) == 0); + assert(bin_len == 0); + for (i = 0; i < 1000; i++) { assert(sizeof buf1 >= 100); bin_len = (size_t) randombytes_uniform(100); diff -Nru libsodium-1.0.17/test/default/codecs.exp libsodium-1.0.18/test/default/codecs.exp --- libsodium-1.0.17/test/default/codecs.exp 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/codecs.exp 2019-05-30 20:13:18.000000000 +0000 @@ -1,4 +1,6 @@ 30313233343536373839414243444546 +bin2hex(..., guard_page, 0): +bin2hex(..., "", 0): 4:cafe6942 dt1: 11 4:cafe6942 diff -Nru libsodium-1.0.17/test/default/core_ed25519.c libsodium-1.0.18/test/default/core_ed25519.c --- libsodium-1.0.17/test/default/core_ed25519.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/core_ed25519.c 2019-05-30 20:13:18.000000000 +0000 @@ -44,29 +44,43 @@ int main(void) { - unsigned char *h; + unsigned char *h, *r; unsigned char *p, *p2, *p3; unsigned char *sc, *sc2, *sc3; unsigned char *sc64; char *hex; unsigned int i, j; - h = (unsigned char *) sodium_malloc(crypto_core_ed25519_UNIFORMBYTES); + h = (unsigned char *) sodium_malloc(crypto_core_ed25519_HASHBYTES); + r = (unsigned char *) sodium_malloc(crypto_core_ed25519_UNIFORMBYTES); p = (unsigned char *) sodium_malloc(crypto_core_ed25519_BYTES); - for (i = 0; i < 1000; i++) { - randombytes_buf(h, crypto_core_ed25519_UNIFORMBYTES); - if (crypto_core_ed25519_from_uniform(p, h) != 0) { + for (i = 0; i < 500; i++) { + randombytes_buf(r, crypto_core_ed25519_UNIFORMBYTES); + if (crypto_core_ed25519_from_uniform(p, r) != 0) { printf("crypto_core_ed25519_from_uniform() failed\n"); } if (crypto_core_ed25519_is_valid_point(p) == 0) { printf("crypto_core_ed25519_from_uniform() returned an invalid point\n"); } + + randombytes_buf(h, crypto_core_ed25519_HASHBYTES); + if (crypto_core_ed25519_from_hash(p, h) != 0) { + printf("crypto_core_ed25519_from_hash() failed\n"); + } + if (crypto_core_ed25519_is_valid_point(p) == 0) { + printf("crypto_core_ed25519_from_hash() returned an invalid point\n"); + } + + crypto_core_ed25519_random(p); + if (crypto_core_ed25519_is_valid_point(p) == 0) { + printf("crypto_core_ed25519_random() returned an invalid point\n"); + } } p2 = (unsigned char *) sodium_malloc(crypto_core_ed25519_BYTES); p3 = (unsigned char *) sodium_malloc(crypto_core_ed25519_BYTES); - randombytes_buf(h, crypto_core_ed25519_UNIFORMBYTES); - crypto_core_ed25519_from_uniform(p2, h); + + crypto_core_ed25519_random(p2); j = 1 + (unsigned int) randombytes_uniform(100); memcpy(p3, p, crypto_core_ed25519_BYTES); @@ -145,9 +159,10 @@ assert(crypto_core_ed25519_sub(p3, non_canonical_invalid_p, p3) == -1); for (i = 0; i < 1000; i++) { - randombytes_buf(h, crypto_core_ed25519_UNIFORMBYTES); - crypto_core_ed25519_from_uniform(p, h); - crypto_core_ed25519_scalar_random(sc); + crypto_core_ed25519_random(p); + do { + crypto_core_ed25519_scalar_random(sc); + } while (sodium_is_zero(sc, crypto_core_ed25519_SCALARBYTES)); if (crypto_scalarmult_ed25519_noclamp(p2, sc, p) != 0) { printf("crypto_scalarmult_ed25519_noclamp() failed\n"); } @@ -175,8 +190,8 @@ printf("crypto_core_ed25519_scalar_reduce() failed\n"); } - randombytes_buf(h, crypto_core_ed25519_UNIFORMBYTES); - crypto_core_ed25519_from_uniform(p, h); + randombytes_buf(r, crypto_core_ed25519_UNIFORMBYTES); + crypto_core_ed25519_from_uniform(p, r); memcpy(p2, p, crypto_core_ed25519_BYTES); crypto_core_ed25519_scalar_random(sc); if (crypto_scalarmult_ed25519_noclamp(p, sc, p) != 0) { @@ -187,15 +202,14 @@ printf("crypto_scalarmult_ed25519_noclamp() failed (2)\n"); } crypto_core_ed25519_add(p3, p, p2); - crypto_core_ed25519_from_uniform(p, h); + crypto_core_ed25519_from_uniform(p, r); crypto_core_ed25519_sub(p, p, p3); assert(p[0] == 0x01); for (i = 1; i < crypto_core_ed25519_BYTES; i++) { assert(p[i] == 0); } - randombytes_buf(h, crypto_core_ed25519_UNIFORMBYTES); - crypto_core_ed25519_from_uniform(p, h); + crypto_core_ed25519_random(p); memcpy(p2, p, crypto_core_ed25519_BYTES); crypto_core_ed25519_scalar_random(sc); if (crypto_scalarmult_ed25519_noclamp(p, sc, p) != 0) { @@ -306,8 +320,8 @@ assert(sodium_is_zero(sc3, crypto_core_ed25519_SCALARBYTES)); } - memset(sc, 0x69, crypto_core_ed25519_UNIFORMBYTES); - memset(sc2, 0x42, crypto_core_ed25519_UNIFORMBYTES); + memset(sc, 0x69, crypto_core_ed25519_SCALARBYTES); + memset(sc2, 0x42, crypto_core_ed25519_SCALARBYTES); crypto_core_ed25519_scalar_add(sc, sc, sc2); crypto_core_ed25519_scalar_add(sc, sc2, sc); sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1, @@ -320,8 +334,8 @@ sc, crypto_core_ed25519_SCALARBYTES); printf("sub1: %s\n", hex); - memset(sc, 0xcd, crypto_core_ed25519_UNIFORMBYTES); - memset(sc2, 0x42, crypto_core_ed25519_UNIFORMBYTES); + memset(sc, 0xcd, crypto_core_ed25519_SCALARBYTES); + memset(sc2, 0x42, crypto_core_ed25519_SCALARBYTES); crypto_core_ed25519_scalar_add(sc, sc, sc2); crypto_core_ed25519_scalar_add(sc, sc2, sc); sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1, @@ -334,6 +348,45 @@ sc, crypto_core_ed25519_SCALARBYTES); printf("sub2: %s\n", hex); + memset(sc, 0x69, crypto_core_ed25519_SCALARBYTES); + memset(sc2, 0x42, crypto_core_ed25519_SCALARBYTES); + for (i = 0; i < 100; i++) { + crypto_core_ed25519_scalar_mul(sc, sc, sc2); + crypto_core_ed25519_scalar_mul(sc2, sc, sc2); + } + sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1, + sc2, crypto_core_ed25519_SCALARBYTES); + printf("mul: %s\n", hex); + for (i = 0; i < 1000; i++) { + crypto_core_ed25519_scalar_random(sc); + memset(sc2, 0, crypto_core_ed25519_SCALARBYTES); + crypto_core_ed25519_scalar_mul(sc3, sc, sc2); + assert(sodium_is_zero(sc3, crypto_core_ed25519_SCALARBYTES)); + + sc2[0]++; + crypto_core_ed25519_scalar_mul(sc3, sc, sc2); + assert(memcmp(sc3, sc, crypto_core_ed25519_SCALARBYTES) == 0); + + sc2[0]++; + crypto_core_ed25519_scalar_mul(sc3, sc, sc2); + crypto_core_ed25519_scalar_sub(sc3, sc3, sc); + crypto_core_ed25519_scalar_sub(sc3, sc3, sc); + assert(sodium_is_zero(sc3, crypto_core_ed25519_SCALARBYTES)); + + do { + crypto_core_ed25519_scalar_random(sc2); + } while (sodium_is_zero(sc2, crypto_core_ed25519_SCALARBYTES)); + crypto_core_ed25519_scalar_mul(sc3, sc, sc2); + crypto_core_ed25519_scalar_invert(sc2, sc2); + crypto_core_ed25519_scalar_mul(sc3, sc3, sc2); + assert(memcmp(sc3, sc, crypto_core_ed25519_SCALARBYTES) == 0); + + sc[31] |= 0x11; + memset(sc2, 0, crypto_core_ed25519_SCALARBYTES); + sc2[0] = 1; + crypto_core_ed25519_scalar_mul(sc3, sc, sc2); + assert(memcmp(sc3, sc, crypto_core_ed25519_SCALARBYTES) != 0); + } sodium_free(hex); sodium_free(sc64); sodium_free(sc3); @@ -342,6 +395,7 @@ sodium_free(p3); sodium_free(p2); sodium_free(p); + sodium_free(r); sodium_free(h); assert(crypto_core_ed25519_BYTES == crypto_core_ed25519_bytes()); @@ -350,6 +404,8 @@ assert(crypto_core_ed25519_NONREDUCEDSCALARBYTES >= crypto_core_ed25519_SCALARBYTES); assert(crypto_core_ed25519_UNIFORMBYTES == crypto_core_ed25519_uniformbytes()); assert(crypto_core_ed25519_UNIFORMBYTES >= crypto_core_ed25519_BYTES); + assert(crypto_core_ed25519_HASHBYTES == crypto_core_ed25519_hashbytes()); + assert(crypto_core_ed25519_HASHBYTES >= 2 * crypto_core_ed25519_BYTES); printf("OK\n"); diff -Nru libsodium-1.0.17/test/default/core_ed25519.exp libsodium-1.0.18/test/default/core_ed25519.exp --- libsodium-1.0.17/test/default/core_ed25519.exp 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/core_ed25519.exp 2019-05-30 20:13:18.000000000 +0000 @@ -14,4 +14,5 @@ sub1: f67c79849de0253ba142949e1db6224b13121212121212121212121212121202 add2: b02e8581ce62f69922427c23f970f7e951525252525252525252525252525202 sub2: 3da570db4b001cbeb35a7b7fe588e72aaeadadadadadadadadadadadadadad0d +mul: 4453ef38408c06677c1b810e4bf8b1991f01c88716fbfa2f075a518b77da400b OK diff -Nru libsodium-1.0.17/test/default/core_ristretto255.c libsodium-1.0.18/test/default/core_ristretto255.c --- libsodium-1.0.17/test/default/core_ristretto255.c 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/test/default/core_ristretto255.c 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,270 @@ +#define TEST_NAME "core_ristretto255" +#include "cmptest.h" + +static void +tv1(void) +{ + static const char *bad_encodings_hex[] = { + /* Non-canonical field encodings */ + "00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f", + "f3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f", + "edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f", + + /* Negative field elements */ + "0100000000000000000000000000000000000000000000000000000000000000", + "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f", + "ed57ffd8c914fb201471d1c3d245ce3c746fcbe63a3679d51b6a516ebebe0e20", + "c34c4e1826e5d403b78e246e88aa051c36ccf0aafebffe137d148a2bf9104562", + "c940e5a4404157cfb1628b108db051a8d439e1a421394ec4ebccb9ec92a8ac78", + "47cfc5497c53dc8e61c91d17fd626ffb1c49e2bca94eed052281b510b1117a24", + "f1c6165d33367351b0da8f6e4511010c68174a03b6581212c71c0e1d026c3c72", + "87260f7a2f12495118360f02c26a470f450dadf34a413d21042b43b9d93e1309", + + /* Non-square x^2 */ + "26948d35ca62e643e26a83177332e6b6afeb9d08e4268b650f1f5bbd8d81d371", + "4eac077a713c57b4f4397629a4145982c661f48044dd3f96427d40b147d9742f", + "de6a7b00deadc788eb6b6c8d20c0ae96c2f2019078fa604fee5b87d6e989ad7b", + "bcab477be20861e01e4a0e295284146a510150d9817763caf1a6f4b422d67042", + "2a292df7e32cababbd9de088d1d1abec9fc0440f637ed2fba145094dc14bea08", + "f4a9e534fc0d216c44b218fa0c42d99635a0127ee2e53c712f70609649fdff22", + "8268436f8c4126196cf64b3c7ddbda90746a378625f9813dd9b8457077256731", + "2810e5cbc2cc4d4eece54f61c6f69758e289aa7ab440b3cbeaa21995c2f4232b", + + /* Negative xy value */ + "3eb858e78f5a7254d8c9731174a94f76755fd3941c0ac93735c07ba14579630e", + "a45fdc55c76448c049a1ab33f17023edfb2be3581e9c7aade8a6125215e04220", + "d483fe813c6ba647ebbfd3ec41adca1c6130c2beeee9d9bf065c8d151c5f396e", + "8a2e1d30050198c65a54483123960ccc38aef6848e1ec8f5f780e8523769ba32", + "32888462f8b486c68ad7dd9610be5192bbeaf3b443951ac1a8118419d9fa097b", + "227142501b9d4355ccba290404bde41575b037693cef1f438c47f8fbf35d1165", + "5c37cc491da847cfeb9281d407efc41e15144c876e0170b499a96a22ed31e01e", + "445425117cb8c90edcbc7c1cc0e74f747f2c1efa5630a967c64f287792a48a4b", + + /* s = -1, which causes y = 0 */ + "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f" + }; + unsigned char *s; + size_t i; + + s = (unsigned char *) sodium_malloc(crypto_core_ristretto255_BYTES); + for (i = 0; i < sizeof bad_encodings_hex / sizeof bad_encodings_hex[0]; i++) { + sodium_hex2bin(s, crypto_core_ristretto255_BYTES, bad_encodings_hex[i], + crypto_core_ristretto255_BYTES * 2 + 1, + NULL, NULL, NULL); + if (crypto_core_ristretto255_is_valid_point(s)) { + printf("[%s] was not rejected\n", bad_encodings_hex[i]); + } + } + sodium_free(s); +}; + +static void +tv2(void) +{ + static const char *hash_hex[] = { + "5d1be09e3d0c82fc538112490e35701979d99e06ca3e2b5b54bffe8b4dc772c1" + "4d98b696a1bbfb5ca32c436cc61c16563790306c79eaca7705668b47dffe5bb6", + + "f116b34b8f17ceb56e8732a60d913dd10cce47a6d53bee9204be8b44f6678b27" + "0102a56902e2488c46120e9276cfe54638286b9e4b3cdb470b542d46c2068d38", + + "8422e1bbdaab52938b81fd602effb6f89110e1e57208ad12d9ad767e2e25510c" + "27140775f9337088b982d83d7fcf0b2fa1edffe51952cbe7365e95c86eaf325c", + + "ac22415129b61427bf464e17baee8db65940c233b98afce8d17c57beeb7876c2" + "150d15af1cb1fb824bbd14955f2b57d08d388aab431a391cfc33d5bafb5dbbaf", + + "165d697a1ef3d5cf3c38565beefcf88c0f282b8e7dbd28544c483432f1cec767" + "5debea8ebb4e5fe7d6f6e5db15f15587ac4d4d4a1de7191e0c1ca6664abcc413", + + "a836e6c9a9ca9f1e8d486273ad56a78c70cf18f0ce10abb1c7172ddd605d7fd2" + "979854f47ae1ccf204a33102095b4200e5befc0465accc263175485f0e17ea5c", + + "2cdc11eaeb95daf01189417cdddbf95952993aa9cb9c640eb5058d09702c7462" + "2c9965a697a3b345ec24ee56335b556e677b30e6f90ac77d781064f866a3c982" + }; + unsigned char *s; + unsigned char *u; + char *hex; + size_t i; + + s = (unsigned char *) sodium_malloc(crypto_core_ristretto255_BYTES); + u = (unsigned char *) sodium_malloc(crypto_core_ristretto255_HASHBYTES); + hex = (char *) sodium_malloc(crypto_core_ristretto255_BYTES * 2 + 1); + for (i = 0; i < sizeof hash_hex / sizeof hash_hex[0]; i++) { + sodium_hex2bin(u, crypto_core_ristretto255_HASHBYTES, hash_hex[i], + crypto_core_ristretto255_HASHBYTES * 2 + 1, + NULL, NULL, NULL); + crypto_core_ristretto255_from_hash(s, u); + sodium_bin2hex(hex, crypto_core_ristretto255_BYTES * 2 + 1, + s, crypto_core_ristretto255_BYTES); + printf("%s\n", hex); + } + sodium_free(hex); + sodium_free(u); + sodium_free(s); +} + +static void +tv3(void) +{ + static const unsigned char l[crypto_core_ed25519_BYTES] = + { 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, + 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10 }; + + unsigned char *r = + (unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES); + unsigned char *r_inv = + (unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES); + unsigned char *ru = + (unsigned char *) sodium_malloc(crypto_core_ristretto255_HASHBYTES); + unsigned char *s = + (unsigned char *) sodium_malloc(crypto_core_ristretto255_BYTES); + unsigned char *s_ = + (unsigned char *) sodium_malloc(crypto_core_ristretto255_BYTES); + unsigned char *s2 = + (unsigned char *) sodium_malloc(crypto_core_ristretto255_BYTES); + int i; + + for (i = 0; i < 1000; i++) { + crypto_core_ristretto255_scalar_random(r); + if (crypto_scalarmult_ristretto255_base(s, r) != 0 || + crypto_core_ristretto255_is_valid_point(s) != 1) { + printf("crypto_scalarmult_ristretto255_base() failed\n"); + } + crypto_core_ristretto255_random(s); + if (crypto_core_ristretto255_is_valid_point(s) != 1) { + printf("crypto_core_ristretto255_random() failed\n"); + } + if (crypto_scalarmult_ristretto255(s, l, s) == 0) { + printf("s*l != inf (1)\n"); + } + randombytes_buf(ru, crypto_core_ristretto255_HASHBYTES); + if (crypto_core_ristretto255_from_hash(s, ru) != 0 || + crypto_core_ristretto255_is_valid_point(s) != 1) { + printf("crypto_core_ristretto255_from_hash() failed\n"); + } + if (crypto_scalarmult_ristretto255(s2, l, s) == 0) { + printf("s*l != inf (2)\n"); + } + if (crypto_scalarmult_ristretto255(s2, r, s) != 0 || + crypto_core_ristretto255_is_valid_point(s2) != 1) { + printf("crypto_scalarmult_ristretto255() failed\n"); + } + if (crypto_core_ristretto255_scalar_invert(r_inv, r) != 0) { + printf("crypto_core_ristretto255_scalar_invert() failed\n"); + } + if (crypto_scalarmult_ristretto255(s_, r_inv, s2) != 0 || + crypto_core_ristretto255_is_valid_point(s_) != 1) { + printf("crypto_scalarmult_ristretto255() failed\n"); + } + if (memcmp(s, s_, crypto_core_ristretto255_BYTES) != 0) { + printf("inversion failed\n"); + } + if (crypto_scalarmult_ristretto255(s2, l, s2) == 0) { + printf("s*l != inf (3)\n"); + } + if (crypto_core_ristretto255_add(s2, s, s_) != 0) { + printf("addition failed"); + } + if (crypto_core_ristretto255_sub(s2, s2, s_) != 0) { + printf("substraction failed"); + } + if (crypto_core_ristretto255_is_valid_point(s2) == 0) { + printf("invalid point"); + } + if (memcmp(s, s2, crypto_core_ristretto255_BYTES) != 0) { + printf("s2 + s - s_ != s\n"); + } + if (crypto_core_ristretto255_sub(s2, s2, s) != 0) { + printf("substraction failed"); + } + if (crypto_core_ristretto255_is_valid_point(s2) == -1) { + printf("s + s' - s - s' != 0"); + } + } + + crypto_core_ristretto255_random(s); + memset(s_, 0xfe, crypto_core_ristretto255_BYTES); + assert(crypto_core_ristretto255_add(s2, s_, s) == -1); + assert(crypto_core_ristretto255_add(s2, s, s_) == -1); + assert(crypto_core_ristretto255_add(s2, s_, s_) == -1); + assert(crypto_core_ristretto255_add(s2, s, s) == 0); + assert(crypto_core_ristretto255_sub(s2, s_, s) == -1); + assert(crypto_core_ristretto255_sub(s2, s, s_) == -1); + assert(crypto_core_ristretto255_sub(s2, s_, s_) == -1); + assert(crypto_core_ristretto255_sub(s2, s, s) == 0); + + sodium_free(s2); + sodium_free(s_); + sodium_free(s); + sodium_free(ru); + sodium_free(r_inv); + sodium_free(r); +} + +static void +tv4(void) +{ + unsigned char *r; + unsigned char *s1; + unsigned char *s2; + unsigned char *s3; + unsigned char *s4; + + r = (unsigned char *) sodium_malloc(crypto_core_ristretto255_NONREDUCEDSCALARBYTES); + s1 = (unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES); + s2 = (unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES); + s3 = (unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES); + s4 = (unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES); + + crypto_core_ristretto255_scalar_random(s1); + randombytes_buf(r, crypto_core_ristretto255_NONREDUCEDSCALARBYTES); + crypto_core_ristretto255_scalar_reduce(s2, r); + memcpy(s4, s1, crypto_core_ristretto255_SCALARBYTES); + crypto_core_ristretto255_scalar_add(s3, s1, s2); + crypto_core_ristretto255_scalar_sub(s4, s1, s2); + crypto_core_ristretto255_scalar_add(s2, s3, s4); + crypto_core_ristretto255_scalar_sub(s2, s2, s1); + crypto_core_ristretto255_scalar_mul(s2, s3, s2); + crypto_core_ristretto255_scalar_invert(s4, s3); + crypto_core_ristretto255_scalar_mul(s2, s2, s4); + crypto_core_ristretto255_scalar_negate(s1, s1); + crypto_core_ristretto255_scalar_add(s2, s2, s1); + crypto_core_ristretto255_scalar_complement(s1, s2); + s1[0]--; + assert(sodium_is_zero(s1, crypto_core_ristretto255_SCALARBYTES)); + + sodium_free(s1); + sodium_free(s2); + sodium_free(s3); + sodium_free(s4); + sodium_free(r); +} + +int +main(void) +{ + tv1(); + tv2(); + tv3(); + tv4(); + + assert(crypto_core_ristretto255_BYTES == crypto_core_ristretto255_bytes()); + assert(crypto_core_ristretto255_SCALARBYTES == crypto_core_ristretto255_scalarbytes()); + assert(crypto_core_ristretto255_NONREDUCEDSCALARBYTES == crypto_core_ristretto255_nonreducedscalarbytes()); + assert(crypto_core_ristretto255_NONREDUCEDSCALARBYTES >= crypto_core_ristretto255_SCALARBYTES); + assert(crypto_core_ristretto255_HASHBYTES == crypto_core_ristretto255_hashbytes()); + assert(crypto_core_ristretto255_HASHBYTES >= crypto_core_ristretto255_BYTES); + assert(crypto_core_ristretto255_BYTES == crypto_core_ed25519_BYTES); + assert(crypto_core_ristretto255_SCALARBYTES == crypto_core_ed25519_SCALARBYTES); + assert(crypto_core_ristretto255_NONREDUCEDSCALARBYTES == crypto_core_ed25519_NONREDUCEDSCALARBYTES); + assert(crypto_core_ristretto255_HASHBYTES >= 2 * crypto_core_ed25519_UNIFORMBYTES); + + printf("OK\n"); + + return 0; +} diff -Nru libsodium-1.0.17/test/default/core_ristretto255.exp libsodium-1.0.18/test/default/core_ristretto255.exp --- libsodium-1.0.17/test/default/core_ristretto255.exp 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/test/default/core_ristretto255.exp 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,8 @@ +3066f82a1a747d45120d1740f14358531a8f04bbffe6a819f86dfe50f44a0a46 +f26e5b6f7d362d2d2a94c5d0e7602cb4773c95a2e5c31a64f133189fa76ed61b +006ccd2a9e6867e6a2c5cea83d3302cc9de128dd2a9a57dd8ee7b9d7ffe02826 +f8f0c87cf237953c5890aec3998169005dae3eca1fbb04548c635953c817f92a +ae81e7dedf20a497e10c304a765c1767a42d6e06029758d2d7e8ef7cc4c41179 +e2705652ff9f5e44d3e841bf1c251cf7dddb77d140870d1ab2ed64f1a9ce8628 +80bd07262511cdde4863f8a7434cef696750681cb9510eea557088f76d9e5065 +OK diff -Nru libsodium-1.0.17/test/default/Makefile.am libsodium-1.0.18/test/default/Makefile.am --- libsodium-1.0.17/test/default/Makefile.am 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/Makefile.am 2019-05-30 20:13:18.000000000 +0000 @@ -1,6 +1,7 @@ EXTRA_DIST = \ cmptest.h \ + wasi-test-wrapper.sh \ wintest.bat \ pre.js.inc \ aead_aes256gcm.exp \ @@ -25,6 +26,7 @@ chacha20.exp \ codecs.exp \ core_ed25519.exp \ + core_ristretto255.exp \ core1.exp \ core2.exp \ core3.exp \ @@ -53,6 +55,7 @@ randombytes.exp \ scalarmult.exp \ scalarmult_ed25519.exp \ + scalarmult_ristretto255.exp \ scalarmult2.exp \ scalarmult5.exp \ scalarmult6.exp \ @@ -103,6 +106,7 @@ chacha20.res \ codecs.res \ core_ed25519.res \ + core_ristretto255.res \ core1.res \ core2.res \ core3.res \ @@ -131,6 +135,7 @@ randombytes.res \ scalarmult.res \ scalarmult_ed25519.res \ + scalarmult_ristretto255.res \ scalarmult2.res \ scalarmult5.res \ scalarmult6.res \ @@ -158,158 +163,6 @@ verify1.res \ xchacha20.res -if NATIVECLIENT -CLEANFILES = \ - aead_aes256gcm.final \ - aead_aes256gcm2.final \ - aead_chacha20poly1305.final \ - aead_chacha20poly13052.final \ - aead_xchacha20poly1305.final \ - auth.final \ - auth2.final \ - auth3.final \ - auth5.final \ - auth6.final \ - auth7.final \ - box.final \ - box2.final \ - box7.final \ - box8.final \ - box_easy.final \ - box_easy2.final \ - box_seal.final \ - box_seed.final \ - chacha20.final \ - codecs.final \ - core_ed25519.final \ - core1.final \ - core2.final \ - core3.final \ - core4.final \ - core5.final \ - core6.final \ - ed25519_convert.final \ - generichash.final \ - generichash2.final \ - generichash3.final \ - hash.final \ - hash2.final \ - hash3.final \ - kdf.final \ - keygen.final \ - kx.final \ - metamorphic.final \ - misuse.final \ - onetimeauth.final \ - onetimeauth2.final \ - onetimeauth7.final \ - pwhash_argon2i.final \ - pwhash_argon2id.final \ - pwhash_scrypt.final \ - pwhash_scrypt_ll.final \ - randombytes.final \ - scalarmult.final \ - scalarmult_ed25519.final \ - scalarmult2.final \ - scalarmult5.final \ - scalarmult6.final \ - scalarmult7.final \ - scalarmult8.final \ - secretbox.final \ - secretbox2.final \ - secretbox7.final \ - secretbox8.final \ - secretbox_easy.final \ - secretbox_easy2.final \ - secretstream.final \ - shorthash.final \ - sign.final \ - siphashx24.final \ - sodium_core.final \ - sodium_utils.final \ - sodium_version.final \ - stream.final \ - stream2.final \ - stream3.final \ - stream4.final \ - verify1.final \ - xchacha20.final \ - aead_aes256gcm.nexe \ - aead_aes256gcm2.nexe \ - aead_chacha20poly1305.nexe \ - aead_chacha20poly13052.nexe \ - aead_xchacha20poly1305.nexe \ - auth.nexe \ - auth2.nexe \ - auth3.nexe \ - auth5.nexe \ - auth6.nexe \ - auth7.nexe \ - box.nexe \ - box2.nexe \ - box7.nexe \ - box8.nexe \ - box_easy.nexe \ - box_easy2.nexe \ - box_seal.nexe \ - box_seed.nexe \ - chacha20.nexe \ - codecs.nexe \ - core_ed25519.nexe \ - core1.nexe \ - core2.nexe \ - core3.nexe \ - core4.nexe \ - core5.nexe \ - core6.nexe \ - ed25519_convert.nexe \ - generichash.nexe \ - generichash2.nexe \ - generichash3.nexe \ - hash.nexe \ - hash2.nexe \ - hash3.nexe \ - kdf.nexe \ - keygen.nexe \ - kx.nexe \ - metamorphic.nexe \ - misuse.nexe \ - onetimeauth.nexe \ - onetimeauth2.nexe \ - onetimeauth7.nexe \ - pwhash_argon2i.nexe \ - pwhash_argon2id.nexe \ - pwhash_scrypt.nexe \ - pwhash_scrypt_ll.nexe \ - randombytes.nexe \ - scalarmult.nexe \ - scalarmult_ed25519.nexe \ - scalarmult2.nexe \ - scalarmult5.nexe \ - scalarmult6.nexe \ - scalarmult7.nexe \ - scalarmult8.nexe \ - secretbox.nexe \ - secretbox2.nexe \ - secretbox7.nexe \ - secretbox8.nexe \ - secretbox_easy.nexe \ - secretbox_easy2.nexe \ - secretstream.nexe \ - shorthash.nexe \ - sign.nexe \ - siphashx24.nexe \ - sodium_core.nexe \ - sodium_utils.nexe \ - sodium_version.nexe \ - stream.nexe \ - stream2.nexe \ - stream3.nexe \ - stream4.nexe \ - verify1.nexe \ - xchacha20.nexe -endif - AM_CPPFLAGS = \ -DTEST_SRCDIR=\"@srcdir@\" \ -I$(top_srcdir)/src/libsodium/include \ @@ -390,12 +243,10 @@ verify1 if !EMSCRIPTEN -if !NATIVECLIENT TESTS_TARGETS += \ sodium_utils2 \ sodium_utils3 endif -endif check_PROGRAMS = $(TESTS_TARGETS) @@ -470,6 +321,9 @@ core_ed25519_SOURCE = cmptest.h core_ed25519.c core_ed25519_LDADD = $(TESTS_LDADD) +core_ristretto255_SOURCE = cmptest.h core_ristretto255.c +core_ristretto255_LDADD = $(TESTS_LDADD) + core1_SOURCE = cmptest.h core1.c core1_LDADD = $(TESTS_LDADD) @@ -551,6 +405,9 @@ scalarmult_ed25519_SOURCE = cmptest.h scalarmult_ed25519.c scalarmult_ed25519_LDADD = $(TESTS_LDADD) +scalarmult_ristretto255_SOURCE = cmptest.h scalarmult_ristretto255.c +scalarmult_ristretto255_LDADD = $(TESTS_LDADD) + scalarmult2_SOURCE = cmptest.h scalarmult2.c scalarmult2_LDADD = $(TESTS_LDADD) @@ -632,15 +489,17 @@ if !MINIMAL TESTS_TARGETS += \ core_ed25519 \ + core_ristretto255 \ pwhash_scrypt \ pwhash_scrypt_ll \ scalarmult_ed25519 \ + scalarmult_ristretto255 \ siphashx24 \ xchacha20 endif -if NATIVECLIENT -LOG_COMPILER = ./nacl-test-wrapper.sh +if WASI +LOG_COMPILER = ./wasi-test-wrapper.sh endif verify: check diff -Nru libsodium-1.0.17/test/default/nacl-test-wrapper.sh libsodium-1.0.18/test/default/nacl-test-wrapper.sh --- libsodium-1.0.17/test/default/nacl-test-wrapper.sh 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/nacl-test-wrapper.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -#! /bin/sh - -if [ -z "$NACL_SDK_ROOT" ]; then - echo "The following variable needs to be set: - \$NACL_SDK_ROOT=$NACL_SDK_ROOT" >&2 - exit 1 -fi - -if [ -z "$PNACL_FINALIZE" -o -z "$PNACL_TRANSLATE" ]; then - exe="$1" -else - exe="$1.nexe" - if [ ! -f "$exe" ]; then - $PNACL_FINALIZE "$1" -o "$1.final" - $PNACL_TRANSLATE -arch $(uname -m) "$1.final" -o "$exe" - fi -fi - -command -v command >/dev/null 2>&1 || { - echo "command is required, but wasn't found on this system" >&2 - exit 1 -} - -command -v python >/dev/null 2>&1 || { - echo "Python not found. Aborting." >&2 - exit 1 -} - -SEL_LDR=$(find "$NACL_SDK_ROOT" -name sel_ldr.py | head -n 1) -if [ -z "$SEL_LDR" ]; then - echo "Couldn't find sel_ldr.py under $NACL_SDK_ROOT" >&2 - exit 1 -fi - -exec python "$SEL_LDR" "$exe" diff -Nru libsodium-1.0.17/test/default/pwhash_scrypt.c libsodium-1.0.18/test/default/pwhash_scrypt.c --- libsodium-1.0.17/test/default/pwhash_scrypt.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/pwhash_scrypt.c 2019-05-30 20:13:18.000000000 +0000 @@ -266,8 +266,6 @@ { "test", "$7$z6..../.....lgPchkGHqbeONR/xtuXyjCrt9kUSg6NlKFQO0OSxo/$.DbajbPYH9T7sg3fOtcgxvJzzfIgJBIxMkeQ8b24YQ." }, { "test", - "$7$8zzzzz/.....lgPchkGHqbeONR/xtuXyjCrt9kUSg6NlKFQO0OSxo/$.DbajbPYH9T7sg3fOtcgxvJzzfIgJBIxMkeQ8b24YQ." }, - { "test", "$7$8zzzzzzzzzz.lgPchkGHqbeONR/xtuXyjCrt9kUSg6NlKFQO0OSxo/$.DbajbPYH9T7sg3fOtcgxvJzzfIgJBIxMkeQ8b24YQ." }, { "test", "$7$8.....zzzzz.lgPchkGHqbeONR/xtuXyjCrt9kUSg6NlKFQO0OSxo/$.DbajbPYH9T7sg3fOtcgxvJzzfIgJBIxMkeQ8b24YQ." }, diff -Nru libsodium-1.0.17/test/default/pwhash_scrypt.exp libsodium-1.0.18/test/default/pwhash_scrypt.exp --- libsodium-1.0.17/test/default/pwhash_scrypt.exp 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/pwhash_scrypt.exp 2019-05-30 20:13:18.000000000 +0000 @@ -34,5 +34,4 @@ pwhash_str failure: [30] pwhash_str failure: [31] pwhash_str failure: [32] -pwhash_str failure: [33] OK diff -Nru libsodium-1.0.17/test/default/randombytes.c libsodium-1.0.18/test/default/randombytes.c --- libsodium-1.0.17/test/default/randombytes.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/randombytes.c 2019-05-30 20:13:18.000000000 +0000 @@ -42,8 +42,6 @@ #ifndef BENCHMARKS # ifdef __EMSCRIPTEN__ assert(strcmp(randombytes_implementation_name(), "js") == 0); -# elif defined(__native_client__) - assert(strcmp(randombytes_implementation_name(), "nativeclient") == 0); # else assert(strcmp(randombytes_implementation_name(), "sysrandom") == 0); # endif @@ -73,8 +71,9 @@ assert(randombytes_uniform(1U) == 0U); randombytes_close(); #ifndef __EMSCRIPTEN__ - randombytes_set_implementation(&randombytes_salsa20_implementation); - assert(strcmp(randombytes_implementation_name(), "salsa20") == 0); + assert(&randombytes_internal_implementation == &randombytes_salsa20_implementation); + randombytes_set_implementation(&randombytes_internal_implementation); + assert(strcmp(randombytes_implementation_name(), "internal") == 0); #endif randombytes_stir(); for (i = 0; i < 256; ++i) { @@ -129,11 +128,7 @@ static int impl_tests(void) { -#ifndef __native_client__ randombytes_implementation impl = randombytes_sysrandom_implementation; -#else - randombytes_implementation impl = randombytes_nativeclient_implementation; -#endif uint32_t v = randombytes_random(); impl.uniform = randombytes_uniform_impl; diff -Nru libsodium-1.0.17/test/default/scalarmult_ed25519.c libsodium-1.0.18/test/default/scalarmult_ed25519.c --- libsodium-1.0.17/test/default/scalarmult_ed25519.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/scalarmult_ed25519.c 2019-05-30 20:13:18.000000000 +0000 @@ -83,6 +83,18 @@ if (memcmp(q, q2, crypto_scalarmult_ed25519_BYTES) == 0) { printf("clamping not applied\n"); } + + n[0] = 9; + if (crypto_scalarmult_ed25519_base(q, n) != 0) { + printf("crypto_scalarmult_ed25519_base() failed\n"); + } + if (crypto_scalarmult_ed25519_base_noclamp(q2, n) != 0) { + printf("crypto_scalarmult_ed25519_base_noclamp() failed\n"); + } + if (memcmp(q, q2, crypto_scalarmult_ed25519_BYTES) == 0) { + printf("clamping not applied\n"); + } + n[0] = 8; n[31] = 64; if (crypto_scalarmult_ed25519_noclamp(q2, n, p) != 0) { diff -Nru libsodium-1.0.17/test/default/scalarmult_ristretto255.c libsodium-1.0.18/test/default/scalarmult_ristretto255.c --- libsodium-1.0.17/test/default/scalarmult_ristretto255.c 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/test/default/scalarmult_ristretto255.c 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,51 @@ +#define TEST_NAME "scalarmult_ristretto255" +#include "cmptest.h" + +#define B_HEX "e2f2ae0a6abc4e71a884a961c500515f58e30b6aa582dd8db6a65945e08d2d76" + +int +main(void) +{ + unsigned char *b = + (unsigned char *) sodium_malloc(crypto_scalarmult_ristretto255_BYTES); + unsigned char *n = + (unsigned char *) sodium_malloc(crypto_scalarmult_ristretto255_SCALARBYTES); + unsigned char *p = + (unsigned char *) sodium_malloc(crypto_scalarmult_ristretto255_BYTES); + unsigned char *p2 = + (unsigned char *) sodium_malloc(crypto_scalarmult_ristretto255_BYTES); + char *hex = + (char *) sodium_malloc(2 * crypto_scalarmult_ristretto255_BYTES + 1); + int i; + + sodium_hex2bin(b, crypto_scalarmult_ristretto255_BYTES, + B_HEX, sizeof B_HEX - (size_t) 1U, NULL, NULL, NULL); + memset(n, 0, crypto_scalarmult_ristretto255_SCALARBYTES); + for (i = 0; i < 16; i++) { + crypto_scalarmult_ristretto255_base(p, n); + if (crypto_scalarmult_ristretto255(p2, n, b) != 0) { + printf("crypto_scalarmult_ristretto255(%d) != 0\n", i); + } + sodium_bin2hex(hex, 2 * crypto_scalarmult_ristretto255_BYTES + 1, + p, crypto_scalarmult_ristretto255_BYTES); + printf("%s\n", hex); + assert(memcmp(p, p2, crypto_scalarmult_ristretto255_BYTES) == 0); + sodium_increment(n, crypto_scalarmult_ristretto255_SCALARBYTES); + } + + memset(p, 0xfe, crypto_scalarmult_ristretto255_BYTES); + assert(crypto_scalarmult_ristretto255(guard_page, n, p) == -1); + + sodium_free(hex); + sodium_free(p2); + sodium_free(p); + sodium_free(n); + sodium_free(b); + + assert(crypto_scalarmult_ristretto255_BYTES == crypto_scalarmult_ristretto255_bytes()); + assert(crypto_scalarmult_ristretto255_SCALARBYTES == crypto_scalarmult_ristretto255_scalarbytes()); + + printf("OK\n"); + + return 0; +} diff -Nru libsodium-1.0.17/test/default/scalarmult_ristretto255.exp libsodium-1.0.18/test/default/scalarmult_ristretto255.exp --- libsodium-1.0.17/test/default/scalarmult_ristretto255.exp 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/test/default/scalarmult_ristretto255.exp 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,18 @@ +crypto_scalarmult_ristretto255(0) != 0 +0000000000000000000000000000000000000000000000000000000000000000 +e2f2ae0a6abc4e71a884a961c500515f58e30b6aa582dd8db6a65945e08d2d76 +6a493210f7499cd17fecb510ae0cea23a110e8d5b901f8acadd3095c73a3b919 +94741f5d5d52755ece4f23f044ee27d5d1ea1e2bd196b462166b16152a9d0259 +da80862773358b466ffadfe0b3293ab3d9fd53c5ea6c955358f568322daf6a57 +e882b131016b52c1d3337080187cf768423efccbb517bb495ab812c4160ff44e +f64746d3c92b13050ed8d80236a7f0007c3b3f962f5ba793d19a601ebb1df403 +44f53520926ec81fbd5a387845beb7df85a96a24ece18738bdcfa6a7822a176d +903293d8f2287ebe10e2374dc1a53e0bc887e592699f02d077d5263cdd55601c +02622ace8f7303a31cafc63f8fc48fdc16e1c8c8d234b2f0d6685282a9076031 +20706fd788b2720a1ed2a5dad4952b01f413bcf0e7564de8cdc816689e2db95f +bce83f8ba5dd2fa572864c24ba1810f9522bc6004afe95877ac73241cafdab42 +e4549ee16b9aa03099ca208c67adafcafa4c3f3e4e5303de6026e3ca8ff84460 +aa52e000df2e16f55fb1032fc33bc42742dad6bd5a8fc0be0167436c5948501f +46376b80f409b29dc2b5f6f0c52591990896e5716f41477cd30085ab7f10301e +e0c418f7c8d9c4cdd7395b93ea124f3ad99021bb681dfc3302a9d99a2e53e64e +OK diff -Nru libsodium-1.0.17/test/default/sodium_utils2.c libsodium-1.0.18/test/default/sodium_utils2.c --- libsodium-1.0.17/test/default/sodium_utils2.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/sodium_utils2.c 2019-05-30 20:13:18.000000000 +0000 @@ -23,14 +23,16 @@ printf("Intentional segfault / bus error caught\n"); printf("OK\n"); -#ifdef SIGSEGV +#ifdef SIG_DFL +# ifdef SIGSEGV signal(SIGSEGV, SIG_DFL); -#endif -#ifdef SIGBUS +# endif +# ifdef SIGBUS signal(SIGBUS, SIG_DFL); -#endif -#ifdef SIGABRT +# endif +# ifdef SIGABRT signal(SIGABRT, SIG_DFL); +# endif #endif exit(0); } @@ -70,15 +72,16 @@ sodium_free(buf); } printf("OK\n"); - -#ifdef SIGSEGV +#ifdef SIG_DFL +# ifdef SIGSEGV signal(SIGSEGV, segv_handler); -#endif -#ifdef SIGBUS +# endif +# ifdef SIGBUS signal(SIGBUS, segv_handler); -#endif -#ifdef SIGABRT +# endif +# ifdef SIGABRT signal(SIGABRT, segv_handler); +# endif #endif size = 1U + randombytes_uniform(100000U); buf = sodium_malloc(size); diff -Nru libsodium-1.0.17/test/default/sodium_utils3.c libsodium-1.0.18/test/default/sodium_utils3.c --- libsodium-1.0.17/test/default/sodium_utils3.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/sodium_utils3.c 2019-05-30 20:13:18.000000000 +0000 @@ -19,14 +19,16 @@ printf("Intentional segfault / bus error caught\n"); printf("OK\n"); -#ifdef SIGSEGV +#ifdef SIG_DFL +# ifdef SIGSEGV signal(SIGSEGV, SIG_DFL); -#endif -#ifdef SIGBUS +# endif +# ifdef SIGBUS signal(SIGBUS, SIG_DFL); -#endif -#ifdef SIGABRT +# endif +# ifdef SIGABRT signal(SIGABRT, SIG_DFL); +# endif #endif exit(0); } @@ -37,14 +39,16 @@ void * buf; size_t size; -#ifdef SIGSEGV +#ifdef SIG_DFL +# ifdef SIGSEGV signal(SIGSEGV, segv_handler); -#endif -#ifdef SIGBUS +# endif +# ifdef SIGBUS signal(SIGBUS, segv_handler); -#endif -#ifdef SIGABRT +# endif +# ifdef SIGABRT signal(SIGABRT, segv_handler); +# endif #endif size = 1U + randombytes_uniform(100000U); buf = sodium_malloc(size); diff -Nru libsodium-1.0.17/test/default/sodium_utils.c libsodium-1.0.18/test/default/sodium_utils.c --- libsodium-1.0.17/test/default/sodium_utils.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/sodium_utils.c 2019-05-30 20:13:18.000000000 +0000 @@ -29,6 +29,10 @@ printf("%d\n", sodium_memcmp(buf1, buf2, 0U)); sodium_memzero(buf2, sizeof buf2 / 2); printf("%d\n", sodium_memcmp(buf1, buf2, sizeof buf1)); + printf("%d\n", sodium_memcmp(buf1, guard_page, 0U)); + printf("%d\n", sodium_memcmp(guard_page, buf2, 0U)); + printf("%d\n", sodium_memcmp(guard_page, guard_page, 0U)); + sodium_memzero(guard_page, 0U); memset(nonce, 0, sizeof nonce); sodium_increment(nonce, sizeof nonce); @@ -70,6 +74,8 @@ (unsigned int) bin_len); } } + printf("%d\n", sodium_compare(buf1, NULL, 0U)); + printf("%d\n", sodium_compare(NULL, buf1, 0U)); memset(buf1, 0, sizeof buf1); if (sodium_is_zero(buf1, sizeof buf1) != 1) { printf("sodium_is_zero() failed\n"); @@ -154,6 +160,21 @@ sodium_add(nonce, nonce, 24U); printf("%s\n", sodium_bin2hex(nonce_hex, sizeof nonce_hex, nonce, sizeof nonce)); + sodium_add(nonce, nonce, 0U); + printf("%s\n", + sodium_bin2hex(nonce_hex, sizeof nonce_hex, nonce, sizeof nonce)); + sodium_add(nonce, guard_page, 0U); + printf("%s\n", + sodium_bin2hex(nonce_hex, sizeof nonce_hex, nonce, sizeof nonce)); + sodium_add(guard_page, nonce, 0U); + + sodium_sub(nonce, nonce, 0U); + printf("%s\n", + sodium_bin2hex(nonce_hex, sizeof nonce_hex, nonce, sizeof nonce)); + sodium_sub(nonce, guard_page, 0U); + printf("%s\n", + sodium_bin2hex(nonce_hex, sizeof nonce_hex, nonce, sizeof nonce)); + sodium_sub(guard_page, nonce, 0U); randombytes_buf(buf1, 64U); randombytes_buf(buf2, 64U); diff -Nru libsodium-1.0.17/test/default/sodium_utils.exp libsodium-1.0.18/test/default/sodium_utils.exp --- libsodium-1.0.17/test/default/sodium_utils.exp 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/sodium_utils.exp 2019-05-30 20:13:18.000000000 +0000 @@ -3,14 +3,23 @@ -1 0 0 +0 +0 +0 010000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000 010100000000000000000000000000000000000000000000 020000000000000000000000000000000000000000000000 0001ff000000000000000000000000000000000000000000 +0 +0 000000000000fffefefefefefefefefefefefefefefefefe 00000000000000000000fffefefefefefefefefefefefefe 00000000000000000000000000000000000000000000fffe fcfffffffffffbfdfefefefefefefefefefefefefefefefe fcfffffffffffffffffffbfdfefefefefefefefefefefefe fcfffffffffffffffffffffffffffffffffffffffffffbfd +fcfffffffffffffffffffffffffffffffffffffffffffbfd +fcfffffffffffffffffffffffffffffffffffffffffffbfd +fcfffffffffffffffffffffffffffffffffffffffffffbfd +fcfffffffffffffffffffffffffffffffffffffffffffbfd diff -Nru libsodium-1.0.17/test/default/stream2.c libsodium-1.0.18/test/default/stream2.c --- libsodium-1.0.17/test/default/stream2.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/stream2.c 2019-05-30 20:13:18.000000000 +0000 @@ -2,42 +2,54 @@ #define TEST_NAME "stream2" #include "cmptest.h" -static unsigned char secondkey[32] = { 0xdc, 0x90, 0x8d, 0xda, 0x0b, 0x93, 0x44, - 0xa9, 0x53, 0x62, 0x9b, 0x73, 0x38, 0x20, - 0x77, 0x88, 0x80, 0xf3, 0xce, 0xb4, 0x21, - 0xbb, 0x61, 0xb9, 0x1c, 0xbd, 0x4c, 0x3e, - 0x66, 0x25, 0x6c, 0xe4 }; +static const unsigned char secondkey[32] = { + 0xdc, 0x90, 0x8d, 0xda, 0x0b, 0x93, 0x44, + 0xa9, 0x53, 0x62, 0x9b, 0x73, 0x38, 0x20, + 0x77, 0x88, 0x80, 0xf3, 0xce, 0xb4, 0x21, + 0xbb, 0x61, 0xb9, 0x1c, 0xbd, 0x4c, 0x3e, + 0x66, 0x25, 0x6c, 0xe4 +}; + +static const unsigned char noncesuffix[8] = { + 0x82, 0x19, 0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 +}; -static unsigned char noncesuffix[8] = { 0x82, 0x19, 0xe0, 0x03, - 0x6b, 0x7a, 0x0b, 0x37 }; -static unsigned char output[4194304]; - -static unsigned char h[32]; int main(void) { - int i; - crypto_stream_salsa20(output, sizeof output, noncesuffix, secondkey); - crypto_hash_sha256(h, output, sizeof output); - for (i = 0; i < 32; ++i) - printf("%02x", h[i]); - printf("\n"); + unsigned char *output; + char *hex; + unsigned char h[32]; + size_t sizeof_hex = 32 * 2 + 1; + size_t sizeof_output = 4194304; + int i; + + output = (unsigned char *) sodium_malloc(sizeof_output); + hex = (char *) sodium_malloc(sizeof_hex); + + crypto_stream_salsa20(output, sizeof_output, noncesuffix, secondkey); + crypto_hash_sha256(h, output, sizeof_output); + sodium_bin2hex(hex, sizeof_hex, h, sizeof h); + printf("%s\n", hex); - assert(sizeof output > 4000); + assert(sizeof_output > 4000); crypto_stream_salsa20_xor_ic(output, output, 4000, noncesuffix, 0U, secondkey); - for (i = 0; i < 4000; ++i) + for (i = 0; i < 4000; i++) { assert(output[i] == 0); + } crypto_stream_salsa20_xor_ic(output, output, 4000, noncesuffix, 1U, secondkey); - crypto_hash_sha256(h, output, sizeof output); - for (i = 0; i < 32; ++i) - printf("%02x", h[i]); - printf("\n"); + crypto_hash_sha256(h, output, sizeof_output); + sodium_bin2hex(hex, sizeof_hex, h, sizeof h); + printf("%s\n", hex); + + sodium_free(hex); + sodium_free(output); assert(crypto_stream_salsa20_keybytes() > 0U); assert(crypto_stream_salsa20_noncebytes() > 0U); diff -Nru libsodium-1.0.17/test/default/stream.c libsodium-1.0.18/test/default/stream.c --- libsodium-1.0.17/test/default/stream.c 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/stream.c 2019-05-30 20:13:18.000000000 +0000 @@ -2,48 +2,55 @@ #define TEST_NAME "stream" #include "cmptest.h" -static unsigned char firstkey[32] = { 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, - 0xd4, 0x62, 0xcd, 0x51, 0x19, 0x7a, 0x9a, - 0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac, - 0x64, 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08, - 0x44, 0xf6, 0x83, 0x89 }; - -static unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, - 0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8, - 0x75, 0xfc, 0x73, 0xd6, 0x82, 0x19, - 0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 }; - -static unsigned char output[4194304]; - -static unsigned char h[32]; -static char hex[2 * 192 + 1]; +static const unsigned char firstkey[32] = { + 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, + 0xd4, 0x62, 0xcd, 0x51, 0x19, 0x7a, 0x9a, + 0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac, + 0x64, 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08, + 0x44, 0xf6, 0x83, 0x89 +}; + +static const unsigned char nonce[24] = { + 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, + 0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8, + 0x75, 0xfc, 0x73, 0xd6, 0x82, 0x19, + 0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 +}; int main(void) { - int i; - - randombytes_buf(output, sizeof output); - crypto_stream(output, sizeof output, nonce, firstkey); - crypto_hash_sha256(h, output, sizeof output); - sodium_bin2hex(hex, sizeof hex, h, sizeof h); + unsigned char h[32]; + char *hex; + unsigned char *output; + size_t sizeof_hex = 17 * 64 * 2 + 1; + size_t sizeof_output = 4194304; + int i; + + output = (unsigned char *) sodium_malloc(sizeof_output); + hex = (char *) sodium_malloc(sizeof_hex); + + randombytes_buf(output, sizeof_output); + crypto_stream(output, sizeof_output, nonce, firstkey); + crypto_hash_sha256(h, output, sizeof_output); + sodium_bin2hex(hex, sizeof_hex, h, sizeof h); printf("%s\n", hex); - assert(sizeof output > 4000); + assert(sizeof_output > 4000); crypto_stream_xsalsa20_xor_ic(output, output, 4000, nonce, 0U, firstkey); for (i = 0; i < 4000; i++) { assert(output[i] == 0); } crypto_stream_xsalsa20_xor_ic(output, output, 4000, nonce, 1U, firstkey); - crypto_hash_sha256(h, output, sizeof output); - sodium_bin2hex(hex, sizeof hex, h, sizeof h); + crypto_hash_sha256(h, output, sizeof_output); + sodium_bin2hex(hex, sizeof_hex, h, sizeof h); printf("%s\n", hex); for (i = 0; i < 64; i++) { memset(output, i, 64); crypto_stream(output, (int) (i & 0xff), nonce, firstkey); - sodium_bin2hex(hex, sizeof hex, output, 64); + sodium_bin2hex(hex, sizeof_hex, output, 64); printf("%s\n", hex); } @@ -53,6 +60,18 @@ sodium_bin2hex(hex, 192 * 2 + 1, output, 192); printf("%s\n", hex); + for (i = 16; i > 0; i--) { + memset(output, 0, 17 * 64); + crypto_stream_xsalsa20_xor_ic(output, output, 17 * 64, nonce, + (1ULL << 32) - (unsigned long long) i, + firstkey); + sodium_bin2hex(hex, 2 * 17 * 64 + 1, output, 17 * 64); + printf("%s\n", hex); + } + + sodium_free(hex); + sodium_free(output); + assert(crypto_stream_keybytes() > 0U); assert(crypto_stream_noncebytes() > 0U); assert(crypto_stream_messagebytes_max() > 0U); diff -Nru libsodium-1.0.17/test/default/stream.exp libsodium-1.0.18/test/default/stream.exp --- libsodium-1.0.17/test/default/stream.exp 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/default/stream.exp 2019-05-30 20:13:18.000000000 +0000 @@ -65,3 +65,19 @@ eea6a7251c1e72916d11c2cb214d3c252539121d8e234e652d651fa4c8cff880309e645a74e9e0a60d8243acd9177ab51a1beb8d5a2f5d700c093c5e55853e3e eea6a7251c1e72916d11c2cb214d3c252539121d8e234e652d651fa4c8cff880309e645a74e9e0a60d8243acd9177ab51a1beb8d5a2f5d700c093c5e5585573f b46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44 +e825afc24db1b82ca241ef61bbd68003af106fbc07c41df1493b963b5ce45b72540ababca323c71ca3c903e1eec355121fbe9fad8bef90721c819eeba906ef7300b84696929a86d2a95aacebef2f38c489617398a39bc36762b5de6ccf544dde7fa47a839e3bf36903e3b7e9539c5c1c1794cfc991a414e2eef16bcf1b16d07cfb1ff0d77e5940a858f9025563334efeea808e3a82a54a0998e5587fddcb8b48e05de4cdb6ed1df7ddfca886d7122590844bc060178e13ba22a3c60f6fd53bb48f12931a32c81cbdde25e2fe3141682ff0443a9fb890e0520d328f91e19c4c0b0d05bd391351459dd5b15da237cfb3c36c95cfbfb076637b9181d9d9b42ae8ee3655eef4662a0c8737e5620ed7760a577afac32aa37baa35323a52287dfba632abcbff3e40aee172648c3d6f8e468262a49bbc2fb7876e97bb9d06ce6038e9eb425927287fb9ac67e41be494a883668602f4fcf76cc2c6bc62c3240bb63c233316630a645d5309af5c49813b8cc23e149ce40db089c7124431935e93fcc34dd1326fc6b1b8e71c37a3ee97a334f2c6bf579c5e986858a88b07136dd6b254543b16e14f38c7cb22cdb41a9028e3a6af9233c45ba06d1667746d48fc7b5c47601237fb2bde1e5a5551a1b4bf848734310103edb75a815e4ced8be43163ca13b3e399e91bf32b28de0b37c17d155f7129e23aec3deb2416122d7008a5684d5d0080f15e5eef787d292097cd781b3f95449b5f5a059a2cfbcd2cb10cc88a4759f2227f20d550c4cee567ab3e297191e8f1c3d537f1fc265c93ce900ae588d7d6a971cb0f0ae663a41347797bc4384568e439e10fa3cb24fefddf51202b17e35e5e3aba42fb067d15854bdeb400e8e96dfd097d5ffa793f3135cc819edefbf18c26c7e7a830988e8e1612a06c2d1f3bc03efb7ce5ca6538c4be7ba033a8f369fc479d527ca82cbc8198ef815ba7946fb7f4e7f503d280bddc767e39c4fb0ed54c86065a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe +00b84696929a86d2a95aacebef2f38c489617398a39bc36762b5de6ccf544dde7fa47a839e3bf36903e3b7e9539c5c1c1794cfc991a414e2eef16bcf1b16d07cfb1ff0d77e5940a858f9025563334efeea808e3a82a54a0998e5587fddcb8b48e05de4cdb6ed1df7ddfca886d7122590844bc060178e13ba22a3c60f6fd53bb48f12931a32c81cbdde25e2fe3141682ff0443a9fb890e0520d328f91e19c4c0b0d05bd391351459dd5b15da237cfb3c36c95cfbfb076637b9181d9d9b42ae8ee3655eef4662a0c8737e5620ed7760a577afac32aa37baa35323a52287dfba632abcbff3e40aee172648c3d6f8e468262a49bbc2fb7876e97bb9d06ce6038e9eb425927287fb9ac67e41be494a883668602f4fcf76cc2c6bc62c3240bb63c233316630a645d5309af5c49813b8cc23e149ce40db089c7124431935e93fcc34dd1326fc6b1b8e71c37a3ee97a334f2c6bf579c5e986858a88b07136dd6b254543b16e14f38c7cb22cdb41a9028e3a6af9233c45ba06d1667746d48fc7b5c47601237fb2bde1e5a5551a1b4bf848734310103edb75a815e4ced8be43163ca13b3e399e91bf32b28de0b37c17d155f7129e23aec3deb2416122d7008a5684d5d0080f15e5eef787d292097cd781b3f95449b5f5a059a2cfbcd2cb10cc88a4759f2227f20d550c4cee567ab3e297191e8f1c3d537f1fc265c93ce900ae588d7d6a971cb0f0ae663a41347797bc4384568e439e10fa3cb24fefddf51202b17e35e5e3aba42fb067d15854bdeb400e8e96dfd097d5ffa793f3135cc819edefbf18c26c7e7a830988e8e1612a06c2d1f3bc03efb7ce5ca6538c4be7ba033a8f369fc479d527ca82cbc8198ef815ba7946fb7f4e7f503d280bddc767e39c4fb0ed54c86065a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44 +fb1ff0d77e5940a858f9025563334efeea808e3a82a54a0998e5587fddcb8b48e05de4cdb6ed1df7ddfca886d7122590844bc060178e13ba22a3c60f6fd53bb48f12931a32c81cbdde25e2fe3141682ff0443a9fb890e0520d328f91e19c4c0b0d05bd391351459dd5b15da237cfb3c36c95cfbfb076637b9181d9d9b42ae8ee3655eef4662a0c8737e5620ed7760a577afac32aa37baa35323a52287dfba632abcbff3e40aee172648c3d6f8e468262a49bbc2fb7876e97bb9d06ce6038e9eb425927287fb9ac67e41be494a883668602f4fcf76cc2c6bc62c3240bb63c233316630a645d5309af5c49813b8cc23e149ce40db089c7124431935e93fcc34dd1326fc6b1b8e71c37a3ee97a334f2c6bf579c5e986858a88b07136dd6b254543b16e14f38c7cb22cdb41a9028e3a6af9233c45ba06d1667746d48fc7b5c47601237fb2bde1e5a5551a1b4bf848734310103edb75a815e4ced8be43163ca13b3e399e91bf32b28de0b37c17d155f7129e23aec3deb2416122d7008a5684d5d0080f15e5eef787d292097cd781b3f95449b5f5a059a2cfbcd2cb10cc88a4759f2227f20d550c4cee567ab3e297191e8f1c3d537f1fc265c93ce900ae588d7d6a971cb0f0ae663a41347797bc4384568e439e10fa3cb24fefddf51202b17e35e5e3aba42fb067d15854bdeb400e8e96dfd097d5ffa793f3135cc819edefbf18c26c7e7a830988e8e1612a06c2d1f3bc03efb7ce5ca6538c4be7ba033a8f369fc479d527ca82cbc8198ef815ba7946fb7f4e7f503d280bddc767e39c4fb0ed54c86065a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef5 +8f12931a32c81cbdde25e2fe3141682ff0443a9fb890e0520d328f91e19c4c0b0d05bd391351459dd5b15da237cfb3c36c95cfbfb076637b9181d9d9b42ae8ee3655eef4662a0c8737e5620ed7760a577afac32aa37baa35323a52287dfba632abcbff3e40aee172648c3d6f8e468262a49bbc2fb7876e97bb9d06ce6038e9eb425927287fb9ac67e41be494a883668602f4fcf76cc2c6bc62c3240bb63c233316630a645d5309af5c49813b8cc23e149ce40db089c7124431935e93fcc34dd1326fc6b1b8e71c37a3ee97a334f2c6bf579c5e986858a88b07136dd6b254543b16e14f38c7cb22cdb41a9028e3a6af9233c45ba06d1667746d48fc7b5c47601237fb2bde1e5a5551a1b4bf848734310103edb75a815e4ced8be43163ca13b3e399e91bf32b28de0b37c17d155f7129e23aec3deb2416122d7008a5684d5d0080f15e5eef787d292097cd781b3f95449b5f5a059a2cfbcd2cb10cc88a4759f2227f20d550c4cee567ab3e297191e8f1c3d537f1fc265c93ce900ae588d7d6a971cb0f0ae663a41347797bc4384568e439e10fa3cb24fefddf51202b17e35e5e3aba42fb067d15854bdeb400e8e96dfd097d5ffa793f3135cc819edefbf18c26c7e7a830988e8e1612a06c2d1f3bc03efb7ce5ca6538c4be7ba033a8f369fc479d527ca82cbc8198ef815ba7946fb7f4e7f503d280bddc767e39c4fb0ed54c86065a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0 +3655eef4662a0c8737e5620ed7760a577afac32aa37baa35323a52287dfba632abcbff3e40aee172648c3d6f8e468262a49bbc2fb7876e97bb9d06ce6038e9eb425927287fb9ac67e41be494a883668602f4fcf76cc2c6bc62c3240bb63c233316630a645d5309af5c49813b8cc23e149ce40db089c7124431935e93fcc34dd1326fc6b1b8e71c37a3ee97a334f2c6bf579c5e986858a88b07136dd6b254543b16e14f38c7cb22cdb41a9028e3a6af9233c45ba06d1667746d48fc7b5c47601237fb2bde1e5a5551a1b4bf848734310103edb75a815e4ced8be43163ca13b3e399e91bf32b28de0b37c17d155f7129e23aec3deb2416122d7008a5684d5d0080f15e5eef787d292097cd781b3f95449b5f5a059a2cfbcd2cb10cc88a4759f2227f20d550c4cee567ab3e297191e8f1c3d537f1fc265c93ce900ae588d7d6a971cb0f0ae663a41347797bc4384568e439e10fa3cb24fefddf51202b17e35e5e3aba42fb067d15854bdeb400e8e96dfd097d5ffa793f3135cc819edefbf18c26c7e7a830988e8e1612a06c2d1f3bc03efb7ce5ca6538c4be7ba033a8f369fc479d527ca82cbc8198ef815ba7946fb7f4e7f503d280bddc767e39c4fb0ed54c86065a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58 +425927287fb9ac67e41be494a883668602f4fcf76cc2c6bc62c3240bb63c233316630a645d5309af5c49813b8cc23e149ce40db089c7124431935e93fcc34dd1326fc6b1b8e71c37a3ee97a334f2c6bf579c5e986858a88b07136dd6b254543b16e14f38c7cb22cdb41a9028e3a6af9233c45ba06d1667746d48fc7b5c47601237fb2bde1e5a5551a1b4bf848734310103edb75a815e4ced8be43163ca13b3e399e91bf32b28de0b37c17d155f7129e23aec3deb2416122d7008a5684d5d0080f15e5eef787d292097cd781b3f95449b5f5a059a2cfbcd2cb10cc88a4759f2227f20d550c4cee567ab3e297191e8f1c3d537f1fc265c93ce900ae588d7d6a971cb0f0ae663a41347797bc4384568e439e10fa3cb24fefddf51202b17e35e5e3aba42fb067d15854bdeb400e8e96dfd097d5ffa793f3135cc819edefbf18c26c7e7a830988e8e1612a06c2d1f3bc03efb7ce5ca6538c4be7ba033a8f369fc479d527ca82cbc8198ef815ba7946fb7f4e7f503d280bddc767e39c4fb0ed54c86065a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58af8a27936cf507dcc7ec480ffce410373c81374fddcbad758a1976894d58e68d84f3da8a0bbbfd3d62d09679378ee94686866e0ef101e05ccb7cc8fdf6f31cbb +326fc6b1b8e71c37a3ee97a334f2c6bf579c5e986858a88b07136dd6b254543b16e14f38c7cb22cdb41a9028e3a6af9233c45ba06d1667746d48fc7b5c47601237fb2bde1e5a5551a1b4bf848734310103edb75a815e4ced8be43163ca13b3e399e91bf32b28de0b37c17d155f7129e23aec3deb2416122d7008a5684d5d0080f15e5eef787d292097cd781b3f95449b5f5a059a2cfbcd2cb10cc88a4759f2227f20d550c4cee567ab3e297191e8f1c3d537f1fc265c93ce900ae588d7d6a971cb0f0ae663a41347797bc4384568e439e10fa3cb24fefddf51202b17e35e5e3aba42fb067d15854bdeb400e8e96dfd097d5ffa793f3135cc819edefbf18c26c7e7a830988e8e1612a06c2d1f3bc03efb7ce5ca6538c4be7ba033a8f369fc479d527ca82cbc8198ef815ba7946fb7f4e7f503d280bddc767e39c4fb0ed54c86065a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58af8a27936cf507dcc7ec480ffce410373c81374fddcbad758a1976894d58e68d84f3da8a0bbbfd3d62d09679378ee94686866e0ef101e05ccb7cc8fdf6f31cbbf757c4d17aa607bc1decad9a65b8120adb7ef3b9d18a9c07226adf6f73f93c2ff79956f5e19b7c613dff1e907a8381863eb9ca536b44a3034cd522d6caa1766e +37fb2bde1e5a5551a1b4bf848734310103edb75a815e4ced8be43163ca13b3e399e91bf32b28de0b37c17d155f7129e23aec3deb2416122d7008a5684d5d0080f15e5eef787d292097cd781b3f95449b5f5a059a2cfbcd2cb10cc88a4759f2227f20d550c4cee567ab3e297191e8f1c3d537f1fc265c93ce900ae588d7d6a971cb0f0ae663a41347797bc4384568e439e10fa3cb24fefddf51202b17e35e5e3aba42fb067d15854bdeb400e8e96dfd097d5ffa793f3135cc819edefbf18c26c7e7a830988e8e1612a06c2d1f3bc03efb7ce5ca6538c4be7ba033a8f369fc479d527ca82cbc8198ef815ba7946fb7f4e7f503d280bddc767e39c4fb0ed54c86065a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58af8a27936cf507dcc7ec480ffce410373c81374fddcbad758a1976894d58e68d84f3da8a0bbbfd3d62d09679378ee94686866e0ef101e05ccb7cc8fdf6f31cbbf757c4d17aa607bc1decad9a65b8120adb7ef3b9d18a9c07226adf6f73f93c2ff79956f5e19b7c613dff1e907a8381863eb9ca536b44a3034cd522d6caa1766eda2dadd40a0f32380a30c0a0be3ad991007c8778ec855f0c2e9869718f07562ef2bce1d6fa7b551454eda2f86a514d0cd754188715d5f73cbe47d940b8a98a2d +f15e5eef787d292097cd781b3f95449b5f5a059a2cfbcd2cb10cc88a4759f2227f20d550c4cee567ab3e297191e8f1c3d537f1fc265c93ce900ae588d7d6a971cb0f0ae663a41347797bc4384568e439e10fa3cb24fefddf51202b17e35e5e3aba42fb067d15854bdeb400e8e96dfd097d5ffa793f3135cc819edefbf18c26c7e7a830988e8e1612a06c2d1f3bc03efb7ce5ca6538c4be7ba033a8f369fc479d527ca82cbc8198ef815ba7946fb7f4e7f503d280bddc767e39c4fb0ed54c86065a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58af8a27936cf507dcc7ec480ffce410373c81374fddcbad758a1976894d58e68d84f3da8a0bbbfd3d62d09679378ee94686866e0ef101e05ccb7cc8fdf6f31cbbf757c4d17aa607bc1decad9a65b8120adb7ef3b9d18a9c07226adf6f73f93c2ff79956f5e19b7c613dff1e907a8381863eb9ca536b44a3034cd522d6caa1766eda2dadd40a0f32380a30c0a0be3ad991007c8778ec855f0c2e9869718f07562ef2bce1d6fa7b551454eda2f86a514d0cd754188715d5f73cbe47d940b8a98a2de9cb66cba3830b2e732aa836df30b279f434ac98182114990d0b8d423813f75b5527dfa7982a167712380786bda08836976c21358a0d50e735f3efcb59ff69ac +cb0f0ae663a41347797bc4384568e439e10fa3cb24fefddf51202b17e35e5e3aba42fb067d15854bdeb400e8e96dfd097d5ffa793f3135cc819edefbf18c26c7e7a830988e8e1612a06c2d1f3bc03efb7ce5ca6538c4be7ba033a8f369fc479d527ca82cbc8198ef815ba7946fb7f4e7f503d280bddc767e39c4fb0ed54c86065a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58af8a27936cf507dcc7ec480ffce410373c81374fddcbad758a1976894d58e68d84f3da8a0bbbfd3d62d09679378ee94686866e0ef101e05ccb7cc8fdf6f31cbbf757c4d17aa607bc1decad9a65b8120adb7ef3b9d18a9c07226adf6f73f93c2ff79956f5e19b7c613dff1e907a8381863eb9ca536b44a3034cd522d6caa1766eda2dadd40a0f32380a30c0a0be3ad991007c8778ec855f0c2e9869718f07562ef2bce1d6fa7b551454eda2f86a514d0cd754188715d5f73cbe47d940b8a98a2de9cb66cba3830b2e732aa836df30b279f434ac98182114990d0b8d423813f75b5527dfa7982a167712380786bda08836976c21358a0d50e735f3efcb59ff69ace37ddc48ef2b83bcc1931cf6673dfa726ac5229b83be548b60416ed5c7daf3a3201db9aadd1ffe632a7d3012d94668d5191010dd35d8ba9dc881005e112f2808 +e7a830988e8e1612a06c2d1f3bc03efb7ce5ca6538c4be7ba033a8f369fc479d527ca82cbc8198ef815ba7946fb7f4e7f503d280bddc767e39c4fb0ed54c86065a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58af8a27936cf507dcc7ec480ffce410373c81374fddcbad758a1976894d58e68d84f3da8a0bbbfd3d62d09679378ee94686866e0ef101e05ccb7cc8fdf6f31cbbf757c4d17aa607bc1decad9a65b8120adb7ef3b9d18a9c07226adf6f73f93c2ff79956f5e19b7c613dff1e907a8381863eb9ca536b44a3034cd522d6caa1766eda2dadd40a0f32380a30c0a0be3ad991007c8778ec855f0c2e9869718f07562ef2bce1d6fa7b551454eda2f86a514d0cd754188715d5f73cbe47d940b8a98a2de9cb66cba3830b2e732aa836df30b279f434ac98182114990d0b8d423813f75b5527dfa7982a167712380786bda08836976c21358a0d50e735f3efcb59ff69ace37ddc48ef2b83bcc1931cf6673dfa726ac5229b83be548b60416ed5c7daf3a3201db9aadd1ffe632a7d3012d94668d5191010dd35d8ba9dc881005e112f28083f085c8094de717acd2516b631760110c176bff91d3e8cd4d2df79f79d450e54a5007e34caf791d9ac10aa98f45e52d987addf59f4beb5e62ef59e2e1b199413 +5a301ce502d083eeabcbcfd79dfc0de676d444c500d83d123367639d741e4fc4d87eea89f203fadd7e38f9a17b01a34ffe48f2469565751aca063c59614007c41aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58af8a27936cf507dcc7ec480ffce410373c81374fddcbad758a1976894d58e68d84f3da8a0bbbfd3d62d09679378ee94686866e0ef101e05ccb7cc8fdf6f31cbbf757c4d17aa607bc1decad9a65b8120adb7ef3b9d18a9c07226adf6f73f93c2ff79956f5e19b7c613dff1e907a8381863eb9ca536b44a3034cd522d6caa1766eda2dadd40a0f32380a30c0a0be3ad991007c8778ec855f0c2e9869718f07562ef2bce1d6fa7b551454eda2f86a514d0cd754188715d5f73cbe47d940b8a98a2de9cb66cba3830b2e732aa836df30b279f434ac98182114990d0b8d423813f75b5527dfa7982a167712380786bda08836976c21358a0d50e735f3efcb59ff69ace37ddc48ef2b83bcc1931cf6673dfa726ac5229b83be548b60416ed5c7daf3a3201db9aadd1ffe632a7d3012d94668d5191010dd35d8ba9dc881005e112f28083f085c8094de717acd2516b631760110c176bff91d3e8cd4d2df79f79d450e54a5007e34caf791d9ac10aa98f45e52d987addf59f4beb5e62ef59e2e1b1994131fa61652a5574f50fa159d47f8f28776e25e21b51103b91afc8345cfbedf46586e17269bfb521ae07f2cd202d308110abcb2b6f0157a55bc6aa6936812c1074d +1aff83247f8daae106f5cd50177b4b98388e6963cf51baaa1de17e90831b5977016aa71973485b4d8524b7aa4f6b7e0a8d994662b922aaab519ab0f8e0d1513ccf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58af8a27936cf507dcc7ec480ffce410373c81374fddcbad758a1976894d58e68d84f3da8a0bbbfd3d62d09679378ee94686866e0ef101e05ccb7cc8fdf6f31cbbf757c4d17aa607bc1decad9a65b8120adb7ef3b9d18a9c07226adf6f73f93c2ff79956f5e19b7c613dff1e907a8381863eb9ca536b44a3034cd522d6caa1766eda2dadd40a0f32380a30c0a0be3ad991007c8778ec855f0c2e9869718f07562ef2bce1d6fa7b551454eda2f86a514d0cd754188715d5f73cbe47d940b8a98a2de9cb66cba3830b2e732aa836df30b279f434ac98182114990d0b8d423813f75b5527dfa7982a167712380786bda08836976c21358a0d50e735f3efcb59ff69ace37ddc48ef2b83bcc1931cf6673dfa726ac5229b83be548b60416ed5c7daf3a3201db9aadd1ffe632a7d3012d94668d5191010dd35d8ba9dc881005e112f28083f085c8094de717acd2516b631760110c176bff91d3e8cd4d2df79f79d450e54a5007e34caf791d9ac10aa98f45e52d987addf59f4beb5e62ef59e2e1b1994131fa61652a5574f50fa159d47f8f28776e25e21b51103b91afc8345cfbedf46586e17269bfb521ae07f2cd202d308110abcb2b6f0157a55bc6aa6936812c1074dcd3dc1365d431608687e158b5b3622375e0ddda9cfccb2f16b4a966fc3ecababaa3ea4f8311b37c4578c4692a0d2bdd251c18a886c9b48671531db2759828959 +cf9906615f1bb36a01a9916b27484414e3f3b559e52cf3380b422df71eda463fd1ef24a8d84e82d9718fb46d51d13687352ea76737209d618e77119b066161e2d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58af8a27936cf507dcc7ec480ffce410373c81374fddcbad758a1976894d58e68d84f3da8a0bbbfd3d62d09679378ee94686866e0ef101e05ccb7cc8fdf6f31cbbf757c4d17aa607bc1decad9a65b8120adb7ef3b9d18a9c07226adf6f73f93c2ff79956f5e19b7c613dff1e907a8381863eb9ca536b44a3034cd522d6caa1766eda2dadd40a0f32380a30c0a0be3ad991007c8778ec855f0c2e9869718f07562ef2bce1d6fa7b551454eda2f86a514d0cd754188715d5f73cbe47d940b8a98a2de9cb66cba3830b2e732aa836df30b279f434ac98182114990d0b8d423813f75b5527dfa7982a167712380786bda08836976c21358a0d50e735f3efcb59ff69ace37ddc48ef2b83bcc1931cf6673dfa726ac5229b83be548b60416ed5c7daf3a3201db9aadd1ffe632a7d3012d94668d5191010dd35d8ba9dc881005e112f28083f085c8094de717acd2516b631760110c176bff91d3e8cd4d2df79f79d450e54a5007e34caf791d9ac10aa98f45e52d987addf59f4beb5e62ef59e2e1b1994131fa61652a5574f50fa159d47f8f28776e25e21b51103b91afc8345cfbedf46586e17269bfb521ae07f2cd202d308110abcb2b6f0157a55bc6aa6936812c1074dcd3dc1365d431608687e158b5b3622375e0ddda9cfccb2f16b4a966fc3ecababaa3ea4f8311b37c4578c4692a0d2bdd251c18a886c9b48671531db27598289593cf82813da4f43eb854142ef39c4e5950f86b29e291737413396ae4c62f4472fe12659e12b61b84619a96b03a386dd6adb6b74ce09bc11330482e01564d3eb1a +d93cc6ac5cb77a7a0d14988e3355e07a2f02bed2f8cec08807c544efd8ccc5ca3475e8be3143997d402aecfb56e80697f57179e6d631e38741ff3ef57a7ff80cb46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58af8a27936cf507dcc7ec480ffce410373c81374fddcbad758a1976894d58e68d84f3da8a0bbbfd3d62d09679378ee94686866e0ef101e05ccb7cc8fdf6f31cbbf757c4d17aa607bc1decad9a65b8120adb7ef3b9d18a9c07226adf6f73f93c2ff79956f5e19b7c613dff1e907a8381863eb9ca536b44a3034cd522d6caa1766eda2dadd40a0f32380a30c0a0be3ad991007c8778ec855f0c2e9869718f07562ef2bce1d6fa7b551454eda2f86a514d0cd754188715d5f73cbe47d940b8a98a2de9cb66cba3830b2e732aa836df30b279f434ac98182114990d0b8d423813f75b5527dfa7982a167712380786bda08836976c21358a0d50e735f3efcb59ff69ace37ddc48ef2b83bcc1931cf6673dfa726ac5229b83be548b60416ed5c7daf3a3201db9aadd1ffe632a7d3012d94668d5191010dd35d8ba9dc881005e112f28083f085c8094de717acd2516b631760110c176bff91d3e8cd4d2df79f79d450e54a5007e34caf791d9ac10aa98f45e52d987addf59f4beb5e62ef59e2e1b1994131fa61652a5574f50fa159d47f8f28776e25e21b51103b91afc8345cfbedf46586e17269bfb521ae07f2cd202d308110abcb2b6f0157a55bc6aa6936812c1074dcd3dc1365d431608687e158b5b3622375e0ddda9cfccb2f16b4a966fc3ecababaa3ea4f8311b37c4578c4692a0d2bdd251c18a886c9b48671531db27598289593cf82813da4f43eb854142ef39c4e5950f86b29e291737413396ae4c62f4472fe12659e12b61b84619a96b03a386dd6adb6b74ce09bc11330482e01564d3eb1a688a80b912ad6d8ce2b939e06e7ecc18c358772ea0c92e82ef26d9bbe342a18babc0d54f676ed9c380fc990a7d576c958d19f6e15fda4fe08752bb8d1eedb05f +b46af0bf761b78533e01a0dd7e07216c9710ef35f09a28d1e5fa469b602472ca5085f6dbcc6a6b51fb89986f8feca85658d05701f5677d0bb340a1f2c769547219f5420c62ffff7d1304dad82b6dec2bdc59ec12a9e18a774eed128c2c90610a9d4c75c0817d64817a76bbc12746971ae897af210a072c1bc9fb044e086b7bfe85fad95d5c2bbb28c12de5755b1ccde63e93cc892b4d2bcbd7dc0706b094c2492e329e3b9a98a9cbc7d01031cf1d5861f576e1291df6286c28146b0b4df9ad44a8d40ce05f73fa3de1a92f948c38fe88a296db696a16742c5073aed1f26c6289675c28c763ab90a070b643ecf1c50f4165b82cf5b8eda4137903765f42cbaef571f6303486a899aef83ca9c8c1e53af717293a6e219675aa1f479eac02d30df16649fc1c83b24855617385b5330b054c13f8fe8670ea2383552fe7fa096a6ff0d90d3922c26b77fb632041df8a3c585f295488aa98d73bc6a3a43eac5644b59440e02ed8a6b9a8acb9f33e732c1850ed6f811975a84b65cb8775df2f55f15f58af8a27936cf507dcc7ec480ffce410373c81374fddcbad758a1976894d58e68d84f3da8a0bbbfd3d62d09679378ee94686866e0ef101e05ccb7cc8fdf6f31cbbf757c4d17aa607bc1decad9a65b8120adb7ef3b9d18a9c07226adf6f73f93c2ff79956f5e19b7c613dff1e907a8381863eb9ca536b44a3034cd522d6caa1766eda2dadd40a0f32380a30c0a0be3ad991007c8778ec855f0c2e9869718f07562ef2bce1d6fa7b551454eda2f86a514d0cd754188715d5f73cbe47d940b8a98a2de9cb66cba3830b2e732aa836df30b279f434ac98182114990d0b8d423813f75b5527dfa7982a167712380786bda08836976c21358a0d50e735f3efcb59ff69ace37ddc48ef2b83bcc1931cf6673dfa726ac5229b83be548b60416ed5c7daf3a3201db9aadd1ffe632a7d3012d94668d5191010dd35d8ba9dc881005e112f28083f085c8094de717acd2516b631760110c176bff91d3e8cd4d2df79f79d450e54a5007e34caf791d9ac10aa98f45e52d987addf59f4beb5e62ef59e2e1b1994131fa61652a5574f50fa159d47f8f28776e25e21b51103b91afc8345cfbedf46586e17269bfb521ae07f2cd202d308110abcb2b6f0157a55bc6aa6936812c1074dcd3dc1365d431608687e158b5b3622375e0ddda9cfccb2f16b4a966fc3ecababaa3ea4f8311b37c4578c4692a0d2bdd251c18a886c9b48671531db27598289593cf82813da4f43eb854142ef39c4e5950f86b29e291737413396ae4c62f4472fe12659e12b61b84619a96b03a386dd6adb6b74ce09bc11330482e01564d3eb1a688a80b912ad6d8ce2b939e06e7ecc18c358772ea0c92e82ef26d9bbe342a18babc0d54f676ed9c380fc990a7d576c958d19f6e15fda4fe08752bb8d1eedb05fbb420713aa2c9df64fc3fcb136d739466a36b38c515e44b1fd8e04717ab838bb8ad38ee6613c173d1d973f478cb0abcd6e69ac2570b8c9b78264ceb9d4a975c8 diff -Nru libsodium-1.0.17/test/default/wasi-test-wrapper.sh libsodium-1.0.18/test/default/wasi-test-wrapper.sh --- libsodium-1.0.17/test/default/wasi-test-wrapper.sh 1970-01-01 00:00:00.000000000 +0000 +++ libsodium-1.0.18/test/default/wasi-test-wrapper.sh 2019-05-30 20:13:18.000000000 +0000 @@ -0,0 +1,28 @@ +#! /bin/sh + +MAX_MEMORY_TESTS="67108864" + +if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmtime" ]; then + if command -v wasmtime >/dev/null; then + wasmtime -o --dir=. "$1" && exit 0 + fi +fi + +if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "lucet" ]; then + if command -v lucetc-wasi >/dev/null && command -v lucet-wasi >/dev/null; then + lucetc-wasi \ + --reserved-size "${MAX_MEMORY_TESTS}" \ + -o "${1}.so" --opt-level fast "$1" && + lucet-wasi --dir=.:. --max-heap-size "${MAX_MEMORY_TESTS}" "${1}.so" && + rm -f "${1}.so" && exit 0 + fi +fi + +if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmer" ]; then + if command -v wasmer >/dev/null; then + wasmer run "$1" --backend "${WASMER_BACKEND:-cranelift}" --dir=. && exit 0 + fi +fi + +echo "WebAssembly runtime failed" >&2 +exit 1 diff -Nru libsodium-1.0.17/test/quirks/quirks.h libsodium-1.0.18/test/quirks/quirks.h --- libsodium-1.0.17/test/quirks/quirks.h 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/test/quirks/quirks.h 2019-05-30 20:13:18.000000000 +0000 @@ -4,23 +4,6 @@ /* C++Builder defines a "random" macro */ #undef random -#ifdef __native_client__ -# define memset(dst, c, n) xmemset(dst, c, n) - -static void * -xmemset(void *dst, int c, size_t n) -{ - unsigned char * dst_ = (unsigned char *) dst; - const unsigned char c_ = (unsigned char) c; - size_t i; - - for (i = 0; i < n; i++) { - dst_[i] = c_; - } - return dst; -} -#endif - #ifdef __EMSCRIPTEN__ # define strcmp(s1, s2) xstrcmp(s1, s2) diff -Nru libsodium-1.0.17/.travis.yml libsodium-1.0.18/.travis.yml --- libsodium-1.0.17/.travis.yml 2019-01-06 19:32:54.000000000 +0000 +++ libsodium-1.0.18/.travis.yml 2019-05-30 20:13:18.000000000 +0000 @@ -12,22 +12,32 @@ install: - ./autogen.sh - - env CC=tcc CFLAGS='-w' ./configure --prefix=/tmp --disable-dependency-tracking --disable-shared || cat config.log + - env CC=tcc CFLAGS='-w' CPPFLAGS="-DDEV_MODE=1" ./configure --prefix=/tmp --disable-dependency-tracking --disable-shared || cat config.log - make -j $(nproc) && make check && make install - env CC=tcc CPPFLAGS='-I/tmp/include' LDFLAGS='-L/tmp/lib' LD_LIBRARY_PATH='/tmp/lib' ./test/constcheck.sh - make uninstall - make distclean script: - - ./configure --disable-dependency-tracking + - env CPPFLAGS="-DDEV_MODE=1" ./configure --disable-dependency-tracking - if [ "$TRAVIS_OS_NAME" = 'linux' -a "$CC" = 'gcc' ]; then make -j $(nproc) CFLAGS='-g0' > /dev/null && cp src/libsodium/.libs/libsodium.so lib.so && make clean > /dev/null && make CFLAGS='-g0' CPPFLAGS='-DSODIUM_C99\(X\)=' > /dev/null && cp src/libsodium/.libs/libsodium.so lib-oldc.so && cmp lib.so lib-oldc.so && echo No binary changes && make clean > /dev/null ; fi - make distcheck - make distclean > /dev/null - - ./configure --disable-dependency-tracking --enable-minimal + - CPPFLAGS="-DDEV_MODE=1" ./configure --disable-dependency-tracking --enable-minimal + - make -j $(nproc) - make check - ( echo '#include ' ; echo 'int main(void) { return sodium_init(); }' ) > /tmp/main.c && gcc -Isrc/libsodium/include -Isrc/libsodium/include/sodium $(find src -name '*.c' -o -name '*.S') /tmp/main.c + - make distclean > /dev/null + +after_success: + - CPPFLAGS="-DDEV_MODE=1" ./configure --disable-dependency-tracking --host=powerpc-linux-gnu + - make -j $(nproc) + - env QEMU_LD_PREFIX=/usr/powerpc-linux-gnu make check + - make clean > /dev/null addons: apt: packages: - tcc + - qemu-user-static + - gcc-powerpc-linux-gnu