mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-12-07 00:02:12 -05:00
Merge branch 'master' of https://github.com/open-quantum-safe/liboqs
Merged upstream oqs changes (fix windows build)
This commit is contained in:
commit
9c00eedd27
49
.travis.yml
Normal file
49
.travis.yml
Normal file
@ -0,0 +1,49 @@
|
||||
language: c
|
||||
sudo: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: CC_OQS=gcc-4.8
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-4.8
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: CC_OQS=gcc-4.9
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-4.9
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: CC_OQS=gcc-5
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-5
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: CC_OQS=gcc-6
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-6
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CC_OQS=clang
|
||||
|
||||
|
||||
script:
|
||||
- make
|
||||
- make check
|
||||
13
Makefile
13
Makefile
@ -1,4 +1,9 @@
|
||||
CC=cc
|
||||
ifdef CC_OQS
|
||||
CC=$(CC_OQS)
|
||||
else
|
||||
CC=cc
|
||||
endif
|
||||
|
||||
AR=ar rcs
|
||||
CURL=curl
|
||||
RANLIB=ranlib
|
||||
@ -9,6 +14,8 @@ CFLAGS=$(DEFAULTS) -DCONSTANT_TIME
|
||||
LDFLAGS=-lm
|
||||
INCLUDES=-Iinclude
|
||||
|
||||
.PHONY: all check clean prettyprint
|
||||
|
||||
all: links lib tests
|
||||
|
||||
objs/%.o: src/%.c
|
||||
@ -59,6 +66,10 @@ tests: lib src/rand/test_rand.c src/kex/test_kex.c
|
||||
docs: links
|
||||
doxygen
|
||||
|
||||
check: links tests
|
||||
./test_kex
|
||||
./test_rand
|
||||
|
||||
clean:
|
||||
rm -rf docs objs include
|
||||
rm -f test_rand test_kex liboqs.a
|
||||
|
||||
10
README.md
10
README.md
@ -1,3 +1,5 @@
|
||||
[](https://travis-ci.org/open-quantum-safe/liboqs)
|
||||
|
||||
# liboqs
|
||||
|
||||
liboqs is a C library for quantum-safe cryptographic algorithms.
|
||||
@ -10,7 +12,7 @@ The **Open Quantum Safe (OQS) project** has the goal of developing and prototypi
|
||||
|
||||
OQS will also include integrations into application-level protocols to provide easy prototyping of quantum-resistant cryptography. Our first integration is in OpenSSL:
|
||||
|
||||
- **open-quantum-safe/openssl** is an integration of liboqs into OpenSSL 1.0.2. The goal of this integration is to provide easy prototyping of quantum-resistant cryptography. The integration should not be considered "production quality". See more about this integration in its Github repository [open-quantum-safe/openssl/](https://github.com/open-quantum-safe/openssl/).
|
||||
- **open-quantum-safe/openssl** is an integration of liboqs into OpenSSL 1.0.2. The goal of this integration is to provide easy prototyping of quantum-resistant cryptography. The integration should not be considered "production quality". See more about this integration in its GitHub repository [open-quantum-safe/openssl/](https://github.com/open-quantum-safe/openssl/).
|
||||
|
||||
More information on OQS can be found in slides 64–67 of [this presentation](https://www.douglas.stebila.ca/files/research/presentations/20160812-SAC.pdf) by Douglas Stebila.
|
||||
|
||||
@ -25,7 +27,7 @@ liboqs currently contains:
|
||||
|
||||
Builds have been tested on Mac OS X 10.11.6, Ubuntu 16.04.1, and Windows 10.
|
||||
|
||||
To build, clone or download the source from Github, then simply type:
|
||||
To build, clone or download the source from GitHub, then simply type:
|
||||
|
||||
make
|
||||
|
||||
@ -35,6 +37,10 @@ This will generate:
|
||||
- `test_rand`: A simple test harness for the random number generator. This will test the distance of PRNG output from uniform using statistical distance.
|
||||
- `test_kex`: A simple test harness for the default key exchange algorithm. This will output key exchange messages; indicate whether the parties agree on the session key or not over a large number of trials; and measure the distance of the sessions keys from uniform using statistical distance.
|
||||
|
||||
To run the tests, simply type:
|
||||
|
||||
make check
|
||||
|
||||
Windows binaries can be generated using the Visual Studio solution in the VisualStudio folder.
|
||||
|
||||
## Documentation
|
||||
|
||||
@ -102,8 +102,9 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>OQS_RAND_DEFAULT_URANDOM_CHACHA20;OQS_KEX_DEFAULT_BCNS15;CONSTANT_TIME;WINDOWS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include;</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -124,8 +125,9 @@ copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)inc
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>OQS_RAND_DEFAULT_URANDOM_CHACHA20;OQS_KEX_DEFAULT_BCNS15;CONSTANT_TIME;WINDOWS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include;</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -148,8 +150,9 @@ copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)inc
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>OQS_RAND_DEFAULT_URANDOM_CHACHA20;OQS_KEX_DEFAULT_BCNS15;CONSTANT_TIME;WINDOWS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include;</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -174,8 +177,9 @@ copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)inc
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>OQS_RAND_DEFAULT_URANDOM_CHACHA20;OQS_KEX_DEFAULT_BCNS15;CONSTANT_TIME;WINDOWS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include;</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
||||
@ -94,6 +94,7 @@
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -111,6 +112,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -130,6 +132,7 @@
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -151,6 +154,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
||||
@ -94,6 +94,7 @@
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -111,6 +112,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -130,6 +132,7 @@
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -151,6 +154,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
||||
@ -158,7 +158,7 @@ cleanup:
|
||||
|
||||
int main() {
|
||||
|
||||
int ret;
|
||||
int success;
|
||||
|
||||
/* setup RAND */
|
||||
OQS_RAND *rand = NULL;
|
||||
@ -167,21 +167,21 @@ int main() {
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = kex_test_correctness_wrapper(rand, &OQS_KEX_new, NULL, 0, NULL, KEX_TEST_ITERATIONS);
|
||||
if (ret != 1) {
|
||||
success = kex_test_correctness_wrapper(rand, &OQS_KEX_new, NULL, 0, NULL, KEX_TEST_ITERATIONS);
|
||||
if (success != 1) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
success = 1;
|
||||
goto cleanup;
|
||||
|
||||
err:
|
||||
ret = 0;
|
||||
success = 0;
|
||||
fprintf(stderr, "ERROR!\n");
|
||||
|
||||
cleanup:
|
||||
OQS_RAND_free(rand);
|
||||
|
||||
return ret;
|
||||
return (success == 1) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
|
||||
}
|
||||
|
||||
@ -20,10 +20,6 @@
|
||||
|
||||
#include "rlwe_a.h"
|
||||
|
||||
#if defined(WINDOWS)
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
|
||||
OQS_KEX *OQS_KEX_rlwe_bcns15_new(OQS_RAND *rand, UNUSED const uint8_t *seed, UNUSED const size_t seed_len, UNUSED const char *named_parameters) {
|
||||
|
||||
OQS_KEX *k = malloc(sizeof(OQS_KEX));
|
||||
|
||||
@ -137,20 +137,20 @@ static int rand_test_distribution_wrapper(OQS_RAND * (*new_method)(), int iterat
|
||||
|
||||
int main() {
|
||||
|
||||
int ret;
|
||||
int success;
|
||||
|
||||
ret = rand_test_distribution_wrapper(&OQS_RAND_new, RAND_TEST_ITERATIONS);
|
||||
if (ret != 1) goto err;
|
||||
success = rand_test_distribution_wrapper(&OQS_RAND_new, RAND_TEST_ITERATIONS);
|
||||
if (success != 1) goto err;
|
||||
|
||||
ret = 1;
|
||||
success = 1;
|
||||
goto cleanup;
|
||||
|
||||
err:
|
||||
ret = 0;
|
||||
success = 0;
|
||||
fprintf(stderr, "ERROR!\n");
|
||||
|
||||
cleanup:
|
||||
|
||||
return ret;
|
||||
return (success == 1) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
|
||||
}
|
||||
|
||||
@ -16,10 +16,6 @@
|
||||
|
||||
#include "external/chacha20.c"
|
||||
|
||||
#if defined(WINDOWS)
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
|
||||
typedef struct OQS_RAND_urandom_chacha20_ctx {
|
||||
uint8_t key[32];
|
||||
uint32_t nonce[2];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user