@@ -6,13 +6,15 @@ NISTFLAGS += -Wno-unused-result -march=native -mtune=native -O3
6
6
SOURCES = sign.c packing.c polyvec.c poly.c ntt.S invntt.S pointwise.S \
7
7
consts.c rejsample.c reduce.S
8
8
HEADERS = config.h params.h api.h sign.h packing.h polyvec.h poly.h ntt.h \
9
- consts.h shuffle.inc rejsample.h reduce.h rounding.h symmetric.h
9
+ consts.h shuffle.inc rejsample.h reduce.h rounding.h symmetric.h randombytes.h
10
10
KECCAK_SOURCES = $(SOURCES ) fips202.c fips202x4.c symmetric-shake.c \
11
11
keccak4x/KeccakP-1600-times4-SIMD256.o
12
12
KECCAK_HEADERS = $(HEADERS ) fips202.h fips202x4.h
13
13
AES_SOURCES = $(SOURCES ) fips202.c aes256ctr.c
14
14
AES_HEADERS = $(HEADERS ) fips202.h aes256ctr.h
15
15
16
+ .PHONY : all shared clean
17
+
16
18
all : \
17
19
test/test_dilithium2 \
18
20
test/test_dilithium3 \
@@ -40,15 +42,15 @@ all: \
40
42
PQCgenKAT_sign4aes
41
43
42
44
shared : \
43
- dilithium2_avx2 .so \
44
- dilithium3_avx2 .so \
45
- dilithium4_avx2 .so \
46
- dilithium2aes_avx2 .so \
47
- dilithium3aes_avx2 .so \
48
- dilithium4aes_avx2 .so \
49
- pqcrystals_ref .so \
50
- pqcrystals_avx2 .so \
51
- pqcrystals_avx2_aes256ctr .so
45
+ libpqcrystals_dilithium2_avx2 .so \
46
+ libpqcrystals_dilithium3_avx2 .so \
47
+ libpqcrystals_dilithium4_avx2 .so \
48
+ libpqcrystals_dilithium2aes_avx2 .so \
49
+ libpqcrystals_dilithium3aes_avx2 .so \
50
+ libpqcrystals_dilithium4aes_avx2 .so \
51
+ libpqcrystals_fips202_ref .so \
52
+ libpqcrystals_fips202x4_avx2 .so \
53
+ libpqcrystals_aes256ctr_avx2 .so
52
54
53
55
keccak4x/KeccakP-1600-times4-SIMD256.o : \
54
56
keccak4x/KeccakP-1600-times4-SIMD256.c \
@@ -59,189 +61,177 @@ keccak4x/KeccakP-1600-times4-SIMD256.o: \
59
61
keccak4x/brg_endian.h
60
62
$(CC) $(CFLAGS) -c $< -o $@
61
63
62
- pqcrystals_ref .so : fips202.c fips202.h
64
+ libpqcrystals_fips202_ref .so : fips202.c fips202.h
63
65
$(CC ) -shared -fPIC $(CFLAGS ) -o $@ $<
64
66
65
- pqcrystals_avx2 .so : fips202x4.c fips202x4.h \
67
+ libpqcrystals_fips202x4_avx2 .so : fips202x4.c fips202x4.h \
66
68
keccak4x/KeccakP-1600-times4-SIMD256.o
67
69
$(CC) -shared -fPIC $(CFLAGS) -o $@ $< \
68
70
keccak4x/KeccakP-1600-times4-SIMD256.o
69
71
70
- pqcrystals_avx2_aes256ctr .so : aes256ctr.c aes256ctr.h
72
+ libpqcrystals_aes256ctr_avx2 .so : aes256ctr.c aes256ctr.h
71
73
$(CC ) -shared -fPIC $(CFLAGS ) -o $@ $<
72
74
73
- dilithium2_avx2 .so : $(SOURCES ) $(HEADERS ) symmetric-shake.c
75
+ libpqcrystals_dilithium2_avx2 .so : $(SOURCES ) $(HEADERS ) symmetric-shake.c
74
76
$(CC ) -shared -fPIC $(CFLAGS ) -DDILITHIUM_MODE=2 \
75
77
-o $@ $(SOURCES ) symmetric-shake.c
76
78
77
- dilithium3_avx2 .so : $(SOURCES ) $(HEADERS ) symmetric-shake.c
79
+ libpqcrystals_dilithium3_avx2 .so : $(SOURCES ) $(HEADERS ) symmetric-shake.c
78
80
$(CC ) -shared -fPIC $(CFLAGS ) -DDILITHIUM_MODE=3 \
79
81
-o $@ $(SOURCES ) symmetric-shake.c
80
82
81
- dilithium4_avx2 .so : $(SOURCES ) $(HEADERS ) symmetric-shake.c
83
+ libpqcrystals_dilithium4_avx2 .so : $(SOURCES ) $(HEADERS ) symmetric-shake.c
82
84
$(CC ) -shared -fPIC $(CFLAGS ) -DDILITHIUM_MODE=4 \
83
85
-o $@ $(SOURCES ) symmetric-shake.c
84
86
85
- dilithium2aes_avx2 .so : $(SOURCES ) $(HEADERS )
87
+ libpqcrystals_dilithium2aes_avx2 .so : $(SOURCES ) $(HEADERS )
86
88
$(CC ) -shared -fPIC $(CFLAGS ) -DDILITHIUM_MODE=2 -DDILITHIUM_USE_AES \
87
89
-o $@ $(SOURCES )
88
90
89
- dilithium3aes_avx2 .so : $(SOURCES ) $(HEADERS )
91
+ libpqcrystals_dilithium3aes_avx2 .so : $(SOURCES ) $(HEADERS )
90
92
$(CC ) -shared -fPIC $(CFLAGS ) -DDILITHIUM_MODE=3 -DDILITHIUM_USE_AES \
91
93
-o $@ $(SOURCES )
92
94
93
- dilithium4aes_avx2 .so : $(SOURCES ) $(HEADERS )
95
+ libpqcrystals_dilithium4aes_avx2 .so : $(SOURCES ) $(HEADERS )
94
96
$(CC ) -shared -fPIC $(CFLAGS ) -DDILITHIUM_MODE=4 -DDILITHIUM_USE_AES \
95
97
-o $@ $(SOURCES )
96
98
97
99
test/test_dilithium2 : test/test_dilithium.c randombytes.c $(KECCAK_SOURCES ) \
98
- randombytes.h $(KECCAK_HEADERS)
100
+ $(KECCAK_HEADERS)
99
101
$(CC) $(CFLAGS) -DDILITHIUM_MODE=2 \
100
102
-o $@ $< randombytes.c $(KECCAK_SOURCES)
101
103
102
104
test/test_dilithium3 : test/test_dilithium.c randombytes.c $(KECCAK_SOURCES ) \
103
- randombytes.h $(KECCAK_HEADERS)
105
+ $(KECCAK_HEADERS)
104
106
$(CC) $(CFLAGS) -DDILITHIUM_MODE=3 \
105
107
-o $@ $< randombytes.c $(KECCAK_SOURCES)
106
108
107
109
test/test_dilithium4 : test/test_dilithium.c randombytes.c $(KECCAK_SOURCES ) \
108
- randombytes.h $(KECCAK_HEADERS)
110
+ $(KECCAK_HEADERS)
109
111
$(CC) $(CFLAGS) -DDILITHIUM_MODE=4 \
110
112
-o $@ $< randombytes.c $(KECCAK_SOURCES)
111
113
112
114
test/test_dilithium2aes : test/test_dilithium.c randombytes.c $(AES_SOURCES ) \
113
- randombytes.h $(AES_HEADERS)
115
+ $(AES_HEADERS)
114
116
$(CC) $(CFLAGS) -DDILITHIUM_MODE=2 -DDILITHIUM_USE_AES \
115
117
-o $@ $< randombytes.c $(AES_SOURCES)
116
118
117
119
test/test_dilithium3aes : test/test_dilithium.c randombytes.c $(AES_SOURCES ) \
118
- randombytes.h $(AES_HEADERS)
120
+ $(AES_HEADERS)
119
121
$(CC) $(CFLAGS) -DDILITHIUM_MODE=3 -DDILITHIUM_USE_AES \
120
122
-o $@ $< randombytes.c $(AES_SOURCES)
121
123
122
124
test/test_dilithium4aes : test/test_dilithium.c randombytes.c $(AES_SOURCES ) \
123
- randombytes.h $(AES_HEADERS)
125
+ $(AES_HEADERS)
124
126
$(CC) $(CFLAGS) -DDILITHIUM_MODE=4 -DDILITHIUM_USE_AES \
125
127
-o $@ $< randombytes.c $(AES_SOURCES)
126
128
127
- test/test_vectors2 : test/test_vectors.c rng.c $(KECCAK_SOURCES ) \
128
- rng.h $(KECCAK_HEADERS)
129
+ test/test_vectors2 : test/test_vectors.c rng.c rng.h $(KECCAK_SOURCES ) \
130
+ $(KECCAK_HEADERS)
129
131
$(CC) $(NISTFLAGS) -DDILITHIUM_MODE=2 \
130
132
-o $@ $< rng.c $(KECCAK_SOURCES) -lcrypto
131
133
132
- test/test_vectors3 : test/test_vectors.c rng.c $(KECCAK_SOURCES ) \
133
- rng.h $(KECCAK_HEADERS)
134
+ test/test_vectors3 : test/test_vectors.c rng.c rng.h $(KECCAK_SOURCES ) \
135
+ $(KECCAK_HEADERS)
134
136
$(CC) $(NISTFLAGS) -DDILITHIUM_MODE=3 \
135
137
-o $@ $< rng.c $(KECCAK_SOURCES) -lcrypto
136
138
137
- test/test_vectors4 : test/test_vectors.c rng.c $(KECCAK_SOURCES ) \
138
- rng.h $(KECCAK_HEADERS)
139
+ test/test_vectors4 : test/test_vectors.c rng.c rng.h $(KECCAK_SOURCES ) \
140
+ $(KECCAK_HEADERS)
139
141
$(CC) $(NISTFLAGS) -DDILITHIUM_MODE=4 \
140
142
-o $@ $< rng.c $(KECCAK_SOURCES) -lcrypto
141
143
142
- test/test_vectors2aes : test/test_vectors.c rng.c $(AES_SOURCES ) \
143
- rng.h $(AES_HEADERS)
144
+ test/test_vectors2aes : test/test_vectors.c rng.c rng.h $(AES_SOURCES ) \
145
+ $(AES_HEADERS)
144
146
$(CC) $(NISTFLAGS) -DDILITHIUM_MODE=2 -DDILITHIUM_USE_AES \
145
147
-o $@ $< rng.c $(AES_SOURCES) -lcrypto
146
148
147
- test/test_vectors3aes : test/test_vectors.c rng.c $(AES_SOURCES ) \
148
- rng.h $(AES_HEADERS)
149
+ test/test_vectors3aes : test/test_vectors.c rng.c rng.h $(AES_SOURCES ) \
150
+ $(AES_HEADERS)
149
151
$(CC) $(NISTFLAGS) -DDILITHIUM_MODE=3 -DDILITHIUM_USE_AES \
150
152
-o $@ $< rng.c $(AES_SOURCES) -lcrypto
151
153
152
- test/test_vectors4aes : test/test_vectors.c rng.c $(AES_SOURCES ) \
153
- rng.h $(AES_HEADERS)
154
+ test/test_vectors4aes : test/test_vectors.c rng.c rng.h $(AES_SOURCES ) \
155
+ $(AES_HEADERS)
154
156
$(CC) $(NISTFLAGS) -DDILITHIUM_MODE=4 -DDILITHIUM_USE_AES \
155
157
-o $@ $< rng.c $(AES_SOURCES) -lcrypto
156
158
157
- test/test_speed2 : test/test_speed.c test/speed_print.c test/cpucycles.c \
158
- randombytes.c $(KECCAK_SOURCES) \
159
- test/speed_print.h test/cpucycles.h randombytes.h $(KECCAK_HEADERS)
159
+ test/test_speed2 : test/test_speed.c test/speed_print.c test/speed_print.h \
160
+ test/cpucycles.c test/cpucycles.h randombytes.c $(KECCAK_SOURCES) \
161
+ $(KECCAK_HEADERS)
160
162
$(CC) $(CFLAGS) -DDILITHIUM_MODE=2 \
161
163
-o $@ $< test/speed_print.c test/cpucycles.c randombytes.c \
162
164
$(KECCAK_SOURCES)
163
165
164
- test/test_speed3 : test/test_speed.c test/speed_print.c test/cpucycles.c \
165
- randombytes.c $(KECCAK_SOURCES) \
166
- test/speed_print.h test/cpucycles.h randombytes.h $(KECCAK_HEADERS)
166
+ test/test_speed3 : test/test_speed.c test/speed_print.c test/speed_print.h \
167
+ test/cpucycles.c test/cpucycles.h randombytes.c $(KECCAK_SOURCES) \
168
+ $(KECCAK_HEADERS)
167
169
$(CC) $(CFLAGS) -DDILITHIUM_MODE=3 \
168
170
-o $@ $< test/speed_print.c test/cpucycles.c randombytes.c \
169
171
$(KECCAK_SOURCES)
170
172
171
- test/test_speed4 : test/test_speed.c test/speed_print.c test/cpucycles.c \
172
- randombytes.c $(KECCAK_SOURCES) \
173
- test/speed_print.h test/cpucycles.h randombytes.h $(KECCAK_HEADERS)
173
+ test/test_speed4 : test/test_speed.c test/speed_print.c test/speed_print.h \
174
+ test/cpucycles.c test/cpucycles.h randombytes.c $(KECCAK_SOURCES) \
175
+ $(KECCAK_HEADERS)
174
176
$(CC) $(CFLAGS) -DDILITHIUM_MODE=4 \
175
177
-o $@ $< test/speed_print.c test/cpucycles.c randombytes.c \
176
178
$(KECCAK_SOURCES)
177
179
178
- test/test_speed2aes : test/test_speed.c test/speed_print.c test/cpucycles.c \
179
- randombytes.c $(AES_SOURCES) \
180
- test/speed_print.h test/cpucycles.h randombytes.h $(AES_HEADERS)
180
+ test/test_speed2aes : test/test_speed.c test/speed_print.c test/speed_print.h \
181
+ test/cpucycles.c test/cpucycles.h randombytes.c $(AES_SOURCES) \
182
+ $(AES_HEADERS)
181
183
$(CC) $(CFLAGS) -DDILITHIUM_MODE=2 -DDILITHIUM_USE_AES \
182
184
-o $@ $< test/speed_print.c test/cpucycles.c randombytes.c \
183
185
$(AES_SOURCES)
184
186
185
- test/test_speed3aes : test/test_speed.c test/speed_print.c test/cpucycles.c \
186
- randombytes.c $(AES_SOURCES) \
187
- test/speed_print.h test/cpucycles.h randombytes.h $(AES_HEADERS)
187
+ test/test_speed3aes : test/test_speed.c test/speed_print.c test/speed_print.h \
188
+ test/cpucycles.c test/cpucycles.h randombytes.c $(AES_SOURCES) \
189
+ $(AES_HEADERS)
188
190
$(CC) $(CFLAGS) -DDILITHIUM_MODE=3 -DDILITHIUM_USE_AES \
189
191
-o $@ $< test/speed_print.c test/cpucycles.c randombytes.c \
190
192
$(AES_SOURCES)
191
193
192
- test/test_speed4aes : test/test_speed.c test/speed_print.c test/cpucycles.c \
193
- randombytes.c $(AES_SOURCES) \
194
- test/speed_print.h test/cpucycles.h randombytes.h $(AES_HEADERS)
194
+ test/test_speed4aes : test/test_speed.c test/speed_print.c test/speed_print.h \
195
+ test/cpucycles.c test/cpucycles.h randombytes.c $(AES_SOURCES) \
196
+ $(AES_HEADERS)
195
197
$(CC) $(CFLAGS) -DDILITHIUM_MODE=4 -DDILITHIUM_USE_AES \
196
198
-o $@ $< test/speed_print.c test/cpucycles.c randombytes.c \
197
199
$(AES_SOURCES)
198
200
199
201
test/test_mul : test/test_mul.c randombytes.c $(KECCAK_SOURCES ) \
200
- randombytes.h $(KECCAK_HEADERS)
202
+ $(KECCAK_HEADERS)
201
203
$(CC) $(CFLAGS) -UDBENCH -o $@ $< randombytes.c $(KECCAK_SOURCES)
202
204
203
- PQCgenKAT_sign2 : PQCgenKAT_sign.c rng.c $(KECCAK_SOURCES ) \
204
- rng.h $(KECCAK_HEADERS)
205
+ PQCgenKAT_sign2 : PQCgenKAT_sign.c rng.c rng.h $(KECCAK_SOURCES ) \
206
+ $(KECCAK_HEADERS)
205
207
$(CC) $(NISTFLAGS) -DDILITHIUM_MODE=2 \
206
208
-o $@ $< rng.c $(KECCAK_SOURCES) -lcrypto
207
209
208
- PQCgenKAT_sign3 : PQCgenKAT_sign.c rng.c $(KECCAK_SOURCES ) \
209
- rng.h $(KECCAK_HEADERS)
210
+ PQCgenKAT_sign3 : PQCgenKAT_sign.c rng.c rng.h $(KECCAK_SOURCES ) \
211
+ $(KECCAK_HEADERS)
210
212
$(CC) $(NISTFLAGS) -DDILITHIUM_MODE=3 \
211
213
-o $@ $< rng.c $(KECCAK_SOURCES) -lcrypto
212
214
213
- PQCgenKAT_sign4 : PQCgenKAT_sign.c rng.c $(KECCAK_SOURCES ) \
214
- rng.h $(KECCAK_HEADERS)
215
+ PQCgenKAT_sign4 : PQCgenKAT_sign.c rng.c rng.h $(KECCAK_SOURCES ) \
216
+ $(KECCAK_HEADERS)
215
217
$(CC) $(NISTFLAGS) -DDILITHIUM_MODE=4 \
216
218
-o $@ $< rng.c $(KECCAK_SOURCES) -lcrypto
217
219
218
- PQCgenKAT_sign2aes : PQCgenKAT_sign.c rng.c $(AES_SOURCES ) \
219
- rng.h $(AES_HEADERS)
220
+ PQCgenKAT_sign2aes : PQCgenKAT_sign.c rng.c rng.h $(AES_SOURCES ) $(AES_HEADERS )
220
221
$(CC ) $(NISTFLAGS ) -DDILITHIUM_MODE=2 -DDILITHIUM_USE_AES \
221
222
-o $@ $< rng.c $(AES_SOURCES ) -lcrypto
222
223
223
- PQCgenKAT_sign3aes : PQCgenKAT_sign.c rng.c $(AES_SOURCES ) \
224
- rng.h $(AES_HEADERS)
224
+ PQCgenKAT_sign3aes : PQCgenKAT_sign.c rng.c rng.h $(AES_SOURCES ) $(AES_HEADERS )
225
225
$(CC ) $(NISTFLAGS ) -DDILITHIUM_MODE=3 -DDILITHIUM_USE_AES \
226
226
-o $@ $< rng.c $(AES_SOURCES ) -lcrypto
227
227
228
- PQCgenKAT_sign4aes : PQCgenKAT_sign.c rng.c $(AES_SOURCES ) \
229
- rng.h $(AES_HEADERS)
228
+ PQCgenKAT_sign4aes : PQCgenKAT_sign.c rng.c rng.h $(AES_SOURCES ) $(AES_HEADERS )
230
229
$(CC ) $(NISTFLAGS ) -DDILITHIUM_MODE=4 -DDILITHIUM_USE_AES \
231
230
-o $@ $< rng.c $(AES_SOURCES ) -lcrypto
232
231
233
232
clean :
234
- rm -f * ~ test/* ~
235
- rm -f dilithium2_avx2.so
236
- rm -f dilithium3_avx2.so
237
- rm -f dilithium4_avx2.so
238
- rm -f dilithium2aes_avx2.so
239
- rm -f dilithium3aes_avx2.so
240
- rm -f dilithium4aes_avx2.so
233
+ rm -f * .o * .a * .so
241
234
rm -f keccak4x/KeccakP-1600-times4-SIMD256.o
242
- rm -f pqcrystals_ref.so
243
- rm -f pqcrystals_avx2.so
244
- rm -f pqcrystals_avx2_aes256ctr.so
245
235
rm -f test/test_dilithium2
246
236
rm -f test/test_dilithium3
247
237
rm -f test/test_dilithium4
0 commit comments