mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-26 09:21:28 +00:00
Build functional tests and test vectors on Windows continuous integration
This commit is contained in:
parent
a7328f827c
commit
5f3e8ca2d5
@ -33,8 +33,8 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
/* Windows */
|
/* Windows */
|
||||||
#include <wincrypt.h> /* CryptAcquireContext, CryptGenRandom */
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <wincrypt.h> /* CryptAcquireContext, CryptGenRandom */
|
||||||
#endif /* defined(_WIN32) */
|
#endif /* defined(_WIN32) */
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
@ -1,19 +1,44 @@
|
|||||||
@ECHO OFF
|
@ECHO OFF
|
||||||
SETLOCAL
|
SETLOCAL EnableDelayedExpansion
|
||||||
SET EL=0
|
SET EL=0
|
||||||
|
|
||||||
REM CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
|
REM CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||||
REM IF ERRORLEVEL 1 SET EL=1
|
REM IF ERRORLEVEL 1 SET EL=1
|
||||||
|
|
||||||
|
:: Build the library files for individual implementations
|
||||||
FOR /D %%K IN (crypto_kem\* crypto_sign\*) DO (
|
FOR /D %%K IN (crypto_kem\* crypto_sign\*) DO (
|
||||||
FOR /D %%L IN (%%K\*) DO (
|
FOR /D %%L IN (%%K\*) DO (
|
||||||
cd %%L
|
CD %%L
|
||||||
nmake /f Makefile.Microsoft_nmake clean
|
nmake /f Makefile.Microsoft_nmake clean
|
||||||
IF ERRORLEVEL 1 SET EL=2
|
IF ERRORLEVEL 1 SET EL=2
|
||||||
nmake /f Makefile.Microsoft_nmake
|
nmake /f Makefile.Microsoft_nmake
|
||||||
IF ERRORLEVEL 1 SET EL=3
|
IF ERRORLEVEL 1 SET EL=3
|
||||||
cd ..\..\..
|
CD ..\..\..
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
:: Build and run the functional tests and test vector programs for each implementation
|
||||||
|
FOR %%T IN (kem sign) DO (
|
||||||
|
CD crypto_%%T
|
||||||
|
FOR /D %%K IN (*) DO (
|
||||||
|
SET schemeuppercase=%%K
|
||||||
|
FOR %%B IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO SET "schemeuppercase=!schemeuppercase:%%B=%%B!"
|
||||||
|
SET "schemeuppercase=!schemeuppercase:-=!"
|
||||||
|
CD %%K
|
||||||
|
FOR /D %%L IN (*) DO (
|
||||||
|
CD ..\..\test
|
||||||
|
nmake /f Makefile.Microsoft_nmake /E TYPE=%%T SCHEME=%%K SCHEME_UPPERCASE=!schemeuppercase! IMPLEMENTATION=%%L clean
|
||||||
|
IF ERRORLEVEL 1 SET EL=4
|
||||||
|
nmake /f Makefile.Microsoft_nmake /E TYPE=%%T SCHEME=%%K SCHEME_UPPERCASE=!schemeuppercase! IMPLEMENTATION=%%L
|
||||||
|
IF ERRORLEVEL 1 SET EL=5
|
||||||
|
CD ..
|
||||||
|
bin\functest_%%K_%%L
|
||||||
|
IF ERRORLEVEL 1 SET EL=6
|
||||||
|
CD crypto_%%T\%%K
|
||||||
|
)
|
||||||
|
CD ..
|
||||||
|
)
|
||||||
|
CD ..
|
||||||
|
)
|
||||||
|
|
||||||
EXIT /b %EL%
|
EXIT /b %EL%
|
||||||
|
41
test/Makefile.Microsoft_nmake
Normal file
41
test/Makefile.Microsoft_nmake
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# This Makefile can be used with Microsoft Visual Studio's nmake using the command:
|
||||||
|
# nmake /f Makefile.Microsoft_nmake
|
||||||
|
|
||||||
|
# override as desired
|
||||||
|
TYPE=kem
|
||||||
|
SCHEME=kyber768
|
||||||
|
SCHEME_UPPERCASE=KYBER768
|
||||||
|
IMPLEMENTATION=clean
|
||||||
|
|
||||||
|
SCHEME_DIR=..\crypto_$(TYPE)\$(SCHEME)\$(IMPLEMENTATION)
|
||||||
|
|
||||||
|
COMMON_DIR=..\common
|
||||||
|
COMMON_OBJECTS=$(COMMON_DIR)\fips202.obj $(COMMON_DIR)\sha2.obj
|
||||||
|
COMMON_OBJECTS_NOPATH=fips202.obj sha2.obj
|
||||||
|
|
||||||
|
DEST_DIR=..\bin
|
||||||
|
|
||||||
|
CFLAGS=/I $(COMMON_DIR) /W1 /WX # FIXME: Should be /W4 but many compiler warnings in common files
|
||||||
|
|
||||||
|
all: $(DEST_DIR)\functest_$(SCHEME)_$(IMPLEMENTATION).EXE $(DEST_DIR)\testvectors_$(SCHEME)_$(IMPLEMENTATION).EXE
|
||||||
|
|
||||||
|
rebuild-scheme:
|
||||||
|
cd $(SCHEME_DIR)
|
||||||
|
nmake /f Makefile.Microsoft_nmake clean
|
||||||
|
nmake /f Makefile.Microsoft_nmake
|
||||||
|
cd ..\..\..\test
|
||||||
|
|
||||||
|
$(DEST_DIR)\functest_$(SCHEME)_$(IMPLEMENTATION).EXE: rebuild-scheme $(COMMON_OBJECTS) $(COMMON_DIR)\randombytes.obj
|
||||||
|
-MKDIR $(DEST_DIR)
|
||||||
|
$(CC) /c crypto_$(TYPE)\functest.c $(CFLAGS) /I $(SCHEME_DIR) /DPQCLEAN_NAMESPACE=PQCLEAN_$(SCHEME_UPPERCASE)
|
||||||
|
LINK.EXE /OUT:$@ functest.obj $(COMMON_OBJECTS_NOPATH) randombytes.obj $(SCHEME_DIR)\lib$(SCHEME)_$(IMPLEMENTATION).lib Advapi32.lib
|
||||||
|
|
||||||
|
$(DEST_DIR)\testvectors_$(SCHEME)_$(IMPLEMENTATION).EXE: rebuild-scheme $(COMMON_OBJECTS) $(COMMON_DIR)\notrandombytes.obj
|
||||||
|
-MKDIR $(DEST_DIR)
|
||||||
|
$(CC) /c crypto_$(TYPE)\testvectors.c $(CFLAGS) /I $(SCHEME_DIR) /DPQCLEAN_NAMESPACE=PQCLEAN_$(SCHEME_UPPERCASE)
|
||||||
|
LINK.EXE /OUT:$@ testvectors.obj $(COMMON_OBJECTS_NOPATH) notrandombytes.obj $(SCHEME_DIR)\lib$(SCHEME)_$(IMPLEMENTATION).lib
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-DEL functest.obj testvectors.obj
|
||||||
|
-DEL $(COMMON_OBJECTS_NOPATH) randombytes.obj notrandombytes.obj
|
||||||
|
-DEL $(DEST_DIR)\functest_$(SCHEME)_$(IMPLEMENTATION).EXE
|
Loading…
Reference in New Issue
Block a user