blob: 9604b0568768841c3e4aa3451029238a9d541e9b [file] [log] [blame]
Gilles Peskinef040a172017-05-05 18:56:12 +02001OPENSSL = openssl
2
3cli_crt_key_file_rsa = cli-rsa.key
4cli_crt_extensions_file = cli.opensslconf
5test_ca_key_file_rsa = test-ca.key
6test_ca_pwd_rsa = PolarSSLTest
7test_ca_config_file = test-ca.opensslconf
8
9default: all_final
10
11all_intermediate := # temporary files
12all_final := # files used by tests
13
14test-ca.csr: $(test_ca_key_file_rsa) $(test_ca_config_file)
15 $(OPENSSL) req -new -config $(test_ca_config_file) -key $(test_ca_key_file_rsa) -passin "pass:$(test_ca_pwd_rsa)" -subj "/C=NL/O=PolarSSL/CN=PolarSSL Test CA" -out $@
16all_intermediate += test-ca.csr
17test-ca-sha1.crt: $(test_ca_key_file_rsa) $(test_ca_config_file) test-ca.csr
18 $(OPENSSL) req -x509 -config $(test_ca_config_file) -key $(test_ca_key_file_rsa) -passin "pass:$(test_ca_pwd_rsa)" -set_serial 0 -days 3653 -sha1 -in test-ca.csr -out $@
19all_final += test-ca-sha1.crt
20test-ca-sha256.crt: $(test_ca_key_file_rsa) $(test_ca_config_file) test-ca.csr
21 $(OPENSSL) req -x509 -config $(test_ca_config_file) -key $(test_ca_key_file_rsa) -passin "pass:$(test_ca_pwd_rsa)" -set_serial 0 -days 3653 -sha256 -in test-ca.csr -out $@
22all_final += test-ca-sha256.crt
23
24cli-rsa.csr: $(cli_crt_key_file_rsa)
25 $(OPENSSL) req -new -key $(cli_crt_key_file_rsa) -passin "pass:$(test_ca_pwd_rsa)" -subj "/C=NL/O=PolarSSL/CN=PolarSSL Client 2" -out $@
26all_intermediate += cli-rsa.csr
27cli-rsa-sha1.crt: $(cli_crt_key_file_rsa) test-ca-sha1.crt cli-rsa.csr
28 $(OPENSSL) x509 -req -extfile $(cli_crt_extensions_file) -extensions cli-rsa -CA test-ca-sha1.crt -CAkey $(test_ca_key_file_rsa) -passin "pass:$(test_ca_pwd_rsa)" -set_serial 4 -days 3653 -sha1 -in cli-rsa.csr -out $@
29all_final += cli-rsa-sha1.crt
30cli-rsa-sha256.crt: $(cli_crt_key_file_rsa) test-ca-sha256.crt cli-rsa.csr
31 $(OPENSSL) x509 -req -extfile $(cli_crt_extensions_file) -extensions cli-rsa -CA test-ca-sha256.crt -CAkey $(test_ca_key_file_rsa) -passin "pass:$(test_ca_pwd_rsa)" -set_serial 4 -days 3653 -sha256 -in cli-rsa.csr -out $@
32all_final += cli-rsa-sha256.crt
33
Gilles Peskinebc70a182017-05-09 15:59:24 +020034server2-rsa.csr: server2.key
35 $(OPENSSL) req -new -key server2.key -passin "pass:$(test_ca_pwd_rsa)" -subj "/C=NL/O=PolarSSL/CN=localhost" -out $@
36all_intermediate += server2-rsa.csr
37server2-sha256.crt: server2-rsa.csr
38 $(OPENSSL) x509 -req -extfile $(cli_crt_extensions_file) -extensions cli-rsa -CA test-ca-sha256.crt -CAkey $(test_ca_key_file_rsa) -passin "pass:$(test_ca_pwd_rsa)" -set_serial 4 -days 3653 -sha256 -in server2-rsa.csr -out $@
39all_final += server2-sha256.crt
40
41
Gilles Peskinef040a172017-05-05 18:56:12 +020042all_final: $(all_final)
43all: $(all_intermediate) $(all_final)
44
45# These files should not be committed to the repository.
46list_intermediate:
47 @printf '%s\n' $(all_intermediate) | sort
48# These files should be committed to the repository so that the test data is
49# available upon checkout without running a randomized process depending on
50# third-party tools.
51list_final:
52 @printf '%s\n' $(all_final) | sort
53
54clean:
55 rm -f $(all_intermediate)
56neat: clean
57 rm -f $(all_final)