summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-07-01 14:45:01 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-07-01 14:45:01 +0300
commitf10699e580b3eead1cb9c250822abbbc626eb3e3 (patch)
tree732540d8c618787c4244fc9fb6d8d8ca8fdb7e80 /src/mir_app
parent4ac1dc06f30c240089da5cdeba6cbf46cd598a1e (diff)
TLS 1.3 support:
Netlib_GetTlsUnique - new function to retrieve TLS binding data for an opened socket
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/netlib_sock.cpp17
3 files changed, 17 insertions, 2 deletions
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 608dd1e07b..0bf07ba1cc 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -740,3 +740,4 @@ Chat_CreateMenu @824 NONAME
?OnEventEdited@PROTO_INTERFACE@@UAEXII@Z @828 NONAME
?GetChecker@MDatabaseCommon@@UAGPAUMIDatabaseChecker@@XZ @829 NONAME
?GetMenuItem@PROTO_INTERFACE@@QAEPAUTMO_IntMenuItem@@W4ProtoMenuItemType@@@Z @830 NONAME
+_Netlib_GetTlsUnique@8 @831 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 2e123cd123..945587d58a 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -740,3 +740,4 @@ Chat_CreateMenu @824 NONAME
?OnEventEdited@PROTO_INTERFACE@@UEAAXII@Z @828 NONAME
?GetChecker@MDatabaseCommon@@UEAAPEAUMIDatabaseChecker@@XZ @829 NONAME
?GetMenuItem@PROTO_INTERFACE@@QEAAPEAUTMO_IntMenuItem@@W4ProtoMenuItemType@@@Z @830 NONAME
+Netlib_GetTlsUnique @831 NONAME
diff --git a/src/mir_app/src/netlib_sock.cpp b/src/mir_app/src/netlib_sock.cpp
index 2c4bfdc82a..a5f03114d0 100644
--- a/src/mir_app/src/netlib_sock.cpp
+++ b/src/mir_app/src/netlib_sock.cpp
@@ -210,9 +210,8 @@ MIR_APP_DLL(char*) Netlib_AddressToString(sockaddr_in *addr)
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Netlib_GetConnectionInfo(HNETLIBCONN hConnection, NETLIBCONNINFO *connInfo)
+MIR_APP_DLL(int) Netlib_GetConnectionInfo(HNETLIBCONN nlc, NETLIBCONNINFO *connInfo)
{
- NetlibConnection *nlc = (NetlibConnection*)hConnection;
if (!nlc || !connInfo)
return 1;
@@ -228,6 +227,20 @@ MIR_APP_DLL(int) Netlib_GetConnectionInfo(HNETLIBCONN hConnection, NETLIBCONNINF
/////////////////////////////////////////////////////////////////////////////////////////
+MIR_APP_DLL(void*) Netlib_GetTlsUnique(HNETLIBCONN nlc, int &cbLen)
+{
+ if (nlc == nullptr || nlc->hSsl == nullptr || sslApi.unique == nullptr)
+ return nullptr;
+
+ void *pBuf = sslApi.unique(nlc->hSsl, &cbLen);
+ if (pBuf == nullptr || !cbLen)
+ return nullptr;
+
+ return pBuf;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
inline bool IsAddrGlobal(const IN6_ADDR *a)
{
unsigned char High = a->s6_bytes[0] & 0xf0;