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