blob: ab54d555fa334cce20014f1a7bb2767c792c265f [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 Greendb2b8db2018-06-15 13:06:04 +0100161 tests/suites/test_suite_psa_crypto_storage_file.data \
162 tests/suites/test_suite_psa_crypto_storage_file.function \
Jaeden Amerodebb2c02018-06-25 17:25:29 +0100163# Don't delete this line.
164
165OTHER_FILES := \
166 LICENSE \
167 VERSION.txt \
168 programs/psa/crypto_examples.c \
169 programs/psa/key_ladder_demo.c \
Jaeden Amero80e317a2018-07-11 15:45:23 +0100170 programs/psa/key_ladder_demo.sh \
Jaeden Amerodebb2c02018-06-25 17:25:29 +0100171 programs/psa/psa_constant_names.c \
172 scripts/config.pl \
173 scripts/generate_psa_constants.py \
174# Don't delete this line.
175
176# Prepend destination directory
177LIB_FILES := $(addprefix crypto/library/,$(LIB_FILES))
178INC_FILES := $(addprefix crypto/include/,$(INC_FILES))
179TEST_FILES := $(addprefix crypto/,$(TEST_FILES))
180OTHER_FILES := $(addprefix crypto/,$(OTHER_FILES))
181
182define rename_mbedcrypto
183 @sed -i -e 's/Mbed TLS/Mbed Crypto/g' $(1)
184 @sed -i -e 's/mbed TLS/Mbed Crypto/g' $(1)
185 @sed -i -e 's/MBEDTLS_/MBEDCRYPTO_/g' $(1)
186 @sed -i -e 's/mbedtls/mbedcrypto/g' $(1)
187 @sed -i -e 's/MbedTls/MbedCrypto/g' $(1)
188 @sed -i -e 's/include\/mbedtls/include\/mbedcrypto/g' $(1)
189endef
190
191crypto/include/mbedcrypto/config.h: configs/config-psa-crypto.h
192 @echo $@
193 @mkdir -p $(dir $@)
194 @cp $< $@
195 @#Rename the file in the comments
196 @sed -i -e 's/config-psa-crypto.h/config.h/g' $@
197 $(call rename_mbedcrypto,$@)
198
199crypto/tests/data_files/%: tests/data_files/%
200 @echo $@
201 @mkdir -p $(dir $@)
202 @cp $< $@
203 @#Don't rename things inside data files
204
205crypto/include/mbedcrypto/%.h: include/mbedtls/%.h
206 @echo $@
207 @mkdir -p $(dir $@)
208 @cp $< $@
209 $(call rename_mbedcrypto,$@)
210
211crypto/LICENSE: apache-2.0.txt
212 @echo $@
213 @mkdir -p $(dir $@)
214 @cp $< $@
215 @#Don't rename anything in the license
216
217crypto/%: %
218 @echo $@
219 @mkdir -p $(dir $@)
220 @cp $< $@
221 $(call rename_mbedcrypto,$@)
222
223crypto/VERSION.txt: FORCE
Jaeden Amero3a33c012018-09-27 10:14:36 +0100224 @git describe --tags --abbrev=12 --dirty --always > $@
Jaeden Amerodebb2c02018-06-25 17:25:29 +0100225
226mbedcrypto.tar.gz: $(LIB_FILES) $(INC_FILES) $(TEST_FILES) $(OTHER_FILES)
227 @echo $@
228 @tar czf mbedcrypto.tar.gz crypto
229
230clean:
231 @echo clean
232 @rm -rf mbedcrypto.tar.gz \
233 $(LIB_FILES) $(INC_FILES) $(TEST_FILES) $(OTHER_FILES)
234
235FORCE:
236
237# vi: ft=make