From d3c2b8425b0cdf90a9680ed97f6a144c20de9cde Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:48:41 +0200 Subject: [PATCH] feat: add set_tls_certificate wrapper function --- src/lib.c.v | 6 +----- src/lib_d_tls.v | 11 +++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 src/lib_d_tls.v diff --git a/src/lib.c.v b/src/lib.c.v index 9db378e..d2f8f19 100644 --- a/src/lib.c.v +++ b/src/lib.c.v @@ -15,11 +15,7 @@ $if macos { $if msvc { #flag -lAdvapi32 -lShell32 -lUser32 } -$if use_tls ? { - #flag -DWEBUI_USE_TLS -DWEBUI_TLS -DNO_SSL_DL -DOPENSSL_API_1_1 - #flag -lssl -lcrypto - #flag windows -lBcrypt -} $else { +$if !tls ? { #flag -DNO_SSL } $if webui_log ? { diff --git a/src/lib_d_tls.v b/src/lib_d_tls.v new file mode 100644 index 0000000..124ddda --- /dev/null +++ b/src/lib_d_tls.v @@ -0,0 +1,11 @@ +module vwebui + +#flag -DWEBUI_USE_TLS -DWEBUI_TLS -DNO_SSL_DL -DOPENSSL_API_1_1 +#flag -lssl -lcrypto +#flag windows -lBcrypt + +fn set_tls_certificate(certificate_pem string, private_key_pem string) ! { + if !C.webui_set_tls_certificate(&char(certificate_pem.str), &char(private_key_pem.str)) { + return error('Failed setting tls certificate.') + } +}