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