Skip to content

Commit cc7a6d0

Browse files
committed
Add wycheproof test support for Windows MSVC (C backend only)
mlkem-native already runs tests on Windows via Mingw-w64, but the MSVC/nmake build has no wycheproof test coverage. This commit adds the compile and link rules to Makefile.Microsoft_nmake, also add the run_wycheproof target, to enable wycheproof tests against the portable C backend under MSVC. Signed-off-by: willieyz <willie.zhao@chelpis.com>
1 parent 92384e2 commit cc7a6d0

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

Makefile.Microsoft_nmake

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,21 @@ OPT = 0
130130
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\test\acvp mkdir $(MLKEM1024_BUILD_DIR)\test\acvp
131131
$(CC) $(CFLAGS) /D MLK_CONFIG_PARAMETER_SET=1024 /c /Fo$(MLKEM1024_BUILD_DIR)\test\acvp\ $<
132132

133+
# compilation of wycheproof test for mlkem512
134+
{test\wycheproof}.c{$(MLKEM512_BUILD_DIR)\test\wycheproof}.obj::
135+
@if NOT EXIST $(MLKEM512_BUILD_DIR)\test\wycheproof mkdir $(MLKEM512_BUILD_DIR)\test\wycheproof
136+
$(CC) $(CFLAGS) /D MLK_CONFIG_PARAMETER_SET=512 /c /Fo$(MLKEM512_BUILD_DIR)\test\wycheproof\ $<
137+
138+
# compilation of wycheproof test for mlkem768
139+
{test\wycheproof}.c{$(MLKEM768_BUILD_DIR)\test\wycheproof}.obj::
140+
@if NOT EXIST $(MLKEM768_BUILD_DIR)\test\wycheproof mkdir $(MLKEM768_BUILD_DIR)\test\wycheproof
141+
$(CC) $(CFLAGS) /D MLK_CONFIG_PARAMETER_SET=768 /c /Fo$(MLKEM768_BUILD_DIR)\test\wycheproof\ $<
142+
143+
# compilation of wycheproof test for mlkem1024
144+
{test\wycheproof}.c{$(MLKEM1024_BUILD_DIR)\test\wycheproof}.obj::
145+
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\test\wycheproof mkdir $(MLKEM1024_BUILD_DIR)\test\wycheproof
146+
$(CC) $(CFLAGS) /D MLK_CONFIG_PARAMETER_SET=1024 /c /Fo$(MLKEM1024_BUILD_DIR)\test\wycheproof\ $<
147+
133148
# compile functional test for mlkem512
134149
test_mlkem512: $(OBJ_FILES_512) $(MLKEM512_BUILD_DIR)\test\test_mlkem.obj $(BUILD_DIR)\randombytes\notrandombytes.obj
135150
@if NOT EXIST $(MLKEM512_BUILD_DIR)\bin mkdir $(MLKEM512_BUILD_DIR)\bin
@@ -205,8 +220,25 @@ test_alloc1024: $(OBJ_FILES_1024_ALLOC) $(MLKEM1024_BUILD_DIR)\test\alloc\test_a
205220
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\bin mkdir $(MLKEM1024_BUILD_DIR)\bin
206221
$(CC) $(CFLAGS) /D MLK_CONFIG_PARAMETER_SET=1024 /Fe$(MLKEM1024_BUILD_DIR)\bin\test_alloc1024 $** /link
207222

223+
# compile wycheproof test for mlkem512
224+
wycheproof_mlkem512: $(OBJ_FILES_512) $(MLKEM512_BUILD_DIR)\test\wycheproof\wycheproof_mlkem.obj $(BUILD_DIR)\randombytes\notrandombytes.obj
225+
@if NOT EXIST $(MLKEM512_BUILD_DIR)\bin mkdir $(MLKEM512_BUILD_DIR)\bin
226+
$(CC) $(CFLAGS) /D MLK_CONFIG_PARAMETER_SET=512 /Fe$(MLKEM512_BUILD_DIR)\bin\wycheproof_mlkem512 $** /link
227+
228+
# compile wycheproof test for mlkem768
229+
wycheproof_mlkem768: $(OBJ_FILES_768) $(MLKEM768_BUILD_DIR)\test\wycheproof\wycheproof_mlkem.obj $(BUILD_DIR)\randombytes\notrandombytes.obj
230+
@if NOT EXIST $(MLKEM768_BUILD_DIR)\bin mkdir $(MLKEM768_BUILD_DIR)\bin
231+
$(CC) $(CFLAGS) /D MLK_CONFIG_PARAMETER_SET=768 /Fe$(MLKEM768_BUILD_DIR)\bin\wycheproof_mlkem768 $** /link
232+
233+
# compile wycheproof test for mlkem1024
234+
wycheproof_mlkem1024: $(OBJ_FILES_1024) $(MLKEM1024_BUILD_DIR)\test\wycheproof\wycheproof_mlkem.obj $(BUILD_DIR)\randombytes\notrandombytes.obj
235+
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\bin mkdir $(MLKEM1024_BUILD_DIR)\bin
236+
$(CC) $(CFLAGS) /D MLK_CONFIG_PARAMETER_SET=1024 /Fe$(MLKEM1024_BUILD_DIR)\bin\wycheproof_mlkem1024 $** /link
237+
208238
acvp: acvp_mlkem512 acvp_mlkem768 acvp_mlkem1024
209239

240+
wycheproof: wycheproof_mlkem512 wycheproof_mlkem768 wycheproof_mlkem1024
241+
210242
gen_KAT: gen_KAT512 gen_KAT768 gen_KAT1024
211243

212244
run_kat: gen_KAT
@@ -217,6 +249,9 @@ run_kat: gen_KAT
217249
run_acvp: acvp
218250
python test/acvp/acvp_client.py
219251

252+
run_wycheproof: wycheproof
253+
python test/wycheproof/wycheproof_client.py
254+
220255
run_func: test_mlkem512 test_mlkem768 test_mlkem1024
221256
$(MLKEM512_BUILD_DIR)\bin\test_mlkem512.exe
222257
$(MLKEM768_BUILD_DIR)\bin\test_mlkem768.exe
@@ -232,7 +267,7 @@ run_alloc: test_alloc512 test_alloc768 test_alloc1024
232267
$(MLKEM768_BUILD_DIR)\bin\test_alloc768.exe
233268
$(MLKEM1024_BUILD_DIR)\bin\test_alloc1024.exe
234269

235-
test: run_func run_rng_fail run_alloc run_acvp run_kat
270+
test: run_func run_rng_fail run_alloc run_acvp run_kat run_wycheproof
236271
@echo Everything checks fine!
237272

238273
quickcheck: test

0 commit comments

Comments
 (0)