]> pd.if.org Git - zpackage/blob - Makefile
fix bug with dhe cbc mode
[zpackage] / Makefile
1 CC=clang --target=x86_64-pc-linux-musl
2 CC=/usr/musl/bin/musl-clang
3 #CC=/usr/musl/bin/musl-gcc
4 #CFLAGS=-Wall -W -Wextra -Werror -Wno-implicit-fallthrough -std=c99 -Ilib -Isqlite -Ielf -I. -Ilzma/api --target=x86_64-pc-linux-musl
5 CFLAGS=-Wall -W -Wextra -Werror -Wno-implicit-fallthrough -std=c99 -Ilib -Isqlite -Ielf -I. -Ilzma/api
6
7 ZPMVER:=$(shell git describe --tags --match 'v[0-9]*' | sed -e 's/^v//' | sed -e 's/-g.\+//' | sed -e 's/-/./g')
8
9 LZMAFLAGS=-Ilzma/api -Ilzma/tuklib -Ilzma/lzma -Ilzma/common -Ilzma/check -Ilzma/lz -Ilzma/rangecoder -Ilzma/simple -Ilzma/delta -DHAVE_CHECK_CRC64 -DHAVE_CHECK_CRC32 -DHAVE_ENCODER_LZMA2 -DHAVE_DECODER_LZMA2 -DHAVE_MF_BT4
10
11 LDFLAGS=-fuse-ld=lld -L. -static
12
13 LZMACHECKSRC=lzma/check/check.c lzma/check/crc32_fast.c lzma/check/crc64_fast.c lzma/check/crc32_table.c lzma/check/crc64_table.c
14 LZMASRC=$(shell ls lzma/lzma/*.c lzma/common/*.c lzma/lz/*.c) $(LZMACHECKSRC) lzma/rangecoder/price_table.c
15 LZMAOBJ=$(filter-out lzma/common/stream_encoder_mt.o, $(LZMASRC:%.c=%.o))
16
17 JSWSRC=lib/jsw/jsw_avltree.c \
18 lib/jsw/jsw_atree.c \
19 lib/jsw/jsw_hlib.c \
20 lib/jsw/jsw_rbtree.c
21
22 JSWOBJ=$(JSWSRC:%.c=%.o)
23 LIBZPMSRC=sha256.c db.c compress.c uncompress.c zpm.c zpm_hash.c \
24           foreach_path.c vercmp.c findpkg.c quote.c dbquery.c script_hash.c \
25           parse.c integ.c seterror.c notes.c createpkg.c
26
27 LIBZPMOBJ=$(addprefix lib/, $(LIBZPMSRC:%.c=%.o))
28
29 curdir=$(shell pwd)
30
31 ZPKGBIN=zpm-addfile zpm-extract zpm-init zpm-vercmp zpm-stat zpm-hash \
32         zpm-findpkg zpm-shell zpm-soneed zpm-foreach-path zpm-parse \
33         zpm-script zpm-soname zpm-syncfs zpm-packagehash zpm-verify \
34         zpm-elftype zpm-quote zpm-note zpm-search zpm-add zpm-fetchurl \
35         zpm-sign
36
37 SCRIPTS=zpm zpm-install zpm-merge zpm-list zpm-test zpm-log \
38         zpm-contents zpm-uninstall zpm-pathmod zpm-rmpackage zpm-newpackage \
39         zpm-pkg zpm-pkgfile zpm-gc zpm-repo zpm-update zpm-confgit
40
41 MANPAGES=$(shell ls doc/*.8)
42 #MANPAGES=doc/zpm.8 $(addprefix doc/zpm-, list.8 contents.8 hash.8 quote.8 pathmod.8 note.8 vercmp.8 repo.8 gc.8)
43 COMPILED=$(ZPKGBIN)
44 PROGRAMS=$(SCRIPTS) $(COMPILED)
45
46 def: programs
47         strip $(ZPKGBIN)
48
49 d:
50         printf '%s\n' $(LZMAOBJ)
51         printf '%s\n' $(PATH)
52
53 libzpm.a: $(LIBZPMOBJ) sqlite/sqlite3.o \
54         $(LZMAOBJ) \
55         $(JSWOBJ)
56         ar rcuv $@ $?
57
58 package: zpm-$(ZPMVER)-1.zpm
59
60 lzmaupdate:
61         find xz/src/liblzma -type d -name .deps -prune \
62                 -o -type f -printf '%P\n' \
63                 | xargs -IZ echo Z Z Z \
64                 | xargs printf 'test -e lzma/%s && cp xz/src/liblzma/%s lzma/%s\n' \
65                 | sh
66
67 #lzma/lz/lz_decoder.o: lzma/lz/lz_decoder.c
68 #lzma/lz/lz_encoder.o: lzma/lz/lz_encoder.c
69
70 lzma/%.o: lzma/%.c
71         $(CC) $(CFLAGS) $(LZMAFLAGS) -c -o $@ $<
72
73 lib/liblzma.a: $(LZMAOBJ)
74         ar rcuv $@ $?
75
76 lib/libjsw.a: $(JSWOBJ)
77         ar rcuv $@ $?
78
79 ZPM:= ./zpm -P.
80
81 zpm-$(ZPMVER)-1.zpm: programs $(MANPAGES)
82         rm -f $@
83         $(ZPM) newpackage -C zpm-$(ZPMVER)-1
84         $(ZPM) add -v -u root -g root -f $@ -P /sbin zpm-$(ZPMVER)-1 $(sort $(PROGRAMS))
85         $(ZPM) add -v -u root -g root -f $@ -P /usr/share/man/man8 -S doc $(MANPAGES)
86
87 tarball: zpm-$(ZPMVER)-1.tar.xz
88
89 zpm-$(ZPMVER)-1.tar.xz: programs
90         rm -f $@
91         tar -cJf $@ --transform='s|^|sbin/|' \
92                 $(PROGRAMS)
93
94 lzma.c: mklzma
95         sh mklzma
96
97 lzma.o: lzma.c
98         gcc -std=c99 -Wall -c -o $@ $<
99
100 stest: $(ZPKGBIN)
101         PATH=$(curdir)/t:$(curdir):$(PATH) t/$(T).t
102
103 t/ctap/prove: t/ctap/prove.o
104         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
105
106 test: $(ZPKGBIN) t/ctap/prove
107         @PATH=$(curdir)/t:$(curdir):$(PATH) t/ctap/prove t/*.t
108
109 programs: $(ZPKGBIN)
110
111 uncompress: uncompress.o 
112         $(CC) $(CFLAGS) -o $@ $+ -llzma
113
114 zpm-elftype: elf/elftype.o
115         $(CC) $(CFLAGS) -Ielf $(LDFLAGS) -o $@ $+
116
117 zpm-soname: elf/soname.o
118         $(CC) $(CFLAGS) -Ielf $(LDFLAGS) -o $@ $+
119
120 zpm-soneed: elf/needed.o
121         $(CC) $(CFLAGS) -Ielf $(LDFLAGS) -o $@ $+
122
123 zpm-addfile: src/addfile.o libzpm.a libelf.a
124         $(CC) -Ielf $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
125
126 zpm-hash: src/hash.o libzpm.a
127         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm
128
129 zpm-verify: src/verify.o t/ctap/ctap.o libzpm.a
130         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< t/ctap/ctap.o -lzpm -lelf
131
132 zpm-init: src/init.o libzpm.a
133         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
134
135 zpm-stat: src/stat.o
136         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
137
138 zpm-extract: src/extract.o libzpm.a
139         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
140
141 zpm-script: src/script.o libzpm.a
142         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
143         
144 zpm-packagehash: src/packagehash.o libzpm.a
145         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
146
147 src/foreach-path.o: CFLAGS+=-Wno-unused-parameter
148 src/script.o: CFLAGS+=-Wno-unused-parameter
149
150 zpm-foreach-path: src/foreach-path.o libzpm.a sqlite/sqlite3.h
151         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
152
153 zpm-findpkg: src/findpkg.o libzpm.a
154         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
155
156 zpm-search: src/search.o libzpm.a
157         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
158
159 zpm-note: src/note.o libzpm.a
160         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
161
162 zpm-syncfs: src/syncfs.o libzpm.a libelf.a
163         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf -lm
164
165 zpm-parse: src/parse.o lib/parse.o
166         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
167
168 zpm-add: src/add.o libzpm.a libelf.a
169         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
170
171 zpm-quote: src/quote.o
172         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
173
174 db.sql: schema/main.sql schema/syncconflicts.sql schema/syncinfo.sql schema/preserve_packages.sql schema/age.sql
175         echo 'begin;' > $@
176         cat $+ >> $@
177         echo 'commit;' >> $@
178
179 newdb.c: db.sql
180         echo "char createdb[] = {" > $@
181         xxd -i < $< >> $@
182         echo ", 0};" >> $@
183
184 sqlite/sqlite3.o: sqlite/sqlite3.c sqlite/config.h
185         $(CC) -Wall -std=c99 -Ilib -D_HAVE_SQLITE_CONFIG_H=1 -c -o $@ $<
186
187 sqlite/extensions.o: sqlite/extensions.c
188         $(CC) -O3 -Wall -std=c99 -I. -Isqlite -DSQLITE_CORE=1 -c -o $@ $<
189
190 sqlite/shell.o: sqlite/shell.c sqlite/config.h Makefile
191         $(CC) -Wall -std=c99 -Ilib \
192                 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
193                 '-DSQLITE_SHELL_INIT_PROC(x)=zpm_setup_extensions(x)' \
194                 -D_POSIX_C_SOURCE=200112L -c -o $@ $<
195
196 lib/zpm.o: newdb.c
197
198 zpm-vercmp: src/vercmp.o lib/vercmp.o
199         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
200         
201 zpm-shell: sqlite/sqlite3.o sqlite/shell.o sqlite/extensions.o lib/vercmp.o
202         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
203
204 libelf.a: elf/libelf.o
205         ar rcuv $@ $?
206
207 install: $(COMPILED) $(MANPAGES)
208         test -d $(DESTDIR)/sbin || install -d $(DESTDIR)/sbin
209         install $(PROGRAMS) $(DESTDIR)/sbin
210         mkdir -p $(DESTDIR)/usr/share/man/man8
211         install -m644 $(MANPAGES) $(DESTDIR)/usr/share/man/man8
212
213 scan-prep: clean sqlite/sqlite3.o sqlite/shell.o lib/liblzma.a
214         @echo scan-build -v -o report make -j10
215
216 # crypto/tls items
217 X255OBJ= \
218 base.o \
219 fe_0.o \
220 fe_1.o \
221 fe_add.o \
222 fe_copy.o \
223 fe_cswap.o \
224 fe_frombytes.o \
225 fe_invert.o \
226 fe_mul.o \
227 fe_mul121666.o \
228 fe_sq.o \
229 fe_sub.o \
230 fe_tobytes.o \
231 scalarmult.o
232
233 TLSOBJ= tlse.o x25519.o chacha.o base64.o pem.o forward.o handshake.o \
234         buffer.o parse_client_hello.o parse_message.o cipher_supported.o \
235         packet_update.o hmac_message.o hkdf.o hash.o cipher_name.o
236
237 crypto/x25519.o: $(addprefix crypto/ref10/, $(X255OBJ))
238         ld -o $@ -r $+
239
240 crypto/%.o: CFLAGS+=-Icrypto -DTFM_DESC -DTFM_NO_ASM \
241         -Itomsfastmath/src/headers \
242         -Wno-pointer-sign -Wno-missing-braces -Ilibtomcrypt/src/headers
243
244 #       -DDEBUG
245
246 #       /usr/musl/bin/musl-clang -Wall -Wextra -Wno-missing-braces -Werror -Wno-pointer-sign -I. -DTFM_DESC -DTFM_NO_ASM -I ../libtomcrypt/src/headers -I ../tomsfastmath/src/headers -DSTRICT_TLS -DIGNORE_SESSION_ID --rtlib=compiler-rt   -c -o tlse.o tlse.c
247
248 #/usr/musl/bin/musl-clang -Wall -Wextra -Wno-missing-braces -Werror -Wno-pointer-sign -I. -DTFM_DESC -DTFM_NO_ASM -I ../libtomcrypt/src/headers -I ../tomsfastmath/src/headers -DSTRICT_TLS -DIGNORE_SESSION_ID --rtlib=compiler-rt   -c -o tlse.o tlse.c
249
250 tls.o: $(addprefix crypto/, $(TLSOBJ))
251         ld -o $@ -r $+
252
253 TFMOBJ= \
254    addsub/fp_add.o \
255    addsub/fp_add_d.o \
256    addsub/fp_addmod.o \
257    addsub/fp_cmp.o \
258    addsub/fp_cmp_d.o \
259    addsub/fp_cmp_mag.o \
260    addsub/fp_sub.o \
261    addsub/fp_sub_d.o \
262    addsub/fp_submod.o \
263    addsub/s_fp_add.o \
264    addsub/s_fp_sub.o \
265    bin/fp_radix_size.o \
266    bin/fp_read_radix.o \
267    bin/fp_read_signed_bin.o \
268    bin/fp_reverse.o \
269    bin/fp_read_unsigned_bin.o \
270    bin/fp_signed_bin_size.o \
271    bin/fp_s_rmap.o \
272    bin/fp_toradix.o \
273    bin/fp_toradix_n.o \
274    bin/fp_to_signed_bin.o \
275    bin/fp_to_unsigned_bin.o \
276    bin/fp_unsigned_bin_size.o \
277    bit/fp_cnt_lsb.o \
278    bit/fp_count_bits.o \
279    bit/fp_div_2.o \
280    bit/fp_div_2d.o \
281    bit/fp_lshd.o \
282    bit/fp_mod_2d.o \
283    bit/fp_rshd.o \
284    divide/fp_div.o \
285    divide/fp_div_d.o \
286    divide/fp_mod.o \
287    divide/fp_mod_d.o \
288    exptmod/fp_2expt.o \
289    exptmod/fp_exptmod.o \
290    misc/fp_ident.o \
291    misc/fp_rand.o \
292    misc/fp_set.o \
293    mont/fp_montgomery_calc_normalization.o \
294    mont/fp_montgomery_reduce.o \
295    mont/fp_montgomery_setup.o \
296    mul/fp_mul_2.o \
297    mul/fp_mul_2d.o \
298    mul/fp_mul.o \
299    mul/fp_mul_comba_12.o \
300    mul/fp_mul_comba_17.o \
301    mul/fp_mul_comba_20.o \
302    mul/fp_mul_comba_24.o \
303    mul/fp_mul_comba_28.o \
304    mul/fp_mul_comba_32.o \
305    mul/fp_mul_comba_3.o \
306    mul/fp_mul_comba_48.o \
307    mul/fp_mul_comba_4.o \
308    mul/fp_mul_comba_64.o \
309    mul/fp_mul_comba_6.o \
310    mul/fp_mul_comba_7.o \
311    mul/fp_mul_comba_8.o \
312    mul/fp_mul_comba.o \
313    mul/fp_mul_comba_small_set.o \
314    mul/fp_mul_d.o \
315    mul/fp_mul_comba_9.o \
316    mul/fp_mulmod.o \
317    numtheory/fp_gcd.o \
318    numtheory/fp_invmod.o \
319    numtheory/fp_isprime.o \
320    numtheory/fp_isprime_ex.o \
321    numtheory/fp_lcm.o \
322    numtheory/fp_prime_miller_rabin.o \
323    numtheory/fp_prime_random_ex.o \
324    sqr/fp_sqr.o \
325    sqr/fp_sqr_comba_12.o \
326    sqr/fp_sqr_comba_17.o \
327    sqr/fp_sqr_comba_20.o \
328    sqr/fp_sqr_comba_24.o \
329    sqr/fp_sqr_comba_28.o \
330    sqr/fp_sqr_comba_32.o \
331    sqr/fp_sqr_comba_48.o \
332    sqr/fp_sqr_comba_3.o \
333    sqr/fp_sqr_comba_4.o \
334    sqr/fp_sqr_comba_64.o \
335    sqr/fp_sqr_comba_6.o \
336    sqr/fp_sqr_comba_7.o \
337    sqr/fp_sqr_comba_8.o \
338    sqr/fp_sqr_comba_9.o \
339    sqr/fp_sqr_comba.o \
340    sqr/fp_sqr_comba_generic.o \
341    sqr/fp_sqr_comba_small_set.o \
342    sqr/fp_sqrmod.o
343
344 tomsfastmath/src/addsub/%.o: CFLAGS+=-DTFM_DESC -DTFM_NO_ASM -Itomsfastmath/src/headers -DARGTYPE=4
345 tomsfastmath/src/%.o: CFLAGS+=-DTFM_DESC -DTFM_NO_ASM -Itomsfastmath/src/headers -DARGTYPE=4
346
347 tfm.o: $(addprefix tomsfastmath/src/, $(TFMOBJ))
348         ld -o $@ -r $+
349
350 LTCOBJ= \
351    ciphers/aes/aes.o \
352    ciphers/anubis.o \
353    ciphers/blowfish.o \
354    ciphers/camellia.o \
355    ciphers/cast5.o \
356    ciphers/des.o \
357    ciphers/kasumi.o \
358    ciphers/khazad.o \
359    ciphers/kseed.o \
360    ciphers/multi2.o \
361    ciphers/noekeon.o \
362    ciphers/rc2.o \
363    ciphers/rc5.o \
364    ciphers/rc6.o \
365    ciphers/safer/safer.o \
366    ciphers/safer/saferp.o \
367    ciphers/skipjack.o \
368    ciphers/twofish/twofish.o \
369    ciphers/xtea.o \
370    encauth/ccm/ccm_add_aad.o \
371    encauth/ccm/ccm_add_nonce.o \
372    encauth/ccm/ccm_done.o \
373    encauth/ccm/ccm_init.o \
374    encauth/ccm/ccm_memory.o \
375    encauth/ccm/ccm_process.o \
376    encauth/ccm/ccm_reset.o \
377    encauth/ccm/ccm_test.o \
378    encauth/chachapoly/chacha20poly1305_add_aad.o \
379    encauth/chachapoly/chacha20poly1305_decrypt.o \
380    encauth/chachapoly/chacha20poly1305_done.o \
381    encauth/chachapoly/chacha20poly1305_encrypt.o \
382    encauth/chachapoly/chacha20poly1305_init.o \
383    encauth/chachapoly/chacha20poly1305_memory.o \
384    encauth/chachapoly/chacha20poly1305_setiv.o \
385    encauth/chachapoly/chacha20poly1305_setiv_rfc7905.o \
386    encauth/chachapoly/chacha20poly1305_test.o \
387    encauth/eax/eax_addheader.o \
388    encauth/eax/eax_decrypt.o \
389    encauth/eax/eax_decrypt_verify_memory.o \
390    encauth/eax/eax_done.o \
391    encauth/eax/eax_encrypt.o \
392    encauth/eax/eax_encrypt_authenticate_memory.o \
393    encauth/eax/eax_init.o \
394    encauth/eax/eax_test.o \
395    encauth/gcm/gcm_add_aad.o \
396    encauth/gcm/gcm_add_iv.o \
397    encauth/gcm/gcm_done.o \
398    encauth/gcm/gcm_gf_mult.o \
399    encauth/gcm/gcm_init.o \
400    encauth/gcm/gcm_memory.o \
401    encauth/gcm/gcm_mult_h.o \
402    encauth/gcm/gcm_process.o \
403    encauth/gcm/gcm_reset.o \
404    encauth/gcm/gcm_test.o \
405    misc/crypt/crypt_find_cipher_id.o \
406    misc/crypt/crypt_find_hash_any.o \
407    misc/crypt/crypt_find_hash.o \
408    encauth/ocb/ocb_decrypt.o \
409    encauth/ocb/ocb_decrypt_verify_memory.o \
410    encauth/ocb/ocb_done_decrypt.o \
411    encauth/ocb/ocb_done_encrypt.o \
412    misc/crypt/crypt_find_hash_id.o \
413    misc/crypt/crypt_find_hash_oid.o \
414    encauth/ocb/ocb_encrypt.o \
415    encauth/ocb/ocb_encrypt_authenticate_memory.o \
416    encauth/ocb/ocb_init.o \
417    encauth/ocb/ocb_ntz.o \
418    encauth/ocb/ocb_shift_xor.o \
419    encauth/ocb/ocb_test.o \
420    encauth/ocb/s_ocb_done.o \
421    encauth/ocb3/ocb3_add_aad.o \
422    encauth/ocb3/ocb3_decrypt.o \
423    encauth/ocb3/ocb3_decrypt_last.o \
424    encauth/ocb3/ocb3_decrypt_verify_memory.o \
425    encauth/ocb3/ocb3_done.o \
426    encauth/ocb3/ocb3_encrypt.o \
427    encauth/ocb3/ocb3_encrypt_authenticate_memory.o \
428    encauth/ocb3/ocb3_encrypt_last.o \
429    encauth/ocb3/ocb3_init.o \
430    encauth/ocb3/ocb3_int_ntz.o \
431    encauth/ocb3/ocb3_int_xor_blocks.o \
432    encauth/ocb3/ocb3_test.o \
433    hashes/blake2b.o \
434    hashes/blake2s.o \
435    hashes/chc/chc.o \
436    hashes/helper/hash_file.o \
437    hashes/helper/hash_filehandle.o \
438    hashes/helper/hash_memory.o \
439    hashes/helper/hash_memory_multi.o \
440    hashes/md2.o \
441    hashes/md4.o \
442    hashes/md5.o \
443    hashes/rmd128.o \
444    hashes/rmd160.o \
445    hashes/rmd256.o \
446    hashes/rmd320.o \
447    hashes/sha1.o \
448    hashes/sha2/sha224.o \
449    hashes/sha2/sha256.o \
450    hashes/sha2/sha384.o \
451    hashes/sha2/sha512.o \
452    hashes/sha2/sha512_224.o \
453    hashes/sha2/sha512_256.o \
454    hashes/sha3.o \
455    hashes/sha3_test.o \
456    hashes/tiger.o \
457    hashes/whirl/whirl.o \
458    mac/blake2/blake2bmac.o \
459    mac/blake2/blake2bmac_file.o \
460    mac/blake2/blake2bmac_memory.o \
461    mac/blake2/blake2bmac_memory_multi.o \
462    mac/blake2/blake2bmac_test.o \
463    mac/blake2/blake2smac.o \
464    mac/blake2/blake2smac_file.o \
465    mac/blake2/blake2smac_memory.o \
466    mac/blake2/blake2smac_memory_multi.o \
467    mac/blake2/blake2smac_test.o \
468    mac/f9/f9_done.o \
469    mac/f9/f9_file.o \
470    mac/f9/f9_init.o \
471    mac/f9/f9_memory.o \
472    mac/f9/f9_memory_multi.o \
473    mac/f9/f9_process.o \
474    mac/f9/f9_test.o \
475    mac/hmac/hmac_done.o \
476    mac/hmac/hmac_file.o \
477    mac/hmac/hmac_init.o \
478    mac/hmac/hmac_memory.o \
479    mac/hmac/hmac_memory_multi.o \
480    mac/hmac/hmac_process.o \
481    mac/hmac/hmac_test.o \
482    mac/omac/omac_done.o \
483    mac/omac/omac_file.o \
484    mac/omac/omac_init.o \
485    mac/omac/omac_memory.o \
486    mac/omac/omac_memory_multi.o \
487    mac/omac/omac_process.o \
488    misc/crypt/crypt_find_prng.o \
489    mac/omac/omac_test.o \
490    mac/pelican/pelican.o \
491    mac/pelican/pelican_memory.o \
492    mac/pelican/pelican_test.o \
493    mac/pmac/pmac_done.o \
494    mac/pmac/pmac_file.o \
495    mac/pmac/pmac_init.o \
496    mac/pmac/pmac_memory.o \
497    mac/pmac/pmac_memory_multi.o \
498    mac/pmac/pmac_ntz.o \
499    mac/pmac/pmac_process.o \
500    mac/pmac/pmac_shift_xor.o \
501    mac/pmac/pmac_test.o \
502    mac/poly1305/poly1305.o \
503    mac/poly1305/poly1305_file.o \
504    mac/poly1305/poly1305_memory.o \
505    mac/poly1305/poly1305_memory_multi.o \
506    mac/poly1305/poly1305_test.o \
507    mac/xcbc/xcbc_done.o \
508    mac/xcbc/xcbc_file.o \
509    mac/xcbc/xcbc_init.o \
510    mac/xcbc/xcbc_memory.o \
511    mac/xcbc/xcbc_memory_multi.o \
512    mac/xcbc/xcbc_process.o \
513    mac/xcbc/xcbc_test.o \
514    math/fp/ltc_ecc_fp_mulmod.o \
515    math/gmp_desc.o \
516    math/ltm_desc.o \
517    math/multi.o \
518    math/radix_to_bin.o \
519    math/rand_bn.o \
520    math/rand_prime.o \
521    math/tfm_desc.o \
522    misc/adler32.o \
523    misc/base64/base64_decode.o \
524    misc/base64/base64_encode.o \
525    misc/burn_stack.o \
526    misc/compare_testvector.o \
527    misc/crc32.o \
528    misc/crypt/crypt.o \
529    misc/crypt/crypt_argchk.o \
530    misc/crypt/crypt_cipher_descriptor.o \
531    misc/crypt/crypt_cipher_is_valid.o \
532    misc/crypt/crypt_constants.o \
533    misc/crypt/crypt_find_cipher.o \
534    misc/crypt/crypt_find_cipher_any.o \
535    misc/crypt/crypt_fsa.o \
536    misc/crypt/crypt_hash_descriptor.o \
537    misc/crypt/crypt_hash_is_valid.o \
538    misc/crypt/crypt_inits.o \
539    misc/crypt/crypt_ltc_mp_descriptor.o \
540    misc/crypt/crypt_prng_descriptor.o \
541    misc/crypt/crypt_prng_is_valid.o \
542    misc/crypt/crypt_prng_rng_descriptor.o \
543    misc/crypt/crypt_register_all_ciphers.o \
544    misc/crypt/crypt_register_all_hashes.o \
545    misc/crypt/crypt_register_all_prngs.o \
546    misc/crypt/crypt_register_cipher.o \
547    misc/crypt/crypt_register_hash.o \
548    misc/crypt/crypt_register_prng.o \
549    misc/crypt/crypt_sizes.o \
550    misc/crypt/crypt_unregister_cipher.o \
551    misc/crypt/crypt_unregister_hash.o \
552    misc/crypt/crypt_unregister_prng.o \
553    misc/error_to_string.o \
554    misc/hkdf/hkdf.o \
555    misc/hkdf/hkdf_test.o \
556    misc/mem_neq.o \
557    misc/pk_get_oid.o \
558    misc/pkcs5/pkcs_5_1.o \
559    misc/pkcs5/pkcs_5_2.o \
560    misc/pkcs5/pkcs_5_test.o \
561    misc/zeromem.o \
562    modes/cbc/cbc_decrypt.o \
563    modes/cbc/cbc_done.o \
564    modes/cbc/cbc_encrypt.o \
565    modes/cbc/cbc_getiv.o \
566    modes/cbc/cbc_setiv.o \
567    modes/cbc/cbc_start.o \
568    modes/cfb/cfb_decrypt.o \
569    modes/cfb/cfb_done.o \
570    modes/cfb/cfb_encrypt.o \
571    modes/cfb/cfb_getiv.o \
572    modes/cfb/cfb_setiv.o \
573    modes/cfb/cfb_start.o \
574    modes/ctr/ctr_decrypt.o \
575    modes/ctr/ctr_done.o \
576    modes/ctr/ctr_encrypt.o \
577    modes/ctr/ctr_getiv.o \
578    modes/ctr/ctr_setiv.o \
579    modes/ctr/ctr_start.o \
580    modes/ctr/ctr_test.o \
581    modes/ecb/ecb_decrypt.o \
582    modes/ecb/ecb_done.o \
583    modes/ecb/ecb_encrypt.o \
584    modes/ecb/ecb_start.o \
585    modes/f8/f8_decrypt.o \
586    modes/f8/f8_done.o \
587    modes/f8/f8_encrypt.o \
588    modes/f8/f8_getiv.o \
589    modes/f8/f8_setiv.o \
590    modes/f8/f8_start.o \
591    modes/f8/f8_test_mode.o \
592    modes/lrw/lrw_decrypt.o \
593    modes/lrw/lrw_done.o \
594    modes/lrw/lrw_encrypt.o \
595    modes/lrw/lrw_getiv.o \
596    modes/lrw/lrw_process.o \
597    modes/lrw/lrw_start.o \
598    modes/lrw/lrw_setiv.o \
599    modes/lrw/lrw_test.o \
600    modes/ofb/ofb_decrypt.o \
601    modes/ofb/ofb_done.o \
602    modes/ofb/ofb_encrypt.o \
603    modes/ofb/ofb_getiv.o \
604    modes/ofb/ofb_setiv.o \
605    modes/ofb/ofb_start.o \
606    modes/xts/xts_decrypt.o \
607    modes/xts/xts_done.o \
608    modes/xts/xts_encrypt.o \
609    modes/xts/xts_init.o \
610    modes/xts/xts_mult_x.o \
611    modes/xts/xts_test.o \
612    pk/asn1/der/bit/der_decode_bit_string.o \
613    pk/asn1/der/bit/der_decode_raw_bit_string.o \
614    pk/asn1/der/bit/der_encode_bit_string.o \
615    pk/asn1/der/bit/der_encode_raw_bit_string.o \
616    pk/asn1/der/bit/der_length_bit_string.o \
617    pk/asn1/der/boolean/der_decode_boolean.o \
618    pk/asn1/der/boolean/der_encode_boolean.o \
619    pk/asn1/der/boolean/der_length_boolean.o \
620    pk/asn1/der/choice/der_decode_choice.o \
621    pk/asn1/der/generalizedtime/der_decode_generalizedtime.o \
622    pk/asn1/der/generalizedtime/der_encode_generalizedtime.o \
623    pk/asn1/der/generalizedtime/der_length_generalizedtime.o \
624    pk/asn1/der/ia5/der_decode_ia5_string.o \
625    pk/asn1/der/ia5/der_encode_ia5_string.o \
626    pk/asn1/der/ia5/der_length_ia5_string.o \
627    pk/asn1/der/integer/der_decode_integer.o \
628    pk/asn1/der/integer/der_encode_integer.o \
629    pk/asn1/der/integer/der_length_integer.o \
630    pk/asn1/der/object_identifier/der_decode_object_identifier.o \
631    pk/asn1/der/object_identifier/der_encode_object_identifier.o \
632    pk/asn1/der/object_identifier/der_length_object_identifier.o \
633    pk/asn1/der/octet/der_decode_octet_string.o \
634    pk/asn1/der/octet/der_encode_octet_string.o \
635    pk/asn1/der/octet/der_length_octet_string.o \
636    pk/asn1/der/printable_string/der_decode_printable_string.o \
637    pk/asn1/der/printable_string/der_encode_printable_string.o \
638    pk/asn1/der/printable_string/der_length_printable_string.o \
639    pk/asn1/der/sequence/der_decode_sequence_ex.o \
640    pk/asn1/der/sequence/der_decode_sequence_flexi.o \
641    pk/asn1/der/sequence/der_decode_sequence_multi.o \
642    pk/asn1/der/sequence/der_decode_subject_public_key_info.o \
643    pk/asn1/der/sequence/der_encode_sequence_ex.o \
644    pk/asn1/der/sequence/der_encode_sequence_multi.o \
645    pk/asn1/der/sequence/der_encode_subject_public_key_info.o \
646    pk/asn1/der/sequence/der_length_sequence.o \
647    pk/asn1/der/sequence/der_sequence_free.o \
648    pk/asn1/der/sequence/der_sequence_shrink.o \
649    pk/asn1/der/set/der_encode_set.o \
650    pk/asn1/der/set/der_encode_setof.o \
651    pk/asn1/der/short_integer/der_decode_short_integer.o \
652    pk/asn1/der/short_integer/der_encode_short_integer.o \
653    pk/asn1/der/short_integer/der_length_short_integer.o \
654    pk/asn1/der/teletex_string/der_decode_teletex_string.o \
655    pk/asn1/der/teletex_string/der_length_teletex_string.o \
656    pk/asn1/der/utctime/der_decode_utctime.o \
657    pk/asn1/der/utctime/der_encode_utctime.o \
658    pk/asn1/der/utf8/der_decode_utf8_string.o \
659    pk/asn1/der/utctime/der_length_utctime.o \
660    pk/asn1/der/utf8/der_encode_utf8_string.o \
661    pk/asn1/der/utf8/der_length_utf8_string.o \
662    pk/dh/dh.o \
663    pk/dh/dh_check_pubkey.o \
664    pk/dh/dh_export.o \
665    pk/dh/dh_export_key.o \
666    pk/dh/dh_free.o \
667    pk/dh/dh_generate_key.o \
668    pk/dh/dh_import.o \
669    pk/dh/dh_set.o \
670    pk/dh/dh_set_pg_dhparam.o \
671    pk/dh/dh_shared_secret.o \
672    pk/dsa/dsa_decrypt_key.o \
673    pk/dsa/dsa_encrypt_key.o \
674    pk/dsa/dsa_export.o \
675    pk/dsa/dsa_generate_key.o \
676    pk/dsa/dsa_generate_pqg.o \
677    pk/dsa/dsa_free.o \
678    pk/dsa/dsa_import.o \
679    pk/dsa/dsa_make_key.o \
680    pk/dsa/dsa_set.o \
681    pk/dsa/dsa_set_pqg_dsaparam.o \
682    pk/dsa/dsa_shared_secret.o \
683    pk/dsa/dsa_sign_hash.o \
684    pk/dsa/dsa_verify_hash.o \
685    pk/dsa/dsa_verify_key.o \
686    pk/ecc/ecc.o \
687    pk/ecc/ecc_ansi_x963_export.o \
688    pk/ecc/ecc_ansi_x963_import.o \
689    pk/ecc/ecc_decrypt_key.o \
690    pk/ecc/ecc_encrypt_key.o \
691    pk/ecc/ecc_export.o \
692    pk/ecc/ecc_free.o \
693    pk/ecc/ecc_get_size.o \
694    pk/ecc/ecc_import.o \
695    pk/ecc/ecc_make_key.o \
696    pk/ecc/ecc_shared_secret.o \
697    pk/ecc/ecc_sign_hash.o \
698    pk/ecc/ecc_sizes.o \
699    pk/ecc/ecc_test.o \
700    pk/ecc/ecc_verify_hash.o \
701    pk/ecc/ltc_ecc_map.o \
702    pk/ecc/ltc_ecc_is_valid_idx.o \
703    pk/ecc/ltc_ecc_mul2add.o \
704    pk/ecc/ltc_ecc_mulmod.o \
705    pk/ecc/ltc_ecc_mulmod_timing.o \
706    pk/ecc/ltc_ecc_points.o \
707    pk/ecc/ltc_ecc_projective_add_point.o \
708    pk/ecc/ltc_ecc_projective_dbl_point.o \
709    pk/katja/katja_decrypt_key.o \
710    pk/katja/katja_encrypt_key.o \
711    pk/katja/katja_export.o \
712    pk/katja/katja_exptmod.o \
713    pk/katja/katja_free.o \
714    pk/katja/katja_import.o \
715    pk/katja/katja_make_key.o \
716    pk/pkcs1/pkcs_1_i2osp.o \
717    pk/pkcs1/pkcs_1_mgf1.o \
718    pk/pkcs1/pkcs_1_oaep_decode.o \
719    pk/pkcs1/pkcs_1_oaep_encode.o \
720    pk/pkcs1/pkcs_1_os2ip.o \
721    pk/pkcs1/pkcs_1_pss_decode.o \
722    pk/pkcs1/pkcs_1_pss_encode.o \
723    pk/pkcs1/pkcs_1_v1_5_decode.o \
724    pk/pkcs1/pkcs_1_v1_5_encode.o \
725    pk/rsa/rsa_decrypt_key.o \
726    pk/rsa/rsa_encrypt_key.o \
727    pk/rsa/rsa_export.o \
728    pk/rsa/rsa_exptmod.o \
729    pk/rsa/rsa_free.o \
730    pk/rsa/rsa_get_size.o \
731    pk/rsa/rsa_import.o \
732    pk/rsa/rsa_import_pkcs8.o \
733    pk/rsa/rsa_import_x509.o \
734    pk/rsa/rsa_make_key.o \
735    pk/rsa/rsa_set.o \
736    pk/rsa/rsa_sign_hash.o \
737    pk/rsa/rsa_sign_saltlen_get.o \
738    pk/rsa/rsa_verify_hash.o \
739    prngs/chacha20.o \
740    prngs/fortuna.o \
741    prngs/rc4.o \
742    prngs/rng_get_bytes.o \
743    prngs/rng_make_prng.o \
744    prngs/sober128.o \
745    prngs/sprng.o \
746    prngs/yarrow.o \
747    stream/chacha/chacha_crypt.o \
748    stream/chacha/chacha_done.o \
749    stream/chacha/chacha_ivctr32.o \
750    stream/chacha/chacha_ivctr64.o \
751    stream/chacha/chacha_keystream.o \
752    stream/chacha/chacha_setup.o \
753    stream/chacha/chacha_test.o \
754    stream/rc4/rc4_stream.o \
755    stream/rc4/rc4_test.o \
756    stream/sober128/sober128_stream.o \
757    stream/sober128/sober128_test.o
758
759 libtomcrypt/%.o: CFLAGS+=-DTFM_DESC -Isrc/headers -Itomsfastmath/src/headers -DARGTYPE=4 -DLTC_NO_ASM -DTFM_NO_ASM -Ilibtomcrypt/src/headers -DLTC_SOURCE
760
761 ltc.o: $(addprefix libtomcrypt/src/, $(LTCOBJ))
762         ld -o $@ -r $+
763
764 crypto/rfc3986.c: crypto/rfc3986.re
765         re2c --input custom --tags -o $@ $<
766
767 rfc3986: rfc3986.c
768         $(CC) -Wall -W -Wextra -Werror -o $@ $+
769
770 src/fetchurl.o: CFLAGS+=-DTFM_DESC -Isrc/headers -Itomsfastmath/src/headers -DARGTYPE=4 -DLTC_NO_ASM -DTFM_NO_ASM -Ilibtomcrypt/src/headers -DLTC_SOURCE -Icrypto -Wno-pointer-sign -DDEBUG
771
772 zpm-fetchurl: ltc.o tls.o tfm.o src/fetchurl.o crypto/https.o crypto/rfc3986.o
773         $(CC) $(CFLAGS) -o $@ $+
774
775 testddg: zpm-fetchurl
776         ./zpm-fetchurl duckduckgo.com 443 /
777
778 testgra: zpm-fetchurl
779         ./zpm-fetchurl granicus.if.org 443 /
780
781 SIGNSRC= \
782 crypto/libeddsa/lib/burn.c \
783 crypto/libeddsa/lib/burnstack.c \
784 crypto/libeddsa/lib/ed.c \
785 crypto/libeddsa/lib/ed25519-sha512.c \
786 crypto/libeddsa/lib/fld.c \
787 crypto/libeddsa/lib/sc.c \
788 crypto/libeddsa/lib/sha512.c \
789 crypto/libeddsa/lib/x25519.c \
790 crypto/libeddsa/sign.c
791
792 SIGNOBJ=$(SIGNSRC:.c=.o)
793
794 $(SIGNOBJ): CFLAGS+=-Icrypto/libeddsa/lib
795
796 zpm-sign: $(SIGNOBJ)
797         $(CC) $(CFLAGS) -o $@ $+
798
799 clean:
800         rm -f *.o sqlite/*.o lib/*.o $(LZMAOBJ) liblzma.a \
801                 libelf.a libzpm.a zpm-addfile soname \
802                 *.xz \
803                 local.db \
804                 t/ctap/*.o \
805                 $(ZPKGBIN) \
806                 db.sql \
807                 elf/*.o lib/jsw/*.o \
808                 $(addprefix crypto/ref10/, $(X255OBJ)) \
809                 $(addprefix crypto/, $(TLSOBJ)) \
810                 $(addprefix tomsfastmath/src/, $(TFMOBJ)) \
811                 $(addprefix libtomcrypt/src/, $(LTCOBJ)) \
812                 x25519.o