Skip to content

Commit 5b8519f

Browse files
committed
Add allocation failure test with bump allocator
Tests that the toplevel API correctly handles allocation failures by: - Returning MLD_ERR_OUT_OF_MEMORY on allocation failure - Cleaning up all allocated memory (no leaks) - Freeing in LIFO order (enabling bump allocator use) Uses custom bump allocator with LIFO tracking to systematically inject failures at each allocation point and verify error handling. Signed-off-by: Hanno Becker <[email protected]>
1 parent 9ad3d21 commit 5b8519f

File tree

8 files changed

+1421
-55
lines changed

8 files changed

+1421
-55
lines changed

BIBLIOGRAPHY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ source code and documentation.
5353
- [test/custom_zeroize_config.h](test/custom_zeroize_config.h)
5454
- [test/no_asm_config.h](test/no_asm_config.h)
5555
- [test/serial_fips202_config.h](test/serial_fips202_config.h)
56+
- [test/test_alloc_config.h](test/test_alloc_config.h)
5657

5758
### `FIPS202`
5859

@@ -107,6 +108,7 @@ source code and documentation.
107108
- [test/custom_zeroize_config.h](test/custom_zeroize_config.h)
108109
- [test/no_asm_config.h](test/no_asm_config.h)
109110
- [test/serial_fips202_config.h](test/serial_fips202_config.h)
111+
- [test/test_alloc_config.h](test/test_alloc_config.h)
110112

111113
### `HYBRID`
112114

Makefile

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
# Copyright (c) The mldsa-native project authors
33
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
44

5-
.PHONY: func kat acvp stack unit \
6-
func_44 kat_44 acvp_44 stack_44 unit_44 \
7-
func_65 kat_65 acvp_65 stack_65 unit_65 \
8-
func_87 kat_87 acvp_87 stack_87 unit_87 \
9-
run_func run_kat run_acvp run_stack run_unit \
10-
run_func_44 run_kat_44 run_stack_44 run_unit_44 \
11-
run_func_65 run_kat_65 run_stack_65 run_unit_65 \
12-
run_func_87 run_kat_87 run_stack_87 run_unit_87 \
5+
.PHONY: func kat acvp stack unit alloc \
6+
func_44 kat_44 acvp_44 stack_44 unit_44 alloc_44 \
7+
func_65 kat_65 acvp_65 stack_65 unit_65 alloc_65 \
8+
func_87 kat_87 acvp_87 stack_87 unit_87 alloc_87 \
9+
run_func run_kat run_acvp run_stack run_unit run_alloc \
10+
run_func_44 run_kat_44 run_stack_44 run_unit_44 run_alloc_44 \
11+
run_func_65 run_kat_65 run_stack_65 run_unit_65 run_alloc_65 \
12+
run_func_87 run_kat_87 run_stack_87 run_unit_87 run_alloc_87 \
1313
bench_44 bench_65 bench_87 bench \
1414
run_bench_44 run_bench_65 run_bench_87 run_bench \
1515
bench_components_44 bench_components_65 bench_components_87 bench_components \
@@ -48,7 +48,7 @@ quickcheck: test
4848
build: func kat acvp
4949
$(Q)echo " Everything builds fine!"
5050

51-
test: run_kat run_func run_acvp run_unit
51+
test: run_kat run_func run_acvp run_unit run_alloc
5252
$(Q)echo " Everything checks fine!"
5353

5454
# Detect available SHA256 command
@@ -115,7 +115,7 @@ acvp_65: $(MLDSA65_DIR)/bin/acvp_mldsa65
115115
acvp_87: $(MLDSA87_DIR)/bin/acvp_mldsa87
116116
$(Q)echo " ACVP ML-DSA-87: $^"
117117
acvp: acvp_44 acvp_65 acvp_87
118-
118+
119119
ifeq ($(HOST_PLATFORM),Linux-aarch64)
120120
# valgrind does not work with the AArch64 SHA3 extension
121121
# Use armv8-a as the target architecture, overwriting a
@@ -141,6 +141,22 @@ run_stack_87: stack_87
141141
$(Q)python3 scripts/stack $(MLDSA87_DIR)/bin/test_stack87 --build-dir $(MLDSA87_DIR) $(STACK_ANALYSIS_FLAGS)
142142
run_stack: run_stack_44 run_stack_65 run_stack_87
143143

144+
alloc_44: $(MLDSA44_DIR)/bin/test_alloc44
145+
$(Q)echo " ALLOC ML-DSA-44: $^"
146+
alloc_65: $(MLDSA65_DIR)/bin/test_alloc65
147+
$(Q)echo " ALLOC ML-DSA-65: $^"
148+
alloc_87: $(MLDSA87_DIR)/bin/test_alloc87
149+
$(Q)echo " ALLOC ML-DSA-87: $^"
150+
alloc: alloc_44 alloc_65 alloc_87
151+
152+
run_alloc_44: alloc_44
153+
$(W) $(MLDSA44_DIR)/bin/test_alloc44
154+
run_alloc_65: alloc_65
155+
$(W) $(MLDSA65_DIR)/bin/test_alloc65
156+
run_alloc_87: alloc_87
157+
$(W) $(MLDSA87_DIR)/bin/test_alloc87
158+
run_alloc: run_alloc_44 run_alloc_65 run_alloc_87
159+
144160
lib: $(BUILD_DIR)/libmldsa.a $(BUILD_DIR)/libmldsa44.a $(BUILD_DIR)/libmldsa65.a $(BUILD_DIR)/libmldsa87.a
145161

146162
# Enforce setting CYCLES make variable when

mldsa/src/sign.c

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ static int mld_check_pct(uint8_t const pk[MLDSA_CRYPTO_PUBLICKEYBYTES],
119119

120120
cleanup:
121121
/* @[FIPS204, Section 3.6.3] Destruction of intermediate values. */
122-
MLD_FREE(signature, uint8_t, MLDSA_CRYPTO_BYTES);
123122
MLD_FREE(pk_test, uint8_t, MLDSA_CRYPTO_PUBLICKEYBYTES);
123+
MLD_FREE(signature, uint8_t, MLDSA_CRYPTO_BYTES);
124124

125125
return ret;
126126
}
@@ -274,9 +274,9 @@ __contract__(
274274

275275
cleanup:
276276
/* @[FIPS204, Section 3.6.3] Destruction of intermediate values. */
277-
MLD_FREE(mat, mld_polymat, 1);
278-
MLD_FREE(s1hat, mld_polyvecl, 1);
279277
MLD_FREE(t, mld_polyveck, 1);
278+
MLD_FREE(s1hat, mld_polyvecl, 1);
279+
MLD_FREE(mat, mld_polymat, 1);
280280
return ret;
281281
}
282282

@@ -332,19 +332,24 @@ int crypto_sign_keypair_internal(uint8_t pk[MLDSA_CRYPTO_PUBLICKEYBYTES],
332332
/* Constant time: pk is the public key, inherently public data */
333333
MLD_CT_TESTING_DECLASSIFY(pk, MLDSA_CRYPTO_PUBLICKEYBYTES);
334334

335-
/* Pairwise Consistency Test (PCT) @[FIPS140_3_IG, p.87] */
336-
ret = mld_check_pct(pk, sk);
337-
338335
cleanup:
339336
/* @[FIPS204, Section 3.6.3] Destruction of intermediate values. */
340-
MLD_FREE(seedbuf, uint8_t, 2 * MLDSA_SEEDBYTES + MLDSA_CRHBYTES);
341-
MLD_FREE(inbuf, uint8_t, MLDSA_SEEDBYTES + 2);
342-
MLD_FREE(tr, uint8_t, MLDSA_TRBYTES);
343-
MLD_FREE(s1, mld_polyvecl, 1);
344-
MLD_FREE(s2, mld_polyveck, 1);
345-
MLD_FREE(t1, mld_polyveck, 1);
346337
MLD_FREE(t0, mld_polyveck, 1);
347-
return ret;
338+
MLD_FREE(t1, mld_polyveck, 1);
339+
MLD_FREE(s2, mld_polyveck, 1);
340+
MLD_FREE(s1, mld_polyvecl, 1);
341+
MLD_FREE(tr, uint8_t, MLDSA_TRBYTES);
342+
MLD_FREE(inbuf, uint8_t, MLDSA_SEEDBYTES + 2);
343+
MLD_FREE(seedbuf, uint8_t, 2 * MLDSA_SEEDBYTES + MLDSA_CRHBYTES);
344+
345+
if (ret != 0)
346+
{
347+
return ret;
348+
}
349+
350+
/* Pairwise Consistency Test (PCT) @[FIPS140_3_IG, p.87] */
351+
/* Do this after freeing all temporaries. */
352+
return mld_check_pct(pk, sk);
348353
}
349354

350355
#if !defined(MLD_CONFIG_NO_RANDOMIZED_API)
@@ -610,13 +615,13 @@ __contract__(
610615

611616
cleanup:
612617
/* @[FIPS204, Section 3.6.3] Destruction of intermediate values. */
613-
MLD_FREE(challenge_bytes, uint8_t, MLDSA_CTILDEBYTES);
614-
MLD_FREE(y, mld_polyvecl, 1);
615-
MLD_FREE(z, mld_polyvecl, 1);
616-
MLD_FREE(w1, mld_polyveck, 1);
617-
MLD_FREE(w0, mld_polyveck, 1);
618-
MLD_FREE(h, mld_polyveck, 1);
619618
MLD_FREE(cp, mld_poly, 1);
619+
MLD_FREE(h, mld_polyveck, 1);
620+
MLD_FREE(w0, mld_polyveck, 1);
621+
MLD_FREE(w1, mld_polyveck, 1);
622+
MLD_FREE(z, mld_polyvecl, 1);
623+
MLD_FREE(y, mld_polyvecl, 1);
624+
MLD_FREE(challenge_bytes, uint8_t, MLDSA_CTILDEBYTES);
620625

621626
return res;
622627
}
@@ -735,12 +740,12 @@ int crypto_sign_signature_internal(
735740
}
736741

737742
/* @[FIPS204, Section 3.6.3] Destruction of intermediate values. */
738-
MLD_FREE(seedbuf, uint8_t,
739-
2 * MLDSA_SEEDBYTES + MLDSA_TRBYTES + 2 * MLDSA_CRHBYTES);
740-
MLD_FREE(mat, mld_polymat, 1);
741-
MLD_FREE(s1, mld_polyvecl, 1);
742743
MLD_FREE(s2, mld_polyveck, 1);
743744
MLD_FREE(t0, mld_polyveck, 1);
745+
MLD_FREE(s1, mld_polyvecl, 1);
746+
MLD_FREE(mat, mld_polymat, 1);
747+
MLD_FREE(seedbuf, uint8_t,
748+
2 * MLDSA_SEEDBYTES + MLDSA_TRBYTES + 2 * MLDSA_CRHBYTES);
744749
return ret;
745750
}
746751

@@ -794,8 +799,8 @@ int crypto_sign_signature(uint8_t sig[MLDSA_CRYPTO_BYTES], size_t *siglen,
794799
}
795800

796801
/* @[FIPS204, Section 3.6.3] Destruction of intermediate values. */
797-
MLD_FREE(pre, uint8_t, MLD_DOMAIN_SEPARATION_MAX_BYTES);
798802
MLD_FREE(rnd, uint8_t, MLDSA_RNDBYTES);
803+
MLD_FREE(pre, uint8_t, MLD_DOMAIN_SEPARATION_MAX_BYTES);
799804

800805
return ret;
801806
}
@@ -971,18 +976,18 @@ int crypto_sign_verify_internal(const uint8_t *sig, size_t siglen,
971976

972977
cleanup:
973978
/* @[FIPS204, Section 3.6.3] Destruction of intermediate values. */
974-
MLD_FREE(buf, uint8_t, (MLDSA_K * MLDSA_POLYW1_PACKEDBYTES));
975-
MLD_FREE(rho, uint8_t, MLDSA_SEEDBYTES);
976-
MLD_FREE(mu, uint8_t, MLDSA_CRHBYTES);
977-
MLD_FREE(c, uint8_t, MLDSA_CTILDEBYTES);
978-
MLD_FREE(c2, uint8_t, MLDSA_CTILDEBYTES);
979-
MLD_FREE(cp, mld_poly, 1);
980-
MLD_FREE(mat, mld_polymat, 1);
981-
MLD_FREE(z, mld_polyvecl, 1);
982-
MLD_FREE(t1, mld_polyveck, 1);
983-
MLD_FREE(w1, mld_polyveck, 1);
984-
MLD_FREE(tmp, mld_polyveck, 1);
985979
MLD_FREE(h, mld_polyveck, 1);
980+
MLD_FREE(tmp, mld_polyveck, 1);
981+
MLD_FREE(w1, mld_polyveck, 1);
982+
MLD_FREE(t1, mld_polyveck, 1);
983+
MLD_FREE(z, mld_polyvecl, 1);
984+
MLD_FREE(mat, mld_polymat, 1);
985+
MLD_FREE(cp, mld_poly, 1);
986+
MLD_FREE(c2, uint8_t, MLDSA_CTILDEBYTES);
987+
MLD_FREE(c, uint8_t, MLDSA_CTILDEBYTES);
988+
MLD_FREE(mu, uint8_t, MLDSA_CRHBYTES);
989+
MLD_FREE(rho, uint8_t, MLDSA_SEEDBYTES);
990+
MLD_FREE(buf, uint8_t, (MLDSA_K * MLDSA_POLYW1_PACKEDBYTES));
986991
return res;
987992
}
988993

@@ -1349,15 +1354,15 @@ int crypto_sign_pk_from_sk(uint8_t pk[MLDSA_CRYPTO_PUBLICKEYBYTES],
13491354

13501355
cleanup:
13511356
/* @[FIPS204, Section 3.6.3] Destruction of intermediate values. */
1352-
MLD_FREE(rho, uint8_t, MLDSA_SEEDBYTES);
1353-
MLD_FREE(tr, uint8_t, MLDSA_TRBYTES);
1354-
MLD_FREE(tr_computed, uint8_t, MLDSA_TRBYTES);
1355-
MLD_FREE(key, uint8_t, MLDSA_SEEDBYTES);
1356-
MLD_FREE(s1, mld_polyvecl, 1);
1357-
MLD_FREE(s2, mld_polyveck, 1);
1358-
MLD_FREE(t0, mld_polyveck, 1);
1359-
MLD_FREE(t0_computed, mld_polyveck, 1);
13601357
MLD_FREE(t1, mld_polyveck, 1);
1358+
MLD_FREE(t0_computed, mld_polyveck, 1);
1359+
MLD_FREE(t0, mld_polyveck, 1);
1360+
MLD_FREE(s2, mld_polyveck, 1);
1361+
MLD_FREE(s1, mld_polyvecl, 1);
1362+
MLD_FREE(key, uint8_t, MLDSA_SEEDBYTES);
1363+
MLD_FREE(tr_computed, uint8_t, MLDSA_TRBYTES);
1364+
MLD_FREE(tr, uint8_t, MLDSA_TRBYTES);
1365+
MLD_FREE(rho, uint8_t, MLDSA_SEEDBYTES);
13611366

13621367
return ret;
13631368
}

test/configs.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,3 +411,21 @@ configs:
411411
#endif /* !__ASSEMBLER__ */
412412
MLD_CONFIG_FILE:
413413
comment: "/* No need to set this -- we _are_ already in a custom config */"
414+
415+
- path: test/test_alloc_config.h
416+
description: "Using custom allocation that can be made fail at specific invocation"
417+
defines:
418+
MLD_CONFIG_NAMESPACE_PREFIX: mld
419+
MLD_CONFIG_KEYGEN_PCT: true
420+
MLD_CONFIG_CUSTOM_ALLOC_FREE:
421+
content: |
422+
#define MLD_CONFIG_CUSTOM_ALLOC_FREE
423+
#if !defined(__ASSEMBLER__)
424+
#include <stdlib.h>
425+
void * custom_alloc(size_t sz, const char *file, int line, const char *var, const char *type);
426+
void custom_free(void *p, size_t sz, const char *file, int line, const char *var, const char *type);
427+
#define MLD_CUSTOM_ALLOC(v, T, N) T *v = custom_alloc(sizeof(T)*(N), __FILE__, __LINE__, #v, #T)
428+
#define MLD_CUSTOM_FREE(v, T, N) custom_free(v, sizeof(T)*(N), __FILE__, __LINE__, #v, #T)
429+
#endif /* !__ASSEMBLER__ */
430+
MLD_CONFIG_FILE:
431+
comment: "/* No need to set this -- we _are_ already in a custom config */"

test/mk/components.mk

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ifeq ($(OPT),1)
1414
CFLAGS += -DMLD_CONFIG_USE_NATIVE_BACKEND_ARITH -DMLD_CONFIG_USE_NATIVE_BACKEND_FIPS202
1515
endif
1616

17-
ALL_TESTS = test_mldsa test_unit acvp_mldsa bench_mldsa bench_components_mldsa gen_KAT test_stack
17+
ALL_TESTS = test_mldsa test_unit acvp_mldsa bench_mldsa bench_components_mldsa gen_KAT test_stack test_alloc
1818

1919
MLDSA44_DIR = $(BUILD_DIR)/mldsa44
2020
MLDSA65_DIR = $(BUILD_DIR)/mldsa65
@@ -35,6 +35,14 @@ $(MLDSA65_UNIT_OBJS): CFLAGS += -DMLD_CONFIG_PARAMETER_SET=65 -DMLD_STATIC_TESTA
3535
MLDSA87_UNIT_OBJS = $(call MAKE_OBJS,$(MLDSA87_DIR)/unit,$(SOURCES) $(FIPS202_SRCS))
3636
$(MLDSA87_UNIT_OBJS): CFLAGS += -DMLD_CONFIG_PARAMETER_SET=87 -DMLD_STATIC_TESTABLE= -Wno-missing-prototypes
3737

38+
# Alloc test object files - same sources but with custom alloc config
39+
MLDSA44_ALLOC_OBJS = $(call MAKE_OBJS,$(MLDSA44_DIR)/alloc,$(SOURCES) $(FIPS202_SRCS))
40+
$(MLDSA44_ALLOC_OBJS): CFLAGS += -DMLD_CONFIG_PARAMETER_SET=44 -DMLD_CONFIG_FILE=\"../test/test_alloc_config.h\"
41+
MLDSA65_ALLOC_OBJS = $(call MAKE_OBJS,$(MLDSA65_DIR)/alloc,$(SOURCES) $(FIPS202_SRCS))
42+
$(MLDSA65_ALLOC_OBJS): CFLAGS += -DMLD_CONFIG_PARAMETER_SET=65 -DMLD_CONFIG_FILE=\"../test/test_alloc_config.h\"
43+
MLDSA87_ALLOC_OBJS = $(call MAKE_OBJS,$(MLDSA87_DIR)/alloc,$(SOURCES) $(FIPS202_SRCS))
44+
$(MLDSA87_ALLOC_OBJS): CFLAGS += -DMLD_CONFIG_PARAMETER_SET=87 -DMLD_CONFIG_FILE=\"../test/test_alloc_config.h\"
45+
3846

3947

4048
CFLAGS += -Imldsa
@@ -48,6 +56,11 @@ $(BUILD_DIR)/libmldsa44_unit.a: $(MLDSA44_UNIT_OBJS)
4856
$(BUILD_DIR)/libmldsa65_unit.a: $(MLDSA65_UNIT_OBJS)
4957
$(BUILD_DIR)/libmldsa87_unit.a: $(MLDSA87_UNIT_OBJS)
5058

59+
# Alloc test libraries with custom alloc config
60+
$(BUILD_DIR)/libmldsa44_alloc.a: $(MLDSA44_ALLOC_OBJS)
61+
$(BUILD_DIR)/libmldsa65_alloc.a: $(MLDSA65_ALLOC_OBJS)
62+
$(BUILD_DIR)/libmldsa87_alloc.a: $(MLDSA87_ALLOC_OBJS)
63+
5164

5265
$(BUILD_DIR)/libmldsa.a: $(MLDSA44_OBJS) $(MLDSA65_OBJS) $(MLDSA87_OBJS)
5366

@@ -62,6 +75,10 @@ $(MLDSA44_DIR)/bin/test_stack44: CFLAGS += -Imldsa -fstack-usage
6275
$(MLDSA65_DIR)/bin/test_stack65: CFLAGS += -Imldsa -fstack-usage
6376
$(MLDSA87_DIR)/bin/test_stack87: CFLAGS += -Imldsa -fstack-usage
6477

78+
$(MLDSA44_DIR)/test/test_alloc.c.o: CFLAGS += -DMLD_CONFIG_FILE=\"../test/test_alloc_config.h\"
79+
$(MLDSA65_DIR)/test/test_alloc.c.o: CFLAGS += -DMLD_CONFIG_FILE=\"../test/test_alloc_config.h\"
80+
$(MLDSA87_DIR)/test/test_alloc.c.o: CFLAGS += -DMLD_CONFIG_FILE=\"../test/test_alloc_config.h\"
81+
6582
$(MLDSA44_DIR)/bin/test_unit44: CFLAGS += -DMLD_STATIC_TESTABLE= -Wno-missing-prototypes
6683
$(MLDSA65_DIR)/bin/test_unit65: CFLAGS += -DMLD_STATIC_TESTABLE= -Wno-missing-prototypes
6784
$(MLDSA87_DIR)/bin/test_unit87: CFLAGS += -DMLD_STATIC_TESTABLE= -Wno-missing-prototypes
@@ -96,9 +113,15 @@ $(BUILD_DIR)/$(1)/bin/test_unit$(subst mldsa,,$(1)): LDLIBS += -L$(BUILD_DIR) -l
96113
$(BUILD_DIR)/$(1)/bin/test_unit$(subst mldsa,,$(1)): $(BUILD_DIR)/$(1)/test/test_unit.c.o $(BUILD_DIR)/lib$(1)_unit.a $(call MAKE_OBJS, $(BUILD_DIR)/$(1), $(wildcard test/notrandombytes/*.c))
97114
endef
98115

116+
# Special rule for test_alloc - link against alloc libraries with custom alloc config
117+
define ADD_SOURCE_ALLOC
118+
$(BUILD_DIR)/$(1)/bin/test_alloc$(subst mldsa,,$(1)): LDLIBS += -L$(BUILD_DIR) -l$(1)_alloc
119+
$(BUILD_DIR)/$(1)/bin/test_alloc$(subst mldsa,,$(1)): $(BUILD_DIR)/$(1)/test/test_alloc.c.o $(BUILD_DIR)/lib$(1)_alloc.a $(call MAKE_OBJS, $(BUILD_DIR)/$(1), $(wildcard test/notrandombytes/*.c))
120+
endef
121+
99122

100123
$(foreach scheme,mldsa44 mldsa65 mldsa87, \
101-
$(foreach test,$(filter-out test_unit,$(ALL_TESTS)), \
124+
$(foreach test,$(filter-out test_unit test_alloc,$(ALL_TESTS)), \
102125
$(eval $(call ADD_SOURCE,$(scheme),$(test))) \
103126
) \
104127
)
@@ -107,6 +130,10 @@ $(foreach scheme,mldsa44 mldsa65 mldsa87, \
107130
$(eval $(call ADD_SOURCE_UNIT,$(scheme))) \
108131
)
109132

133+
$(foreach scheme,mldsa44 mldsa65 mldsa87, \
134+
$(eval $(call ADD_SOURCE_ALLOC,$(scheme))) \
135+
)
136+
110137
$(ALL_TESTS:%=$(MLDSA44_DIR)/bin/%44): $(call MAKE_OBJS, $(MLDSA44_DIR), $(wildcard test/notrandombytes/*.c) $(EXTRA_SOURCES))
111138
$(ALL_TESTS:%=$(MLDSA65_DIR)/bin/%65): $(call MAKE_OBJS, $(MLDSA65_DIR), $(wildcard test/notrandombytes/*.c) $(EXTRA_SOURCES))
112139
$(ALL_TESTS:%=$(MLDSA87_DIR)/bin/%87): $(call MAKE_OBJS, $(MLDSA87_DIR), $(wildcard test/notrandombytes/*.c) $(EXTRA_SOURCES))

test/mk/rules.mk

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,33 @@ $(BUILD_DIR)/mldsa87/unit/%.S.o: %.S $(CONFIG)
8383
$(Q)echo " AS $@"
8484
$(Q)[ -d $(@D) ] || mkdir -p $(@D)
8585
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
86+
87+
$(BUILD_DIR)/mldsa44/alloc/%.c.o: %.c $(CONFIG)
88+
$(Q)echo " CC $@"
89+
$(Q)[ -d $(@D) ] || mkdir -p $(@D)
90+
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
91+
92+
$(BUILD_DIR)/mldsa44/alloc/%.S.o: %.S $(CONFIG)
93+
$(Q)echo " AS $@"
94+
$(Q)[ -d $(@D) ] || mkdir -p $(@D)
95+
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
96+
97+
$(BUILD_DIR)/mldsa65/alloc/%.c.o: %.c $(CONFIG)
98+
$(Q)echo " CC $@"
99+
$(Q)[ -d $(@D) ] || mkdir -p $(@D)
100+
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
101+
102+
$(BUILD_DIR)/mldsa65/alloc/%.S.o: %.S $(CONFIG)
103+
$(Q)echo " AS $@"
104+
$(Q)[ -d $(@D) ] || mkdir -p $(@D)
105+
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
106+
107+
$(BUILD_DIR)/mldsa87/alloc/%.c.o: %.c $(CONFIG)
108+
$(Q)echo " CC $@"
109+
$(Q)[ -d $(@D) ] || mkdir -p $(@D)
110+
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
111+
112+
$(BUILD_DIR)/mldsa87/alloc/%.S.o: %.S $(CONFIG)
113+
$(Q)echo " AS $@"
114+
$(Q)[ -d $(@D) ] || mkdir -p $(@D)
115+
$(Q)$(CC) -c -o $@ $(CFLAGS) $<

0 commit comments

Comments
 (0)