mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-11-22 00:09:23 -05:00
Merge remote-tracking branch 'upstream/master'
Merge upstream.
This commit is contained in:
commit
ab352e4a56
20
.travis-banned-functions-check.sh
Executable file
20
.travis-banned-functions-check.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
retvalue=0
|
||||||
|
|
||||||
|
if [[ $(find -E . -name '*.[ch]' -exec grep -H bzero {} \;) ]];
|
||||||
|
then
|
||||||
|
tput setaf 1;
|
||||||
|
echo "Code uses banned functions (bzero).";
|
||||||
|
retvalue=1;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# can add more checks here by copying the above code block
|
||||||
|
|
||||||
|
if [[ $retvalue == 0 ]];
|
||||||
|
then
|
||||||
|
tput setaf 2;
|
||||||
|
echo "Code does not use banned functions.";
|
||||||
|
fi;
|
||||||
|
|
||||||
|
exit $retvalue;
|
||||||
21
.travis.yml
21
.travis.yml
@ -12,10 +12,7 @@ matrix:
|
|||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- gcc-4.8
|
- gcc-4.8
|
||||||
before_install:
|
- astyle
|
||||||
- wget http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz
|
|
||||||
- tar xzf astyle_2.05.1_linux.tar.gz
|
|
||||||
- cd astyle/build/gcc && make && export PATH=$(pwd)/bin:$PATH && cd ../../../
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
env: CC_OQS=gcc-4.9
|
env: CC_OQS=gcc-4.9
|
||||||
@ -25,10 +22,7 @@ matrix:
|
|||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- gcc-4.9
|
- gcc-4.9
|
||||||
before_install:
|
- astyle
|
||||||
- wget http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz
|
|
||||||
- tar xzf astyle_2.05.1_linux.tar.gz
|
|
||||||
- cd astyle/build/gcc && make && export PATH=$(pwd)/bin:$PATH && cd ../../../
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
env: CC_OQS=gcc-5
|
env: CC_OQS=gcc-5
|
||||||
@ -38,10 +32,7 @@ matrix:
|
|||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- gcc-5
|
- gcc-5
|
||||||
before_install:
|
- astyle
|
||||||
- wget http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz
|
|
||||||
- tar xzf astyle_2.05.1_linux.tar.gz
|
|
||||||
- cd astyle/build/gcc && make && export PATH=$(pwd)/bin:$PATH && cd ../../../
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
env: CC_OQS=gcc-6 USE_OPENSSL=1
|
env: CC_OQS=gcc-6 USE_OPENSSL=1
|
||||||
@ -51,11 +42,8 @@ matrix:
|
|||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- gcc-6
|
- gcc-6
|
||||||
|
- astyle
|
||||||
- libssl-dev
|
- libssl-dev
|
||||||
before_install:
|
|
||||||
- wget http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz
|
|
||||||
- tar xzf astyle_2.05.1_linux.tar.gz
|
|
||||||
- cd astyle/build/gcc && make && export PATH=$(pwd)/bin:$PATH && cd ../../../
|
|
||||||
- os: osx
|
- os: osx
|
||||||
compiler: clang
|
compiler: clang
|
||||||
env: CC_OQS=clang AES_NI=0 USE_OPENSSL=1
|
env: CC_OQS=clang AES_NI=0 USE_OPENSSL=1
|
||||||
@ -67,3 +55,4 @@ script:
|
|||||||
- make check
|
- make check
|
||||||
- bash .travis-style-check.sh
|
- bash .travis-style-check.sh
|
||||||
- bash .travis-global-namespace-check.sh
|
- bash .travis-global-namespace-check.sh
|
||||||
|
- bash .travis-banned-functions-check.sh
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
<ClInclude Include="..\..\src\kex_rlwe_newhope\kex_rlwe_newhope.h" />
|
<ClInclude Include="..\..\src\kex_rlwe_newhope\kex_rlwe_newhope.h" />
|
||||||
<ClInclude Include="..\..\src\kex_rlwe_newhope\params.h" />
|
<ClInclude Include="..\..\src\kex_rlwe_newhope\params.h" />
|
||||||
<ClInclude Include="..\..\src\rand\rand.h" />
|
<ClInclude Include="..\..\src\rand\rand.h" />
|
||||||
|
<ClInclude Include="..\..\src\rand_urandom_aesctr\rand_urandom_aesctr.h" />
|
||||||
<ClInclude Include="..\..\src\rand_urandom_chacha20\rand_urandom_chacha20.h" />
|
<ClInclude Include="..\..\src\rand_urandom_chacha20\rand_urandom_chacha20.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -47,6 +48,7 @@
|
|||||||
<ClCompile Include="..\..\src\kex_rlwe_newhope\kex_rlwe_newhope.c" />
|
<ClCompile Include="..\..\src\kex_rlwe_newhope\kex_rlwe_newhope.c" />
|
||||||
<ClCompile Include="..\..\src\kex_rlwe_newhope\newhope.c" />
|
<ClCompile Include="..\..\src\kex_rlwe_newhope\newhope.c" />
|
||||||
<ClCompile Include="..\..\src\rand\rand.c" />
|
<ClCompile Include="..\..\src\rand\rand.c" />
|
||||||
|
<ClCompile Include="..\..\src\rand_urandom_aesctr\rand_urandom_aesctr.c" />
|
||||||
<ClCompile Include="..\..\src\rand_urandom_chacha20\rand_urandom_chacha20.c" />
|
<ClCompile Include="..\..\src\rand_urandom_chacha20\rand_urandom_chacha20.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
@ -127,6 +129,7 @@
|
|||||||
del /Q "$(SolutionDir)include\oqs\*.*"
|
del /Q "$(SolutionDir)include\oqs\*.*"
|
||||||
copy "$(SolutionDir)..\src\rand\rand.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\rand\rand.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\rand_urandom_chacha20\rand_urandom_chacha20.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\rand_urandom_chacha20\rand_urandom_chacha20.h" "$(SolutionDir)include\oqs\"
|
||||||
|
copy "$(SolutionDir)..\src\rand_urandom_aesctr\rand_urandom_aesctr.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\kex\kex.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\kex\kex.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\aes\aes.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\aes\aes.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)include\oqs\"
|
||||||
@ -153,6 +156,7 @@ copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include
|
|||||||
del /Q "$(SolutionDir)include\oqs\*.*"
|
del /Q "$(SolutionDir)include\oqs\*.*"
|
||||||
copy "$(SolutionDir)..\src\rand\rand.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\rand\rand.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\rand_urandom_chacha20\rand_urandom_chacha20.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\rand_urandom_chacha20\rand_urandom_chacha20.h" "$(SolutionDir)include\oqs\"
|
||||||
|
copy "$(SolutionDir)..\src\rand_urandom_aesctr\rand_urandom_aesctr.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\kex\kex.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\kex\kex.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\aes\aes.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\aes\aes.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)include\oqs\"
|
||||||
@ -183,6 +187,7 @@ copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include
|
|||||||
del /Q "$(SolutionDir)include\oqs\*.*"
|
del /Q "$(SolutionDir)include\oqs\*.*"
|
||||||
copy "$(SolutionDir)..\src\rand\rand.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\rand\rand.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\rand_urandom_chacha20\rand_urandom_chacha20.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\rand_urandom_chacha20\rand_urandom_chacha20.h" "$(SolutionDir)include\oqs\"
|
||||||
|
copy "$(SolutionDir)..\src\rand_urandom_aesctr\rand_urandom_aesctr.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\kex\kex.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\kex\kex.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\aes\aes.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\aes\aes.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)include\oqs\"
|
||||||
@ -213,6 +218,7 @@ copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include
|
|||||||
del /Q "$(SolutionDir)include\oqs\*.*"
|
del /Q "$(SolutionDir)include\oqs\*.*"
|
||||||
copy "$(SolutionDir)..\src\rand\rand.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\rand\rand.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\rand_urandom_chacha20\rand_urandom_chacha20.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\rand_urandom_chacha20\rand_urandom_chacha20.h" "$(SolutionDir)include\oqs\"
|
||||||
|
copy "$(SolutionDir)..\src\rand_urandom_aesctr\rand_urandom_aesctr.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\kex\kex.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\kex\kex.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\aes\aes.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\aes\aes.h" "$(SolutionDir)include\oqs\"
|
||||||
copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)include\oqs\"
|
copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)include\oqs\"
|
||||||
|
|||||||
@ -81,6 +81,9 @@
|
|||||||
<ClInclude Include="..\..\src\aes\aes.h">
|
<ClInclude Include="..\..\src\aes\aes.h">
|
||||||
<Filter>Header Files\AES</Filter>
|
<Filter>Header Files\AES</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\rand_urandom_aesctr\rand_urandom_aesctr.h">
|
||||||
|
<Filter>Header Files\rand</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\kex\kex.c">
|
<ClCompile Include="..\..\src\kex\kex.c">
|
||||||
@ -128,5 +131,8 @@
|
|||||||
<ClCompile Include="..\..\src\aes\aes_ni.c">
|
<ClCompile Include="..\..\src\aes\aes_ni.c">
|
||||||
<Filter>Source Files\AES</Filter>
|
<Filter>Source Files\AES</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\rand_urandom_aesctr\rand_urandom_aesctr.c">
|
||||||
|
<Filter>Source Files\rand</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -25,7 +25,11 @@ typedef struct oqs_rand_urandom_aesctr_ctx {
|
|||||||
} oqs_rand_urandom_aesctr_ctx;
|
} oqs_rand_urandom_aesctr_ctx;
|
||||||
|
|
||||||
static oqs_rand_urandom_aesctr_ctx *oqs_rand_urandom_aesctr_ctx_new() {
|
static oqs_rand_urandom_aesctr_ctx *oqs_rand_urandom_aesctr_ctx_new() {
|
||||||
|
#if defined(WINDOWS)
|
||||||
|
HCRYPTPROV hCryptProv;
|
||||||
|
#else
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
|
#endif
|
||||||
oqs_rand_urandom_aesctr_ctx *rand_ctx = NULL;
|
oqs_rand_urandom_aesctr_ctx *rand_ctx = NULL;
|
||||||
rand_ctx = (oqs_rand_urandom_aesctr_ctx *) malloc(sizeof(oqs_rand_urandom_aesctr_ctx));
|
rand_ctx = (oqs_rand_urandom_aesctr_ctx *) malloc(sizeof(oqs_rand_urandom_aesctr_ctx));
|
||||||
if (rand_ctx == NULL) {
|
if (rand_ctx == NULL) {
|
||||||
@ -33,10 +37,8 @@ static oqs_rand_urandom_aesctr_ctx *oqs_rand_urandom_aesctr_ctx_new() {
|
|||||||
}
|
}
|
||||||
uint8_t key[16];
|
uint8_t key[16];
|
||||||
#if defined(WINDOWS)
|
#if defined(WINDOWS)
|
||||||
HCRYPTPROV hCryptProv;
|
|
||||||
if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT) ||
|
if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT) ||
|
||||||
!cryptgenrandom(hcryptprov, 16, key) ||
|
!CryptGenRandom(hCryptProv, 16, key)) {
|
||||||
!cryptgenrandom(hcryptprov, 8, &rand_ctx->ctr[8]) ) {
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user