forked from vincentbernat/ssl-dos
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
35 lines (30 loc) · 1.09 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
CFLAGS=-g -Werror -Wall -ansi -std=c99 -D_POSIX_C_SOURCE=199309
LDFLAGS=
EXEC=server-vs-client.exe brute-shake.exe
CERTS = 256-ecc.pem \
1024-dh.pem 2048-dh.pem \
768-rsa.pem 1024-rsa.pem 2048-rsa.pem 4096-rsa.pem \
768-dsa.pem 1024-dsa.pem 2048-dsa.pem # 4096-dsa.pem
all: $(EXEC) certificates
# Tools
server-vs-client.exe: server-vs-client.o common.o
$(CC) -o $@ $^ $(LDFLAGS) -lssl -lcrypto -lpthread -lrt
brute-shake.exe: brute-shake.o common.o
$(CC) -o $@ $^ $(LDFLAGS) -lcrypto -lpthread
# Certificates
cert_size = $(word 1,$(subst -, ,$@))
cert_type = $(word 2,$(subst -, ,$@))
dsa = $(if $(filter dsa,$(cert_type)),--dsa)
ecc = $(if $(filter ecc,$(cert_type)),--ecc)
certificates: $(CERTS)
%.pem: %-key.pem %-cert.pem %-dh.pem
cat $^ > $@
%-key.pem:
certtool --bits $(cert_size) --generate-privkey $(dsa) $(ecc) --outfile $@
%-cert.pem: %-key.pem
certtool --template certtool.cfg --generate-self-signed $(dsa) --load-privkey $^ --outfile $@
%-dh.pem:
certtool --bits $(cert_size) --generate-dh-params $(dsa) --outfile $@
clean:
rm -f *.pem *.o $(EXEC)
.PHONY: clean certificates all