xref: /freebsd/lib/libbearssl/Makefile (revision e32fecd0c2c3ee37c47ee100f169e7eb0282a873)
1# $FreeBSD$
2
3# This is a reach over build of BearSSL (www.BearSSL.org)
4
5.include <src.opts.mk>
6
7LIB= bearssl
8
9# pick up SRCS used by libsa
10.include "Makefile.libsa.inc"
11
12SRCS+= \
13	codec/dec16be.c \
14	codec/dec16le.c \
15	codec/dec32le.c \
16	codec/dec64le.c \
17	codec/enc16be.c \
18	codec/enc16le.c \
19	codec/enc32le.c \
20	codec/enc64le.c \
21	codec/pemenc.c \
22	ec/ec_all_m15.c \
23	ec/ec_c25519_i15.c \
24	ec/ec_c25519_i31.c \
25	ec/ec_c25519_m15.c \
26	ec/ec_curve25519.c \
27	ec/ec_keygen.c \
28	ec/ec_p256_m15.c \
29	ec/ec_prime_i15.c \
30	ec/ecdsa_default_sign_asn1.c \
31	ec/ecdsa_default_sign_raw.c \
32	ec/ecdsa_default_vrfy_raw.c \
33	ec/ecdsa_i15_bits.c \
34	ec/ecdsa_i15_sign_asn1.c \
35	ec/ecdsa_i15_sign_raw.c \
36	ec/ecdsa_i15_vrfy_asn1.c \
37	ec/ecdsa_i15_vrfy_raw.c \
38	ec/ecdsa_i31_sign_asn1.c \
39	ec/ecdsa_i31_sign_raw.c \
40	ec/ecdsa_rta.c \
41	hash/dig_oid.c \
42	hash/dig_size.c \
43	hash/ghash_ctmul.c \
44	hash/ghash_ctmul32.c \
45	hash/ghash_ctmul64.c \
46	hash/ghash_pwr8.c \
47	hash/md5.c \
48	hash/md5sha1.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
153INCS= \
154	inc/bearssl.h \
155	inc/bearssl_aead.h \
156	inc/bearssl_block.h \
157	inc/bearssl_ec.h \
158	inc/bearssl_hash.h \
159	inc/bearssl_hmac.h \
160	inc/bearssl_kdf.h \
161	inc/bearssl_pem.h \
162	inc/bearssl_prf.h \
163	inc/bearssl_rand.h \
164	inc/bearssl_rsa.h \
165	inc/bearssl_ssl.h \
166	inc/bearssl_x509.h \
167
168INCS:= ${INCS:S,^,${BEARSSL}/,}
169
170
171.if ${MK_BEARSSL_SSL:Uno} == "yes"
172SRCS+= \
173	mac/hmac.c \
174	mac/hmac_ct.c \
175	rand/hmac_drbg.c \
176	ssl/prf.c \
177	ssl/prf_md5sha1.c \
178	ssl/prf_sha256.c \
179	ssl/prf_sha384.c \
180	ssl/ssl_ccert_single_ec.c \
181	ssl/ssl_ccert_single_rsa.c \
182	ssl/ssl_client.c \
183	ssl/ssl_client_default_rsapub.c \
184	ssl/ssl_client_full.c \
185	ssl/ssl_engine.c \
186	ssl/ssl_engine_default_aescbc.c \
187	ssl/ssl_engine_default_aesccm.c \
188	ssl/ssl_engine_default_aesgcm.c \
189	ssl/ssl_engine_default_chapol.c \
190	ssl/ssl_engine_default_descbc.c \
191	ssl/ssl_engine_default_ec.c \
192	ssl/ssl_engine_default_ecdsa.c \
193	ssl/ssl_engine_default_rsavrfy.c \
194	ssl/ssl_hashes.c \
195	ssl/ssl_hs_client.c \
196	ssl/ssl_hs_server.c \
197	ssl/ssl_io.c \
198	ssl/ssl_lru.c \
199	ssl/ssl_rec_cbc.c \
200	ssl/ssl_rec_ccm.c \
201	ssl/ssl_rec_chapol.c \
202	ssl/ssl_rec_gcm.c \
203	ssl/ssl_scert_single_ec.c \
204	ssl/ssl_scert_single_rsa.c \
205	ssl/ssl_server.c \
206	ssl/ssl_server_full_ec.c \
207	ssl/ssl_server_full_rsa.c \
208	ssl/ssl_server_mine2c.c \
209	ssl/ssl_server_mine2g.c \
210	ssl/ssl_server_minf2c.c \
211	ssl/ssl_server_minf2g.c \
212	ssl/ssl_server_minr2g.c \
213	ssl/ssl_server_minu2g.c \
214	ssl/ssl_server_minv2g.c \
215
216SRCS+= \
217	symcipher/aes_big_cbcdec.c \
218	symcipher/aes_big_cbcenc.c \
219	symcipher/aes_big_ctr.c \
220	symcipher/aes_big_dec.c \
221	symcipher/aes_big_enc.c \
222	symcipher/aes_common.c \
223	symcipher/aes_ct.c \
224	symcipher/aes_ct64.c \
225	symcipher/aes_ct64_cbcdec.c \
226	symcipher/aes_ct64_cbcenc.c \
227	symcipher/aes_ct64_ctr.c \
228	symcipher/aes_ct64_dec.c \
229	symcipher/aes_ct64_enc.c \
230	symcipher/aes_ct_cbcdec.c \
231	symcipher/aes_ct_cbcenc.c \
232	symcipher/aes_ct_ctr.c \
233	symcipher/aes_ct_dec.c \
234	symcipher/aes_ct_enc.c \
235	symcipher/aes_pwr8.c \
236	symcipher/aes_pwr8_cbcdec.c \
237	symcipher/aes_pwr8_cbcenc.c \
238	symcipher/aes_pwr8_ctr.c \
239	symcipher/aes_pwr8_ctrcbc.c \
240	symcipher/aes_small_cbcdec.c \
241	symcipher/aes_small_cbcenc.c \
242	symcipher/aes_small_ctr.c \
243	symcipher/aes_small_dec.c \
244	symcipher/aes_small_enc.c \
245	symcipher/aes_x86ni.c \
246	symcipher/aes_x86ni_cbcdec.c \
247	symcipher/aes_x86ni_cbcenc.c \
248	symcipher/aes_x86ni_ctr.c \
249	symcipher/chacha20_ct.c \
250	symcipher/des_ct.c \
251	symcipher/des_ct_cbcdec.c \
252	symcipher/des_ct_cbcenc.c \
253	symcipher/des_support.c \
254	symcipher/des_tab.c \
255	symcipher/des_tab_cbcdec.c \
256	symcipher/des_tab_cbcenc.c \
257	symcipher/poly1305_ctmul.c \
258	symcipher/poly1305_ctmul32.c \
259	symcipher/poly1305_ctmulq.c \
260	symcipher/poly1305_i15.c \
261
262.endif
263
264.include <bsd.lib.mk>
265
266.if ${MACHINE} == "host"
267CWARNFLAGS+= -Wno-error
268.endif
269XCFLAGS.gcc.rsa_i62_keygen+= -Wno-error
270XCFLAGS.i15_moddiv+= -Wno-shadow
271XCFLAGS.i31_moddiv+= -Wno-shadow
272XCFLAGS.i62_modpow2+= -Wno-cast-align
273XCFLAGS.x509_minimal+= -Wno-cast-qual
274
275CFLAGS+= ${XCFLAGS.${.TARGET:T:R}:U} \
276	${XCFLAGS.${COMPILER_TYPE}.${.TARGET:T:R}:U}
277
278