Skip to content

Commit 10c95d1

Browse files
committed
Extend interface to OpenSSL
1 parent 00fee1d commit 10c95d1

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

src/S7CommPlusDriver/OpenSSL/Native.cs

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,118 @@ public class Native
6767
public const int SSL_CLIENT_HELLO_CB = 7;
6868
public const int SSL_RETRY_VERIFY = 8;
6969

70+
public const int SSL_CTRL_GET_CLIENT_CERT_REQUEST = 9;
71+
public const int SSL_CTRL_GET_NUM_RENEGOTIATIONS = 10;
72+
public const int SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS = 11;
73+
public const int SSL_CTRL_GET_TOTAL_RENEGOTIATIONS = 12;
74+
public const int SSL_CTRL_GET_FLAGS = 13;
75+
public const int SSL_CTRL_EXTRA_CHAIN_CERT = 14;
76+
public const int SSL_CTRL_SET_MSG_CALLBACK = 15;
77+
public const int SSL_CTRL_SET_MSG_CALLBACK_ARG = 16;
78+
public const int SSL_CTRL_SET_MTU = 17;
79+
public const int SSL_CTRL_SESS_NUMBER = 20;
80+
public const int SSL_CTRL_SESS_CONNECT = 21;
81+
public const int SSL_CTRL_SESS_CONNECT_GOOD = 22;
82+
public const int SSL_CTRL_SESS_CONNECT_RENEGOTIATE = 23;
83+
public const int SSL_CTRL_SESS_ACCEPT = 24;
84+
public const int SSL_CTRL_SESS_ACCEPT_GOOD = 25;
85+
public const int SSL_CTRL_SESS_ACCEPT_RENEGOTIATE = 26;
86+
public const int SSL_CTRL_SESS_HIT = 27;
87+
public const int SSL_CTRL_SESS_CB_HIT = 28;
88+
public const int SSL_CTRL_SESS_MISSES = 29;
89+
public const int SSL_CTRL_SESS_TIMEOUTS = 30;
90+
public const int SSL_CTRL_SESS_CACHE_FULL = 31;
91+
public const int SSL_CTRL_MODE = 33;
92+
public const int SSL_CTRL_GET_READ_AHEAD = 40;
93+
public const int SSL_CTRL_SET_READ_AHEAD = 41;
94+
public const int SSL_CTRL_SET_SESS_CACHE_SIZE = 42;
95+
public const int SSL_CTRL_GET_SESS_CACHE_SIZE = 43;
96+
public const int SSL_CTRL_SET_SESS_CACHE_MODE = 44;
97+
public const int SSL_CTRL_GET_SESS_CACHE_MODE = 45;
98+
public const int SSL_CTRL_GET_MAX_CERT_LIST = 50;
99+
public const int SSL_CTRL_SET_MAX_CERT_LIST = 51;
100+
public const int SSL_CTRL_SET_MAX_SEND_FRAGMENT = 52;
101+
public const int SSL_CTRL_SET_TLSEXT_SERVERNAME_CB = 53;
102+
public const int SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG = 54;
103+
public const int SSL_CTRL_SET_TLSEXT_HOSTNAME = 55;
104+
public const int SSL_CTRL_SET_TLSEXT_DEBUG_CB = 56;
105+
public const int SSL_CTRL_SET_TLSEXT_DEBUG_ARG = 57;
106+
public const int SSL_CTRL_GET_TLSEXT_TICKET_KEYS = 58;
107+
public const int SSL_CTRL_SET_TLSEXT_TICKET_KEYS = 59;
108+
public const int SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB = 63;
109+
public const int SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG = 64;
110+
public const int SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE = 65;
111+
public const int SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS = 66;
112+
public const int SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS = 67;
113+
public const int SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS = 68;
114+
public const int SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS = 69;
115+
public const int SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP = 70;
116+
public const int SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP = 71;
117+
public const int SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB = 75;
118+
public const int SSL_CTRL_SET_SRP_VERIFY_PARAM_CB = 76;
119+
public const int SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB = 77;
120+
public const int SSL_CTRL_SET_SRP_ARG = 78;
121+
public const int SSL_CTRL_SET_TLS_EXT_SRP_USERNAME = 79;
122+
public const int SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH = 80;
123+
public const int SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD = 81;
124+
public const int DTLS_CTRL_GET_TIMEOUT = 73;
125+
public const int DTLS_CTRL_HANDLE_TIMEOUT = 74;
126+
public const int SSL_CTRL_GET_RI_SUPPORT = 76;
127+
public const int SSL_CTRL_CLEAR_MODE = 78;
128+
public const int SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB = 79;
129+
public const int SSL_CTRL_GET_EXTRA_CHAIN_CERTS = 82;
130+
public const int SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS = 83;
131+
public const int SSL_CTRL_CHAIN = 88;
132+
public const int SSL_CTRL_CHAIN_CERT = 89;
133+
public const int SSL_CTRL_GET_GROUPS = 90;
134+
public const int SSL_CTRL_SET_GROUPS = 91;
135+
public const int SSL_CTRL_SET_GROUPS_LIST = 92;
136+
public const int SSL_CTRL_GET_SHARED_GROUP = 93;
137+
public const int SSL_CTRL_SET_SIGALGS = 97;
138+
public const int SSL_CTRL_SET_SIGALGS_LIST = 98;
139+
public const int SSL_CTRL_CERT_FLAGS = 99;
140+
public const int SSL_CTRL_CLEAR_CERT_FLAGS = 100;
141+
public const int SSL_CTRL_SET_CLIENT_SIGALGS = 101;
142+
public const int SSL_CTRL_SET_CLIENT_SIGALGS_LIST = 102;
143+
public const int SSL_CTRL_GET_CLIENT_CERT_TYPES = 103;
144+
public const int SSL_CTRL_SET_CLIENT_CERT_TYPES = 104;
145+
public const int SSL_CTRL_BUILD_CERT_CHAIN = 105;
146+
public const int SSL_CTRL_SET_VERIFY_CERT_STORE = 106;
147+
public const int SSL_CTRL_SET_CHAIN_CERT_STORE = 107;
148+
public const int SSL_CTRL_GET_PEER_SIGNATURE_NID = 108;
149+
public const int SSL_CTRL_GET_PEER_TMP_KEY = 109;
150+
public const int SSL_CTRL_GET_RAW_CIPHERLIST = 110;
151+
public const int SSL_CTRL_GET_EC_POINT_FORMATS = 111;
152+
public const int SSL_CTRL_GET_CHAIN_CERTS = 115;
153+
public const int SSL_CTRL_SELECT_CURRENT_CERT = 116;
154+
public const int SSL_CTRL_SET_CURRENT_CERT = 117;
155+
public const int SSL_CTRL_SET_DH_AUTO = 118;
156+
public const int DTLS_CTRL_SET_LINK_MTU = 120;
157+
public const int DTLS_CTRL_GET_LINK_MIN_MTU = 121;
158+
public const int SSL_CTRL_GET_EXTMS_SUPPORT = 122;
159+
public const int SSL_CTRL_SET_MIN_PROTO_VERSION = 123;
160+
public const int SSL_CTRL_SET_MAX_PROTO_VERSION = 124;
161+
public const int SSL_CTRL_SET_SPLIT_SEND_FRAGMENT = 125;
162+
public const int SSL_CTRL_SET_MAX_PIPELINES = 126;
163+
public const int SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE = 127;
164+
public const int SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB = 128;
165+
public const int SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG = 129;
166+
public const int SSL_CTRL_GET_MIN_PROTO_VERSION = 130;
167+
public const int SSL_CTRL_GET_MAX_PROTO_VERSION = 131;
168+
public const int SSL_CTRL_GET_SIGNATURE_NID = 132;
169+
public const int SSL_CTRL_GET_TMP_KEY = 133;
170+
public const int SSL_CTRL_GET_NEGOTIATED_GROUP = 134;
171+
public const int SSL_CTRL_SET_RETRY_VERIFY = 136;
172+
public const int SSL_CTRL_GET_VERIFY_CERT_STORE = 137;
173+
public const int SSL_CTRL_GET_CHAIN_CERT_STORE = 138;
174+
175+
// SSL/TLS related defines useful to providers
176+
// from: prov_ssl.h
177+
public const int TLS1_VERSION = 0x0301;
178+
public const int TLS1_1_VERSION = 0x0302;
179+
public const int TLS1_2_VERSION = 0x0303;
180+
public const int TLS1_3_VERSION = 0x0304;
181+
70182
// int SSL_connect(SSL *ssl);
71183
[DllImport(SSLDLLNAME, CallingConvention = CallingConvention.Cdecl)]
72184
public static extern int SSL_connect(IntPtr ssl);
@@ -138,6 +250,10 @@ public class Native
138250
[DllImport(SSLDLLNAME, CallingConvention = CallingConvention.Cdecl)]
139251
public static extern IntPtr SSL_CTX_new(IntPtr sslMethod);
140252

253+
// int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str);
254+
[DllImport(SSLDLLNAME, CallingConvention = CallingConvention.Cdecl)]
255+
public static extern int SSL_CTX_set_ciphersuites(IntPtr ctx, string str);
256+
141257
// typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line);
142258
// void SSL_CTX_set_keylog_callback(SSL_CTX* ctx, SSL_CTX_keylog_cb_func cb);
143259
[DllImport(SSLDLLNAME, CallingConvention = CallingConvention.Cdecl)]

0 commit comments

Comments
 (0)