diff -Nru libsodium-1.0.16/appveyor.yml libsodium-1.0.18/appveyor.yml
--- libsodium-1.0.16/appveyor.yml 2017-12-13 09:24:13.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.16/AUTHORS libsodium-1.0.18/AUTHORS
--- libsodium-1.0.16/AUTHORS 2017-12-13 09:24:13.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.16/autogen.sh libsodium-1.0.18/autogen.sh
--- libsodium-1.0.16/autogen.sh 2017-12-13 09:24:13.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.16/azure-pipelines.yml libsodium-1.0.18/azure-pipelines.yml
--- libsodium-1.0.16/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.16/builds/Makefile.am libsodium-1.0.18/builds/Makefile.am
--- libsodium-1.0.16/builds/Makefile.am 2017-12-13 09:24:13.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.16/builds/msvc/build/buildall.bat libsodium-1.0.18/builds/msvc/build/buildall.bat
--- libsodium-1.0.16/builds/msvc/build/buildall.bat 2017-12-13 09:24:13.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.16/builds/msvc/build/buildbase.bat libsodium-1.0.18/builds/msvc/build/buildbase.bat
--- libsodium-1.0.16/builds/msvc/build/buildbase.bat 2017-12-13 09:24:13.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.16/builds/msvc/resource.rc libsodium-1.0.18/builds/msvc/resource.rc
--- libsodium-1.0.16/builds/msvc/resource.rc 2017-12-13 09:24:13.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.16.0"
-#define LIBSODIUM_VERSION_BIN 1,0,16,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)
@@ -47,7 +47,7 @@
VALUE "FileDescription", "The Sodium crypto library (libsodium) "
VALUE "FileVersion", LIBSODIUM_VERSION_STRING
VALUE "InternalName", "libsodium"
- VALUE "LegalCopyright", "Copyright (c) 2017 The libsodium authors."
+ VALUE "LegalCopyright", "Copyright (c) 2013-2019 The libsodium authors."
VALUE "OriginalFilename", "libsodium.dll"
VALUE "ProductName", LIBSODIUM_PRODUCT_NAME
VALUE "ProductVersion", LIBSODIUM_VERSION_STRING
diff -Nru libsodium-1.0.16/builds/msvc/version.h libsodium-1.0.18/builds/msvc/version.h
--- libsodium-1.0.16/builds/msvc/version.h 2017-12-13 09:24:13.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.16"
+#define SODIUM_VERSION_STRING "1.0.18"
#define SODIUM_LIBRARY_VERSION_MAJOR 10
-#define SODIUM_LIBRARY_VERSION_MINOR 1
+#define SODIUM_LIBRARY_VERSION_MINOR 3
#ifdef __cplusplus
extern "C" {
diff -Nru libsodium-1.0.16/builds/msvc/vs2010/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2010/libsodium/libsodium.vcxproj
--- libsodium-1.0.16/builds/msvc/vs2010/libsodium/libsodium.vcxproj 2017-12-13 09:24:13.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 @@
+
@@ -259,6 +261,7 @@
+
diff -Nru libsodium-1.0.16/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters
--- libsodium-1.0.16/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters 2017-12-13 09:24:13.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
@@ -566,6 +572,9 @@
include\sodium\private
+
+ include\sodium\private
+
include\sodium\private
@@ -877,6 +886,12 @@
{834d4827-81e4-3de3-baa1-a216763f11d6}
+
+ {52bf28eb-7ffd-399a-be35-0df3e8e99c15}
+
+
+ {39cc576f-4b54-3d71-b14c-27445bc4b138}
+
{b9b02bee-5c1f-36d2-b97d-983f865a4cc6}
@@ -970,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.16/builds/msvc/vs2012/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2012/libsodium/libsodium.vcxproj
--- libsodium-1.0.16/builds/msvc/vs2012/libsodium/libsodium.vcxproj 2017-12-13 09:24:13.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 @@
+
@@ -259,6 +261,7 @@
+
diff -Nru libsodium-1.0.16/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters
--- libsodium-1.0.16/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters 2017-12-13 09:24:13.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
@@ -566,6 +572,9 @@
include\sodium\private
+
+ include\sodium\private
+
include\sodium\private
@@ -877,6 +886,12 @@
{834d4827-81e4-3de3-baa1-a216763f11d6}
+
+ {52bf28eb-7ffd-399a-be35-0df3e8e99c15}
+
+
+ {39cc576f-4b54-3d71-b14c-27445bc4b138}
+
{b9b02bee-5c1f-36d2-b97d-983f865a4cc6}
@@ -970,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.16/builds/msvc/vs2013/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2013/libsodium/libsodium.vcxproj
--- libsodium-1.0.16/builds/msvc/vs2013/libsodium/libsodium.vcxproj 2017-12-13 09:24:13.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 @@
+
@@ -259,6 +261,7 @@
+
diff -Nru libsodium-1.0.16/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters
--- libsodium-1.0.16/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters 2017-12-13 09:24:13.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
@@ -566,6 +572,9 @@
include\sodium\private
+
+ include\sodium\private
+
include\sodium\private
@@ -877,6 +886,12 @@
{834d4827-81e4-3de3-baa1-a216763f11d6}
+
+ {52bf28eb-7ffd-399a-be35-0df3e8e99c15}
+
+
+ {39cc576f-4b54-3d71-b14c-27445bc4b138}
+
{b9b02bee-5c1f-36d2-b97d-983f865a4cc6}
@@ -970,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.16/builds/msvc/vs2015/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2015/libsodium/libsodium.vcxproj
--- libsodium-1.0.16/builds/msvc/vs2015/libsodium/libsodium.vcxproj 2017-12-13 09:24:13.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 @@
+
@@ -259,6 +261,7 @@
+
diff -Nru libsodium-1.0.16/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters
--- libsodium-1.0.16/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters 2017-12-13 09:24:13.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
@@ -566,6 +572,9 @@
include\sodium\private
+
+ include\sodium\private
+
include\sodium\private
@@ -877,6 +886,12 @@
{834d4827-81e4-3de3-baa1-a216763f11d6}
+
+ {52bf28eb-7ffd-399a-be35-0df3e8e99c15}
+
+
+ {39cc576f-4b54-3d71-b14c-27445bc4b138}
+
{b9b02bee-5c1f-36d2-b97d-983f865a4cc6}
@@ -970,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.16/builds/msvc/vs2017/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2017/libsodium/libsodium.vcxproj
--- libsodium-1.0.16/builds/msvc/vs2017/libsodium/libsodium.vcxproj 2017-12-13 09:24:13.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 @@
+
@@ -259,6 +261,7 @@
+
diff -Nru libsodium-1.0.16/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters
--- libsodium-1.0.16/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters 2017-12-13 09:24:13.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
@@ -566,6 +572,9 @@
include\sodium\private
+
+ include\sodium\private
+
include\sodium\private
@@ -877,6 +886,12 @@
{834d4827-81e4-3de3-baa1-a216763f11d6}
+
+ {52bf28eb-7ffd-399a-be35-0df3e8e99c15}
+
+
+ {39cc576f-4b54-3d71-b14c-27445bc4b138}
+
{b9b02bee-5c1f-36d2-b97d-983f865a4cc6}
@@ -970,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.16/builds/msvc/vs2019/libsodium/libsodium.props libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.props
--- libsodium-1.0.16/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.16/builds/msvc/vs2019/libsodium/libsodium.vcxproj libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.vcxproj
--- libsodium-1.0.16/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.16/builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters
--- libsodium-1.0.16/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.16/builds/msvc/vs2019/libsodium/libsodium.xml libsodium-1.0.18/builds/msvc/vs2019/libsodium/libsodium.xml
--- libsodium-1.0.16/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.16/builds/msvc/vs2019/libsodium.import.props libsodium-1.0.18/builds/msvc/vs2019/libsodium.import.props
--- libsodium-1.0.16/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.16/builds/msvc/vs2019/libsodium.import.xml libsodium-1.0.18/builds/msvc/vs2019/libsodium.import.xml
--- libsodium-1.0.16/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.16/builds/msvc/vs2019/libsodium.sln libsodium-1.0.18/builds/msvc/vs2019/libsodium.sln
--- libsodium-1.0.16/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.16/ChangeLog libsodium-1.0.18/ChangeLog
--- libsodium-1.0.16/ChangeLog 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/ChangeLog 2019-05-30 20:13:18.000000000 +0000
@@ -1,4 +1,62 @@
+* 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
+module; fall back to Javascript on these.
+ - JS/WebAssembly: compatibility with newer Emscripten versions.
+ - Bug fix: `crypto_pwhash_scryptsalsa208sha256_str_verify()` and
+`crypto_pwhash_scryptsalsa208sha256_str_needs_rehash()` didn't return
+`EINVAL` on input strings with a short length, unlike their high-level
+counterpart.
+ - Added a workaround for Visual Studio 2010 bug causing CPU features
+not to be detected.
+ - Portability improvements.
+ - Test vectors from Project Wycheproof have been added.
+ - New low-level APIs for arithmetic mod the order of the prime order group:
+`crypto_core_ed25519_scalar_random()`, `crypto_core_ed25519_scalar_reduce()`,
+`crypto_core_ed25519_scalar_invert()`, `crypto_core_ed25519_scalar_negate()`,
+`crypto_core_ed25519_scalar_complement()`, `crypto_core_ed25519_scalar_add()`
+and `crypto_core_ed25519_scalar_sub()`.
+ - New low-level APIs for scalar multiplication without clamping:
+`crypto_scalarmult_ed25519_base_noclamp()` and
+`crypto_scalarmult_ed25519_noclamp()`. These new APIs are especially useful
+for blinding.
+ - `sodium_sub()` has been implemented.
+ - Support for WatchOS has been added.
+ - getrandom(2) is now used on FreeBSD 12+.
+ - The `nonnull` attribute has been added to all relevant prototypes.
+ - More reliable AVX512 detection.
+ - Javascript/Webassembly builds now use dynamic memory growth.
+
* Version 1.0.16
- Signatures computations and verifications are now way faster on
64-bit platforms with compilers supporting 128-bit arithmetic (gcc,
diff -Nru libsodium-1.0.16/configure.ac libsodium-1.0.18/configure.ac
--- libsodium-1.0.16/configure.ac 2017-12-13 09:24:13.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.16],
+AC_INIT([libsodium],[1.0.18],
[https://github.com/jedisct1/libsodium/issues],
[libsodium],
[https://github.com/jedisct1/libsodium])
@@ -13,13 +13,11 @@
AM_DEP_TRACK
AC_SUBST(VERSION)
-ISODATE=`date +%Y-%m-%d`
-AC_SUBST(ISODATE)
SODIUM_LIBRARY_VERSION_MAJOR=10
-SODIUM_LIBRARY_VERSION_MINOR=1
-DLL_VERSION=8
-SODIUM_LIBRARY_VERSION=24:0:1
+SODIUM_LIBRARY_VERSION_MINOR=3
+DLL_VERSION=24
+SODIUM_LIBRARY_VERSION=26:0:3
# | | |
# +------+ | +---+
# | | |
@@ -38,6 +36,7 @@
AC_LANG_ASSERT(C)
LX_CFLAGS=${CFLAGS-NONE}
+PKGCONFIG_LIBS_PRIVATE=""
dnl Path check
@@ -61,7 +60,7 @@
])
AC_ARG_ENABLE(asm,
-[AS_HELP_STRING(--disable-asm,Do not compile assembly code -- This disables all (including non-assembly) platform-specific optimizations on Unix systems)],
+[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"
@@ -83,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)],
@@ -126,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,
@@ -151,6 +160,17 @@
])
])
+AC_ARG_ENABLE(retpoline,
+[AS_HELP_STRING(--enable-retpoline,Use return trampolines for indirect calls)],
+[AS_IF([test "x$enableval" = "xyes"], [
+ AX_CHECK_COMPILE_FLAG([-mindirect-branch=thunk-inline],
+ [CFLAGS="$CFLAGS -mindirect-branch=thunk-inline"],
+ [AX_CHECK_COMPILE_FLAG([-mretpoline], [CFLAGS="$CFLAGS -mretpoline"])]
+ )
+ AX_CHECK_COMPILE_FLAG([-mindirect-branch-register])
+ ])
+])
+
ENABLE_CWFLAGS=no
AC_ARG_ENABLE(debug,
[AS_HELP_STRING(--enable-debug,For maintainers only - please do not use)],
@@ -176,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
@@ -192,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],
@@ -264,7 +287,7 @@
AS_IF([test "x$enable_ssp" != "xno"],[
AS_CASE([$host_os],
- [cygwin*|mingw*|msys|pw32*|cegcc*], [ ],
+ [cygwin*|mingw*|msys|pw32*|cegcc*|haiku|none], [ ],
[*], [
AX_CHECK_COMPILE_FLAG([-fstack-protector], [
AX_CHECK_LINK_FLAG([-fstack-protector],
@@ -324,24 +347,13 @@
AX_CHECK_LINK_FLAG([-Wl,-z,now], [LDFLAGS="$LDFLAGS -Wl,-z,now"])
AX_CHECK_LINK_FLAG([-Wl,-z,noexecstack], [LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"])
-AC_MSG_CHECKING(for a broken clang + AVX512 combination)
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
-#if !(defined(__AVX512F__) && defined(__clang__) && __clang_major__ < 4)
-#error Not a broken clang + AVX512 combination
-#endif
-]])],
- [AC_MSG_RESULT(yes - disabling AVX512 optimizations)
- AX_CHECK_COMPILE_FLAG([$CFLAGS -mno-avx512f],
- [CFLAGS="$CFLAGS -mno-avx512f"])
- ],
- [AC_MSG_RESULT(no)
-])
-
AX_CHECK_CATCHABLE_SEGV
AX_CHECK_CATCHABLE_ABRT
AS_IF([test "x$with_threads" = "xyes"], [
- AX_TLS([AC_MSG_RESULT(thread local storage is supported)],
+ AX_TLS([AC_MSG_RESULT(thread local storage is supported)
+ AX_CHECK_COMPILE_FLAG([-ftls-model=local-dynamic],
+ [CFLAGS="$CFLAGS -ftls-model=local-dynamic"])],
[AC_MSG_RESULT(thread local storage is not supported)]) ])
LT_INIT
@@ -352,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"])
@@ -428,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(); ]])],
@@ -444,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
]], [[
@@ -459,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()); ]])],
@@ -477,19 +480,32 @@
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
]], [[
+
+#ifndef __AVX512F__
+# error No AVX512 support
+#elif defined(__clang__)
+# if __clang_major__ < 4
+# error Compiler AVX512 support may be broken
+# endif
+#elif defined(__GNUC__)
+# if __GNUC__ < 6
+# error Compiler AVX512 support may be broken
+# endif
+#endif
+
__m512i x = _mm512_setzero_epi32();
__m512i y = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7), x);
]])],
[AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_AVX512FINTRIN_H], [1], [AVX512F is available])
AX_CHECK_COMPILE_FLAG([-mavx512f], [CFLAGS_AVX512F="-mavx512f"])],
- [AC_MSG_RESULT(no)])
+ [AC_MSG_RESULT(no)
+ AX_CHECK_COMPILE_FLAG([$CFLAGS -mno-avx512f],
+ [CFLAGS="$CFLAGS -mno-avx512f"])
+ ])
CFLAGS="$oldcflags"
oldcflags="$CFLAGS"
@@ -497,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
@@ -517,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); ]])],
@@ -544,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(
@@ -580,6 +590,18 @@
CPPFLAGS="$CPPFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
])
+AC_MSG_CHECKING(whether we can use inline asm code)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+]], [[
+int a = 42;
+int *pnt = &a;
+__asm__ __volatile__ ("" : : "r"(pnt) : "memory");
+]])],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_INLINE_ASM], [1], [inline asm code can be used])]
+ [AC_MSG_RESULT(no)]
+)
+
HAVE_AMD64_ASM_V=0
AS_IF([test "$enable_asm" != "no"],[
AC_MSG_CHECKING(whether we can use x86_64 asm code)
@@ -635,18 +657,17 @@
AC_MSG_CHECKING(for 128-bit arithmetic)
HAVE_TI_MODE_V=0
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#if !defined(__GNUC__) && !defined(__SIZEOF_INT128__)
+#if !defined(__clang__) && !defined(__GNUC__) && !defined(__SIZEOF_INT128__)
# error mode(TI) is a gcc extension, and __int128 is not available
#endif
-#if defined(__clang__) && !defined(__x86_64__)
+#if defined(__clang__) && !defined(__x86_64__) && !defined(__aarch64__)
# error clang does not properly handle the 128-bit type on 32-bit systems
#endif
#ifndef NATIVE_LITTLE_ENDIAN
# error libsodium currently expects a little endian CPU for the 128-bit type
#endif
#ifdef __EMSCRIPTEN__
-# error emscripten currently supports only shift operations on integers \
-# larger than 64 bits
+# error emscripten currently doesn't support some operations on integers larger than 64 bits
#endif
#include
#include
@@ -657,6 +678,8 @@
#endif
void fcontract(uint128_t *t) {
*t += 0x8000000000000 - 1;
+ *t *= *t;
+ *t >>= 84;
}
]], [[
(void) fcontract;
@@ -669,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];
@@ -686,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"
@@ -772,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 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])
@@ -785,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.16/contrib/Findsodium.cmake libsodium-1.0.18/contrib/Findsodium.cmake
--- libsodium-1.0.16/contrib/Findsodium.cmake 2017-12-13 09:24:13.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)
- 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)
-
- # if pkgconfig for libsodium doesn't provide
- # static lib info, then override PKG_STATIC here..
- if (sodium_PKG_STATIC_LIBRARIES STREQUAL "")
- 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.16/debian/changelog libsodium-1.0.18/debian/changelog
--- libsodium-1.0.16/debian/changelog 2017-12-26 10:09:42.000000000 +0000
+++ libsodium-1.0.18/debian/changelog 2020-05-25 14:40:44.000000000 +0000
@@ -1,3 +1,28 @@
+libsodium (1.0.18-1~18.04~wfg1) bionic; urgency=medium
+
+ * Copied from debian
+
+ -- Rico Tzschichholz Mon, 25 May 2020 16:40:44 +0200
+
+libsodium (1.0.18-1) unstable; urgency=medium
+
+ * New upstream release.
+ * Update libsodium23.symbols .
+ * Refer CC0 license via path in common licenses (closes: #882633).
+ * Update Standards-Version to 4.4.0 .
+
+ -- Laszlo Boszormenyi (GCS) Sun, 18 Aug 2019 11:58:00 +0000
+
+libsodium (1.0.17-1) unstable; urgency=medium
+
+ * New upstream release.
+ * Update libsodium23.symbols .
+ * Don't specify parallel to debhelper.
+ * Update watch file.
+ * Update Standards-Version to 4.3.0 .
+
+ -- Laszlo Boszormenyi (GCS) Thu, 24 Jan 2019 18:51:58 +0100
+
libsodium (1.0.16-2) unstable; urgency=medium
* Upload to Sid for starting the package transition.
diff -Nru libsodium-1.0.16/debian/control libsodium-1.0.18/debian/control
--- libsodium-1.0.16/debian/control 2017-12-19 19:25:34.000000000 +0000
+++ libsodium-1.0.18/debian/control 2019-08-18 11:58:00.000000000 +0000
@@ -3,10 +3,10 @@
Priority: optional
Build-Depends: debhelper ( >= 11), pkg-config
Maintainer: Laszlo Boszormenyi (GCS)
-Standards-Version: 4.1.2
+Standards-Version: 4.4.0
Vcs-Git: git://github.com/gcsideal/debian-libsodium
Vcs-Browser: https://github.com/gcsideal/debian-libsodium
-Homepage: http://www.libsodium.org/
+Homepage: https://www.libsodium.org/
Package: libsodium23
Depends: ${misc:Depends}, ${shlibs:Depends}
diff -Nru libsodium-1.0.16/debian/copyright libsodium-1.0.18/debian/copyright
--- libsodium-1.0.16/debian/copyright 2017-10-16 17:50:26.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.16/debian/libsodium23.symbols libsodium-1.0.18/debian/libsodium23.symbols
--- libsodium-1.0.16/debian/libsodium23.symbols 2017-12-19 19:25:34.000000000 +0000
+++ libsodium-1.0.18/debian/libsodium23.symbols 2019-08-18 11:58:00.000000000 +0000
@@ -146,8 +146,21 @@
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
+ crypto_core_ed25519_scalar_sub@Base 1.0.17
+ crypto_core_ed25519_scalarbytes@Base 1.0.17
crypto_core_ed25519_sub@Base 1.0.16
crypto_core_ed25519_uniformbytes@Base 1.0.16
crypto_core_hchacha20@Base 1.0.10
@@ -160,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
@@ -358,9 +388,15 @@
crypto_scalarmult_curve25519_scalarbytes@Base 0.6.0
crypto_scalarmult_ed25519@Base 1.0.16
crypto_scalarmult_ed25519_base@Base 1.0.16
+ crypto_scalarmult_ed25519_base_noclamp@Base 1.0.17
crypto_scalarmult_ed25519_bytes@Base 1.0.16
+ 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
@@ -524,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
@@ -569,5 +605,6 @@
sodium_runtime_has_ssse3@Base 1.0.8
sodium_set_misuse_handler@Base 1.0.14
sodium_stackzero@Base 1.0.16
+ sodium_sub@Base 1.0.17
sodium_unpad@Base 1.0.14
sodium_version_string@Base 0.6.0
diff -Nru libsodium-1.0.16/debian/rules libsodium-1.0.18/debian/rules
--- libsodium-1.0.16/debian/rules 2017-12-19 19:25:34.000000000 +0000
+++ libsodium-1.0.18/debian/rules 2019-01-24 17:51:58.000000000 +0000
@@ -5,4 +5,4 @@
#export DH_VERBOSE=1
%:
- dh $@ --with autoreconf -Bbuild --parallel
+ dh $@ --with autoreconf -Bbuild
diff -Nru libsodium-1.0.16/debian/watch libsodium-1.0.18/debian/watch
--- libsodium-1.0.16/debian/watch 2014-03-21 23:53:22.000000000 +0000
+++ libsodium-1.0.18/debian/watch 2019-01-24 17:51:58.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.16/dist-build/android-build.sh libsodium-1.0.18/dist-build/android-build.sh
--- libsodium-1.0.16/dist-build/android-build.sh 2017-12-13 09:24:13.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
@@ -45,9 +51,15 @@
"$MAKE_TOOLCHAIN" --force --api="$NDK_API_VERSION_COMPAT" \
--arch="$ARCH" --install-dir="$TOOLCHAIN_DIR" || exit 1
+if [ -z "$LIBSODIUM_FULL_BUILD" ]; then
+ export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal"
+else
+ export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
+fi
+
./configure \
--disable-soname-versions \
- --enable-minimal \
+ ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--host="${HOST_COMPILER}" \
--prefix="${PREFIX}" \
--with-sysroot="${TOOLCHAIN_DIR}/sysroot" || exit 1
@@ -63,7 +75,7 @@
./configure \
--disable-soname-versions \
- --enable-minimal \
+ ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--host="${HOST_COMPILER}" \
--prefix="${PREFIX}" \
--with-sysroot="${TOOLCHAIN_DIR}/sysroot" || exit 1
@@ -77,6 +89,10 @@
rm -f config-def.log config-def-compat.log
fi
+
+NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
+PROCESSORS=${NPROCESSORS:-3}
+
make clean && \
-make -j3 install && \
+make -j${PROCESSORS} install && \
echo "libsodium has been installed into ${PREFIX}"
diff -Nru libsodium-1.0.16/dist-build/emscripten.sh libsodium-1.0.18/dist-build/emscripten.sh
--- libsodium-1.0.16/dist-build/emscripten.sh 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/dist-build/emscripten.sh 2019-05-30 20:13:18.000000000 +0000
@@ -1,23 +1,25 @@
#! /bin/sh
export MAKE_FLAGS='-j4'
-export EXPORTED_FUNCTIONS_STANDARD='["_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_npubbytes","_crypto_aead_chacha20poly1305_ietf_nsecbytes","_crypto_aead_chacha20poly1305_keybytes","_crypto_aead_chacha20poly1305_keygen","_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_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_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_core_hchacha20","_crypto_core_hchacha20_constbytes","_crypto_core_hchacha20_inputbytes","_crypto_core_hchacha20_keybytes","_crypto_core_hchacha20_outputbytes","_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_primitive","_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_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_open","_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_keygen","_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='["_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_npubbytes","_crypto_aead_chacha20poly1305_ietf_nsecbytes","_crypto_aead_chacha20poly1305_keybytes","_crypto_aead_chacha20poly1305_keygen","_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_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_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_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_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_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_bytes","_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_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_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_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_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_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_noncebytes","_crypto_stream_chacha20_ietf_xor","_crypto_stream_chacha20_ietf_xor_ic","_crypto_stream_chacha20_keybytes","_crypto_stream_chacha20_keygen","_crypto_stream_chacha20_noncebytes","_crypto_stream_chacha20_xor","_crypto_stream_chacha20_xor_ic","_crypto_stream_keybytes","_crypto_stream_keygen","_crypto_stream_noncebytes","_crypto_stream_primitive","_crypto_stream_salsa20","_crypto_stream_salsa2012","_crypto_stream_salsa2012_keybytes","_crypto_stream_salsa2012_keygen","_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_noncebytes","_crypto_stream_salsa20_xor","_crypto_stream_salsa20_xor_ic","_crypto_stream_xchacha20","_crypto_stream_xchacha20_keybytes","_crypto_stream_xchacha20_keygen","_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_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 TOTAL_MEMORY=16777216
-export TOTAL_MEMORY_SUMO=83886080
+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_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"
-export LDFLAGS="${LDFLAGS} -s NO_DYNAMIC_EXECUTION=1 -s ASSERTIONS=0"
+export LDFLAGS="${LDFLAGS} -s ASSERTIONS=0"
export LDFLAGS="${LDFLAGS} -s AGGRESSIVE_VARIABLE_ELIMINATION=1 -s ALIASING_FUNCTION_POINTERS=1"
-export LDFLAGS="${LDFLAGS} -s FUNCTION_POINTER_ALIGNMENT=1 -s DISABLE_EXCEPTION_CATCHING=1"
+export LDFLAGS="${LDFLAGS} -s DISABLE_EXCEPTION_CATCHING=1"
export LDFLAGS="${LDFLAGS} -s ELIMINATE_DUPLICATE_FUNCTIONS=1"
-export LDFLAGS_DIST="-s NO_FILESYSTEM=1"
export CFLAGS="-Os"
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"
@@ -25,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_SUMO}"
+ 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'
@@ -41,7 +43,8 @@
elif [ "x$1" = "x--tests" ]; then
echo "Building for testing"
export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_SUMO"
- export LDFLAGS="${LDFLAGS} -s TOTAL_MEMORY=${TOTAL_MEMORY_SUMO}"
+ export CPPFLAGS="${CPPFLAGS} -DBENCHMARKS -DITERATIONS=10"
+ 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'
@@ -52,7 +55,7 @@
echo
exit 1
fi
-export JS_EXPORTS_FLAGS="-s EXPORTED_FUNCTIONS=${EXPORTED_FUNCTIONS}"
+export JS_EXPORTS_FLAGS="-s EXPORTED_FUNCTIONS=${EXPORTED_FUNCTIONS} -s EXTRA_EXPORTED_RUNTIME_METHODS=${EXPORTED_RUNTIME_METHODS}"
rm -f "$DONE_FILE"
@@ -73,7 +76,7 @@
"${PREFIX}/lib/libsodium.a" -o "${outFile}" || exit 1
}
emmake make $MAKE_FLAGS install || exit 1
- emccLibsodium "${PREFIX}/lib/libsodium.asm.tmp.js" -Oz -s RUNNING_JS_OPTS=1 -s NO_EXIT_RUNTIME=1
+ emccLibsodium "${PREFIX}/lib/libsodium.asm.tmp.js" -Oz -s WASM=0 -s RUNNING_JS_OPTS=1
emccLibsodium "${PREFIX}/lib/libsodium.wasm.tmp.js" -O3 -s WASM=1
cat > "${PREFIX}/lib/libsodium.js" <<- EOM
@@ -93,16 +96,36 @@
Module['TOTAL_MEMORY'] = root['sodium']['totalMemory'];
}
var _Module = Module;
- Module.ready = new Promise(function (resolve, reject) {
+ Module.ready = new Promise(function(resolve, reject) {
var Module = _Module;
Module.onAbort = reject;
- Module.onRuntimeInitialized = resolve;
+ 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 */
+ Module._crypto_secretbox_keybytes();
+ resolve();
+ } catch (err) {
+ reject(err);
+ }
+ };
+ Module.useBackupModule = function() {
+ var Module = _Module;
+ Object.keys(Module).forEach(function(k) {
+ if (k !== 'getRandomValue') {
+ delete Module[k];
+ }
+ });
+ $(cat "${PREFIX}/lib/libsodium.asm.tmp.js" | sed 's|use asm||g')
+ };
$(cat "${PREFIX}/lib/libsodium.wasm.tmp.js")
- }).catch(function () {
- var Module = _Module;
- Module.onAbort = undefined;
- Module.onRuntimeInitialized = undefined;
- $(cat "${PREFIX}/lib/libsodium.asm.tmp.js" | sed 's|use asm||g')
+ }).catch(function() {
+ _Module.useBackupModule();
});
EOM
@@ -113,7 +136,7 @@
fi
if test "x$NODE" = x; then
- for candidate in node nodejs; do
+ for candidate in /usr/local/bin/node /usr/local/bin/nodejs /usr/bin/node /usr/bin/nodejs node nodejs; do
case $($candidate --version 2>&1) in #(
v*)
NODE=$candidate
diff -Nru libsodium-1.0.16/dist-build/emscripten-symbols.def libsodium-1.0.18/dist-build/emscripten-symbols.def
--- libsodium-1.0.16/dist-build/emscripten-symbols.def 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/dist-build/emscripten-symbols.def 2019-05-30 20:13:18.000000000 +0000
@@ -27,12 +27,12 @@
_crypto_aead_chacha20poly1305_ietf_encrypt_detached 1 1
_crypto_aead_chacha20poly1305_ietf_keybytes 1 1
_crypto_aead_chacha20poly1305_ietf_keygen 1 1
-_crypto_aead_chacha20poly1305_ietf_messagebytes_max 0 0
+_crypto_aead_chacha20poly1305_ietf_messagebytes_max 1 1
_crypto_aead_chacha20poly1305_ietf_npubbytes 1 1
_crypto_aead_chacha20poly1305_ietf_nsecbytes 1 1
_crypto_aead_chacha20poly1305_keybytes 1 1
_crypto_aead_chacha20poly1305_keygen 1 1
-_crypto_aead_chacha20poly1305_messagebytes_max 0 0
+_crypto_aead_chacha20poly1305_messagebytes_max 1 1
_crypto_aead_chacha20poly1305_npubbytes 1 1
_crypto_aead_chacha20poly1305_nsecbytes 1 1
_crypto_aead_xchacha20poly1305_ietf_abytes 1 1
@@ -42,7 +42,7 @@
_crypto_aead_xchacha20poly1305_ietf_encrypt_detached 1 1
_crypto_aead_xchacha20poly1305_ietf_keybytes 1 1
_crypto_aead_xchacha20poly1305_ietf_keygen 1 1
-_crypto_aead_xchacha20poly1305_ietf_messagebytes_max 0 0
+_crypto_aead_xchacha20poly1305_ietf_messagebytes_max 1 1
_crypto_aead_xchacha20poly1305_ietf_npubbytes 1 1
_crypto_aead_xchacha20poly1305_ietf_nsecbytes 1 1
_crypto_auth 1 1
@@ -91,7 +91,7 @@
_crypto_box_curve25519xchacha20poly1305_easy_afternm 0 1
_crypto_box_curve25519xchacha20poly1305_keypair 0 1
_crypto_box_curve25519xchacha20poly1305_macbytes 0 1
-_crypto_box_curve25519xchacha20poly1305_messagebytes_max 0 0
+_crypto_box_curve25519xchacha20poly1305_messagebytes_max 0 1
_crypto_box_curve25519xchacha20poly1305_noncebytes 0 1
_crypto_box_curve25519xchacha20poly1305_open_detached 0 1
_crypto_box_curve25519xchacha20poly1305_open_detached_afternm 0 1
@@ -111,7 +111,7 @@
_crypto_box_curve25519xsalsa20poly1305_boxzerobytes 0 1
_crypto_box_curve25519xsalsa20poly1305_keypair 0 1
_crypto_box_curve25519xsalsa20poly1305_macbytes 0 1
-_crypto_box_curve25519xsalsa20poly1305_messagebytes_max 0 0
+_crypto_box_curve25519xsalsa20poly1305_messagebytes_max 0 1
_crypto_box_curve25519xsalsa20poly1305_noncebytes 0 1
_crypto_box_curve25519xsalsa20poly1305_open 0 1
_crypto_box_curve25519xsalsa20poly1305_open_afternm 0 1
@@ -126,7 +126,7 @@
_crypto_box_easy_afternm 1 1
_crypto_box_keypair 1 1
_crypto_box_macbytes 1 1
-_crypto_box_messagebytes_max 0 0
+_crypto_box_messagebytes_max 1 1
_crypto_box_noncebytes 1 1
_crypto_box_open 0 1
_crypto_box_open_afternm 0 1
@@ -145,20 +145,51 @@
_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
+_crypto_core_ed25519_scalar_sub 0 1
+_crypto_core_ed25519_scalarbytes 0 1
_crypto_core_ed25519_sub 0 1
_crypto_core_ed25519_uniformbytes 0 1
-_crypto_core_hchacha20 1 1
-_crypto_core_hchacha20_constbytes 1 1
-_crypto_core_hchacha20_inputbytes 1 1
-_crypto_core_hchacha20_keybytes 1 1
-_crypto_core_hchacha20_outputbytes 1 1
+_crypto_core_hchacha20 0 1
+_crypto_core_hchacha20_constbytes 0 1
+_crypto_core_hchacha20_inputbytes 0 1
+_crypto_core_hchacha20_keybytes 0 1
+_crypto_core_hchacha20_outputbytes 0 1
_crypto_core_hsalsa20 0 1
_crypto_core_hsalsa20_constbytes 0 1
_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
@@ -320,7 +351,7 @@
_crypto_pwhash_opslimit_sensitive 1 1
_crypto_pwhash_passwd_max 1 1
_crypto_pwhash_passwd_min 1 1
-_crypto_pwhash_primitive 1 1
+_crypto_pwhash_primitive 0 1
_crypto_pwhash_saltbytes 1 1
_crypto_pwhash_scryptsalsa208sha256 0 1
_crypto_pwhash_scryptsalsa208sha256_bytes_max 0 1
@@ -357,9 +388,15 @@
_crypto_scalarmult_curve25519_scalarbytes 0 1
_crypto_scalarmult_ed25519 0 1
_crypto_scalarmult_ed25519_base 0 1
+_crypto_scalarmult_ed25519_base_noclamp 0 1
_crypto_scalarmult_ed25519_bytes 0 1
+_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
@@ -368,7 +405,7 @@
_crypto_secretbox_keybytes 1 1
_crypto_secretbox_keygen 1 1
_crypto_secretbox_macbytes 1 1
-_crypto_secretbox_messagebytes_max 0 0
+_crypto_secretbox_messagebytes_max 1 1
_crypto_secretbox_noncebytes 1 1
_crypto_secretbox_open 0 1
_crypto_secretbox_open_detached 1 1
@@ -378,7 +415,7 @@
_crypto_secretbox_xchacha20poly1305_easy 0 1
_crypto_secretbox_xchacha20poly1305_keybytes 0 1
_crypto_secretbox_xchacha20poly1305_macbytes 0 1
-_crypto_secretbox_xchacha20poly1305_messagebytes_max 0 0
+_crypto_secretbox_xchacha20poly1305_messagebytes_max 0 1
_crypto_secretbox_xchacha20poly1305_noncebytes 0 1
_crypto_secretbox_xchacha20poly1305_open_detached 0 1
_crypto_secretbox_xchacha20poly1305_open_easy 0 1
@@ -387,15 +424,15 @@
_crypto_secretbox_xsalsa20poly1305_keybytes 0 1
_crypto_secretbox_xsalsa20poly1305_keygen 0 1
_crypto_secretbox_xsalsa20poly1305_macbytes 0 1
-_crypto_secretbox_xsalsa20poly1305_messagebytes_max 0 0
+_crypto_secretbox_xsalsa20poly1305_messagebytes_max 0 1
_crypto_secretbox_xsalsa20poly1305_noncebytes 0 1
_crypto_secretbox_xsalsa20poly1305_open 0 1
_crypto_secretbox_xsalsa20poly1305_zerobytes 0 1
_crypto_secretbox_zerobytes 0 1
_crypto_secretstream_xchacha20poly1305_abytes 1 1
+_crypto_secretstream_xchacha20poly1305_headerbytes 1 1
_crypto_secretstream_xchacha20poly1305_init_pull 1 1
_crypto_secretstream_xchacha20poly1305_init_push 1 1
-_crypto_secretstream_xchacha20poly1305_headerbytes 1 1
_crypto_secretstream_xchacha20poly1305_keybytes 1 1
_crypto_secretstream_xchacha20poly1305_keygen 1 1
_crypto_secretstream_xchacha20poly1305_messagebytes_max 1 1
@@ -425,7 +462,7 @@
_crypto_sign_ed25519_bytes 0 1
_crypto_sign_ed25519_detached 0 1
_crypto_sign_ed25519_keypair 0 1
-_crypto_sign_ed25519_messagebytes_max 0 0
+_crypto_sign_ed25519_messagebytes_max 0 1
_crypto_sign_ed25519_open 0 1
_crypto_sign_ed25519_pk_to_curve25519 1 1
_crypto_sign_ed25519_publickeybytes 0 1
@@ -448,7 +485,7 @@
_crypto_sign_final_verify 1 1
_crypto_sign_init 1 1
_crypto_sign_keypair 1 1
-_crypto_sign_messagebytes_max 0 0
+_crypto_sign_messagebytes_max 1 1
_crypto_sign_open 1 1
_crypto_sign_primitive 0 1
_crypto_sign_publickeybytes 1 1
@@ -463,26 +500,26 @@
_crypto_stream_chacha20_ietf 0 1
_crypto_stream_chacha20_ietf_keybytes 0 1
_crypto_stream_chacha20_ietf_keygen 0 1
-_crypto_stream_chacha20_ietf_messagebytes_max 0 0
+_crypto_stream_chacha20_ietf_messagebytes_max 0 1
_crypto_stream_chacha20_ietf_noncebytes 0 1
_crypto_stream_chacha20_ietf_xor 0 1
_crypto_stream_chacha20_ietf_xor_ic 0 1
_crypto_stream_chacha20_keybytes 0 1
_crypto_stream_chacha20_keygen 0 1
-_crypto_stream_chacha20_messagebytes_max 0 0
+_crypto_stream_chacha20_messagebytes_max 0 1
_crypto_stream_chacha20_noncebytes 0 1
_crypto_stream_chacha20_xor 0 1
_crypto_stream_chacha20_xor_ic 0 1
_crypto_stream_keybytes 0 1
-_crypto_stream_keygen 1 1
-_crypto_stream_messagebytes_max 0 0
+_crypto_stream_keygen 0 1
+_crypto_stream_messagebytes_max 0 1
_crypto_stream_noncebytes 0 1
_crypto_stream_primitive 0 1
_crypto_stream_salsa20 0 1
_crypto_stream_salsa2012 0 1
_crypto_stream_salsa2012_keybytes 0 1
_crypto_stream_salsa2012_keygen 0 1
-_crypto_stream_salsa2012_messagebytes_max 0 0
+_crypto_stream_salsa2012_messagebytes_max 0 1
_crypto_stream_salsa2012_noncebytes 0 1
_crypto_stream_salsa2012_xor 0 1
_crypto_stream_salsa208 0 1
@@ -493,14 +530,14 @@
_crypto_stream_salsa208_xor 0 1
_crypto_stream_salsa20_keybytes 0 1
_crypto_stream_salsa20_keygen 0 1
-_crypto_stream_salsa20_messagebytes_max 0 0
+_crypto_stream_salsa20_messagebytes_max 0 1
_crypto_stream_salsa20_noncebytes 0 1
_crypto_stream_salsa20_xor 0 1
_crypto_stream_salsa20_xor_ic 0 1
_crypto_stream_xchacha20 0 1
_crypto_stream_xchacha20_keybytes 0 1
_crypto_stream_xchacha20_keygen 0 1
-_crypto_stream_xchacha20_messagebytes_max 0 0
+_crypto_stream_xchacha20_messagebytes_max 0 1
_crypto_stream_xchacha20_noncebytes 0 1
_crypto_stream_xchacha20_xor 0 1
_crypto_stream_xchacha20_xor_ic 0 1
@@ -508,7 +545,7 @@
_crypto_stream_xsalsa20 0 1
_crypto_stream_xsalsa20_keybytes 0 1
_crypto_stream_xsalsa20_keygen 0 1
-_crypto_stream_xsalsa20_messagebytes_max 0 0
+_crypto_stream_xsalsa20_messagebytes_max 0 1
_crypto_stream_xsalsa20_noncebytes 0 1
_crypto_stream_xsalsa20_xor 0 1
_crypto_stream_xsalsa20_xor_ic 0 1
@@ -530,8 +567,8 @@
_randombytes_uniform 1 1
_sodium_add 0 0
_sodium_allocarray 0 0
-_sodium_base64_encoded_len 1 1
_sodium_base642bin 1 1
+_sodium_base64_encoded_len 1 1
_sodium_bin2base64 1 1
_sodium_bin2hex 1 1
_sodium_compare 0 0
@@ -566,5 +603,6 @@
_sodium_runtime_has_ssse3 0 0
_sodium_set_misuse_handler 0 0
_sodium_stackzero 0 0
+_sodium_sub 0 0
_sodium_unpad 1 1
_sodium_version_string 1 1
diff -Nru libsodium-1.0.16/dist-build/generate-emscripten-symbols.sh libsodium-1.0.18/dist-build/generate-emscripten-symbols.sh
--- libsodium-1.0.16/dist-build/generate-emscripten-symbols.sh 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/dist-build/generate-emscripten-symbols.sh 2019-05-30 20:13:18.000000000 +0000
@@ -17,7 +17,7 @@
fi
done < emscripten-symbols.def
- nm /usr/local/lib/libsodium.23.dylib | \
+ /usr/bin/nm /usr/local/lib/libsodium.23.dylib | \
fgrep ' T _' | \
cut -d' ' -f3 | {
while read symbol; do
@@ -35,7 +35,7 @@
} | \
sort | \
{
- out=''
+ out='"_malloc","_free"'
while read symbol ; do
if [ ! -z "$out" ]; then
out="${out},"
diff -Nru libsodium-1.0.16/dist-build/ios.sh libsodium-1.0.18/dist-build/ios.sh
--- libsodium-1.0.16/dist-build/ios.sh 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/dist-build/ios.sh 2019-05-30 20:13:18.000000000 +0000
@@ -17,14 +17,14 @@
export SIMULATOR64_PREFIX="$PREFIX/tmp/simulator64"
export XCODEDIR=$(xcode-select -p)
-xcode_major=$(xcodebuild -version|egrep '^Xcode '|cut -d' ' -f2|cut -d. -f1)
-if [ $xcode_major -ge 8 ]; then
- export IOS_SIMULATOR_VERSION_MIN=${IOS_SIMULATOR_VERSION_MIN-"6.0.0"}
- export IOS_VERSION_MIN=${IOS_VERSION_MIN-"6.0.0"}
-else
- export IOS_SIMULATOR_VERSION_MIN=${IOS_SIMULATOR_VERSION_MIN-"5.1.1"}
- export IOS_VERSION_MIN=${IOS_VERSION_MIN-"5.1.1"}
-fi
+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
@@ -34,30 +34,40 @@
export SDK="${BASEDIR}/SDKs/iPhoneSimulator.sdk"
## i386 simulator
-export CFLAGS="-O2 -arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN} -flto"
-export LDFLAGS="-arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN} -flto"
+export CFLAGS="-O2 -arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
+export LDFLAGS="-arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
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 --host=i686-apple-darwin10 \
--disable-shared \
- --enable-minimal \
+ ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$SIMULATOR32_PREFIX" || exit 1
-make -j3 install || exit 1
+
+NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
+PROCESSORS=${NPROCESSORS:-3}
+
+make -j${PROCESSORS} install || exit 1
## x86_64 simulator
-export CFLAGS="-O2 -arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN} -flto"
-export LDFLAGS="-arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN} -flto"
+export CFLAGS="-O2 -arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
+export LDFLAGS="-arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
make distclean > /dev/null
./configure --host=x86_64-apple-darwin10 \
--disable-shared \
- --enable-minimal \
+ ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$SIMULATOR64_PREFIX"
-make -j3 install || exit 1
+make -j${PROCESSORS} install || exit 1
# Build for iOS
export BASEDIR="${XCODEDIR}/Platforms/iPhoneOS.platform/Developer"
@@ -65,43 +75,43 @@
export SDK="${BASEDIR}/SDKs/iPhoneOS.sdk"
## 32-bit iOS
-export CFLAGS="-O2 -mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN} -flto"
-export LDFLAGS="-mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN} -flto"
+export CFLAGS="-fembed-bitcode -O2 -mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
+export LDFLAGS="-fembed-bitcode -mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
make distclean > /dev/null
./configure --host=arm-apple-darwin10 \
--disable-shared \
- --enable-minimal \
+ ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$IOS32_PREFIX" || exit 1
-make -j3 install || exit 1
+make -j${PROCESSORS} install || exit 1
## 32-bit armv7s iOS
-export CFLAGS="-O2 -mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN} -flto"
-export LDFLAGS="-mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN} -flto"
+export CFLAGS="-fembed-bitcode -O2 -mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
+export LDFLAGS="-fembed-bitcode -mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
make distclean > /dev/null
./configure --host=arm-apple-darwin10 \
--disable-shared \
- --enable-minimal \
+ ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$IOS32s_PREFIX" || exit 1
-make -j3 install || exit 1
+make -j${PROCESSORS} install || exit 1
## 64-bit iOS
-export CFLAGS="-O2 -arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN} -flto -fembed-bitcode"
-export LDFLAGS="-arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN} -flto -fembed-bitcode"
+export CFLAGS="-fembed-bitcode -O2 -arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN} -fembed-bitcode"
+export LDFLAGS="-fembed-bitcode -arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN} -fembed-bitcode"
make distclean > /dev/null
./configure --host=arm-apple-darwin10 \
--disable-shared \
- --enable-minimal \
+ ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$IOS64_PREFIX" || exit 1
-make -j3 install || exit 1
+make -j${PROCESSORS} install || exit 1
# Create universal binary and include folder
rm -fr -- "$PREFIX/include" "$PREFIX/libsodium.a" 2> /dev/null
diff -Nru libsodium-1.0.16/dist-build/Makefile.am libsodium-1.0.18/dist-build/Makefile.am
--- libsodium-1.0.16/dist-build/Makefile.am 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/dist-build/Makefile.am 2019-05-30 20:13:18.000000000 +0000
@@ -12,6 +12,5 @@
ios.sh \
msys2-win32.sh \
msys2-win64.sh \
- nativeclient-pnacl.sh \
- nativeclient-x86.sh \
- nativeclient-x86_64.sh
+ watchos.sh \
+ wasm32-wasi.sh
diff -Nru libsodium-1.0.16/dist-build/nativeclient-pnacl.sh libsodium-1.0.18/dist-build/nativeclient-pnacl.sh
--- libsodium-1.0.16/dist-build/nativeclient-pnacl.sh 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/dist-build/nativeclient-pnacl.sh 1970-01-01 00:00:00.000000000 +0000
@@ -1,27 +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
-
-./configure --enable-minimal \
- --host=nacl \
- --disable-ssp --without-pthreads \
- --prefix="$PREFIX" || exit 1
-
-make -j3 check && make -j3 install || exit 1
diff -Nru libsodium-1.0.16/dist-build/nativeclient-x86_64.sh libsodium-1.0.18/dist-build/nativeclient-x86_64.sh
--- libsodium-1.0.16/dist-build/nativeclient-x86_64.sh 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/dist-build/nativeclient-x86_64.sh 1970-01-01 00:00:00.000000000 +0000
@@ -1,19 +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
-
-./configure --enable-minimal \
- --host=x86_64-nacl \
- --disable-ssp --without-pthreads \
- --prefix="$PREFIX" || exit 1
-
-make -j3 check && make -j3 install || exit 1
diff -Nru libsodium-1.0.16/dist-build/nativeclient-x86.sh libsodium-1.0.18/dist-build/nativeclient-x86.sh
--- libsodium-1.0.16/dist-build/nativeclient-x86.sh 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/dist-build/nativeclient-x86.sh 1970-01-01 00:00:00.000000000 +0000
@@ -1,19 +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
-
-./configure --enable-minimal \
- --host=i686-nacl \
- --disable-ssp --without-pthreads \
- --prefix="$PREFIX" || exit 1
-
-make -j3 check && make -j3 install || exit 1
diff -Nru libsodium-1.0.16/dist-build/osx.sh libsodium-1.0.18/dist-build/osx.sh
--- libsodium-1.0.16/dist-build/osx.sh 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/dist-build/osx.sh 2019-05-30 20:13:18.000000000 +0000
@@ -6,15 +6,25 @@
mkdir -p $PREFIX || exit 1
-export CFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH} -O2 -g -flto"
-export LDFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH} -flto"
+export CFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH} -O2 -g"
+export LDFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH}"
make distclean > /dev/null
-./configure --enable-minimal \
+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} \
--prefix="$PREFIX" || exit 1
-make -j3 check && make -j3 install || 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
# Cleanup
make distclean > /dev/null
diff -Nru libsodium-1.0.16/dist-build/wasm32-wasi.sh libsodium-1.0.18/dist-build/wasm32-wasi.sh
--- libsodium-1.0.16/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.16/dist-build/watchos.sh libsodium-1.0.18/dist-build/watchos.sh
--- libsodium-1.0.16/dist-build/watchos.sh 1970-01-01 00:00:00.000000000 +0000
+++ libsodium-1.0.18/dist-build/watchos.sh 2019-05-30 20:13:18.000000000 +0000
@@ -0,0 +1,114 @@
+#! /bin/sh
+#
+# Step 1.
+# Configure for base system so simulator is covered
+#
+# Step 2.
+# Make for watchOS and watchOS simulator
+#
+# Step 3.
+# Merge libs into final version for xcode import
+
+export PREFIX="$(pwd)/libsodium-watchos"
+export WATCHOS32_PREFIX="$PREFIX/tmp/watchos32"
+export WATCHOS64_32_PREFIX="$PREFIX/tmp/watchos64_32"
+export SIMULATOR32_PREFIX="$PREFIX/tmp/simulator32"
+export SIMULATOR64_PREFIX="$PREFIX/tmp/simulator64"
+export XCODEDIR=$(xcode-select -p)
+
+export WATCHOS_SIMULATOR_VERSION_MIN=${WATCHOS_SIMULATOR_VERSION_MIN-"4.0.0"}
+export WATCHOS_VERSION_MIN=${WATCHOS_VERSION_MIN-"4.0.0"}
+
+mkdir -p $SIMULATOR32_PREFIX $SIMULATOR64_PREFIX $WATCHOS32_PREFIX $WATCHOS64_32_PREFIX || exit 1
+
+# Build for the simulator
+export BASEDIR="${XCODEDIR}/Platforms/WatchSimulator.platform/Developer"
+export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
+export SDK="${BASEDIR}/SDKs/WatchSimulator.sdk"
+
+## i386 simulator
+export CFLAGS="-O2 -arch i386 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
+export LDFLAGS="-arch i386 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
+
+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 --host=i686-apple-darwin10 \
+ --disable-shared \
+ ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
+ --prefix="$SIMULATOR32_PREFIX" || exit 1
+
+
+NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
+PROCESSORS=${NPROCESSORS:-3}
+
+make -j${PROCESSORS} install || exit 1
+
+## x86_64 simulator
+export CFLAGS="-O2 -arch x86_64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
+export LDFLAGS="-arch x86_64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
+
+make distclean > /dev/null
+
+./configure --host=x86_64-apple-darwin10 \
+ --disable-shared \
+ ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
+ --prefix="$SIMULATOR64_PREFIX"
+
+make -j${PROCESSORS} install || exit 1
+
+# Build for watchOS
+export BASEDIR="${XCODEDIR}/Platforms/WatchOS.platform/Developer"
+export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
+export SDK="${BASEDIR}/SDKs/WatchOS.sdk"
+
+## 32-bit watchOS
+export CFLAGS="-fembed-bitcode -O2 -mthumb -arch armv7k -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
+export LDFLAGS="-fembed-bitcode -mthumb -arch armv7k -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
+
+make distclean > /dev/null
+
+./configure --host=arm-apple-darwin10 \
+ --disable-shared \
+ ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
+ --prefix="$WATCHOS32_PREFIX" || exit 1
+
+make -j${PROCESSORS} install || exit 1
+
+## 64-bit arm64_32 watchOS
+export CFLAGS="-fembed-bitcode -O2 -mthumb -arch arm64_32 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
+export LDFLAGS="-fembed-bitcode -mthumb -arch arm64_32 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
+
+make distclean > /dev/null
+
+./configure --host=arm-apple-darwin10 \
+ --disable-shared \
+ ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
+ --prefix="$WATCHOS64_32_PREFIX" || exit 1
+
+make -j${PROCESSORS} install || exit 1
+
+# Create universal binary and include folder
+rm -fr -- "$PREFIX/include" "$PREFIX/libsodium.a" 2> /dev/null
+mkdir -p -- "$PREFIX/lib"
+lipo -create \
+ "$SIMULATOR32_PREFIX/lib/libsodium.a" \
+ "$SIMULATOR64_PREFIX/lib/libsodium.a" \
+ "$WATCHOS32_PREFIX/lib/libsodium.a" \
+ "$WATCHOS64_32_PREFIX/lib/libsodium.a" \
+ -output "$PREFIX/lib/libsodium.a"
+mv -f -- "$WATCHOS32_PREFIX/include" "$PREFIX/"
+
+echo
+echo "libsodium has been installed into $PREFIX"
+echo
+file -- "$PREFIX/lib/libsodium.a"
+
+# Cleanup
+rm -rf -- "$PREFIX/tmp"
+make distclean > /dev/null
diff -Nru libsodium-1.0.16/.gitignore libsodium-1.0.18/.gitignore
--- libsodium-1.0.16/.gitignore 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/.gitignore 2019-05-30 20:13:18.000000000 +0000
@@ -1,5 +1,4 @@
*.bc
-*.cmake
*.dSYM
*.done
*.final
@@ -59,6 +58,7 @@
libsodium-nativeclient-*
libsodium-osx
libsodium-uninstalled.pc
+libsodium-wasm32-wasi
libsodium-win32
libsodium-win64
libsodium.pc
@@ -77,12 +77,13 @@
src/libsodium/include/sodium/version.h
stamp-*
test-driver
-test/default/browser
test/default/*.asm.js
test/default/*.res
test/default/*.trs
test/default/aead_aes256gcm
+test/default/aead_aes256gcm2
test/default/aead_chacha20poly1305
+test/default/aead_chacha20poly13052
test/default/aead_xchacha20poly1305
test/default/auth
test/default/auth2
@@ -98,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
@@ -127,11 +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.16/lgtm.yml libsodium-1.0.18/lgtm.yml
--- libsodium-1.0.16/lgtm.yml 1970-01-01 00:00:00.000000000 +0000
+++ libsodium-1.0.18/lgtm.yml 2019-05-30 20:13:18.000000000 +0000
@@ -0,0 +1,6 @@
+extraction:
+ cpp:
+ configure:
+ command:
+ - ./autogen.sh
+ - ./configure
\ No newline at end of file
diff -Nru libsodium-1.0.16/libsodium.pc.in libsodium-1.0.18/libsodium.pc.in
--- libsodium-1.0.16/libsodium.pc.in 2017-12-13 09:24:13.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.16/libsodium-uninstalled.pc.in libsodium-1.0.18/libsodium-uninstalled.pc.in
--- libsodium-1.0.16/libsodium-uninstalled.pc.in 2017-12-13 09:24:13.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.16/libsodium.vcxproj libsodium-1.0.18/libsodium.vcxproj
--- libsodium-1.0.16/libsodium.vcxproj 2017-12-13 09:24:13.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 @@
+
@@ -497,6 +499,7 @@
+
diff -Nru libsodium-1.0.16/libsodium.vcxproj.filters libsodium-1.0.18/libsodium.vcxproj.filters
--- libsodium-1.0.16/libsodium.vcxproj.filters 2017-12-13 09:24:13.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
@@ -557,6 +563,9 @@
Header Files
+
+ Header Files
+
Header Files
diff -Nru libsodium-1.0.16/LICENSE libsodium-1.0.18/LICENSE
--- libsodium-1.0.16/LICENSE 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/LICENSE 2019-05-30 20:13:18.000000000 +0000
@@ -1,7 +1,7 @@
/*
* ISC License
*
- * Copyright (c) 2013-2017
+ * Copyright (c) 2013-2019
* Frank Denis
*
* Permission to use, copy, modify, and/or distribute this software for any
Binary files /tmp/tmpmy04nD/Q2Eoq1V0JN/libsodium-1.0.16/logo.png and /tmp/tmpmy04nD/V07VcV9wB2/libsodium-1.0.18/logo.png differ
diff -Nru libsodium-1.0.16/msvc-scripts/process.bat libsodium-1.0.18/msvc-scripts/process.bat
--- libsodium-1.0.16/msvc-scripts/process.bat 2017-12-13 09:24:13.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.16/ < 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@/1/ < 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.16/packaging/dotnet-core/libsodium.props libsodium-1.0.18/packaging/dotnet-core/libsodium.props
--- libsodium-1.0.16/packaging/dotnet-core/libsodium.props 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/packaging/dotnet-core/libsodium.props 2019-05-30 20:13:18.000000000 +0000
@@ -15,7 +15,7 @@
Frank Denis
Internal implementation package not meant for direct consumption. Please do not reference directly.
- © 2013-2017 Frank Denis
+ © 2013-2019 Frank Denis
true
https://raw.githubusercontent.com/jedisct1/libsodium/master/LICENSE
https://libsodium.org/
diff -Nru libsodium-1.0.16/packaging/dotnet-core/prepare.py libsodium-1.0.18/packaging/dotnet-core/prepare.py
--- libsodium-1.0.16/packaging/dotnet-core/prepare.py 2017-12-13 09:24:13.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.16-preview-01')
- print(' python3 prepare.py 1.0.16-preview-02')
- print(' python3 prepare.py 1.0.16-preview-03')
- print(' python3 prepare.py 1.0.16')
- print(' python3 prepare.py 1.0.16.1-preview-01')
- print(' python3 prepare.py 1.0.16.1')
- print(' python3 prepare.py 1.0.16.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.16/packaging/dotnet-core/README.md libsodium-1.0.18/packaging/dotnet-core/README.md
--- libsodium-1.0.16/packaging/dotnet-core/README.md 2017-12-13 09:24:13.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.16` is the initial
- release of the package for libsodium 1.0.16 and `1.0.16.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.16-preview-01` is the first pre-release of the package
- for libsodium 1.0.16 and `1.0.16.5-preview-02` the second pre-release of the
- fifth revision of the package for libsodium 1.0.16.
+ `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.16/packaging/nuget/package.config libsodium-1.0.18/packaging/nuget/package.config
--- libsodium-1.0.16/packaging/nuget/package.config 2017-12-13 09:24:13.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.16/packaging/nuget/package.gsl libsodium-1.0.18/packaging/nuget/package.gsl
--- libsodium-1.0.16/packaging/nuget/package.gsl 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/packaging/nuget/package.gsl 2019-05-30 20:13:18.000000000 +0000
@@ -27,7 +27,7 @@
Sodium is a portable, cross-compilable, installable, packageable fork of NaCl, with a compatible API.
Portable fork of NaCl, packaged for Visual Studio 2013 (v120) and CTP_Nov2013 compilers.
https://raw.github.com/jedisct1/libsodium/master/ChangeLog
- (c) 2013-2017, Frank Denis (attribution required)
+ (c) 2013-2019, Frank Denis (attribution required)
native, NaCl, salt, sodium, libsodium, C++
.for dependency
@@ -257,4 +257,4 @@
-
\ No newline at end of file
+
diff -Nru libsodium-1.0.16/README.markdown libsodium-1.0.18/README.markdown
--- libsodium-1.0.16/README.markdown 2017-12-13 09:24:13.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)
============
@@ -21,17 +22,17 @@
## Documentation
-The documentation is available on Gitbook:
+The documentation is available on Gitbook and built from the [libsodium-doc](https://github.com/jedisct1/libsodium-doc) repository:
* [libsodium documentation](https://download.libsodium.org/doc/) -
online, requires Javascript.
* [offline documentation](https://www.gitbook.com/book/jedisct1/libsodium/details)
-in PDF, MOBI and ePUB formats.
+in PDF format.
## Integrity Checking
The integrity checking instructions (including the signing key for libsodium)
-are available in the [installation](https://download.libsodium.org/doc/installation/index.html#integrity-checking)
+are available in the [installation](https://download.libsodium.org/doc/installation#integrity-checking)
section of the documentation.
## Community
diff -Nru libsodium-1.0.16/regen-msvc/regen-msvc.py libsodium-1.0.18/regen-msvc/regen-msvc.py
--- libsodium-1.0.16/regen-msvc/regen-msvc.py 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/regen-msvc/regen-msvc.py 2019-05-30 20:13:18.000000000 +0000
@@ -1,6 +1,5 @@
#! /usr/bin/env python3
-import fileinput
import glob
import os
import uuid
@@ -10,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"
@@ -60,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"
@@ -74,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.16/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c libsodium-1.0.18/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c
--- libsodium-1.0.16/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c 2019-05-30 20:13:18.000000000 +0000
@@ -51,10 +51,10 @@
}
#endif
-typedef struct context {
- CRYPTO_ALIGN(16) unsigned char H[16];
- __m128i rkeys[16];
-} context;
+typedef struct aes256gcm_state {
+ __m128i rkeys[16];
+ unsigned char H[16];
+} aes256gcm_state;
static inline void
aesni_key256_expand(const unsigned char *key, __m128i * const rkeys)
@@ -488,10 +488,10 @@
crypto_aead_aes256gcm_beforenm(crypto_aead_aes256gcm_state *ctx_,
const unsigned char *k)
{
- context *ctx = (context *) ctx_;
- __m128i *rkeys = ctx->rkeys;
- __m128i zero = _mm_setzero_si128();
- unsigned char *H = ctx->H;
+ aes256gcm_state *ctx = (aes256gcm_state *) (void *) ctx_;
+ unsigned char *H = ctx->H;
+ __m128i *rkeys = ctx->rkeys;
+ __m128i zero = _mm_setzero_si128();
COMPILER_ASSERT((sizeof *ctx_) >= (sizeof *ctx));
aesni_key256_expand(k, rkeys);
@@ -509,13 +509,13 @@
const unsigned char *npub,
const crypto_aead_aes256gcm_state *ctx_)
{
- const __m128i rev = _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
- const context *ctx = (const context *) ctx_;
- const __m128i *rkeys = ctx->rkeys;
- __m128i Hv, H2v, H3v, H4v, accv;
- unsigned long long i, j;
- unsigned long long adlen_rnd64 = adlen & ~63ULL;
- unsigned long long mlen_rnd128 = mlen & ~127ULL;
+ const __m128i rev = _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
+ const aes256gcm_state *ctx = (const aes256gcm_state *) (const void *) ctx_;
+ const __m128i *rkeys = ctx->rkeys;
+ __m128i Hv, H2v, H3v, H4v, accv;
+ unsigned long long i, j;
+ unsigned long long adlen_rnd64 = adlen & ~63ULL;
+ unsigned long long mlen_rnd128 = mlen & ~127ULL;
CRYPTO_ALIGN(16) uint32_t n2[4];
CRYPTO_ALIGN(16) unsigned char H[16];
CRYPTO_ALIGN(16) unsigned char T[16];
@@ -647,14 +647,14 @@
const unsigned char *npub,
const crypto_aead_aes256gcm_state *ctx_)
{
- const __m128i rev = _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
- const context *ctx = (const context *) ctx_;
- const __m128i *rkeys = ctx->rkeys;
- __m128i Hv, H2v, H3v, H4v, accv;
- unsigned long long i, j;
- unsigned long long adlen_rnd64 = adlen & ~63ULL;
- unsigned long long mlen;
- unsigned long long mlen_rnd128;
+ const __m128i rev = _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
+ const aes256gcm_state *ctx = (const aes256gcm_state *) (const void *) ctx_;
+ const __m128i *rkeys = ctx->rkeys;
+ __m128i Hv, H2v, H3v, H4v, accv;
+ unsigned long long i, j;
+ unsigned long long adlen_rnd64 = adlen & ~63ULL;
+ unsigned long long mlen;
+ unsigned long long mlen_rnd128;
CRYPTO_ALIGN(16) uint32_t n2[4];
CRYPTO_ALIGN(16) unsigned char H[16];
CRYPTO_ALIGN(16) unsigned char T[16];
@@ -862,7 +862,7 @@
ret = crypto_aead_aes256gcm_encrypt_afternm
(c, clen_p, m, mlen, ad, adlen, nsec, npub,
(const crypto_aead_aes256gcm_state *) &ctx);
- sodium_memzero(ctx, sizeof ctx);
+ sodium_memzero(&ctx, sizeof ctx);
return ret;
}
@@ -906,7 +906,7 @@
ret = crypto_aead_aes256gcm_decrypt_afternm
(m, mlen_p, nsec, c, clen, ad, adlen, npub,
(const crypto_aead_aes256gcm_state *) &ctx);
- sodium_memzero(ctx, sizeof ctx);
+ sodium_memzero(&ctx, sizeof ctx);
return ret;
}
diff -Nru libsodium-1.0.16/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c libsodium-1.0.18/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c
--- libsodium-1.0.16/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c 2019-05-30 20:13:18.000000000 +0000
@@ -12,6 +12,7 @@
#include "randombytes.h"
#include "utils.h"
+#include "private/chacha20_ietf_ext.h"
#include "private/common.h"
static const unsigned char _pad0[16] = { 0 };
diff -Nru libsodium-1.0.16/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c libsodium-1.0.18/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c
--- libsodium-1.0.16/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c 2019-05-30 20:13:18.000000000 +0000
@@ -5,14 +5,118 @@
#include
#include "core.h"
-#include "crypto_aead_xchacha20poly1305.h"
#include "crypto_aead_chacha20poly1305.h"
+#include "crypto_aead_xchacha20poly1305.h"
#include "crypto_core_hchacha20.h"
+#include "crypto_onetimeauth_poly1305.h"
+#include "crypto_stream_chacha20.h"
+#include "crypto_verify_16.h"
#include "randombytes.h"
#include "utils.h"
+#include "private/chacha20_ietf_ext.h"
#include "private/common.h"
+static const unsigned char _pad0[16] = { 0 };
+
+static int
+_encrypt_detached(unsigned char *c,
+ unsigned char *mac,
+ unsigned long long *maclen_p,
+ const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *ad,
+ unsigned long long adlen,
+ const unsigned char *nsec,
+ const unsigned char *npub,
+ const unsigned char *k)
+{
+ crypto_onetimeauth_poly1305_state state;
+ unsigned char block0[64U];
+ unsigned char slen[8U];
+
+ (void) nsec;
+ crypto_stream_chacha20_ietf_ext(block0, sizeof block0, npub, k);
+ crypto_onetimeauth_poly1305_init(&state, block0);
+ sodium_memzero(block0, sizeof block0);
+
+ crypto_onetimeauth_poly1305_update(&state, ad, adlen);
+ crypto_onetimeauth_poly1305_update(&state, _pad0, (0x10 - adlen) & 0xf);
+
+ crypto_stream_chacha20_ietf_ext_xor_ic(c, m, mlen, npub, 1U, k);
+
+ crypto_onetimeauth_poly1305_update(&state, c, mlen);
+ crypto_onetimeauth_poly1305_update(&state, _pad0, (0x10 - mlen) & 0xf);
+
+ STORE64_LE(slen, (uint64_t) adlen);
+ crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+ STORE64_LE(slen, (uint64_t) mlen);
+ crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+ crypto_onetimeauth_poly1305_final(&state, mac);
+ sodium_memzero(&state, sizeof state);
+
+ if (maclen_p != NULL) {
+ *maclen_p = crypto_aead_chacha20poly1305_ietf_ABYTES;
+ }
+ return 0;
+}
+
+static int
+_decrypt_detached(unsigned char *m,
+ unsigned char *nsec,
+ const unsigned char *c,
+ unsigned long long clen,
+ const unsigned char *mac,
+ const unsigned char *ad,
+ unsigned long long adlen,
+ const unsigned char *npub,
+ const unsigned char *k)
+{
+ crypto_onetimeauth_poly1305_state state;
+ unsigned char block0[64U];
+ unsigned char slen[8U];
+ unsigned char computed_mac[crypto_aead_chacha20poly1305_ietf_ABYTES];
+ unsigned long long mlen;
+ int ret;
+
+ (void) nsec;
+ crypto_stream_chacha20_ietf_ext(block0, sizeof block0, npub, k);
+ crypto_onetimeauth_poly1305_init(&state, block0);
+ sodium_memzero(block0, sizeof block0);
+
+ crypto_onetimeauth_poly1305_update(&state, ad, adlen);
+ crypto_onetimeauth_poly1305_update(&state, _pad0, (0x10 - adlen) & 0xf);
+
+ mlen = clen;
+ crypto_onetimeauth_poly1305_update(&state, c, mlen);
+ crypto_onetimeauth_poly1305_update(&state, _pad0, (0x10 - mlen) & 0xf);
+
+ STORE64_LE(slen, (uint64_t) adlen);
+ crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+ STORE64_LE(slen, (uint64_t) mlen);
+ crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+ crypto_onetimeauth_poly1305_final(&state, computed_mac);
+ sodium_memzero(&state, sizeof state);
+
+ COMPILER_ASSERT(sizeof computed_mac == 16U);
+ ret = crypto_verify_16(computed_mac, mac);
+ sodium_memzero(computed_mac, sizeof computed_mac);
+ if (m == NULL) {
+ return ret;
+ }
+ if (ret != 0) {
+ memset(m, 0, mlen);
+ return -1;
+ }
+ crypto_stream_chacha20_ietf_ext_xor_ic(m, c, mlen, npub, 1U, k);
+
+ return 0;
+}
+
int
crypto_aead_xchacha20poly1305_ietf_encrypt_detached(unsigned char *c,
unsigned char *mac,
@@ -32,8 +136,8 @@
crypto_core_hchacha20(k2, npub, k, NULL);
memcpy(npub2 + 4, npub + crypto_core_hchacha20_INPUTBYTES,
crypto_aead_chacha20poly1305_ietf_NPUBBYTES - 4);
- ret = crypto_aead_chacha20poly1305_ietf_encrypt_detached
- (c, mac, maclen_p, m, mlen, ad, adlen, nsec, npub2, k2);
+ ret = _encrypt_detached(c, mac, maclen_p, m, mlen, ad, adlen,
+ nsec, npub2, k2);
sodium_memzero(k2, crypto_core_hchacha20_OUTPUTBYTES);
return ret;
@@ -53,7 +157,7 @@
unsigned long long clen = 0ULL;
int ret;
- if (mlen > UINT64_MAX - crypto_aead_xchacha20poly1305_ietf_ABYTES) {
+ if (mlen > crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX) {
sodium_misuse();
}
ret = crypto_aead_xchacha20poly1305_ietf_encrypt_detached
@@ -85,12 +189,10 @@
crypto_core_hchacha20(k2, npub, k, NULL);
memcpy(npub2 + 4, npub + crypto_core_hchacha20_INPUTBYTES,
crypto_aead_chacha20poly1305_ietf_NPUBBYTES - 4);
- ret = crypto_aead_chacha20poly1305_ietf_decrypt_detached
- (m, nsec, c, clen, mac, ad, adlen, npub2, k2);
+ ret = _decrypt_detached(m, nsec, c, clen, mac, ad, adlen, npub2, k2);
sodium_memzero(k2, crypto_core_hchacha20_OUTPUTBYTES);
return ret;
-
}
int
@@ -105,7 +207,7 @@
const unsigned char *k)
{
unsigned long long mlen = 0ULL;
- int ret = -1;
+ int ret = -1;
if (clen >= crypto_aead_xchacha20poly1305_ietf_ABYTES) {
ret = crypto_aead_xchacha20poly1305_ietf_decrypt_detached
diff -Nru libsodium-1.0.16/src/libsodium/crypto_core/ed25519/core_ed25519.c libsodium-1.0.18/src/libsodium/crypto_core/ed25519/core_ed25519.c
--- libsodium-1.0.16/src/libsodium/crypto_core/ed25519/core_ed25519.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_core/ed25519/core_ed25519.c 2019-05-30 20:13:18.000000000 +0000
@@ -1,7 +1,11 @@
+#include
+
#include "crypto_core_ed25519.h"
#include "private/common.h"
#include "private/ed25519_ref10.h"
+#include "randombytes.h"
+#include "utils.h"
int
crypto_core_ed25519_is_valid_point(const unsigned char *p)
@@ -63,7 +67,131 @@
{
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
+crypto_core_ed25519_scalar_random(unsigned char *r)
+{
+ do {
+ randombytes_buf(r, crypto_core_ed25519_SCALARBYTES);
+ r[crypto_core_ed25519_SCALARBYTES - 1] &= 0x1f;
+ } while (sc25519_is_canonical(r) == 0 ||
+ sodium_is_zero(r, crypto_core_ed25519_SCALARBYTES));
+}
+
+int
+crypto_core_ed25519_scalar_invert(unsigned char *recip, const unsigned char *s)
+{
+ sc25519_invert(recip, s);
+
+ return - sodium_is_zero(s, crypto_core_ed25519_SCALARBYTES);
+}
+
+/* 2^252+27742317777372353535851937790883648493 */
+static const unsigned char L[] = {
+ 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
+};
+
+void
+crypto_core_ed25519_scalar_negate(unsigned char *neg, const unsigned char *s)
+{
+ unsigned char t_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+ unsigned char s_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+
+ COMPILER_ASSERT(crypto_core_ed25519_NONREDUCEDSCALARBYTES >=
+ 2 * crypto_core_ed25519_SCALARBYTES);
+ memset(t_, 0, sizeof t_);
+ memset(s_, 0, sizeof s_);
+ memcpy(t_ + crypto_core_ed25519_SCALARBYTES, L,
+ crypto_core_ed25519_SCALARBYTES);
+ memcpy(s_, s, crypto_core_ed25519_SCALARBYTES);
+ sodium_sub(t_, s_, sizeof t_);
+ sc25519_reduce(t_);
+ memcpy(neg, t_, crypto_core_ed25519_SCALARBYTES);
+}
+
+void
+crypto_core_ed25519_scalar_complement(unsigned char *comp,
+ const unsigned char *s)
+{
+ unsigned char t_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+ unsigned char s_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+
+ COMPILER_ASSERT(crypto_core_ed25519_NONREDUCEDSCALARBYTES >=
+ 2 * crypto_core_ed25519_SCALARBYTES);
+ memset(t_, 0, sizeof t_);
+ memset(s_, 0, sizeof s_);
+ t_[0]++;
+ memcpy(t_ + crypto_core_ed25519_SCALARBYTES, L,
+ crypto_core_ed25519_SCALARBYTES);
+ memcpy(s_, s, crypto_core_ed25519_SCALARBYTES);
+ sodium_sub(t_, s_, sizeof t_);
+ sc25519_reduce(t_);
+ memcpy(comp, t_, crypto_core_ed25519_SCALARBYTES);
+}
+
+void
+crypto_core_ed25519_scalar_add(unsigned char *z, const unsigned char *x,
+ const unsigned char *y)
+{
+ unsigned char x_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+ unsigned char y_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+
+ memset(x_, 0, sizeof x_);
+ memset(y_, 0, sizeof y_);
+ memcpy(x_, x, crypto_core_ed25519_SCALARBYTES);
+ memcpy(y_, y, crypto_core_ed25519_SCALARBYTES);
+ sodium_add(x_, y_, crypto_core_ed25519_SCALARBYTES);
+ crypto_core_ed25519_scalar_reduce(z, x_);
+}
+
+void
+crypto_core_ed25519_scalar_sub(unsigned char *z, const unsigned char *x,
+ const unsigned char *y)
+{
+ unsigned char yn[crypto_core_ed25519_SCALARBYTES];
+
+ crypto_core_ed25519_scalar_negate(yn, y);
+ crypto_core_ed25519_scalar_add(z, x, yn);
+}
+
+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)
+{
+ unsigned char t[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+
+ memcpy(t, s, sizeof t);
+ sc25519_reduce(t);
+ memcpy(r, t, crypto_core_ed25519_SCALARBYTES);
+ sodium_memzero(t, sizeof t);
}
size_t
@@ -73,7 +201,25 @@
}
size_t
+crypto_core_ed25519_nonreducedscalarbytes(void)
+{
+ return crypto_core_ed25519_NONREDUCEDSCALARBYTES;
+}
+
+size_t
crypto_core_ed25519_uniformbytes(void)
{
return crypto_core_ed25519_UNIFORMBYTES;
}
+
+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.16/src/libsodium/crypto_core/ed25519/core_ristretto255.c libsodium-1.0.18/src/libsodium/crypto_core/ed25519/core_ristretto255.c
--- libsodium-1.0.16/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.16/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.16/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c 2017-12-13 09:24:13.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);
}
@@ -1059,16 +1075,14 @@
Input:
a[0]+256*a[1]+...+256^31*a[31] = a
b[0]+256*b[1]+...+256^31*b[31] = b
- c[0]+256*c[1]+...+256^31*c[31] = c
*
Output:
- s[0]+256*s[1]+...+256^31*s[31] = (ab+c) mod l
+ s[0]+256*s[1]+...+256^31*s[31] = (ab) mod l
where l = 2^252 + 27742317777372353535851937790883648493.
*/
void
-sc25519_muladd(unsigned char *s, const unsigned char *a,
- const unsigned char *b, const unsigned char *c)
+sc25519_mul(unsigned char s[32], const unsigned char a[32], const unsigned char b[32])
{
int64_t a0 = 2097151 & load_3(a);
int64_t a1 = 2097151 & (load_4(a + 2) >> 5);
@@ -1096,19 +1110,6 @@
int64_t b10 = 2097151 & (load_3(b + 26) >> 2);
int64_t b11 = (load_4(b + 28) >> 7);
- int64_t c0 = 2097151 & load_3(c);
- int64_t c1 = 2097151 & (load_4(c + 2) >> 5);
- int64_t c2 = 2097151 & (load_3(c + 5) >> 2);
- int64_t c3 = 2097151 & (load_4(c + 7) >> 7);
- int64_t c4 = 2097151 & (load_4(c + 10) >> 4);
- int64_t c5 = 2097151 & (load_3(c + 13) >> 1);
- int64_t c6 = 2097151 & (load_4(c + 15) >> 6);
- int64_t c7 = 2097151 & (load_3(c + 18) >> 3);
- int64_t c8 = 2097151 & load_3(c + 21);
- int64_t c9 = 2097151 & (load_4(c + 23) >> 5);
- int64_t c10 = 2097151 & (load_3(c + 26) >> 2);
- int64_t c11 = (load_4(c + 28) >> 7);
-
int64_t s0;
int64_t s1;
int64_t s2;
@@ -1158,23 +1159,22 @@
int64_t carry21;
int64_t carry22;
- s0 = c0 + a0 * b0;
- s1 = c1 + a0 * b1 + a1 * b0;
- s2 = c2 + a0 * b2 + a1 * b1 + a2 * b0;
- s3 = c3 + a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0;
- s4 = c4 + a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0;
- s5 = c5 + a0 * b5 + a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 + a5 * b0;
- s6 = c6 + a0 * b6 + a1 * b5 + a2 * b4 + a3 * b3 + a4 * b2 + a5 * b1 +
- a6 * b0;
- s7 = c7 + a0 * b7 + a1 * b6 + a2 * b5 + a3 * b4 + a4 * b3 + a5 * b2 +
+ s0 = a0 * b0;
+ s1 = a0 * b1 + a1 * b0;
+ s2 = a0 * b2 + a1 * b1 + a2 * b0;
+ s3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0;
+ s4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0;
+ s5 = a0 * b5 + a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 + a5 * b0;
+ s6 = a0 * b6 + a1 * b5 + a2 * b4 + a3 * b3 + a4 * b2 + a5 * b1 + a6 * b0;
+ s7 = a0 * b7 + a1 * b6 + a2 * b5 + a3 * b4 + a4 * b3 + a5 * b2 +
a6 * b1 + a7 * b0;
- s8 = c8 + a0 * b8 + a1 * b7 + a2 * b6 + a3 * b5 + a4 * b4 + a5 * b3 +
+ s8 = a0 * b8 + a1 * b7 + a2 * b6 + a3 * b5 + a4 * b4 + a5 * b3 +
a6 * b2 + a7 * b1 + a8 * b0;
- s9 = c9 + a0 * b9 + a1 * b8 + a2 * b7 + a3 * b6 + a4 * b5 + a5 * b4 +
+ s9 = a0 * b9 + a1 * b8 + a2 * b7 + a3 * b6 + a4 * b5 + a5 * b4 +
a6 * b3 + a7 * b2 + a8 * b1 + a9 * b0;
- s10 = c10 + a0 * b10 + a1 * b9 + a2 * b8 + a3 * b7 + a4 * b6 + a5 * b5 +
+ s10 = a0 * b10 + a1 * b9 + a2 * b8 + a3 * b7 + a4 * b6 + a5 * b5 +
a6 * b4 + a7 * b3 + a8 * b2 + a9 * b1 + a10 * b0;
- s11 = c11 + a0 * b11 + a1 * b10 + a2 * b9 + a3 * b8 + a4 * b7 + a5 * b6 +
+ s11 = a0 * b11 + a1 * b10 + a2 * b9 + a3 * b8 + a4 * b7 + a5 * b6 +
a6 * b5 + a7 * b4 + a8 * b3 + a9 * b2 + a10 * b1 + a11 * b0;
s12 = a1 * b11 + a2 * b10 + a3 * b9 + a4 * b8 + a5 * b7 + a6 * b6 +
a7 * b5 + a8 * b4 + a9 * b3 + a10 * b2 + a11 * b1;
@@ -1545,41 +1545,82 @@
/*
Input:
- s[0]+256*s[1]+...+256^63*s[63] = s
+ a[0]+256*a[1]+...+256^31*a[31] = a
+ b[0]+256*b[1]+...+256^31*b[31] = b
+ c[0]+256*c[1]+...+256^31*c[31] = c
*
Output:
- s[0]+256*s[1]+...+256^31*s[31] = s mod l
+ s[0]+256*s[1]+...+256^31*s[31] = (ab+c) mod l
where l = 2^252 + 27742317777372353535851937790883648493.
- Overwrites s in place.
*/
void
-sc25519_reduce(unsigned char *s)
+sc25519_muladd(unsigned char s[32], const unsigned char a[32],
+ const unsigned char b[32], const unsigned char c[32])
{
- int64_t s0 = 2097151 & load_3(s);
- int64_t s1 = 2097151 & (load_4(s + 2) >> 5);
- int64_t s2 = 2097151 & (load_3(s + 5) >> 2);
- int64_t s3 = 2097151 & (load_4(s + 7) >> 7);
- int64_t s4 = 2097151 & (load_4(s + 10) >> 4);
- int64_t s5 = 2097151 & (load_3(s + 13) >> 1);
- int64_t s6 = 2097151 & (load_4(s + 15) >> 6);
- int64_t s7 = 2097151 & (load_3(s + 18) >> 3);
- int64_t s8 = 2097151 & load_3(s + 21);
- int64_t s9 = 2097151 & (load_4(s + 23) >> 5);
- int64_t s10 = 2097151 & (load_3(s + 26) >> 2);
- int64_t s11 = 2097151 & (load_4(s + 28) >> 7);
- int64_t s12 = 2097151 & (load_4(s + 31) >> 4);
- int64_t s13 = 2097151 & (load_3(s + 34) >> 1);
- int64_t s14 = 2097151 & (load_4(s + 36) >> 6);
- int64_t s15 = 2097151 & (load_3(s + 39) >> 3);
- int64_t s16 = 2097151 & load_3(s + 42);
- int64_t s17 = 2097151 & (load_4(s + 44) >> 5);
- int64_t s18 = 2097151 & (load_3(s + 47) >> 2);
- int64_t s19 = 2097151 & (load_4(s + 49) >> 7);
- int64_t s20 = 2097151 & (load_4(s + 52) >> 4);
- int64_t s21 = 2097151 & (load_3(s + 55) >> 1);
- int64_t s22 = 2097151 & (load_4(s + 57) >> 6);
- int64_t s23 = (load_4(s + 60) >> 3);
+ int64_t a0 = 2097151 & load_3(a);
+ int64_t a1 = 2097151 & (load_4(a + 2) >> 5);
+ int64_t a2 = 2097151 & (load_3(a + 5) >> 2);
+ int64_t a3 = 2097151 & (load_4(a + 7) >> 7);
+ int64_t a4 = 2097151 & (load_4(a + 10) >> 4);
+ int64_t a5 = 2097151 & (load_3(a + 13) >> 1);
+ int64_t a6 = 2097151 & (load_4(a + 15) >> 6);
+ int64_t a7 = 2097151 & (load_3(a + 18) >> 3);
+ int64_t a8 = 2097151 & load_3(a + 21);
+ int64_t a9 = 2097151 & (load_4(a + 23) >> 5);
+ int64_t a10 = 2097151 & (load_3(a + 26) >> 2);
+ int64_t a11 = (load_4(a + 28) >> 7);
+
+ int64_t b0 = 2097151 & load_3(b);
+ int64_t b1 = 2097151 & (load_4(b + 2) >> 5);
+ int64_t b2 = 2097151 & (load_3(b + 5) >> 2);
+ int64_t b3 = 2097151 & (load_4(b + 7) >> 7);
+ int64_t b4 = 2097151 & (load_4(b + 10) >> 4);
+ int64_t b5 = 2097151 & (load_3(b + 13) >> 1);
+ int64_t b6 = 2097151 & (load_4(b + 15) >> 6);
+ int64_t b7 = 2097151 & (load_3(b + 18) >> 3);
+ int64_t b8 = 2097151 & load_3(b + 21);
+ int64_t b9 = 2097151 & (load_4(b + 23) >> 5);
+ int64_t b10 = 2097151 & (load_3(b + 26) >> 2);
+ int64_t b11 = (load_4(b + 28) >> 7);
+
+ int64_t c0 = 2097151 & load_3(c);
+ int64_t c1 = 2097151 & (load_4(c + 2) >> 5);
+ int64_t c2 = 2097151 & (load_3(c + 5) >> 2);
+ int64_t c3 = 2097151 & (load_4(c + 7) >> 7);
+ int64_t c4 = 2097151 & (load_4(c + 10) >> 4);
+ int64_t c5 = 2097151 & (load_3(c + 13) >> 1);
+ int64_t c6 = 2097151 & (load_4(c + 15) >> 6);
+ int64_t c7 = 2097151 & (load_3(c + 18) >> 3);
+ int64_t c8 = 2097151 & load_3(c + 21);
+ int64_t c9 = 2097151 & (load_4(c + 23) >> 5);
+ int64_t c10 = 2097151 & (load_3(c + 26) >> 2);
+ int64_t c11 = (load_4(c + 28) >> 7);
+
+ int64_t s0;
+ int64_t s1;
+ int64_t s2;
+ int64_t s3;
+ int64_t s4;
+ int64_t s5;
+ int64_t s6;
+ int64_t s7;
+ int64_t s8;
+ int64_t s9;
+ int64_t s10;
+ int64_t s11;
+ int64_t s12;
+ int64_t s13;
+ int64_t s14;
+ int64_t s15;
+ int64_t s16;
+ int64_t s17;
+ int64_t s18;
+ int64_t s19;
+ int64_t s20;
+ int64_t s21;
+ int64_t s22;
+ int64_t s23;
int64_t carry0;
int64_t carry1;
@@ -1598,6 +1639,119 @@
int64_t carry14;
int64_t carry15;
int64_t carry16;
+ int64_t carry17;
+ int64_t carry18;
+ int64_t carry19;
+ int64_t carry20;
+ int64_t carry21;
+ int64_t carry22;
+
+ s0 = c0 + a0 * b0;
+ s1 = c1 + a0 * b1 + a1 * b0;
+ s2 = c2 + a0 * b2 + a1 * b1 + a2 * b0;
+ s3 = c3 + a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0;
+ s4 = c4 + a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0;
+ s5 = c5 + a0 * b5 + a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 + a5 * b0;
+ s6 = c6 + a0 * b6 + a1 * b5 + a2 * b4 + a3 * b3 + a4 * b2 + a5 * b1 +
+ a6 * b0;
+ s7 = c7 + a0 * b7 + a1 * b6 + a2 * b5 + a3 * b4 + a4 * b3 + a5 * b2 +
+ a6 * b1 + a7 * b0;
+ s8 = c8 + a0 * b8 + a1 * b7 + a2 * b6 + a3 * b5 + a4 * b4 + a5 * b3 +
+ a6 * b2 + a7 * b1 + a8 * b0;
+ s9 = c9 + a0 * b9 + a1 * b8 + a2 * b7 + a3 * b6 + a4 * b5 + a5 * b4 +
+ a6 * b3 + a7 * b2 + a8 * b1 + a9 * b0;
+ s10 = c10 + a0 * b10 + a1 * b9 + a2 * b8 + a3 * b7 + a4 * b6 + a5 * b5 +
+ a6 * b4 + a7 * b3 + a8 * b2 + a9 * b1 + a10 * b0;
+ s11 = c11 + a0 * b11 + a1 * b10 + a2 * b9 + a3 * b8 + a4 * b7 + a5 * b6 +
+ a6 * b5 + a7 * b4 + a8 * b3 + a9 * b2 + a10 * b1 + a11 * b0;
+ s12 = a1 * b11 + a2 * b10 + a3 * b9 + a4 * b8 + a5 * b7 + a6 * b6 +
+ a7 * b5 + a8 * b4 + a9 * b3 + a10 * b2 + a11 * b1;
+ s13 = a2 * b11 + a3 * b10 + a4 * b9 + a5 * b8 + a6 * b7 + a7 * b6 +
+ a8 * b5 + a9 * b4 + a10 * b3 + a11 * b2;
+ s14 = a3 * b11 + a4 * b10 + a5 * b9 + a6 * b8 + a7 * b7 + a8 * b6 +
+ a9 * b5 + a10 * b4 + a11 * b3;
+ s15 = a4 * b11 + a5 * b10 + a6 * b9 + a7 * b8 + a8 * b7 + a9 * b6 +
+ a10 * b5 + a11 * b4;
+ s16 =
+ a5 * b11 + a6 * b10 + a7 * b9 + a8 * b8 + a9 * b7 + a10 * b6 + a11 * b5;
+ s17 = a6 * b11 + a7 * b10 + a8 * b9 + a9 * b8 + a10 * b7 + a11 * b6;
+ s18 = a7 * b11 + a8 * b10 + a9 * b9 + a10 * b8 + a11 * b7;
+ s19 = a8 * b11 + a9 * b10 + a10 * b9 + a11 * b8;
+ s20 = a9 * b11 + a10 * b10 + a11 * b9;
+ s21 = a10 * b11 + a11 * b10;
+ s22 = a11 * b11;
+ s23 = 0;
+
+ carry0 = (s0 + (int64_t) (1L << 20)) >> 21;
+ s1 += carry0;
+ s0 -= carry0 * ((uint64_t) 1L << 21);
+ carry2 = (s2 + (int64_t) (1L << 20)) >> 21;
+ s3 += carry2;
+ s2 -= carry2 * ((uint64_t) 1L << 21);
+ carry4 = (s4 + (int64_t) (1L << 20)) >> 21;
+ s5 += carry4;
+ s4 -= carry4 * ((uint64_t) 1L << 21);
+ carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
+ s7 += carry6;
+ s6 -= carry6 * ((uint64_t) 1L << 21);
+ carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
+ s9 += carry8;
+ s8 -= carry8 * ((uint64_t) 1L << 21);
+ carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
+ s11 += carry10;
+ s10 -= carry10 * ((uint64_t) 1L << 21);
+ carry12 = (s12 + (int64_t) (1L << 20)) >> 21;
+ s13 += carry12;
+ s12 -= carry12 * ((uint64_t) 1L << 21);
+ carry14 = (s14 + (int64_t) (1L << 20)) >> 21;
+ s15 += carry14;
+ s14 -= carry14 * ((uint64_t) 1L << 21);
+ carry16 = (s16 + (int64_t) (1L << 20)) >> 21;
+ s17 += carry16;
+ s16 -= carry16 * ((uint64_t) 1L << 21);
+ carry18 = (s18 + (int64_t) (1L << 20)) >> 21;
+ s19 += carry18;
+ s18 -= carry18 * ((uint64_t) 1L << 21);
+ carry20 = (s20 + (int64_t) (1L << 20)) >> 21;
+ s21 += carry20;
+ s20 -= carry20 * ((uint64_t) 1L << 21);
+ carry22 = (s22 + (int64_t) (1L << 20)) >> 21;
+ s23 += carry22;
+ s22 -= carry22 * ((uint64_t) 1L << 21);
+
+ carry1 = (s1 + (int64_t) (1L << 20)) >> 21;
+ s2 += carry1;
+ s1 -= carry1 * ((uint64_t) 1L << 21);
+ carry3 = (s3 + (int64_t) (1L << 20)) >> 21;
+ s4 += carry3;
+ s3 -= carry3 * ((uint64_t) 1L << 21);
+ carry5 = (s5 + (int64_t) (1L << 20)) >> 21;
+ s6 += carry5;
+ s5 -= carry5 * ((uint64_t) 1L << 21);
+ carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
+ s8 += carry7;
+ s7 -= carry7 * ((uint64_t) 1L << 21);
+ carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
+ s10 += carry9;
+ s9 -= carry9 * ((uint64_t) 1L << 21);
+ carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
+ s12 += carry11;
+ s11 -= carry11 * ((uint64_t) 1L << 21);
+ carry13 = (s13 + (int64_t) (1L << 20)) >> 21;
+ s14 += carry13;
+ s13 -= carry13 * ((uint64_t) 1L << 21);
+ carry15 = (s15 + (int64_t) (1L << 20)) >> 21;
+ s16 += carry15;
+ s15 -= carry15 * ((uint64_t) 1L << 21);
+ carry17 = (s17 + (int64_t) (1L << 20)) >> 21;
+ s18 += carry17;
+ s17 -= carry17 * ((uint64_t) 1L << 21);
+ carry19 = (s19 + (int64_t) (1L << 20)) >> 21;
+ s20 += carry19;
+ s19 -= carry19 * ((uint64_t) 1L << 21);
+ carry21 = (s21 + (int64_t) (1L << 20)) >> 21;
+ s22 += carry21;
+ s21 -= carry21 * ((uint64_t) 1L << 21);
s11 += s23 * 666643;
s12 += s23 * 470296;
@@ -1877,14 +2031,430 @@
s[31] = s11 >> 17;
}
-int
-sc25519_is_canonical(const unsigned char *s)
+/*
+ Input:
+ a[0]+256*a[1]+...+256^31*a[31] = a
+ *
+ Output:
+ s[0]+256*s[1]+...+256^31*s[31] = a^2 mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+ */
+
+static inline void
+sc25519_sq(unsigned char *s, const unsigned char *a)
{
- /* 2^252+27742317777372353535851937790883648493 */
- static const unsigned char L[32] = {
- 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
+ sc25519_mul(s, a, a);
+}
+
+/*
+ Input:
+ s[0]+256*a[1]+...+256^31*a[31] = a
+ n
+ *
+ Output:
+ s[0]+256*s[1]+...+256^31*s[31] = x * s^(s^n) mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+ Overwrites s in place.
+ */
+
+static inline void
+sc25519_sqmul(unsigned char s[32], const int n, const unsigned char a[32])
+{
+ int i;
+
+ for (i = 0; i < n; i++) {
+ sc25519_sq(s, s);
+ }
+ sc25519_mul(s, s, a);
+}
+
+void
+sc25519_invert(unsigned char recip[32], const unsigned char s[32])
+{
+ unsigned char _10[32], _100[32], _11[32], _101[32], _111[32],
+ _1001[32], _1011[32], _1111[32];
+
+ sc25519_sq(_10, s);
+ sc25519_sq(_100, _10);
+ sc25519_mul(_11, _10, s);
+ sc25519_mul(_101, _10, _11);
+ sc25519_mul(_111, _10, _101);
+ sc25519_mul(_1001, _10, _111);
+ sc25519_mul(_1011, _10, _1001);
+ sc25519_mul(_1111, _100, _1011);
+ sc25519_mul(recip, _1111, s);
+
+ sc25519_sqmul(recip, 123 + 3, _101);
+ sc25519_sqmul(recip, 2 + 2, _11);
+ sc25519_sqmul(recip, 1 + 4, _1111);
+ sc25519_sqmul(recip, 1 + 4, _1111);
+ sc25519_sqmul(recip, 4, _1001);
+ sc25519_sqmul(recip, 2, _11);
+ sc25519_sqmul(recip, 1 + 4, _1111);
+ sc25519_sqmul(recip, 1 + 3, _101);
+ sc25519_sqmul(recip, 3 + 3, _101);
+ sc25519_sqmul(recip, 3, _111);
+ sc25519_sqmul(recip, 1 + 4, _1111);
+ sc25519_sqmul(recip, 2 + 3, _111);
+ sc25519_sqmul(recip, 2 + 2, _11);
+ sc25519_sqmul(recip, 1 + 4, _1011);
+ sc25519_sqmul(recip, 2 + 4, _1011);
+ sc25519_sqmul(recip, 6 + 4, _1001);
+ sc25519_sqmul(recip, 2 + 2, _11);
+ sc25519_sqmul(recip, 3 + 2, _11);
+ sc25519_sqmul(recip, 3 + 2, _11);
+ sc25519_sqmul(recip, 1 + 4, _1001);
+ sc25519_sqmul(recip, 1 + 3, _111);
+ sc25519_sqmul(recip, 2 + 4, _1111);
+ sc25519_sqmul(recip, 1 + 4, _1011);
+ sc25519_sqmul(recip, 3, _101);
+ sc25519_sqmul(recip, 2 + 4, _1111);
+ sc25519_sqmul(recip, 3, _101);
+ sc25519_sqmul(recip, 1 + 2, _11);
+}
+
+/*
+ Input:
+ s[0]+256*s[1]+...+256^63*s[63] = s
+ *
+ Output:
+ s[0]+256*s[1]+...+256^31*s[31] = s mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+ Overwrites s in place.
+ */
+
+void
+sc25519_reduce(unsigned char s[64])
+{
+ int64_t s0 = 2097151 & load_3(s);
+ int64_t s1 = 2097151 & (load_4(s + 2) >> 5);
+ int64_t s2 = 2097151 & (load_3(s + 5) >> 2);
+ int64_t s3 = 2097151 & (load_4(s + 7) >> 7);
+ int64_t s4 = 2097151 & (load_4(s + 10) >> 4);
+ int64_t s5 = 2097151 & (load_3(s + 13) >> 1);
+ int64_t s6 = 2097151 & (load_4(s + 15) >> 6);
+ int64_t s7 = 2097151 & (load_3(s + 18) >> 3);
+ int64_t s8 = 2097151 & load_3(s + 21);
+ int64_t s9 = 2097151 & (load_4(s + 23) >> 5);
+ int64_t s10 = 2097151 & (load_3(s + 26) >> 2);
+ int64_t s11 = 2097151 & (load_4(s + 28) >> 7);
+ int64_t s12 = 2097151 & (load_4(s + 31) >> 4);
+ int64_t s13 = 2097151 & (load_3(s + 34) >> 1);
+ int64_t s14 = 2097151 & (load_4(s + 36) >> 6);
+ int64_t s15 = 2097151 & (load_3(s + 39) >> 3);
+ int64_t s16 = 2097151 & load_3(s + 42);
+ int64_t s17 = 2097151 & (load_4(s + 44) >> 5);
+ int64_t s18 = 2097151 & (load_3(s + 47) >> 2);
+ int64_t s19 = 2097151 & (load_4(s + 49) >> 7);
+ int64_t s20 = 2097151 & (load_4(s + 52) >> 4);
+ int64_t s21 = 2097151 & (load_3(s + 55) >> 1);
+ int64_t s22 = 2097151 & (load_4(s + 57) >> 6);
+ int64_t s23 = (load_4(s + 60) >> 3);
+
+ int64_t carry0;
+ int64_t carry1;
+ int64_t carry2;
+ int64_t carry3;
+ int64_t carry4;
+ int64_t carry5;
+ int64_t carry6;
+ int64_t carry7;
+ int64_t carry8;
+ int64_t carry9;
+ int64_t carry10;
+ int64_t carry11;
+ int64_t carry12;
+ int64_t carry13;
+ int64_t carry14;
+ int64_t carry15;
+ int64_t carry16;
+
+ s11 += s23 * 666643;
+ s12 += s23 * 470296;
+ s13 += s23 * 654183;
+ s14 -= s23 * 997805;
+ s15 += s23 * 136657;
+ s16 -= s23 * 683901;
+
+ s10 += s22 * 666643;
+ s11 += s22 * 470296;
+ s12 += s22 * 654183;
+ s13 -= s22 * 997805;
+ s14 += s22 * 136657;
+ s15 -= s22 * 683901;
+
+ s9 += s21 * 666643;
+ s10 += s21 * 470296;
+ s11 += s21 * 654183;
+ s12 -= s21 * 997805;
+ s13 += s21 * 136657;
+ s14 -= s21 * 683901;
+
+ s8 += s20 * 666643;
+ s9 += s20 * 470296;
+ s10 += s20 * 654183;
+ s11 -= s20 * 997805;
+ s12 += s20 * 136657;
+ s13 -= s20 * 683901;
+
+ s7 += s19 * 666643;
+ s8 += s19 * 470296;
+ s9 += s19 * 654183;
+ s10 -= s19 * 997805;
+ s11 += s19 * 136657;
+ s12 -= s19 * 683901;
+
+ s6 += s18 * 666643;
+ s7 += s18 * 470296;
+ s8 += s18 * 654183;
+ s9 -= s18 * 997805;
+ s10 += s18 * 136657;
+ s11 -= s18 * 683901;
+
+ carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
+ s7 += carry6;
+ s6 -= carry6 * ((uint64_t) 1L << 21);
+ carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
+ s9 += carry8;
+ s8 -= carry8 * ((uint64_t) 1L << 21);
+ carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
+ s11 += carry10;
+ s10 -= carry10 * ((uint64_t) 1L << 21);
+ carry12 = (s12 + (int64_t) (1L << 20)) >> 21;
+ s13 += carry12;
+ s12 -= carry12 * ((uint64_t) 1L << 21);
+ carry14 = (s14 + (int64_t) (1L << 20)) >> 21;
+ s15 += carry14;
+ s14 -= carry14 * ((uint64_t) 1L << 21);
+ carry16 = (s16 + (int64_t) (1L << 20)) >> 21;
+ s17 += carry16;
+ s16 -= carry16 * ((uint64_t) 1L << 21);
+
+ carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
+ s8 += carry7;
+ s7 -= carry7 * ((uint64_t) 1L << 21);
+ carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
+ s10 += carry9;
+ s9 -= carry9 * ((uint64_t) 1L << 21);
+ carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
+ s12 += carry11;
+ s11 -= carry11 * ((uint64_t) 1L << 21);
+ carry13 = (s13 + (int64_t) (1L << 20)) >> 21;
+ s14 += carry13;
+ s13 -= carry13 * ((uint64_t) 1L << 21);
+ carry15 = (s15 + (int64_t) (1L << 20)) >> 21;
+ s16 += carry15;
+ s15 -= carry15 * ((uint64_t) 1L << 21);
+
+ s5 += s17 * 666643;
+ s6 += s17 * 470296;
+ s7 += s17 * 654183;
+ s8 -= s17 * 997805;
+ s9 += s17 * 136657;
+ s10 -= s17 * 683901;
+
+ s4 += s16 * 666643;
+ s5 += s16 * 470296;
+ s6 += s16 * 654183;
+ s7 -= s16 * 997805;
+ s8 += s16 * 136657;
+ s9 -= s16 * 683901;
+
+ s3 += s15 * 666643;
+ s4 += s15 * 470296;
+ s5 += s15 * 654183;
+ s6 -= s15 * 997805;
+ s7 += s15 * 136657;
+ s8 -= s15 * 683901;
+
+ s2 += s14 * 666643;
+ s3 += s14 * 470296;
+ s4 += s14 * 654183;
+ s5 -= s14 * 997805;
+ s6 += s14 * 136657;
+ s7 -= s14 * 683901;
+
+ s1 += s13 * 666643;
+ s2 += s13 * 470296;
+ s3 += s13 * 654183;
+ s4 -= s13 * 997805;
+ s5 += s13 * 136657;
+ s6 -= s13 * 683901;
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = (s0 + (int64_t) (1L << 20)) >> 21;
+ s1 += carry0;
+ s0 -= carry0 * ((uint64_t) 1L << 21);
+ carry2 = (s2 + (int64_t) (1L << 20)) >> 21;
+ s3 += carry2;
+ s2 -= carry2 * ((uint64_t) 1L << 21);
+ carry4 = (s4 + (int64_t) (1L << 20)) >> 21;
+ s5 += carry4;
+ s4 -= carry4 * ((uint64_t) 1L << 21);
+ carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
+ s7 += carry6;
+ s6 -= carry6 * ((uint64_t) 1L << 21);
+ carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
+ s9 += carry8;
+ s8 -= carry8 * ((uint64_t) 1L << 21);
+ carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
+ s11 += carry10;
+ s10 -= carry10 * ((uint64_t) 1L << 21);
+
+ carry1 = (s1 + (int64_t) (1L << 20)) >> 21;
+ s2 += carry1;
+ s1 -= carry1 * ((uint64_t) 1L << 21);
+ carry3 = (s3 + (int64_t) (1L << 20)) >> 21;
+ s4 += carry3;
+ s3 -= carry3 * ((uint64_t) 1L << 21);
+ carry5 = (s5 + (int64_t) (1L << 20)) >> 21;
+ s6 += carry5;
+ s5 -= carry5 * ((uint64_t) 1L << 21);
+ carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
+ s8 += carry7;
+ s7 -= carry7 * ((uint64_t) 1L << 21);
+ carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
+ s10 += carry9;
+ s9 -= carry9 * ((uint64_t) 1L << 21);
+ carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
+ s12 += carry11;
+ s11 -= carry11 * ((uint64_t) 1L << 21);
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = s0 >> 21;
+ s1 += carry0;
+ s0 -= carry0 * ((uint64_t) 1L << 21);
+ carry1 = s1 >> 21;
+ s2 += carry1;
+ s1 -= carry1 * ((uint64_t) 1L << 21);
+ carry2 = s2 >> 21;
+ s3 += carry2;
+ s2 -= carry2 * ((uint64_t) 1L << 21);
+ carry3 = s3 >> 21;
+ s4 += carry3;
+ s3 -= carry3 * ((uint64_t) 1L << 21);
+ carry4 = s4 >> 21;
+ s5 += carry4;
+ s4 -= carry4 * ((uint64_t) 1L << 21);
+ carry5 = s5 >> 21;
+ s6 += carry5;
+ s5 -= carry5 * ((uint64_t) 1L << 21);
+ carry6 = s6 >> 21;
+ s7 += carry6;
+ s6 -= carry6 * ((uint64_t) 1L << 21);
+ carry7 = s7 >> 21;
+ s8 += carry7;
+ s7 -= carry7 * ((uint64_t) 1L << 21);
+ carry8 = s8 >> 21;
+ s9 += carry8;
+ s8 -= carry8 * ((uint64_t) 1L << 21);
+ carry9 = s9 >> 21;
+ s10 += carry9;
+ s9 -= carry9 * ((uint64_t) 1L << 21);
+ carry10 = s10 >> 21;
+ s11 += carry10;
+ s10 -= carry10 * ((uint64_t) 1L << 21);
+ carry11 = s11 >> 21;
+ s12 += carry11;
+ s11 -= carry11 * ((uint64_t) 1L << 21);
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+
+ carry0 = s0 >> 21;
+ s1 += carry0;
+ s0 -= carry0 * ((uint64_t) 1L << 21);
+ carry1 = s1 >> 21;
+ s2 += carry1;
+ s1 -= carry1 * ((uint64_t) 1L << 21);
+ carry2 = s2 >> 21;
+ s3 += carry2;
+ s2 -= carry2 * ((uint64_t) 1L << 21);
+ carry3 = s3 >> 21;
+ s4 += carry3;
+ s3 -= carry3 * ((uint64_t) 1L << 21);
+ carry4 = s4 >> 21;
+ s5 += carry4;
+ s4 -= carry4 * ((uint64_t) 1L << 21);
+ carry5 = s5 >> 21;
+ s6 += carry5;
+ s5 -= carry5 * ((uint64_t) 1L << 21);
+ carry6 = s6 >> 21;
+ s7 += carry6;
+ s6 -= carry6 * ((uint64_t) 1L << 21);
+ carry7 = s7 >> 21;
+ s8 += carry7;
+ s7 -= carry7 * ((uint64_t) 1L << 21);
+ carry8 = s8 >> 21;
+ s9 += carry8;
+ s8 -= carry8 * ((uint64_t) 1L << 21);
+ carry9 = s9 >> 21;
+ s10 += carry9;
+ s9 -= carry9 * ((uint64_t) 1L << 21);
+ carry10 = s10 >> 21;
+ s11 += carry10;
+ s10 -= carry10 * ((uint64_t) 1L << 21);
+
+ s[0] = s0 >> 0;
+ s[1] = s0 >> 8;
+ s[2] = (s0 >> 16) | (s1 * ((uint64_t) 1 << 5));
+ s[3] = s1 >> 3;
+ s[4] = s1 >> 11;
+ s[5] = (s1 >> 19) | (s2 * ((uint64_t) 1 << 2));
+ s[6] = s2 >> 6;
+ s[7] = (s2 >> 14) | (s3 * ((uint64_t) 1 << 7));
+ s[8] = s3 >> 1;
+ s[9] = s3 >> 9;
+ s[10] = (s3 >> 17) | (s4 * ((uint64_t) 1 << 4));
+ s[11] = s4 >> 4;
+ s[12] = s4 >> 12;
+ s[13] = (s4 >> 20) | (s5 * ((uint64_t) 1 << 1));
+ s[14] = s5 >> 7;
+ s[15] = (s5 >> 15) | (s6 * ((uint64_t) 1 << 6));
+ s[16] = s6 >> 2;
+ s[17] = s6 >> 10;
+ s[18] = (s6 >> 18) | (s7 * ((uint64_t) 1 << 3));
+ s[19] = s7 >> 5;
+ s[20] = s7 >> 13;
+ s[21] = s8 >> 0;
+ s[22] = s8 >> 8;
+ s[23] = (s8 >> 16) | (s9 * ((uint64_t) 1 << 5));
+ s[24] = s9 >> 3;
+ s[25] = s9 >> 11;
+ s[26] = (s9 >> 19) | (s10 * ((uint64_t) 1 << 2));
+ s[27] = s10 >> 6;
+ s[28] = (s10 >> 14) | (s11 * ((uint64_t) 1 << 7));
+ s[29] = s11 >> 1;
+ s[30] = s11 >> 9;
+ s[31] = s11 >> 17;
+}
+
+int
+sc25519_is_canonical(const unsigned char s[32])
+{
+ /* 2^252+27742317777372353535851937790883648493 */
+ static const unsigned char L[32] = {
+ 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 c = 0;
unsigned char n = 1;
@@ -1955,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;
-
- memcpy(s, r, 32);
- x_sign = s[31] & 0x80;
- s[31] &= 0x7f;
-
- fe25519_frombytes(rr2, s);
+ 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;
- /* elligator */
- fe25519_sq2(rr2, rr2);
+ fe25519_sq2(rr2, r);
rr2[0]++;
fe25519_invert(rr2, rr2);
fe25519_mul(x, curve25519_A, rr2);
@@ -2029,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.16/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.16/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h 2017-12-13 09:24:13.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.16/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.16/src/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h 2017-12-13 09:24:13.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.16/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.16/src/libsodium/crypto_core/salsa/ref/core_salsa_ref.c 2017-12-13 09:24:13.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.16/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.16/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h 2019-05-30 20:13:18.000000000 +0000
@@ -2,18 +2,20 @@
#ifndef blake2b_compress_avx2_H
#define blake2b_compress_avx2_H
-#define LOAD128(p) _mm_load_si128((__m128i *) (p))
-#define STORE128(p, r) _mm_store_si128((__m128i *) (p), r)
-
-#define LOADU128(p) _mm_loadu_si128((__m128i *) (p))
+#define LOADU128(p) _mm_loadu_si128((const __m128i *) (p))
#define STOREU128(p, r) _mm_storeu_si128((__m128i *) (p), r)
-#define LOAD(p) _mm256_load_si256((__m256i *) (p))
-#define STORE(p, r) _mm256_store_si256((__m256i *) (p), r)
-
-#define LOADU(p) _mm256_loadu_si256((__m256i *) (p))
+#define LOADU(p) _mm256_loadu_si256((const __m256i *) (p))
#define STOREU(p, r) _mm256_storeu_si256((__m256i *) (p), r)
+#if defined(__INTEL_COMPILER) || defined(_MSC_VER) || defined(__GNUC__)
+# define LOAD(p) _mm256_load_si256((const __m256i *) (p))
+# define STORE(p, r) _mm256_store_si256((__m256i *) (p), r)
+#else
+# define LOAD(p) LOADU(p)
+# define STORE(p, r) STOREU(p, r)
+#endif
+
static inline uint64_t
LOADU64(const void *p)
{
@@ -66,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.16/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.16/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c 2019-05-30 20:13:18.000000000 +0000
@@ -34,12 +34,12 @@
uint64_t v[16];
int i;
- for (i = 0; i < 16; ++i)
- m[i] = LOAD64_LE(block + i * sizeof(m[i]));
-
- for (i = 0; i < 8; ++i)
+ for (i = 0; i < 16; ++i) {
+ m[i] = LOAD64_LE(block + i * sizeof m[i]);
+ }
+ for (i = 0; i < 8; ++i) {
v[i] = S->h[i];
-
+ }
v[8] = blake2b_IV[0];
v[9] = blake2b_IV[1];
v[10] = blake2b_IV[2];
@@ -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.16/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c
--- libsodium-1.0.16/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c 2019-05-30 20:13:18.000000000 +0000
@@ -39,22 +39,22 @@
_mm_setr_epi8(2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9);
const __m128i r24 =
_mm_setr_epi8(3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10);
- const uint64_t m0 = ((uint64_t *) block)[0];
- const uint64_t m1 = ((uint64_t *) block)[1];
- const uint64_t m2 = ((uint64_t *) block)[2];
- const uint64_t m3 = ((uint64_t *) block)[3];
- const uint64_t m4 = ((uint64_t *) block)[4];
- const uint64_t m5 = ((uint64_t *) block)[5];
- const uint64_t m6 = ((uint64_t *) block)[6];
- const uint64_t m7 = ((uint64_t *) block)[7];
- const uint64_t m8 = ((uint64_t *) block)[8];
- const uint64_t m9 = ((uint64_t *) block)[9];
- const uint64_t m10 = ((uint64_t *) block)[10];
- const uint64_t m11 = ((uint64_t *) block)[11];
- const uint64_t m12 = ((uint64_t *) block)[12];
- const uint64_t m13 = ((uint64_t *) block)[13];
- const uint64_t m14 = ((uint64_t *) block)[14];
- const uint64_t m15 = ((uint64_t *) block)[15];
+ const uint64_t m0 = ((const uint64_t *) block)[0];
+ const uint64_t m1 = ((const uint64_t *) block)[1];
+ const uint64_t m2 = ((const uint64_t *) block)[2];
+ const uint64_t m3 = ((const uint64_t *) block)[3];
+ const uint64_t m4 = ((const uint64_t *) block)[4];
+ const uint64_t m5 = ((const uint64_t *) block)[5];
+ const uint64_t m6 = ((const uint64_t *) block)[6];
+ const uint64_t m7 = ((const uint64_t *) block)[7];
+ const uint64_t m8 = ((const uint64_t *) block)[8];
+ const uint64_t m9 = ((const uint64_t *) block)[9];
+ const uint64_t m10 = ((const uint64_t *) block)[10];
+ const uint64_t m11 = ((const uint64_t *) block)[11];
+ const uint64_t m12 = ((const uint64_t *) block)[12];
+ const uint64_t m13 = ((const uint64_t *) block)[13];
+ const uint64_t m14 = ((const uint64_t *) block)[14];
+ const uint64_t m15 = ((const uint64_t *) block)[15];
row1l = LOADU(&S->h[0]);
row1h = LOADU(&S->h[2]);
diff -Nru libsodium-1.0.16/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.16/src/libsodium/crypto_generichash/blake2b/ref/blake2b-load-avx2.h 2017-12-13 09:24:13.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.16/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c
--- libsodium-1.0.16/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c 2019-05-30 20:13:18.000000000 +0000
@@ -51,9 +51,9 @@
static inline int
blake2b_set_lastblock(blake2b_state *S)
{
- if (S->last_node)
+ if (S->last_node) {
blake2b_set_lastnode(S);
-
+ }
S->f[0] = -1;
return 0;
}
@@ -97,7 +97,9 @@
for (i = 0; i < 8; i++) {
S->h[i] = blake2b_IV[i];
}
- memset(S->t, 0, offsetof(blake2b_state, last_node) + sizeof(S->last_node)
+ /* zero everything between .t and .last_node */
+ memset((void *) &S->t, 0,
+ offsetof(blake2b_state, last_node) + sizeof(S->last_node)
- offsetof(blake2b_state, t));
return 0;
}
@@ -183,7 +185,7 @@
sodium_misuse();
}
if (!key || !keylen || keylen > BLAKE2B_KEYBYTES) {
- sodium_misuse();
+ sodium_misuse(); /* does not return */
}
P->digest_length = outlen;
P->key_length = keylen;
@@ -203,7 +205,7 @@
{
uint8_t block[BLAKE2B_BLOCKBYTES];
memset(block, 0, BLAKE2B_BLOCKBYTES);
- memcpy(block, key, keylen); /* keylen cannot be 0 */
+ memcpy(block, key, keylen); /* key and keylen cannot be 0 */
blake2b_update(S, block, BLAKE2B_BLOCKBYTES);
sodium_memzero(block, BLAKE2B_BLOCKBYTES); /* Burn the key from stack */
}
@@ -221,7 +223,7 @@
sodium_misuse();
}
if (!key || !keylen || keylen > BLAKE2B_KEYBYTES) {
- sodium_misuse();
+ sodium_misuse(); /* does not return */
}
P->digest_length = outlen;
P->key_length = keylen;
@@ -249,7 +251,7 @@
{
uint8_t block[BLAKE2B_BLOCKBYTES];
memset(block, 0, BLAKE2B_BLOCKBYTES);
- memcpy(block, key, keylen); /* keylen cannot be 0 */
+ memcpy(block, key, keylen); /* key and keylen cannot be 0 */
blake2b_update(S, block, BLAKE2B_BLOCKBYTES);
sodium_memzero(block, BLAKE2B_BLOCKBYTES); /* Burn the key from stack */
}
@@ -333,7 +335,7 @@
blake2b(uint8_t *out, const void *in, const void *key, const uint8_t outlen,
const uint64_t inlen, uint8_t keylen)
{
- blake2b_state S[1];
+ CRYPTO_ALIGN(64) blake2b_state S[1];
/* Verify parameters */
if (NULL == in && inlen > 0) {
@@ -371,7 +373,7 @@
const uint8_t outlen, const uint64_t inlen,
uint8_t keylen, const void *salt, const void *personal)
{
- blake2b_state S[1];
+ CRYPTO_ALIGN(64) blake2b_state S[1];
/* Verify parameters */
if (NULL == in && inlen > 0) {
diff -Nru libsodium-1.0.16/src/libsodium/crypto_generichash/blake2b/ref/blake2.h libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2.h
--- libsodium-1.0.16/src/libsodium/crypto_generichash/blake2b/ref/blake2.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/blake2.h 2019-05-30 20:13:18.000000000 +0000
@@ -65,7 +65,14 @@
uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */
} blake2b_param;
-typedef crypto_generichash_blake2b_state blake2b_state;
+typedef struct blake2b_state {
+ uint64_t h[8];
+ uint64_t t[2];
+ uint64_t f[2];
+ uint8_t buf[2 * 128];
+ size_t buflen;
+ uint8_t last_node;
+} blake2b_state;
#if defined(__IBMC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#pragma pack()
diff -Nru libsodium-1.0.16/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c
--- libsodium-1.0.16/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c 2019-05-30 20:13:18.000000000 +0000
@@ -5,6 +5,7 @@
#include "blake2.h"
#include "crypto_generichash_blake2b.h"
+#include "private/common.h"
#include "private/implementations.h"
int
@@ -52,11 +53,12 @@
}
assert(outlen <= UINT8_MAX);
assert(keylen <= UINT8_MAX);
+ COMPILER_ASSERT(sizeof(blake2b_state) <= sizeof *state);
if (key == NULL || keylen <= 0U) {
- if (blake2b_init(state, (uint8_t) outlen) != 0) {
+ if (blake2b_init((blake2b_state *) (void *) state, (uint8_t) outlen) != 0) {
return -1; /* LCOV_EXCL_LINE */
}
- } else if (blake2b_init_key(state, (uint8_t) outlen, key,
+ } else if (blake2b_init_key((blake2b_state *) (void *) state, (uint8_t) outlen, key,
(uint8_t) keylen) != 0) {
return -1; /* LCOV_EXCL_LINE */
}
@@ -76,11 +78,12 @@
assert(outlen <= UINT8_MAX);
assert(keylen <= UINT8_MAX);
if (key == NULL || keylen <= 0U) {
- if (blake2b_init_salt_personal(state, (uint8_t) outlen, salt,
- personal) != 0) {
+ if (blake2b_init_salt_personal((blake2b_state *) (void *) state,
+ (uint8_t) outlen, salt, personal) != 0) {
return -1; /* LCOV_EXCL_LINE */
}
- } else if (blake2b_init_key_salt_personal(state, (uint8_t) outlen, key,
+ } else if (blake2b_init_key_salt_personal((blake2b_state *) (void *) state,
+ (uint8_t) outlen, key,
(uint8_t) keylen, salt,
personal) != 0) {
return -1; /* LCOV_EXCL_LINE */
@@ -93,7 +96,8 @@
const unsigned char *in,
unsigned long long inlen)
{
- return blake2b_update(state, (const uint8_t *) in, (uint64_t) inlen);
+ return blake2b_update((blake2b_state *) (void *) state,
+ (const uint8_t *) in, (uint64_t) inlen);
}
int
@@ -101,7 +105,8 @@
unsigned char *out, const size_t outlen)
{
assert(outlen <= UINT8_MAX);
- return blake2b_final(state, (uint8_t *) out, (uint8_t) outlen);
+ return blake2b_final((blake2b_state *) (void *) state,
+ (uint8_t *) out, (uint8_t) outlen);
}
int
diff -Nru libsodium-1.0.16/src/libsodium/crypto_kx/crypto_kx.c libsodium-1.0.18/src/libsodium/crypto_kx/crypto_kx.c
--- libsodium-1.0.16/src/libsodium/crypto_kx/crypto_kx.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_kx/crypto_kx.c 2019-05-30 20:13:18.000000000 +0000
@@ -63,8 +63,8 @@
crypto_generichash_final(&h, keys, sizeof keys);
sodium_memzero(&h, sizeof h);
for (i = 0; i < crypto_kx_SESSIONKEYBYTES; i++) {
- rx[i] = keys[i];
- tx[i] = keys[i + crypto_kx_SESSIONKEYBYTES];
+ rx[i] = keys[i]; /* rx cannot be NULL */
+ tx[i] = keys[i + crypto_kx_SESSIONKEYBYTES]; /* tx cannot be NULL */
}
sodium_memzero(keys, sizeof keys);
diff -Nru libsodium-1.0.16/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h libsodium-1.0.18/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h
--- libsodium-1.0.16/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h 2019-05-30 20:13:18.000000000 +0000
@@ -5,7 +5,7 @@
#if defined(_MSC_VER)
# define POLY1305_NOINLINE __declspec(noinline)
-#elif defined(__GNUC__)
+#elif defined(__clang__) || defined(__GNUC__)
# define POLY1305_NOINLINE __attribute__((noinline))
#else
# define POLY1305_NOINLINE
diff -Nru libsodium-1.0.16/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.16/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h 2019-05-30 20:13:18.000000000 +0000
@@ -13,7 +13,7 @@
#if defined(_MSC_VER)
# define POLY1305_NOINLINE __declspec(noinline)
-#elif defined(__GNUC__)
+#elif defined(__clang__) || defined(__GNUC__)
# define POLY1305_NOINLINE __attribute__((noinline))
#else
# define POLY1305_NOINLINE
@@ -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.16/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c libsodium-1.0.18/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c
--- libsodium-1.0.16/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c 2019-05-30 20:13:18.000000000 +0000
@@ -21,7 +21,7 @@
# if defined(_MSC_VER)
# define POLY1305_NOINLINE __declspec(noinline)
-# elif defined(__GNUC__)
+# elif defined(__clang__) || defined(__GNUC__)
# define POLY1305_NOINLINE __attribute__((noinline))
# else
# define POLY1305_NOINLINE
diff -Nru libsodium-1.0.16/src/libsodium/crypto_pwhash/argon2/argon2-core.c libsodium-1.0.18/src/libsodium/crypto_pwhash/argon2/argon2-core.c
--- libsodium-1.0.16/src/libsodium/crypto_pwhash/argon2/argon2-core.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_pwhash/argon2/argon2-core.c 2019-05-30 20:13:18.000000000 +0000
@@ -67,7 +67,7 @@
* @param m_cost number of blocks to allocate in the memory
* @return ARGON2_OK if @memory is a valid pointer and memory is allocated
*/
-static int allocate_memory(block_region **memory, uint32_t m_cost);
+static int allocate_memory(block_region **region, uint32_t m_cost);
static int
allocate_memory(block_region **region, uint32_t m_cost)
@@ -80,14 +80,11 @@
return ARGON2_MEMORY_ALLOCATION_ERROR; /* LCOV_EXCL_LINE */
}
memory_size = sizeof(block) * m_cost;
- if (m_cost == 0 ||
- memory_size / m_cost !=
- sizeof(block)) { /*1. Check for multiplication overflow*/
+ if (m_cost == 0 || memory_size / m_cost != sizeof(block)) {
return ARGON2_MEMORY_ALLOCATION_ERROR; /* LCOV_EXCL_LINE */
}
- *region = (block_region *) malloc(
- sizeof(block_region)); /*2. Try to allocate region*/
- if (!*region) {
+ *region = (block_region *) malloc(sizeof(block_region));
+ if (*region == NULL) {
return ARGON2_MEMORY_ALLOCATION_ERROR; /* LCOV_EXCL_LINE */
}
(*region)->base = (*region)->memory = NULL;
@@ -116,7 +113,11 @@
}
#endif
if (base == NULL) {
- return ARGON2_MEMORY_ALLOCATION_ERROR; /* LCOV_EXCL_LINE */
+ /* LCOV_EXCL_START */
+ free(*region);
+ *region = NULL;
+ return ARGON2_MEMORY_ALLOCATION_ERROR;
+ /* LCOV_EXCL_STOP */
}
(*region)->base = base;
(*region)->memory = memory;
@@ -153,7 +154,7 @@
/* Deallocates memory
* @param memory pointer to the blocks
*/
-static void free_memory(block_region *memory);
+static void free_memory(block_region *region);
static void
free_memory(block_region *region)
diff -Nru libsodium-1.0.16/src/libsodium/crypto_pwhash/crypto_pwhash.c libsodium-1.0.18/src/libsodium/crypto_pwhash/crypto_pwhash.c
--- libsodium-1.0.16/src/libsodium/crypto_pwhash/crypto_pwhash.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_pwhash/crypto_pwhash.c 2019-05-30 20:13:18.000000000 +0000
@@ -168,6 +168,7 @@
}
sodium_misuse();
/* NOTREACHED */
+ return -1;
}
int
diff -Nru libsodium-1.0.16/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c libsodium-1.0.18/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c
--- libsodium-1.0.16/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c 2019-05-30 20:13:18.000000000 +0000
@@ -158,11 +158,11 @@
prefixlen = src - setting;
salt = src;
- src = (uint8_t *) strrchr((char *) salt, '$');
+ src = (const uint8_t *) strrchr((const char *) salt, '$');
if (src) {
saltlen = src - salt;
} else {
- saltlen = strlen((char *) salt);
+ saltlen = strlen((const char *) salt);
}
need = prefixlen + saltlen + 1 +
crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES_ENCODED + 1;
diff -Nru libsodium-1.0.16/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.16/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c 2019-05-30 20:13:18.000000000 +0000
@@ -163,8 +163,9 @@
x[15] ^= R(x[14] + x[13], 18);
#undef R
}
- for (i = 0; i < 16; i++)
+ for (i = 0; i < 16; i++) {
B[i] += x[i];
+ }
}
/**
@@ -180,20 +181,23 @@
/* 1: X <-- B_{2r - 1} */
blkcpy_64((escrypt_block_t *) X,
- (escrypt_block_t *) &Bin[(2 * r - 1) * 16]);
+ (const escrypt_block_t *) &Bin[(2 * r - 1) * 16]);
/* 2: for i = 0 to 2r - 1 do */
for (i = 0; i < 2 * r; i += 2) {
/* 3: X <-- H(X \xor B_i) */
- blkxor_64((escrypt_block_t *) X, (escrypt_block_t *) &Bin[i * 16]);
+ blkxor_64((escrypt_block_t *) X,
+ (const escrypt_block_t *) &Bin[i * 16]);
salsa20_8(X);
/* 4: Y_i <-- X */
/* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
- blkcpy_64((escrypt_block_t *) &Bout[i * 8], (escrypt_block_t *) X);
+ blkcpy_64((escrypt_block_t *) &Bout[i * 8],
+ (const escrypt_block_t *) X);
/* 3: X <-- H(X \xor B_i) */
- blkxor_64((escrypt_block_t *) X, (escrypt_block_t *) &Bin[i * 16 + 16]);
+ blkxor_64((escrypt_block_t *) X,
+ (const escrypt_block_t *) &Bin[i * 16 + 16]);
salsa20_8(X);
/* 4: Y_i <-- X */
@@ -301,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.16/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c libsodium-1.0.18/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c
--- libsodium-1.0.16/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c 2019-05-30 20:13:18.000000000 +0000
@@ -52,6 +52,17 @@
return 0;
}
+static size_t
+sodium_strnlen(const char *str, size_t maxlen)
+{
+ size_t i = 0U;
+
+ while (i < maxlen && str[i] != 0) {
+ i++;
+ }
+ return i;
+}
+
size_t
crypto_pwhash_scryptsalsa208sha256_bytes_min(void)
{
@@ -234,8 +245,8 @@
escrypt_local_t escrypt_local;
int ret = -1;
- if (memchr(str, 0, crypto_pwhash_scryptsalsa208sha256_STRBYTES) !=
- &str[crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1U]) {
+ if (sodium_strnlen(str, crypto_pwhash_scryptsalsa208sha256_STRBYTES) !=
+ crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1U) {
return -1;
}
if (escrypt_init_local(&escrypt_local) != 0) {
@@ -268,8 +279,8 @@
errno = EINVAL;
return -1;
}
- if (memchr(str, 0, crypto_pwhash_scryptsalsa208sha256_STRBYTES) !=
- &str[crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1U]) {
+ if (sodium_strnlen(str, crypto_pwhash_scryptsalsa208sha256_STRBYTES) !=
+ crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1U) {
errno = EINVAL;
return -1;
}
diff -Nru libsodium-1.0.16/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c libsodium-1.0.18/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c
--- libsodium-1.0.16/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c 2019-05-30 20:13:18.000000000 +0000
@@ -55,9 +55,9 @@
aligned = base;
#else
base = aligned = NULL;
- if (size + 63 < size)
+ if (size + 63 < size) {
errno = ENOMEM;
- else if ((base = (uint8_t *) malloc(size + 63)) != NULL) {
+ } else if ((base = (uint8_t *) malloc(size + 63)) != NULL) {
aligned = base + 63;
aligned -= (uintptr_t) aligned & 63;
}
diff -Nru libsodium-1.0.16/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.16/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c 2017-12-13 09:24:13.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.16/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c libsodium-1.0.18/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c
--- libsodium-1.0.16/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c 2019-05-30 20:13:18.000000000 +0000
@@ -18,29 +18,50 @@
{
CRYPTO_ALIGN(16)
static const unsigned char blacklist[][32] = {
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3, 0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32, 0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00 },
- { 0x5f, 0x9c, 0x95, 0xbc, 0xa3, 0x50, 0x8c, 0x24, 0xb1, 0xd0, 0xb1, 0x55, 0x9c, 0x83, 0xef, 0x5b, 0x04, 0x44, 0x5c, 0xc4, 0x58, 0x1c, 0x8e, 0x86, 0xd8, 0x22, 0x4e, 0xdd, 0xd0, 0x9f, 0x11, 0x57 },
- { 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f },
- { 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f },
- { 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f },
- { 0xcd, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3, 0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32, 0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x80 },
- { 0x4c, 0x9c, 0x95, 0xbc, 0xa3, 0x50, 0x8c, 0x24, 0xb1, 0xd0, 0xb1, 0x55, 0x9c, 0x83, 0xef, 0x5b, 0x04, 0x44, 0x5c, 0xc4, 0x58, 0x1c, 0x8e, 0x86, 0xd8, 0x22, 0x4e, 0xdd, 0xd0, 0x9f, 0x11, 0xd7 },
- { 0xd9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
- { 0xda, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
- { 0xdb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }
+ /* 0 (order 4) */
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ /* 1 (order 1) */
+ { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ /* 325606250916557431795983626356110631294008115727848805560023387167927233504
+ (order 8) */
+ { 0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3,
+ 0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32,
+ 0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00 },
+ /* 39382357235489614581723060781553021112529911719440698176882885853963445705823
+ (order 8) */
+ { 0x5f, 0x9c, 0x95, 0xbc, 0xa3, 0x50, 0x8c, 0x24, 0xb1, 0xd0, 0xb1,
+ 0x55, 0x9c, 0x83, 0xef, 0x5b, 0x04, 0x44, 0x5c, 0xc4, 0x58, 0x1c,
+ 0x8e, 0x86, 0xd8, 0x22, 0x4e, 0xdd, 0xd0, 0x9f, 0x11, 0x57 },
+ /* p-1 (order 2) */
+ { 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f },
+ /* p (=0, order 4) */
+ { 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f },
+ /* p+1 (=1, order 1) */
+ { 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }
};
- unsigned char c[12] = { 0 };
+ unsigned char c[7] = { 0 };
unsigned int k;
size_t i, j;
- COMPILER_ASSERT(12 == sizeof blacklist / sizeof blacklist[0]);
- for (j = 0; j < 32; j++) {
+ COMPILER_ASSERT(7 == sizeof blacklist / sizeof blacklist[0]);
+ for (j = 0; j < 31; j++) {
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
c[i] |= s[j] ^ blacklist[i][j];
}
}
+ for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
+ c[i] |= (s[j] & 0x7f) ^ blacklist[i][j];
+ }
k = 0;
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
k |= (c[i] - 1);
diff -Nru libsodium-1.0.16/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.16/src/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c 2017-12-13 09:24:13.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,13 +24,12 @@
_crypto_scalarmult_ed25519_clamp(unsigned char k[32])
{
k[0] &= 248;
- k[31] &= 127;
k[31] |= 64;
}
-int
-crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n,
- const unsigned char *p)
+static int
+_crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n,
+ const unsigned char *p, const int clamp)
{
unsigned char *t = q;
ge25519_p3 Q;
@@ -44,7 +43,11 @@
for (i = 0; i < 32; ++i) {
t[i] = n[i];
}
- _crypto_scalarmult_ed25519_clamp(t);
+ 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)) {
@@ -54,8 +57,22 @@
}
int
-crypto_scalarmult_ed25519_base(unsigned char *q,
- const unsigned char *n)
+crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n,
+ const unsigned char *p)
+{
+ return _crypto_scalarmult_ed25519(q, n, p, 1);
+}
+
+int
+crypto_scalarmult_ed25519_noclamp(unsigned char *q, const unsigned char *n,
+ const unsigned char *p)
+{
+ return _crypto_scalarmult_ed25519(q, n, p, 0);
+}
+
+static int
+_crypto_scalarmult_ed25519_base(unsigned char *q,
+ const unsigned char *n, const int clamp)
{
unsigned char *t = q;
ge25519_p3 Q;
@@ -64,15 +81,33 @@
for (i = 0; i < 32; ++i) {
t[i] = n[i];
}
- _crypto_scalarmult_ed25519_clamp(t);
+ if (clamp != 0) {
+ _crypto_scalarmult_ed25519_clamp(t);
+ }
+ t[31] &= 127;
+
ge25519_scalarmult_base(&Q, t);
ge25519_p3_tobytes(q, &Q);
- if (sodium_is_zero(n, 32) != 0) {
+ if (_crypto_scalarmult_ed25519_is_inf(q) != 0 || sodium_is_zero(n, 32)) {
return -1;
}
return 0;
}
+int
+crypto_scalarmult_ed25519_base(unsigned char *q,
+ const unsigned char *n)
+{
+ return _crypto_scalarmult_ed25519_base(q, n, 1);
+}
+
+int
+crypto_scalarmult_ed25519_base_noclamp(unsigned char *q,
+ const unsigned char *n)
+{
+ return _crypto_scalarmult_ed25519_base(q, n, 0);
+}
+
size_t
crypto_scalarmult_ed25519_bytes(void)
{
diff -Nru libsodium-1.0.16/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.16/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.16/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c libsodium-1.0.18/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c
--- libsodium-1.0.16/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c 2019-05-30 20:13:18.000000000 +0000
@@ -123,6 +123,8 @@
if (outlen_p != NULL) {
*outlen_p = 0U;
}
+ COMPILER_ASSERT(crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX
+ <= crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX);
if (mlen > crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX) {
sodium_misuse();
}
diff -Nru libsodium-1.0.16/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.c libsodium-1.0.18/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.c
--- libsodium-1.0.16/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.c 2019-05-30 20:13:18.000000000 +0000
@@ -33,16 +33,22 @@
switch (left) {
case 7:
b |= ((uint64_t) in[6]) << 48;
+ /* FALLTHRU */
case 6:
b |= ((uint64_t) in[5]) << 40;
+ /* FALLTHRU */
case 5:
b |= ((uint64_t) in[4]) << 32;
+ /* FALLTHRU */
case 4:
b |= ((uint64_t) in[3]) << 24;
+ /* FALLTHRU */
case 3:
b |= ((uint64_t) in[2]) << 16;
+ /* FALLTHRU */
case 2:
b |= ((uint64_t) in[1]) << 8;
+ /* FALLTHRU */
case 1:
b |= ((uint64_t) in[0]);
break;
diff -Nru libsodium-1.0.16/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c libsodium-1.0.18/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c
--- libsodium-1.0.16/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c 2019-05-30 20:13:18.000000000 +0000
@@ -32,16 +32,22 @@
switch (left) {
case 7:
b |= ((uint64_t) in[6]) << 48;
+ /* FALLTHRU */
case 6:
b |= ((uint64_t) in[5]) << 40;
+ /* FALLTHRU */
case 5:
b |= ((uint64_t) in[4]) << 32;
+ /* FALLTHRU */
case 4:
b |= ((uint64_t) in[3]) << 24;
+ /* FALLTHRU */
case 3:
b |= ((uint64_t) in[2]) << 16;
+ /* FALLTHRU */
case 2:
b |= ((uint64_t) in[1]) << 8;
+ /* FALLTHRU */
case 1:
b |= ((uint64_t) in[0]);
break;
diff -Nru libsodium-1.0.16/src/libsodium/crypto_sign/crypto_sign.c libsodium-1.0.18/src/libsodium/crypto_sign/crypto_sign.c
--- libsodium-1.0.16/src/libsodium/crypto_sign/crypto_sign.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_sign/crypto_sign.c 2019-05-30 20:13:18.000000000 +0000
@@ -108,7 +108,7 @@
}
int
-crypto_sign_final_verify(crypto_sign_state *state, unsigned char *sig,
+crypto_sign_final_verify(crypto_sign_state *state, const unsigned char *sig,
const unsigned char *pk)
{
return crypto_sign_ed25519ph_final_verify(state, sig, pk);
diff -Nru libsodium-1.0.16/src/libsodium/crypto_sign/ed25519/ref10/keypair.c libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/ref10/keypair.c
--- libsodium-1.0.16/src/libsodium/crypto_sign/ed25519/ref10/keypair.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/ref10/keypair.c 2019-05-30 20:13:18.000000000 +0000
@@ -15,11 +15,7 @@
{
ge25519_p3 A;
-#ifdef ED25519_NONDETERMINISTIC
- memmove(sk, seed, 32);
-#else
crypto_hash_sha512(sk, seed, 32);
-#endif
sk[0] &= 248;
sk[31] &= 127;
sk[31] |= 64;
@@ -61,9 +57,9 @@
}
fe25519_1(one_minus_y);
fe25519_sub(one_minus_y, one_minus_y, A.Y);
- fe25519_invert(one_minus_y, one_minus_y);
fe25519_1(x);
fe25519_add(x, x, A.Y);
+ fe25519_invert(one_minus_y, one_minus_y);
fe25519_mul(x, x, one_minus_y);
fe25519_tobytes(curve25519_pk, x);
@@ -76,11 +72,7 @@
{
unsigned char h[crypto_hash_sha512_BYTES];
-#ifdef ED25519_NONDETERMINISTIC
- memcpy(h, ed25519_sk, 32);
-#else
crypto_hash_sha512(h, ed25519_sk, 32);
-#endif
h[0] &= 248;
h[31] &= 127;
h[31] |= 64;
diff -Nru libsodium-1.0.16/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c
--- libsodium-1.0.16/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c 2017-12-13 09:24:13.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.16/src/libsodium/crypto_sign/ed25519/ref10/open.c libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/ref10/open.c
--- libsodium-1.0.16/src/libsodium/crypto_sign/ed25519/ref10/open.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/ref10/open.c 2019-05-30 20:13:18.000000000 +0000
@@ -23,21 +23,21 @@
ge25519_p3 A;
ge25519_p2 R;
-#ifndef ED25519_COMPAT
- if (sc25519_is_canonical(sig + 32) == 0 ||
- ge25519_has_small_order(sig) != 0) {
+#ifdef ED25519_COMPAT
+ if (sig[63] & 224) {
return -1;
}
- if (ge25519_is_canonical(pk) == 0) {
+#else
+ if (sc25519_is_canonical(sig + 32) == 0 ||
+ ge25519_has_small_order(sig) != 0) {
return -1;
}
-#else
- if (sig[63] & 224) {
+ if (ge25519_is_canonical(pk) == 0 ||
+ ge25519_has_small_order(pk) != 0) {
return -1;
}
#endif
- if (ge25519_has_small_order(pk) != 0 ||
- ge25519_frombytes_negate_vartime(&A, pk) != 0) {
+ if (ge25519_frombytes_negate_vartime(&A, pk) != 0) {
return -1;
}
_crypto_sign_ed25519_ref10_hinit(&hs, prehashed);
@@ -75,14 +75,17 @@
}
mlen = smlen - 64;
if (crypto_sign_ed25519_verify_detached(sm, sm + 64, mlen, pk) != 0) {
- memset(m, 0, mlen);
+ if (m != NULL) {
+ memset(m, 0, mlen);
+ }
goto badsig;
}
if (mlen_p != NULL) {
*mlen_p = mlen;
}
- memmove(m, sm + 64, mlen);
-
+ if (m != NULL) {
+ memmove(m, sm + 64, mlen);
+ }
return 0;
badsig:
diff -Nru libsodium-1.0.16/src/libsodium/crypto_sign/ed25519/ref10/sign.c libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/ref10/sign.c
--- libsodium-1.0.16/src/libsodium/crypto_sign/ed25519/ref10/sign.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/ref10/sign.c 2019-05-30 20:13:18.000000000 +0000
@@ -74,11 +74,10 @@
_crypto_sign_ed25519_ref10_hinit(&hs, prehashed);
+ crypto_hash_sha512(az, sk, 32);
#ifdef ED25519_NONDETERMINISTIC
- memcpy(az, sk, 32);
- _crypto_sign_ed25519_synthetic_r_hv(&hs, nonce, az);
+ _crypto_sign_ed25519_synthetic_r_hv(&hs, nonce /* Z */, az);
#else
- crypto_hash_sha512(az, sk, 32);
crypto_hash_sha512_update(&hs, az + 32, 32);
#endif
diff -Nru libsodium-1.0.16/src/libsodium/crypto_sign/ed25519/sign_ed25519.c libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/sign_ed25519.c
--- libsodium-1.0.16/src/libsodium/crypto_sign/ed25519/sign_ed25519.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_sign/ed25519/sign_ed25519.c 2019-05-30 20:13:18.000000000 +0000
@@ -86,7 +86,7 @@
int
crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state *state,
- unsigned char *sig,
+ const unsigned char *sig,
const unsigned char *pk)
{
unsigned char ph[crypto_hash_sha512_BYTES];
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c
--- libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c 2019-05-30 20:13:18.000000000 +0000
@@ -77,9 +77,6 @@
if (!bytes) {
return; /* LCOV_EXCL_LINE */
}
- if (bytes > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
- sodium_misuse();
- }
# include "u8.h"
# include "u4.h"
# include "u1.h"
@@ -106,8 +103,8 @@
}
static int
-stream_ietf_ref(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k)
+stream_ietf_ext_ref(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k)
{
struct chacha_ctx ctx;
@@ -150,9 +147,9 @@
}
static int
-stream_ietf_ref_xor_ic(unsigned char *c, const unsigned char *m,
- unsigned long long mlen, const unsigned char *n,
- uint32_t ic, const unsigned char *k)
+stream_ietf_ext_ref_xor_ic(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ uint32_t ic, const unsigned char *k)
{
struct chacha_ctx ctx;
uint8_t ic_bytes[4];
@@ -172,9 +169,9 @@
struct crypto_stream_chacha20_implementation
crypto_stream_chacha20_dolbeau_avx2_implementation = {
SODIUM_C99(.stream =) stream_ref,
- SODIUM_C99(.stream_ietf =) stream_ietf_ref,
+ SODIUM_C99(.stream_ietf_ext =) stream_ietf_ext_ref,
SODIUM_C99(.stream_xor_ic =) stream_ref_xor_ic,
- SODIUM_C99(.stream_ietf_xor_ic =) stream_ietf_ref_xor_ic
+ SODIUM_C99(.stream_ietf_ext_xor_ic =) stream_ietf_ext_ref_xor_ic
};
#endif
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c
--- libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c 2019-05-30 20:13:18.000000000 +0000
@@ -72,9 +72,6 @@
if (!bytes) {
return; /* LCOV_EXCL_LINE */
}
- if (bytes > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
- sodium_misuse();
- }
# include "u4.h"
# include "u1.h"
# include "u0.h"
@@ -100,8 +97,8 @@
}
static int
-stream_ietf_ref(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k)
+stream_ietf_ext_ref(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k)
{
struct chacha_ctx ctx;
@@ -144,9 +141,9 @@
}
static int
-stream_ietf_ref_xor_ic(unsigned char *c, const unsigned char *m,
- unsigned long long mlen, const unsigned char *n,
- uint32_t ic, const unsigned char *k)
+stream_ietf_ext_ref_xor_ic(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ uint32_t ic, const unsigned char *k)
{
struct chacha_ctx ctx;
uint8_t ic_bytes[4];
@@ -166,9 +163,9 @@
struct crypto_stream_chacha20_implementation
crypto_stream_chacha20_dolbeau_ssse3_implementation = {
SODIUM_C99(.stream =) stream_ref,
- SODIUM_C99(.stream_ietf =) stream_ietf_ref,
+ SODIUM_C99(.stream_ietf_ext =) stream_ietf_ext_ref,
SODIUM_C99(.stream_xor_ic =) stream_ref_xor_ic,
- SODIUM_C99(.stream_ietf_xor_ic =) stream_ietf_ref_xor_ic
+ SODIUM_C99(.stream_ietf_ext_xor_ic =) stream_ietf_ext_ref_xor_ic
};
#endif
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/u0.h libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/u0.h
--- libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/u0.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/u0.h 2019-05-30 20:13:18.000000000 +0000
@@ -9,10 +9,10 @@
unsigned int i;
- x_0 = _mm_loadu_si128((__m128i*) (x + 0));
- x_1 = _mm_loadu_si128((__m128i*) (x + 4));
- x_2 = _mm_loadu_si128((__m128i*) (x + 8));
- x_3 = _mm_loadu_si128((__m128i*) (x + 12));
+ x_0 = _mm_loadu_si128((const __m128i*) (x + 0));
+ x_1 = _mm_loadu_si128((const __m128i*) (x + 4));
+ x_2 = _mm_loadu_si128((const __m128i*) (x + 8));
+ x_3 = _mm_loadu_si128((const __m128i*) (x + 12));
for (i = 0; i < ROUNDS; i += 2) {
x_0 = _mm_add_epi32(x_0, x_1);
@@ -69,10 +69,10 @@
t_1 = _mm_srli_epi32(t_1, 25);
x_1 = _mm_xor_si128(x_1, t_1);
}
- x_0 = _mm_add_epi32(x_0, _mm_loadu_si128((__m128i*) (x + 0)));
- x_1 = _mm_add_epi32(x_1, _mm_loadu_si128((__m128i*) (x + 4)));
- x_2 = _mm_add_epi32(x_2, _mm_loadu_si128((__m128i*) (x + 8)));
- x_3 = _mm_add_epi32(x_3, _mm_loadu_si128((__m128i*) (x + 12)));
+ x_0 = _mm_add_epi32(x_0, _mm_loadu_si128((const __m128i*) (x + 0)));
+ x_1 = _mm_add_epi32(x_1, _mm_loadu_si128((const __m128i*) (x + 4)));
+ x_2 = _mm_add_epi32(x_2, _mm_loadu_si128((const __m128i*) (x + 8)));
+ x_3 = _mm_add_epi32(x_3, _mm_loadu_si128((const __m128i*) (x + 12)));
_mm_storeu_si128((__m128i*) (partialblock + 0), x_0);
_mm_storeu_si128((__m128i*) (partialblock + 16), x_1);
_mm_storeu_si128((__m128i*) (partialblock + 32), x_2);
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/u1.h libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/u1.h
--- libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/u1.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/u1.h 2019-05-30 20:13:18.000000000 +0000
@@ -10,10 +10,10 @@
uint32_t in13;
int i;
- x_0 = _mm_loadu_si128((__m128i*) (x + 0));
- x_1 = _mm_loadu_si128((__m128i*) (x + 4));
- x_2 = _mm_loadu_si128((__m128i*) (x + 8));
- x_3 = _mm_loadu_si128((__m128i*) (x + 12));
+ x_0 = _mm_loadu_si128((const __m128i*) (x + 0));
+ x_1 = _mm_loadu_si128((const __m128i*) (x + 4));
+ x_2 = _mm_loadu_si128((const __m128i*) (x + 8));
+ x_3 = _mm_loadu_si128((const __m128i*) (x + 12));
for (i = 0; i < ROUNDS; i += 2) {
x_0 = _mm_add_epi32(x_0, x_1);
@@ -70,14 +70,14 @@
t_1 = _mm_srli_epi32(t_1, 25);
x_1 = _mm_xor_si128(x_1, t_1);
}
- x_0 = _mm_add_epi32(x_0, _mm_loadu_si128((__m128i*) (x + 0)));
- x_1 = _mm_add_epi32(x_1, _mm_loadu_si128((__m128i*) (x + 4)));
- x_2 = _mm_add_epi32(x_2, _mm_loadu_si128((__m128i*) (x + 8)));
- x_3 = _mm_add_epi32(x_3, _mm_loadu_si128((__m128i*) (x + 12)));
- x_0 = _mm_xor_si128(x_0, _mm_loadu_si128((__m128i*) (m + 0)));
- x_1 = _mm_xor_si128(x_1, _mm_loadu_si128((__m128i*) (m + 16)));
- x_2 = _mm_xor_si128(x_2, _mm_loadu_si128((__m128i*) (m + 32)));
- x_3 = _mm_xor_si128(x_3, _mm_loadu_si128((__m128i*) (m + 48)));
+ x_0 = _mm_add_epi32(x_0, _mm_loadu_si128((const __m128i*) (x + 0)));
+ x_1 = _mm_add_epi32(x_1, _mm_loadu_si128((const __m128i*) (x + 4)));
+ x_2 = _mm_add_epi32(x_2, _mm_loadu_si128((const __m128i*) (x + 8)));
+ x_3 = _mm_add_epi32(x_3, _mm_loadu_si128((const __m128i*) (x + 12)));
+ x_0 = _mm_xor_si128(x_0, _mm_loadu_si128((const __m128i*) (m + 0)));
+ x_1 = _mm_xor_si128(x_1, _mm_loadu_si128((const __m128i*) (m + 16)));
+ x_2 = _mm_xor_si128(x_2, _mm_loadu_si128((const __m128i*) (m + 32)));
+ x_3 = _mm_xor_si128(x_3, _mm_loadu_si128((const __m128i*) (m + 48)));
_mm_storeu_si128((__m128i*) (c + 0), x_0);
_mm_storeu_si128((__m128i*) (c + 16), x_1);
_mm_storeu_si128((__m128i*) (c + 32), x_2);
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/u4.h libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/u4.h
--- libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/u4.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/u4.h 2019-05-30 20:13:18.000000000 +0000
@@ -120,31 +120,33 @@
VEC4_QUARTERROUND(3, 4, 9, 14);
}
-#define ONEQUAD_TRANSPOSE(A, B, C, D) \
- { \
- __m128i t0, t1, t2, t3; \
- \
- x_##A = _mm_add_epi32(x_##A, orig##A); \
- x_##B = _mm_add_epi32(x_##B, orig##B); \
- x_##C = _mm_add_epi32(x_##C, orig##C); \
- x_##D = _mm_add_epi32(x_##D, orig##D); \
- t_##A = _mm_unpacklo_epi32(x_##A, x_##B); \
- t_##B = _mm_unpacklo_epi32(x_##C, x_##D); \
- t_##C = _mm_unpackhi_epi32(x_##A, x_##B); \
- t_##D = _mm_unpackhi_epi32(x_##C, x_##D); \
- x_##A = _mm_unpacklo_epi64(t_##A, t_##B); \
- x_##B = _mm_unpackhi_epi64(t_##A, t_##B); \
- x_##C = _mm_unpacklo_epi64(t_##C, t_##D); \
- x_##D = _mm_unpackhi_epi64(t_##C, t_##D); \
- \
- t0 = _mm_xor_si128(x_##A, _mm_loadu_si128((__m128i*) (m + 0))); \
- _mm_storeu_si128((__m128i*) (c + 0), t0); \
- t1 = _mm_xor_si128(x_##B, _mm_loadu_si128((__m128i*) (m + 64))); \
- _mm_storeu_si128((__m128i*) (c + 64), t1); \
- t2 = _mm_xor_si128(x_##C, _mm_loadu_si128((__m128i*) (m + 128))); \
- _mm_storeu_si128((__m128i*) (c + 128), t2); \
- t3 = _mm_xor_si128(x_##D, _mm_loadu_si128((__m128i*) (m + 192))); \
- _mm_storeu_si128((__m128i*) (c + 192), t3); \
+#define ONEQUAD_TRANSPOSE(A, B, C, D) \
+ { \
+ __m128i t0, t1, t2, t3; \
+ \
+ x_##A = _mm_add_epi32(x_##A, orig##A); \
+ x_##B = _mm_add_epi32(x_##B, orig##B); \
+ x_##C = _mm_add_epi32(x_##C, orig##C); \
+ x_##D = _mm_add_epi32(x_##D, orig##D); \
+ t_##A = _mm_unpacklo_epi32(x_##A, x_##B); \
+ t_##B = _mm_unpacklo_epi32(x_##C, x_##D); \
+ t_##C = _mm_unpackhi_epi32(x_##A, x_##B); \
+ t_##D = _mm_unpackhi_epi32(x_##C, x_##D); \
+ x_##A = _mm_unpacklo_epi64(t_##A, t_##B); \
+ x_##B = _mm_unpackhi_epi64(t_##A, t_##B); \
+ x_##C = _mm_unpacklo_epi64(t_##C, t_##D); \
+ x_##D = _mm_unpackhi_epi64(t_##C, t_##D); \
+ \
+ t0 = _mm_xor_si128(x_##A, _mm_loadu_si128((const __m128i*) (m + 0))); \
+ _mm_storeu_si128((__m128i*) (c + 0), t0); \
+ t1 = _mm_xor_si128(x_##B, _mm_loadu_si128((const __m128i*) (m + 64))); \
+ _mm_storeu_si128((__m128i*) (c + 64), t1); \
+ t2 = \
+ _mm_xor_si128(x_##C, _mm_loadu_si128((const __m128i*) (m + 128))); \
+ _mm_storeu_si128((__m128i*) (c + 128), t2); \
+ t3 = \
+ _mm_xor_si128(x_##D, _mm_loadu_si128((const __m128i*) (m + 192))); \
+ _mm_storeu_si128((__m128i*) (c + 192), t3); \
}
#define ONEQUAD(A, B, C, D) ONEQUAD_TRANSPOSE(A, B, C, D)
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/u8.h libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/u8.h
--- libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/dolbeau/u8.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/dolbeau/u8.h 2019-05-30 20:13:18.000000000 +0000
@@ -200,7 +200,7 @@
in12 = x[12];
in13 = x[13];
in1213 = ((uint64_t) in12) | (((uint64_t) in13) << 32);
- x_12 = x_13 = _mm256_broadcastq_epi64(_mm_cvtsi64_si128(in1213));
+ x_12 = x_13 = _mm256_broadcastq_epi64(_mm_cvtsi64_si128(in1213));
t12 = _mm256_add_epi64(addv12, x_12);
t13 = _mm256_add_epi64(addv13, x_13);
@@ -228,45 +228,45 @@
VEC8_ROUND(0, 5, 10, 15, 1, 6, 11, 12, 2, 7, 8, 13, 3, 4, 9, 14);
}
-#define ONEQUAD_TRANSPOSE(A, B, C, D) \
- { \
- __m128i t0, t1, t2, t3; \
- x_##A = _mm256_add_epi32(x_##A, orig##A); \
- x_##B = _mm256_add_epi32(x_##B, orig##B); \
- x_##C = _mm256_add_epi32(x_##C, orig##C); \
- x_##D = _mm256_add_epi32(x_##D, orig##D); \
- t_##A = _mm256_unpacklo_epi32(x_##A, x_##B); \
- t_##B = _mm256_unpacklo_epi32(x_##C, x_##D); \
- t_##C = _mm256_unpackhi_epi32(x_##A, x_##B); \
- t_##D = _mm256_unpackhi_epi32(x_##C, x_##D); \
- x_##A = _mm256_unpacklo_epi64(t_##A, t_##B); \
- x_##B = _mm256_unpackhi_epi64(t_##A, t_##B); \
- x_##C = _mm256_unpacklo_epi64(t_##C, t_##D); \
- x_##D = _mm256_unpackhi_epi64(t_##C, t_##D); \
- t0 = _mm_xor_si128(_mm256_extracti128_si256(x_##A, 0), \
- _mm_loadu_si128((__m128i*) (m + 0))); \
- _mm_storeu_si128((__m128i*) (c + 0), t0); \
- t1 = _mm_xor_si128(_mm256_extracti128_si256(x_##B, 0), \
- _mm_loadu_si128((__m128i*) (m + 64))); \
- _mm_storeu_si128((__m128i*) (c + 64), t1); \
- t2 = _mm_xor_si128(_mm256_extracti128_si256(x_##C, 0), \
- _mm_loadu_si128((__m128i*) (m + 128))); \
- _mm_storeu_si128((__m128i*) (c + 128), t2); \
- t3 = _mm_xor_si128(_mm256_extracti128_si256(x_##D, 0), \
- _mm_loadu_si128((__m128i*) (m + 192))); \
- _mm_storeu_si128((__m128i*) (c + 192), t3); \
- t0 = _mm_xor_si128(_mm256_extracti128_si256(x_##A, 1), \
- _mm_loadu_si128((__m128i*) (m + 256))); \
- _mm_storeu_si128((__m128i*) (c + 256), t0); \
- t1 = _mm_xor_si128(_mm256_extracti128_si256(x_##B, 1), \
- _mm_loadu_si128((__m128i*) (m + 320))); \
- _mm_storeu_si128((__m128i*) (c + 320), t1); \
- t2 = _mm_xor_si128(_mm256_extracti128_si256(x_##C, 1), \
- _mm_loadu_si128((__m128i*) (m + 384))); \
- _mm_storeu_si128((__m128i*) (c + 384), t2); \
- t3 = _mm_xor_si128(_mm256_extracti128_si256(x_##D, 1), \
- _mm_loadu_si128((__m128i*) (m + 448))); \
- _mm_storeu_si128((__m128i*) (c + 448), t3); \
+#define ONEQUAD_TRANSPOSE(A, B, C, D) \
+ { \
+ __m128i t0, t1, t2, t3; \
+ x_##A = _mm256_add_epi32(x_##A, orig##A); \
+ x_##B = _mm256_add_epi32(x_##B, orig##B); \
+ x_##C = _mm256_add_epi32(x_##C, orig##C); \
+ x_##D = _mm256_add_epi32(x_##D, orig##D); \
+ t_##A = _mm256_unpacklo_epi32(x_##A, x_##B); \
+ t_##B = _mm256_unpacklo_epi32(x_##C, x_##D); \
+ t_##C = _mm256_unpackhi_epi32(x_##A, x_##B); \
+ t_##D = _mm256_unpackhi_epi32(x_##C, x_##D); \
+ x_##A = _mm256_unpacklo_epi64(t_##A, t_##B); \
+ x_##B = _mm256_unpackhi_epi64(t_##A, t_##B); \
+ x_##C = _mm256_unpacklo_epi64(t_##C, t_##D); \
+ x_##D = _mm256_unpackhi_epi64(t_##C, t_##D); \
+ t0 = _mm_xor_si128(_mm256_extracti128_si256(x_##A, 0), \
+ _mm_loadu_si128((const __m128i*) (m + 0))); \
+ _mm_storeu_si128((__m128i*) (c + 0), t0); \
+ t1 = _mm_xor_si128(_mm256_extracti128_si256(x_##B, 0), \
+ _mm_loadu_si128((const __m128i*) (m + 64))); \
+ _mm_storeu_si128((__m128i*) (c + 64), t1); \
+ t2 = _mm_xor_si128(_mm256_extracti128_si256(x_##C, 0), \
+ _mm_loadu_si128((const __m128i*) (m + 128))); \
+ _mm_storeu_si128((__m128i*) (c + 128), t2); \
+ t3 = _mm_xor_si128(_mm256_extracti128_si256(x_##D, 0), \
+ _mm_loadu_si128((const __m128i*) (m + 192))); \
+ _mm_storeu_si128((__m128i*) (c + 192), t3); \
+ t0 = _mm_xor_si128(_mm256_extracti128_si256(x_##A, 1), \
+ _mm_loadu_si128((const __m128i*) (m + 256))); \
+ _mm_storeu_si128((__m128i*) (c + 256), t0); \
+ t1 = _mm_xor_si128(_mm256_extracti128_si256(x_##B, 1), \
+ _mm_loadu_si128((const __m128i*) (m + 320))); \
+ _mm_storeu_si128((__m128i*) (c + 320), t1); \
+ t2 = _mm_xor_si128(_mm256_extracti128_si256(x_##C, 1), \
+ _mm_loadu_si128((const __m128i*) (m + 384))); \
+ _mm_storeu_si128((__m128i*) (c + 384), t2); \
+ t3 = _mm_xor_si128(_mm256_extracti128_si256(x_##D, 1), \
+ _mm_loadu_si128((const __m128i*) (m + 448))); \
+ _mm_storeu_si128((__m128i*) (c + 448), t3); \
}
#define ONEQUAD(A, B, C, D) ONEQUAD_TRANSPOSE(A, B, C, D)
@@ -287,42 +287,42 @@
x_##D = _mm256_unpackhi_epi64(t_##C, t_##D); \
}
-#define ONEOCTO(A, B, C, D, A2, B2, C2, D2) \
- { \
- ONEQUAD_UNPCK(A, B, C, D); \
- ONEQUAD_UNPCK(A2, B2, C2, D2); \
- t_##A = _mm256_permute2x128_si256(x_##A, x_##A2, 0x20); \
- t_##A2 = _mm256_permute2x128_si256(x_##A, x_##A2, 0x31); \
- t_##B = _mm256_permute2x128_si256(x_##B, x_##B2, 0x20); \
- t_##B2 = _mm256_permute2x128_si256(x_##B, x_##B2, 0x31); \
- t_##C = _mm256_permute2x128_si256(x_##C, x_##C2, 0x20); \
- t_##C2 = _mm256_permute2x128_si256(x_##C, x_##C2, 0x31); \
- t_##D = _mm256_permute2x128_si256(x_##D, x_##D2, 0x20); \
- t_##D2 = _mm256_permute2x128_si256(x_##D, x_##D2, 0x31); \
- t_##A = \
- _mm256_xor_si256(t_##A, _mm256_loadu_si256((__m256i*) (m + 0))); \
- t_##B = \
- _mm256_xor_si256(t_##B, _mm256_loadu_si256((__m256i*) (m + 64))); \
- t_##C = \
- _mm256_xor_si256(t_##C, _mm256_loadu_si256((__m256i*) (m + 128))); \
- t_##D = \
- _mm256_xor_si256(t_##D, _mm256_loadu_si256((__m256i*) (m + 192))); \
- t_##A2 = _mm256_xor_si256(t_##A2, \
- _mm256_loadu_si256((__m256i*) (m + 256))); \
- t_##B2 = _mm256_xor_si256(t_##B2, \
- _mm256_loadu_si256((__m256i*) (m + 320))); \
- t_##C2 = _mm256_xor_si256(t_##C2, \
- _mm256_loadu_si256((__m256i*) (m + 384))); \
- t_##D2 = _mm256_xor_si256(t_##D2, \
- _mm256_loadu_si256((__m256i*) (m + 448))); \
- _mm256_storeu_si256((__m256i*) (c + 0), t_##A); \
- _mm256_storeu_si256((__m256i*) (c + 64), t_##B); \
- _mm256_storeu_si256((__m256i*) (c + 128), t_##C); \
- _mm256_storeu_si256((__m256i*) (c + 192), t_##D); \
- _mm256_storeu_si256((__m256i*) (c + 256), t_##A2); \
- _mm256_storeu_si256((__m256i*) (c + 320), t_##B2); \
- _mm256_storeu_si256((__m256i*) (c + 384), t_##C2); \
- _mm256_storeu_si256((__m256i*) (c + 448), t_##D2); \
+#define ONEOCTO(A, B, C, D, A2, B2, C2, D2) \
+ { \
+ ONEQUAD_UNPCK(A, B, C, D); \
+ ONEQUAD_UNPCK(A2, B2, C2, D2); \
+ t_##A = _mm256_permute2x128_si256(x_##A, x_##A2, 0x20); \
+ t_##A2 = _mm256_permute2x128_si256(x_##A, x_##A2, 0x31); \
+ t_##B = _mm256_permute2x128_si256(x_##B, x_##B2, 0x20); \
+ t_##B2 = _mm256_permute2x128_si256(x_##B, x_##B2, 0x31); \
+ t_##C = _mm256_permute2x128_si256(x_##C, x_##C2, 0x20); \
+ t_##C2 = _mm256_permute2x128_si256(x_##C, x_##C2, 0x31); \
+ t_##D = _mm256_permute2x128_si256(x_##D, x_##D2, 0x20); \
+ t_##D2 = _mm256_permute2x128_si256(x_##D, x_##D2, 0x31); \
+ t_##A = _mm256_xor_si256( \
+ t_##A, _mm256_loadu_si256((const __m256i*) (m + 0))); \
+ t_##B = _mm256_xor_si256( \
+ t_##B, _mm256_loadu_si256((const __m256i*) (m + 64))); \
+ t_##C = _mm256_xor_si256( \
+ t_##C, _mm256_loadu_si256((const __m256i*) (m + 128))); \
+ t_##D = _mm256_xor_si256( \
+ t_##D, _mm256_loadu_si256((const __m256i*) (m + 192))); \
+ t_##A2 = _mm256_xor_si256( \
+ t_##A2, _mm256_loadu_si256((const __m256i*) (m + 256))); \
+ t_##B2 = _mm256_xor_si256( \
+ t_##B2, _mm256_loadu_si256((const __m256i*) (m + 320))); \
+ t_##C2 = _mm256_xor_si256( \
+ t_##C2, _mm256_loadu_si256((const __m256i*) (m + 384))); \
+ t_##D2 = _mm256_xor_si256( \
+ t_##D2, _mm256_loadu_si256((const __m256i*) (m + 448))); \
+ _mm256_storeu_si256((__m256i*) (c + 0), t_##A); \
+ _mm256_storeu_si256((__m256i*) (c + 64), t_##B); \
+ _mm256_storeu_si256((__m256i*) (c + 128), t_##C); \
+ _mm256_storeu_si256((__m256i*) (c + 192), t_##D); \
+ _mm256_storeu_si256((__m256i*) (c + 256), t_##A2); \
+ _mm256_storeu_si256((__m256i*) (c + 320), t_##B2); \
+ _mm256_storeu_si256((__m256i*) (c + 384), t_##C2); \
+ _mm256_storeu_si256((__m256i*) (c + 448), t_##D2); \
}
ONEOCTO(0, 1, 2, 3, 4, 5, 6, 7);
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c
--- libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c 2019-05-30 20:13:18.000000000 +0000
@@ -92,9 +92,6 @@
if (!bytes) {
return; /* LCOV_EXCL_LINE */
}
- if (bytes > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
- sodium_misuse();
- }
j0 = ctx->input[0];
j1 = ctx->input[1];
j2 = ctx->input[2];
@@ -243,8 +240,8 @@
}
static int
-stream_ietf_ref(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k)
+stream_ietf_ext_ref(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k)
{
struct chacha_ctx ctx;
@@ -287,9 +284,9 @@
}
static int
-stream_ietf_ref_xor_ic(unsigned char *c, const unsigned char *m,
- unsigned long long mlen, const unsigned char *n,
- uint32_t ic, const unsigned char *k)
+stream_ietf_ext_ref_xor_ic(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ uint32_t ic, const unsigned char *k)
{
struct chacha_ctx ctx;
uint8_t ic_bytes[4];
@@ -309,7 +306,7 @@
struct crypto_stream_chacha20_implementation
crypto_stream_chacha20_ref_implementation = {
SODIUM_C99(.stream =) stream_ref,
- SODIUM_C99(.stream_ietf =) stream_ietf_ref,
+ SODIUM_C99(.stream_ietf_ext =) stream_ietf_ext_ref,
SODIUM_C99(.stream_xor_ic =) stream_ref_xor_ic,
- SODIUM_C99(.stream_ietf_xor_ic =) stream_ietf_ref_xor_ic
+ SODIUM_C99(.stream_ietf_ext_xor_ic =) stream_ietf_ext_ref_xor_ic
};
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/stream_chacha20.c libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/stream_chacha20.c
--- libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/stream_chacha20.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/stream_chacha20.c 2019-05-30 20:13:18.000000000 +0000
@@ -1,4 +1,6 @@
#include "crypto_stream_chacha20.h"
+#include "core.h"
+#include "private/chacha20_ietf_ext.h"
#include "private/common.h"
#include "private/implementations.h"
#include "randombytes.h"
@@ -53,48 +55,100 @@
crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
const unsigned char *n, const unsigned char *k)
{
+ if (clen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+ sodium_misuse();
+ }
return implementation->stream(c, clen, n, k);
}
int
-crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k)
-{
- return implementation->stream_ietf(c, clen, n, k);
-}
-
-int
crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m,
unsigned long long mlen,
const unsigned char *n, uint64_t ic,
const unsigned char *k)
{
+ if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+ sodium_misuse();
+ }
return implementation->stream_xor_ic(c, m, mlen, n, ic, k);
}
int
-crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m,
- unsigned long long mlen,
- const unsigned char *n, uint32_t ic,
- const unsigned char *k)
-{
- return implementation->stream_ietf_xor_ic(c, m, mlen, n, ic, k);
-}
-
-int
crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
const unsigned char *k)
{
+ if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+ sodium_misuse();
+ }
return implementation->stream_xor_ic(c, m, mlen, n, 0U, k);
}
int
+crypto_stream_chacha20_ietf_ext(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k)
+{
+ if (clen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+ sodium_misuse();
+ }
+ return implementation->stream_ietf_ext(c, clen, n, k);
+}
+
+int
+crypto_stream_chacha20_ietf_ext_xor_ic(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n, uint32_t ic,
+ const unsigned char *k)
+{
+ if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+ sodium_misuse();
+ }
+ return implementation->stream_ietf_ext_xor_ic(c, m, mlen, n, ic, k);
+}
+
+static int
+crypto_stream_chacha20_ietf_ext_xor(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k)
+{
+ if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+ sodium_misuse();
+ }
+ return implementation->stream_ietf_ext_xor_ic(c, m, mlen, n, 0U, k);
+}
+
+int
+crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k)
+{
+ if (clen > crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX) {
+ sodium_misuse();
+ }
+ return crypto_stream_chacha20_ietf_ext(c, clen, n, k);
+}
+
+int
+crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n, uint32_t ic,
+ const unsigned char *k)
+{
+ if ((unsigned long long) ic >
+ (64ULL * (1ULL << 32)) / 64ULL - (mlen + 63ULL) / 64ULL) {
+ sodium_misuse();
+ }
+ return crypto_stream_chacha20_ietf_ext_xor_ic(c, m, mlen, n, ic, k);
+}
+
+int
crypto_stream_chacha20_ietf_xor(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
const unsigned char *k)
{
- return implementation->stream_ietf_xor_ic(c, m, mlen, n, 0U, k);
+ if (mlen > crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX) {
+ sodium_misuse();
+ }
+ return crypto_stream_chacha20_ietf_ext_xor(c, m, mlen, n, k);
}
void
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/stream_chacha20.h libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/stream_chacha20.h
--- libsodium-1.0.16/src/libsodium/crypto_stream/chacha20/stream_chacha20.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/chacha20/stream_chacha20.h 2019-05-30 20:13:18.000000000 +0000
@@ -7,16 +7,16 @@
typedef struct crypto_stream_chacha20_implementation {
int (*stream)(unsigned char *c, unsigned long long clen,
const unsigned char *n, const unsigned char *k);
- int (*stream_ietf)(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k);
+ int (*stream_ietf_ext)(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k);
int (*stream_xor_ic)(unsigned char *c, const unsigned char *m,
unsigned long long mlen,
const unsigned char *n, uint64_t ic,
const unsigned char *k);
- int (*stream_ietf_xor_ic)(unsigned char *c, const unsigned char *m,
- unsigned long long mlen,
- const unsigned char *n, uint32_t ic,
- const unsigned char *k);
+ int (*stream_ietf_ext_xor_ic)(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n, uint32_t ic,
+ const unsigned char *k);
} crypto_stream_chacha20_implementation;
#endif
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/salsa20/xmm6int/u0.h libsodium-1.0.18/src/libsodium/crypto_stream/salsa20/xmm6int/u0.h
--- libsodium-1.0.16/src/libsodium/crypto_stream/salsa20/xmm6int/u0.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/salsa20/xmm6int/u0.h 2019-05-30 20:13:18.000000000 +0000
@@ -1,8 +1,8 @@
if (bytes > 0) {
- __m128i diag0 = _mm_loadu_si128((__m128i *) (x + 0));
- __m128i diag1 = _mm_loadu_si128((__m128i *) (x + 4));
- __m128i diag2 = _mm_loadu_si128((__m128i *) (x + 8));
- __m128i diag3 = _mm_loadu_si128((__m128i *) (x + 12));
+ __m128i diag0 = _mm_loadu_si128((const __m128i *) (x + 0));
+ __m128i diag1 = _mm_loadu_si128((const __m128i *) (x + 4));
+ __m128i diag2 = _mm_loadu_si128((const __m128i *) (x + 8));
+ __m128i diag3 = _mm_loadu_si128((const __m128i *) (x + 12));
__m128i a0, a1, a2, a3, a4, a5, a6, a7;
__m128i b0, b1, b2, b3, b4, b5, b6, b7;
uint8_t partialblock[64];
@@ -156,25 +156,25 @@
diag0 = _mm_xor_si128(diag0, b7);
}
- diag0 = _mm_add_epi32(diag0, _mm_loadu_si128((__m128i *) (x + 0)));
- diag1 = _mm_add_epi32(diag1, _mm_loadu_si128((__m128i *) (x + 4)));
- diag2 = _mm_add_epi32(diag2, _mm_loadu_si128((__m128i *) (x + 8)));
- diag3 = _mm_add_epi32(diag3, _mm_loadu_si128((__m128i *) (x + 12)));
-
-#define ONEQUAD_SHUFFLE(A, B, C, D) \
- do { \
- uint32_t in##A = _mm_cvtsi128_si32(diag0); \
- uint32_t in##B = _mm_cvtsi128_si32(diag1); \
- uint32_t in##C = _mm_cvtsi128_si32(diag2); \
- uint32_t in##D = _mm_cvtsi128_si32(diag3); \
- diag0 = _mm_shuffle_epi32(diag0, 0x39); \
- diag1 = _mm_shuffle_epi32(diag1, 0x39); \
- diag2 = _mm_shuffle_epi32(diag2, 0x39); \
- diag3 = _mm_shuffle_epi32(diag3, 0x39); \
- *(uint32_t *) (partialblock + (A * 4)) = in##A; \
- *(uint32_t *) (partialblock + (B * 4)) = in##B; \
- *(uint32_t *) (partialblock + (C * 4)) = in##C; \
- *(uint32_t *) (partialblock + (D * 4)) = in##D; \
+ diag0 = _mm_add_epi32(diag0, _mm_loadu_si128((const __m128i *) (x + 0)));
+ diag1 = _mm_add_epi32(diag1, _mm_loadu_si128((const __m128i *) (x + 4)));
+ diag2 = _mm_add_epi32(diag2, _mm_loadu_si128((const __m128i *) (x + 8)));
+ diag3 = _mm_add_epi32(diag3, _mm_loadu_si128((const __m128i *) (x + 12)));
+
+#define ONEQUAD_SHUFFLE(A, B, C, D) \
+ do { \
+ uint32_t in##A = _mm_cvtsi128_si32(diag0); \
+ uint32_t in##B = _mm_cvtsi128_si32(diag1); \
+ uint32_t in##C = _mm_cvtsi128_si32(diag2); \
+ uint32_t in##D = _mm_cvtsi128_si32(diag3); \
+ diag0 = _mm_shuffle_epi32(diag0, 0x39); \
+ diag1 = _mm_shuffle_epi32(diag1, 0x39); \
+ diag2 = _mm_shuffle_epi32(diag2, 0x39); \
+ diag3 = _mm_shuffle_epi32(diag3, 0x39); \
+ *(uint32_t *) (partialblock + (A * 4)) = in##A; \
+ *(uint32_t *) (partialblock + (B * 4)) = in##B; \
+ *(uint32_t *) (partialblock + (C * 4)) = in##C; \
+ *(uint32_t *) (partialblock + (D * 4)) = in##D; \
} while (0)
#define ONEQUAD(A, B, C, D) ONEQUAD_SHUFFLE(A, B, C, D)
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/salsa20/xmm6int/u1.h libsodium-1.0.18/src/libsodium/crypto_stream/salsa20/xmm6int/u1.h
--- libsodium-1.0.16/src/libsodium/crypto_stream/salsa20/xmm6int/u1.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/salsa20/xmm6int/u1.h 2019-05-30 20:13:18.000000000 +0000
@@ -1,8 +1,8 @@
while (bytes >= 64) {
- __m128i diag0 = _mm_loadu_si128((__m128i *) (x + 0));
- __m128i diag1 = _mm_loadu_si128((__m128i *) (x + 4));
- __m128i diag2 = _mm_loadu_si128((__m128i *) (x + 8));
- __m128i diag3 = _mm_loadu_si128((__m128i *) (x + 12));
+ __m128i diag0 = _mm_loadu_si128((const __m128i *) (x + 0));
+ __m128i diag1 = _mm_loadu_si128((const __m128i *) (x + 4));
+ __m128i diag2 = _mm_loadu_si128((const __m128i *) (x + 8));
+ __m128i diag3 = _mm_loadu_si128((const __m128i *) (x + 12));
__m128i a0, a1, a2, a3, a4, a5, a6, a7;
__m128i b0, b1, b2, b3, b4, b5, b6, b7;
@@ -157,10 +157,10 @@
diag0 = _mm_xor_si128(diag0, b7);
}
- diag0 = _mm_add_epi32(diag0, _mm_loadu_si128((__m128i *) (x + 0)));
- diag1 = _mm_add_epi32(diag1, _mm_loadu_si128((__m128i *) (x + 4)));
- diag2 = _mm_add_epi32(diag2, _mm_loadu_si128((__m128i *) (x + 8)));
- diag3 = _mm_add_epi32(diag3, _mm_loadu_si128((__m128i *) (x + 12)));
+ diag0 = _mm_add_epi32(diag0, _mm_loadu_si128((const __m128i *) (x + 0)));
+ diag1 = _mm_add_epi32(diag1, _mm_loadu_si128((const __m128i *) (x + 4)));
+ diag2 = _mm_add_epi32(diag2, _mm_loadu_si128((const __m128i *) (x + 8)));
+ diag3 = _mm_add_epi32(diag3, _mm_loadu_si128((const __m128i *) (x + 12)));
#define ONEQUAD_SHUFFLE(A, B, C, D) \
do { \
@@ -172,10 +172,10 @@
diag1 = _mm_shuffle_epi32(diag1, 0x39); \
diag2 = _mm_shuffle_epi32(diag2, 0x39); \
diag3 = _mm_shuffle_epi32(diag3, 0x39); \
- in##A ^= *(uint32_t *) (m + (A * 4)); \
- in##B ^= *(uint32_t *) (m + (B * 4)); \
- in##C ^= *(uint32_t *) (m + (C * 4)); \
- in##D ^= *(uint32_t *) (m + (D * 4)); \
+ in##A ^= *(const uint32_t *) (m + (A * 4)); \
+ in##B ^= *(const uint32_t *) (m + (B * 4)); \
+ in##C ^= *(const uint32_t *) (m + (C * 4)); \
+ in##D ^= *(const uint32_t *) (m + (D * 4)); \
*(uint32_t *) (c + (A * 4)) = in##A; \
*(uint32_t *) (c + (B * 4)) = in##B; \
*(uint32_t *) (c + (C * 4)) = in##C; \
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/salsa20/xmm6int/u4.h libsodium-1.0.18/src/libsodium/crypto_stream/salsa20/xmm6int/u4.h
--- libsodium-1.0.16/src/libsodium/crypto_stream/salsa20/xmm6int/u4.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/salsa20/xmm6int/u4.h 2019-05-30 20:13:18.000000000 +0000
@@ -12,22 +12,22 @@
/* element broadcast immediate for _mm_shuffle_epi32 are in order:
0x00, 0x55, 0xaa, 0xff */
- z0 = _mm_loadu_si128((__m128i *) (x + 0));
+ z0 = _mm_loadu_si128((const __m128i *) (x + 0));
z5 = _mm_shuffle_epi32(z0, 0x55);
z10 = _mm_shuffle_epi32(z0, 0xaa);
z15 = _mm_shuffle_epi32(z0, 0xff);
z0 = _mm_shuffle_epi32(z0, 0x00);
- z1 = _mm_loadu_si128((__m128i *) (x + 4));
+ z1 = _mm_loadu_si128((const __m128i *) (x + 4));
z6 = _mm_shuffle_epi32(z1, 0xaa);
z11 = _mm_shuffle_epi32(z1, 0xff);
z12 = _mm_shuffle_epi32(z1, 0x00);
z1 = _mm_shuffle_epi32(z1, 0x55);
- z2 = _mm_loadu_si128((__m128i *) (x + 8));
+ z2 = _mm_loadu_si128((const __m128i *) (x + 8));
z7 = _mm_shuffle_epi32(z2, 0xff);
z13 = _mm_shuffle_epi32(z2, 0x55);
z2 = _mm_shuffle_epi32(z2, 0xaa);
/* no z8 -> first half of the nonce, will fill later */
- z3 = _mm_loadu_si128((__m128i *) (x + 12));
+ z3 = _mm_loadu_si128((const __m128i *) (x + 12));
z4 = _mm_shuffle_epi32(z3, 0x00);
z14 = _mm_shuffle_epi32(z3, 0xaa);
z3 = _mm_shuffle_epi32(z3, 0xff);
@@ -498,26 +498,26 @@
/* store data ; this macro first transpose data in-registers, and then store
* them in memory. much faster with icc. */
-#define ONEQUAD_TRANSPOSE(A, B, C, D) \
- z##A = _mm_add_epi32(z##A, orig##A); \
- z##B = _mm_add_epi32(z##B, orig##B); \
- z##C = _mm_add_epi32(z##C, orig##C); \
- z##D = _mm_add_epi32(z##D, orig##D); \
- y##A = _mm_unpacklo_epi32(z##A, z##B); \
- y##B = _mm_unpacklo_epi32(z##C, z##D); \
- y##C = _mm_unpackhi_epi32(z##A, z##B); \
- y##D = _mm_unpackhi_epi32(z##C, z##D); \
- z##A = _mm_unpacklo_epi64(y##A, y##B); \
- z##B = _mm_unpackhi_epi64(y##A, y##B); \
- z##C = _mm_unpacklo_epi64(y##C, y##D); \
- z##D = _mm_unpackhi_epi64(y##C, y##D); \
- y##A = _mm_xor_si128(z##A, _mm_loadu_si128((__m128i *) (m + 0))); \
- _mm_storeu_si128((__m128i *) (c + 0), y##A); \
- y##B = _mm_xor_si128(z##B, _mm_loadu_si128((__m128i *) (m + 64))); \
- _mm_storeu_si128((__m128i *) (c + 64), y##B); \
- y##C = _mm_xor_si128(z##C, _mm_loadu_si128((__m128i *) (m + 128))); \
- _mm_storeu_si128((__m128i *) (c + 128), y##C); \
- y##D = _mm_xor_si128(z##D, _mm_loadu_si128((__m128i *) (m + 192))); \
+#define ONEQUAD_TRANSPOSE(A, B, C, D) \
+ z##A = _mm_add_epi32(z##A, orig##A); \
+ z##B = _mm_add_epi32(z##B, orig##B); \
+ z##C = _mm_add_epi32(z##C, orig##C); \
+ z##D = _mm_add_epi32(z##D, orig##D); \
+ y##A = _mm_unpacklo_epi32(z##A, z##B); \
+ y##B = _mm_unpacklo_epi32(z##C, z##D); \
+ y##C = _mm_unpackhi_epi32(z##A, z##B); \
+ y##D = _mm_unpackhi_epi32(z##C, z##D); \
+ z##A = _mm_unpacklo_epi64(y##A, y##B); \
+ z##B = _mm_unpackhi_epi64(y##A, y##B); \
+ z##C = _mm_unpacklo_epi64(y##C, y##D); \
+ z##D = _mm_unpackhi_epi64(y##C, y##D); \
+ y##A = _mm_xor_si128(z##A, _mm_loadu_si128((const __m128i *) (m + 0))); \
+ _mm_storeu_si128((__m128i *) (c + 0), y##A); \
+ y##B = _mm_xor_si128(z##B, _mm_loadu_si128((const __m128i *) (m + 64))); \
+ _mm_storeu_si128((__m128i *) (c + 64), y##B); \
+ y##C = _mm_xor_si128(z##C, _mm_loadu_si128((const __m128i *) (m + 128))); \
+ _mm_storeu_si128((__m128i *) (c + 128), y##C); \
+ y##D = _mm_xor_si128(z##D, _mm_loadu_si128((const __m128i *) (m + 192))); \
_mm_storeu_si128((__m128i *) (c + 192), y##D)
#define ONEQUAD(A, B, C, D) ONEQUAD_TRANSPOSE(A, B, C, D)
diff -Nru libsodium-1.0.16/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h libsodium-1.0.18/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h
--- libsodium-1.0.16/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h 2019-05-30 20:13:18.000000000 +0000
@@ -361,45 +361,45 @@
/* store data ; this macro first transpose data in-registers, and then store
* them in memory. much faster with icc. */
-#define ONEQUAD_TRANSPOSE(A, B, C, D) \
- { \
- __m128i t0, t1, t2, t3; \
- z##A = _mm256_add_epi32(z##A, orig##A); \
- z##B = _mm256_add_epi32(z##B, orig##B); \
- z##C = _mm256_add_epi32(z##C, orig##C); \
- z##D = _mm256_add_epi32(z##D, orig##D); \
- y##A = _mm256_unpacklo_epi32(z##A, z##B); \
- y##B = _mm256_unpacklo_epi32(z##C, z##D); \
- y##C = _mm256_unpackhi_epi32(z##A, z##B); \
- y##D = _mm256_unpackhi_epi32(z##C, z##D); \
- z##A = _mm256_unpacklo_epi64(y##A, y##B); \
- z##B = _mm256_unpackhi_epi64(y##A, y##B); \
- z##C = _mm256_unpacklo_epi64(y##C, y##D); \
- z##D = _mm256_unpackhi_epi64(y##C, y##D); \
- t0 = _mm_xor_si128(_mm256_extracti128_si256(z##A, 0), \
- _mm_loadu_si128((__m128i*) (m + 0))); \
- _mm_storeu_si128((__m128i*) (c + 0), t0); \
- t1 = _mm_xor_si128(_mm256_extracti128_si256(z##B, 0), \
- _mm_loadu_si128((__m128i*) (m + 64))); \
- _mm_storeu_si128((__m128i*) (c + 64), t1); \
- t2 = _mm_xor_si128(_mm256_extracti128_si256(z##C, 0), \
- _mm_loadu_si128((__m128i*) (m + 128))); \
- _mm_storeu_si128((__m128i*) (c + 128), t2); \
- t3 = _mm_xor_si128(_mm256_extracti128_si256(z##D, 0), \
- _mm_loadu_si128((__m128i*) (m + 192))); \
- _mm_storeu_si128((__m128i*) (c + 192), t3); \
- t0 = _mm_xor_si128(_mm256_extracti128_si256(z##A, 1), \
- _mm_loadu_si128((__m128i*) (m + 256))); \
- _mm_storeu_si128((__m128i*) (c + 256), t0); \
- t1 = _mm_xor_si128(_mm256_extracti128_si256(z##B, 1), \
- _mm_loadu_si128((__m128i*) (m + 320))); \
- _mm_storeu_si128((__m128i*) (c + 320), t1); \
- t2 = _mm_xor_si128(_mm256_extracti128_si256(z##C, 1), \
- _mm_loadu_si128((__m128i*) (m + 384))); \
- _mm_storeu_si128((__m128i*) (c + 384), t2); \
- t3 = _mm_xor_si128(_mm256_extracti128_si256(z##D, 1), \
- _mm_loadu_si128((__m128i*) (m + 448))); \
- _mm_storeu_si128((__m128i*) (c + 448), t3); \
+#define ONEQUAD_TRANSPOSE(A, B, C, D) \
+ { \
+ __m128i t0, t1, t2, t3; \
+ z##A = _mm256_add_epi32(z##A, orig##A); \
+ z##B = _mm256_add_epi32(z##B, orig##B); \
+ z##C = _mm256_add_epi32(z##C, orig##C); \
+ z##D = _mm256_add_epi32(z##D, orig##D); \
+ y##A = _mm256_unpacklo_epi32(z##A, z##B); \
+ y##B = _mm256_unpacklo_epi32(z##C, z##D); \
+ y##C = _mm256_unpackhi_epi32(z##A, z##B); \
+ y##D = _mm256_unpackhi_epi32(z##C, z##D); \
+ z##A = _mm256_unpacklo_epi64(y##A, y##B); \
+ z##B = _mm256_unpackhi_epi64(y##A, y##B); \
+ z##C = _mm256_unpacklo_epi64(y##C, y##D); \
+ z##D = _mm256_unpackhi_epi64(y##C, y##D); \
+ t0 = _mm_xor_si128(_mm256_extracti128_si256(z##A, 0), \
+ _mm_loadu_si128((const __m128i*) (m + 0))); \
+ _mm_storeu_si128((__m128i*) (c + 0), t0); \
+ t1 = _mm_xor_si128(_mm256_extracti128_si256(z##B, 0), \
+ _mm_loadu_si128((const __m128i*) (m + 64))); \
+ _mm_storeu_si128((__m128i*) (c + 64), t1); \
+ t2 = _mm_xor_si128(_mm256_extracti128_si256(z##C, 0), \
+ _mm_loadu_si128((const __m128i*) (m + 128))); \
+ _mm_storeu_si128((__m128i*) (c + 128), t2); \
+ t3 = _mm_xor_si128(_mm256_extracti128_si256(z##D, 0), \
+ _mm_loadu_si128((const __m128i*) (m + 192))); \
+ _mm_storeu_si128((__m128i*) (c + 192), t3); \
+ t0 = _mm_xor_si128(_mm256_extracti128_si256(z##A, 1), \
+ _mm_loadu_si128((const __m128i*) (m + 256))); \
+ _mm_storeu_si128((__m128i*) (c + 256), t0); \
+ t1 = _mm_xor_si128(_mm256_extracti128_si256(z##B, 1), \
+ _mm_loadu_si128((const __m128i*) (m + 320))); \
+ _mm_storeu_si128((__m128i*) (c + 320), t1); \
+ t2 = _mm_xor_si128(_mm256_extracti128_si256(z##C, 1), \
+ _mm_loadu_si128((const __m128i*) (m + 384))); \
+ _mm_storeu_si128((__m128i*) (c + 384), t2); \
+ t3 = _mm_xor_si128(_mm256_extracti128_si256(z##D, 1), \
+ _mm_loadu_si128((const __m128i*) (m + 448))); \
+ _mm_storeu_si128((__m128i*) (c + 448), t3); \
}
#define ONEQUAD(A, B, C, D) ONEQUAD_TRANSPOSE(A, B, C, D)
@@ -420,41 +420,42 @@
z##D = _mm256_unpackhi_epi64(y##C, y##D); \
}
-#define ONEOCTO(A, B, C, D, A2, B2, C2, D2) \
- { \
- ONEQUAD_UNPCK(A, B, C, D); \
- ONEQUAD_UNPCK(A2, B2, C2, D2); \
- y##A = _mm256_permute2x128_si256(z##A, z##A2, 0x20); \
- y##A2 = _mm256_permute2x128_si256(z##A, z##A2, 0x31); \
- y##B = _mm256_permute2x128_si256(z##B, z##B2, 0x20); \
- y##B2 = _mm256_permute2x128_si256(z##B, z##B2, 0x31); \
- y##C = _mm256_permute2x128_si256(z##C, z##C2, 0x20); \
- y##C2 = _mm256_permute2x128_si256(z##C, z##C2, 0x31); \
- y##D = _mm256_permute2x128_si256(z##D, z##D2, 0x20); \
- y##D2 = _mm256_permute2x128_si256(z##D, z##D2, 0x31); \
- y##A = _mm256_xor_si256(y##A, _mm256_loadu_si256((__m256i*) (m + 0))); \
- y##B = \
- _mm256_xor_si256(y##B, _mm256_loadu_si256((__m256i*) (m + 64))); \
- y##C = \
- _mm256_xor_si256(y##C, _mm256_loadu_si256((__m256i*) (m + 128))); \
- y##D = \
- _mm256_xor_si256(y##D, _mm256_loadu_si256((__m256i*) (m + 192))); \
- y##A2 = \
- _mm256_xor_si256(y##A2, _mm256_loadu_si256((__m256i*) (m + 256))); \
- y##B2 = \
- _mm256_xor_si256(y##B2, _mm256_loadu_si256((__m256i*) (m + 320))); \
- y##C2 = \
- _mm256_xor_si256(y##C2, _mm256_loadu_si256((__m256i*) (m + 384))); \
- y##D2 = \
- _mm256_xor_si256(y##D2, _mm256_loadu_si256((__m256i*) (m + 448))); \
- _mm256_storeu_si256((__m256i*) (c + 0), y##A); \
- _mm256_storeu_si256((__m256i*) (c + 64), y##B); \
- _mm256_storeu_si256((__m256i*) (c + 128), y##C); \
- _mm256_storeu_si256((__m256i*) (c + 192), y##D); \
- _mm256_storeu_si256((__m256i*) (c + 256), y##A2); \
- _mm256_storeu_si256((__m256i*) (c + 320), y##B2); \
- _mm256_storeu_si256((__m256i*) (c + 384), y##C2); \
- _mm256_storeu_si256((__m256i*) (c + 448), y##D2); \
+#define ONEOCTO(A, B, C, D, A2, B2, C2, D2) \
+ { \
+ ONEQUAD_UNPCK(A, B, C, D); \
+ ONEQUAD_UNPCK(A2, B2, C2, D2); \
+ y##A = _mm256_permute2x128_si256(z##A, z##A2, 0x20); \
+ y##A2 = _mm256_permute2x128_si256(z##A, z##A2, 0x31); \
+ y##B = _mm256_permute2x128_si256(z##B, z##B2, 0x20); \
+ y##B2 = _mm256_permute2x128_si256(z##B, z##B2, 0x31); \
+ y##C = _mm256_permute2x128_si256(z##C, z##C2, 0x20); \
+ y##C2 = _mm256_permute2x128_si256(z##C, z##C2, 0x31); \
+ y##D = _mm256_permute2x128_si256(z##D, z##D2, 0x20); \
+ y##D2 = _mm256_permute2x128_si256(z##D, z##D2, 0x31); \
+ y##A = _mm256_xor_si256(y##A, \
+ _mm256_loadu_si256((const __m256i*) (m + 0))); \
+ y##B = _mm256_xor_si256( \
+ y##B, _mm256_loadu_si256((const __m256i*) (m + 64))); \
+ y##C = _mm256_xor_si256( \
+ y##C, _mm256_loadu_si256((const __m256i*) (m + 128))); \
+ y##D = _mm256_xor_si256( \
+ y##D, _mm256_loadu_si256((const __m256i*) (m + 192))); \
+ y##A2 = _mm256_xor_si256( \
+ y##A2, _mm256_loadu_si256((const __m256i*) (m + 256))); \
+ y##B2 = _mm256_xor_si256( \
+ y##B2, _mm256_loadu_si256((const __m256i*) (m + 320))); \
+ y##C2 = _mm256_xor_si256( \
+ y##C2, _mm256_loadu_si256((const __m256i*) (m + 384))); \
+ y##D2 = _mm256_xor_si256( \
+ y##D2, _mm256_loadu_si256((const __m256i*) (m + 448))); \
+ _mm256_storeu_si256((__m256i*) (c + 0), y##A); \
+ _mm256_storeu_si256((__m256i*) (c + 64), y##B); \
+ _mm256_storeu_si256((__m256i*) (c + 128), y##C); \
+ _mm256_storeu_si256((__m256i*) (c + 192), y##D); \
+ _mm256_storeu_si256((__m256i*) (c + 256), y##A2); \
+ _mm256_storeu_si256((__m256i*) (c + 320), y##B2); \
+ _mm256_storeu_si256((__m256i*) (c + 384), y##C2); \
+ _mm256_storeu_si256((__m256i*) (c + 448), y##D2); \
}
ONEOCTO(0, 1, 2, 3, 4, 5, 6, 7);
diff -Nru libsodium-1.0.16/src/libsodium/include/Makefile.am libsodium-1.0.18/src/libsodium/include/Makefile.am
--- libsodium-1.0.16/src/libsodium/include/Makefile.am 2017-12-13 09:24:13.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.16/src/libsodium/include/sodium/crypto_aead_aes256gcm.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_aead_aes256gcm.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_aead_aes256gcm.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_aead_aes256gcm.h 2019-05-30 20:13:18.000000000 +0000
@@ -52,11 +52,13 @@
#define crypto_aead_aes256gcm_MESSAGEBYTES_MAX \
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aes256gcm_ABYTES, \
- (16ULL * ((1ULL << 32) - 2ULL)) - crypto_aead_aes256gcm_ABYTES)
+ (16ULL * ((1ULL << 32) - 2ULL)))
SODIUM_EXPORT
size_t crypto_aead_aes256gcm_messagebytes_max(void);
-typedef CRYPTO_ALIGN(16) unsigned char crypto_aead_aes256gcm_state[512];
+typedef struct CRYPTO_ALIGN(16) crypto_aead_aes256gcm_state_ {
+ unsigned char opaque[512];
+} crypto_aead_aes256gcm_state;
SODIUM_EXPORT
size_t crypto_aead_aes256gcm_statebytes(void);
@@ -70,7 +72,8 @@
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 8, 9)));
SODIUM_EXPORT
int crypto_aead_aes256gcm_decrypt(unsigned char *m,
@@ -82,7 +85,7 @@
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
SODIUM_EXPORT
int crypto_aead_aes256gcm_encrypt_detached(unsigned char *c,
@@ -94,7 +97,8 @@
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 2, 9, 10)));
SODIUM_EXPORT
int crypto_aead_aes256gcm_decrypt_detached(unsigned char *m,
@@ -106,13 +110,14 @@
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
/* -- Precomputation interface -- */
SODIUM_EXPORT
int crypto_aead_aes256gcm_beforenm(crypto_aead_aes256gcm_state *ctx_,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_aead_aes256gcm_encrypt_afternm(unsigned char *c,
@@ -123,7 +128,8 @@
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
- const crypto_aead_aes256gcm_state *ctx_);
+ const crypto_aead_aes256gcm_state *ctx_)
+ __attribute__ ((nonnull(1, 8, 9)));
SODIUM_EXPORT
int crypto_aead_aes256gcm_decrypt_afternm(unsigned char *m,
@@ -135,7 +141,7 @@
unsigned long long adlen,
const unsigned char *npub,
const crypto_aead_aes256gcm_state *ctx_)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
SODIUM_EXPORT
int crypto_aead_aes256gcm_encrypt_detached_afternm(unsigned char *c,
@@ -147,7 +153,8 @@
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
- const crypto_aead_aes256gcm_state *ctx_);
+ const crypto_aead_aes256gcm_state *ctx_)
+ __attribute__ ((nonnull(1, 2, 9, 10)));
SODIUM_EXPORT
int crypto_aead_aes256gcm_decrypt_detached_afternm(unsigned char *m,
@@ -159,10 +166,11 @@
unsigned long long adlen,
const unsigned char *npub,
const crypto_aead_aes256gcm_state *ctx_)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
SODIUM_EXPORT
-void crypto_aead_aes256gcm_keygen(unsigned char k[crypto_aead_aes256gcm_KEYBYTES]);
+void crypto_aead_aes256gcm_keygen(unsigned char k[crypto_aead_aes256gcm_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h 2019-05-30 20:13:18.000000000 +0000
@@ -32,7 +32,7 @@
#define crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX \
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ietf_ABYTES, \
- (64ULL * (1ULL << 32) - 64ULL) - crypto_aead_chacha20poly1305_ietf_ABYTES)
+ (64ULL * ((1ULL << 32) - 1ULL)))
SODIUM_EXPORT
size_t crypto_aead_chacha20poly1305_ietf_messagebytes_max(void);
@@ -45,7 +45,8 @@
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 8, 9)));
SODIUM_EXPORT
int crypto_aead_chacha20poly1305_ietf_decrypt(unsigned char *m,
@@ -57,7 +58,7 @@
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
SODIUM_EXPORT
int crypto_aead_chacha20poly1305_ietf_encrypt_detached(unsigned char *c,
@@ -69,7 +70,8 @@
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 2, 9, 10)));
SODIUM_EXPORT
int crypto_aead_chacha20poly1305_ietf_decrypt_detached(unsigned char *m,
@@ -81,10 +83,11 @@
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
SODIUM_EXPORT
-void crypto_aead_chacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_chacha20poly1305_ietf_KEYBYTES]);
+void crypto_aead_chacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_chacha20poly1305_ietf_KEYBYTES])
+ __attribute__ ((nonnull));
/* -- Original ChaCha20-Poly1305 construction with a 64-bit nonce and a 64-bit internal counter -- */
@@ -118,7 +121,8 @@
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 8, 9)));
SODIUM_EXPORT
int crypto_aead_chacha20poly1305_decrypt(unsigned char *m,
@@ -130,7 +134,7 @@
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
SODIUM_EXPORT
int crypto_aead_chacha20poly1305_encrypt_detached(unsigned char *c,
@@ -142,7 +146,8 @@
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 2, 9, 10)));
SODIUM_EXPORT
int crypto_aead_chacha20poly1305_decrypt_detached(unsigned char *m,
@@ -154,10 +159,11 @@
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
SODIUM_EXPORT
-void crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_chacha20poly1305_KEYBYTES]);
+void crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_chacha20poly1305_KEYBYTES])
+ __attribute__ ((nonnull));
/* Aliases */
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h 2019-05-30 20:13:18.000000000 +0000
@@ -41,7 +41,8 @@
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 8, 9)));
SODIUM_EXPORT
int crypto_aead_xchacha20poly1305_ietf_decrypt(unsigned char *m,
@@ -53,7 +54,7 @@
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
SODIUM_EXPORT
int crypto_aead_xchacha20poly1305_ietf_encrypt_detached(unsigned char *c,
@@ -65,7 +66,8 @@
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 2, 9, 10)));
SODIUM_EXPORT
int crypto_aead_xchacha20poly1305_ietf_decrypt_detached(unsigned char *m,
@@ -77,10 +79,11 @@
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __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]);
+void crypto_aead_xchacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchacha20poly1305_ietf_KEYBYTES])
+ __attribute__ ((nonnull));
/* Aliases */
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_auth.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_auth.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth.h 2019-05-30 20:13:18.000000000 +0000
@@ -27,15 +27,17 @@
SODIUM_EXPORT
int crypto_auth(unsigned char *out, const unsigned char *in,
- unsigned long long inlen, const unsigned char *k);
+ unsigned long long inlen, const unsigned char *k)
+ __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__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
SODIUM_EXPORT
-void crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES]);
+void crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_auth_hmacsha256.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth_hmacsha256.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_auth_hmacsha256.h 2017-12-13 09:24:13.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);
+ 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__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
/* ------------------------------------------------------------------------- */
@@ -46,20 +46,22 @@
SODIUM_EXPORT
int crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state,
const unsigned char *key,
- size_t keylen);
+ size_t keylen) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_auth_hmacsha256_update(crypto_auth_hmacsha256_state *state,
const unsigned char *in,
- unsigned long long inlen);
+ unsigned long long inlen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state *state,
- unsigned char *out);
+ unsigned char *out) __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_auth_hmacsha256_keygen(unsigned char k[crypto_auth_hmacsha256_KEYBYTES]);
+void crypto_auth_hmacsha256_keygen(unsigned char k[crypto_auth_hmacsha256_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h 2017-12-13 09:24:13.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__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
/* ------------------------------------------------------------------------- */
@@ -41,19 +43,20 @@
SODIUM_EXPORT
int crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state,
const unsigned char *key,
- size_t keylen);
+ size_t keylen) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_auth_hmacsha512256_update(crypto_auth_hmacsha512256_state *state,
const unsigned char *in,
- unsigned long long inlen);
+ unsigned long long inlen) __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state *state,
- unsigned char *out);
+ unsigned char *out) __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_auth_hmacsha512256_keygen(unsigned char k[crypto_auth_hmacsha512256_KEYBYTES]);
+void crypto_auth_hmacsha512256_keygen(unsigned char k[crypto_auth_hmacsha512256_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_auth_hmacsha512.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_auth_hmacsha512.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_auth_hmacsha512.h 2017-12-13 09:24:13.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);
+ 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__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
/* ------------------------------------------------------------------------- */
@@ -46,19 +46,20 @@
SODIUM_EXPORT
int crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state,
const unsigned char *key,
- size_t keylen);
+ size_t keylen) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_auth_hmacsha512_update(crypto_auth_hmacsha512_state *state,
const unsigned char *in,
- unsigned long long inlen);
+ unsigned long long inlen) __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_auth_hmacsha512_final(crypto_auth_hmacsha512_state *state,
- unsigned char *out);
+ unsigned char *out) __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_auth_hmacsha512_keygen(unsigned char k[crypto_auth_hmacsha512_KEYBYTES]);
+void crypto_auth_hmacsha512_keygen(unsigned char k[crypto_auth_hmacsha512_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h 2019-05-30 20:13:18.000000000 +0000
@@ -45,11 +45,13 @@
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_seed_keypair(unsigned char *pk,
unsigned char *sk,
- const unsigned char *seed);
+ const unsigned char *seed)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_keypair(unsigned char *pk,
- unsigned char *sk);
+ unsigned char *sk)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_easy(unsigned char *c,
@@ -58,7 +60,7 @@
const unsigned char *n,
const unsigned char *pk,
const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_open_easy(unsigned char *m,
@@ -67,7 +69,7 @@
const unsigned char *n,
const unsigned char *pk,
const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_detached(unsigned char *c,
@@ -77,7 +79,7 @@
const unsigned char *n,
const unsigned char *pk,
const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 2, 5, 6, 7)));
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_open_detached(unsigned char *m,
@@ -87,7 +89,7 @@
const unsigned char *n,
const unsigned char *pk,
const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6, 7)));
/* -- Precomputation interface -- */
@@ -95,14 +97,15 @@
int crypto_box_curve25519xchacha20poly1305_beforenm(unsigned char *k,
const unsigned char *pk,
const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_easy_afternm(unsigned char *c,
const unsigned char *m,
unsigned long long mlen,
const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 4, 5)));
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_open_easy_afternm(unsigned char *m,
@@ -110,7 +113,7 @@
unsigned long long clen,
const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_detached_afternm(unsigned char *c,
@@ -118,7 +121,8 @@
const unsigned char *m,
unsigned long long mlen,
const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 2, 5, 6)));
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_open_detached_afternm(unsigned char *m,
@@ -127,7 +131,7 @@
unsigned long long clen,
const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
/* -- Ephemeral SK interface -- */
@@ -142,7 +146,8 @@
int crypto_box_curve25519xchacha20poly1305_seal(unsigned char *c,
const unsigned char *m,
unsigned long long mlen,
- const unsigned char *pk);
+ const unsigned char *pk)
+ __attribute__ ((nonnull(1, 4)));
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_seal_open(unsigned char *m,
@@ -150,7 +155,7 @@
unsigned long long clen,
const unsigned char *pk,
const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h 2019-05-30 20:13:18.000000000 +0000
@@ -45,17 +45,19 @@
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
unsigned char *sk,
- const unsigned char *seed);
+ const unsigned char *seed)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk,
- unsigned char *sk);
+ unsigned char *sk)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
const unsigned char *pk,
const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
/* -- NaCl compatibility interface ; Requires padding -- */
@@ -76,7 +78,7 @@
const unsigned char *n,
const unsigned char *pk,
const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m,
@@ -85,14 +87,15 @@
const unsigned char *n,
const unsigned char *pk,
const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_afternm(unsigned char *c,
const unsigned char *m,
unsigned long long mlen,
const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 4, 5)));
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_open_afternm(unsigned char *m,
@@ -100,7 +103,7 @@
unsigned long long clen,
const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_box.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_box.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_box.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_box.h 2019-05-30 20:13:18.000000000 +0000
@@ -50,29 +50,31 @@
SODIUM_EXPORT
int crypto_box_seed_keypair(unsigned char *pk, unsigned char *sk,
- const unsigned char *seed);
+ const unsigned char *seed)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-int crypto_box_keypair(unsigned char *pk, unsigned char *sk);
+int crypto_box_keypair(unsigned char *pk, unsigned char *sk)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
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__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
SODIUM_EXPORT
int crypto_box_open_easy(unsigned char *m, const unsigned char *c,
unsigned long long clen, const unsigned char *n,
const unsigned char *pk, const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
SODIUM_EXPORT
int crypto_box_detached(unsigned char *c, unsigned char *mac,
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__ ((warn_unused_result)) __attribute__ ((nonnull(1, 2, 5, 6, 7)));
SODIUM_EXPORT
int crypto_box_open_detached(unsigned char *m, const unsigned char *c,
@@ -81,7 +83,7 @@
const unsigned char *n,
const unsigned char *pk,
const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6, 7)));
/* -- Precomputation interface -- */
@@ -92,30 +94,31 @@
SODIUM_EXPORT
int crypto_box_beforenm(unsigned char *k, const unsigned char *pk,
const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
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);
+ const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
SODIUM_EXPORT
int crypto_box_open_easy_afternm(unsigned char *m, const unsigned char *c,
unsigned long long clen, const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
SODIUM_EXPORT
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);
+ const unsigned char *n, const unsigned char *k)
+ __attribute__ ((nonnull(1, 2, 5, 6)));
SODIUM_EXPORT
int crypto_box_open_detached_afternm(unsigned char *m, const unsigned char *c,
const unsigned char *mac,
unsigned long long clen, const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
/* -- Ephemeral SK interface -- */
@@ -125,13 +128,14 @@
SODIUM_EXPORT
int crypto_box_seal(unsigned char *c, const unsigned char *m,
- unsigned long long mlen, const unsigned char *pk);
+ unsigned long long mlen, const unsigned char *pk)
+ __attribute__ ((nonnull(1, 4)));
SODIUM_EXPORT
int crypto_box_seal_open(unsigned char *m, const unsigned char *c,
unsigned long long clen,
const unsigned char *pk, const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
/* -- NaCl compatibility interface ; Requires padding -- */
@@ -147,24 +151,24 @@
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__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
SODIUM_EXPORT
int crypto_box_open(unsigned char *m, const unsigned char *c,
unsigned long long clen, const unsigned char *n,
const unsigned char *pk, const unsigned char *sk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
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);
+ const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
SODIUM_EXPORT
int crypto_box_open_afternm(unsigned char *m, const unsigned char *c,
unsigned long long clen, const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_ed25519.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_ed25519.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_ed25519.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_ed25519.h 2019-05-30 20:13:18.000000000 +0000
@@ -16,19 +16,82 @@
SODIUM_EXPORT
size_t crypto_core_ed25519_uniformbytes(void);
+#define crypto_core_ed25519_HASHBYTES 64
SODIUM_EXPORT
-int crypto_core_ed25519_is_valid_point(const unsigned char *p);
+size_t crypto_core_ed25519_hashbytes(void);
+
+#define crypto_core_ed25519_SCALARBYTES 32
+SODIUM_EXPORT
+size_t crypto_core_ed25519_scalarbytes(void);
+
+#define crypto_core_ed25519_NONREDUCEDSCALARBYTES 64
+SODIUM_EXPORT
+size_t crypto_core_ed25519_nonreducedscalarbytes(void);
+
+SODIUM_EXPORT
+int crypto_core_ed25519_is_valid_point(const unsigned char *p)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_core_ed25519_add(unsigned char *r,
- const unsigned char *p, const unsigned char *q);
+ const unsigned char *p, const unsigned char *q)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_core_ed25519_sub(unsigned char *r,
- const unsigned char *p, const unsigned char *q);
+ const unsigned char *p, const unsigned char *q)
+ __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r)
+ __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));
+
+SODIUM_EXPORT
+int crypto_core_ed25519_scalar_invert(unsigned char *recip, const unsigned char *s)
+ __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ed25519_scalar_negate(unsigned char *neg, const unsigned char *s)
+ __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ed25519_scalar_complement(unsigned char *comp, const unsigned char *s)
+ __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ed25519_scalar_add(unsigned char *z, const unsigned char *x,
+ const unsigned char *y)
+ __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ed25519_scalar_sub(unsigned char *z, const unsigned char *x,
+ 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`.
+ */
SODIUM_EXPORT
-int crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r);
+void crypto_core_ed25519_scalar_reduce(unsigned char *r, const unsigned char *s)
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_hchacha20.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_hchacha20.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_hchacha20.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_hchacha20.h 2019-05-30 20:13:18.000000000 +0000
@@ -26,7 +26,8 @@
SODIUM_EXPORT
int crypto_core_hchacha20(unsigned char *out, const unsigned char *in,
- const unsigned char *k, const unsigned char *c);
+ const unsigned char *k, const unsigned char *c)
+ __attribute__ ((nonnull(1, 2, 3)));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_hsalsa20.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_hsalsa20.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_hsalsa20.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_hsalsa20.h 2019-05-30 20:13:18.000000000 +0000
@@ -26,7 +26,8 @@
SODIUM_EXPORT
int crypto_core_hsalsa20(unsigned char *out, const unsigned char *in,
- const unsigned char *k, const unsigned char *c);
+ const unsigned char *k, const unsigned char *c)
+ __attribute__ ((nonnull(1, 2, 3)));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_ristretto255.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_ristretto255.h
--- libsodium-1.0.16/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.16/src/libsodium/include/sodium/crypto_core_salsa2012.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_salsa2012.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_salsa2012.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_salsa2012.h 2019-05-30 20:13:18.000000000 +0000
@@ -26,7 +26,8 @@
SODIUM_EXPORT
int crypto_core_salsa2012(unsigned char *out, const unsigned char *in,
- const unsigned char *k, const unsigned char *c);
+ const unsigned char *k, const unsigned char *c)
+ __attribute__ ((nonnull(1, 2, 3)));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_salsa208.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_salsa208.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_salsa208.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_salsa208.h 2019-05-30 20:13:18.000000000 +0000
@@ -30,7 +30,8 @@
SODIUM_EXPORT
int crypto_core_salsa208(unsigned char *out, const unsigned char *in,
- const unsigned char *k, const unsigned char *c);
+ const unsigned char *k, const unsigned char *c)
+ __attribute__ ((nonnull(1, 2, 3)));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_salsa20.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_salsa20.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_core_salsa20.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_core_salsa20.h 2019-05-30 20:13:18.000000000 +0000
@@ -26,7 +26,8 @@
SODIUM_EXPORT
int crypto_core_salsa20(unsigned char *out, const unsigned char *in,
- const unsigned char *k, const unsigned char *c);
+ const unsigned char *k, const unsigned char *c)
+ __attribute__ ((nonnull(1, 2, 3)));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_generichash_blake2b.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_generichash_blake2b.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_generichash_blake2b.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_generichash_blake2b.h 2019-05-30 20:13:18.000000000 +0000
@@ -21,12 +21,7 @@
#endif
typedef struct CRYPTO_ALIGN(64) crypto_generichash_blake2b_state {
- uint64_t h[8];
- uint64_t t[2];
- uint64_t f[2];
- uint8_t buf[2 * 128];
- size_t buflen;
- uint8_t last_node;
+ unsigned char opaque[384];
} crypto_generichash_blake2b_state;
#if defined(__IBMC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
@@ -74,7 +69,8 @@
int crypto_generichash_blake2b(unsigned char *out, size_t outlen,
const unsigned char *in,
unsigned long long inlen,
- const unsigned char *key, size_t keylen);
+ const unsigned char *key, size_t keylen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_generichash_blake2b_salt_personal(unsigned char *out, size_t outlen,
@@ -83,32 +79,37 @@
const unsigned char *key,
size_t keylen,
const unsigned char *salt,
- const unsigned char *personal);
+ const unsigned char *personal)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
const unsigned char *key,
- const size_t keylen, const size_t outlen);
+ const size_t keylen, const size_t outlen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_generichash_blake2b_init_salt_personal(crypto_generichash_blake2b_state *state,
const unsigned char *key,
const size_t keylen, const size_t outlen,
const unsigned char *salt,
- const unsigned char *personal);
+ const unsigned char *personal)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state,
const unsigned char *in,
- unsigned long long inlen);
+ unsigned long long inlen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state,
unsigned char *out,
- const size_t outlen);
+ const size_t outlen) __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_generichash_blake2b_keygen(unsigned char k[crypto_generichash_blake2b_KEYBYTES]);
+void crypto_generichash_blake2b_keygen(unsigned char k[crypto_generichash_blake2b_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_generichash.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_generichash.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_generichash.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_generichash.h 2019-05-30 20:13:18.000000000 +0000
@@ -41,6 +41,10 @@
SODIUM_EXPORT
const char *crypto_generichash_primitive(void);
+/*
+ * Important when writing bindings for other programming languages:
+ * the state address should be 64-bytes aligned.
+ */
typedef crypto_generichash_blake2b_state crypto_generichash_state;
SODIUM_EXPORT
@@ -49,24 +53,29 @@
SODIUM_EXPORT
int crypto_generichash(unsigned char *out, size_t outlen,
const unsigned char *in, unsigned long long inlen,
- const unsigned char *key, size_t keylen);
+ const unsigned char *key, size_t keylen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_generichash_init(crypto_generichash_state *state,
const unsigned char *key,
- const size_t keylen, const size_t outlen);
+ const size_t keylen, const size_t outlen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_generichash_update(crypto_generichash_state *state,
const unsigned char *in,
- unsigned long long inlen);
+ unsigned long long inlen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_generichash_final(crypto_generichash_state *state,
- unsigned char *out, const size_t outlen);
+ unsigned char *out, const size_t outlen)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_generichash_keygen(unsigned char k[crypto_generichash_KEYBYTES]);
+void crypto_generichash_keygen(unsigned char k[crypto_generichash_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_hash.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_hash.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_hash.h 2017-12-13 09:24:13.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);
+ unsigned long long inlen) __attribute__ ((nonnull(1)));
#define crypto_hash_PRIMITIVE "sha512"
SODIUM_EXPORT
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_hash_sha256.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_hash_sha256.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_hash_sha256.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_hash_sha256.h 2019-05-30 20:13:18.000000000 +0000
@@ -36,19 +36,22 @@
SODIUM_EXPORT
int crypto_hash_sha256(unsigned char *out, const unsigned char *in,
- unsigned long long inlen);
+ unsigned long long inlen) __attribute__ ((nonnull(1)));
SODIUM_EXPORT
-int crypto_hash_sha256_init(crypto_hash_sha256_state *state);
+int crypto_hash_sha256_init(crypto_hash_sha256_state *state)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_hash_sha256_update(crypto_hash_sha256_state *state,
const unsigned char *in,
- unsigned long long inlen);
+ unsigned long long inlen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_hash_sha256_final(crypto_hash_sha256_state *state,
- unsigned char *out);
+ unsigned char *out)
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_hash_sha512.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_hash_sha512.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_hash_sha512.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_hash_sha512.h 2019-05-30 20:13:18.000000000 +0000
@@ -36,19 +36,22 @@
SODIUM_EXPORT
int crypto_hash_sha512(unsigned char *out, const unsigned char *in,
- unsigned long long inlen);
+ unsigned long long inlen) __attribute__ ((nonnull(1)));
SODIUM_EXPORT
-int crypto_hash_sha512_init(crypto_hash_sha512_state *state);
+int crypto_hash_sha512_init(crypto_hash_sha512_state *state)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_hash_sha512_update(crypto_hash_sha512_state *state,
const unsigned char *in,
- unsigned long long inlen);
+ unsigned long long inlen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_hash_sha512_final(crypto_hash_sha512_state *state,
- unsigned char *out);
+ unsigned char *out)
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_kdf_blake2b.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_kdf_blake2b.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_kdf_blake2b.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_kdf_blake2b.h 2019-05-30 20:13:18.000000000 +0000
@@ -34,7 +34,9 @@
int crypto_kdf_blake2b_derive_from_key(unsigned char *subkey, size_t subkey_len,
uint64_t subkey_id,
const char ctx[crypto_kdf_blake2b_CONTEXTBYTES],
- const unsigned char key[crypto_kdf_blake2b_KEYBYTES]);
+ const unsigned char key[crypto_kdf_blake2b_KEYBYTES])
+ __attribute__ ((nonnull));
+
#ifdef __cplusplus
}
#endif
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_kdf.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_kdf.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_kdf.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_kdf.h 2019-05-30 20:13:18.000000000 +0000
@@ -39,10 +39,12 @@
int crypto_kdf_derive_from_key(unsigned char *subkey, size_t subkey_len,
uint64_t subkey_id,
const char ctx[crypto_kdf_CONTEXTBYTES],
- const unsigned char key[crypto_kdf_KEYBYTES]);
+ const unsigned char key[crypto_kdf_KEYBYTES])
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES]);
+void crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_kx.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_kx.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_kx.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_kx.h 2019-05-30 20:13:18.000000000 +0000
@@ -35,11 +35,13 @@
SODIUM_EXPORT
int crypto_kx_seed_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES],
unsigned char sk[crypto_kx_SECRETKEYBYTES],
- const unsigned char seed[crypto_kx_SEEDBYTES]);
+ const unsigned char seed[crypto_kx_SEEDBYTES])
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_kx_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES],
- unsigned char sk[crypto_kx_SECRETKEYBYTES]);
+ unsigned char sk[crypto_kx_SECRETKEYBYTES])
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_kx_client_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
@@ -47,7 +49,7 @@
const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES],
const unsigned char client_sk[crypto_kx_SECRETKEYBYTES],
const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES])
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 4, 5)));
SODIUM_EXPORT
int crypto_kx_server_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
@@ -55,7 +57,7 @@
const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES],
const unsigned char server_sk[crypto_kx_SECRETKEYBYTES],
const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES])
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 4, 5)));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_onetimeauth.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_onetimeauth.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_onetimeauth.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_onetimeauth.h 2019-05-30 20:13:18.000000000 +0000
@@ -32,28 +32,31 @@
SODIUM_EXPORT
int crypto_onetimeauth(unsigned char *out, const unsigned char *in,
- unsigned long long inlen, const unsigned char *k);
+ unsigned long long inlen, const unsigned char *k)
+ __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__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
SODIUM_EXPORT
int crypto_onetimeauth_init(crypto_onetimeauth_state *state,
- const unsigned char *key);
+ const unsigned char *key) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_onetimeauth_update(crypto_onetimeauth_state *state,
const unsigned char *in,
- unsigned long long inlen);
+ unsigned long long inlen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_onetimeauth_final(crypto_onetimeauth_state *state,
- unsigned char *out);
+ unsigned char *out) __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_onetimeauth_keygen(unsigned char k[crypto_onetimeauth_KEYBYTES]);
+void crypto_onetimeauth_keygen(unsigned char k[crypto_onetimeauth_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h 2019-05-30 20:13:18.000000000 +0000
@@ -35,30 +35,35 @@
int crypto_onetimeauth_poly1305(unsigned char *out,
const unsigned char *in,
unsigned long long inlen,
- const unsigned char *k);
+ const unsigned char *k)
+ __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__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
SODIUM_EXPORT
int crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state,
- const unsigned char *key);
+ const unsigned char *key)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state,
const unsigned char *in,
- unsigned long long inlen);
+ unsigned long long inlen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state,
- unsigned char *out);
+ unsigned char *out)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_onetimeauth_poly1305_keygen(unsigned char k[crypto_onetimeauth_poly1305_KEYBYTES]);
+void crypto_onetimeauth_poly1305_keygen(unsigned char k[crypto_onetimeauth_poly1305_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_pwhash_argon2id.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_pwhash_argon2id.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_pwhash_argon2id.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_pwhash_argon2id.h 2019-05-30 20:13:18.000000000 +0000
@@ -95,25 +95,25 @@
const unsigned char * const salt,
unsigned long long opslimit, size_t memlimit,
int alg)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_argon2id_str(char out[crypto_pwhash_argon2id_STRBYTES],
const char * const passwd,
unsigned long long passwdlen,
unsigned long long opslimit, size_t memlimit)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_argon2id_str_verify(const char str[crypto_pwhash_argon2id_STRBYTES],
const char * const passwd,
unsigned long long passwdlen)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_argon2id_str_needs_rehash(const char str[crypto_pwhash_argon2id_STRBYTES],
unsigned long long opslimit, size_t memlimit)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_pwhash_argon2i.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_pwhash_argon2i.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_pwhash_argon2i.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_pwhash_argon2i.h 2019-05-30 20:13:18.000000000 +0000
@@ -95,25 +95,25 @@
const unsigned char * const salt,
unsigned long long opslimit, size_t memlimit,
int alg)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_argon2i_str(char out[crypto_pwhash_argon2i_STRBYTES],
const char * const passwd,
unsigned long long passwdlen,
unsigned long long opslimit, size_t memlimit)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_argon2i_str_verify(const char str[crypto_pwhash_argon2i_STRBYTES],
const char * const passwd,
unsigned long long passwdlen)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_argon2i_str_needs_rehash(const char str[crypto_pwhash_argon2i_STRBYTES],
unsigned long long opslimit, size_t memlimit)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_pwhash.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_pwhash.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_pwhash.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_pwhash.h 2019-05-30 20:13:18.000000000 +0000
@@ -105,7 +105,7 @@
const char * const passwd, unsigned long long passwdlen,
const unsigned char * const salt,
unsigned long long opslimit, size_t memlimit, int alg)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
/*
* The output string already includes all the required parameters, including
@@ -116,24 +116,24 @@
int crypto_pwhash_str(char out[crypto_pwhash_STRBYTES],
const char * const passwd, unsigned long long passwdlen,
unsigned long long opslimit, size_t memlimit)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_str_alg(char out[crypto_pwhash_STRBYTES],
const char * const passwd, unsigned long long passwdlen,
unsigned long long opslimit, size_t memlimit, int alg)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_str_verify(const char str[crypto_pwhash_STRBYTES],
const char * const passwd,
unsigned long long passwdlen)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_str_needs_rehash(const char str[crypto_pwhash_STRBYTES],
unsigned long long opslimit, size_t memlimit)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
#define crypto_pwhash_PRIMITIVE "argon2i"
SODIUM_EXPORT
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h 2019-05-30 20:13:18.000000000 +0000
@@ -84,7 +84,7 @@
const unsigned char * const salt,
unsigned long long opslimit,
size_t memlimit)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
@@ -92,26 +92,26 @@
unsigned long long passwdlen,
unsigned long long opslimit,
size_t memlimit)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_scryptsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
const char * const passwd,
unsigned long long passwdlen)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdlen,
const uint8_t * salt, size_t saltlen,
uint64_t N, uint32_t r, uint32_t p,
uint8_t * buf, size_t buflen)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
unsigned long long opslimit,
size_t memlimit)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h 2017-12-13 09:24:13.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)
@@ -28,10 +28,12 @@
SODIUM_EXPORT
int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
const unsigned char *p)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
-int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
+int crypto_scalarmult_curve25519_base(unsigned char *q,
+ const unsigned char *n)
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h 2017-12-13 09:24:13.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)
@@ -29,10 +29,20 @@
SODIUM_EXPORT
int crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n,
const unsigned char *p)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
-int crypto_scalarmult_ed25519_base(unsigned char *q, const unsigned char *n);
+int crypto_scalarmult_ed25519_noclamp(unsigned char *q, const unsigned char *n,
+ const unsigned char *p)
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_scalarmult_ed25519_base(unsigned char *q, const unsigned char *n)
+ __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_scalarmult_ed25519_base_noclamp(unsigned char *q, const unsigned char *n)
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_scalarmult.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_scalarmult.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult.h 2019-05-30 20:13:18.000000000 +0000
@@ -23,10 +23,11 @@
const char *crypto_scalarmult_primitive(void);
SODIUM_EXPORT
-int crypto_scalarmult_base(unsigned char *q, const unsigned char *n);
+int crypto_scalarmult_base(unsigned char *q, const unsigned char *n)
+ __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)
@@ -36,7 +37,7 @@
SODIUM_EXPORT
int crypto_scalarmult(unsigned char *q, const unsigned char *n,
const unsigned char *p)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h
--- libsodium-1.0.16/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.16/src/libsodium/include/sodium/crypto_secretbox.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_secretbox.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox.h 2019-05-30 20:13:18.000000000 +0000
@@ -36,20 +36,21 @@
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);
+ const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
SODIUM_EXPORT
int crypto_secretbox_open_easy(unsigned char *m, const unsigned char *c,
unsigned long long clen, const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
SODIUM_EXPORT
int crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
const unsigned char *m,
unsigned long long mlen,
const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 2, 5, 6)));
SODIUM_EXPORT
int crypto_secretbox_open_detached(unsigned char *m,
@@ -58,10 +59,11 @@
unsigned long long clen,
const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
SODIUM_EXPORT
-void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES]);
+void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES])
+ __attribute__ ((nonnull));
/* -- NaCl compatibility interface ; Requires padding -- */
@@ -76,13 +78,13 @@
SODIUM_EXPORT
int crypto_secretbox(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
SODIUM_EXPORT
int crypto_secretbox_open(unsigned char *m, const unsigned char *c,
unsigned long long clen, const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h 2019-05-30 20:13:18.000000000 +0000
@@ -34,7 +34,8 @@
const unsigned char *m,
unsigned long long mlen,
const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 4, 5)));
SODIUM_EXPORT
int crypto_secretbox_xchacha20poly1305_open_easy(unsigned char *m,
@@ -42,7 +43,7 @@
unsigned long long clen,
const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
SODIUM_EXPORT
int crypto_secretbox_xchacha20poly1305_detached(unsigned char *c,
@@ -50,7 +51,8 @@
const unsigned char *m,
unsigned long long mlen,
const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 2, 5, 6)));
SODIUM_EXPORT
int crypto_secretbox_xchacha20poly1305_open_detached(unsigned char *m,
@@ -59,7 +61,7 @@
unsigned long long clen,
const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h 2019-05-30 20:13:18.000000000 +0000
@@ -35,7 +35,8 @@
const unsigned char *m,
unsigned long long mlen,
const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull(1, 4, 5)));
SODIUM_EXPORT
int crypto_secretbox_xsalsa20poly1305_open(unsigned char *m,
@@ -43,10 +44,11 @@
unsigned long long clen,
const unsigned char *n,
const unsigned char *k)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
SODIUM_EXPORT
-void crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES]);
+void crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES])
+ __attribute__ ((nonnull));
/* -- NaCl compatibility interface ; Requires padding -- */
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h 2019-05-30 20:13:18.000000000 +0000
@@ -30,7 +30,8 @@
size_t crypto_secretstream_xchacha20poly1305_keybytes(void);
#define crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX \
- SODIUM_MIN(SODIUM_SIZE_MAX, ((1ULL << 32) - 2ULL) * 64ULL)
+ SODIUM_MIN(SODIUM_SIZE_MAX - crypto_secretstream_xchacha20poly1305_ABYTES, \
+ (64ULL * ((1ULL << 32) - 2ULL)))
SODIUM_EXPORT
size_t crypto_secretstream_xchacha20poly1305_messagebytes_max(void);
@@ -63,33 +64,38 @@
SODIUM_EXPORT
void crypto_secretstream_xchacha20poly1305_keygen
- (unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]);
+ (unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_secretstream_xchacha20poly1305_init_push
(crypto_secretstream_xchacha20poly1305_state *state,
unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
- const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]);
+ const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_secretstream_xchacha20poly1305_push
(crypto_secretstream_xchacha20poly1305_state *state,
unsigned char *c, unsigned long long *clen_p,
const unsigned char *m, unsigned long long mlen,
- const unsigned char *ad, unsigned long long adlen, unsigned char tag);
+ const unsigned char *ad, unsigned long long adlen, unsigned char tag)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_secretstream_xchacha20poly1305_init_pull
(crypto_secretstream_xchacha20poly1305_state *state,
const unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
- const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]);
+ const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_secretstream_xchacha20poly1305_pull
(crypto_secretstream_xchacha20poly1305_state *state,
unsigned char *m, unsigned long long *mlen_p, unsigned char *tag_p,
const unsigned char *c, unsigned long long clen,
- const unsigned char *ad, unsigned long long adlen);
+ const unsigned char *ad, unsigned long long adlen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
void crypto_secretstream_xchacha20poly1305_rekey
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_shorthash.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_shorthash.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_shorthash.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_shorthash.h 2019-05-30 20:13:18.000000000 +0000
@@ -27,10 +27,12 @@
SODIUM_EXPORT
int crypto_shorthash(unsigned char *out, const unsigned char *in,
- unsigned long long inlen, const unsigned char *k);
+ unsigned long long inlen, const unsigned char *k)
+ __attribute__ ((nonnull(1, 4)));
SODIUM_EXPORT
-void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES]);
+void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_shorthash_siphash24.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_shorthash_siphash24.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_shorthash_siphash24.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_shorthash_siphash24.h 2019-05-30 20:13:18.000000000 +0000
@@ -23,7 +23,8 @@
SODIUM_EXPORT
int crypto_shorthash_siphash24(unsigned char *out, const unsigned char *in,
- unsigned long long inlen, const unsigned char *k);
+ unsigned long long inlen, const unsigned char *k)
+ __attribute__ ((nonnull(1, 4)));
#ifndef SODIUM_LIBRARY_MINIMAL
/* -- 128-bit output -- */
@@ -38,7 +39,8 @@
SODIUM_EXPORT
int crypto_shorthash_siphashx24(unsigned char *out, const unsigned char *in,
- unsigned long long inlen, const unsigned char *k);
+ unsigned long long inlen, const unsigned char *k)
+ __attribute__ ((nonnull(1, 4)));
#endif
#ifdef __cplusplus
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_sign_ed25519.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_sign_ed25519.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_sign_ed25519.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_sign_ed25519.h 2019-05-30 20:13:18.000000000 +0000
@@ -42,70 +42,80 @@
SODIUM_EXPORT
int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p,
const unsigned char *m, unsigned long long mlen,
- const unsigned char *sk);
+ const unsigned char *sk)
+ __attribute__ ((nonnull(1, 5)));
SODIUM_EXPORT
int crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p,
const unsigned char *sm, unsigned long long smlen,
const unsigned char *pk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5)));
SODIUM_EXPORT
int crypto_sign_ed25519_detached(unsigned char *sig,
unsigned long long *siglen_p,
const unsigned char *m,
unsigned long long mlen,
- const unsigned char *sk);
+ const unsigned char *sk)
+ __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);
+int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk,
- const unsigned char *seed);
+ const unsigned char *seed)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_sign_ed25519_pk_to_curve25519(unsigned char *curve25519_pk,
const unsigned char *ed25519_pk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk,
- const unsigned char *ed25519_sk);
+ const unsigned char *ed25519_sk)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_sign_ed25519_sk_to_seed(unsigned char *seed,
- const unsigned char *sk);
+ const unsigned char *sk)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk);
+int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state);
+int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_sign_ed25519ph_update(crypto_sign_ed25519ph_state *state,
const unsigned char *m,
- unsigned long long mlen);
+ unsigned long long mlen)
+ __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);
+ const unsigned char *sk)
+ __attribute__ ((nonnull(1, 2, 4)));
SODIUM_EXPORT
int crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state *state,
- unsigned char *sig,
+ const unsigned char *sig,
const unsigned char *pk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h 2017-12-13 09:24:13.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__ ((deprecated)) __attribute__ ((nonnull(1, 5)));
SODIUM_EXPORT
int crypto_sign_edwards25519sha512batch_open(unsigned char *m,
@@ -41,12 +41,12 @@
const unsigned char *sm,
unsigned long long smlen,
const unsigned char *pk)
- __attribute__ ((deprecated));
+ __attribute__ ((deprecated)) __attribute__ ((nonnull(3, 5)));
SODIUM_EXPORT
int crypto_sign_edwards25519sha512batch_keypair(unsigned char *pk,
unsigned char *sk)
- __attribute__ ((deprecated));
+ __attribute__ ((deprecated)) __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_sign.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_sign.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_sign.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_sign.h 2019-05-30 20:13:18.000000000 +0000
@@ -51,50 +51,54 @@
SODIUM_EXPORT
int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
- const unsigned char *seed);
+ const unsigned char *seed)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-int crypto_sign_keypair(unsigned char *pk, unsigned char *sk);
+int crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
+ __attribute__ ((nonnull));
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);
+ const unsigned char *sk) __attribute__ ((nonnull(1, 5)));
SODIUM_EXPORT
int crypto_sign_open(unsigned char *m, unsigned long long *mlen_p,
const unsigned char *sm, unsigned long long smlen,
const unsigned char *pk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5)));
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);
+ 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__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
SODIUM_EXPORT
int crypto_sign_init(crypto_sign_state *state);
SODIUM_EXPORT
int crypto_sign_update(crypto_sign_state *state,
- const unsigned char *m, unsigned long long mlen);
+ const unsigned char *m, unsigned long long mlen)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_sign_final_create(crypto_sign_state *state, unsigned char *sig,
unsigned long long *siglen_p,
- const unsigned char *sk);
+ const unsigned char *sk)
+ __attribute__ ((nonnull(1, 2, 4)));
SODIUM_EXPORT
-int crypto_sign_final_verify(crypto_sign_state *state, unsigned char *sig,
+int crypto_sign_final_verify(crypto_sign_state *state, const unsigned char *sig,
const unsigned char *pk)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_chacha20.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_chacha20.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_chacha20.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_chacha20.h 2019-05-30 20:13:18.000000000 +0000
@@ -36,21 +36,25 @@
SODIUM_EXPORT
int crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k);
+ const unsigned char *n, const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m,
unsigned long long mlen,
const unsigned char *n, uint64_t ic,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES]);
+void crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES])
+ __attribute__ ((nonnull));
/* ChaCha20 with a 96-bit nonce and a 32-bit counter (IETF) */
@@ -69,21 +73,25 @@
SODIUM_EXPORT
int crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k);
+ const unsigned char *n, const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_chacha20_ietf_xor(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m,
unsigned long long mlen,
const unsigned char *n, uint32_t ic,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES]);
+void crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES])
+ __attribute__ ((nonnull));
/* Aliases */
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream.h 2019-05-30 20:13:18.000000000 +0000
@@ -39,15 +39,18 @@
SODIUM_EXPORT
int crypto_stream(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k);
+ const unsigned char *n, const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_xor(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES]);
+void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_salsa2012.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_salsa2012.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_salsa2012.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_salsa2012.h 2019-05-30 20:13:18.000000000 +0000
@@ -33,15 +33,18 @@
SODIUM_EXPORT
int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k);
+ const unsigned char *n, const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_salsa2012_xor(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES]);
+void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_salsa208.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_salsa208.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_salsa208.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_salsa208.h 2019-05-30 20:13:18.000000000 +0000
@@ -37,17 +37,17 @@
SODIUM_EXPORT
int crypto_stream_salsa208(unsigned char *c, unsigned long long clen,
const unsigned char *n, const unsigned char *k)
- __attribute__ ((deprecated));
+ __attribute__ ((deprecated)) __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_salsa208_xor(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
const unsigned char *k)
- __attribute__ ((deprecated));
+ __attribute__ ((deprecated)) __attribute__ ((nonnull));
SODIUM_EXPORT
void crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES])
- __attribute__ ((deprecated));
+ __attribute__ ((deprecated)) __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_salsa20.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_salsa20.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_salsa20.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_salsa20.h 2019-05-30 20:13:18.000000000 +0000
@@ -34,21 +34,25 @@
SODIUM_EXPORT
int crypto_stream_salsa20(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k);
+ const unsigned char *n, const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_salsa20_xor(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_salsa20_xor_ic(unsigned char *c, const unsigned char *m,
unsigned long long mlen,
const unsigned char *n, uint64_t ic,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES]);
+void crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_xchacha20.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_xchacha20.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_xchacha20.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_xchacha20.h 2019-05-30 20:13:18.000000000 +0000
@@ -34,21 +34,25 @@
SODIUM_EXPORT
int crypto_stream_xchacha20(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k);
+ const unsigned char *n, const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_xchacha20_xor(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_xchacha20_xor_ic(unsigned char *c, const unsigned char *m,
unsigned long long mlen,
const unsigned char *n, uint64_t ic,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES]);
+void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_xsalsa20.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_xsalsa20.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_stream_xsalsa20.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_stream_xsalsa20.h 2019-05-30 20:13:18.000000000 +0000
@@ -34,21 +34,25 @@
SODIUM_EXPORT
int crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen,
- const unsigned char *n, const unsigned char *k);
+ const unsigned char *n, const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_xsalsa20_xor(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_stream_xsalsa20_xor_ic(unsigned char *c, const unsigned char *m,
unsigned long long mlen,
const unsigned char *n, uint64_t ic,
- const unsigned char *k);
+ const unsigned char *k)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-void crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES]);
+void crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES])
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_verify_16.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_verify_16.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_verify_16.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_verify_16.h 2019-05-30 20:13:18.000000000 +0000
@@ -14,7 +14,7 @@
SODIUM_EXPORT
int crypto_verify_16(const unsigned char *x, const unsigned char *y)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_verify_32.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_verify_32.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_verify_32.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_verify_32.h 2019-05-30 20:13:18.000000000 +0000
@@ -14,7 +14,7 @@
SODIUM_EXPORT
int crypto_verify_32(const unsigned char *x, const unsigned char *y)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/crypto_verify_64.h libsodium-1.0.18/src/libsodium/include/sodium/crypto_verify_64.h
--- libsodium-1.0.16/src/libsodium/include/sodium/crypto_verify_64.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/crypto_verify_64.h 2019-05-30 20:13:18.000000000 +0000
@@ -14,7 +14,7 @@
SODIUM_EXPORT
int crypto_verify_64(const unsigned char *x, const unsigned char *y)
- __attribute__ ((warn_unused_result));
+ __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/export.h libsodium-1.0.18/src/libsodium/include/sodium/export.h
--- libsodium-1.0.16/src/libsodium/include/sodium/export.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/export.h 2019-05-30 20:13:18.000000000 +0000
@@ -2,7 +2,11 @@
#ifndef sodium_export_H
#define sodium_export_H
-#ifndef __GNUC__
+#include
+#include
+#include
+
+#if !defined(__clang__) && !defined(__GNUC__)
# ifdef __attribute__
# undef __attribute__
# endif
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/private/chacha20_ietf_ext.h libsodium-1.0.18/src/libsodium/include/sodium/private/chacha20_ietf_ext.h
--- libsodium-1.0.16/src/libsodium/include/sodium/private/chacha20_ietf_ext.h 1970-01-01 00:00:00.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/private/chacha20_ietf_ext.h 2019-05-30 20:13:18.000000000 +0000
@@ -0,0 +1,16 @@
+#ifndef chacha20_ietf_ext_H
+#define chacha20_ietf_ext_H
+
+#include
+
+/* The ietf_ext variant allows the internal counter to overflow into the IV */
+
+int crypto_stream_chacha20_ietf_ext(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k);
+
+int crypto_stream_chacha20_ietf_ext_xor_ic(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n, uint32_t ic,
+ const unsigned char *k);
+#endif
+
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/private/common.h libsodium-1.0.18/src/libsodium/include/sodium/private/common.h
--- libsodium-1.0.16/src/libsodium/include/sodium/private/common.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/private/common.h 2019-05-30 20:13:18.000000000 +0000
@@ -1,6 +1,21 @@
#ifndef common_H
#define common_H 1
+#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.
+# warning Do not use this except if you are planning to contribute code.
+# warning Use releases available at https://download.libsodium.org/libsodium/releases/ instead.
+# warning Alternatively, use the "stable" branch in the git repository.
+#endif
+
+#if !defined(_MSC_VER) && (!defined(CONFIGURED) || CONFIGURED != 1)
+# warning *** The library is being compiled using an undocumented method.
+# warning This is not supported. It has not been tested, it might not
+# warning work as expected, and performance is likely to be suboptimal.
+#endif
+
#include
#include
#include
@@ -196,7 +211,7 @@
}
}
-#ifndef __GNUC__
+#if !defined(__clang__) && !defined(__GNUC__)
# ifdef __attribute__
# undef __attribute__
# endif
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/private/ed25519_ref10.h libsodium-1.0.18/src/libsodium/include/sodium/private/ed25519_ref10.h
--- libsodium-1.0.16/src/libsodium/include/sodium/private/ed25519_ref10.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/private/ed25519_ref10.h 2019-05-30 20:13:18.000000000 +0000
@@ -110,16 +110,33 @@
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.
*/
-void sc25519_reduce(unsigned char *s);
+void sc25519_invert(unsigned char recip[32], const unsigned char s[32]);
+
+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, const unsigned char *a,
- const unsigned char *b, const unsigned char *c);
+void sc25519_muladd(unsigned char s[32], const unsigned char a[32],
+ const unsigned char b[32], const unsigned char c[32]);
-int sc25519_is_canonical(const unsigned char *s);
+int sc25519_is_canonical(const unsigned char s[32]);
#endif
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/randombytes.h libsodium-1.0.18/src/libsodium/include/sodium/randombytes.h
--- libsodium-1.0.16/src/libsodium/include/sodium/randombytes.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/randombytes.h 2019-05-30 20:13:18.000000000 +0000
@@ -32,11 +32,13 @@
size_t randombytes_seedbytes(void);
SODIUM_EXPORT
-void randombytes_buf(void * const buf, const size_t size);
+void randombytes_buf(void * const buf, const size_t size)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
void randombytes_buf_deterministic(void * const buf, const size_t size,
- const unsigned char seed[randombytes_SEEDBYTES]);
+ const unsigned char seed[randombytes_SEEDBYTES])
+ __attribute__ ((nonnull));
SODIUM_EXPORT
uint32_t randombytes_random(void);
@@ -51,7 +53,8 @@
int randombytes_close(void);
SODIUM_EXPORT
-int randombytes_set_implementation(randombytes_implementation *impl);
+int randombytes_set_implementation(randombytes_implementation *impl)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
const char *randombytes_implementation_name(void);
@@ -59,7 +62,8 @@
/* -- NaCl compatibility interface -- */
SODIUM_EXPORT
-void randombytes(unsigned char * const buf, const unsigned long long buf_len);
+void randombytes(unsigned char * const buf, const unsigned long long buf_len)
+ __attribute__ ((nonnull));
#ifdef __cplusplus
}
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium/randombytes_internal_random.h libsodium-1.0.18/src/libsodium/include/sodium/randombytes_internal_random.h
--- libsodium-1.0.16/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.16/src/libsodium/include/sodium/randombytes_nativeclient.h libsodium-1.0.18/src/libsodium/include/sodium/randombytes_nativeclient.h
--- libsodium-1.0.16/src/libsodium/include/sodium/randombytes_nativeclient.h 2017-12-13 09:24:13.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.16/src/libsodium/include/sodium/randombytes_salsa20_random.h libsodium-1.0.18/src/libsodium/include/sodium/randombytes_salsa20_random.h
--- libsodium-1.0.16/src/libsodium/include/sodium/randombytes_salsa20_random.h 2017-12-13 09:24:13.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.16/src/libsodium/include/sodium/utils.h libsodium-1.0.18/src/libsodium/include/sodium/utils.h
--- libsodium-1.0.16/src/libsodium/include/sodium/utils.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/include/sodium/utils.h 2019-05-30 20:13:18.000000000 +0000
@@ -42,8 +42,7 @@
*/
SODIUM_EXPORT
int sodium_compare(const unsigned char *b1_, const unsigned char *b2_,
- size_t len)
- __attribute__ ((warn_unused_result));
+ size_t len) __attribute__ ((warn_unused_result));
SODIUM_EXPORT
int sodium_is_zero(const unsigned char *n, const size_t nlen);
@@ -55,14 +54,19 @@
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);
+
+SODIUM_EXPORT
char *sodium_bin2hex(char * const hex, const size_t hex_maxlen,
- const unsigned char * const bin, const size_t bin_len);
+ const unsigned char * const bin, const size_t bin_len)
+ __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);
+ const char ** const hex_end)
+ __attribute__ ((nonnull(1)));
#define sodium_base64_VARIANT_ORIGINAL 1
#define sodium_base64_VARIANT_ORIGINAL_NO_PADDING 3
@@ -84,19 +88,22 @@
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);
+ 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);
+ const char ** const b64_end, const int variant)
+ __attribute__ ((nonnull(1)));
SODIUM_EXPORT
-int sodium_mlock(void * const addr, const size_t len);
+int sodium_mlock(void * const addr, const size_t len)
+ __attribute__ ((nonnull));
SODIUM_EXPORT
-int sodium_munlock(void * const addr, const size_t len);
+int sodium_munlock(void * const addr, const size_t len)
+ __attribute__ ((nonnull));
/* WARNING: sodium_malloc() and sodium_allocarray() are not general-purpose
* allocation functions.
@@ -143,21 +150,23 @@
void sodium_free(void *ptr);
SODIUM_EXPORT
-int sodium_mprotect_noaccess(void *ptr);
+int sodium_mprotect_noaccess(void *ptr) __attribute__ ((nonnull));
SODIUM_EXPORT
-int sodium_mprotect_readonly(void *ptr);
+int sodium_mprotect_readonly(void *ptr) __attribute__ ((nonnull));
SODIUM_EXPORT
-int sodium_mprotect_readwrite(void *ptr);
+int sodium_mprotect_readwrite(void *ptr) __attribute__ ((nonnull));
SODIUM_EXPORT
int sodium_pad(size_t *padded_buflen_p, unsigned char *buf,
- size_t unpadded_buflen, size_t blocksize, size_t max_buflen);
+ size_t unpadded_buflen, size_t blocksize, size_t max_buflen)
+ __attribute__ ((nonnull(2)));
SODIUM_EXPORT
int sodium_unpad(size_t *unpadded_buflen_p, const unsigned char *buf,
- size_t padded_buflen, size_t blocksize);
+ size_t padded_buflen, size_t blocksize)
+ __attribute__ ((nonnull(2)));
/* -------- */
diff -Nru libsodium-1.0.16/src/libsodium/include/sodium.h libsodium-1.0.18/src/libsodium/include/sodium.h
--- libsodium-1.0.16/src/libsodium/include/sodium.h 2017-12-13 09:24:13.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.16/src/libsodium/Makefile.am libsodium-1.0.18/src/libsodium/Makefile.am
--- libsodium-1.0.16/src/libsodium/Makefile.am 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/Makefile.am 2019-05-30 20:13:18.000000000 +0000
@@ -82,6 +82,7 @@
crypto_stream/salsa20/stream_salsa20.h \
crypto_stream/xsalsa20/stream_xsalsa20.c \
crypto_verify/sodium/verify.c \
+ include/sodium/private/chacha20_ietf_ext.h \
include/sodium/private/common.h \
include/sodium/private/ed25519_ref10.h \
include/sodium/private/implementations.h \
@@ -151,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 \
@@ -159,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 \
@@ -170,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) \
@@ -201,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.16/src/libsodium/randombytes/internal/randombytes_internal_random.c libsodium-1.0.18/src/libsodium/randombytes/internal/randombytes_internal_random.c
--- libsodium-1.0.16/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.16/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c libsodium-1.0.18/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c
--- libsodium-1.0.16/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c 2017-12-13 09:24:13.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.16/src/libsodium/randombytes/randombytes.c libsodium-1.0.18/src/libsodium/randombytes/randombytes.c
--- libsodium-1.0.16/src/libsodium/randombytes/randombytes.c 2017-12-13 09:24:13.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
@@ -107,7 +100,7 @@
try {
var crypto = require('crypto');
var randomValueNodeJS = function() {
- var buf = crypto.randomBytes(4);
+ var buf = crypto['randomBytes'](4);
return (buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]) >>> 0;
};
randomValueNodeJS();
diff -Nru libsodium-1.0.16/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c libsodium-1.0.18/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c
--- libsodium-1.0.16/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c 1970-01-01 00:00:00.000000000 +0000
@@ -1,564 +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
-# else
-# include
-# endif
-# 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)
-{
- stream.nonce = sodium_hrtime();
- assert(stream.nonce != (uint64_t) 0U);
- 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_);
-}
-
-# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) && !defined(NO_BLOCKING_RANDOM_POLL)
-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;
-
-# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) && !defined(NO_BLOCKING_RANDOM_POLL)
- 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
-
-# if defined(__dietlibc__) || (defined(SYS_getrandom) && defined(__NR_getrandom))
-static int
-_randombytes_linux_getrandom(void * const buf, const size_t size)
-{
- int readnb;
-
- assert(size <= 256U);
- do {
-# ifdef __dietlibc__
- readnb = getrandom(buf, size, 0);
-# else
- readnb = syscall(SYS_getrandom, buf, (int) size, 0);
-# endif
- } 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;
-
- stream.nonce = sodium_hrtime();
- global.rdrand_available = sodium_runtime_has_rdrand();
- assert(stream.nonce != (uint64_t) 0U);
-
-# ifdef HAVE_SAFE_ARC4RANDOM
- errno = errno_save;
-# else
-
-# if defined(SYS_getrandom) && defined(__NR_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 /* SYS_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)
-{
- unsigned char m0[crypto_stream_salsa20_KEYBYTES +
- crypto_stream_salsa20_NONCEBYTES];
-
- 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(m0, sizeof m0);
-# elif defined(SYS_getrandom) && defined(__NR_getrandom)
- if (global.getrandom_available != 0) {
- if (randombytes_linux_getrandom(m0, sizeof m0) != 0) {
- sodium_misuse(); /* LCOV_EXCL_LINE */
- }
- } else if (global.random_data_source_fd == -1 ||
- safe_read(global.random_data_source_fd, m0,
- sizeof m0) != (ssize_t) sizeof m0) {
- sodium_misuse(); /* LCOV_EXCL_LINE */
- }
-# else
- if (global.random_data_source_fd == -1 ||
- safe_read(global.random_data_source_fd, m0,
- sizeof m0) != (ssize_t) sizeof m0) {
- sodium_misuse(); /* LCOV_EXCL_LINE */
- }
-# endif
-
-#else /* _WIN32 */
- if (! RtlGenRandom((PVOID) m0, (ULONG) sizeof m0)) {
- sodium_misuse(); /* LCOV_EXCL_LINE */
- }
-#endif
-
- crypto_stream_salsa20(stream.key, sizeof stream.key,
- m0 + crypto_stream_salsa20_KEYBYTES, m0);
- sodium_memzero(m0, sizeof m0);
- 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
-
-# if defined(SYS_getrandom) && defined(__NR_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(ULONG_LONG_MAX) && defined(SIZE_MAX)
-# if SIZE_MAX > ULONG_LONG_MAX
- /* coverity[result_independent_of_operands] */
- assert(size <= ULONG_LONG_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.16/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c libsodium-1.0.18/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c
--- libsodium-1.0.16/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c 2019-05-30 20:13:18.000000000 +0000
@@ -8,19 +8,39 @@
#ifndef _WIN32
# include
#endif
-
#include
+
#include
#ifndef _WIN32
# include
# include
#endif
#ifdef __linux__
-# ifdef __dietlibc__
-# define _LINUX_SOURCE
+# 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
@@ -55,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
@@ -88,7 +108,7 @@
return 0;
}
-#else /* __OpenBSD__ */
+#else /* HAVE_SAFE_ARC4RANDOM */
typedef struct SysRandom_ {
int random_data_source_fd;
@@ -102,7 +122,7 @@
SODIUM_C99(.getrandom_available =) 0
};
-#ifndef _WIN32
+# ifndef _WIN32
static ssize_t
safe_read(const int fd, void * const buf_, size_t size)
{
@@ -126,10 +146,8 @@
return (ssize_t) (buf - (unsigned char *) buf_);
}
-#endif
-#ifndef _WIN32
-# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) && !defined(NO_BLOCKING_RANDOM_POLL)
+# ifdef BLOCK_ON_DEV_RANDOM
static int
randombytes_block_on_dev_random(void)
{
@@ -154,7 +172,7 @@
}
return close(fd);
}
-# endif
+# endif /* BLOCK_ON_DEV_RANDOM */
static int
randombytes_sysrandom_random_dev_open(void)
@@ -162,34 +180,34 @@
/* LCOV_EXCL_START */
struct stat st;
static const char *devices[] = {
-# ifndef USE_BLOCKING_RANDOM
+# ifndef USE_BLOCKING_RANDOM
"/dev/urandom",
-# endif
+# endif
"/dev/random", NULL
};
const char **device = devices;
int fd;
-# if defined(__linux__) && !defined(USE_BLOCKING_RANDOM) && !defined(NO_BLOCKING_RANDOM_POLL)
+# ifdef BLOCK_ON_DEV_RANDOM
if (randombytes_block_on_dev_random() != 0) {
return -1;
}
-# endif
+# endif
do {
fd = open(*device, O_RDONLY);
if (fd != -1) {
if (fstat(fd, &st) == 0 &&
-# ifdef __COMPCERT__
+# ifdef __COMPCERT__
1
-# elif defined(S_ISNAM)
+# elif defined(S_ISNAM)
(S_ISNAM(st.st_mode) || S_ISCHR(st.st_mode))
-# else
+# else
S_ISCHR(st.st_mode)
-# endif
+# endif
) {
-# if defined(F_SETFD) && defined(FD_CLOEXEC)
+# if defined(F_SETFD) && defined(FD_CLOEXEC)
(void) fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
-# endif
+# endif
return fd;
}
(void) close(fd);
@@ -204,7 +222,7 @@
/* LCOV_EXCL_STOP */
}
-# if defined(__dietlibc__) || (defined(SYS_getrandom) && defined(__NR_getrandom))
+# ifdef HAVE_LINUX_COMPATIBLE_GETRANDOM
static int
_randombytes_linux_getrandom(void * const buf, const size_t size)
{
@@ -212,11 +230,7 @@
assert(size <= 256U);
do {
-# ifdef __dietlibc__
readnb = getrandom(buf, size, 0);
-# else
- readnb = syscall(SYS_getrandom, buf, (int) size, 0);
-# endif
} while (readnb < 0 && (errno == EINTR || errno == EAGAIN));
return (readnb == (int) size) - 1;
@@ -242,14 +256,14 @@
return 0;
}
-# endif
+# endif /* HAVE_LINUX_COMPATIBLE_GETRANDOM */
static void
randombytes_sysrandom_init(void)
{
const int errno_save = errno;
-# if defined(SYS_getrandom) && defined(__NR_getrandom)
+# ifdef HAVE_LINUX_COMPATIBLE_GETRANDOM
{
unsigned char fodder[16];
@@ -260,7 +274,7 @@
}
stream.getrandom_available = 0;
}
-# endif
+# endif
if ((stream.random_data_source_fd =
randombytes_sysrandom_random_dev_open()) == -1) {
@@ -269,13 +283,13 @@
errno = errno_save;
}
-#else /* _WIN32 */
+# else /* _WIN32 */
static void
randombytes_sysrandom_init(void)
{
}
-#endif
+# endif /* _WIN32 */
static void
randombytes_sysrandom_stir(void)
@@ -299,24 +313,24 @@
{
int ret = -1;
-#ifndef _WIN32
+# ifndef _WIN32
if (stream.random_data_source_fd != -1 &&
close(stream.random_data_source_fd) == 0) {
stream.random_data_source_fd = -1;
stream.initialized = 0;
ret = 0;
}
-# if defined(SYS_getrandom) && defined(__NR_getrandom)
+# ifdef HAVE_LINUX_COMPATIBLE_GETRANDOM
if (stream.getrandom_available != 0) {
ret = 0;
}
-# endif
-#else /* _WIN32 */
+# endif
+# else /* _WIN32 */
if (stream.initialized != 0) {
stream.initialized = 0;
ret = 0;
}
-#endif
+# endif /* _WIN32 */
return ret;
}
@@ -324,26 +338,26 @@
randombytes_sysrandom_buf(void * const buf, const size_t size)
{
randombytes_sysrandom_stir_if_needed();
-#if defined(ULONG_LONG_MAX) && defined(SIZE_MAX)
-# if SIZE_MAX > ULONG_LONG_MAX
+# if defined(ULLONG_MAX) && defined(SIZE_MAX)
+# if SIZE_MAX > ULLONG_MAX
/* coverity[result_independent_of_operands] */
- assert(size <= ULONG_LONG_MAX);
+ assert(size <= ULLONG_MAX);
+# endif
# endif
-#endif
-#ifndef _WIN32
-# if defined(SYS_getrandom) && defined(__NR_getrandom)
+# ifndef _WIN32
+# ifdef HAVE_LINUX_COMPATIBLE_GETRANDOM
if (stream.getrandom_available != 0) {
if (randombytes_linux_getrandom(buf, size) != 0) {
sodium_misuse(); /* LCOV_EXCL_LINE */
}
return;
}
-# endif
+# endif
if (stream.random_data_source_fd == -1 ||
safe_read(stream.random_data_source_fd, buf, size) != (ssize_t) size) {
sodium_misuse(); /* LCOV_EXCL_LINE */
}
-#else
+# else /* _WIN32 */
COMPILER_ASSERT(randombytes_BYTES_MAX <= 0xffffffffUL);
if (size > (size_t) 0xffffffffUL) {
sodium_misuse(); /* LCOV_EXCL_LINE */
@@ -351,7 +365,7 @@
if (! RtlGenRandom((PVOID) buf, (ULONG) size)) {
sodium_misuse(); /* LCOV_EXCL_LINE */
}
-#endif
+# endif /* _WIN32 */
}
static uint32_t
@@ -364,7 +378,7 @@
return r;
}
-#endif /* __OpenBSD__ */
+#endif /* HAVE_SAFE_ARC4RANDOM */
static const char *
randombytes_sysrandom_implementation_name(void)
diff -Nru libsodium-1.0.16/src/libsodium/sodium/core.c libsodium-1.0.18/src/libsodium/sodium/core.c
--- libsodium-1.0.16/src/libsodium/sodium/core.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/sodium/core.c 2019-05-30 20:13:18.000000000 +0000
@@ -21,21 +21,6 @@
#include "private/implementations.h"
#include "private/mutex.h"
-#if !defined(_MSC_VER) && 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.
-# warning Do not use this in production.
-# warning Use releases available at https://download.libsodium.org/libsodium/releases/ instead.
-# warning Alternatively, use the "stable" branch in the git repository.
-#endif
-
-#if !defined(_MSC_VER) && (!defined(CONFIGURED) || CONFIGURED != 1)
-# warning *** The library is being compiled using an undocumented method.
-# warning This is not supported. It has not been tested, it might not
-# warning work as expected, and performance is likely to be suboptimal.
-#endif
-
static volatile int initialized;
static volatile int locked;
@@ -140,8 +125,6 @@
int
sodium_crit_leave(void)
{
- int ret;
-
if (locked == 0) {
# ifdef EPERM
errno = EPERM;
@@ -153,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.16/src/libsodium/sodium/runtime.c libsodium-1.0.18/src/libsodium/sodium/runtime.c
--- libsodium-1.0.16/src/libsodium/sodium/runtime.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/sodium/runtime.c 2019-05-30 20:13:18.000000000 +0000
@@ -39,8 +39,11 @@
#define CPUID_EDX_SSE2 0x04000000
-#define XCR0_SSE 0x00000002
-#define XCR0_AVX 0x00000004
+#define XCR0_SSE 0x00000002
+#define XCR0_AVX 0x00000004
+#define XCR0_OPMASK 0x00000020
+#define XCR0_ZMM_HI256 0x00000040
+#define XCR0_HI16_ZMM 0x00000080
static int
_sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
@@ -114,6 +117,7 @@
{
unsigned int cpu_info[4];
unsigned int id;
+ uint32_t xcr0 = 0U;
_cpuid(cpu_info, 0x0);
if ((id = cpu_info[0]) == 0U) {
@@ -145,18 +149,31 @@
#endif
cpu_features->has_avx = 0;
+
+ (void) xcr0;
#ifdef HAVE_AVXINTRIN_H
if ((cpu_info[2] & (CPUID_ECX_AVX | CPUID_ECX_XSAVE | CPUID_ECX_OSXSAVE)) ==
(CPUID_ECX_AVX | CPUID_ECX_XSAVE | CPUID_ECX_OSXSAVE)) {
- uint32_t xcr0 = 0U;
+ xcr0 = 0U;
# if defined(HAVE__XGETBV) || \
(defined(_MSC_VER) && defined(_XCR_XFEATURE_ENABLED_MASK) && _MSC_FULL_VER >= 160040219)
xcr0 = (uint32_t) _xgetbv(0);
# elif defined(_MSC_VER) && defined(_M_IX86)
+ /*
+ * Visual Studio documentation states that eax/ecx/edx don't need to
+ * be preserved in inline assembly code. But that doesn't seem to
+ * always hold true on Visual Studio 2010.
+ */
__asm {
+ push eax
+ push ecx
+ push edx
xor ecx, ecx
_asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0
mov xcr0, eax
+ pop edx
+ pop ecx
+ pop eax
}
# elif defined(HAVE_AVX_ASM)
__asm__ __volatile__(".byte 0x0f, 0x01, 0xd0" /* XGETBV */
@@ -186,7 +203,13 @@
unsigned int cpu_info7[4];
_cpuid(cpu_info7, 0x00000007);
- cpu_features->has_avx512f = ((cpu_info7[1] & CPUID_EBX_AVX512F) != 0x0);
+ /* 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.16/src/libsodium/sodium/utils.c libsodium-1.0.18/src/libsodium/sodium/utils.c
--- libsodium-1.0.16/src/libsodium/sodium/utils.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/src/libsodium/sodium/utils.c 2019-05-30 20:13:18.000000000 +0000
@@ -25,7 +25,7 @@
# ifdef HAVE_ALLOCA_H
# include
# elif !defined(alloca)
-# if defined(__GNUC__)
+# if defined(__clang__) || defined(__GNUC__)
# define alloca __builtin_alloca
# elif defined _AIX
# define alloca __alloca
@@ -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);
@@ -110,11 +110,15 @@
}
#elif defined(HAVE_EXPLICIT_BZERO)
explicit_bzero(pnt, len);
+#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);
-# ifdef HAVE_AMD64_ASM
- __asm__ __volatile__ ("" : : "p"(pnt));
+ 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
#else
volatile unsigned char *volatile pnt_ =
@@ -287,7 +291,7 @@
void
sodium_add(unsigned char *a, const unsigned char *b, const size_t len)
{
- size_t i = 0U;
+ size_t i;
uint_fast16_t c = 0U;
#ifdef HAVE_AMD64_ASM
@@ -326,13 +330,56 @@
return;
}
#endif
- for (; i < len; i++) {
+ for (i = 0U; i < len; i++) {
c += (uint_fast16_t) a[i] + (uint_fast16_t) b[i];
a[i] = (unsigned char) c;
c >>= 8;
}
}
+void
+sodium_sub(unsigned char *a, const unsigned char *b, const size_t len)
+{
+ uint_fast16_t c = 0U;
+ size_t i;
+
+#ifdef HAVE_AMD64_ASM
+ uint64_t t64_1, t64_2, t64_3, t64_4;
+ uint64_t t64_5, t64_6, t64_7, t64_8;
+ uint32_t t32;
+
+ if (len == 64U) {
+ __asm__ __volatile__(
+ "movq (%[in]), %[t64_1] \n"
+ "movq 8(%[in]), %[t64_2] \n"
+ "movq 16(%[in]), %[t64_3] \n"
+ "movq 24(%[in]), %[t64_4] \n"
+ "movq 32(%[in]), %[t64_5] \n"
+ "movq 40(%[in]), %[t64_6] \n"
+ "movq 48(%[in]), %[t64_7] \n"
+ "movq 56(%[in]), %[t64_8] \n"
+ "subq %[t64_1], (%[out]) \n"
+ "sbbq %[t64_2], 8(%[out]) \n"
+ "sbbq %[t64_3], 16(%[out]) \n"
+ "sbbq %[t64_4], 24(%[out]) \n"
+ "sbbq %[t64_5], 32(%[out]) \n"
+ "sbbq %[t64_6], 40(%[out]) \n"
+ "sbbq %[t64_7], 48(%[out]) \n"
+ "sbbq %[t64_8], 56(%[out]) \n"
+ : [t64_1] "=&r"(t64_1), [t64_2] "=&r"(t64_2), [t64_3] "=&r"(t64_3), [t64_4] "=&r"(t64_4),
+ [t64_5] "=&r"(t64_5), [t64_6] "=&r"(t64_6), [t64_7] "=&r"(t64_7), [t64_8] "=&r"(t64_8)
+ : [in] "S"(b), [out] "D"(a)
+ : "memory", "flags", "cc");
+ return;
+ }
+#endif
+ for (i = 0U; i < len; i++) {
+ c = (uint_fast16_t) a[i] - (uint_fast16_t) b[i] - c;
+ a[i] = (unsigned char) c;
+ c = (c >> 8) & 1U;
+ }
+}
+
int
_sodium_alloc_init(void)
{
@@ -436,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 */
@@ -573,15 +622,11 @@
__attribute__((malloc)) void *
sodium_allocarray(size_t count, size_t size)
{
- size_t total_size;
-
if (count > (size_t) 0U && size >= (size_t) SIZE_MAX / count) {
errno = ENOMEM;
return NULL;
}
- total_size = count * size;
-
- return sodium_malloc(total_size);
+ return sodium_malloc(count * size);
}
#ifndef HAVE_ALIGNED_MALLOC
@@ -699,8 +744,9 @@
}
mask = 0U;
for (i = 0; i < blocksize; i++) {
- barrier_mask = (unsigned char) (((i ^ xpadlen) - 1U) >> 8);
- tail[-i] = (tail[-i] & mask) | (0x80 & barrier_mask);
+ barrier_mask = (unsigned char) (((i ^ xpadlen) - 1U)
+ >> ((sizeof(size_t) - 1) * CHAR_BIT));
+ *(tail - i) = ((*(tail - i)) & mask) | (0x80 & barrier_mask);
mask |= barrier_mask;
}
return 0;
@@ -724,7 +770,7 @@
tail = &buf[padded_buflen - 1U];
for (i = 0U; i < blocksize; i++) {
- c = tail[-i];
+ c = *(tail - i);
is_barrier =
(( (acc - 1U) & (pad_len - 1U) & ((c ^ 0x80) - 1U) ) >> 8) & 1U;
acc |= c;
diff -Nru libsodium-1.0.16/test/constcheck.sh libsodium-1.0.18/test/constcheck.sh
--- libsodium-1.0.16/test/constcheck.sh 2017-12-13 09:24:13.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.16/test/default/aead_aes256gcm2.c libsodium-1.0.18/test/default/aead_aes256gcm2.c
--- libsodium-1.0.16/test/default/aead_aes256gcm2.c 1970-01-01 00:00:00.000000000 +0000
+++ libsodium-1.0.18/test/default/aead_aes256gcm2.c 2019-05-30 20:13:18.000000000 +0000
@@ -0,0 +1,276 @@
+
+#define TEST_NAME "aead_aes256gcm2"
+#include "cmptest.h"
+
+static struct {
+ const char *key_hex;
+ const char nonce_hex[crypto_aead_aes256gcm_NPUBBYTES * 2 + 1];
+ const char *ad_hex;
+ const char *message_hex;
+ const char *detached_ciphertext_hex;
+ const char mac_hex[crypto_aead_aes256gcm_ABYTES * 2 + 1];
+ const char *outcome;
+} tests[] = {
+ { "92ace3e348cd821092cd921aa3546374299ab46209691bc28b8752d17f123c20",
+ "00112233445566778899aabb", "00000000ffffffff", "00010203040506070809",
+ "e27abdd2d2a53d2f136b", "9a4a2579529301bcfb71c78d4060f52c", "valid" },
+ { "29d3a44f8723dc640239100c365423a312934ac80239212ac3df3421a2098123",
+ "00112233445566778899aabb", "aabbccddeeff", "", "",
+ "2a7d77fa526b8250cb296078926b5020", "valid" },
+ { "cc56b680552eb75008f5484b4cb803fa5063ebd6eab91f6ab6aef4916a766273",
+ "99e23ec48985bccdeeab60f1", "", "2a", "06",
+ "633c1e9703ef744ffffb40edf9d14355", "valid" },
+ { "51e4bf2bad92b7aff1a4bc05550ba81df4b96fabf41c12c7b00e60e48db7e152",
+ "4f07afedfdc3b6c2361823d3", "", "be3308f72a2c6aed", "cf332a12fdee800b",
+ "602e8d7c4799d62c140c9bb834876b09", "valid" },
+ { "67119627bd988eda906219e08c0d0d779a07d208ce8a4fe0709af755eeec6dcb",
+ "68ab7fdbf61901dad461d23c", "", "51f8c1f731ea14acdb210a6d973e07",
+ "43fc101bff4b32bfadd3daf57a590e", "ec04aacb7148a8b8be44cb7eaf4efa69",
+ "valid" },
+ { "59d4eafb4de0cfc7d3db99a8f54b15d7b39f0acc8da69763b019c1699f87674a",
+ "2fcb1b38a99e71b84740ad9b", "", "549b365af913f3b081131ccb6b825588",
+ "f58c16690122d75356907fd96b570fca", "28752c20153092818faba2a334640d6e",
+ "valid" },
+ { "3b2458d8176e1621c0cc24c0c0e24c1e80d72f7ee9149a4b166176629616d011",
+ "45aaa3e5d16d2d42dc03445d", "", "3ff1514b1c503915918f0c0c31094a6e1f",
+ "73a6b6f45f6ccc5131e07f2caa1f2e2f56", "2d7379ec1db5952d4e95d30c340b1b1d",
+ "valid" },
+ { "0212a8de5007ed87b33f1a7090b6114f9e08cefd9607f2c276bdcfdbc5ce9cd7",
+ "e6b1adf2fd58a8762c65f31b", "",
+ "10f1ecf9c60584665d9ae5efe279e7f7377eea6916d2b111",
+ "0843fff52d934fc7a071ea62c0bd351ce85678cde3ea2c9e",
+ "7355fde599006715053813ce696237a8", "valid" },
+ { "b279f57e19c8f53f2f963f5f2519fdb7c1779be2ca2b3ae8e1128b7d6c627fc4",
+ "98bc2c7438d5cd7665d76f6e", "c0",
+ "fcc515b294408c8645c9183e3f4ecee5127846d1",
+ "eb5500e3825952866d911253f8de860c00831c81",
+ "ecb660e1fb0541ec41e8d68a64141b3a", "valid" },
+ { "cdccfe3f46d782ef47df4e72f0c02d9c7f774def970d23486f11a57f54247f17",
+ "376187894605a8d45e30de51", "956846a209e087ed",
+ "e28e0e9f9d22463ac0e42639b530f42102fded75",
+ "feca44952447015b5df1f456df8ca4bb4eee2ce2",
+ "082e91924deeb77880e1b1c84f9b8d30", "valid" },
+ { "f32364b1d339d82e4f132d8f4a0ec1ff7e746517fa07ef1a7f422f4e25a48194",
+ "5a86a50a0e8a179c734b996d", "ab2ac7c44c60bdf8228c7884adb20184",
+ "43891bccb522b1e72a6b53cf31c074e9d6c2df8e",
+ "43dda832e942e286da314daa99bef5071d9d2c78",
+ "c3922583476ced575404ddb85dd8cd44", "valid" },
+ { "ff0089ee870a4a39f645b0a5da774f7a5911e9696fc9cad646452c2aa8595a12",
+ "bc2a7757d0ce2d8b1f14ccd9",
+ "972ab4e06390caae8f99dd6e2187be6c7ff2c08a24be16ef",
+ "748b28031621d95ee61812b4b4f47d04c6fc2ff3",
+ "a929ee7e67c7a2f91bbcec6389a3caf43ab49305",
+ "ebec6774b955e789591c822dab739e12", "valid" },
+ { "00112233445566778899aabbccddeeff102132435465768798a9bacbdcedfe0f",
+ "000000000000000000000000", "", "561008fa07a68f5c61285cd013464eaf",
+ "23293e9b07ca7d1b0cae7cc489a973b3", "ffffffffffffffffffffffffffffffff",
+ "valid" },
+ { "00112233445566778899aabbccddeeff102132435465768798a9bacbdcedfe0f",
+ "ffffffffffffffffffffffff", "", "c6152244cea1978d3e0bc274cf8c0b3b",
+ "7cb6fc7c6abc009efe9551a99f36a421", "00000000000000000000000000000000",
+ "valid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9de8fef6d8ab1bf1bf887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ee8fef6d8ab1bf1bf887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "1ce8fef6d8ab1bf1bf887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce9fef6d8ab1bf1bf887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fe76d8ab1bf1bf887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d9ab1bf1bf887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6daab1bf1bf887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1b71bf887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1be887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf13f887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bfa87232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887332eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232ebb590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232e8b590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf8872326ab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232eab590dc",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232eab590df",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232eab5909d",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232eab5905d",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9de8fef6d8ab1bf1be887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fe76d8ab1b71bf887232eab590dd",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1b71bf887232eab5905d",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "631701092754e40e40778dcd154a6f22",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "00000000000000000000000000000000",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "ffffffffffffffffffffffffffffffff",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "1c687e76582b9b713f08f2b26a35105d",
+ "invalid" },
+ { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
+ "505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
+ "b2061457c0759fc1749f174ee1ccadfa", "9de9fff7d9aa1af0be897333ebb491dc",
+ "invalid" }
+};
+
+static int
+tv(void)
+{
+ unsigned char *ad;
+ unsigned char *decrypted;
+ unsigned char *detached_ciphertext;
+ unsigned char *key;
+ unsigned char *message;
+ unsigned char *mac;
+ unsigned char *nonce;
+ size_t ad_len;
+ size_t detached_ciphertext_len;
+ size_t message_len;
+ unsigned int i;
+
+ key = (unsigned char *) sodium_malloc(crypto_aead_aes256gcm_KEYBYTES);
+ nonce = (unsigned char *) sodium_malloc(crypto_aead_aes256gcm_NPUBBYTES);
+ mac = (unsigned char *) sodium_malloc(crypto_aead_aes256gcm_ABYTES);
+
+ for (i = 0U; i < (sizeof tests) / (sizeof tests[0]); i++) {
+ assert(strlen(tests[i].key_hex) == 2 * crypto_aead_aes256gcm_KEYBYTES);
+ sodium_hex2bin(key, crypto_aead_aes256gcm_KEYBYTES, tests[i].key_hex,
+ strlen(tests[i].key_hex), NULL, NULL, NULL);
+
+ assert(strlen(tests[i].nonce_hex) ==
+ 2 * crypto_aead_aes256gcm_NPUBBYTES);
+ sodium_hex2bin(nonce, crypto_aead_aes256gcm_NPUBBYTES,
+ tests[i].nonce_hex, strlen(tests[i].nonce_hex), NULL,
+ NULL, NULL);
+
+ message_len = strlen(tests[i].message_hex) / 2;
+ message = (unsigned char *) sodium_malloc(message_len);
+ sodium_hex2bin(message, message_len, tests[i].message_hex,
+ strlen(tests[i].message_hex), NULL, NULL, NULL);
+
+ ad_len = strlen(tests[i].ad_hex) / 2;
+ ad = (unsigned char *) sodium_malloc(ad_len);
+ sodium_hex2bin(ad, ad_len, tests[i].ad_hex, strlen(tests[i].ad_hex),
+ NULL, NULL, NULL);
+
+ detached_ciphertext_len = message_len;
+ assert(strlen(tests[i].detached_ciphertext_hex) == 2 * message_len);
+ assert(strlen(tests[i].mac_hex) == 2 * crypto_aead_aes256gcm_ABYTES);
+ sodium_hex2bin(mac, crypto_aead_aes256gcm_ABYTES, tests[i].mac_hex,
+ strlen(tests[i].mac_hex), NULL, NULL, NULL);
+
+ detached_ciphertext =
+ (unsigned char *) sodium_malloc(detached_ciphertext_len);
+ sodium_hex2bin(detached_ciphertext, detached_ciphertext_len,
+ tests[i].detached_ciphertext_hex,
+ strlen(tests[i].detached_ciphertext_hex), NULL, NULL,
+ NULL);
+
+ decrypted = (unsigned char *) sodium_malloc(message_len);
+ if (crypto_aead_aes256gcm_decrypt_detached(
+ decrypted, NULL, detached_ciphertext, detached_ciphertext_len,
+ mac, ad, ad_len, nonce, key) == 0) {
+ if (strcmp(tests[i].outcome, "valid") != 0) {
+ printf("*** test case %u succeeded, was supposed to be %s\n", i,
+ tests[i].outcome);
+ }
+ if (memcmp(decrypted, message, message_len) != 0) {
+ printf("Incorrect decryption of test vector #%u\n",
+ (unsigned int) i);
+ }
+ } else {
+ if (strcmp(tests[i].outcome, "invalid") != 0) {
+ printf("*** test case %u failed, was supposed to be %s\n", i,
+ tests[i].outcome);
+ }
+ }
+
+ sodium_free(message);
+ sodium_free(ad);
+ sodium_free(decrypted);
+ sodium_free(detached_ciphertext);
+ }
+
+ sodium_free(key);
+ sodium_free(mac);
+ sodium_free(nonce);
+
+ return 0;
+}
+
+int
+main(void)
+{
+ if (crypto_aead_aes256gcm_is_available()) {
+ tv();
+ }
+ printf("OK\n");
+
+ return 0;
+}
diff -Nru libsodium-1.0.16/test/default/aead_aes256gcm2.exp libsodium-1.0.18/test/default/aead_aes256gcm2.exp
--- libsodium-1.0.16/test/default/aead_aes256gcm2.exp 1970-01-01 00:00:00.000000000 +0000
+++ libsodium-1.0.18/test/default/aead_aes256gcm2.exp 2019-05-30 20:13:18.000000000 +0000
@@ -0,0 +1 @@
+OK
diff -Nru libsodium-1.0.16/test/default/aead_aes256gcm.c libsodium-1.0.18/test/default/aead_aes256gcm.c
--- libsodium-1.0.16/test/default/aead_aes256gcm.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/aead_aes256gcm.c 2019-05-30 20:13:18.000000000 +0000
@@ -3179,7 +3179,7 @@
printf("Message length should have been set to zero after a failure\n");
}
if (crypto_aead_aes256gcm_decrypt(decrypted, &found_message_len,
- NULL, NULL,
+ NULL, guard_page,
randombytes_uniform(crypto_aead_aes256gcm_ABYTES),
ad, ad_len, nonce, key) != -1) {
printf("Verification of test vector #%u with a truncated tag failed\n",
diff -Nru libsodium-1.0.16/test/default/aead_chacha20poly13052.c libsodium-1.0.18/test/default/aead_chacha20poly13052.c
--- libsodium-1.0.16/test/default/aead_chacha20poly13052.c 1970-01-01 00:00:00.000000000 +0000
+++ libsodium-1.0.18/test/default/aead_chacha20poly13052.c 2019-05-30 20:13:18.000000000 +0000
@@ -0,0 +1,1046 @@
+
+#define TEST_NAME "aead_chacha20poly13052"
+#include "cmptest.h"
+
+static struct {
+ const char *key_hex;
+ const char nonce_hex[crypto_aead_chacha20poly1305_ietf_NPUBBYTES * 2 + 1];
+ const char *ad_hex;
+ const char *message_hex;
+ const char *detached_ciphertext_hex;
+ const char mac_hex[crypto_aead_chacha20poly1305_ietf_ABYTES * 2 + 1];
+ const char *outcome;
+} tests[] = {
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "070000004041424344454647", "50515253c0c1c2c3c4c5c6c7",
+ "4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66"
+ "202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e6520"
+ "74697020666f7220746865206675747572652c2073756e73637265656e20776f756c6420"
+ "62652069742e",
+ "d31a8d34648e60db7b86afbc53ef7ec2a4aded51296e08fea9e2b5a736ee62d63dbea45e"
+ "8ca9671282fafb69da92728b1a71de0a9e060b2905d6a5b67ecd3b3692ddbd7f2d778b8c"
+ "9803aee328091b58fab324e4fad675945585808b4831d7bc3ff4def08e4b7a9de576d265"
+ "86cec64b6116",
+ "1ae10b594f09e26a7e902ecbd0600691", "valid" },
+ { "80ba3192c803ce965ea371d5ff073cf0f43b6a2ab576b208426e11409c09b9b0",
+ "4da5bf8dfd5852c1ea12379d", "", "", "",
+ "76acb342cf3166a5b63c0c0ea1383c8d", "valid" },
+ { "7a4cd759172e02eb204db2c3f5c746227df584fc1345196391dbb9577a250742",
+ "a92ef0ac991dd516a3c6f689", "bd506764f2d2c410", "", "",
+ "906fa6284b52f87b7359cbaa7563c709", "valid" },
+ { "cc56b680552eb75008f5484b4cb803fa5063ebd6eab91f6ab6aef4916a766273",
+ "99e23ec48985bccdeeab60f1", "", "2a", "3a",
+ "cac27dec0968801e9f6eded69d807522", "valid" },
+ { "46f0254965f769d52bdb4a70b443199f8ef207520d1220c55e4b70f0fda620ee",
+ "ab0dca716ee051d2782f4403", "91ca6c592cbcca53", "51", "c4",
+ "168310ca45b1f7c66cad4e99e43f72b9", "valid" },
+ { "2f7f7e4f592bb389194989743507bf3ee9cbde1786b6695fe6c025fd9ba4c100",
+ "461af122e9f2e0347e03f2db", "", "5c60", "4d13",
+ "91e8b61efb39c122195453077b22e5e2", "valid" },
+ { "c8833dce5ea9f248aa2030eacfe72bffe69a620caf793344e5718fe0d7ab1a58",
+ "61546ba5f1720590b6040ac6", "88364fc8060518bf", "ddf2", "b60d",
+ "ead0fd4697ec2e5558237719d02437a2", "valid" },
+ { "55568158d3a6483f1f7021eab69b703f614251cadc1af5d34a374fdbfc5adac7",
+ "3c4e654d663fa4596dc55bb7", "", "ab85e9c1571731", "5dfe3440dbb3c3",
+ "ed7a434e2602d394281e0afa9fb7aa42", "valid" },
+ { "e3c09e7fab1aefb516da6a33022a1dd4eb272c80d540c5da52a730f34d840d7f",
+ "58389375c69ee398de948396", "84e46be8c0919053", "4ee5cda20d4290",
+ "4bd47212941ce3", "185f1408ee7fbf18f5abad6e2253a1ba", "valid" },
+ { "51e4bf2bad92b7aff1a4bc05550ba81df4b96fabf41c12c7b00e60e48db7e152",
+ "4f07afedfdc3b6c2361823d3", "", "be3308f72a2c6aed", "8e9439a56eeec817",
+ "fbe8a6ed8fabb1937539dd6c00e90021", "valid" },
+ { "1131c1418577a054de7a4ac551950f1a053f9ae46e5b75fe4abd5608d7cddadd",
+ "b4ea666ee119563366484a78", "66c0ae70076cb14d", "a4c9c2801b71f7df",
+ "b9b910433af052b0", "4530f51aeee024e0a445a6328fa67a18", "valid" },
+ { "99b62bd5afbe3fb015bde93f0abf483957a1c3eb3ca59cb50b39f7f8a9cc51be",
+ "9a59fce26df0005e07538656", "", "42baae5978feaf5c368d14e0",
+ "ff7dc203b26c467a6b50db33", "578c0f2758c2e14e36d4fc106dcb29b4", "valid" },
+ { "85f35b6282cff440bc1020c8136ff27031110fa63ec16f1e825118b006b91257",
+ "58dbd4ad2c4ad35dd906e9ce", "a506e1a5c69093f9",
+ "fdc85b94a4b2a6b759b1a0da", "9f8816de0994e938d9e53f95",
+ "d086fc6c9d8fa915fd8423a7cf05072f", "valid" },
+ { "67119627bd988eda906219e08c0d0d779a07d208ce8a4fe0709af755eeec6dcb",
+ "68ab7fdbf61901dad461d23c", "", "51f8c1f731ea14acdb210a6d973e07",
+ "0b29638e1fbdd6df53970be2210042", "2a9134087d67a46e79178d0a93f5e1d2",
+ "valid" },
+ { "e6f1118d41e4b43fb58221b7ed79673834e0d8ac5c4fa60bbc8bc4893a58894d",
+ "d95b3243afaef714c5035b6a", "6453a53384632212",
+ "97469da667d6110f9cbda1d1a20673", "32db66c4a3819d81557455e5980fed",
+ "feae30dec94e6ad3a9eea06a0d703917", "valid" },
+ { "59d4eafb4de0cfc7d3db99a8f54b15d7b39f0acc8da69763b019c1699f87674a",
+ "2fcb1b38a99e71b84740ad9b", "", "549b365af913f3b081131ccb6b825588",
+ "e9110e9f56ab3ca483500ceabab67a13", "836ccabf15a6a22a51c1071cfa68fa0c",
+ "valid" },
+ { "b907a45075513fe8a8019edee3f2591487b2a030b03c6e1d771c862571d2ea1e",
+ "118a6964c2d3e380071f5266", "034585621af8d7ff",
+ "55a465644f5b650928cbee7c063214d6", "e4b113cb775945f3d3a8ae9ec141c00c",
+ "7c43f16ce096d0dc27c95849dc383b7d", "valid" },
+ { "3b2458d8176e1621c0cc24c0c0e24c1e80d72f7ee9149a4b166176629616d011",
+ "45aaa3e5d16d2d42dc03445d", "", "3ff1514b1c503915918f0c0c31094a6e1f",
+ "02cc3acb5ee1fcdd12a03bb857976474d3", "d83b7463a2c3800fe958c28eaa290813",
+ "valid" },
+ { "f60c6a1b625725f76c7037b48fe3577fa7f7b87b1bd5a982176d182306ffb870",
+ "f0384fb876121410633d993d", "9aaf299eeea78f79",
+ "63858ca3e2ce69887b578a3c167b421c9c",
+ "35766488d2bc7c2b8d17cbbb9abfad9e6d", "1f391e657b2738dda08448cba2811ceb",
+ "valid" },
+ { "0212a8de5007ed87b33f1a7090b6114f9e08cefd9607f2c276bdcfdbc5ce9cd7",
+ "e6b1adf2fd58a8762c65f31b", "",
+ "10f1ecf9c60584665d9ae5efe279e7f7377eea6916d2b111",
+ "42f26c56cb4be21d9d8d0c80fc99dde00d75f38074bfe764",
+ "54aa7e13d48fff7d7557039457040a3a", "valid" },
+ { "c5bc09565646e7edda954f1f739223dada20b95c44ab033d0fae4b0283d18be3",
+ "6b282ebecc541bcd7834ed55", "3e8bc5ade182ff08",
+ "9222f9018e54fd6de1200806a9ee8e4cc904d29f25cba193",
+ "123032437b4bfd6920e8f7e7e0087ae4889ebe7a0ad0e900",
+ "3cf68f179550da63d3b96c2d55411865", "valid" },
+ { "2eb51c469aa8eb9e6c54a8349bae50a20f0e382711bba1152c424f03b6671d71",
+ "04a9be03508a5f31371a6fd2", "",
+ "b053999286a2824f42cc8c203ab24e2c97a685adcc2ad32662558e55a5c729",
+ "45c7d6b53acad4abb68876a6e96a48fb59524d2c92c9d8a189c9fd2db91746",
+ "566d3ca10e311b695f3eae1551652493", "valid" },
+ { "7f5b74c07ed1b40fd14358fe2ff2a740c116c7706510e6a437f19ea49911cec4",
+ "470a339ecb3219b8b81a1f8b", "374618a06ea98a48",
+ "f45206abc25552b2abc9ab7fa243035fedaaddc3b2293956f1ea6e7156e7eb",
+ "46a80c4187024720084627580080dde5a3f4a11093a7076ed6f3d326bc7b70",
+ "534d4aa2835a52e72d14df0e4f47f25f", "valid" },
+ { "e1731d5854e1b70cb3ffe8b786a2b3ebf0994370954757b9dc8c7bc5354634a3",
+ "72cfd90ef3026ca22b7e6e6a", "",
+ "b9c554cbc36ac18ae897df7beecac1dbeb4eafa156bb60ce2e5d48f05715e678",
+ "ea29afa49d36e8760f5fe19723b9811ed5d519934a440f5081ac430b953b0e21",
+ "222541af46b86533c6b68d2ff108a7ea", "valid" },
+ { "27d860631b0485a410702fea61bc873f3442260caded4abde25b786a2d97f145",
+ "262880d475f3dac5340dd1b8", "2333e5ce0f93b059",
+ "6b2604996cd30c14a13a5257ed6cffd3bc5e29d6b97eb1799eb335e281ea451e",
+ "6dad637897544d8bf6be9507ed4d1bb2e954bc427e5de729daf50762846ff2f4",
+ "7b997d93c982189d7095dc794c746232", "valid" },
+ { "cf0d40a4644e5f51815165d5301b22631f4544c49a1878e3a0a5e8e1aae0f264",
+ "e74a515e7e2102b90bef55d2", "",
+ "973d0c753826bae466cf9abb3493152e9de7819e2bd0c71171346b4d2cebf8041aa3cedc"
+ "0dfd7b467e26228bc86c9a",
+ "fba78ae4f9d808a62e3da40be2cb7700c3613d9eb2c529c652e76a432c658d27095f0eb8"
+ "f940c324981ea935e507f9",
+ "8f046956db3a512908bd7afc8f2ab0a9", "valid" },
+ { "6cbfd71c645d184cf5d23c402bdb0d25ec54898c8a0273d42eb5be109fdcb2ac",
+ "d4d807341683825b31cd4d95", "b3e4064683b02d84",
+ "a98995504df16f748bfb7785ff91eeb3b660ea9ed3450c3d5e7b0e79ef653659a9978d75"
+ "542ef91c456762215640b9",
+ "a1ffed80761829ecce242e0e88b138049016bca018da2b6e19986b3e318cae8d806198fb"
+ "4c527cc39350ebddeac573",
+ "c4cbf0befda0b70242c640d7cd02d7a3", "valid" },
+ { "5b1d1035c0b17ee0b0444767f80a25b8c1b741f4b50a4d3052226baa1c6fb701",
+ "d61040a313ed492823cc065b", "",
+ "d096803181beef9e008ff85d5ddc38ddacf0f09ee5f7e07f1e4079cb64d0dc8f5e6711cd"
+ "4921a7887de76e2678fdc67618f1185586bfea9d4c685d50e4bb9a82",
+ "9a4ef22b181677b5755c08f747c0f8d8e8d4c18a9cc2405c12bb51bb1872c8e8b877678b"
+ "ec442cfcbb0ff464a64b74332cf072898c7e0eddf6232ea6e27efe50",
+ "9ff3427a0f32fa566d9ca0a78aefc013", "valid" },
+ { "97d635c4f47574d9998a90875da1d3a284b755b2d39297a5725235190e10a97e",
+ "d31c21aba175b70de4ebb19c", "7193f623663321a2",
+ "94ee166d6d6ecf8832437136b4ae805d428864359586d9193a25016293edba443c58e07e"
+ "7b7195ec5bd84582a9d56c8d4a108c7d7ce34e6c6f8ea1bec0567317",
+ "5fbbdecc34be201614f636031eeb42f1cace3c79a12cffd871ee8e73820c829749f1abb4"
+ "294367849fb6c2aa56bda8a3078f723d7c1c852024b017b58973fb1e",
+ "09263da7b4cb921452f97dca40f580ec", "valid" },
+ { "fe6e55bdaed1f7284ca5fc0f8c5f2b8df56dc0f49e8ca66a41995e783351f901",
+ "17c86a8abbb7e003acde2799", "",
+ "b429eb80fb8fe8baeda0c85b9c333458e7c2992e558475069d12d45c2221756412158803"
+ "2297eff56783742a5fc22d7410ffb29d66098661d76f126c3c27689e43b37267cac5a3a6"
+ "d3ab49e391da29cd3054a5692e2807e4c3ea46c8761d50f592",
+ "d0102f6c258bf49742cec34cf2d0fedf23d105fb4c84cf98515e1bc9a64f8ad5be8f0721"
+ "bde50645d00083c3a263a31053b760245f52ae2866a5ec83b19f61be1d30d5c5d9fecc4c"
+ "bbe08fd385813a2aa39a00ff9c10f7f23702add1e4b2ffa31c",
+ "41865fc71de12b19612127ce49993bb0", "valid" },
+ { "aabc063474e65c4c3e9bdc480dea97b45110c8618846ff6b15bdd2a4a5682c4e",
+ "46362f45d6379e63e5229460", "a11c40b603767330",
+ "ceb534ce50dc23ff638ace3ef63ab2cc2973eeada80785fc165d06c2f5100ff5e8ab2882"
+ "c475afcd05ccd49f2e7d8f55ef3a72e3dc51d6852b8e6b9e7aece57be6556b0b6d9413e3"
+ "3fc5fc24a9a205ad59574bb39d944a92dc47970d84a6ad3176",
+ "7545391b51de01d5c53dfaca777909063e58edee4bb1227e7110ac4d2620c2aec2f848f5"
+ "6deeb037a8dced75afa8a6c890e2dee42f950bb33d9e2424d08a505d899563973ed38870"
+ "f3de6ee2adc7fe072c366c14e2cf7ca62fb3d36bee11685461",
+ "b70d44ef8c66c5c7bbf10dcadd7facf6", "valid" },
+ { "7d00b48095adfa3272050607b264185002ba99957c498be022770f2ce2f3143c",
+ "87345f1055fd9e2102d50656", "02", "e5ccaa441bc814688f8f6e8f28b500b2",
+ "7e72f5a185af16a611921b438f749f0b", "1242c670732334029adfe1c5001651e4",
+ "valid" },
+ { "6432717f1db85e41ac7836bce25185a080d5762b9e2b18444b6ec72c3bd8e4dc",
+ "87a3163ec0598ad95b3aa713", "b648", "02cde168fba3f544bbd0332f7adeada8",
+ "85f29a719557cdd14d1f8fffab6d9e60", "732ca32becd515a1ed353f542e999858",
+ "valid" },
+ { "8e34cf73d245a1082a920b86364eb896c4946467bcb3d58929fcb36690e6394f",
+ "6f573aa86baa492ba46596df", "bd4cd02fc7502bbdbdf6c9a3cbe8f0",
+ "16ddd23ff53f3d23c06334487040eb47", "c1b295936d56fadac03e5f742bff73a1",
+ "39c457dbab66382babb3b55800cda5b8", "valid" },
+ { "cb5575f5c7c45c91cf320b139fb594237560d0a3e6f865a67d4f633f2c08f016",
+ "1a6518f02ede1da6809266d9", "89cce9fb47441d07e0245a66fe8b778b",
+ "623b7850c321e2cf0c6fbcc8dfd1aff2", "c84c9bb7c61c1bcb17772a1c500c5095",
+ "dbadf7a5138ca03459a2cd65831e092f", "valid" },
+ { "a5569e729a69b24ba6e0ff15c4627897436824c941e9d00b2e93fddc4ba77657",
+ "564dee49ab00d240fc1068c3", "d19f2d989095f7ab03a5fde84416e00c0e",
+ "87b3a4d7b26d8d3203a0de1d64ef82e3", "94bc80621ed1e71b1fd2b5c3a15e3568",
+ "333511861796978401598b963722f5b3", "valid" },
+ { "56207465b4e48e6d04630f4a42f35cfc163ab289c22a2b4784f6f9290330bee0",
+ "df8713e87ec3dbcfad14d53e",
+ "5e6470facd99c1d81e37cd44015fe19480a2a4d3352a4ff560c0640fdbda",
+ "e601b38557797da2f8a4106a089d1da6", "299b5d3f3d03c087209a16e285143111",
+ "4b454ed198de117e83ec49fa8d8508d6", "valid" },
+ { "3937986af86dafc1ba0c4672d8abc46c207062682d9c264ab06d6c5807205130",
+ "8df4b15a888c33286a7b7651",
+ "ba446f6f9a0ced22450feb10737d9007fd69abc19b1d4d9049a5551e86ec2b37",
+ "dc9e9eaf11e314182df6a4eba17aec9c", "605bbf90aeb974f6602bc778056f0dca",
+ "38ea23d99054b46b42ffe004129d2204", "valid" },
+ { "36372abcdb78e0279646ac3d176b9674e9154eecf0d5469c651ec7e16b4c1199",
+ "be40e5f1a11817a0a8fa8949",
+ "d41a828d5e71829247021905402ea257dccbc3b80fcd5675056b68bb59e62e8873",
+ "81ce84ede9b35859cc8c49a8f6be7dc6", "7b7ce0d824809a70de32562ccf2c2bbd",
+ "15d44a00ce0d19b4231f921e22bc0a43", "valid" },
+ { "9f1479ed097d7fe529c11f2f5add9aaff4a1ca0b68997a2cb7f79749bd90aaf4",
+ "84c87dae4eee27730ec35d12",
+ "3f2dd49bbf09d69a78a3d80ea2566614fc379474196c1aae84583da73d7ff85c6f42ca42"
+ "056a9792cc1b9fb3c7d261",
+ "a66747c89e857af3a18e2c79500087ed", "ca82bff3e2f310ccc976672c4415e69b",
+ "57638c62a5d85ded774f913c813ea032", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "00000000000000000000000000000000",
+ "256d40888094178355d304846443fee8df99470303fb3b7b80e030beebd329be",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "e6d3d7324a1cbba777bbb0ecdda37807", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "00000000000000000000000000000000",
+ "256d40888094178355d304846443fee8df99470303fb3b7b80e030beebd329bee3bcdb5b"
+ "1edefcfe8bcda1b6a15c8c2b0869ffd2ec5e26e553b7b227fe87fdbd",
+ "000000000000000000000000000000000000000000000000000000000000000000000000"
+ "00000000000000000000000000000000000000000000000000000000",
+ "062de6795f274fd2a305d76980bc9cce", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "00000000000000000000000000000000",
+ "256d40888094178355d304846443fee8df99470303fb3b7b80e030beebd329bee3bcdb5b"
+ "1edefcfe8bcda1b6a15c8c2b0869ffd2ec5e26e553b7b227fe87fdbd7ada44424269bffa"
+ "5527f270acf68502b74c5ae2e60c0580981a4938459392c49bb2f284b646efc7f3f0b136"
+ "1dc348ed77d30bc57692ed38fbac0188380488c7",
+ "000000000000000000000000000000000000000000000000000000000000000000000000"
+ "000000000000000000000000000000000000000000000000000000000000000000000000"
+ "000000000000000000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000000000000000",
+ "d8b47902baaeafb34203051529af282e", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "ffffffffffffffffffffffffffffffff",
+ "da92bf777f6be87caa2cfb7b9bbc01172066b8fcfc04c4847f1fcf41142cd641",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "b3891c849cb52c27747edfcf31213bb6", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "ffffffffffffffffffffffffffffffff",
+ "da92bf777f6be87caa2cfb7b9bbc01172066b8fcfc04c4847f1fcf41142cd6411c4324a4"
+ "e121030174325e495ea373d4f796002d13a1d91aac484dd801780242",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "f0c12d26ef03029b62c008da27c5dc68", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "ffffffffffffffffffffffffffffffff",
+ "da92bf777f6be87caa2cfb7b9bbc01172066b8fcfc04c4847f1fcf41142cd6411c4324a4"
+ "e121030174325e495ea373d4f796002d13a1d91aac484dd8017802428525bbbdbd964005"
+ "aad80d8f53097afd48b3a51d19f3fa7f67e5b6c7ba6c6d3b644d0d7b49b910380c0f4ec9"
+ "e23cb712882cf43a896d12c70453fe77c7fb7738",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "ee65783001c25691fa28d0f5f1c1d762", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "00000080000000800000008000000080",
+ "256d40088094170355d304046443fe68df99478303fb3bfb80e0303eebd3293e",
+ "0000008000000080000000800000008000000080000000800000008000000080",
+ "79ba7a29f5a7bb75797af87a610129a4", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "00000080000000800000008000000080",
+ "256d40088094170355d304046443fe68df99478303fb3bfb80e0303eebd3293ee3bcdbdb"
+ "1edefc7e8bcda136a15c8cab0869ff52ec5e266553b7b2a7fe87fd3d",
+ "000000800000008000000080000000800000008000000080000000800000008000000080"
+ "00000080000000800000008000000080000000800000008000000080",
+ "36b1743819e1b9ba1551e8ed922a959a", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "00000080000000800000008000000080",
+ "256d40088094170355d304046443fe68df99478303fb3bfb80e0303eebd3293ee3bcdbdb"
+ "1edefc7e8bcda136a15c8cab0869ff52ec5e266553b7b2a7fe87fd3d7ada44c24269bf7a"
+ "5527f2f0acf68582b74c5a62e60c0500981a49b8459392449bb2f204b646ef47f3f0b1b6"
+ "1dc3486d77d30b457692edb8fbac010838048847",
+ "000000800000008000000080000000800000008000000080000000800000008000000080"
+ "000000800000008000000080000000800000008000000080000000800000008000000080"
+ "000000800000008000000080000000800000008000000080000000800000008000000080"
+ "0000008000000080000000800000008000000080",
+ "feac4955554e806f3a1902e24432c08a", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "ffffff7fffffff7fffffff7fffffff7f",
+ "da92bff77f6be8fcaa2cfbfb9bbc01972066b87cfc04c4047f1fcfc1142cd6c1",
+ "ffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7f",
+ "20a3798df1292c5972bf9741aec38a19", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "ffffff7fffffff7fffffff7fffffff7f",
+ "da92bff77f6be8fcaa2cfbfb9bbc01972066b87cfc04c4047f1fcfc1142cd6c11c432424"
+ "e121038174325ec95ea37354f79600ad13a1d99aac484d58017802c2",
+ "ffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7f"
+ "ffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7f",
+ "c03d9f67354a97b2f074f7551557e49c", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "ffffff7fffffff7fffffff7fffffff7f",
+ "da92bff77f6be8fcaa2cfbfb9bbc01972066b87cfc04c4047f1fcfc1142cd6c11c432424"
+ "e121038174325ec95ea37354f79600ad13a1d99aac484d58017802c28525bb3dbd964085"
+ "aad80d0f53097a7d48b3a59d19f3faff67e5b647ba6c6dbb644d0dfb49b910b80c0f4e49"
+ "e23cb792882cf4ba896d12470453fef7c7fb77b8",
+ "ffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7f"
+ "ffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7f"
+ "ffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7f"
+ "ffffff7fffffff7fffffff7fffffff7fffffff7f",
+ "c86da8dd652286d50213d328d63e4006", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "7fffffff7fffffff7fffffff7fffffff",
+ "5a92bf77ff6be87c2a2cfb7b1bbc0117a066b8fc7c04c484ff1fcf41942cd641",
+ "7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff",
+ "bede9083ceb36ddfe5fa811f95471c67", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "7fffffff7fffffff7fffffff7fffffff",
+ "5a92bf77ff6be87c2a2cfb7b1bbc0117a066b8fc7c04c484ff1fcf41942cd6419c4324a4"
+ "61210301f4325e49dea373d47796002d93a1d91a2c484dd881780242",
+ "7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff"
+ "7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff",
+ "300874bb0692b689dead9ae15b067390", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "7fffffff7fffffff7fffffff7fffffff",
+ "5a92bf77ff6be87c2a2cfb7b1bbc0117a066b8fc7c04c484ff1fcf41942cd6419c4324a4"
+ "61210301f4325e49dea373d47796002d93a1d91a2c484dd8817802420525bbbd3d964005"
+ "2ad80d8fd3097afdc8b3a51d99f3fa7fe7e5b6c73a6c6d3be44d0d7bc9b910388c0f4ec9"
+ "623cb712082cf43a096d12c78453fe7747fb7738",
+ "7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff"
+ "7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff"
+ "7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff"
+ "7fffffff7fffffff7fffffff7fffffff7fffffff",
+ "99cad85f45ca40942d0d4d5e950ade22", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "00000000ffffffff00000000ffffffff",
+ "256d40887f6be87c55d304849bbc0117df994703fc04c48480e030be142cd641",
+ "00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff",
+ "8bbe145272e7c2d9a1891a3ab0983d9d", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "00000000ffffffff00000000ffffffff",
+ "256d40887f6be87c55d304849bbc0117df994703fc04c48480e030be142cd641e3bcdb5b"
+ "e12103018bcda1b65ea373d40869ffd213a1d91a53b7b22701780242",
+ "00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000"
+ "ffffffff00000000ffffffff00000000ffffffff00000000ffffffff",
+ "3b41861913a8f6de7f61e225631bc382", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "00000000ffffffff00000000ffffffff",
+ "256d40887f6be87c55d304849bbc0117df994703fc04c48480e030be142cd641e3bcdb5b"
+ "e12103018bcda1b65ea373d40869ffd213a1d91a53b7b227017802427ada4442bd964005"
+ "5527f27053097afdb74c5ae219f3fa7f981a4938ba6c6d3b9bb2f28449b91038f3f0b136"
+ "e23cb71277d30bc5896d12c7fbac0188c7fb7738",
+ "00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000"
+ "ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff"
+ "00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000"
+ "ffffffff00000000ffffffff00000000ffffffff",
+ "8428bcf023ec6bf31fd9efb203ff0871", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "ffffffff00000000ffffffff00000000",
+ "da92bf7780941783aa2cfb7b6443fee82066b8fc03fb3b7b7f1fcf41ebd329be",
+ "ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000",
+ "139fdf6474ea24f549b075825f2c7620", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "ffffffff00000000ffffffff00000000",
+ "da92bf7780941783aa2cfb7b6443fee82066b8fc03fb3b7b7f1fcf41ebd329be1c4324a4"
+ "1edefcfe74325e49a15c8c2bf796002dec5e26e5ac484dd8fe87fdbd",
+ "ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff"
+ "00000000ffffffff00000000ffffffff00000000ffffffff00000000",
+ "bbad8d863b835a8e8664fd1d4566b6b4", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000000000000000001ee3200", "ffffffff00000000ffffffff00000000",
+ "da92bf7780941783aa2cfb7b6443fee82066b8fc03fb3b7b7f1fcf41ebd329be1c4324a4"
+ "1edefcfe74325e49a15c8c2bf796002dec5e26e5ac484dd8fe87fdbd8525bbbd4269bffa"
+ "aad80d8facf6850248b3a51de60c058067e5b6c7459392c4644d0d7bb646efc70c0f4ec9"
+ "1dc348ed882cf43a7692ed380453fe77380488c7",
+ "ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff"
+ "00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000"
+ "ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff"
+ "00000000ffffffff00000000ffffffff00000000",
+ "42f2354297849a511d53e5571772f71f", "valid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a2e3fdf9fba6861b5ad2607f40b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a1e3fdf9fba6861b5ad2607f40b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "23e3fdf9fba6861b5ad2607f40b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e2fdf9fba6861b5ad2607f40b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fd79fba6861b5ad2607f40b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9faa6861b5ad2607f40b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9f9a6861b5ad2607f40b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9fba6869b5ad2607f40b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9fba6861b5bd2607f40b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9fba6861b5af2607f40b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9fba6861b5ad2617f40b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9fba6861b5ad2607f41b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9fba6861b5ad2607f42b7f447", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9fba6861b5ad2607f40b7f446", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9fba6861b5ad2607f40b7f445", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9fba6861b5ad2607f40b7f407", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9fba6861b5ad2607f40b7f4c7", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "a3e3fdf9fba6869b5ad2607f40b7f4c7", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "00000000000000000000000000000000", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "", "",
+ "ffffffffffffffffffffffffffffffff", "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "26da374f17b7f1b23844a5490bfc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "25da374f17b7f1b23844a5490bfc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "a7da374f17b7f1b23844a5490bfc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27db374f17b7f1b23844a5490bfc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da37cf17b7f1b23844a5490bfc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f16b7f1b23844a5490bfc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f15b7f1b23844a5490bfc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f17b7f1323844a5490bfc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f17b7f1b23944a5490bfc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f17b7f1b23864a5490bfc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f17b7f1b23844a4490bfc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f17b7f1b23844a5490afc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f17b7f1b23844a54909fc4001",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f17b7f1b23844a5490bfc4000",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f17b7f1b23844a5490bfc4003",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f17b7f1b23844a5490bfc4041",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f17b7f1b23844a5490bfc4081",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "27da374f17b7f1323844a5490bfc4081",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "00000000000000000000000000000000",
+ "invalid" },
+ { "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
+ "000102030405060708090a0b", "616164", "00000000000000000000000000000000",
+ "2cf8ae525fc86025268a4e1d88bead19", "ffffffffffffffffffffffffffffffff",
+ "invalid" },
+ { "3030303030303030303030303030303030303030303030303030303030303030",
+ "30303030303030300002506e",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "d4500bf009493551c380adf52c573a69df7e8b762463330facc16a5726be7190c63c5a1c"
+ "926584a096756828dcdc64acdf963d931bf1dae238f3f157224ac4b542d785b0dd84db6b"
+ "e3bc5a3663e84149ffbed09e54f78f16a8223b24cb019f58b21b0e551e7aa07327629551"
+ "376ccbc3937671a0629bd95c9915c78555771e7a",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "0b300d8da56c2185755279553c4c82ca", "valid" },
+ { "3030303030303030303030303030303030303030303030303030303030303030",
+ "3030303030303030000318a5",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "7de87f6729945275d0655da4c7fde4569e16f111b5eb26c22d859e3ff822eced3a6dd9a6"
+ "0f22957f7b7c857e8822eb9fe0b8d7022141f2d0b48f4b5612d322a88dd0fe0b4d917932"
+ "4f7c6c9e990efbd80e5ed6775826498b1efe0f71a0f3ec5b29cb28c2540a7dcd51b7daae"
+ "e0ff4a7f3ac1ee54c29ee4c170de408f66692194",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "c578e2aa44d309b7b6a5193bdc6118f5", "valid" },
+ { "3030303030303030303030303030303030303030303030303030303030303030",
+ "00000000000000000007b4f0",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "1b996f9a3ccc6785de22ff5b8add9502ce03a0faf5992a09522cdd1206d220b8f8bd07d1"
+ "f1f5a1bd9a71d11c7f579b855818c08d4de036393183b7f590b335aed8de5b57b13c5fed"
+ "e2441c3e184aa9d46e61598506b3e11c43c62cbcaceced33190875b012218b1930fb7c38"
+ "ec45ac11c353d0cf938dccb9efad8fedbe46daa5",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "4b0bda8ad043830d8319ab82c50c7663", "valid" },
+ { "3030303030303030303030303030303030303030303030303030303030303030",
+ "00000000000000000020fb66",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "86cbacae4d3f74ae01213e0551cc15160ea1be8408e3d5d74f01464995a69e6176cb9e02"
+ "b2247ed299892f9182a45caf4c69405611766edfafdc285519ea30480c44f05e781eacf8"
+ "fcecc7090abb28fa5fd585ac8cda7e8772e594e4ce6c883281932e0f89f877a1f04d9c32"
+ "b06cf90b0e762b430c4d517c97107068f498ef7f",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "4bc98f72c494c2a43c2b15a1043f1cfa", "valid" },
+ { "3030303030303030303030303030303030303030303030303030303030303030",
+ "00000000000000000038bb90",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "fab1cddf4fe198ef63add881d6ead6c57637bbe92018ca7c0b96fba0871e932db1fbf907"
+ "61be25df8dfaf931ce5757e617b3d7a9f0bf0ffe5d591a33c143b8f53fd0b5a19609fd62"
+ "e5c251a4281a200cfdc34f281710406f4e37625446ff6ef224913deb0d89af337128e3d1"
+ "55d16d3ec3246041432143e9ab3a6d2ccc2f4d62",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "f7e9e151b02533c74658bfc7737c680d", "valid" },
+ { "3030303030303030303030303030303030303030303030303030303030303030",
+ "00000000000000000070484a",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "227202be7f3515e9d1c02eea2f1950b6481b048a4c91506cb40d504e6c949f82d197c25a"
+ "d17dc721651125782ac7a71247feaef32f1f250ce4bb8f79acaa179d45a7b0545f092432"
+ "5efa87d5e441d28478c61f2223ee67c3b41f4394535e2a24369a2e16613c459490c14fb1"
+ "d755fe53fbe1ee45b1b21f7162e2fcaa742abefd",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "795bcff647c553c2e4eb6e0eafd9e04e", "valid" },
+ { "3030303030303030303030303030303030303030303030303030303030303030",
+ "000000000000000000932f40",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "fae58345c16cb0f5cc537f2b1b3469c969463b3ea71bcf6b98d669a8e60e04fc08d5fd06"
+ "9c362638e3400ef4cb242e27e2245e68cb9ec583da5340b12edf423b7326ad20feeb57da"
+ "ca2e0467a32899b42df8e56d84e006bc8a7acc731e7c1f6becb5719f7077f0d4f4c61ab1"
+ "1ebac1001801ce33c4e4a77d831d3ce34e8410e1",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "1946d653960f947a74d3e8093cf48502", "valid" },
+ { "3030303030303030303030303030303030303030303030303030303030303030",
+ "000000000000000000e29335",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "ebb216ddd7ca709215f503df9ce63c5cd2194e7d9099e8a90b2afaad5eba35069925a603"
+ "fdbc341aaed41505b10941fa3856a7e247b1040709746cfc2096caa631b2fff41c250506"
+ "d889c1c90671ade853ee6394c19192a5cf3710d1073099e5bc946582fc0fab9f543c716a"
+ "e2486a8683fdca39d2e14f23d00a582664f4ecb1",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "36c3002985dd21baf895d633573f12c0", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000000ef7d5",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "408ae6ef1c7ef0fb2c2d610816fc7849efa58f78273f5f166ea65f81b575747d035b3040"
+ "fede1eb9459788669788408e00413b3e376d152d204aa2b7a83558fcd48a0ef7a26b1cd6"
+ "d35d23b3f5dfe0ca77a4ce32b94abf83da2aefcaf068380879e89fb0a3829595cf44c385"
+ "2ae2cc662b689f9355d9c183801f6acc313f8907",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "6514518e0a264142e0b7351f967fc2ae", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000003dfce4",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "0a0a24499bcade58cf1576c312aca984718cb4cc7e0153f5a9015810859644dfc021174e"
+ "0b060a397448de8b484a8603be680a6934c0906f30dd17eae2d4c5faa777f8ca53370e08"
+ "331b88c342bac959787bbb33930e3b56be86da7f2a6eb1f94089d1d181074d4302f8e055"
+ "2d0de1fab306a21b42d4c3ba6e6f0cbcc81e877a",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "4c194da6a99fd65b40e9cad798f44b19", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000018486a8",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "4a0aaff8494729188691701340f3ce2b8a78eed3a0f065994b72484e7991d25c29aa075e"
+ "b1fc16de93fe069058112ab284a3ed18780326d1258a47222fa633d8b29f3bd9150b239b"
+ "1546c2bb9b9f410febead396000ee477701532c3d0f5fbf895d280196d2f737c5e9fec50"
+ "d92bb0df5d7e513be5b8ea971310d5bf16ba7aee",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "c8ae7788cd2874abc138541e11fd0587", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "ff9428d079351f665cd001354319875c783d35f613e6d9093d38e975c38fe3b89f7aed35"
+ "cb5a2fcaa0346efb936554649cf6378171eae4396ea15dc240d1abf4472d9096524fa1b2"
+ "b023b8b288222773d4d206616f9293f65b45dbbc74e7c2edfbcbbf1cfb679bb739a5862d"
+ "e2bcb937f74d5bf8671c5a8a5092f61d54c9aa5b",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffff",
+ "933a5163c7f62368327b3fbc1036c943", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000102030405060708090a0b",
+ "85ffffffffffffffffffffffffffffffa6902fcbc883bbc180b256ae34ad7f00",
+ "9a49c40f8b48d7c66d1db4e53f20f2dd4aaa241ddab26b5bc0e218b72c3390f2df3ebd01"
+ "76704419972bcdbc6bbcb3e4e74a71528ef51263ce24e0d575e0e44d",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "000102030405060708090a0b0c0d0e0f", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000102030405060708090a0b",
+ "ffffffffffffffffffffffffffffffff247e50642a1c0a2f8f77219609dba958",
+ "9a49c40f8b48d7c66d1db4e53f20f2dd4aaa241ddab26b5bc0e218b72c3390f2df3ebd01"
+ "76704419972bcdbc6bbcb3e4e74a71528ef51263ce24e0d575e0e44d",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "00000000000000000000000000000000", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000102030405060708090a0b",
+ "7cffffffffffffffffffffffffffffffd9e72c064ac8961f3fa585e0e2abd600",
+ "9a49c40f8b48d7c66d1db4e53f20f2dd4aaa241ddab26b5bc0e218b72c3390f2df3ebd01"
+ "76704419972bcdbc6bbcb3e4e74a71528ef51263ce24e0d575e0e44d",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "ffffffffffffffffffffffffffffffff", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000102030405060708090a0b",
+ "65ffffffffffffffffffffffffffffff95af0f4d0b686eaeccca4307d596f502",
+ "9a49c40f8b48d7c66d1db4e53f20f2dd4aaa241ddab26b5bc0e218b72c3390f2df3ebd01"
+ "76704419972bcdbc6bbcb3e4e74a71528ef51263ce24e0d575e0e44d",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "00000080000000800000008000000080", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000102030405060708090a0b",
+ "ffffffffffffffffffffffffffffffff8540b464357707be3a39d55c34f8bcb3",
+ "9a49c40f8b48d7c66d1db4e53f20f2dd4aaa241ddab26b5bc0e218b72c3390f2df3ebd01"
+ "76704419972bcdbc6bbcb3e4e74a71528ef51263ce24e0d575e0e44d",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "ffffff7fffffff7fffffff7fffffff7f", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000102030405060708090a0b",
+ "4fffffffffffffffffffffffffffffff6623d990b898d830d212af2383330701",
+ "9a49c40f8b48d7c66d1db4e53f20f2dd4aaa241ddab26b5bc0e218b72c3390f2df3ebd01"
+ "76704419972bcdbc6bbcb3e4e74a71528ef51263ce24e0d575e0e44d",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "01000000010000000100000001000000", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "000102030405060708090a0b",
+ "83ffffffffffffffffffffffffffffff5f16d09f17787211b7d484e024f89701",
+ "9a49c40f8b48d7c66d1db4e53f20f2dd4aaa241ddab26b5bc0e218b72c3390f2df3ebd01"
+ "76704419972bcdbc6bbcb3e4e74a71528ef51263ce24e0d575e0e44d",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "ffffffff000000000000000000000000", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "005235d2a919f28d3db7664a34ae6b444d3d35f613e6d9093d38e975c38fe3b85b8b9450"
+ "9e2b74a36d346e33d572659ba9f6378171eae4396ea15dc240d1abf483dce9f3073efadb"
+ "7d23b87ace35168c",
+ "0039e2fd2fd312149e989880884813e7caffffffffffffffffffffffffffffff3b0e869a"
+ "aa8ea49632ffff37b9e8ce00caffffffffffffffffffffffffffffff3b0e869aaa8ea496"
+ "32ffff37b9e8ce00",
+ "a519ac1a35b4a57787510af78d8d200a", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "d39428d079351f665cd001354319875ce5da78766fa19290c031f75208506745ae7aed35"
+ "cb5a2fcaa0346efb93655464496ddeb05509c6efffab75eb2df4ab09762d9096524fa1b2"
+ "b023b8b2882227730149ef504b71b120ca4ff39519c2c210",
+ "d3ffffffffffffffffffffffffffffff6218b27f83b8b46602f6e1d834207b02ceffffff"
+ "ffffffffffffffffffffffff2a6416cedb1cdd296ef5d7d692daff02ceffffffffffffff"
+ "ffffffffffffffff2a6416cedb1cdd296ef5d7d692daff02",
+ "302fe82ab0a09af64400d015ae83d9cc", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "e99428d079351f665cd001354319875c6df1394edc539b5b3a0957be0fb85946807aed35"
+ "cb5a2fcaa0346efb93655464d1769fe806bbfeb6f590950f2eac9e0a582d9096524fa1b2"
+ "b023b8b2882227739952ae0818c38979c07413711a9af713",
+ "e9ffffffffffffffffffffffffffffffea33f347304abdadf8ce413433c84501e0ffffff"
+ "ffffffffffffffffffffffffb27f579688aee57064ce37329182ca01e0ffffffffffffff"
+ "ffffffffffffffffb27f579688aee57064ce37329182ca01",
+ "98a7e836e0ee4d023500d0557ec2cbe0", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "ff9428d079351f665cd001354319875c64f90f5b2692b860d4596ff4b3402c5c00b9bb53"
+ "707aa667d356fe50c7199694033561e7caca6d941dc3cd6914ad6904",
+ "ffffffffffffffffffffffffffffffffe33bc552ca8b9e96169e797e8f30301b603ca999"
+ "44df76528c9d6f54ab833d0f603ca99944df76528c9d6f54ab833d0f",
+ "6ab8dce2c59da4737130b0252f68a8d8", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "689428d079351f665cd001354319875cb08f25675b9bcbf6e38407de2ec75a479f7aed35"
+ "cb5a2fcaa0346efb936554642d2af7cd6b080501d31ba54fb2eb7596472d9096524fa1b2"
+ "b023b8b288222773650ec62d757072cee6ff233186dd1c8f",
+ "68ffffffffffffffffffffffffffffff374def6eb782ed002143115412b74600ffffffff"
+ "ffffffffffffffffffffffff4e233fb3e51d1ec7424507720dc5219dffffffffffffffff"
+ "ffffffffffffffff4e233fb3e51d1ec7424507720dc5219d",
+ "044dea608880412bfdffcf35579e9b26", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "6d9428d079351f665cd001354319875ca161b5ab040900629efeff78d7d86b459f7aed35"
+ "cb5a2fcaa0346efb93655464c6f8078cc8ef12a0ff657d6d08db10b8472d9096524fa1b2"
+ "b023b8b2882227738edc366cd697656fca81fb133ced79a1",
+ "6dffffffffffffffffffffffffffffff26a37fa2e81026945c39e9f2eba87702ffffffff"
+ "ffffffffffffffffffffffffa5f1cff246fa09666e3bdf50b7f544b3ffffffffffffffff"
+ "ffffffffffffffffa5f1cff246fa09666e3bdf50b7f544b3",
+ "1e6bea6314542e2ef9ffcf450b2e982b", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "ff9428d079351f665cd001354319875cfc01b891e5f0f9128d7d1c579192b69863414415"
+ "b69968959a7291b7a5af134860cd9ea10c29a36654e7a28e761becd8",
+ "ffffffffffffffffffffffffffffffff7bc3729809e9dfe44fba0addade2aadf03c456df"
+ "823cb8a0c5b900b3c935b8d303c456df823cb8a0c5b900b3c935b8d3",
+ "ed2017c8dba4775629049d786e3bceb1", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "ff9428d079351f665cd001354319875c6b6dc9d21a819e70b577f44137d3d6bd1335f5eb"
+ "44494077b26449a54b6c7c7510b92f5ffef98b847cf17a9c98d883e5",
+ "ffffffffffffffffffffffffffffffffecaf03dbf698b88677b0e2cb0ba3cafa73b0e721"
+ "70ec9042edafd8a127f6d7ee73b0e72170ec9042edafd8a127f6d7ee",
+ "073f17cb6778645925049d8822cbcab6", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "ffcb2b1106f8234c5e99d4db4c7048de323d35f613e6d9093d38e975c38fe3b816e9884a"
+ "114f0e9266cea3885fe36b9fd6f6378171eae4396ea15dc240d1abf4cebef5e9885a80ea"
+ "76d975c144a41888",
+ "ffa0fc3e8032c3d5fdb62a11f096307db5ffffffffffffffffffffffffffffff766c9a80"
+ "25eadea73905328c3379c004b5ffffffffffffffffffffffffffffff766c9a8025eadea7"
+ "3905328c3379c004",
+ "8b9bb4b4861289658c696a8340150405", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "6f9e70ed3b8baca026e46a5a0943158d213d35f613e6d9093d38e975c38fe3b80c612c5e"
+ "8d89a873dbcaad5b7346429bc5f6378171eae4396ea15dc240d1abf4d43651fd149c260b"
+ "cbdd7b126801318c",
+ "6ff5a7c2bd414c3985cb9490b5a56d2ea6ffffffffffffffffffffffffffffff6ce43e94"
+ "b92c784684013c5f1fdce900a6ffffffffffffffffffffffffffffff6ce43e94b92c7846"
+ "84013c5f1fdce900",
+ "8b3bbd51644459568d81ca1fa72ce404", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "412b080a3e19c10d44a1af1eabdeb4ce353d35f613e6d9093d38e975c38fe3b86b839433"
+ "0921486ca11d291c3e97ee9ad1f6378171eae4396ea15dc240d1abf4b3d4e9909034c614"
+ "b10aff5525d09d8d",
+ "4140df25b8d32194e78e51d41738cc6db2ffffffffffffffffffffffffffffff0b0686f9"
+ "3d849859fed6b818520d4501b2ffffffffffffffffffffffffffffff0b0686f93d849859"
+ "fed6b818520d4501",
+ "86fbab2b4a94f47aa56f0aea65d11008", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "b247a74723491aacacaad709c91e932b313d35f613e6d9093d38e975c38fe3b89ade04e7"
+ "5bb701d9660601b34765de98d5f6378171eae4396ea15dc240d1abf442897944c2a28fa1"
+ "7611d7fa5c22ad8f",
+ "b22c7068a583fa350f8529c375f8eb88b6fffffffffffffffffffffffffffffffa5b162d"
+ "6f12d1ec39cd90b72bff7503b6fffffffffffffffffffffffffffffffa5b162d6f12d1ec"
+ "39cd90b72bff7503",
+ "a019ac2ed667e17da16f0afa19610d0d", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "740f9e49f610efa585b659ca6ed8b4992d3d35f613e6d9093d38e975c38fe3b8412d96af"
+ "be80ec3e79d451b00a2db29ac9f6378171eae4396ea15dc240d1abf4997aeb0c27956246"
+ "69c387f9116ac18d",
+ "7464496670da0f3c2699a700d23ecc3aaaffffffffffffffffffffffffffffff21a88465"
+ "8a253c0b261fc0b466b71901aaffffffffffffffffffffffffffffff21a884658a253c0b"
+ "261fc0b466b71901",
+ "736e18181696a5889c3159faabab20fd", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "adba5d105bc8aa062c2336cb889ddbd5373d35f613e6d9093d38e975c38fe3b8177c5ffe"
+ "2875f468f6c2965748f3599ad3f6378171eae4396ea15dc240d1abf4cf2b225db1607a10"
+ "e6d5401e53b42a8d",
+ "add18a3fdd024a9f8f0cc801347ba376b0ffffffffffffffffffffffffffffff77f94d34"
+ "1cd0245da90907532469f201b0ffffffffffffffffffffffffffffff77f94d341cd0245d"
+ "a90907532469f201",
+ "bad58f10a91e6a889aba32fd17d8331a", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "fe9428d079351f665cd001354319875cc001edc5da442e719bce9abe273af144b47aed35"
+ "cb5a2fcaa0346efb9365546448025f41fa4e336c786957a2a7c4930a6c2d9096524fa1b2"
+ "b023b8b28822277300266ea1e43644a34d8dd1dc93f2fa13",
+ "feffffffffffffffffffffffffffffff47c327cc365d088759098c341b4aed03d4ffffff"
+ "ffffffffffffffffffffffff2b0b973f745b28aae937f59f18eac701d4ffffffffffffff"
+ "ffffffffffffffff2b0b973f745b28aae937f59f18eac701",
+ "d68ce174079add028dd05cf814630488", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "b513b06ab9ac14435acb8aa3a37afdb6543d35f613e6d9093d38e975c38fe3b861950193"
+ "b1bf0311ff117989aed9a999b0f6378171eae4396ea15dc240d1abf4b9c27c3028aa8d69"
+ "ef06afc0b59eda8e",
+ "b57867453f66f4daf9e474691f9c8515d3ffffffffffffffffffffffffffffff01101359"
+ "851ad324a0dae88dc2430202d3ffffffffffffffffffffffffffffff01101359851ad324"
+ "a0dae88dc2430202",
+ "aa48a3887d4b059699c2fdf9c6787e0a", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "ff9428d079351f665cd001354319875cd4f109e814cea85a08c011d850dd1dcbcf7aed35"
+ "cb5a2fcaa0346efb936554645340b85a9aa08296b77a5fc3961f660f172d9096524fa1b2"
+ "b023b8b2882227731b6489ba84d8f559829ed9bda2290f16",
+ "ffffffffffffffffffffffffffffffff5333c3e1f8d78eacca0707526cad018cafffffff"
+ "ffffffffffffffffffffffff3049702414b599502624fdfe29313204afffffffffffffff"
+ "ffffffffffffffff3049702414b599502624fdfe29313204",
+ "b936a817f2211af129e2cf160fd42bcb", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "ff9428d079351f665cd001354319875cdf4c62032d4119b588477e99925a56d9d67aed35"
+ "cb5a2fcaa0346efb93655464fa84f0645536421b2bb9246ec219ed0b0e2d9096524fa1b2"
+ "b023b8b288222773b2a0c1844b4e35d41e5da210f62f8412",
+ "ffffffffffffffffffffffffffffffff588ea80ac1583f434a806813ae2a4a9eb6ffffff"
+ "ffffffffffffffffffffffff998d381adb2359ddbae786537d37b900b6ffffffffffffff"
+ "ffffffffffffffff998d381adb2359ddbae786537d37b900",
+ "9f7ac4351f6b91e63097a713115d05be", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "ff9428d079351f665cd001354319875c13f80a006dc1bbdad639a92fc7eca655f77aed35"
+ "cb5a2fcaa0346efb936554646348b8fd29bf96d563a517e27d7bfc0f2f2d9096524fa1b2"
+ "b023b8b2882227732b6c891d37c7e11a5641919c494d9516",
+ "ffffffffffffffffffffffffffffffff943ac00981d89d2c14febfa5fb9cba1297ffffff"
+ "ffffffffffffffffffffffff00417083a7aa8d13f2fbb5dfc255a80497ffffffffffffff"
+ "ffffffffffffffff00417083a7aa8d13f2fbb5dfc255a804",
+ "9a18a828070269f44700d009e7171cc9", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "ff9428d079351f665cd001354319875c82e59b4582915038f933811e652dc66afc7aed35"
+ "cb5a2fcaa0346efb93655464b671c8cac270c265a0ac2f535799880a242d9096524fa1b2"
+ "b023b8b288222773fe55f92adc08b5aa9548a92d63afe113",
+ "ffffffffffffffffffffffffffffffff0527514c6e8876ce3bf49794595dda2d9cffffff"
+ "ffffffffffffffffffffffffd57800b44c65d9a331f28d6ee8b7dc019cffffffffffffff"
+ "ffffffffffffffffd57800b44c65d9a331f28d6ee8b7dc01",
+ "b436a82b93d555f74300d0199ba718ce", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "ff9428d079351f665cd001354319875cf1d12887b7216986a12d79098b6de60fc07aed35"
+ "cb5a2fcaa0346efb93655464a7c75899f3e60af1fcb6c7307d87590f182d9096524fa1b2"
+ "b023b8b288222773efe36979ed9e7d3ec952414e49b13016",
+ "ffffffffffffffffffffffffffffffff7613e28e5b384f7063ea6f83b71dfa48a0ffffff"
+ "ffffffffffffffffffffffffc4ce90e77df311376de8650dc2a90d04a0ffffffffffffff"
+ "ffffffffffffffffc4ce90e77df311376de8650dc2a90d04",
+ "ce54a82e1fa942fa3f00d0294f3715d3", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "cbf1da9e0ba9377374e69e1c0e600cfc343d35f613e6d9093d38e975c38fe3b8be3fa66b"
+ "6ce7808aa3e45949f944649fd0f6378171eae4396ea15dc240d1abf46668dbc8f5f20ef2"
+ "b3f38f00e2031788",
+ "cb9a0db18d63d7ead7c960d6b286745fb3ffffffffffffffffffffffffffffffdebab4a1"
+ "584250bffc2fc84d95decf04b3ffffffffffffffffffffffffffffffdebab4a1584250bf"
+ "fc2fc84d95decf04",
+ "2383ab0b799205699b510aa709bf31f1", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "8f278694c4e9daebd58d3e5b966e8b68423d35f613e6d9093d38e975c38fe3b80653e7a3"
+ "31718833acc3b9adff1c3198a6f6378171eae4396ea15dc240d1abf4de049a00a864064b"
+ "bcd46fe4e45b428f",
+ "8f4c51bb42233a7276a2c0912a88f3cbc5ffffffffffffffffffffffffffffff66d6f569"
+ "05d45806f30828a993869a03c5ffffffffffffffffffffffffffffff66d6f56905d45806"
+ "f30828a993869a03",
+ "8bfbab17a9e0b8748b510ae7d9fd2305", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "d59428d079351f665cd001354319875c9a22d70a48e24fddcdd4419de64c8f44fc7aed35"
+ "cb5a2fcaa0346efb9365546477b5c907d9c9e1ea51851a204aad9f0a242d9096524fa1b2"
+ "b023b8b2882227733f91f8e7c7b1962564619c5e7e9bf613",
+ "d5ffffffffffffffffffffffffffffff1de01d03a4fb692b0f135717da3c93039cffffff"
+ "ffffffffffffffffffffffff14bc017957dcfa2cc0dbb81df583cb019cffffffffffffff"
+ "ffffffffffffffff14bc017957dcfa2cc0dbb81df583cb01",
+ "49bc6e9fc51c4d503036644d842773d2", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "db9428d079351f665cd001354319875c75d5643aa5af934d8cce392cc3eedb47c07aed35"
+ "cb5a2fcaa0346efb93655464601b5ad2067f28066a8f3281715ba808182d9096524fa1b2"
+ "b023b8b288222773283f6b3218075fc95f6bb4ff456dc111",
+ "dbfffffffffffffffffffffffffffffff217ae3349b6b5bb4e092fa6ff9ec700a0ffffff"
+ "ffffffffffffffffffffffff031292ac886a33c0fbd190bcce75fc03a0ffffffffffffff"
+ "ffffffffffffffff031292ac886a33c0fbd190bcce75fc03",
+ "63da6ea251f039532c36645d38b76fd7", "valid" },
+ { "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f",
+ "0000000000000000064c2d52", "ffffffff",
+ "939428d079351f665cd001354319875c624839604216e403ebcc6af559ec8b43977aed35"
+ "cb5a2fcaa0346efb93655464d8c8c3fa1a9e474abe52d02c8187e90f4f2d9096524fa1b2"
+ "b023b8b28822277390ecf21a04e630858bb65652b5b18016",
+ "93ffffffffffffffffffffffffffffffe58af369ae0fc2f5290b7c7f659c9704f7ffffff"
+ "ffffffffffffffffffffffffbbc10b84948b5c8c2f0c72113ea9bd04f7ffffffffffffff"
+ "ffffffffffffffffbbc10b84948b5c8c2f0c72113ea9bd04",
+ "73eb2724b5c405f04d00d0f15840a1c1", "valid" }
+};
+
+static int
+tv(void)
+{
+ unsigned char *ad;
+ unsigned char *decrypted;
+ unsigned char *detached_ciphertext;
+ unsigned char *key;
+ unsigned char *message;
+ unsigned char *mac;
+ unsigned char *nonce;
+ size_t ad_len;
+ size_t detached_ciphertext_len;
+ size_t message_len;
+ unsigned int i;
+
+ key = (unsigned char *) sodium_malloc(
+ crypto_aead_chacha20poly1305_ietf_KEYBYTES);
+ nonce = (unsigned char *) sodium_malloc(
+ crypto_aead_chacha20poly1305_ietf_NPUBBYTES);
+ mac = (unsigned char *) sodium_malloc(
+ crypto_aead_chacha20poly1305_ietf_ABYTES);
+
+ for (i = 0U; i < (sizeof tests) / (sizeof tests[0]); i++) {
+ assert(strlen(tests[i].key_hex) ==
+ 2 * crypto_aead_chacha20poly1305_ietf_KEYBYTES);
+ sodium_hex2bin(key, crypto_aead_chacha20poly1305_ietf_KEYBYTES,
+ tests[i].key_hex, strlen(tests[i].key_hex), NULL, NULL,
+ NULL);
+
+ assert(strlen(tests[i].nonce_hex) ==
+ 2 * crypto_aead_chacha20poly1305_ietf_NPUBBYTES);
+ sodium_hex2bin(nonce, crypto_aead_chacha20poly1305_ietf_NPUBBYTES,
+ tests[i].nonce_hex, strlen(tests[i].nonce_hex), NULL,
+ NULL, NULL);
+
+ message_len = strlen(tests[i].message_hex) / 2;
+ message = (unsigned char *) sodium_malloc(message_len);
+ sodium_hex2bin(message, message_len, tests[i].message_hex,
+ strlen(tests[i].message_hex), NULL, NULL, NULL);
+
+ ad_len = strlen(tests[i].ad_hex) / 2;
+ ad = (unsigned char *) sodium_malloc(ad_len);
+ sodium_hex2bin(ad, ad_len, tests[i].ad_hex, strlen(tests[i].ad_hex),
+ NULL, NULL, NULL);
+
+ detached_ciphertext_len = message_len;
+ assert(strlen(tests[i].detached_ciphertext_hex) == 2 * message_len);
+ assert(strlen(tests[i].mac_hex) ==
+ 2 * crypto_aead_chacha20poly1305_ietf_ABYTES);
+ sodium_hex2bin(mac, crypto_aead_chacha20poly1305_ietf_ABYTES,
+ tests[i].mac_hex, strlen(tests[i].mac_hex), NULL, NULL,
+ NULL);
+
+ detached_ciphertext =
+ (unsigned char *) sodium_malloc(detached_ciphertext_len);
+ sodium_hex2bin(detached_ciphertext, detached_ciphertext_len,
+ tests[i].detached_ciphertext_hex,
+ strlen(tests[i].detached_ciphertext_hex), NULL, NULL,
+ NULL);
+
+ decrypted = (unsigned char *) sodium_malloc(message_len);
+ if (crypto_aead_chacha20poly1305_ietf_decrypt_detached(
+ decrypted, NULL, detached_ciphertext, detached_ciphertext_len,
+ mac, ad, ad_len, nonce, key) == 0) {
+ if (strcmp(tests[i].outcome, "valid") != 0) {
+ printf("*** test case %u succeeded, was supposed to be %s\n", i,
+ tests[i].outcome);
+ }
+ if (memcmp(decrypted, message, message_len) != 0) {
+ printf("Incorrect decryption of test vector #%u\n",
+ (unsigned int) i);
+ }
+ } else {
+ if (strcmp(tests[i].outcome, "invalid") != 0) {
+ printf("*** test case %u failed, was supposed to be %s\n", i,
+ tests[i].outcome);
+ }
+ }
+
+ sodium_free(message);
+ sodium_free(ad);
+ sodium_free(decrypted);
+ sodium_free(detached_ciphertext);
+ }
+
+ sodium_free(key);
+ sodium_free(mac);
+ sodium_free(nonce);
+
+ return 0;
+}
+
+int
+main(void)
+{
+ tv();
+ printf("OK\n");
+
+ return 0;
+}
diff -Nru libsodium-1.0.16/test/default/aead_chacha20poly13052.exp libsodium-1.0.18/test/default/aead_chacha20poly13052.exp
--- libsodium-1.0.16/test/default/aead_chacha20poly13052.exp 1970-01-01 00:00:00.000000000 +0000
+++ libsodium-1.0.18/test/default/aead_chacha20poly13052.exp 2019-05-30 20:13:18.000000000 +0000
@@ -0,0 +1 @@
+OK
diff -Nru libsodium-1.0.16/test/default/aead_chacha20poly1305.c libsodium-1.0.18/test/default/aead_chacha20poly1305.c
--- libsodium-1.0.16/test/default/aead_chacha20poly1305.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/aead_chacha20poly1305.c 2019-05-30 20:13:18.000000000 +0000
@@ -115,7 +115,7 @@
}
m2len = 1;
if (crypto_aead_chacha20poly1305_decrypt(
- m2, &m2len, NULL, NULL,
+ m2, &m2len, NULL, guard_page,
randombytes_uniform(crypto_aead_chacha20poly1305_ABYTES),
NULL, 0U, nonce, firstkey) != -1) {
printf("crypto_aead_chacha20poly1305_decrypt() worked with a short "
@@ -296,7 +296,7 @@
}
m2len = 1;
if (crypto_aead_chacha20poly1305_ietf_decrypt(
- m2, &m2len, NULL, NULL,
+ m2, &m2len, NULL, guard_page,
randombytes_uniform(crypto_aead_chacha20poly1305_ietf_ABYTES),
NULL, 0U, nonce, firstkey) != -1) {
printf("crypto_aead_chacha20poly1305_ietf_decrypt() worked with a short "
diff -Nru libsodium-1.0.16/test/default/aead_xchacha20poly1305.c libsodium-1.0.18/test/default/aead_xchacha20poly1305.c
--- libsodium-1.0.16/test/default/aead_xchacha20poly1305.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/aead_xchacha20poly1305.c 2019-05-30 20:13:18.000000000 +0000
@@ -20,11 +20,11 @@
};
#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,
- 0x48, 0x49, 0x4a, 0x4b };
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53 };
static const unsigned char ad[ADLEN]
= { 0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7 };
unsigned char *c = (unsigned char *) sodium_malloc(CLEN);
@@ -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");
@@ -118,7 +122,7 @@
}
m2len = 1;
if (crypto_aead_xchacha20poly1305_ietf_decrypt(
- m2, &m2len, NULL, NULL,
+ m2, &m2len, NULL, guard_page,
randombytes_uniform(crypto_aead_xchacha20poly1305_ietf_ABYTES),
NULL, 0U, nonce, firstkey) != -1) {
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() worked with a short "
@@ -175,6 +179,7 @@
sodium_free(m2);
sodium_free(m);
+ assert(crypto_aead_xchacha20poly1305_ietf_abytes() == crypto_aead_xchacha20poly1305_ietf_ABYTES);
assert(crypto_aead_xchacha20poly1305_ietf_keybytes() == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
assert(crypto_aead_xchacha20poly1305_ietf_npubbytes() == crypto_aead_xchacha20poly1305_ietf_NPUBBYTES);
assert(crypto_aead_xchacha20poly1305_ietf_nsecbytes() == 0U);
diff -Nru libsodium-1.0.16/test/default/aead_xchacha20poly1305.exp libsodium-1.0.18/test/default/aead_xchacha20poly1305.exp
--- libsodium-1.0.16/test/default/aead_xchacha20poly1305.exp 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/aead_xchacha20poly1305.exp 2019-05-30 20:13:18.000000000 +0000
@@ -1,51 +1,51 @@
-,0x45,0x3c,0x06,0x93,0xa7,0x40,0x7f,0x04
-,0xff,0x4c,0x56,0xae,0xdb,0x17,0xa3,0xc0
-,0xa1,0xaf,0xff,0x01,0x17,0x49,0x30,0xfc
-,0x22,0x28,0x7c,0x33,0xdb,0xcf,0x0a,0xc8
-,0xb8,0x9a,0xd9,0x29,0x53,0x0a,0x1b,0xb3
-,0xab,0x5e,0x69,0xf2,0x4c,0x7f,0x60,0x70
-,0xc8,0xf8,0x40,0xc9,0xab,0xb4,0xf6,0x9f
-,0xbf,0xc8,0xa7,0xff,0x51,0x26,0xfa,0xee
-,0xbb,0xb5,0x58,0x05,0xee,0x9c,0x1c,0xf2
-,0xce,0x5a,0x57,0x26,0x32,0x87,0xae,0xc5
-,0x78,0x0f,0x04,0xec,0x32,0x4c,0x35,0x14
-,0x12,0x2c,0xfc,0x32,0x31,0xfc,0x1a,0x8b
-,0x71,0x8a,0x62,0x86,0x37,0x30,0xa2,0x70
-,0x2b,0xb7,0x63,0x66,0x11,0x6b,0xed,0x09
-,0xe0,0xfd,0x5c,0x6d,0x84,0xb6,0xb0,0xc1
-,0xab,0xaf,0x24,0x9d,0x5d,0xd0,0xf7,0xf5
-,0xa7,0xea
-,0x45,0x3c,0x06,0x93,0xa7,0x40,0x7f,0x04
-,0xff,0x4c,0x56,0xae,0xdb,0x17,0xa3,0xc0
-,0xa1,0xaf,0xff,0x01,0x17,0x49,0x30,0xfc
-,0x22,0x28,0x7c,0x33,0xdb,0xcf,0x0a,0xc8
-,0xb8,0x9a,0xd9,0x29,0x53,0x0a,0x1b,0xb3
-,0xab,0x5e,0x69,0xf2,0x4c,0x7f,0x60,0x70
-,0xc8,0xf8,0x40,0xc9,0xab,0xb4,0xf6,0x9f
-,0xbf,0xc8,0xa7,0xff,0x51,0x26,0xfa,0xee
-,0xbb,0xb5,0x58,0x05,0xee,0x9c,0x1c,0xf2
-,0xce,0x5a,0x57,0x26,0x32,0x87,0xae,0xc5
-,0x78,0x0f,0x04,0xec,0x32,0x4c,0x35,0x14
-,0x12,0x2c,0xfc,0x32,0x31,0xfc,0x1a,0x8b
-,0x71,0x8a,0x62,0x86,0x37,0x30,0xa2,0x70
-,0x2b,0xb7,0x63,0x66,0x11,0x6b,0xed,0x09
-,0xe0,0xfd,0xd4,0xc8,0x60,0xb7,0x07,0x4b
-,0xe8,0x94,0xfa,0xc9,0x69,0x73,0x99,0xbe
-,0x5c,0xc1
-,0x45,0x3c,0x06,0x93,0xa7,0x40,0x7f,0x04
-,0xff,0x4c,0x56,0xae,0xdb,0x17,0xa3,0xc0
-,0xa1,0xaf,0xff,0x01,0x17,0x49,0x30,0xfc
-,0x22,0x28,0x7c,0x33,0xdb,0xcf,0x0a,0xc8
-,0xb8,0x9a,0xd9,0x29,0x53,0x0a,0x1b,0xb3
-,0xab,0x5e,0x69,0xf2,0x4c,0x7f,0x60,0x70
-,0xc8,0xf8,0x40,0xc9,0xab,0xb4,0xf6,0x9f
-,0xbf,0xc8,0xa7,0xff,0x51,0x26,0xfa,0xee
-,0xbb,0xb5,0x58,0x05,0xee,0x9c,0x1c,0xf2
-,0xce,0x5a,0x57,0x26,0x32,0x87,0xae,0xc5
-,0x78,0x0f,0x04,0xec,0x32,0x4c,0x35,0x14
-,0x12,0x2c,0xfc,0x32,0x31,0xfc,0x1a,0x8b
-,0x71,0x8a,0x62,0x86,0x37,0x30,0xa2,0x70
-,0x2b,0xb7,0x63,0x66,0x11,0x6b,0xed,0x09
-,0xe0,0xfd,0xd4,0xc8,0x60,0xb7,0x07,0x4b
-,0xe8,0x94,0xfa,0xc9,0x69,0x73,0x99,0xbe
-,0x5c,0xc1
+,0xf8,0xeb,0xea,0x48,0x75,0x04,0x40,0x66
+,0xfc,0x16,0x2a,0x06,0x04,0xe1,0x71,0xfe
+,0xec,0xfb,0x3d,0x20,0x42,0x52,0x48,0x56
+,0x3b,0xcf,0xd5,0xa1,0x55,0xdc,0xc4,0x7b
+,0xbd,0xa7,0x0b,0x86,0xe5,0xab,0x9b,0x55
+,0x00,0x2b,0xd1,0x27,0x4c,0x02,0xdb,0x35
+,0x32,0x1a,0xcd,0x7a,0xf8,0xb2,0xe2,0xd2
+,0x50,0x15,0xe1,0x36,0xb7,0x67,0x94,0x58
+,0xe9,0xf4,0x32,0x43,0xbf,0x71,0x9d,0x63
+,0x9b,0xad,0xb5,0xfe,0xac,0x03,0xf8,0x0a
+,0x19,0xa9,0x6e,0xf1,0x0c,0xb1,0xd1,0x53
+,0x33,0xa8,0x37,0xb9,0x09,0x46,0xba,0x38
+,0x54,0xee,0x74,0xda,0x3f,0x25,0x85,0xef
+,0xc7,0xe1,0xe1,0x70,0xe1,0x7e,0x15,0xe5
+,0x63,0xe7,0x76,0x01,0xf4,0xf8,0x5c,0xaf
+,0xa8,0xe5,0x87,0x76,0x14,0xe1,0x43,0xe6
+,0x84,0x20
+,0xf8,0xeb,0xea,0x48,0x75,0x04,0x40,0x66
+,0xfc,0x16,0x2a,0x06,0x04,0xe1,0x71,0xfe
+,0xec,0xfb,0x3d,0x20,0x42,0x52,0x48,0x56
+,0x3b,0xcf,0xd5,0xa1,0x55,0xdc,0xc4,0x7b
+,0xbd,0xa7,0x0b,0x86,0xe5,0xab,0x9b,0x55
+,0x00,0x2b,0xd1,0x27,0x4c,0x02,0xdb,0x35
+,0x32,0x1a,0xcd,0x7a,0xf8,0xb2,0xe2,0xd2
+,0x50,0x15,0xe1,0x36,0xb7,0x67,0x94,0x58
+,0xe9,0xf4,0x32,0x43,0xbf,0x71,0x9d,0x63
+,0x9b,0xad,0xb5,0xfe,0xac,0x03,0xf8,0x0a
+,0x19,0xa9,0x6e,0xf1,0x0c,0xb1,0xd1,0x53
+,0x33,0xa8,0x37,0xb9,0x09,0x46,0xba,0x38
+,0x54,0xee,0x74,0xda,0x3f,0x25,0x85,0xef
+,0xc7,0xe1,0xe1,0x70,0xe1,0x7e,0x15,0xe5
+,0x63,0xe7,0xe0,0x96,0xe0,0x33,0xd9,0x1b
+,0x63,0xf7,0xac,0x92,0xe9,0x97,0x2e,0x0d
+,0x43,0xe5
+,0xf8,0xeb,0xea,0x48,0x75,0x04,0x40,0x66
+,0xfc,0x16,0x2a,0x06,0x04,0xe1,0x71,0xfe
+,0xec,0xfb,0x3d,0x20,0x42,0x52,0x48,0x56
+,0x3b,0xcf,0xd5,0xa1,0x55,0xdc,0xc4,0x7b
+,0xbd,0xa7,0x0b,0x86,0xe5,0xab,0x9b,0x55
+,0x00,0x2b,0xd1,0x27,0x4c,0x02,0xdb,0x35
+,0x32,0x1a,0xcd,0x7a,0xf8,0xb2,0xe2,0xd2
+,0x50,0x15,0xe1,0x36,0xb7,0x67,0x94,0x58
+,0xe9,0xf4,0x32,0x43,0xbf,0x71,0x9d,0x63
+,0x9b,0xad,0xb5,0xfe,0xac,0x03,0xf8,0x0a
+,0x19,0xa9,0x6e,0xf1,0x0c,0xb1,0xd1,0x53
+,0x33,0xa8,0x37,0xb9,0x09,0x46,0xba,0x38
+,0x54,0xee,0x74,0xda,0x3f,0x25,0x85,0xef
+,0xc7,0xe1,0xe1,0x70,0xe1,0x7e,0x15,0xe5
+,0x63,0xe7,0xe0,0x96,0xe0,0x33,0xd9,0x1b
+,0x63,0xf7,0xac,0x92,0xe9,0x97,0x2e,0x0d
+,0x43,0xe5
diff -Nru libsodium-1.0.16/test/default/auth3.c libsodium-1.0.18/test/default/auth3.c
--- libsodium-1.0.16/test/default/auth3.c 2017-12-13 09:24:13.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.16/test/default/auth5.c libsodium-1.0.18/test/default/auth5.c
--- libsodium-1.0.16/test/default/auth5.c 2017-12-13 09:24:13.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.16/test/default/auth7.c libsodium-1.0.18/test/default/auth7.c
--- libsodium-1.0.16/test/default/auth7.c 2017-12-13 09:24:13.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.16/test/default/auth.c libsodium-1.0.18/test/default/auth.c
--- libsodium-1.0.16/test/default/auth.c 2017-12-13 09:24:13.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() ==
@@ -55,7 +57,7 @@
memset(a2, 0, sizeof a2);
crypto_auth_hmacsha256_init(&st256, key2, sizeof key2);
- crypto_auth_hmacsha256_update(&st256, NULL, 0U);
+ crypto_auth_hmacsha256_update(&st256, guard_page, 0U);
crypto_auth_hmacsha256_update(&st256, c, 1U);
crypto_auth_hmacsha256_update(&st256, c, sizeof c - 2U);
crypto_auth_hmacsha256_final(&st256, a2);
@@ -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.16/test/default/box_easy.c libsodium-1.0.18/test/default/box_easy.c
--- libsodium-1.0.16/test/default/box_easy.c 2017-12-13 09:24:13.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.16/test/default/box_seal.c libsodium-1.0.18/test/default/box_seal.c
--- libsodium-1.0.16/test/default/box_seal.c 2017-12-13 09:24:13.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.16/test/default/box_seal.exp libsodium-1.0.18/test/default/box_seal.exp
--- libsodium-1.0.16/test/default/box_seal.exp 2017-12-13 09:24:13.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.16/test/default/chacha20.c libsodium-1.0.18/test/default/chacha20.c
--- libsodium-1.0.16/test/default/chacha20.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/chacha20.c 2019-05-30 20:13:18.000000000 +0000
@@ -105,7 +105,7 @@
1U },
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
"000000090000004a00000000",
- 0xffffffff }};
+ 0xfeffffff }};
unsigned char key[crypto_stream_chacha20_KEYBYTES];
unsigned char nonce[crypto_stream_chacha20_IETF_NONCEBYTES];
unsigned char *part;
diff -Nru libsodium-1.0.16/test/default/chacha20.exp libsodium-1.0.18/test/default/chacha20.exp
--- libsodium-1.0.16/test/default/chacha20.exp 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/chacha20.exp 2019-05-30 20:13:18.000000000 +0000
@@ -35,7 +35,7 @@
[72d54dfbf12ec44b362692df94137f328fea8da73990265ec1bbbea1ae9af0ca13b25aa26cb4a648cb9b9d1be65b2c0924a66c54d545ec1b7374f4872e99f096bf74dbd52cc4fc95ceb6097fe5e65358c9dbc0a5ecbf7894a132a9a54ae3e951f2e9f209aa9c3d9a877ac9dab62433d2961a17d103e455dfb7337c90f6857aad233065955a212b5c7a8eab4dc8a629e5b6b8ba914afd06de7177054b33d21c96]
[c2c64d378cd536374ae204b9ef933fcd1a8b2288b3dfa49672ab765b54ee27c78a970e0e955c14f3a88e741b97c286f75f8fc299e8148362fa198a39531bed6d1a91288c874ec254f322c2a197340c55bb3e9b3998f7de2309486a0bb494abd20c9c5ef99c1370d61e77f408ac5514f49202bcc6828d45409d2d1416f8ae106b06ebd2541256264fa415bd54cb12e1d4449ed85299a1b7a249b75ff6c89b2e3f]
[10f1e7e4d13b5915500fdd1fa32071c4c7d1f4c733c068030422aa9ac3d46c4ed2826446079faa0914c2d705d98b02a2b5129cd1de164eb9cbd083e8a2503c4e0a88837739d7bf4ef8ccacb0ea2bb9d69d56c394aa351dfda5bf459f0a2e9fe8e721f89255f9c486bf21679c683d4f9c5cf2fa27865526005b06ca374c86af3bdcbfbdcb83be65862ed5c20eae5a43241d6a92da6dca9a156be25297f51c2718]
-[ff2941b8d740f6cbb50936bf997ebd5218cb108dc53f41c64841d0218167430ca03b770ca74ccb642a28194d1dedd2ed13151e25ec5d7faeb6d060bfb7e6b146880b67b55162bca26abe045fad14b0f492a3f369dcd52f98bc1513eaf238a3f434c7527121b4b756613e270395358d831d4950b6c7812fb724dc7c9be5e5c62ec8796d6690205061108b113f695582e4cf5d8b51112a51d157ef15e2cb95e4d5]
+[75924bad7831b25662dbac54b46827990b6168ae990e7bd7e1fd2ad282bf23ef052c7d1a0a6c1ef862070943a0d4da24705fbc006dfb85e2af18c0a264d772a44c70fbedac9d6a6867ff6be0a32826507f2c784101583211c9e2453d4cc8b283d5e86682bd4bf511271b91dbd351415f5a009d1f78b64085a9a4341be7d42e2679d57e2747097f0129950e2c9e9ca1356022d45da252af71ac37f351a2e77911]
[61010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101]
[6146f256040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404]
[6146f2564fe1bd070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707]
diff -Nru libsodium-1.0.16/test/default/cmptest.h libsodium-1.0.18/test/default/cmptest.h
--- libsodium-1.0.16/test/default/cmptest.h 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/cmptest.h 2019-05-30 20:13:18.000000000 +0000
@@ -7,11 +7,12 @@
#endif
#include
+#include
+#include
#include
#include
#include
#include
-#include
#include "sodium.h"
#include "quirks.h"
@@ -34,6 +35,8 @@
int xmain(void);
+static unsigned char *guard_page;
+
#ifdef BENCHMARKS
# include
@@ -42,6 +45,77 @@
# define ITERATIONS 128
# endif
+struct {
+ void *pnt;
+ size_t size;
+} mempool[1024];
+
+static size_t mempool_idx;
+
+static __attribute__((malloc)) void *mempool_alloc(size_t size)
+{
+ size_t i;
+ if (size >= (size_t) 0x80000000 - (size_t) 0x00000fff) {
+ return NULL;
+ }
+ size = (size + (size_t) 0x00000fff) & ~ (size_t) 0x00000fff;
+ for (i = 0U; i < mempool_idx; i++) {
+ if (mempool[i].size >= (size | (size_t) 0x80000000)) {
+ mempool[i].size &= ~ (size_t) 0x80000000;
+ return mempool[i].pnt;
+ }
+ }
+ if (mempool_idx >= sizeof mempool / sizeof mempool[0]) {
+ return NULL;
+ }
+ mempool[mempool_idx].size = size;
+ return (mempool[mempool_idx++].pnt = (void *) malloc(size));
+}
+
+static void mempool_free(void *pnt)
+{
+ size_t i;
+ for (i = 0U; i < mempool_idx; i++) {
+ if (mempool[i].pnt == pnt) {
+ if ((mempool[i].size & (size_t) 0x80000000) != (size_t) 0x0) {
+ break;
+ }
+ mempool[i].size |= (size_t) 0x80000000;
+ return;
+ }
+ }
+ abort();
+}
+
+static __attribute__((malloc)) void *mempool_allocarray(size_t count, size_t size)
+{
+ if (count > (size_t) 0U && size >= (size_t) SIZE_MAX / count) {
+ return NULL;
+ }
+ return mempool_alloc(count * size);
+}
+
+static int mempool_free_all(void)
+{
+ size_t i;
+ int ret = 0;
+
+ for (i = 0U; i < mempool_idx; i++) {
+ if ((mempool[i].size & (size_t) 0x80000000) == (size_t) 0x0) {
+ ret = -1;
+ }
+ free(mempool[i].pnt);
+ mempool[i].pnt = NULL;
+ }
+ mempool_idx = (size_t) 0U;
+
+ return ret;
+}
+
+#define sodium_malloc(X) mempool_alloc(X)
+#define sodium_free(X) mempool_free(X)
+#define sodium_allocarray(X, Y) mempool_allocarray((X), (Y))
+
static unsigned long long now(void)
{
struct timeval tp;
@@ -65,7 +139,10 @@
if (sodium_init() != 0) {
return 99;
}
+
+#ifndef __EMSCRIPTEN__
randombytes_set_implementation(&randombytes_salsa20_implementation);
+#endif
ts_start = now();
for (i = 0; i < ITERATIONS; i++) {
if (xmain() != 0) {
@@ -74,20 +151,25 @@
}
ts_end = now();
printf("%llu\n", 1000000ULL * (ts_end - ts_start) / ITERATIONS);
-
+ if (mempool_free_all() != 0) {
+ fprintf(stderr, "** memory leaks detected **\n");
+ return 99;
+ }
return 0;
}
+#undef printf
#define printf(...) do { } while(0)
#elif !defined(BROWSER_TESTS)
-FILE *fp_res;
+static FILE *fp_res;
int main(void)
{
- FILE *fp_out;
- int c;
+ FILE *fp_out;
+ unsigned char *_guard_page;
+ int c;
if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
perror("fopen(" TEST_NAME_RES ")");
@@ -96,6 +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;
}
@@ -109,6 +200,7 @@
return 99;
}
} while (c != EOF);
+ sodium_free(_guard_page);
return 0;
}
diff -Nru libsodium-1.0.16/test/default/codecs.c libsodium-1.0.18/test/default/codecs.c
--- libsodium-1.0.16/test/default/codecs.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/codecs.c 2019-05-30 20:13:18.000000000 +0000
@@ -11,16 +11,20 @@
char *b64_;
const char *b64_end;
unsigned char *bin;
- unsigned char *bin_padded;
const char *hex;
const char *hex_end;
size_t b64_len;
- size_t bin_len, bin_len2;
+ size_t bin_len;
unsigned int i;
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);
@@ -80,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));
@@ -93,7 +104,7 @@
sodium_bin2base64(buf3, 33U, (const unsigned char *) "\xfb\xf0\xf1" "0123456789ABCDEFabc",
22U, sodium_base64_VARIANT_URLSAFE_NO_PADDING));
printf("%s\n",
- sodium_bin2base64(buf3, 1U, NULL,
+ sodium_bin2base64(buf3, 1U, guard_page,
0U, sodium_base64_VARIANT_ORIGINAL));
printf("%s\n",
sodium_bin2base64(buf3, 5U, (const unsigned char *) "a",
@@ -105,7 +116,7 @@
sodium_bin2base64(buf3, 5U, (const unsigned char *) "abc",
3U, sodium_base64_VARIANT_ORIGINAL));
printf("%s\n",
- sodium_bin2base64(buf3, 1U, NULL,
+ sodium_bin2base64(buf3, 1U, guard_page,
0U, sodium_base64_VARIANT_ORIGINAL_NO_PADDING));
printf("%s\n",
sodium_bin2base64(buf3, 3U, (const unsigned char *) "a",
@@ -161,21 +172,21 @@
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), " \r\n", NULL,
NULL, sodium_base64_VARIANT_URLSAFE_NO_PADDING) == -1);
- assert(sodium_base642bin(NULL, (size_t) 10U, "a=", (size_t) 2U, NULL, NULL, NULL,
+ assert(sodium_base642bin(guard_page, (size_t) 10U, "a=", (size_t) 2U, NULL, NULL, NULL,
sodium_base64_VARIANT_URLSAFE) == -1);
- assert(sodium_base642bin(NULL, (size_t) 10U, "a*", (size_t) 2U, NULL, NULL, NULL,
+ assert(sodium_base642bin(guard_page, (size_t) 10U, "a*", (size_t) 2U, NULL, NULL, NULL,
sodium_base64_VARIANT_URLSAFE) == -1);
- assert(sodium_base642bin(NULL, (size_t) 10U, "a*", (size_t) 2U, "~", NULL, NULL,
+ assert(sodium_base642bin(guard_page, (size_t) 10U, "a*", (size_t) 2U, "~", NULL, NULL,
sodium_base64_VARIANT_URLSAFE) == -1);
- assert(sodium_base642bin(NULL, (size_t) 10U, "a*", (size_t) 2U, "*", NULL, NULL,
+ assert(sodium_base642bin(guard_page, (size_t) 10U, "a*", (size_t) 2U, "*", NULL, NULL,
sodium_base64_VARIANT_URLSAFE) == -1);
- assert(sodium_base642bin(NULL, (size_t) 10U, "a==", (size_t) 3U, NULL, NULL, NULL,
+ assert(sodium_base642bin(guard_page, (size_t) 10U, "a==", (size_t) 3U, NULL, NULL, NULL,
sodium_base64_VARIANT_URLSAFE) == -1);
- assert(sodium_base642bin(NULL, (size_t) 10U, "a=*", (size_t) 3U, NULL, NULL, NULL,
+ assert(sodium_base642bin(guard_page, (size_t) 10U, "a=*", (size_t) 3U, NULL, NULL, NULL,
sodium_base64_VARIANT_URLSAFE) == -1);
- assert(sodium_base642bin(NULL, (size_t) 10U, "a=*", (size_t) 3U, "~", NULL, NULL,
+ assert(sodium_base642bin(guard_page, (size_t) 10U, "a=*", (size_t) 3U, "~", NULL, NULL,
sodium_base64_VARIANT_URLSAFE) == -1);
- assert(sodium_base642bin(NULL, (size_t) 10U, "a=*", (size_t) 3U, "*", NULL, NULL,
+ assert(sodium_base642bin(guard_page, (size_t) 10U, "a=*", (size_t) 3U, "*", NULL, NULL,
sodium_base64_VARIANT_URLSAFE) == -1);
assert(sodium_base642bin(buf1, sizeof buf1, "O1R", (size_t) 3U, NULL, NULL, NULL,
@@ -202,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.16/test/default/codecs.exp libsodium-1.0.18/test/default/codecs.exp
--- libsodium-1.0.16/test/default/codecs.exp 2017-12-13 09:24:13.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.16/test/default/core_ed25519.c libsodium-1.0.18/test/default/core_ed25519.c
--- libsodium-1.0.16/test/default/core_ed25519.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/core_ed25519.c 2019-05-30 20:13:18.000000000 +0000
@@ -23,43 +23,66 @@
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
};
- unsigned char c = 0U;
- unsigned int i;
- unsigned int s;
-
- for (i = 0U; i < 32U; i++) {
- s = S[i] + P[i] + c;
- S[i] = (unsigned char) s;
- c = (s >> 8) & 1;
- }
+
+ sodium_add(S, P, sizeof P);
+}
+
+static void
+add_l64(unsigned char * const S)
+{
+ static const unsigned char l[crypto_core_ed25519_NONREDUCEDSCALARBYTES] =
+ { 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,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ sodium_add(S, l, sizeof l);
}
int
main(void)
{
- unsigned char *h;
+ unsigned char *h, *r;
unsigned char *p, *p2, *p3;
- unsigned char *sc;
- int i, j;
+ 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);
- j = 1 + (int) randombytes_uniform(100);
+ crypto_core_ed25519_random(p2);
+
+ j = 1 + (unsigned int) randombytes_uniform(100);
memcpy(p3, p, crypto_core_ed25519_BYTES);
for (i = 0; i < j; i++) {
crypto_core_ed25519_add(p, p, p2);
@@ -135,15 +158,254 @@
assert(crypto_core_ed25519_sub(p3, non_canonical_p, p3) == 0);
assert(crypto_core_ed25519_sub(p3, non_canonical_invalid_p, p3) == -1);
+ for (i = 0; i < 1000; i++) {
+ 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");
+ }
+ assert(crypto_core_ed25519_is_valid_point(p2));
+ if (crypto_core_ed25519_scalar_invert(sc, sc) != 0) {
+ printf("crypto_core_ed25519_scalar_invert() failed\n");
+ }
+ if (crypto_scalarmult_ed25519_noclamp(p3, sc, p2) != 0) {
+ printf("crypto_scalarmult_ed25519_noclamp() failed\n");
+ }
+ assert(memcmp(p3, p, crypto_core_ed25519_BYTES) == 0);
+ }
+
+ sc64 = (unsigned char *) sodium_malloc(64);
+ crypto_core_ed25519_scalar_random(sc);
+ memcpy(sc64, sc, crypto_core_ed25519_BYTES);
+ memset(sc64 + crypto_core_ed25519_BYTES, 0,
+ 64 - crypto_core_ed25519_BYTES);
+ i = (unsigned int) randombytes_uniform(100);
+ do {
+ add_l64(sc64);
+ } while (i-- > 0);
+ crypto_core_ed25519_scalar_reduce(sc64, sc64);
+ if (memcmp(sc64, sc, crypto_core_ed25519_BYTES) != 0) {
+ printf("crypto_core_ed25519_scalar_reduce() failed\n");
+ }
+
+ 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) {
+ printf("crypto_scalarmult_ed25519_noclamp() failed (1)\n");
+ }
+ crypto_core_ed25519_scalar_complement(sc, sc);
+ if (crypto_scalarmult_ed25519_noclamp(p2, sc, p2) != 0) {
+ printf("crypto_scalarmult_ed25519_noclamp() failed (2)\n");
+ }
+ crypto_core_ed25519_add(p3, p, p2);
+ 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);
+ }
+
+ 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) {
+ printf("crypto_scalarmult_ed25519_noclamp() failed (3)\n");
+ }
+ crypto_core_ed25519_scalar_negate(sc, sc);
+ if (crypto_scalarmult_ed25519_noclamp(p2, sc, p2) != 0) {
+ printf("crypto_scalarmult_ed25519_noclamp() failed (4)\n");
+ }
+ crypto_core_ed25519_add(p, p, p2);
+ assert(p[0] == 0x01);
+ for (i = 1; i < crypto_core_ed25519_BYTES; i++) {
+ assert(p[i] == 0);
+ }
+
+ hex = (char *) sodium_malloc(crypto_core_ed25519_SCALARBYTES * 2 + 1);
+
+ for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
+ sc[i] = 255 - i;
+ }
+ if (crypto_core_ed25519_scalar_invert(sc, sc) != 0) {
+ printf("crypto_core_ed25519_scalar_invert() failed\n");
+ }
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("inv1: %s\n", hex);
+ if (crypto_core_ed25519_scalar_invert(sc, sc) != 0) {
+ printf("crypto_core_ed25519_scalar_invert() failed\n");
+ }
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("inv2: %s\n", hex);
+ for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
+ sc[i] = 32 - i;
+ }
+ if (crypto_core_ed25519_scalar_invert(sc, sc) != 0) {
+ printf("crypto_core_ed25519_scalar_invert() failed\n");
+ }
+
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("inv3: %s\n", hex);
+ if (crypto_core_ed25519_scalar_invert(sc, sc) != 0) {
+ printf("crypto_core_ed25519_scalar_invert() failed\n");
+ }
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("inv4: %s\n", hex);
+
+ for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
+ sc[i] = 255 - i;
+ }
+ crypto_core_ed25519_scalar_negate(sc, sc);
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("neg1: %s\n", hex);
+ crypto_core_ed25519_scalar_negate(sc, sc);
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("neg2: %s\n", hex);
+ for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
+ sc[i] = 32 - i;
+ }
+ crypto_core_ed25519_scalar_negate(sc, sc);
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("neg3: %s\n", hex);
+ crypto_core_ed25519_scalar_negate(sc, sc);
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("neg4: %s\n", hex);
+
+ for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
+ sc[i] = 255 - i;
+ }
+ crypto_core_ed25519_scalar_complement(sc, sc);
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("comp1: %s\n", hex);
+ crypto_core_ed25519_scalar_complement(sc, sc);
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("comp2: %s\n", hex);
+ for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
+ sc[i] = 32 - i;
+ }
+ crypto_core_ed25519_scalar_complement(sc, sc);
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("comp3: %s\n", hex);
+ crypto_core_ed25519_scalar_complement(sc, sc);
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("comp4: %s\n", hex);
+
+ sc2 = (unsigned char *) sodium_malloc(crypto_core_ed25519_SCALARBYTES);
+ sc3 = (unsigned char *) sodium_malloc(crypto_core_ed25519_SCALARBYTES);
+ for (i = 0; i < 1000; i++) {
+ randombytes_buf(sc, crypto_core_ed25519_SCALARBYTES);
+ randombytes_buf(sc2, crypto_core_ed25519_SCALARBYTES);
+ sc[crypto_core_ed25519_SCALARBYTES - 1] &= 0x7f;
+ sc2[crypto_core_ed25519_SCALARBYTES - 1] &= 0x7f;
+ crypto_core_ed25519_scalar_add(sc3, sc, sc2);
+ assert(!sodium_is_zero(sc, crypto_core_ed25519_SCALARBYTES));
+ crypto_core_ed25519_scalar_sub(sc3, sc3, sc2);
+ assert(!sodium_is_zero(sc, crypto_core_ed25519_SCALARBYTES));
+ crypto_core_ed25519_scalar_sub(sc3, sc3, sc);
+ assert(sodium_is_zero(sc3, crypto_core_ed25519_SCALARBYTES));
+ }
+
+ 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,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("add1: %s\n", hex);
+
+ crypto_core_ed25519_scalar_sub(sc, sc2, sc);
+ crypto_core_ed25519_scalar_sub(sc, sc, sc2);
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("sub1: %s\n", hex);
+
+ 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,
+ sc, crypto_core_ed25519_SCALARBYTES);
+ printf("add2: %s\n", hex);
+
+ crypto_core_ed25519_scalar_sub(sc, sc2, sc);
+ crypto_core_ed25519_scalar_sub(sc, sc, sc2);
+ sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
+ 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);
+ sodium_free(sc2);
sodium_free(sc);
sodium_free(p3);
sodium_free(p2);
sodium_free(p);
+ sodium_free(r);
sodium_free(h);
assert(crypto_core_ed25519_BYTES == crypto_core_ed25519_bytes());
+ assert(crypto_core_ed25519_SCALARBYTES == crypto_core_ed25519_scalarbytes());
+ assert(crypto_core_ed25519_NONREDUCEDSCALARBYTES == crypto_core_ed25519_nonreducedscalarbytes());
+ 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.16/test/default/core_ed25519.exp libsodium-1.0.18/test/default/core_ed25519.exp
--- libsodium-1.0.16/test/default/core_ed25519.exp 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/core_ed25519.exp 2019-05-30 20:13:18.000000000 +0000
@@ -1 +1,18 @@
+inv1: 5858cdec40a044b1548b3bb08f8ce0d71103d1f887df84ebc502643dac4df40b
+inv2: 09688ce78a8ff8273f636b0bc748c0cceeeeedecebeae9e8e7e6e5e4e3e2e100
+inv3: f70b4f272b47bd6a1015a511fb3c9fc1b9c21ca4ca2e17d5a225b4c410b9b60d
+inv4: 201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201
+neg1: e46b69758fd3193097398c9717b11e48111112131415161718191a1b1c1d1e0f
+neg2: 09688ce78a8ff8273f636b0bc748c0cceeeeedecebeae9e8e7e6e5e4e3e2e100
+neg3: cdb4d73ffe47f83ebe85e18dcae6cc03f0f0f1f2f3f4f5f6f7f8f9fafbfcfd0e
+neg4: 201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201
+comp1: e56b69758fd3193097398c9717b11e48111112131415161718191a1b1c1d1e0f
+comp2: 09688ce78a8ff8273f636b0bc748c0cceeeeedecebeae9e8e7e6e5e4e3e2e100
+comp3: ceb4d73ffe47f83ebe85e18dcae6cc03f0f0f1f2f3f4f5f6f7f8f9fafbfcfd0e
+comp4: 201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201
+add1: f7567cd87c82ec1c355a6304c143bcc9ecedededededededededededededed0d
+sub1: f67c79849de0253ba142949e1db6224b13121212121212121212121212121202
+add2: b02e8581ce62f69922427c23f970f7e951525252525252525252525252525202
+sub2: 3da570db4b001cbeb35a7b7fe588e72aaeadadadadadadadadadadadadadad0d
+mul: 4453ef38408c06677c1b810e4bf8b1991f01c88716fbfa2f075a518b77da400b
OK
diff -Nru libsodium-1.0.16/test/default/core_ristretto255.c libsodium-1.0.18/test/default/core_ristretto255.c
--- libsodium-1.0.16/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.16/test/default/core_ristretto255.exp libsodium-1.0.18/test/default/core_ristretto255.exp
--- libsodium-1.0.16/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.16/test/default/ed25519_convert.c libsodium-1.0.18/test/default/ed25519_convert.c
--- libsodium-1.0.16/test/default/ed25519_convert.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/ed25519_convert.c 2019-05-30 20:13:18.000000000 +0000
@@ -18,16 +18,10 @@
unsigned char curve25519_sk[crypto_scalarmult_curve25519_BYTES];
char curve25519_pk_hex[crypto_scalarmult_curve25519_BYTES * 2 + 1];
char curve25519_sk_hex[crypto_scalarmult_curve25519_BYTES * 2 + 1];
- unsigned char hseed[crypto_hash_sha512_BYTES];
unsigned int i;
assert(crypto_sign_ed25519_SEEDBYTES <= crypto_hash_sha512_BYTES);
-#ifdef ED25519_NONDETERMINISTIC
- crypto_hash_sha512(hseed, keypair_seed, crypto_sign_ed25519_SEEDBYTES);
-#else
- memcpy(hseed, keypair_seed, crypto_sign_ed25519_SEEDBYTES);
-#endif
- crypto_sign_ed25519_seed_keypair(ed25519_pk, ed25519_skpk, hseed);
+ crypto_sign_ed25519_seed_keypair(ed25519_pk, ed25519_skpk, keypair_seed);
if (crypto_sign_ed25519_pk_to_curve25519(curve25519_pk, ed25519_pk) != 0) {
printf("conversion failed\n");
diff -Nru libsodium-1.0.16/test/default/generichash2.c libsodium-1.0.18/test/default/generichash2.c
--- libsodium-1.0.16/test/default/generichash2.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/generichash2.c 2019-05-30 20:13:18.000000000 +0000
@@ -6,51 +6,57 @@
main(void)
{
#define MAXLEN 64
- crypto_generichash_state st;
- unsigned char in[MAXLEN], out[crypto_generichash_BYTES_MAX],
- k[crypto_generichash_KEYBYTES_MAX];
- size_t h, i, j;
+ crypto_generichash_state *st;
+ unsigned char in[MAXLEN];
+ unsigned char out[crypto_generichash_BYTES_MAX];
+ unsigned char k[crypto_generichash_KEYBYTES_MAX];
+ size_t h, i, j;
- assert(crypto_generichash_statebytes() >= sizeof st);
- for (h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h)
+ assert(crypto_generichash_statebytes() >= sizeof *st);
+ st = (crypto_generichash_state *)
+ sodium_malloc(crypto_generichash_statebytes());
+ for (h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h) {
k[h] = (unsigned char) h;
-
+ }
for (i = 0; i < MAXLEN; ++i) {
in[i] = (unsigned char) i;
- if (crypto_generichash_init(&st, k,
+ if (crypto_generichash_init(st, k,
1 + i % crypto_generichash_KEYBYTES_MAX,
1 + i % crypto_generichash_BYTES_MAX) != 0) {
printf("crypto_generichash_init()\n");
return 1;
}
- crypto_generichash_update(&st, in, i);
- crypto_generichash_update(&st, in, i);
- crypto_generichash_update(&st, in, i);
- if (crypto_generichash_final(&st, out,
+ crypto_generichash_update(st, in, i);
+ crypto_generichash_update(st, in, i);
+ crypto_generichash_update(st, in, i);
+ if (crypto_generichash_final(st, out,
1 + i % crypto_generichash_BYTES_MAX) != 0) {
printf("crypto_generichash_final() should have returned 0\n");
}
for (j = 0; j < 1 + i % crypto_generichash_BYTES_MAX; ++j) {
- printf("%02x", (unsigned int)out[j]);
+ printf("%02x", (unsigned int) out[j]);
}
printf("\n");
- if (crypto_generichash_final(&st, out,
+ if (crypto_generichash_final(st, out,
1 + i % crypto_generichash_BYTES_MAX) != -1) {
printf("crypto_generichash_final() should have returned -1\n");
}
}
- assert(crypto_generichash_init(&st, k, sizeof k, 0U) == -1);
- assert(crypto_generichash_init(&st, k, sizeof k,
+ assert(crypto_generichash_init(st, k, sizeof k, 0U) == -1);
+ assert(crypto_generichash_init(st, k, sizeof k,
crypto_generichash_BYTES_MAX + 1U) == -1);
- assert(crypto_generichash_init(&st, k, crypto_generichash_KEYBYTES_MAX + 1U,
+ assert(crypto_generichash_init(st, k, crypto_generichash_KEYBYTES_MAX + 1U,
sizeof out) == -1);
- assert(crypto_generichash_init(&st, k, 0U, sizeof out) == 0);
- assert(crypto_generichash_init(&st, k, 1U, sizeof out) == 0);
- assert(crypto_generichash_init(&st, NULL, 1U, 0U) == -1);
- assert(crypto_generichash_init(&st, NULL, crypto_generichash_KEYBYTES,
+ assert(crypto_generichash_init(st, k, 0U, sizeof out) == 0);
+ assert(crypto_generichash_init(st, k, 1U, sizeof out) == 0);
+ assert(crypto_generichash_init(st, NULL, 1U, 0U) == -1);
+ assert(crypto_generichash_init(st, NULL, crypto_generichash_KEYBYTES,
1U) == 0);
- assert(crypto_generichash_init(&st, NULL, crypto_generichash_KEYBYTES,
+ assert(crypto_generichash_init(st, NULL, crypto_generichash_KEYBYTES,
0U) == -1);
+
+ sodium_free(st);
+
return 0;
}
diff -Nru libsodium-1.0.16/test/default/generichash3.c libsodium-1.0.18/test/default/generichash3.c
--- libsodium-1.0.16/test/default/generichash3.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/generichash3.c 2019-05-30 20:13:18.000000000 +0000
@@ -131,15 +131,15 @@
printf("\n");
assert(crypto_generichash_blake2b_salt_personal
- (NULL, 0,
+ (guard_page, 0,
in, (unsigned long long) sizeof in,
k, sizeof k, NULL, NULL) == -1);
assert(crypto_generichash_blake2b_salt_personal
- (NULL, crypto_generichash_BYTES_MAX + 1,
+ (guard_page, crypto_generichash_BYTES_MAX + 1,
in, (unsigned long long) sizeof in,
k, sizeof k, NULL, NULL) == -1);
assert(crypto_generichash_blake2b_salt_personal
- (NULL, (unsigned long long) sizeof in,
+ (guard_page, (unsigned long long) sizeof in,
in, (unsigned long long) sizeof in,
k, crypto_generichash_KEYBYTES_MAX + 1, NULL, NULL) == -1);
diff -Nru libsodium-1.0.16/test/default/generichash.c libsodium-1.0.18/test/default/generichash.c
--- libsodium-1.0.16/test/default/generichash.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/generichash.c 2019-05-30 20:13:18.000000000 +0000
@@ -1367,13 +1367,13 @@
}
printf("\n");
- assert(crypto_generichash(NULL, 0,
+ assert(crypto_generichash(guard_page, 0,
in, (unsigned long long) sizeof in,
k, sizeof k) == -1);
- assert(crypto_generichash(NULL, crypto_generichash_BYTES_MAX + 1,
+ assert(crypto_generichash(guard_page, crypto_generichash_BYTES_MAX + 1,
in, (unsigned long long) sizeof in,
k, sizeof k) == -1);
- assert(crypto_generichash(NULL, (unsigned long long) sizeof in,
+ assert(crypto_generichash(guard_page, (unsigned long long) sizeof in,
in, (unsigned long long) sizeof in,
k, crypto_generichash_KEYBYTES_MAX + 1) == -1);
diff -Nru libsodium-1.0.16/test/default/kdf.c libsodium-1.0.18/test/default/kdf.c
--- libsodium-1.0.16/test/default/kdf.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/kdf.c 2019-05-30 20:13:18.000000000 +0000
@@ -13,8 +13,9 @@
int ret;
context = (char *) sodium_malloc(crypto_kdf_CONTEXTBYTES);
- memcpy(context, "KDF test", strlen("KDF test"));
master_key = (unsigned char *) sodium_malloc(crypto_kdf_KEYBYTES);
+
+ memcpy(context, "KDF test", sizeof "KDF test" -1U);
for (i = 0; i < crypto_kdf_KEYBYTES; i++) {
master_key[i] = i;
}
@@ -41,6 +42,9 @@
sodium_free(subkey);
}
+ sodium_free(master_key);
+ sodium_free(context);
+
assert(strcmp(crypto_kdf_primitive(), crypto_kdf_PRIMITIVE) == 0);
assert(crypto_kdf_BYTES_MAX > 0);
assert(crypto_kdf_BYTES_MIN <= crypto_kdf_BYTES_MAX);
diff -Nru libsodium-1.0.16/test/default/Makefile.am libsodium-1.0.18/test/default/Makefile.am
--- libsodium-1.0.16/test/default/Makefile.am 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/Makefile.am 2019-05-30 20:13:18.000000000 +0000
@@ -1,10 +1,13 @@
EXTRA_DIST = \
cmptest.h \
+ wasi-test-wrapper.sh \
wintest.bat \
pre.js.inc \
aead_aes256gcm.exp \
+ aead_aes256gcm2.exp \
aead_chacha20poly1305.exp \
+ aead_chacha20poly13052.exp \
aead_xchacha20poly1305.exp \
auth.exp \
auth2.exp \
@@ -23,6 +26,7 @@
chacha20.exp \
codecs.exp \
core_ed25519.exp \
+ core_ristretto255.exp \
core1.exp \
core2.exp \
core3.exp \
@@ -51,10 +55,12 @@
randombytes.exp \
scalarmult.exp \
scalarmult_ed25519.exp \
+ scalarmult_ristretto255.exp \
scalarmult2.exp \
scalarmult5.exp \
scalarmult6.exp \
scalarmult7.exp \
+ scalarmult8.exp \
secretbox.exp \
secretbox2.exp \
secretbox7.exp \
@@ -79,7 +85,9 @@
DISTCLEANFILES = \
aead_aes256gcm.res \
+ aead_aes256gcm2.res \
aead_chacha20poly1305.res \
+ aead_chacha20poly13052.res \
aead_xchacha20poly1305.res \
auth.res \
auth2.res \
@@ -98,6 +106,7 @@
chacha20.res \
codecs.res \
core_ed25519.res \
+ core_ristretto255.res \
core1.res \
core2.res \
core3.res \
@@ -126,10 +135,12 @@
randombytes.res \
scalarmult.res \
scalarmult_ed25519.res \
+ scalarmult_ristretto255.res \
scalarmult2.res \
scalarmult5.res \
scalarmult6.res \
scalarmult7.res \
+ scalarmult8.res \
secretbox.res \
secretbox2.res \
secretbox7.res \
@@ -152,152 +163,6 @@
verify1.res \
xchacha20.res
-if NATIVECLIENT
-CLEANFILES = \
- aead_aes256gcm.final \
- aead_chacha20poly1305.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 \
- 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_chacha20poly1305.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 \
- 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 \
@@ -310,7 +175,9 @@
TESTS_TARGETS = \
aead_aes256gcm \
+ aead_aes256gcm2 \
aead_chacha20poly1305 \
+ aead_chacha20poly13052 \
aead_xchacha20poly1305 \
auth \
auth2 \
@@ -356,6 +223,7 @@
scalarmult5 \
scalarmult6 \
scalarmult7 \
+ scalarmult8 \
secretbox \
secretbox2 \
secretbox7 \
@@ -375,12 +243,10 @@
verify1
if !EMSCRIPTEN
-if !NATIVECLIENT
TESTS_TARGETS += \
sodium_utils2 \
sodium_utils3
endif
-endif
check_PROGRAMS = $(TESTS_TARGETS)
@@ -392,9 +258,15 @@
aead_aes256gcm_SOURCE = cmptest.h aead_aes256gcm.c
aead_aes256gcm_LDADD = $(TESTS_LDADD)
+aead_aes256gcm2_SOURCE = cmptest.h aead_aes256gcm2.c
+aead_aes256gcm2_LDADD = $(TESTS_LDADD)
+
aead_chacha20poly1305_SOURCE = cmptest.h aead_chacha20poly1305.c
aead_chacha20poly1305_LDADD = $(TESTS_LDADD)
+aead_chacha20poly13052_SOURCE = cmptest.h aead_chacha20poly13052.c
+aead_chacha20poly13052_LDADD = $(TESTS_LDADD)
+
aead_xchacha20poly1305_SOURCE = cmptest.h aead_xchacha20poly1305.c
aead_xchacha20poly1305_LDADD = $(TESTS_LDADD)
@@ -449,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)
@@ -530,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)
@@ -542,6 +420,9 @@
scalarmult7_SOURCE = cmptest.h scalarmult7.c
scalarmult7_LDADD = $(TESTS_LDADD)
+scalarmult8_SOURCE = cmptest.h scalarmult8.c
+scalarmult8_LDADD = $(TESTS_LDADD)
+
secretbox_SOURCE = cmptest.h secretbox.c
secretbox_LDADD = $(TESTS_LDADD)
@@ -608,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.16/test/default/misuse.c libsodium-1.0.18/test/default/misuse.c
--- libsodium-1.0.16/test/default/misuse.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/misuse.c 2019-05-30 20:13:18.000000000 +0000
@@ -19,8 +19,8 @@
(void) sig;
signal(SIGABRT, sigabrt_handler_15);
assert(crypto_box_curve25519xchacha20poly1305_easy
- (NULL, NULL, crypto_stream_xchacha20_MESSAGEBYTES_MAX - 1,
- NULL, NULL, NULL) == -1);
+ (guard_page, guard_page, crypto_stream_xchacha20_MESSAGEBYTES_MAX - 1,
+ guard_page, guard_page, guard_page) == -1);
exit(1);
}
@@ -30,8 +30,8 @@
(void) sig;
signal(SIGABRT, sigabrt_handler_14);
assert(crypto_box_curve25519xchacha20poly1305_easy_afternm
- (NULL, NULL, crypto_stream_xchacha20_MESSAGEBYTES_MAX - 1,
- NULL, NULL) == -1);
+ (guard_page, guard_page, crypto_stream_xchacha20_MESSAGEBYTES_MAX - 1,
+ guard_page, guard_page) == -1);
exit(1);
}
# endif
@@ -45,7 +45,8 @@
# else
signal(SIGABRT, sigabrt_handler_13);
# endif
- assert(crypto_pwhash_str_alg(NULL, "", 0U, 1U, 1U, -1) == -1);
+ assert(crypto_pwhash_str_alg((char *) guard_page,
+ "", 0U, 1U, 1U, -1) == -1);
exit(1);
}
@@ -54,8 +55,9 @@
{
(void) sig;
signal(SIGABRT, sigabrt_handler_12);
- assert(crypto_box_easy(NULL, NULL, crypto_stream_xsalsa20_MESSAGEBYTES_MAX,
- NULL, NULL, NULL) == -1);
+ assert(crypto_box_easy(guard_page, guard_page,
+ crypto_stream_xsalsa20_MESSAGEBYTES_MAX,
+ guard_page, guard_page, guard_page) == -1);
exit(1);
}
@@ -64,8 +66,9 @@
{
(void) sig;
signal(SIGABRT, sigabrt_handler_11);
- assert(crypto_box_easy_afternm(NULL, NULL, crypto_stream_xsalsa20_MESSAGEBYTES_MAX,
- NULL, NULL) == -1);
+ assert(crypto_box_easy_afternm(guard_page, guard_page,
+ crypto_stream_xsalsa20_MESSAGEBYTES_MAX,
+ guard_page, guard_page) == -1);
exit(1);
}
@@ -74,7 +77,8 @@
{
(void) sig;
signal(SIGABRT, sigabrt_handler_10);
- assert(sodium_base642bin(NULL, 1, NULL, 1, NULL, NULL, NULL, -1) == -1);
+ assert(sodium_base642bin(guard_page, 1, (const char *) guard_page, 1,
+ NULL, NULL, NULL, -1) == -1);
exit(1);
}
@@ -83,7 +87,8 @@
{
(void) sig;
signal(SIGABRT, sigabrt_handler_9);
- assert(sodium_bin2base64(NULL, 1, NULL, 1, sodium_base64_VARIANT_ORIGINAL) == NULL);
+ assert(sodium_bin2base64((char *) guard_page, 1, guard_page, 1,
+ sodium_base64_VARIANT_ORIGINAL) == NULL);
exit(1);
}
@@ -92,7 +97,8 @@
{
(void) sig;
signal(SIGABRT, sigabrt_handler_8);
- assert(sodium_bin2base64(NULL, 1, NULL, 1, -1) == NULL);
+ assert(sodium_bin2base64((char *) guard_page, 1,
+ guard_page, 1, -1) == NULL);
exit(1);
}
@@ -101,7 +107,7 @@
{
(void) sig;
signal(SIGABRT, sigabrt_handler_7);
- assert(sodium_pad(NULL, NULL, SIZE_MAX, 16, 1) == -1);
+ assert(sodium_pad(NULL, guard_page, SIZE_MAX, 16, 1) == -1);
exit(1);
}
@@ -110,8 +116,9 @@
{
(void) sig;
signal(SIGABRT, sigabrt_handler_6);
- assert(crypto_aead_xchacha20poly1305_ietf_encrypt(NULL, NULL, NULL, UINT64_MAX,
- NULL, 0, NULL, NULL, NULL) == -1);
+ assert(crypto_aead_xchacha20poly1305_ietf_encrypt(guard_page, NULL, NULL, UINT64_MAX,
+ NULL, 0, NULL,
+ guard_page, guard_page) == -1);
exit(1);
}
@@ -120,8 +127,9 @@
{
(void) sig;
signal(SIGABRT, sigabrt_handler_5);
- assert(crypto_aead_chacha20poly1305_ietf_encrypt(NULL, NULL, NULL, UINT64_MAX,
- NULL, 0, NULL, NULL, NULL) == -1);
+ assert(crypto_aead_chacha20poly1305_ietf_encrypt(guard_page, NULL, NULL, UINT64_MAX,
+ NULL, 0, NULL,
+ guard_page, guard_page) == -1);
exit(1);
}
@@ -130,8 +138,9 @@
{
(void) sig;
signal(SIGABRT, sigabrt_handler_4);
- assert(crypto_aead_chacha20poly1305_encrypt(NULL, NULL, NULL, UINT64_MAX,
- NULL, 0, NULL, NULL, NULL) == -1);
+ assert(crypto_aead_chacha20poly1305_encrypt(guard_page, NULL, NULL, UINT64_MAX,
+ NULL, 0, NULL,
+ guard_page, guard_page) == -1);
exit(1);
}
@@ -141,7 +150,7 @@
(void) sig;
signal(SIGABRT, sigabrt_handler_3);
#if SIZE_MAX > 0x4000000000ULL
- randombytes_buf_deterministic(NULL, 0x4000000001ULL, NULL);
+ randombytes_buf_deterministic(guard_page, 0x4000000001ULL, guard_page);
#else
abort();
#endif
@@ -153,7 +162,8 @@
{
(void) sig;
signal(SIGABRT, sigabrt_handler_2);
- assert(crypto_kx_server_session_keys(NULL, NULL, NULL, NULL, NULL) == -1);
+ assert(crypto_kx_server_session_keys(NULL, NULL, guard_page, guard_page,
+ guard_page) == -1);
exit(1);
}
@@ -161,7 +171,8 @@
main(void)
{
signal(SIGABRT, sigabrt_handler_1);
- assert(crypto_kx_client_session_keys(NULL, NULL, NULL, NULL, NULL) == -1);
+ assert(crypto_kx_client_session_keys(NULL, NULL, guard_page, guard_page,
+ guard_page) == -1);
return 1;
}
#else
diff -Nru libsodium-1.0.16/test/default/nacl-test-wrapper.sh libsodium-1.0.18/test/default/nacl-test-wrapper.sh
--- libsodium-1.0.16/test/default/nacl-test-wrapper.sh 2017-12-13 09:24:13.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.16/test/default/pre.js.inc libsodium-1.0.18/test/default/pre.js.inc
--- libsodium-1.0.16/test/default/pre.js.inc 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/pre.js.inc 2019-05-30 20:13:18.000000000 +0000
@@ -5,12 +5,14 @@
this['Module'] = Module = {};
}
if (typeof process === 'object') {
- Module['preRun'] = Module['preRun'] || [];
- Module['preRun'].push(function() {
- FS.init();
- FS.mkdir('/test-data');
- FS.mount(NODEFS, { root: '.' }, '/test-data');
- });
+ if (typeof(FS) === 'object') {
+ Module['preRun'] = Module['preRun'] || [];
+ Module['preRun'].push(function() {
+ FS.init();
+ FS.mkdir('/test-data');
+ FS.mount(NODEFS, { root: '.' }, '/test-data');
+ });
+ }
} else {
Module['print'] = function(x) {
var event = new Event('test-output');
diff -Nru libsodium-1.0.16/test/default/pwhash_argon2i.c libsodium-1.0.18/test/default/pwhash_argon2i.c
--- libsodium-1.0.16/test/default/pwhash_argon2i.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/pwhash_argon2i.c 2019-05-30 20:13:18.000000000 +0000
@@ -208,6 +208,7 @@
char *out;
char *passwd;
size_t i = 0U;
+ int ret;
do {
out = (char *) sodium_malloc(strlen(tests[i].out) + 1U);
@@ -216,13 +217,13 @@
passwd = (char *) sodium_malloc(strlen(tests[i].passwd) + 1U);
assert(passwd != NULL);
memcpy(passwd, tests[i].passwd, strlen(tests[i].passwd) + 1U);
- if (crypto_pwhash_str_verify(out, passwd, strlen(passwd)) != 0) {
+ ret = crypto_pwhash_str_verify(out, passwd, strlen(passwd));
+ sodium_free(out);
+ sodium_free(passwd);
+ if (ret != 0) {
printf("[tv3] pwhash_str failure (maybe intentional): [%u]\n",
(unsigned int) i);
- continue;
}
- sodium_free(out);
- sodium_free(passwd);
} while (++i < (sizeof tests) / (sizeof tests[0]));
}
diff -Nru libsodium-1.0.16/test/default/pwhash_argon2id.c libsodium-1.0.18/test/default/pwhash_argon2id.c
--- libsodium-1.0.16/test/default/pwhash_argon2id.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/pwhash_argon2id.c 2019-05-30 20:13:18.000000000 +0000
@@ -204,6 +204,7 @@
char *out;
char *passwd;
size_t i = 0U;
+ int ret;
do {
out = (char *) sodium_malloc(strlen(tests[i].out) + 1U);
@@ -212,13 +213,13 @@
passwd = (char *) sodium_malloc(strlen(tests[i].passwd) + 1U);
assert(passwd != NULL);
memcpy(passwd, tests[i].passwd, strlen(tests[i].passwd) + 1U);
- if (crypto_pwhash_str_verify(out, passwd, strlen(passwd)) != 0) {
+ ret = crypto_pwhash_str_verify(out, passwd, strlen(passwd));
+ sodium_free(out);
+ sodium_free(passwd);
+ if (ret != 0) {
printf("[tv3] pwhash_argon2id_str failure (maybe intentional): [%u]\n",
(unsigned int) i);
- continue;
}
- sodium_free(out);
- sodium_free(passwd);
} while (++i < (sizeof tests) / (sizeof tests[0]));
}
@@ -230,7 +231,6 @@
char *salt;
const char *passwd = "Correct Horse Battery Staple";
-
salt = (char *) sodium_malloc(crypto_pwhash_argon2id_SALTBYTES);
str_out = (char *) sodium_malloc(crypto_pwhash_argon2id_STRBYTES);
str_out2 = (char *) sodium_malloc(crypto_pwhash_argon2id_STRBYTES);
@@ -480,19 +480,19 @@
assert(crypto_pwhash_alg_argon2id13() != crypto_pwhash_alg_argon2i13());
assert(crypto_pwhash_alg_argon2id13() == crypto_pwhash_alg_default());
- assert(crypto_pwhash_argon2id(NULL, 0, NULL, 0, NULL,
+ assert(crypto_pwhash_argon2id(guard_page, 0, (const char *) guard_page, 0, guard_page,
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
0) == -1);
- assert(crypto_pwhash_argon2id(NULL, 0, NULL, 0, NULL,
+ assert(crypto_pwhash_argon2id(guard_page, 0, (const char *) guard_page, 0, guard_page,
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
crypto_pwhash_ALG_ARGON2I13) == -1);
- assert(crypto_pwhash_argon2i(NULL, 0, NULL, 0, NULL,
+ assert(crypto_pwhash_argon2i(guard_page, 0, (const char *) guard_page, 0, guard_page,
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
0) == -1);
- assert(crypto_pwhash_argon2i(NULL, 0, NULL, 0, NULL,
+ assert(crypto_pwhash_argon2i(guard_page, 0, (const char *) guard_page, 0, guard_page,
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
crypto_pwhash_ALG_ARGON2ID13) == -1);
diff -Nru libsodium-1.0.16/test/default/pwhash_scrypt.c libsodium-1.0.18/test/default/pwhash_scrypt.c
--- libsodium-1.0.16/test/default/pwhash_scrypt.c 2017-12-13 09:24:13.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.16/test/default/pwhash_scrypt.exp libsodium-1.0.18/test/default/pwhash_scrypt.exp
--- libsodium-1.0.16/test/default/pwhash_scrypt.exp 2017-12-13 09:24:13.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.16/test/default/randombytes.c libsodium-1.0.18/test/default/randombytes.c
--- libsodium-1.0.16/test/default/randombytes.c 2017-12-13 09:24:13.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;
@@ -161,7 +156,9 @@
#endif
printf("OK\n");
+#ifndef __EMSCRIPTEN__
randombytes_set_implementation(&randombytes_salsa20_implementation);
+#endif
return 0;
}
diff -Nru libsodium-1.0.16/test/default/scalarmult8.c libsodium-1.0.18/test/default/scalarmult8.c
--- libsodium-1.0.16/test/default/scalarmult8.c 1970-01-01 00:00:00.000000000 +0000
+++ libsodium-1.0.18/test/default/scalarmult8.c 2019-05-30 20:13:18.000000000 +0000
@@ -0,0 +1,580 @@
+
+#define TEST_NAME "scalarmult8"
+#include "cmptest.h"
+
+typedef struct TestData_ {
+ const char pk_hex[crypto_scalarmult_BYTES * 2 + 1];
+ const char sk_hex[crypto_scalarmult_SCALARBYTES * 2 + 1];
+ const char shared_hex[crypto_scalarmult_BYTES * 2 + 1];
+ const char *outcome;
+} TestData;
+
+static TestData test_data[] = {
+ {
+ "9c647d9ae589b9f58fdc3ca4947efbc915c4b2e08e744a0edf469dac59c8f85a",
+ "4852834d9d6b77dadeabaaf2e11dca66d19fe74993a7bec36c6e16a0983feaba",
+ "87b7f212b627f7a54ca5e0bcdaddd5389d9de6156cdbcf8ebe14ffbcfb436551",
+ "valid"
+ },
+ {
+ "9c647d9ae589b9f58fdc3ca4947efbc915c4b2e08e744a0edf469dac59c8f85a",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "4b82bd8650ea9b81a42181840926a4ffa16434d1bf298de1db87efb5b0a9e34e",
+ "valid"
+ },
+ {
+ "63aa40c6e38346c5caf23a6df0a5e6c80889a08647e551b3563449befcfc9733",
+ "588c061a50804ac488ad774ac716c3f5ba714b2712e048491379a500211998a8",
+ "b1a707519495ffffb298ff941716b06dfab87cf8d91123fe2be9a233dda22212",
+ "acceptable"
+ },
+ {
+ "0f83c36fded9d32fadf4efa3ae93a90bb5cfa66893bc412c43fa7287dbb99779",
+ "b05bfd32e55325d9fd648cb302848039000b390e44d521e58aab3b29a6960ba8",
+ "67dd4a6e165533534c0e3f172e4ab8576bca923a5f07b2c069b4c310ff2e935b",
+ "acceptable"
+ },
+ {
+ "0b8211a2b6049097f6871c6c052d3c5fc1ba17da9e32ae458403b05bb283092a",
+ "70e34bcbe1f47fbc0fddfd7c1e1aa53d57bfe0f66d243067b424bb6210bed19c",
+ "4a0638cfaa9ef1933b47f8939296a6b25be541ef7f70e844c0bcc00b134de64a",
+ "acceptable"
+ },
+ {
+ "343ac20a3b9c6a27b1008176509ad30735856ec1c8d8fcae13912d08d152f46c",
+ "68c1f3a653a4cdb1d37bba94738f8b957a57beb24d646e994dc29a276aad458d",
+ "399491fce8dfab73b4f9f611de8ea0b27b28f85994250b0f475d585d042ac207",
+ "acceptable"
+ },
+ {
+ "fa695fc7be8d1be5bf704898f388c452bafdd3b8eae805f8681a8d15c2d4e142",
+ "d877b26d06dff9d9f7fd4c5b3769f8cdd5b30516a5ab806be324ff3eb69ea0b2",
+ "2c4fe11d490a53861776b13b4354abd4cf5a97699db6e6c68c1626d07662f758",
+ "acceptable"
+ },
+ {
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "207494038f2bb811d47805bcdf04a2ac585ada7f2f23389bfd4658f9ddd4debc",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "0100000000000000000000000000000000000000000000000000000000000000",
+ "202e8972b61c7e61930eb9450b5070eae1c670475685541f0476217e4818cfab",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "0200000000000000000000000000000000000000000000000000000000000000",
+ "38dde9f3e7b799045f9ac3793d4a9277dadeadc41bec0290f81f744f73775f84",
+ "9a2cfe84ff9c4a9739625cae4a3b82a906877a441946f8d7b3d795fe8f5d1639",
+ "acceptable"
+ },
+ {
+ "0300000000000000000000000000000000000000000000000000000000000000",
+ "9857a914e3c29036fd9a442ba526b5cdcdf28216153e636c10677acab6bd6aa5",
+ "4da4e0aa072c232ee2f0fa4e519ae50b52c1edd08a534d4ef346c2e106d21d60",
+ "acceptable"
+ },
+ {
+ "ffffff030000f8ffff1f0000c0ffffff000000feffff070000f0ffff3f000000",
+ "48e2130d723305ed05e6e5894d398a5e33367a8c6aac8fcdf0a88e4b42820db7",
+ "9ed10c53747f647f82f45125d3de15a1e6b824496ab40410ffcc3cfe95760f3b",
+ "acceptable"
+ },
+ {
+ "000000fcffff070000e0ffff3f000000ffffff010000f8ffff0f0000c0ffff7f",
+ "28f41011691851b3a62b641553b30d0dfddcb8fffcf53700a7be2f6a872e9fb0",
+ "cf72b4aa6aa1c9f894f4165b86109aa468517648e1f0cc70e1ab08460176506b",
+ "acceptable"
+ },
+ {
+ "00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffff7f",
+ "18a93b6499b9f6b3225ca02fef410e0adec23532321d2d8ef1a6d602a8c65b83",
+ "5d50b62836bb69579410386cf7bb811c14bf85b1c7b17e5924c7ffea91ef9e12",
+ "acceptable"
+ },
+ {
+ "eaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "c01d1305a1338a1fcac2ba7e2e032b427e0b04903165aca957d8d0553d8717b0",
+ "19230eb148d5d67c3c22ab1daeff80a57eae4265ce2872657b2c8099fc698e50",
+ "acceptable"
+ },
+ {
+ "0400000000000000000000000000000000000000000000000000000000000000",
+ "386f7f16c50731d64f82e6a170b142a4e34f31fd7768fcb8902925e7d1e21abe",
+ "0fcab5d842a078d7a71fc59b57bfb4ca0be6873b49dcdb9f44e14ae8fbdfa542",
+ "valid"
+ },
+ {
+ "ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000",
+ "e023a289bd5e90fa2804ddc019a05ef3e79d434bb6ea2f522ecb643a75296e95",
+ "54ce8f2275c077e3b1306a3939c5e03eef6bbb88060544758d9fef59b0bc3e4f",
+ "valid"
+ },
+ {
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03",
+ "68f010d62ee8d926053a361c3a75c6ea4ebdc8606ab285003a6f8f4076b01e83",
+ "f136775c5beb0af8110af10b20372332043cab752419678775a223df57c9d30d",
+ "valid"
+ },
+ {
+ "fffffffbfffffbffffdfffffdffffffffefffffefffff7fffff7ffffbfffff3f",
+ "58ebcb35b0f8845caf1ec630f96576b62c4b7b6c36b29deb2cb0084651755c96",
+ "bf9affd06b844085586460962ef2146ff3d4533d9444aab006eb88cc3054407d",
+ "valid"
+ },
+ {
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f",
+ "188c4bc5b9c44b38bb658b9b2ae82d5b01015e093184b17cb7863503a783e1bb",
+ "d480de04f699cb3be0684a9cc2e31281ea0bc5a9dcc157d3d20158d46ca5246d",
+ "valid"
+ },
+ {
+ "fffffffffeffff7ffffffffffeffff7ffffffffffeffff7ffffffffffeffff7f",
+ "e06c11bb2e13ce3dc7673f67f5482242909423a9ae95ee986a988d98faee23a2",
+ "4c4401cce6b51e4cb18f2790246c9bf914db667750a1cb89069092af07292276",
+ "valid"
+ },
+ {
+ "ebffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "c0658c46dde18129293877535b1162b6f9f5414a23cf4d2cbc140a4d99da2b8f",
+ "578ba8cc2dbdc575afcf9df2b3ee6189f5337d6854c79b4ce165ea12293b3a0f",
+ "valid"
+ },
+ {
+ "e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b800",
+ "10255c9230a97a30a458ca284a629669293a31890cda9d147febc7d1e22d6bb1",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "5f9c95bca3508c24b1d0b1559c83ef5b04445cc4581c8e86d8224eddd09f1157",
+ "78f1e8edf14481b389448dac8f59c70b038e7cf92ef2c7eff57a72466e115296",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "a0a05a3e8f9f44204d5f8059a94ac7dfc39a49ac016dd743dbfa43c5d671fd88",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "d0dbb3ed1906663f15420af31f4eaf6509d9a9949723500605ad7c1c6e7450a9",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "c0b1d0eb22b244fe3291140072cdd9d989b5f0ecd96c100feb5bca241c1d9f8f",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "0000000000000000000000000000000000000000000000000000000000000080",
+ "480bf45f594942a8bc0f3353c6e8b8853d77f351f1c2ca6c2d1abf8a00b4229c",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "0100000000000000000000000000000000000000000000000000000000000080",
+ "30f993fcf8514fc89bd8db14cd43ba0d4b2530e73c4276a05e1b145d420cedb4",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b880",
+ "c04974b758380e2a5b5df6eb09bb2f6b3434f982722a8e676d3da251d1b3de83",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "5f9c95bca3508c24b1d0b1559c83ef5b04445cc4581c8e86d8224eddd09f11d7",
+ "502a31373db32446842fe5add3e024022ea54f274182afc3d9f1bb3d39534eb5",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "90fa6417b0e37030fd6e43eff2abaef14c6793117a039cf621318ba90f4e98be",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "78ad3f26027f1c9fdd975a1613b947779bad2cf2b741ade01840885a30bb979c",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "98e23de7b1e0926ed9c87e7b14baf55f497a1d7096f93977680e44dc1c7b7b8b",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "0100000000000000000000000000000000000000000000000000000000000000",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "5f9c95bca3508c24b1d0b1559c83ef5b04445cc4581c8e86d8224eddd09f1157",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b800",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "0000000000000000000000000000000000000000000000000000000000000080",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "0100000000000000000000000000000000000000000000000000000000000080",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "5f9c95bca3508c24b1d0b1559c83ef5b04445cc4581c8e86d8224eddd09f11d7",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b880",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
+ "0000000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "f01e48dafac9d7bcf589cbc382c878d18bda3550589ffb5d50b523bebe329dae",
+ "bd36a0790eb883098c988b21786773de0b3a4df162282cf110de18dd484ce74b",
+ "acceptable"
+ },
+ {
+ "f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "288796bc5aff4b81a37501757bc0753a3c21964790d38699308debc17a6eaf8d",
+ "b4e0dd76da7b071728b61f856771aa356e57eda78a5b1655cc3820fb5f854c5c",
+ "acceptable"
+ },
+ {
+ "f1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "98df845f6651bf1138221f119041f72b6dbc3c4ace7143d99fd55ad867480da8",
+ "6fdf6c37611dbd5304dc0f2eb7c9517eb3c50e12fd050ac6dec27071d4bfc034",
+ "acceptable"
+ },
+ {
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "f09498e46f02f878829e78b803d316a2ed695d0498a08abdf8276930e24edcb0",
+ "4c8fc4b1c6ab88fb21f18f6d4c810240d4e94651ba44f7a2c863cec7dc56602d",
+ "acceptable"
+ },
+ {
+ "0200000000000000000000000000000000000000000000000000000000000080",
+ "1813c10a5c7f21f96e17f288c0cc37607c04c5f5aea2db134f9e2ffc66bd9db8",
+ "1cd0b28267dc541c642d6d7dca44a8b38a63736eef5c4e6501ffbbb1780c033c",
+ "acceptable"
+ },
+ {
+ "0300000000000000000000000000000000000000000000000000000000000080",
+ "7857fb808653645a0beb138a64f5f4d733a45ea84c3cda11a9c06f7e7139149e",
+ "8755be01c60a7e825cff3e0e78cb3aa4333861516aa59b1c51a8b2a543dfa822",
+ "acceptable"
+ },
+ {
+ "0400000000000000000000000000000000000000000000000000000000000080",
+ "e03aa842e2abc56e81e87b8b9f417b2a1e5913c723eed28d752f8d47a59f498f",
+ "54c9a1ed95e546d27822a360931dda60a1df049da6f904253c0612bbdc087476",
+ "acceptable"
+ },
+ {
+ "daffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "f8f707b7999b18cb0d6b96124f2045972ca274bfc154ad0c87038c24c6d0d4b2",
+ "cc1f40d743cdc2230e1043daba8b75e810f1fbab7f255269bd9ebb29e6bf494f",
+ "acceptable"
+ },
+ {
+ "dbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "a034f684fa631e1a348118c1ce4c98231f2d9eec9ba5365b4a05d69a785b0796",
+ "54998ee43a5b007bf499f078e736524400a8b5c7e9b9b43771748c7cdf880412",
+ "acceptable"
+ },
+ {
+ "dcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "30b6c6a0f2ffa680768f992ba89e152d5bc9893d38c9119be4f767bfab6e0ca5",
+ "ead9b38efdd723637934e55ab717a7ae09eb86a21dc36a3feeb88b759e391e09",
+ "acceptable"
+ },
+ {
+ "eaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "901b9dcf881e01e027575035d40b43bdc1c5242e030847495b0c7286469b6591",
+ "602ff40789b54b41805915fe2a6221f07a50ffc2c3fc94cf61f13d7904e88e0e",
+ "acceptable"
+ },
+ {
+ "ebffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "8046677c28fd82c9a1bdb71a1a1a34faba1225e2507fe3f54d10bd5b0d865f8e",
+ "e00ae8b143471247ba24f12c885536c3cb981b58e1e56b2baf35c12ae1f79c26",
+ "acceptable"
+ },
+ {
+ "efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "602f7e2f68a846b82cc269b1d48e939886ae54fd636c1fe074d710127d472491",
+ "98cb9b50dd3fc2b0d4f2d2bf7c5cfdd10c8fcd31fc40af1ad44f47c131376362",
+ "acceptable"
+ },
+ {
+ "f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "60887b3dc72443026ebedbbbb70665f42b87add1440e7768fbd7e8e2ce5f639d",
+ "38d6304c4a7e6d9f7959334fb5245bd2c754525d4c91db950206926234c1f633",
+ "acceptable"
+ },
+ {
+ "f1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "78d31dfa854497d72d8def8a1b7fb006cec2d8c4924647c93814ae56faeda495",
+ "786cd54996f014a5a031ec14db812ed08355061fdb5de680a800ac521f318e23",
+ "acceptable"
+ },
+ {
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "c04c5baefa8302ddded6a4bb957761b4eb97aefa4fc3b8043085f96a5659b3a5",
+ "29ae8bc73e9b10a08b4f681c43c3e0ac1a171d31b38f1a48efba29ae639ea134",
+ "acceptable"
+ },
+ {
+ "e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c",
+ "a046e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449a44",
+ "c3da55379de9c6908e94ea4df28d084f32eccf03491c71f754b4075577a28552",
+ "valid"
+ },
+ {
+ "e5210f12786811d3f4b7959d0538ae2c31dbe7106fc03c3efc4cd549c715a413",
+ "4866e9d4d1b4673c5ad22691957d6af5c11b6421e0ea01d42ca4169e7918ba4d",
+ "95cbde9476e8907d7aade45cb4b873f88b595a68799fa152e6f8f7647aac7957",
+ "valid"
+ },
+ {
+ "0ab4e76380d84dde4f6833c58f2a9fb8f83bb0169b172be4b6e0592887741a36",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "0200000000000000000000000000000000000000000000000000000000000000",
+ "acceptable"
+ },
+ {
+ "89e10d5701b4337d2d032181538b1064bd4084401ceca1fd12663a1959388000",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "0900000000000000000000000000000000000000000000000000000000000000",
+ "valid"
+ },
+ {
+ "2b55d3aa4a8f80c8c0b2ae5f933e85af49beac36c2fa7394bab76c8933f8f81d",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "1000000000000000000000000000000000000000000000000000000000000000",
+ "valid"
+ },
+ {
+ "63e5b1fe9601fe84385d8866b0421262f78fbfa5aff9585e626679b18547d959",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "feffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f",
+ "acceptable"
+ },
+ {
+ "e428f3dac17809f827a522ce32355058d07369364aa78902ee10139b9f9dd653",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "fcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f",
+ "valid"
+ },
+ {
+ "b3b50e3ed3a407b95de942ef74575b5ab8a10c09ee103544d60bdfed8138ab2b",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f",
+ "acceptable"
+ },
+ {
+ "213fffe93d5ea8cd242e462844029922c43c77c9e3e42f562f485d24c501a20b",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "f3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f",
+ "valid"
+ },
+ {
+ "91b232a178b3cd530932441e6139418f72172292f1da4c1834fc5ebfefb51e3f",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03",
+ "valid"
+ },
+ {
+ "045c6e11c5d332556c7822fe94ebf89b56a3878dc27ca079103058849fabcb4f",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "e5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "acceptable"
+ },
+ {
+ "1ca2190b71163539063c35773bda0c9c928e9136f0620aeb093f099197b7f74e",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "e3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "acceptable"
+ },
+ {
+ "f76e9010ac33c5043b2d3b76a842171000c4916222e9e85897a0aec7f6350b3c",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "ddffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "valid"
+ },
+ {
+ "bb72688d8f8aa7a39cd6060cd5c8093cdec6fe341937c3886a99346cd07faa55",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "dbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+ "acceptable"
+ },
+ {
+ "88fddea193391c6a5933ef9b71901549447205aae9da928a6b91a352ba10f41f",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "0000000000000000000000000000000000000000000000000000000000000002",
+ "acceptable"
+ },
+ {
+ "303b392f153116cad9cc682a00ccc44c95ff0d3bbe568beb6c4e739bafdc2c68",
+ "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
+ "0000000000000000000000000000000000000000000000000000000000008000",
+ "acceptable"
+ },
+ {
+ "fd300aeb40e1fa582518412b49b208a7842b1e1f056a040178ea4141534f652d",
+ "c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2",
+ "b734105dc257585d73b566ccb76f062795ccbec89128e52b02f3e59639f13c46",
+ "valid"
+ },
+ {
+ "c8ef79b514d7682677bc7931e06ee5c27c9b392b4ae9484473f554e6678ecc2e",
+ "c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2",
+ "647a46b6fc3f40d62141ee3cee706b4d7a9271593a7b143e8e2e2279883e4550",
+ "valid"
+ },
+ {
+ "64aeac2504144861532b7bbcb6c87d67dd4c1f07ebc2e06effb95aecc6170b2c",
+ "c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2",
+ "4ff03d5fb43cd8657a3cf37c138cadcecce509e4eba089d0ef40b4e4fb946155",
+ "valid"
+ },
+ {
+ "bf68e35e9bdb7eee1b50570221860f5dcdad8acbab031b14974cc49013c49831",
+ "c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2",
+ "21cee52efdbc812e1d021a4af1e1d8bc4db3c400e4d2a2c56a3926db4d99c65b",
+ "valid"
+ },
+ {
+ "5347c491331a64b43ddc683034e677f53dc32b52a52a577c15a83bf298e99f19",
+ "c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2",
+ "18cb89e4e20c0c2bd324305245266c9327690bbe79acb88f5b8fb3f74eca3e52",
+ "valid"
+ },
+ {
+ "258e04523b8d253ee65719fc6906c657192d80717edc828fa0af21686e2faa75",
+ "a023cdd083ef5bb82f10d62e59e15a6800000000000000000000000000000050",
+ "258e04523b8d253ee65719fc6906c657192d80717edc828fa0af21686e2faa75",
+ "valid"
+ },
+ {
+ "2eae5ec3dd494e9f2d37d258f873a8e6e9d0dbd1e383ef64d98bb91b3e0be035",
+ "58083dd261ad91eff952322ec824c682ffffffffffffffffffffffffffffff5f",
+ "2eae5ec3dd494e9f2d37d258f873a8e6e9d0dbd1e383ef64d98bb91b3e0be035",
+ "acceptable"
+ }
+};
+
+int
+main(void)
+{
+ unsigned char sk[crypto_scalarmult_SCALARBYTES];
+ unsigned char pk[crypto_scalarmult_BYTES];
+ unsigned char shared[crypto_scalarmult_BYTES];
+ unsigned char shared2[crypto_scalarmult_BYTES];
+ unsigned int i;
+ int res;
+
+ for (i = 0U; i < (sizeof test_data) / (sizeof test_data[0]); i++) {
+ sodium_hex2bin(sk, crypto_scalarmult_SCALARBYTES, test_data[i].sk_hex,
+ crypto_scalarmult_SCALARBYTES * 2, NULL, NULL, NULL);
+ sodium_hex2bin(pk, crypto_scalarmult_BYTES, test_data[i].pk_hex,
+ crypto_scalarmult_BYTES * 2, NULL, NULL, NULL);
+ sodium_hex2bin(shared, crypto_scalarmult_BYTES, test_data[i].shared_hex,
+ crypto_scalarmult_BYTES * 2, NULL, NULL, NULL);
+ randombytes_buf(shared2, crypto_scalarmult_BYTES);
+ res = crypto_scalarmult(shared2, sk, pk);
+ if (res == 0) {
+ if (strcmp(test_data[i].outcome, "acceptable") == 0) {
+ printf("test case %u succeeded (%s)\n", i,
+ test_data[i].outcome);
+ } else if (strcmp(test_data[i].outcome, "valid") != 0) {
+ printf("*** test case %u succeeded, was supposed to be %s\n", i,
+ test_data[i].outcome);
+ }
+ if (memcmp(shared, shared2, crypto_scalarmult_BYTES) != 0) {
+ printf("*** test case %u succeeded, but shared key is not %s\n",
+ i, test_data[i].outcome);
+ }
+ } else {
+ if (strcmp(test_data[i].outcome, "acceptable") == 0) {
+ printf("test case %u failed (%s)\n", i, test_data[i].outcome);
+ } else if (strcmp(test_data[i].outcome, "valid") == 0) {
+ printf("*** test case %u failed, was supposed to be %s\n", i,
+ test_data[i].outcome);
+ }
+ }
+ }
+ printf("OK\n");
+
+ return 0;
+}
diff -Nru libsodium-1.0.16/test/default/scalarmult8.exp libsodium-1.0.18/test/default/scalarmult8.exp
--- libsodium-1.0.16/test/default/scalarmult8.exp 1970-01-01 00:00:00.000000000 +0000
+++ libsodium-1.0.18/test/default/scalarmult8.exp 2019-05-30 20:13:18.000000000 +0000
@@ -0,0 +1,65 @@
+test case 2 succeeded (acceptable)
+test case 3 succeeded (acceptable)
+test case 4 succeeded (acceptable)
+test case 5 succeeded (acceptable)
+test case 6 succeeded (acceptable)
+test case 7 failed (acceptable)
+test case 8 failed (acceptable)
+test case 9 succeeded (acceptable)
+test case 10 succeeded (acceptable)
+test case 11 succeeded (acceptable)
+test case 12 succeeded (acceptable)
+test case 13 succeeded (acceptable)
+test case 14 succeeded (acceptable)
+test case 22 failed (acceptable)
+test case 23 failed (acceptable)
+test case 24 failed (acceptable)
+test case 25 failed (acceptable)
+test case 26 failed (acceptable)
+test case 27 failed (acceptable)
+test case 28 failed (acceptable)
+test case 29 failed (acceptable)
+test case 30 failed (acceptable)
+test case 31 failed (acceptable)
+test case 32 failed (acceptable)
+test case 33 failed (acceptable)
+test case 34 failed (acceptable)
+test case 35 failed (acceptable)
+test case 36 failed (acceptable)
+test case 37 failed (acceptable)
+test case 38 failed (acceptable)
+test case 39 failed (acceptable)
+test case 40 failed (acceptable)
+test case 41 failed (acceptable)
+test case 42 failed (acceptable)
+test case 43 failed (acceptable)
+test case 44 failed (acceptable)
+test case 45 failed (acceptable)
+test case 46 failed (acceptable)
+test case 47 failed (acceptable)
+test case 48 succeeded (acceptable)
+test case 49 succeeded (acceptable)
+test case 50 succeeded (acceptable)
+test case 51 succeeded (acceptable)
+test case 52 succeeded (acceptable)
+test case 53 succeeded (acceptable)
+test case 54 succeeded (acceptable)
+test case 55 succeeded (acceptable)
+test case 56 succeeded (acceptable)
+test case 57 succeeded (acceptable)
+test case 58 succeeded (acceptable)
+test case 59 succeeded (acceptable)
+test case 60 succeeded (acceptable)
+test case 61 succeeded (acceptable)
+test case 62 succeeded (acceptable)
+test case 63 succeeded (acceptable)
+test case 66 succeeded (acceptable)
+test case 69 succeeded (acceptable)
+test case 71 succeeded (acceptable)
+test case 74 succeeded (acceptable)
+test case 75 succeeded (acceptable)
+test case 77 succeeded (acceptable)
+test case 78 succeeded (acceptable)
+test case 79 succeeded (acceptable)
+test case 86 succeeded (acceptable)
+OK
diff -Nru libsodium-1.0.16/test/default/scalarmult_ed25519.c libsodium-1.0.18/test/default/scalarmult_ed25519.c
--- libsodium-1.0.16/test/default/scalarmult_ed25519.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/scalarmult_ed25519.c 2019-05-30 20:13:18.000000000 +0000
@@ -43,18 +43,24 @@
memset(n, 0, crypto_scalarmult_ed25519_SCALARBYTES);
if (crypto_scalarmult_ed25519_base(q, n) != -1) {
- printf("crypto_scalarmult_ed25519_base(0) failed\n");
+ printf("crypto_scalarmult_ed25519_base(0) passed\n");
}
if (crypto_scalarmult_ed25519(q2, n, p) != -1) {
printf("crypto_scalarmult_ed25519(0) passed\n");
}
+ if (crypto_scalarmult_ed25519_noclamp(q2, n, p) != -1) {
+ printf("crypto_scalarmult_ed25519_noclamp(0) passed\n");
+ }
n[0] = 1;
if (crypto_scalarmult_ed25519_base(q, n) != 0) {
printf("crypto_scalarmult_ed25519_base() failed\n");
}
if (crypto_scalarmult_ed25519(q2, n, p) != 0) {
- printf("crypto_scalarmult_ed25519() passed\n");
+ printf("crypto_scalarmult_ed25519() failed\n");
+ }
+ if (crypto_scalarmult_ed25519_noclamp(q2, n, p) != 0) {
+ printf("crypto_scalarmult_ed25519_noclamp() failed\n");
}
if (crypto_scalarmult_ed25519(q, n, non_canonical_p) != -1) {
@@ -67,14 +73,52 @@
printf("crypto_scalarmult_ed25519() failed\n");
}
+ n[0] = 9;
+ if (crypto_scalarmult_ed25519(q, n, p) != 0) {
+ printf("crypto_scalarmult_ed25519() failed\n");
+ }
+ if (crypto_scalarmult_ed25519_noclamp(q2, n, p) != 0) {
+ printf("crypto_scalarmult_ed25519_noclamp() failed\n");
+ }
+ 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) {
+ printf("crypto_scalarmult_ed25519_noclamp() failed\n");
+ }
+ if (memcmp(q, q2, crypto_scalarmult_ed25519_BYTES) != 0) {
+ printf("inconsistent clamping\n");
+ }
+
memset(p, 0, crypto_scalarmult_ed25519_BYTES);
if (crypto_scalarmult_ed25519(q, n, p) != -1) {
printf("crypto_scalarmult_ed25519() didn't fail\n");
}
+ if (crypto_scalarmult_ed25519_noclamp(q, n, p) != -1) {
+ printf("crypto_scalarmult_ed25519_noclamp() didn't fail\n");
+ }
+
n[0] = 8;
if (crypto_scalarmult_ed25519(q, n, p) != -1) {
printf("crypto_scalarmult_ed25519() didn't fail\n");
}
+ if (crypto_scalarmult_ed25519_noclamp(q, n, p) != -1) {
+ printf("crypto_scalarmult_ed25519_noclamp() didn't fail\n");
+ }
sodium_free(q2);
sodium_free(q);
diff -Nru libsodium-1.0.16/test/default/scalarmult_ristretto255.c libsodium-1.0.18/test/default/scalarmult_ristretto255.c
--- libsodium-1.0.16/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.16/test/default/scalarmult_ristretto255.exp libsodium-1.0.18/test/default/scalarmult_ristretto255.exp
--- libsodium-1.0.16/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.16/test/default/sign.c libsodium-1.0.18/test/default/sign.c
--- libsodium-1.0.16/test/default/sign.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/sign.c 2019-05-30 20:13:18.000000000 +0000
@@ -1053,15 +1053,8 @@
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 c = 0U;
- unsigned int i;
- unsigned int s;
-
- for (i = 0U; i < 32U; i++) {
- s = S[i] + l[i] + c;
- S[i] = (unsigned char) s;
- c = (s >> 8) & 1;
- }
+
+ sodium_add(S, l, sizeof l);
}
int main(void)
@@ -1266,7 +1259,7 @@
}
sodium_hex2bin(sk, crypto_sign_SECRETKEYBYTES,
"833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42",
- 2 * crypto_sign_SECRETKEYBYTES , NULL, NULL, NULL);
+ 2 * crypto_sign_SECRETKEYBYTES / 2, NULL, NULL, NULL);
sodium_hex2bin(pk, crypto_sign_PUBLICKEYBYTES,
"ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf",
2 * crypto_sign_PUBLICKEYBYTES, NULL, NULL, NULL);
diff -Nru libsodium-1.0.16/test/default/sodium_utils2.c libsodium-1.0.18/test/default/sodium_utils2.c
--- libsodium-1.0.16/test/default/sodium_utils2.c 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/test/default/sodium_utils2.c 2019-05-30 20:13:18.000000000 +0000
@@ -12,6 +12,10 @@
# warning The sodium_utils2 test is expected to fail with address sanitizer
#endif
+#undef sodium_malloc
+#undef sodium_free
+#undef sodium_allocarray
+
__attribute__((noreturn)) static void
segv_handler(int sig)
{
@@ -19,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);
}
@@ -66,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.16/test/default/sodium_utils3.c libsodium-1.0.18/test/default/sodium_utils3.c
--- libsodium-1.0.16/test/default/sodium_utils3.c 2017-12-13 09:24:13.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.16/test/default/sodium_utils.c libsodium-1.0.18/test/default/sodium_utils.c
--- libsodium-1.0.16/test/default/sodium_utils.c 2017-12-13 09:24:13.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);
@@ -60,8 +64,7 @@
buf2_rev[bin_len - 1 - j] = buf2[j];
}
if (memcmp(buf1_rev, buf2_rev, bin_len) *
- sodium_compare(buf1, buf2, bin_len) <
- 0) {
+ sodium_compare(buf1, buf2, bin_len) < 0) {
printf("sodium_compare() failure with length=%u\n",
(unsigned int) bin_len);
}
@@ -71,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");
@@ -106,7 +111,21 @@
if (sodium_compare(buf1, buf2, bin_len) != 0) {
printf("sodium_add() failed\n");
}
-
+ for (i = 0U; i < 1000U; i++) {
+ randombytes_buf(buf1, bin_len);
+ randombytes_buf(buf2, bin_len);
+ sodium_add(buf1, buf2, bin_len);
+ sodium_sub(buf1, buf2, bin_len);
+ sodium_sub(buf1, buf2, 0U);
+ if (sodium_is_zero(buf1, bin_len) &&
+ !sodium_is_zero(buf1, bin_len)) {
+ printf("sodium_sub() failed\n");
+ }
+ sodium_sub(buf1, buf1, bin_len);
+ if (!sodium_is_zero(buf1, bin_len)) {
+ printf("sodium_sub() failed\n");
+ }
+ }
assert(sizeof nonce >= 24U);
memset(nonce, 0xfe, 24U);
memset(nonce, 0xff, 6U);
@@ -141,10 +160,37 @@
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);
+ memset(buf_add, 0, 64U);
+ sodium_add(buf_add, buf1, 64U);
+ assert(!sodium_is_zero(buf_add, 64U));
+ sodium_add(buf_add, buf2, 64U);
+ assert(!sodium_is_zero(buf_add, 64U));
+ sodium_sub(buf_add, buf1, 64U);
+ assert(!sodium_is_zero(buf_add, 64U));
+ sodium_sub(buf_add, buf2, 64U);
+ assert(sodium_is_zero(buf_add, 64U));
for (i = 0; i < 2000U; i++) {
bin_len = randombytes_uniform(200U);
- blocksize = 1U + randombytes_uniform(100U);
+ blocksize = 1U + randombytes_uniform(500U);
bin_padded_maxlen = bin_len + (blocksize - bin_len % blocksize);
bin_padded = (unsigned char *) sodium_malloc(bin_padded_maxlen);
randombytes_buf(bin_padded, bin_padded_maxlen);
diff -Nru libsodium-1.0.16/test/default/sodium_utils.exp libsodium-1.0.18/test/default/sodium_utils.exp
--- libsodium-1.0.16/test/default/sodium_utils.exp 2017-12-13 09:24:13.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.16/test/default/stream2.c libsodium-1.0.18/test/default/stream2.c
--- libsodium-1.0.16/test/default/stream2.c 2017-12-13 09:24:13.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.16/test/default/stream.c libsodium-1.0.18/test/default/stream.c
--- libsodium-1.0.16/test/default/stream.c 2017-12-13 09:24:13.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.16/test/default/stream.exp libsodium-1.0.18/test/default/stream.exp
--- libsodium-1.0.16/test/default/stream.exp 2017-12-13 09:24:13.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.16/test/default/wasi-test-wrapper.sh libsodium-1.0.18/test/default/wasi-test-wrapper.sh
--- libsodium-1.0.16/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.16/test/quirks/quirks.h libsodium-1.0.18/test/quirks/quirks.h
--- libsodium-1.0.16/test/quirks/quirks.h 2017-12-13 09:24:13.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.16/THANKS libsodium-1.0.18/THANKS
--- libsodium-1.0.16/THANKS 2017-12-13 09:24:13.000000000 +0000
+++ libsodium-1.0.18/THANKS 2019-05-30 20:13:18.000000000 +0000
@@ -15,6 +15,7 @@
@neheb
Adam Caudill (@adamcaudill)
+Alexander Ilin (@AlexIljin)
Alexander Morris (@alexpmorris)
Amit Murthy (@amitmurthy)
Andrew Bennett (@potatosalad)
diff -Nru libsodium-1.0.16/.travis.yml libsodium-1.0.18/.travis.yml
--- libsodium-1.0.16/.travis.yml 2017-12-13 09:24:13.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