Skip to content

Commit 5c71e0f

Browse files
committed
wipe Mbed TLS
1 parent a124f5c commit 5c71e0f

File tree

4 files changed

+24
-49
lines changed

4 files changed

+24
-49
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
[submodule "vendor/nghttp2"]
2323
path = vendor/nghttp2
2424
url = https://github.com/nghttp2/nghttp2.git
25-
[submodule "vendor/mbedtls"]
26-
path = vendor/mbedtls
27-
url = https://github.com/Mbed-TLS/mbedtls.git
2825
[submodule "vendor/zlib"]
2926
path = vendor/zlib
3027
url = https://github.com/madler/zlib.git

build.zig

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ pub fn build(b: *Build) !void {
4646
b.option([]const u8, "git_commit", "Current git commit") orelse "dev",
4747
);
4848

49-
const use_boringssl = b.option(bool, "use-boringssl", "Whether use BoringSSL (default:true)") orelse true;
50-
5149
const target = b.standardTargetOptions(.{});
5250
const optimize = b.standardOptimizeOption(.{});
5351

@@ -61,7 +59,7 @@ pub fn build(b: *Build) !void {
6159
.link_libc = true,
6260
.link_libcpp = true,
6361
});
64-
try addDependencies(b, lightpanda_module, opts, use_boringssl);
62+
try addDependencies(b, lightpanda_module, opts);
6563

6664
{
6765
// browser
@@ -115,7 +113,7 @@ pub fn build(b: *Build) !void {
115113
.target = target,
116114
.optimize = optimize,
117115
});
118-
try addDependencies(b, wpt_module, opts, use_boringssl);
116+
try addDependencies(b, wpt_module, opts);
119117

120118
// compile and install
121119
const wpt = b.addExecutable(.{
@@ -153,7 +151,7 @@ pub fn build(b: *Build) !void {
153151
}
154152
}
155153

156-
fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options, use_boringssl: bool) !void {
154+
fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !void {
157155
try moduleNetSurf(b, mod);
158156
mod.addImport("build_config", opts.createModule());
159157

@@ -376,39 +374,29 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options, use
376374
mod.addCMacro("STDC_HEADERS", "1");
377375
mod.addCMacro("TIME_WITH_SYS_TIME", "1");
378376
mod.addCMacro("USE_NGHTTP2", "1");
379-
if (use_boringssl) {
380-
mod.addCMacro("USE_OPENSSL", "1");
381-
mod.addCMacro("OPENSSL_IS_BORINGSSL", "1");
382-
} else {
383-
mod.addCMacro("USE_MBEDTLS", "1");
384-
}
377+
mod.addCMacro("USE_OPENSSL", "1");
378+
mod.addCMacro("OPENSSL_IS_BORINGSSL", "1");
385379
mod.addCMacro("USE_THREADS_POSIX", "1");
386380
mod.addCMacro("USE_UNIX_SOCKETS", "1");
387381
}
388382

389383
try buildZlib(b, mod);
390384
try buildBrotli(b, mod);
391-
if (use_boringssl) {
392-
const maybe_boringssl_dep = b.lazyDependency("boringssl-zig", .{
393-
.target = target,
394-
.optimize = mod.optimize.?,
395-
.force_pic = true,
396-
});
397-
398-
if (maybe_boringssl_dep) |boringssl_dep| {
399-
const ssl = boringssl_dep.artifact("ssl");
400-
ssl.bundle_ubsan_rt = false;
401-
const crypto = boringssl_dep.artifact("crypto");
402-
crypto.bundle_ubsan_rt = false;
403-
404-
mod.linkLibrary(ssl);
405-
mod.linkLibrary(crypto);
406-
}
407-
} else {
408-
try buildMbedtls(b, mod);
409-
}
385+
const boringssl_dep = b.dependency("boringssl-zig", .{
386+
.target = target,
387+
.optimize = mod.optimize.?,
388+
.force_pic = true,
389+
});
390+
391+
const ssl = boringssl_dep.artifact("ssl");
392+
ssl.bundle_ubsan_rt = false;
393+
const crypto = boringssl_dep.artifact("crypto");
394+
crypto.bundle_ubsan_rt = false;
395+
396+
mod.linkLibrary(ssl);
397+
mod.linkLibrary(crypto);
410398
try buildNghttp2(b, mod);
411-
try buildCurl(b, mod, use_boringssl);
399+
try buildCurl(b, mod);
412400
try buildAda(b, mod);
413401

414402
switch (target.result.os.tag) {
@@ -699,7 +687,7 @@ fn buildNghttp2(b: *Build, m: *Build.Module) !void {
699687
} });
700688
}
701689

702-
fn buildCurl(b: *Build, m: *Build.Module, use_boringssl: bool) !void {
690+
fn buildCurl(b: *Build, m: *Build.Module) !void {
703691
const curl = b.addLibrary(.{
704692
.name = "curl",
705693
.root_module = m,
@@ -867,20 +855,12 @@ fn buildCurl(b: *Build, m: *Build.Module, use_boringssl: bool) !void {
867855
root ++ "lib/vauth/spnego_sspi.c",
868856
root ++ "lib/vauth/vauth.c",
869857
root ++ "lib/vtls/cipher_suite.c",
870-
root ++ "lib/vtls/vtls.c",
871-
root ++ "lib/vtls/vtls_scache.c",
872-
root ++ "lib/vtls/x509asn1.c",
873-
},
874-
});
875-
876-
curl.addCSourceFiles(.{
877-
.files = if (use_boringssl) &.{
878858
root ++ "lib/vtls/openssl.c",
879859
root ++ "lib/vtls/hostcheck.c",
880860
root ++ "lib/vtls/keylog.c",
881-
} else &.{
882-
root ++ "lib/vtls/mbedtls.c",
883-
root ++ "lib/vtls/mbedtls_threadlock.c",
861+
root ++ "lib/vtls/vtls.c",
862+
root ++ "lib/vtls/vtls_scache.c",
863+
root ++ "lib/vtls/x509asn1.c",
884864
},
885865
});
886866
}

build.zig.zon

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
.hash = "N-V-__8AAPmhFAAw64ALjlzd5YMtzpSrmZ6KymsT84BKfB4s",
1515
},
1616
.@"boringssl-zig" = .{
17-
.url = "git+https://github.com/Syndica/boringssl-zig.git#01b27c04e42cbb50173348bf2f225b2e223ef87a",
17+
.url = "git+https://github.com/Syndica/boringssl-zig.git#c53df00d06b02b755ad88bbf4d1202ed9687b096",
1818
.hash = "boringssl-0.1.0-VtJeWehMAAA4RNnwRnzEvKcS9rjsR1QVRw1uJrwXxmVK",
19-
.lazy = true,
2019
},
2120
},
2221
}

vendor/mbedtls

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)