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
|
||||
packages:
|
||||
- gcc-4.8
|
||||
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 ../../../
|
||||
- astyle
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: CC_OQS=gcc-4.9
|
||||
@ -25,10 +22,7 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-4.9
|
||||
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 ../../../
|
||||
- astyle
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: CC_OQS=gcc-5
|
||||
@ -38,10 +32,7 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-5
|
||||
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 ../../../
|
||||
- astyle
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: CC_OQS=gcc-6 USE_OPENSSL=1
|
||||
@ -51,11 +42,8 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-6
|
||||
- astyle
|
||||
- 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
|
||||
compiler: clang
|
||||
env: CC_OQS=clang AES_NI=0 USE_OPENSSL=1
|
||||
@ -67,3 +55,4 @@ script:
|
||||
- make check
|
||||
- bash .travis-style-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\params.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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -47,6 +48,7 @@
|
||||
<ClCompile Include="..\..\src\kex_rlwe_newhope\kex_rlwe_newhope.c" />
|
||||
<ClCompile Include="..\..\src\kex_rlwe_newhope\newhope.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" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
@ -127,6 +129,7 @@
|
||||
del /Q "$(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_aesctr\rand_urandom_aesctr.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\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\*.*"
|
||||
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_aesctr\rand_urandom_aesctr.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\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\*.*"
|
||||
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_aesctr\rand_urandom_aesctr.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\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\*.*"
|
||||
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_aesctr\rand_urandom_aesctr.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\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)include\oqs\"
|
||||
|
||||
@ -81,6 +81,9 @@
|
||||
<ClInclude Include="..\..\src\aes\aes.h">
|
||||
<Filter>Header Files\AES</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\rand_urandom_aesctr\rand_urandom_aesctr.h">
|
||||
<Filter>Header Files\rand</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\kex\kex.c">
|
||||
@ -128,5 +131,8 @@
|
||||
<ClCompile Include="..\..\src\aes\aes_ni.c">
|
||||
<Filter>Source Files\AES</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\rand_urandom_aesctr\rand_urandom_aesctr.c">
|
||||
<Filter>Source Files\rand</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -25,7 +25,11 @@ typedef struct oqs_rand_urandom_aesctr_ctx {
|
||||
} oqs_rand_urandom_aesctr_ctx;
|
||||
|
||||
static oqs_rand_urandom_aesctr_ctx *oqs_rand_urandom_aesctr_ctx_new() {
|
||||
#if defined(WINDOWS)
|
||||
HCRYPTPROV hCryptProv;
|
||||
#else
|
||||
int fd = 0;
|
||||
#endif
|
||||
oqs_rand_urandom_aesctr_ctx *rand_ctx = NULL;
|
||||
rand_ctx = (oqs_rand_urandom_aesctr_ctx *) malloc(sizeof(oqs_rand_urandom_aesctr_ctx));
|
||||
if (rand_ctx == NULL) {
|
||||
@ -33,10 +37,8 @@ static oqs_rand_urandom_aesctr_ctx *oqs_rand_urandom_aesctr_ctx_new() {
|
||||
}
|
||||
uint8_t key[16];
|
||||
#if defined(WINDOWS)
|
||||
HCRYPTPROV hCryptProv;
|
||||
if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT) ||
|
||||
!cryptgenrandom(hcryptprov, 16, key) ||
|
||||
!cryptgenrandom(hcryptprov, 8, &rand_ctx->ctr[8]) ) {
|
||||
!CryptGenRandom(hCryptProv, 16, key)) {
|
||||
goto err;
|
||||
}
|
||||
#else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user