blob: f51f5f8f36288d5a54779602155ab7b7a70f0414 [file] [log] [blame]
Jaeden Amerodebb2c02018-06-25 17:25:29 +01001###########################################################################
2#
3# Copyright (c) 2018, ARM Limited, All Rights Reserved
4# SPDX-License-Identifier: Apache-2.0
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18###########################################################################
19
20#
21# Use this file to export an Mbed Crypto release tarball as follows, from the
22# top level of the mbedtls repo:
23#
24# 1) make -f scripts/mbed_crypto.make
25#
26
27.PHONY: all clean FORCE
28
29all: mbedcrypto.tar.gz
30
31#
32# Crypto-necessary library files
33#
34LIB_FILES := \
35 aes.c \
36 aesni.c \
37 arc4.c \
38 asn1parse.c \
39 asn1write.c \
40 base64.c \
41 bignum.c \
42 blowfish.c \
43 camellia.c \
44 ccm.c \
45 cipher.c \
46 cipher_wrap.c \
47 cmac.c \
48 ctr_drbg.c \
49 des.c \
50 ecdsa.c \
51 ecp.c \
52 ecp_curves.c \
53 entropy.c \
54 entropy_poll.c \
55 gcm.c \
56 hmac_drbg.c \
57 md.c \
58 md2.c \
59 md4.c \
60 md5.c \
61 md_wrap.c \
62 oid.c \
63 pem.c \
64 pk.c \
65 pk_wrap.c \
66 pkcs12.c \
67 pkcs5.c \
68 pkparse.c \
69 pkwrite.c \
70 platform.c \
71 platform_util.c \
72 psa_crypto.c \
Darryl Greendb2b8db2018-06-15 13:06:04 +010073 psa_crypto_storage.h \
74 psa_crypto_storage.c \
75 psa_crypto_storage_backend.h \
76 psa_crypto_storage_file.c \
Jaeden Amerodebb2c02018-06-25 17:25:29 +010077 ripemd160.c \
78 rsa_internal.c \
79 rsa.c \
80 sha1.c \
81 sha256.c \
82 sha512.c \
83 xtea.c \
84# Don't delete this line.
85
86#
87# Crypto-necessary include files
88#
89INC_FILES := \
90 mbedcrypto/aes.h \
91 mbedcrypto/aesni.h \
92 mbedcrypto/arc4.h \
93 mbedcrypto/asn1.h \
94 mbedcrypto/asn1write.h \
95 mbedcrypto/base64.h \
96 mbedcrypto/bignum.h \
97 mbedcrypto/blowfish.h \
98 mbedcrypto/bn_mul.h \
99 mbedcrypto/camellia.h \
100 mbedcrypto/ccm.h \
101 mbedcrypto/certs.h \
102 mbedcrypto/check_config.h \
103 mbedcrypto/cipher.h \
104 mbedcrypto/cipher_internal.h \
105 mbedcrypto/cmac.h \
106 mbedcrypto/config.h \
107 mbedcrypto/ctr_drbg.h \
108 mbedcrypto/des.h \
109 mbedcrypto/ecdsa.h \
110 mbedcrypto/ecp.h \
111 mbedcrypto/ecp_internal.h \
112 mbedcrypto/entropy.h \
113 mbedcrypto/entropy_poll.h \
114 mbedcrypto/error.h \
115 mbedcrypto/gcm.h \
116 mbedcrypto/hmac_drbg.h \
117 mbedcrypto/md.h \
118 mbedcrypto/md2.h \
119 mbedcrypto/md4.h \
120 mbedcrypto/md5.h \
121 mbedcrypto/md_internal.h \
122 mbedcrypto/oid.h \
123 mbedcrypto/pem.h \
124 mbedcrypto/pk.h \
125 mbedcrypto/pk_internal.h \
126 mbedcrypto/pkcs11.h \
127 mbedcrypto/pkcs12.h \
128 mbedcrypto/pkcs5.h \
129 mbedcrypto/platform.h \
130 mbedcrypto/platform_util.h \
131 mbedcrypto/ripemd160.h \
132 mbedcrypto/rsa.h \
133 mbedcrypto/rsa_internal.h \
134 mbedcrypto/sha1.h \
135 mbedcrypto/sha256.h \
136 mbedcrypto/sha512.h \
137 mbedcrypto/threading.h \
138 mbedcrypto/xtea.h \
139 psa/crypto.h \
140 psa/crypto_extra.h \
141 psa/crypto_platform.h \
142 psa/crypto_sizes.h \
143 psa/crypto_struct.h \
144# Don't delete this line.
145
146TEST_FILES := \
147 tests/scripts/generate_test_code.py \
148 tests/scripts/mbedtls_test.py \
149 tests/scripts/test_generate_test_code.py \
150 tests/scripts/run-test-suites.pl \
151 tests/suites/helpers.function \
152 tests/suites/host_test.function \
153 tests/suites/main_test.function \
154 tests/suites/target_test.function \
155 tests/suites/test_suite_psa_crypto.data \
156 tests/suites/test_suite_psa_crypto.function \
itayzafrir02d62952018-10-24 12:45:18 +0300157 tests/suites/test_suite_psa_crypto_hash.data \
158 tests/suites/test_suite_psa_crypto_hash.function \
Gilles Peskine44fed612018-08-21 18:20:20 +0200159 tests/suites/test_suite_psa_crypto_metadata.data \
160 tests/suites/test_suite_psa_crypto_metadata.function \
Darryl Greend49a4992018-06-18 17:27:26 +0100161 tests/suites/test_suite_psa_crypto_persistent_key.data \
162 tests/suites/test_suite_psa_crypto_persistent_key.function \
Darryl Greendb2b8db2018-06-15 13:06:04 +0100163 tests/suites/test_suite_psa_crypto_storage_file.data \
164 tests/suites/test_suite_psa_crypto_storage_file.function \
Jaeden Amerodebb2c02018-06-25 17:25:29 +0100165# Don't delete this line.
166
167OTHER_FILES := \
168 LICENSE \
169 VERSION.txt \
170 programs/psa/crypto_examples.c \
171 programs/psa/key_ladder_demo.c \
Jaeden Amero80e317a2018-07-11 15:45:23 +0100172 programs/psa/key_ladder_demo.sh \
Jaeden Amerodebb2c02018-06-25 17:25:29 +0100173 programs/psa/psa_constant_names.c \
174 scripts/config.pl \
175 scripts/generate_psa_constants.py \
176# Don't delete this line.
177
178# Prepend destination directory
179LIB_FILES := $(addprefix crypto/library/,$(LIB_FILES))
180INC_FILES := $(addprefix crypto/include/,$(INC_FILES))
181TEST_FILES := $(addprefix crypto/,$(TEST_FILES))
182OTHER_FILES := $(addprefix crypto/,$(OTHER_FILES))
183
184define rename_mbedcrypto
185 @sed -i -e 's/Mbed TLS/Mbed Crypto/g' $(1)
186 @sed -i -e 's/mbed TLS/Mbed Crypto/g' $(1)
187 @sed -i -e 's/MBEDTLS_/MBEDCRYPTO_/g' $(1)
188 @sed -i -e 's/mbedtls/mbedcrypto/g' $(1)
189 @sed -i -e 's/MbedTls/MbedCrypto/g' $(1)
190 @sed -i -e 's/include\/mbedtls/include\/mbedcrypto/g' $(1)
191endef
192
193crypto/include/mbedcrypto/config.h: configs/config-psa-crypto.h
194 @echo $@
195 @mkdir -p $(dir $@)
196 @cp $< $@
197 @#Rename the file in the comments
198 @sed -i -e 's/config-psa-crypto.h/config.h/g' $@
199 $(call rename_mbedcrypto,$@)
200
201crypto/tests/data_files/%: tests/data_files/%
202 @echo $@
203 @mkdir -p $(dir $@)
204 @cp $< $@
205 @#Don't rename things inside data files
206
207crypto/include/mbedcrypto/%.h: include/mbedtls/%.h
208 @echo $@
209 @mkdir -p $(dir $@)
210 @cp $< $@
211 $(call rename_mbedcrypto,$@)
212
213crypto/LICENSE: apache-2.0.txt
214 @echo $@
215 @mkdir -p $(dir $@)
216 @cp $< $@
217 @#Don't rename anything in the license
218
219crypto/%: %
220 @echo $@
221 @mkdir -p $(dir $@)
222 @cp $< $@
223 $(call rename_mbedcrypto,$@)
224
225crypto/VERSION.txt: FORCE
Jaeden Amero3a33c012018-09-27 10:14:36 +0100226 @git describe --tags --abbrev=12 --dirty --always > $@
Jaeden Amerodebb2c02018-06-25 17:25:29 +0100227
228mbedcrypto.tar.gz: $(LIB_FILES) $(INC_FILES) $(TEST_FILES) $(OTHER_FILES)
229 @echo $@
230 @tar czf mbedcrypto.tar.gz crypto
231
232clean:
233 @echo clean
234 @rm -rf mbedcrypto.tar.gz \
235 $(LIB_FILES) $(INC_FILES) $(TEST_FILES) $(OTHER_FILES)
236
237FORCE:
238
239# vi: ft=make