Add InitSimpleTLS(CA, Cert, Key, Password, TLSID)

This commit is contained in:
René Linder 2020-11-28 10:38:12 +01:00
parent 0e76942285
commit 402feb568c

View file

@ -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