xref: /freebsd/lib/libbearssl/Makefile (revision 6bfca4dcab07dad45a805879d954876b353c0810)
1
2# This is a reach over build of BearSSL (www.BearSSL.org)
3
4.include <src.opts.mk>
5
6LIB= bearssl
7
8# pick up SRCS used by libsa
9.include "Makefile.libsa.inc"
10
11SRCS+= \
12	codec/dec16be.c \
13	codec/dec16le.c \
14	codec/dec32le.c \
15	codec/dec64le.c \
16	codec/enc16be.c \
17	codec/enc16le.c \
18	codec/enc32le.c \
19	codec/enc64le.c \
20	codec/pemenc.c \
21	ec/ec_all_m15.c \
22	ec/ec_c25519_i15.c \
23	ec/ec_c25519_i31.c \
24	ec/ec_c25519_m15.c \
25	ec/ec_curve25519.c \
26	ec/ec_keygen.c \
27	ec/ec_p256_m15.c \
28	ec/ec_prime_i15.c \
29	ec/ecdsa_default_sign_asn1.c \
30	ec/ecdsa_default_sign_raw.c \
31	ec/ecdsa_default_vrfy_raw.c \
32	ec/ecdsa_i15_bits.c \
33	ec/ecdsa_i15_sign_asn1.c \
34	ec/ecdsa_i15_sign_raw.c \
35	ec/ecdsa_i15_vrfy_asn1.c \
36	ec/ecdsa_i15_vrfy_raw.c \
37	ec/ecdsa_i31_sign_asn1.c \
38	ec/ecdsa_i31_sign_raw.c \
39	ec/ecdsa_rta.c \
40	hash/dig_oid.c \
41	hash/dig_size.c \
42	hash/ghash_ctmul.c \
43	hash/ghash_ctmul32.c \
44	hash/ghash_ctmul64.c \
45	hash/ghash_pwr8.c \
46	hash/md5.c \
47	hash/md5sha1.c \
48
49
50# this one does not compile for amd64
51# we do not need it
52#	hash/ghash_pclmul.c \
53
54SRCS+= \
55	int/i15_add.c \
56	int/i15_bitlen.c \
57	int/i15_decmod.c \
58	int/i15_decode.c \
59	int/i15_decred.c \
60	int/i15_encode.c \
61	int/i15_fmont.c \
62	int/i15_iszero.c \
63	int/i15_moddiv.c \
64	int/i15_modpow.c \
65	int/i15_modpow2.c \
66	int/i15_montmul.c \
67	int/i15_mulacc.c \
68	int/i15_muladd.c \
69	int/i15_ninv15.c \
70	int/i15_reduce.c \
71	int/i15_rshift.c \
72	int/i15_sub.c \
73	int/i15_tmont.c \
74	int/i31_decred.c \
75	int/i31_mulacc.c \
76	int/i31_reduce.c \
77	int/i32_add.c \
78	int/i32_bitlen.c \
79	int/i32_decmod.c \
80	int/i32_decode.c \
81	int/i32_decred.c \
82	int/i32_encode.c \
83	int/i32_fmont.c \
84	int/i32_iszero.c \
85	int/i32_modpow.c \
86	int/i32_montmul.c \
87	int/i32_mulacc.c \
88	int/i32_muladd.c \
89	int/i32_ninv32.c \
90	int/i32_reduce.c \
91	int/i32_sub.c \
92	int/i32_tmont.c \
93
94SRCS+= \
95	kdf/hkdf.c \
96	kdf/shake.c \
97
98SRCS+= \
99	rsa/rsa_default_keygen.c \
100	rsa/rsa_default_modulus.c \
101	rsa/rsa_default_pkcs1_sign.c \
102	rsa/rsa_default_priv.c \
103	rsa/rsa_default_privexp.c \
104	rsa/rsa_default_pss_sign.c \
105	rsa/rsa_default_pss_vrfy.c \
106	rsa/rsa_default_pub.c \
107	rsa/rsa_default_pubexp.c \
108	rsa/rsa_i15_keygen.c \
109	rsa/rsa_i15_modulus.c \
110	rsa/rsa_i15_pkcs1_sign.c \
111	rsa/rsa_i15_pkcs1_vrfy.c \
112	rsa/rsa_i15_priv.c \
113	rsa/rsa_i15_privexp.c \
114	rsa/rsa_i15_pss_sign.c \
115	rsa/rsa_i15_pss_vrfy.c \
116	rsa/rsa_i15_pub.c \
117	rsa/rsa_i15_pubexp.c \
118	rsa/rsa_i31_keygen.c \
119	rsa/rsa_i31_keygen_inner.c \
120	rsa/rsa_i31_modulus.c \
121	rsa/rsa_i31_pkcs1_sign.c \
122	rsa/rsa_i31_priv.c \
123	rsa/rsa_i31_privexp.c \
124	rsa/rsa_i31_pss_sign.c \
125	rsa/rsa_i31_pss_vrfy.c \
126	rsa/rsa_i31_pubexp.c \
127	rsa/rsa_i32_pkcs1_sign.c \
128	rsa/rsa_i32_pkcs1_vrfy.c \
129	rsa/rsa_i32_priv.c \
130	rsa/rsa_i32_pss_sign.c \
131	rsa/rsa_i32_pss_vrfy.c \
132	rsa/rsa_i32_pub.c \
133	rsa/rsa_i62_keygen.c \
134	rsa/rsa_i62_pkcs1_sign.c \
135	rsa/rsa_i62_priv.c \
136	rsa/rsa_i62_pss_sign.c \
137	rsa/rsa_i62_pss_vrfy.c \
138	rsa/rsa_pkcs1_sig_pad.c \
139	rsa/rsa_pss_sig_pad.c \
140	rsa/rsa_pss_sig_unpad.c \
141	rsa/rsa_ssl_decrypt.c \
142
143SRCS+= \
144	x509/encode_ec_pk8der.c \
145	x509/encode_ec_rawder.c \
146	x509/encode_rsa_pk8der.c \
147	x509/encode_rsa_rawder.c \
148	x509/skey_decoder.c \
149	x509/x509_knownkey.c \
150	x509/x509_minimal_full.c \
151
152INCS= \
153	inc/bearssl.h \
154	inc/bearssl_aead.h \
155	inc/bearssl_block.h \
156	inc/bearssl_ec.h \
157	inc/bearssl_hash.h \
158	inc/bearssl_hmac.h \
159	inc/bearssl_kdf.h \
160	inc/bearssl_pem.h \
161	inc/bearssl_prf.h \
162	inc/bearssl_rand.h \
163	inc/bearssl_rsa.h \
164	inc/bearssl_ssl.h \
165	inc/bearssl_x509.h \
166
167INCS:= ${INCS:S,^,${BEARSSL}/,}
168
169
170.if ${MK_BEARSSL_SSL:Uno} == "yes"
171SRCS+= \
172	mac/hmac.c \
173	mac/hmac_ct.c \
174	rand/hmac_drbg.c \
175	ssl/prf.c \
176	ssl/prf_md5sha1.c \
177	ssl/prf_sha256.c \
178	ssl/prf_sha384.c \
179	ssl/ssl_ccert_single_ec.c \
180	ssl/ssl_ccert_single_rsa.c \
181	ssl/ssl_client.c \
182	ssl/ssl_client_default_rsapub.c \
183	ssl/ssl_client_full.c \
184	ssl/ssl_engine.c \
185	ssl/ssl_engine_default_aescbc.c \
186	ssl/ssl_engine_default_aesccm.c \
187	ssl/ssl_engine_default_aesgcm.c \
188	ssl/ssl_engine_default_chapol.c \
189	ssl/ssl_engine_default_descbc.c \
190	ssl/ssl_engine_default_ec.c \
191	ssl/ssl_engine_default_ecdsa.c \
192	ssl/ssl_engine_default_rsavrfy.c \
193	ssl/ssl_hashes.c \
194	ssl/ssl_hs_client.c \
195	ssl/ssl_hs_server.c \
196	ssl/ssl_io.c \
197	ssl/ssl_lru.c \
198	ssl/ssl_rec_cbc.c \
199	ssl/ssl_rec_ccm.c \
200	ssl/ssl_rec_chapol.c \
201	ssl/ssl_rec_gcm.c \
202	ssl/ssl_scert_single_ec.c \
203	ssl/ssl_scert_single_rsa.c \
204	ssl/ssl_server.c \
205	ssl/ssl_server_full_ec.c \
206	ssl/ssl_server_full_rsa.c \
207	ssl/ssl_server_mine2c.c \
208	ssl/ssl_server_mine2g.c \
209	ssl/ssl_server_minf2c.c \
210	ssl/ssl_server_minf2g.c \
211	ssl/ssl_server_minr2g.c \
212	ssl/ssl_server_minu2g.c \
213	ssl/ssl_server_minv2g.c \
214
215SRCS+= \
216	symcipher/aes_big_cbcdec.c \
217	symcipher/aes_big_cbcenc.c \
218	symcipher/aes_big_ctr.c \
219	symcipher/aes_big_dec.c \
220	symcipher/aes_big_enc.c \
221	symcipher/aes_common.c \
222	symcipher/aes_ct.c \
223	symcipher/aes_ct64.c \
224	symcipher/aes_ct64_cbcdec.c \
225	symcipher/aes_ct64_cbcenc.c \
226	symcipher/aes_ct64_ctr.c \
227	symcipher/aes_ct64_dec.c \
228	symcipher/aes_ct64_enc.c \
229	symcipher/aes_ct_cbcdec.c \
230	symcipher/aes_ct_cbcenc.c \
231	symcipher/aes_ct_ctr.c \
232	symcipher/aes_ct_dec.c \
233	symcipher/aes_ct_enc.c \
234	symcipher/aes_pwr8.c \
235	symcipher/aes_pwr8_cbcdec.c \
236	symcipher/aes_pwr8_cbcenc.c \
237	symcipher/aes_pwr8_ctr.c \
238	symcipher/aes_pwr8_ctrcbc.c \
239	symcipher/aes_small_cbcdec.c \
240	symcipher/aes_small_cbcenc.c \
241	symcipher/aes_small_ctr.c \
242	symcipher/aes_small_dec.c \
243	symcipher/aes_small_enc.c \
244	symcipher/aes_x86ni.c \
245	symcipher/aes_x86ni_cbcdec.c \
246	symcipher/aes_x86ni_cbcenc.c \
247	symcipher/aes_x86ni_ctr.c \
248	symcipher/chacha20_ct.c \
249	symcipher/des_ct.c \
250	symcipher/des_ct_cbcdec.c \
251	symcipher/des_ct_cbcenc.c \
252	symcipher/des_support.c \
253	symcipher/des_tab.c \
254	symcipher/des_tab_cbcdec.c \
255	symcipher/des_tab_cbcenc.c \
256	symcipher/poly1305_ctmul.c \
257	symcipher/poly1305_ctmul32.c \
258	symcipher/poly1305_ctmulq.c \
259	symcipher/poly1305_i15.c \
260
261.endif
262
263.include <bsd.lib.mk>
264
265.if ${MACHINE} == "host"
266CWARNFLAGS+= -Wno-error
267.endif
268XCFLAGS.gcc.rsa_i62_keygen+= -Wno-error
269XCFLAGS.i15_moddiv+= -Wno-shadow
270XCFLAGS.i31_moddiv+= -Wno-shadow
271XCFLAGS.i62_modpow2+= -Wno-cast-align
272XCFLAGS.x509_minimal+= -Wno-cast-qual
273
274CFLAGS+= ${XCFLAGS.${.TARGET:T:R}:U} \
275	${XCFLAGS.${COMPILER_TYPE}.${.TARGET:T:R}:U}
276
277