From 402feb568c9d829c987497e3e5f2010a0773a53a Mon Sep 17 00:00:00 2001 From: Ground0 Date: Sat, 28 Nov 2020 10:38:12 +0100 Subject: [PATCH] Add InitSimpleTLS(CA, Cert, Key, Password, TLSID) --- ltls.pbi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ltls.pbi b/ltls.pbi index 47cde36..c4cfc80 100644 --- a/ltls.pbi +++ b/ltls.pbi @@ -10,7 +10,7 @@ DeclareModule ltls Password.s EndStructure - + Declare InitSimpleTLS(CA.s, Cert.s, Key.s, Password.s, TLSID.i = 0) Declare InitTLS(*Settings.s_tls_server, TLSID.i = 0) Declare WaitTLSSocket(ServerSocket.i, TLSID.i = 0) Declare ReadTLSSocket(Connection.i, *Buffer, Length.i) @@ -95,6 +95,17 @@ Module ltls Global tls_cfg = #Null Global tls_ctx = #Null + Procedure InitSimpleTLS(CA.s, Cert.s, Key.s, Password.s, TLSID.i = 0) + Define Settings.s_tls_server + Define TLSInitReturn.i + Settings\CA = CA + Settings\Cert = Cert + Settings\Key = Key + Settings\Password = Password + TLSInitReturn = InitTLS(@Settings, TLSID) + ProcedureReturn TLSInitReturn + EndProcedure + Procedure InitTLS(*Settings.s_tls_server, TLSID.i = 0) Protected mem_ptr.i, length.i, returns.i If tls_init() <> 0 : ProcedureReturn -1 : EndIf