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.
73 src/ec/ec_c25519_i15.c \
74 src/ec/ec_c25519_i31.c \
75 src/ec/ec_c25519_m15.c \
76 src/ec/ec_c25519_m31.c \
77 src/ec/ec_c25519_m62.c \
78 src/ec/ec_c25519_m64.c \
79 src/ec/ec_curve25519.c \
82 src/ec/ec_p256_m15.c \
83 src/ec/ec_p256_m31.c \
84 src/ec/ec_p256_m62.c \
85 src/ec/ec_p256_m64.c \
86 src/ec/ec_prime_i15.c \
87 src/ec/ec_prime_i31.c \
89 src/ec/ec_secp256r1.c \
90 src/ec/ec_secp384r1.c \
91 src/ec/ec_secp521r1.c \
93 src/ec/ecdsa_default_sign_asn1.c \
94 src/ec/ecdsa_default_sign_raw.c \
95 src/ec/ecdsa_default_vrfy_asn1.c \
96 src/ec/ecdsa_default_vrfy_raw.c \
97 src/ec/ecdsa_i15_bits.c \
98 src/ec/ecdsa_i15_sign_asn1.c \
99 src/ec/ecdsa_i15_sign_raw.c \
100 src/ec/ecdsa_i15_vrfy_asn1.c \
101 src/ec/ecdsa_i15_vrfy_raw.c \
102 src/ec/ecdsa_i31_bits.c \
103 src/ec/ecdsa_i31_sign_asn1.c \
104 src/ec/ecdsa_i31_sign_raw.c \
105 src/ec/ecdsa_i31_vrfy_asn1.c \
106 src/ec/ecdsa_i31_vrfy_raw.c \
109 src/hash/dig_size.c \
110 src/hash/ghash_ctmul.c \
111 src/hash/ghash_ctmul32.c \
112 src/hash/ghash_ctmul64.c \
113 src/hash/ghash_pclmul.c \
114 src/hash/ghash_pwr8.c \
118 src/hash/multihash.c \
121 src/hash/sha2small.c \
123 src/int/i15_bitlen.c \
124 src/int/i15_decmod.c \
125 src/int/i15_decode.c \
126 src/int/i15_decred.c \
127 src/int/i15_encode.c \
128 src/int/i15_fmont.c \
129 src/int/i15_iszero.c \
130 src/int/i15_moddiv.c \
131 src/int/i15_modpow.c \
132 src/int/i15_modpow2.c \
133 src/int/i15_montmul.c \
134 src/int/i15_mulacc.c \
135 src/int/i15_muladd.c \
136 src/int/i15_ninv15.c \
137 src/int/i15_reduce.c \
138 src/int/i15_rshift.c \
140 src/int/i15_tmont.c \
142 src/int/i31_bitlen.c \
143 src/int/i31_decmod.c \
144 src/int/i31_decode.c \
145 src/int/i31_decred.c \
146 src/int/i31_encode.c \
147 src/int/i31_fmont.c \
148 src/int/i31_iszero.c \
149 src/int/i31_moddiv.c \
150 src/int/i31_modpow.c \
151 src/int/i31_modpow2.c \
152 src/int/i31_montmul.c \
153 src/int/i31_mulacc.c \
154 src/int/i31_muladd.c \
155 src/int/i31_ninv31.c \
156 src/int/i31_reduce.c \
157 src/int/i31_rshift.c \
159 src/int/i31_tmont.c \
161 src/int/i32_bitlen.c \
162 src/int/i32_decmod.c \
163 src/int/i32_decode.c \
164 src/int/i32_decred.c \
165 src/int/i32_div32.c \
166 src/int/i32_encode.c \
167 src/int/i32_fmont.c \
168 src/int/i32_iszero.c \
169 src/int/i32_modpow.c \
170 src/int/i32_montmul.c \
171 src/int/i32_mulacc.c \
172 src/int/i32_muladd.c \
173 src/int/i32_ninv32.c \
174 src/int/i32_reduce.c \
176 src/int/i32_tmont.c \
177 src/int/i62_modpow2.c \
182 src/rand/aesctr_drbg.c \
183 src/rand/hmac_drbg.c \
185 src/rsa/rsa_default_keygen.c \
186 src/rsa/rsa_default_modulus.c \
187 src/rsa/rsa_default_oaep_decrypt.c \
188 src/rsa/rsa_default_oaep_encrypt.c \
189 src/rsa/rsa_default_pkcs1_sign.c \
190 src/rsa/rsa_default_pkcs1_vrfy.c \
191 src/rsa/rsa_default_priv.c \
192 src/rsa/rsa_default_privexp.c \
193 src/rsa/rsa_default_pss_sign.c \
194 src/rsa/rsa_default_pss_vrfy.c \
195 src/rsa/rsa_default_pub.c \
196 src/rsa/rsa_default_pubexp.c \
197 src/rsa/rsa_i15_keygen.c \
198 src/rsa/rsa_i15_modulus.c \
199 src/rsa/rsa_i15_oaep_decrypt.c \
200 src/rsa/rsa_i15_oaep_encrypt.c \
201 src/rsa/rsa_i15_pkcs1_sign.c \
202 src/rsa/rsa_i15_pkcs1_vrfy.c \
203 src/rsa/rsa_i15_priv.c \
204 src/rsa/rsa_i15_privexp.c \
205 src/rsa/rsa_i15_pss_sign.c \
206 src/rsa/rsa_i15_pss_vrfy.c \
207 src/rsa/rsa_i15_pub.c \
208 src/rsa/rsa_i15_pubexp.c \
209 src/rsa/rsa_i31_keygen.c \
210 src/rsa/rsa_i31_keygen_inner.c \
211 src/rsa/rsa_i31_modulus.c \
212 src/rsa/rsa_i31_oaep_decrypt.c \
213 src/rsa/rsa_i31_oaep_encrypt.c \
214 src/rsa/rsa_i31_pkcs1_sign.c \
215 src/rsa/rsa_i31_pkcs1_vrfy.c \
216 src/rsa/rsa_i31_priv.c \
217 src/rsa/rsa_i31_privexp.c \
218 src/rsa/rsa_i31_pss_sign.c \
219 src/rsa/rsa_i31_pss_vrfy.c \
220 src/rsa/rsa_i31_pub.c \
221 src/rsa/rsa_i31_pubexp.c \
222 src/rsa/rsa_i32_oaep_decrypt.c \
223 src/rsa/rsa_i32_oaep_encrypt.c \
224 src/rsa/rsa_i32_pkcs1_sign.c \
225 src/rsa/rsa_i32_pkcs1_vrfy.c \
226 src/rsa/rsa_i32_priv.c \
227 src/rsa/rsa_i32_pss_sign.c \
228 src/rsa/rsa_i32_pss_vrfy.c \
229 src/rsa/rsa_i32_pub.c \
230 src/rsa/rsa_i62_keygen.c \
231 src/rsa/rsa_i62_oaep_decrypt.c \
232 src/rsa/rsa_i62_oaep_encrypt.c \
233 src/rsa/rsa_i62_pkcs1_sign.c \
234 src/rsa/rsa_i62_pkcs1_vrfy.c \
235 src/rsa/rsa_i62_priv.c \
236 src/rsa/rsa_i62_pss_sign.c \
237 src/rsa/rsa_i62_pss_vrfy.c \
238 src/rsa/rsa_i62_pub.c \
239 src/rsa/rsa_oaep_pad.c \
240 src/rsa/rsa_oaep_unpad.c \
241 src/rsa/rsa_pkcs1_sig_pad.c \
242 src/rsa/rsa_pkcs1_sig_unpad.c \
243 src/rsa/rsa_pss_sig_pad.c \
244 src/rsa/rsa_pss_sig_unpad.c \
245 src/rsa/rsa_ssl_decrypt.c \
247 src/ssl/prf_md5sha1.c \
248 src/ssl/prf_sha256.c \
249 src/ssl/prf_sha384.c \
250 src/ssl/ssl_ccert_single_ec.c \
251 src/ssl/ssl_ccert_single_rsa.c \
252 src/ssl/ssl_client.c \
253 src/ssl/ssl_client_default_rsapub.c \
254 src/ssl/ssl_client_full.c \
255 src/ssl/ssl_engine.c \
256 src/ssl/ssl_engine_default_aescbc.c \
257 src/ssl/ssl_engine_default_aesccm.c \
258 src/ssl/ssl_engine_default_aesgcm.c \
259 src/ssl/ssl_engine_default_chapol.c \
260 src/ssl/ssl_engine_default_descbc.c \
261 src/ssl/ssl_engine_default_ec.c \
262 src/ssl/ssl_engine_default_ecdsa.c \
263 src/ssl/ssl_engine_default_rsavrfy.c \
264 src/ssl/ssl_hashes.c \
265 src/ssl/ssl_hs_client.c \
266 src/ssl/ssl_hs_server.c \
268 src/ssl/ssl_keyexport.c \
270 src/ssl/ssl_rec_cbc.c \
271 src/ssl/ssl_rec_ccm.c \
272 src/ssl/ssl_rec_chapol.c \
273 src/ssl/ssl_rec_gcm.c \
274 src/ssl/ssl_scert_single_ec.c \
275 src/ssl/ssl_scert_single_rsa.c \
276 src/ssl/ssl_server.c \
277 src/ssl/ssl_server_full_ec.c \
278 src/ssl/ssl_server_full_rsa.c \
279 src/ssl/ssl_server_mine2c.c \
280 src/ssl/ssl_server_mine2g.c \
281 src/ssl/ssl_server_minf2c.c \
282 src/ssl/ssl_server_minf2g.c \
283 src/ssl/ssl_server_minr2g.c \
284 src/ssl/ssl_server_minu2g.c \
285 src/ssl/ssl_server_minv2g.c \
286 src/symcipher/aes_big_cbcdec.c \
287 src/symcipher/aes_big_cbcenc.c \
288 src/symcipher/aes_big_ctr.c \
289 src/symcipher/aes_big_ctrcbc.c \
290 src/symcipher/aes_big_dec.c \
291 src/symcipher/aes_big_enc.c \
292 src/symcipher/aes_common.c \
293 src/symcipher/aes_ct.c \
294 src/symcipher/aes_ct64.c \
295 src/symcipher/aes_ct64_cbcdec.c \
296 src/symcipher/aes_ct64_cbcenc.c \
297 src/symcipher/aes_ct64_ctr.c \
298 src/symcipher/aes_ct64_ctrcbc.c \
299 src/symcipher/aes_ct64_dec.c \
300 src/symcipher/aes_ct64_enc.c \
301 src/symcipher/aes_ct_cbcdec.c \
302 src/symcipher/aes_ct_cbcenc.c \
303 src/symcipher/aes_ct_ctr.c \
304 src/symcipher/aes_ct_ctrcbc.c \
305 src/symcipher/aes_ct_dec.c \
306 src/symcipher/aes_ct_enc.c \
307 src/symcipher/aes_pwr8.c \
308 src/symcipher/aes_pwr8_cbcdec.c \
309 src/symcipher/aes_pwr8_cbcenc.c \
310 src/symcipher/aes_pwr8_ctr.c \
311 src/symcipher/aes_pwr8_ctrcbc.c \
312 src/symcipher/aes_small_cbcdec.c \
313 src/symcipher/aes_small_cbcenc.c \
314 src/symcipher/aes_small_ctr.c \
315 src/symcipher/aes_small_ctrcbc.c \
316 src/symcipher/aes_small_dec.c \
317 src/symcipher/aes_small_enc.c \
318 src/symcipher/aes_x86ni.c \
319 src/symcipher/aes_x86ni_cbcdec.c \
320 src/symcipher/aes_x86ni_cbcenc.c \
321 src/symcipher/aes_x86ni_ctr.c \
322 src/symcipher/aes_x86ni_ctrcbc.c \
323 src/symcipher/chacha20_ct.c \
324 src/symcipher/chacha20_sse2.c \
325 src/symcipher/des_ct.c \
326 src/symcipher/des_ct_cbcdec.c \
327 src/symcipher/des_ct_cbcenc.c \
328 src/symcipher/des_support.c \
329 src/symcipher/des_tab.c \
330 src/symcipher/des_tab_cbcdec.c \
331 src/symcipher/des_tab_cbcenc.c \
332 src/symcipher/poly1305_ctmul.c \
333 src/symcipher/poly1305_ctmul32.c \
334 src/symcipher/poly1305_ctmulq.c \
335 src/symcipher/poly1305_i15.c \
337 src/x509/encode_ec_pk8der.c \
338 src/x509/encode_ec_rawder.c \
339 src/x509/encode_rsa_pk8der.c \
340 src/x509/encode_rsa_rawder.c \
341 src/x509/skey_decoder.c \
342 src/x509/x509_decoder.c \
343 src/x509/x509_knownkey.c \
344 src/x509/x509_minimal.c \
345 src/x509/x509_minimal_full.c"
347 # Source files for the 'brssl' command-line tool.
367 # Source files the the 'testcrypto' command-line tool.
371 # Source files the the 'testspeed' command-line tool.
375 # Source files the the 'testx509' command-line tool.
379 # Public header files.
383 inc/bearssl_block.h \
395 # Private header files.
400 # Header files for the 'brssl' command-line tool.
404 # T0 compiler source code.
409 T0/CodeElementJump.cs \
410 T0/CodeElementUInt.cs \
411 T0/CodeElementUIntExpr.cs \
412 T0/CodeElementUIntInt.cs \
413 T0/CodeElementUIntUInt.cs \
418 T0/OpcodeGetLocal.cs \
421 T0/OpcodeJumpIfNot.cs \
422 T0/OpcodeJumpUncond.cs \
423 T0/OpcodePutLocal.cs \
436 T0/WordInterpreted.cs \
442 # Function to turn slashes into $P (macro for path separator).
444 printf '%s' "$1" |
sed 's/\//$P/g'
450 # Automatically generated rules. Use 'mkrules.sh' to modify/regenerate.
454 for f
in $coresrc ; do
455 printf ' \\\n $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
457 printf "\nOBJBRSSL ="
458 for f
in $toolssrc ; do
459 printf ' \\\n $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
461 printf "\nOBJTESTCRYPTO ="
462 for f
in $testcryptosrc ; do
463 printf ' \\\n $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
465 printf "\nOBJTESTSPEED ="
466 for f
in $testspeedsrc ; do
467 printf ' \\\n $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
469 printf "\nOBJTESTX509 ="
470 for f
in $testx509src ; do
471 printf ' \\\n $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
473 printf "\nHEADERSPUB ="
474 for f
in $headerspub ; do
475 printf " %s" "$(escsep "$f")"
477 printf "\nHEADERSPRIV = %s" '$(HEADERSPUB)'
478 for f
in $headerspriv ; do
479 printf " %s" "$(escsep "$f")"
481 printf "\nHEADERSTOOLS = %s" '$(HEADERSPUB)'
482 for f
in $headerstools ; do
483 printf " %s" "$(escsep "$f")"
486 for f
in $t0compsrc ; do
487 printf " %s" "$(escsep "$f")"
490 for f
in $t0kernsrc ; do
491 printf " %s" "$(escsep "$f")"
493 printf "\n") >> Rules.mk
495 cat >> Rules.mk
<<EOF
497 all: \$(STATICLIB) \$(DLL) \$(TOOLS) \$(TESTS)
507 tests: \$(TESTCRYPTO) \$(TESTSPEED) \$(TESTX509)
511 kT0: \$(T0COMP) src\$Pssl\$Pssl_hs_common.t0 src\$Pssl\$Pssl_hs_client.t0 src\$Pssl\$Pssl_hs_server.t0 src\$Px509\$Pasn1.t0 src\$Px509\$Pskey_decoder.t0 src\$Px509\$Px509_decoder.t0 src\$Px509\$Px509_minimal.t0
512 \$(RUNT0COMP) -o src\$Pcodec\$Ppemdec -r br_pem_decoder src\$Pcodec\$Ppemdec.t0
513 \$(RUNT0COMP) -o src\$Pssl\$Pssl_hs_client -r br_ssl_hs_client src\$Pssl\$Pssl_hs_common.t0 src\$Pssl\$Pssl_hs_client.t0
514 \$(RUNT0COMP) -o src\$Pssl\$Pssl_hs_server -r br_ssl_hs_server src\$Pssl\$Pssl_hs_common.t0 src\$Pssl\$Pssl_hs_server.t0
515 \$(RUNT0COMP) -o src\$Px509\$Pskey_decoder -r br_skey_decoder src\$Px509\$Pasn1.t0 src\$Px509\$Pskey_decoder.t0
516 \$(RUNT0COMP) -o src\$Px509\$Px509_decoder -r br_x509_decoder src\$Px509\$Pasn1.t0 src\$Px509\$Px509_decoder.t0
517 \$(RUNT0COMP) -o src\$Px509\$Px509_minimal -r br_x509_minimal src\$Px509\$Pasn1.t0 src\$Px509\$Px509_minimal.t0
519 \$(T0COMP): \$(T0SRC) \$(T0KERN)
523 -\$(RM) \$(OBJDIR)\$P*\$O
524 -\$(RM) \$(BEARSSLLIB) \$(BEARSSLDLL) \$(BRSSL) \$(TESTCRYPTO) \$(TESTSPEED) \$(TESTX509)
527 -\$(MKDIR) \$(OBJDIR)
529 \$(BEARSSLLIB): \$(OBJDIR) \$(OBJ)
530 \$(AR) \$(ARFLAGS) \$(AROUT)\$(BEARSSLLIB) \$(OBJ)
532 \$(BEARSSLDLL): \$(OBJDIR) \$(OBJ)
533 \$(LDDLL) \$(LDDLLFLAGS) \$(LDDLLOUT)\$(BEARSSLDLL) \$(OBJ)
535 \$(BRSSL): \$(BEARSSLLIB) \$(OBJBRSSL)
536 \$(LD) \$(LDFLAGS) \$(LDOUT)\$(BRSSL) \$(OBJBRSSL) \$(BEARSSLLIB)
538 \$(TESTCRYPTO): \$(BEARSSLLIB) \$(OBJTESTCRYPTO)
539 \$(LD) \$(LDFLAGS) \$(LDOUT)\$(TESTCRYPTO) \$(OBJTESTCRYPTO) \$(BEARSSLLIB)
541 \$(TESTSPEED): \$(BEARSSLLIB) \$(OBJTESTSPEED)
542 \$(LD) \$(LDFLAGS) \$(LDOUT)\$(TESTSPEED) \$(OBJTESTSPEED) \$(BEARSSLLIB)
544 \$(TESTX509): \$(BEARSSLLIB) \$(OBJTESTX509)
545 \$(LD) \$(LDFLAGS) \$(LDOUT)\$(TESTX509) \$(OBJTESTX509) \$(BEARSSLLIB)
548 (for f
in $coresrc ; do
549 b
="$(basename "$f" .c)\$O"
551 printf '\n$(OBJDIR)$P%s: %s $(HEADERSPRIV)\n\t$(CC) $(CFLAGS) $(INCFLAGS) $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"
554 for f
in $toolssrc ; do
555 b
="$(basename "$f" .c)\$O"
557 printf '\n$(OBJDIR)$P%s: %s $(HEADERSTOOLS)\n\t$(CC) $(CFLAGS) $(INCFLAGS) $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"
560 for f
in $testcryptosrc $testspeedsrc ; do
561 b
="$(basename "$f" .c)\$O"
563 printf '\n$(OBJDIR)$P%s: %s $(HEADERSPRIV)\n\t$(CC) $(CFLAGS) $(INCFLAGS) $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"
566 for f
in $testx509src ; do
567 b
="$(basename "$f" .c)\$O"
569 printf '\n$(OBJDIR)$P%s: %s $(HEADERSPRIV)\n\t$(CC) $(CFLAGS) $(INCFLAGS) -DSRCDIRNAME=".." $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"