140 lines
3.7 KiB
Zig
140 lines
3.7 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn create(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) *std.Build.Step.Compile {
|
|
const lib = b.addStaticLibrary(.{
|
|
.name = "mbedtls",
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
lib.linkLibC();
|
|
|
|
const mbedtls_dep = b.dependency("mbedtls", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
lib.addCSourceFiles(.{
|
|
.root = mbedtls_dep.path(""),
|
|
.files = srcs,
|
|
.flags = &.{"-std=c99"},
|
|
});
|
|
|
|
lib.addIncludePath(mbedtls_dep.path("include"));
|
|
lib.addIncludePath(mbedtls_dep.path("library"));
|
|
lib.installHeadersDirectory(mbedtls_dep.path("include/mbedtls"), "mbedtls", .{});
|
|
lib.installHeadersDirectory(mbedtls_dep.path("include/psa"), "psa", .{});
|
|
|
|
return lib;
|
|
}
|
|
|
|
const srcs = &.{
|
|
"library/x509write_csr.c",
|
|
"library/x509write_crt.c",
|
|
"library/x509write.c",
|
|
"library/x509_csr.c",
|
|
"library/x509_crt.c",
|
|
"library/x509_crl.c",
|
|
"library/x509_create.c",
|
|
"library/x509.c",
|
|
"library/version_features.c",
|
|
"library/version.c",
|
|
"library/timing.c",
|
|
"library/threading.c",
|
|
"library/ssl_tls13_server.c",
|
|
"library/ssl_tls13_keys.c",
|
|
"library/ssl_tls13_generic.c",
|
|
"library/ssl_tls13_client.c",
|
|
"library/ssl_tls12_server.c",
|
|
"library/ssl_tls12_client.c",
|
|
"library/ssl_tls.c",
|
|
"library/ssl_ticket.c",
|
|
"library/ssl_msg.c",
|
|
"library/ssl_debug_helpers_generated.c",
|
|
"library/ssl_cookie.c",
|
|
"library/ssl_client.c",
|
|
"library/ssl_ciphersuites.c",
|
|
"library/ssl_cache.c",
|
|
"library/sha512.c",
|
|
"library/sha3.c",
|
|
"library/sha256.c",
|
|
"library/sha1.c",
|
|
"library/rsa_alt_helpers.c",
|
|
"library/rsa.c",
|
|
"library/ripemd160.c",
|
|
"library/psa_util.c",
|
|
"library/psa_its_file.c",
|
|
"library/psa_crypto_storage.c",
|
|
"library/psa_crypto_slot_management.c",
|
|
"library/psa_crypto_se.c",
|
|
"library/psa_crypto_rsa.c",
|
|
"library/psa_crypto_pake.c",
|
|
"library/psa_crypto_mac.c",
|
|
"library/psa_crypto_hash.c",
|
|
"library/psa_crypto_ffdh.c",
|
|
"library/psa_crypto_ecp.c",
|
|
"library/psa_crypto_driver_wrappers_no_static.c",
|
|
"library/psa_crypto_client.c",
|
|
"library/psa_crypto_cipher.c",
|
|
"library/psa_crypto_aead.c",
|
|
"library/psa_crypto.c",
|
|
"library/poly1305.c",
|
|
"library/platform_util.c",
|
|
"library/platform.c",
|
|
"library/pkwrite.c",
|
|
"library/pkparse.c",
|
|
"library/pkcs7.c",
|
|
"library/pkcs5.c",
|
|
"library/pkcs12.c",
|
|
"library/pk_wrap.c",
|
|
"library/pk_ecc.c",
|
|
"library/pk.c",
|
|
"library/pem.c",
|
|
"library/padlock.c",
|
|
"library/oid.c",
|
|
"library/nist_kw.c",
|
|
"library/net_sockets.c",
|
|
"library/mps_trace.c",
|
|
"library/mps_reader.c",
|
|
"library/memory_buffer_alloc.c",
|
|
"library/md5.c",
|
|
"library/md.c",
|
|
"library/lms.c",
|
|
"library/lmots.c",
|
|
"library/hmac_drbg.c",
|
|
"library/hkdf.c",
|
|
"library/gcm.c",
|
|
"library/error.c",
|
|
"library/entropy_poll.c",
|
|
"library/entropy.c",
|
|
"library/ecp_curves_new.c",
|
|
"library/ecp_curves.c",
|
|
"library/ecp.c",
|
|
"library/ecjpake.c",
|
|
"library/ecdsa.c",
|
|
"library/ecdh.c",
|
|
"library/dhm.c",
|
|
"library/des.c",
|
|
"library/debug.c",
|
|
"library/ctr_drbg.c",
|
|
"library/constant_time.c",
|
|
"library/cmac.c",
|
|
"library/cipher_wrap.c",
|
|
"library/cipher.c",
|
|
"library/chachapoly.c",
|
|
"library/chacha20.c",
|
|
"library/ccm.c",
|
|
"library/camellia.c",
|
|
"library/block_cipher.c",
|
|
"library/bignum_mod_raw.c",
|
|
"library/bignum_mod.c",
|
|
"library/bignum_core.c",
|
|
"library/bignum.c",
|
|
"library/base64.c",
|
|
"library/asn1write.c",
|
|
"library/asn1parse.c",
|
|
"library/aria.c",
|
|
"library/aesni.c",
|
|
"library/aesce.c",
|
|
"library/aes.c",
|
|
};
|