3 # ========================================================================
5 # Copyright (c) 2017 Thomas Pornin <pornin@bolet.org>
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be
16 # included in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 # ========================================================================
29 # This script is used to generate the 'Rules.mk' file from the list
30 # of source file included below. If the list changes (e.g. to add a
31 # new source file), then add it here and rerun this script.
33 # ========================================================================
35 # Solaris compatibility: switch to a more POSIX-compliant /bin/sh.
36 if [ -z "$BR_SCRIPT_LOOP" ] ; then
39 if [ -x /usr
/xpg
6/bin
/sh
] ; then
40 exec /usr
/xpg
6/bin
/sh
"$0" "$@"
42 if [ -x /usr
/xpg
4/bin
/sh
] ; then
43 exec /usr
/xpg
4/bin
/sh
"$0" "$@"
47 # Exit on first error.
50 # Source files. Please keep in alphabetical order.
68 src/ec/ec_c25519_i15.c \
69 src/ec/ec_c25519_i31.c \
70 src/ec/ec_c25519_m15.c \
71 src/ec/ec_c25519_m31.c \
72 src/ec/ec_curve25519.c \
74 src/ec/ec_p256_m15.c \
75 src/ec/ec_p256_m31.c \
76 src/ec/ec_prime_i15.c \
77 src/ec/ec_prime_i31.c \
78 src/ec/ec_secp256r1.c \
79 src/ec/ec_secp384r1.c \
80 src/ec/ec_secp521r1.c \
82 src/ec/ecdsa_default_sign_asn1.c \
83 src/ec/ecdsa_default_sign_raw.c \
84 src/ec/ecdsa_default_vrfy_asn1.c \
85 src/ec/ecdsa_default_vrfy_raw.c \
86 src/ec/ecdsa_i15_bits.c \
87 src/ec/ecdsa_i15_sign_asn1.c \
88 src/ec/ecdsa_i15_sign_raw.c \
89 src/ec/ecdsa_i15_vrfy_asn1.c \
90 src/ec/ecdsa_i15_vrfy_raw.c \
91 src/ec/ecdsa_i31_bits.c \
92 src/ec/ecdsa_i31_sign_asn1.c \
93 src/ec/ecdsa_i31_sign_raw.c \
94 src/ec/ecdsa_i31_vrfy_asn1.c \
95 src/ec/ecdsa_i31_vrfy_raw.c \
99 src/hash/ghash_ctmul.c \
100 src/hash/ghash_ctmul32.c \
101 src/hash/ghash_ctmul64.c \
102 src/hash/ghash_pclmul.c \
103 src/hash/ghash_pwr8.c \
106 src/hash/multihash.c \
109 src/hash/sha2small.c \
111 src/int/i15_bitlen.c \
112 src/int/i15_decmod.c \
113 src/int/i15_decode.c \
114 src/int/i15_decred.c \
115 src/int/i15_encode.c \
116 src/int/i15_fmont.c \
117 src/int/i15_iszero.c \
118 src/int/i15_modpow.c \
119 src/int/i15_modpow2.c \
120 src/int/i15_montmul.c \
121 src/int/i15_mulacc.c \
122 src/int/i15_muladd.c \
123 src/int/i15_ninv15.c \
124 src/int/i15_reduce.c \
125 src/int/i15_rshift.c \
127 src/int/i15_tmont.c \
129 src/int/i31_bitlen.c \
130 src/int/i31_decmod.c \
131 src/int/i31_decode.c \
132 src/int/i31_decred.c \
133 src/int/i31_encode.c \
134 src/int/i31_fmont.c \
135 src/int/i31_iszero.c \
136 src/int/i31_modpow.c \
137 src/int/i31_montmul.c \
138 src/int/i31_mulacc.c \
139 src/int/i31_muladd.c \
140 src/int/i31_ninv31.c \
141 src/int/i31_reduce.c \
142 src/int/i31_rshift.c \
144 src/int/i31_tmont.c \
146 src/int/i32_bitlen.c \
147 src/int/i32_decmod.c \
148 src/int/i32_decode.c \
149 src/int/i32_decred.c \
150 src/int/i32_div32.c \
151 src/int/i32_encode.c \
152 src/int/i32_fmont.c \
153 src/int/i32_iszero.c \
154 src/int/i32_modpow.c \
155 src/int/i32_montmul.c \
156 src/int/i32_mulacc.c \
157 src/int/i32_muladd.c \
158 src/int/i32_ninv32.c \
159 src/int/i32_reduce.c \
161 src/int/i32_tmont.c \
164 src/rand/hmac_drbg.c \
165 src/rsa/rsa_default_pkcs1_sign.c \
166 src/rsa/rsa_default_pkcs1_vrfy.c \
167 src/rsa/rsa_default_priv.c \
168 src/rsa/rsa_default_pub.c \
169 src/rsa/rsa_i15_pkcs1_sign.c \
170 src/rsa/rsa_i15_pkcs1_vrfy.c \
171 src/rsa/rsa_i15_priv.c \
172 src/rsa/rsa_i15_pub.c \
173 src/rsa/rsa_i31_pkcs1_sign.c \
174 src/rsa/rsa_i31_pkcs1_vrfy.c \
175 src/rsa/rsa_i31_priv.c \
176 src/rsa/rsa_i31_pub.c \
177 src/rsa/rsa_i32_pkcs1_sign.c \
178 src/rsa/rsa_i32_pkcs1_vrfy.c \
179 src/rsa/rsa_i32_priv.c \
180 src/rsa/rsa_i32_pub.c \
181 src/rsa/rsa_pkcs1_sig_pad.c \
182 src/rsa/rsa_pkcs1_sig_unpad.c \
183 src/rsa/rsa_ssl_decrypt.c \
185 src/ssl/prf_md5sha1.c \
186 src/ssl/prf_sha256.c \
187 src/ssl/prf_sha384.c \
188 src/ssl/ssl_ccert_single_ec.c \
189 src/ssl/ssl_ccert_single_rsa.c \
190 src/ssl/ssl_client.c \
191 src/ssl/ssl_client_default_rsapub.c \
192 src/ssl/ssl_client_full.c \
193 src/ssl/ssl_engine.c \
194 src/ssl/ssl_engine_default_aescbc.c \
195 src/ssl/ssl_engine_default_aesgcm.c \
196 src/ssl/ssl_engine_default_chapol.c \
197 src/ssl/ssl_engine_default_descbc.c \
198 src/ssl/ssl_engine_default_ec.c \
199 src/ssl/ssl_engine_default_ecdsa.c \
200 src/ssl/ssl_engine_default_rsavrfy.c \
201 src/ssl/ssl_hashes.c \
202 src/ssl/ssl_hs_client.c \
203 src/ssl/ssl_hs_server.c \
206 src/ssl/ssl_rec_cbc.c \
207 src/ssl/ssl_rec_chapol.c \
208 src/ssl/ssl_rec_gcm.c \
209 src/ssl/ssl_scert_single_ec.c \
210 src/ssl/ssl_scert_single_rsa.c \
211 src/ssl/ssl_server.c \
212 src/ssl/ssl_server_full_ec.c \
213 src/ssl/ssl_server_full_rsa.c \
214 src/ssl/ssl_server_mine2c.c \
215 src/ssl/ssl_server_mine2g.c \
216 src/ssl/ssl_server_minf2c.c \
217 src/ssl/ssl_server_minf2g.c \
218 src/ssl/ssl_server_minr2g.c \
219 src/ssl/ssl_server_minu2g.c \
220 src/ssl/ssl_server_minv2g.c \
221 src/symcipher/aes_big_cbcdec.c \
222 src/symcipher/aes_big_cbcenc.c \
223 src/symcipher/aes_big_ctr.c \
224 src/symcipher/aes_big_dec.c \
225 src/symcipher/aes_big_enc.c \
226 src/symcipher/aes_common.c \
227 src/symcipher/aes_ct.c \
228 src/symcipher/aes_ct64.c \
229 src/symcipher/aes_ct64_cbcdec.c \
230 src/symcipher/aes_ct64_cbcenc.c \
231 src/symcipher/aes_ct64_ctr.c \
232 src/symcipher/aes_ct64_dec.c \
233 src/symcipher/aes_ct64_enc.c \
234 src/symcipher/aes_ct_cbcdec.c \
235 src/symcipher/aes_ct_cbcenc.c \
236 src/symcipher/aes_ct_ctr.c \
237 src/symcipher/aes_ct_dec.c \
238 src/symcipher/aes_ct_enc.c \
239 src/symcipher/aes_pwr8.c \
240 src/symcipher/aes_pwr8_cbcdec.c \
241 src/symcipher/aes_pwr8_cbcenc.c \
242 src/symcipher/aes_pwr8_ctr.c \
243 src/symcipher/aes_small_cbcdec.c \
244 src/symcipher/aes_small_cbcenc.c \
245 src/symcipher/aes_small_ctr.c \
246 src/symcipher/aes_small_dec.c \
247 src/symcipher/aes_small_enc.c \
248 src/symcipher/aes_x86ni.c \
249 src/symcipher/aes_x86ni_cbcdec.c \
250 src/symcipher/aes_x86ni_cbcenc.c \
251 src/symcipher/aes_x86ni_ctr.c \
252 src/symcipher/chacha20_ct.c \
253 src/symcipher/des_ct.c \
254 src/symcipher/des_ct_cbcdec.c \
255 src/symcipher/des_ct_cbcenc.c \
256 src/symcipher/des_support.c \
257 src/symcipher/des_tab.c \
258 src/symcipher/des_tab_cbcdec.c \
259 src/symcipher/des_tab_cbcenc.c \
260 src/symcipher/poly1305_ctmul.c \
261 src/symcipher/poly1305_ctmul32.c \
262 src/symcipher/poly1305_i15.c \
263 src/x509/skey_decoder.c \
264 src/x509/x509_decoder.c \
265 src/x509/x509_knownkey.c \
266 src/x509/x509_minimal.c \
267 src/x509/x509_minimal_full.c"
269 # Source files for the 'brssl' command-line tool.
287 # Source files the the 'testcrypto' command-line tool.
291 # Source files the the 'testspeed' command-line tool.
295 # Source files the the 'testx509' command-line tool.
299 # Public header files.
302 inc/bearssl_block.h \
313 # Private header files.
318 # Header files for the 'brssl' command-line tool.
322 # T0 compiler source code.
327 T0/CodeElementJump.cs \
328 T0/CodeElementUInt.cs \
329 T0/CodeElementUIntExpr.cs \
330 T0/CodeElementUIntInt.cs \
331 T0/CodeElementUIntUInt.cs \
336 T0/OpcodeGetLocal.cs \
339 T0/OpcodeJumpIfNot.cs \
340 T0/OpcodeJumpUncond.cs \
341 T0/OpcodePutLocal.cs \
354 T0/WordInterpreted.cs \
360 # Function to turn slashes into $P (macro for path separator).
362 printf '%s' "$1" |
sed 's/\//$P/g'
368 # Automatically generated rules. Use 'mkrules.sh' to modify/regenerate.
372 for f
in $coresrc ; do
373 printf ' $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
375 printf "\nOBJBRSSL ="
376 for f
in $toolssrc ; do
377 printf ' $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
379 printf "\nOBJTESTCRYPTO ="
380 for f
in $testcryptosrc ; do
381 printf ' $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
383 printf "\nOBJTESTSPEED ="
384 for f
in $testspeedsrc ; do
385 printf ' $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
387 printf "\nOBJTESTX509 ="
388 for f
in $testx509src ; do
389 printf ' $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
391 printf "\nHEADERSPUB ="
392 for f
in $headerspub ; do
393 printf " %s" "$(escsep "$f")"
395 printf "\nHEADERSPRIV = %s" '$(HEADERSPUB)'
396 for f
in $headerspriv ; do
397 printf " %s" "$(escsep "$f")"
399 printf "\nHEADERSTOOLS = %s" '$(HEADERSPUB)'
400 for f
in $headerstools ; do
401 printf " %s" "$(escsep "$f")"
404 for f
in $t0compsrc ; do
405 printf " %s" "$(escsep "$f")"
408 for f
in $t0kernsrc ; do
409 printf " %s" "$(escsep "$f")"
411 printf "\n") >> Rules.mk
413 cat >> Rules.mk
<<EOF
415 all: \$(STATICLIB) \$(DLL) \$(TOOLS) \$(TESTS)
425 tests: \$(TESTCRYPTO) \$(TESTSPEED) \$(TESTX509)
428 \$(RUNT0COMP) -o src\$Pcodec\$Ppemdec -r br_pem_decoder src\$Pcodec\$Ppemdec.t0
429 \$(RUNT0COMP) -o src\$Pssl\$Pssl_hs_client -r br_ssl_hs_client src\$Pssl\$Pssl_hs_common.t0 src\$Pssl\$Pssl_hs_client.t0
430 \$(RUNT0COMP) -o src\$Pssl\$Pssl_hs_server -r br_ssl_hs_server src\$Pssl\$Pssl_hs_common.t0 src\$Pssl\$Pssl_hs_server.t0
431 \$(RUNT0COMP) -o src\$Px509\$Pskey_decoder -r br_skey_decoder src\$Px509\$Pasn1.t0 src\$Px509\$Pskey_decoder.t0
432 \$(RUNT0COMP) -o src\$Px509\$Px509_decoder -r br_x509_decoder src\$Px509\$Pasn1.t0 src\$Px509\$Px509_decoder.t0
433 \$(RUNT0COMP) -o src\$Px509\$Px509_minimal -r br_x509_minimal src\$Px509\$Pasn1.t0 src\$Px509\$Px509_minimal.t0
435 \$(T0COMP): \$(T0SRC) \$(T0KERN)
439 -\$(RM) \$(OBJDIR)\$P*\$O
440 -\$(RM) \$(BEARSSLLIB) \$(BEARSSLDLL) \$(BRSSL) \$(TESTCRYPTO) \$(TESTSPEED) \$(TESTX509)
443 -\$(MKDIR) \$(OBJDIR)
445 \$(BEARSSLLIB): \$(OBJDIR) \$(OBJ)
446 \$(AR) \$(ARFLAGS) \$(AROUT)\$(BEARSSLLIB) \$(OBJ)
448 \$(BEARSSLDLL): \$(OBJDIR) \$(OBJ)
449 \$(LDDLL) \$(LDDLLFLAGS) \$(LDDLLOUT)\$(BEARSSLDLL) \$(OBJ)
451 \$(BRSSL): \$(BEARSSLLIB) \$(OBJBRSSL)
452 \$(LD) \$(LDFLAGS) \$(LDOUT)\$(BRSSL) \$(OBJBRSSL) \$(BEARSSLLIB)
454 \$(TESTCRYPTO): \$(BEARSSLLIB) \$(OBJTESTCRYPTO)
455 \$(LD) \$(LDFLAGS) \$(LDOUT)\$(TESTCRYPTO) \$(OBJTESTCRYPTO) \$(BEARSSLLIB)
457 \$(TESTSPEED): \$(BEARSSLLIB) \$(OBJTESTSPEED)
458 \$(LD) \$(LDFLAGS) \$(LDOUT)\$(TESTSPEED) \$(OBJTESTSPEED) \$(BEARSSLLIB)
460 \$(TESTX509): \$(BEARSSLLIB) \$(OBJTESTX509)
461 \$(LD) \$(LDFLAGS) \$(LDOUT)\$(TESTX509) \$(OBJTESTX509) \$(BEARSSLLIB)
464 (for f
in $coresrc ; do
465 b
="$(basename "$f" .c)\$O"
467 printf '\n$(OBJDIR)$P%s: %s $(HEADERSPRIV)\n\t$(CC) $(CFLAGS) $(INCFLAGS) $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"
470 for f
in $toolssrc ; do
471 b
="$(basename "$f" .c)\$O"
473 printf '\n$(OBJDIR)$P%s: %s $(HEADERSTOOLS)\n\t$(CC) $(CFLAGS) $(INCFLAGS) $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"
476 for f
in $testcryptosrc $testspeedsrc ; do
477 b
="$(basename "$f" .c)\$O"
479 printf '\n$(OBJDIR)$P%s: %s $(HEADERSPRIV)\n\t$(CC) $(CFLAGS) $(INCFLAGS) $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"
482 for f
in $testx509src ; do
483 b
="$(basename "$f" .c)\$O"
485 printf '\n$(OBJDIR)$P%s: %s $(HEADERSPRIV)\n\t$(CC) $(CFLAGS) $(INCFLAGS) -DSRCDIRNAME=".." $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"