/
Makefile
211 lines (171 loc) · 9.22 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
CC = /usr/bin/cc
CFLAGS += -Wall -Wextra -Wpedantic -Wmissing-prototypes -Wredundant-decls \
-Wshadow -Wpointer-arith -march=native -mtune=native -O3 \
-fomit-frame-pointer -flto
#CFLAGS += -DUSE_RDPMC
NISTFLAGS = -Wno-unused-result -O3 -march=native -mtune=native
RM = /bin/rm
SOURCES = kem.c indcpa.c polyvec.c poly.c fq.S shuffle.S ntt.S invntt.S \
basemul.S consts.c rejsample.c cbd.c verify.c
SOURCESKECCAK = $(SOURCES) fips202.c fips202x4.c symmetric-shake.c \
keccak4x/KeccakP-1600-times4-SIMD256.o
SOURCESNINETIES = $(SOURCES) aes256ctr.c
HEADERS = params.h api.h indcpa.h polyvec.h poly.h reduce.h fq.inc shuffle.inc \
ntt.h consts.h rejsample.h cbd.h verify.h symmetric.h randombytes.h
HEADERSKECCAK = $(HEADERS) fips202.h fips202x4.h
HEADERSNINETIES = $(HEADERS) aes256ctr.h
.PHONY: all shared clean
all: \
test_kyber512 \
test_kyber768 \
test_kyber1024 \
test_kex512 \
test_kex768 \
test_kex1024 \
test_vectors512 \
test_vectors768 \
test_vectors1024 \
test_speed512 \
test_speed768 \
test_speed1024 \
test_kyber512-90s \
test_kyber768-90s \
test_kyber1024-90s \
test_kex512-90s \
test_kex768-90s \
test_kex1024-90s \
test_vectors512-90s \
test_vectors768-90s \
test_vectors1024-90s \
test_speed512-90s \
test_speed768-90s \
test_speed1024-90s \
PQCgenKAT_kem
shared: \
kyber512_avx2.so \
kyber768_avx2.so \
kyber1024_avx2.so \
kyber512-90s_avx2.so \
kyber768-90s_avx2.so \
kyber1024-90s_avx2.so \
pqcrystals_ref.so \
pqcrystals_avx2.so \
pqcrystals_avx2_aes256ctr.so
keccak4x/KeccakP-1600-times4-SIMD256.o: \
keccak4x/KeccakP-1600-times4-SIMD256.c \
keccak4x/KeccakP-1600-times4-SnP.h \
keccak4x/KeccakP-1600-unrolling.macros \
keccak4x/SIMD256-config.h \
keccak4x/align.h \
keccak4x/brg_endian.h
$(CC) $(CFLAGS) -c $< -o $@
pqcrystals_ref.so: fips202.c fips202.h
$(CC) -shared -fPIC $(CFLAGS) -o $@ $<
pqcrystals_avx2.so: fips202x4.c fips202x4.h \
keccak4x/KeccakP-1600-times4-SIMD256.o
$(CC) -shared -fPIC $(CFLAGS) -o $@ $< \
keccak4x/KeccakP-1600-times4-SIMD256.o
pqcrystals_avx2_aes256ctr.so: aes256ctr.c aes256ctr.h
$(CC) -shared -fPIC $(CFLAGS) -o $@ $<
kyber512_avx2.so: $(SOURCES) $(HEADERS) symmetric-shake.c
$(CC) -shared -fpic $(CFLAGS) -DKYBER_K=2 $(SOURCES) \
symmetric-shake.c -o kyber512_avx2.so
kyber768_avx2.so: $(SOURCES) $(HEADERS) symmetric-shake.c
$(CC) -shared -fpic $(CFLAGS) -DKYBER_K=3 $(SOURCES) \
symmetric-shake.c -o kyber768_avx2.so
kyber1024_avx2.so: $(SOURCES) $(HEADERS) symmetric-shake.c
$(CC) -shared -fpic $(CFLAGS) -DKYBER_K=4 $(SOURCES) \
symmetric-shake.c -o kyber1024_avx2.so
test_kyber512: $(SOURCESKECCAK) $(HEADERSKECCAK) test_kyber.c randombytes.c
$(CC) $(CFLAGS) -DKYBER_K=2 $(SOURCESKECCAK) randombytes.c test_kyber.c -o test_kyber512
test_kyber768: $(SOURCESKECCAK) $(HEADERSKECCAK) test_kyber.c randombytes.c
$(CC) $(CFLAGS) -DKYBER_K=3 $(SOURCESKECCAK) randombytes.c test_kyber.c -o test_kyber768
test_kyber1024: $(SOURCESKECCAK) $(HEADERSKECCAK) test_kyber.c randombytes.c
$(CC) $(CFLAGS) -DKYBER_K=4 $(SOURCESKECCAK) randombytes.c test_kyber.c -o test_kyber1024
test_kex512: $(SOURCESKECCAK) $(HEADERSKECCAK) test_kex.c randombytes.c kex.c kex.h
$(CC) $(CFLAGS) -DKYBER_K=2 $(SOURCESKECCAK) randombytes.c kex.c test_kex.c -o test_kex512
test_kex768: $(SOURCESKECCAK) $(HEADERSKECCAK) test_kex.c randombytes.c kex.c kex.h
$(CC) $(CFLAGS) -DKYBER_K=3 $(SOURCESKECCAK) randombytes.c kex.c test_kex.c -o test_kex768
test_kex1024: $(SOURCESKECCAK) $(HEADERSKECCAK) test_kex.c randombytes.c kex.c kex.h
$(CC) $(CFLAGS) -DKYBER_K=4 $(SOURCESKECCAK) randombytes.c kex.c test_kex.c -o test_kex1024
test_vectors512: $(SOURCESKECCAK) $(HEADERSKECCAK) test_vectors.c
$(CC) $(CFLAGS) -DKYBER_K=2 $(SOURCESKECCAK) test_vectors.c -o test_vectors512
test_vectors768: $(SOURCESKECCAK) $(HEADERSKECCAK) test_vectors.c
$(CC) $(CFLAGS) -DKYBER_K=3 $(SOURCESKECCAK) test_vectors.c -o test_vectors768
test_vectors1024: $(SOURCESKECCAK) $(HEADERSKECCAK) test_vectors.c
$(CC) $(CFLAGS) -DKYBER_K=4 $(SOURCESKECCAK) test_vectors.c -o test_vectors1024
test_speed512: $(SOURCESKECCAK) $(HEADERSKECCAK) cpucycles.h cpucycles.c speed_print.h speed_print.c test_speed.c randombytes.c kex.c kex.h
$(CC) $(CFLAGS) -DKYBER_K=2 $(SOURCESKECCAK) randombytes.c cpucycles.c speed_print.c kex.c test_speed.c -o test_speed512
test_speed768: $(SOURCESKECCAK) $(HEADERSKECCAK) cpucycles.h cpucycles.c speed_print.h speed_print.c test_speed.c randombytes.c kex.c kex.h
$(CC) $(CFLAGS) -DKYBER_K=3 $(SOURCESKECCAK) randombytes.c cpucycles.c speed_print.c kex.c test_speed.c -o test_speed768
test_speed1024: $(SOURCESKECCAK) $(HEADERSKECCAK) cpucycles.h cpucycles.c speed_print.h speed_print.c test_speed.c randombytes.c kex.c kex.h
$(CC) $(CFLAGS) -DKYBER_K=4 $(SOURCESKECCAK) randombytes.c cpucycles.c speed_print.c kex.c test_speed.c -o test_speed1024
kyber512-90s_avx2.so: $(SOURCES) $(HEADERS)
$(CC) -shared -fpic $(CFLAGS) -DKYBER_K=2 -DKYBER_90S $(SOURCES) -o kyber512-90s_avx2.so
kyber768-90s_avx2.so: $(SOURCES) $(HEADERS)
$(CC) -shared -fpic $(CFLAGS) -DKYBER_K=3 -DKYBER_90S $(SOURCES) -o kyber768-90s_avx2.so
kyber1024-90s_avx2.so: $(SOURCES) $(HEADERS)
$(CC) -shared -fpic $(CFLAGS) -DKYBER_K=4 -DKYBER_90S $(SOURCES) -o kyber1024-90s_avx2.so
test_kyber512-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) test_kyber.c randombytes.c
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=2 $(SOURCESNINETIES) randombytes.c test_kyber.c -o test_kyber512-90s -lcrypto
test_kyber768-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) test_kyber.c randombytes.c
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=3 $(SOURCESNINETIES) randombytes.c test_kyber.c -o test_kyber768-90s -lcrypto
test_kyber1024-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) test_kyber.c randombytes.c
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=4 $(SOURCESNINETIES) randombytes.c test_kyber.c -o test_kyber1024-90s -lcrypto
test_kex512-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) test_kex.c randombytes.c fips202.c fips202.h kex.c kex.h
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=2 $(SOURCESNINETIES) randombytes.c fips202.c kex.c test_kex.c -o test_kex512-90s -lcrypto
test_kex768-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) test_kex.c randombytes.c fips202.c fips202.h kex.c kex.h
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=3 $(SOURCESNINETIES) randombytes.c fips202.c kex.c test_kex.c -o test_kex768-90s -lcrypto
test_kex1024-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) test_kex.c randombytes.c fips202.c fips202.h kex.c kex.h
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=4 $(SOURCESNINETIES) randombytes.c fips202.c kex.c test_kex.c -o test_kex1024-90s -lcrypto
test_vectors512-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) test_vectors.c
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=2 $(SOURCESNINETIES) test_vectors.c -o test_vectors512-90s -lcrypto
test_vectors768-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) test_vectors.c
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=3 $(SOURCESNINETIES) test_vectors.c -o test_vectors768-90s -lcrypto
test_vectors1024-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) test_vectors.c
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=4 $(SOURCESNINETIES) test_vectors.c -o test_vectors1024-90s -lcrypto
test_speed512-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) cpucycles.h cpucycles.c speed_print.h speed_print.c test_speed.c randombytes.c kex.c kex.h fips202.c fips202.h
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=2 $(SOURCESNINETIES) randombytes.c cpucycles.c kex.c fips202.c speed_print.c test_speed.c -o test_speed512-90s -lcrypto
test_speed768-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) cpucycles.h cpucycles.c speed_print.h speed_print.c test_speed.c randombytes.c kex.c kex.h fips202.c fips202.h
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=3 $(SOURCESNINETIES) randombytes.c cpucycles.c kex.c fips202.c speed_print.c test_speed.c -o test_speed768-90s -lcrypto
test_speed1024-90s: $(SOURCESNINETIES) $(HEADERSNINETIES) cpucycles.h cpucycles.c speed_print.h speed_print.c test_speed.c randombytes.c kex.c kex.h fips202.c fips202.h
$(CC) $(CFLAGS) -D KYBER_90S -DKYBER_K=4 $(SOURCESNINETIES) randombytes.c cpucycles.c kex.c fips202.c speed_print.c test_speed.c -o test_speed1024-90s -lcrypto
PQCgenKAT_kem: $(SOURCESKECCAK) $(HEADERSKECCAK) PQCgenKAT_kem.c rng.c rng.h
$(CC) $(NISTFLAGS) -o $@ $(SOURCESKECCAK) -I. rng.c PQCgenKAT_kem.c -lcrypto
clean:
-$(RM) -rf *.o
-$(RM) -rf kyber512_avx2.so
-$(RM) -rf kyber768_avx2.so
-$(RM) -rf kyber1024_avx2.so
-$(RM) -rf test_kyber512
-$(RM) -rf test_kyber768
-$(RM) -rf test_kyber1024
-$(RM) -rf test_kex512
-$(RM) -rf test_kex768
-$(RM) -rf test_kex1024
-$(RM) -rf test_vectors512
-$(RM) -rf test_vectors768
-$(RM) -rf test_vectors1024
-$(RM) -rf test_speed512
-$(RM) -rf test_speed768
-$(RM) -rf test_speed1024
-$(RM) -rf kyber512-90s_avx2.so
-$(RM) -rf kyber768-90s_avx2.so
-$(RM) -rf kyber1024-90s_avx2.so
-$(RM) -rf test_kyber512-90s
-$(RM) -rf test_kyber768-90s
-$(RM) -rf test_kyber1024-90s
-$(RM) -rf test_kex512-90s
-$(RM) -rf test_kex768-90s
-$(RM) -rf test_kex1024-90s
-$(RM) -rf test_vectors512-90s
-$(RM) -rf test_vectors768-90s
-$(RM) -rf test_vectors1024-90s
-$(RM) -rf test_speed512-90s
-$(RM) -rf test_speed768-90s
-$(RM) -rf test_speed1024-90s
-$(RM) -rf PQCgenKAT_kem
-$(RM) -rf pqcrystals_ref.so
-$(RM) -rf pqcrystals_avx2.so
-$(RM) -rf pqcrystals_avx2_aes256ctr.so
-$(RM) -rf keccak4x/KeccakP-1600-times4-SIMD256.o