mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 12:44:45 +02:00
added missing wrappers for sni setup & frees
This commit is contained in:
@@ -147,6 +147,10 @@ namespace wolfSSL.CSharp {
|
|||||||
{
|
{
|
||||||
this.psk_cb.Free();
|
this.psk_cb.Free();
|
||||||
}
|
}
|
||||||
|
if (!Object.Equals(this.sni_cb, default(GCHandle)))
|
||||||
|
{
|
||||||
|
this.sni_cb.Free();
|
||||||
|
}
|
||||||
if (!Object.Equals(this.vrf_cb, default(GCHandle)))
|
if (!Object.Equals(this.vrf_cb, default(GCHandle)))
|
||||||
{
|
{
|
||||||
this.vrf_cb.Free();
|
this.vrf_cb.Free();
|
||||||
@@ -217,6 +221,10 @@ namespace wolfSSL.CSharp {
|
|||||||
{
|
{
|
||||||
this.psk_cb.Free();
|
this.psk_cb.Free();
|
||||||
}
|
}
|
||||||
|
if (!Object.Equals(this.sni_cb, default(GCHandle)))
|
||||||
|
{
|
||||||
|
this.sni_cb.Free();
|
||||||
|
}
|
||||||
if (!Object.Equals(this.vrf_cb, default(GCHandle)))
|
if (!Object.Equals(this.vrf_cb, default(GCHandle)))
|
||||||
{
|
{
|
||||||
this.vrf_cb.Free();
|
this.vrf_cb.Free();
|
||||||
@@ -320,6 +328,10 @@ namespace wolfSSL.CSharp {
|
|||||||
private extern static int wolfSSL_CTX_set_tlsext_servername_callback(IntPtr ctx, sni_delegate sni_cb);
|
private extern static int wolfSSL_CTX_set_tlsext_servername_callback(IntPtr ctx, sni_delegate sni_cb);
|
||||||
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||||
private extern static int wolfSSL_CTX_set_servername_arg(IntPtr ctx, IntPtr arg);
|
private extern static int wolfSSL_CTX_set_servername_arg(IntPtr ctx, IntPtr arg);
|
||||||
|
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
private extern static int wolfSSL_CTX_UseSNI(IntPtr ctx, byte type, IntPtr data, ushort size);
|
||||||
|
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
private extern static int wolfSSL_UseSNI(IntPtr ssl, byte type, IntPtr data, ushort size);
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
* SSL Structure
|
* SSL Structure
|
||||||
@@ -1114,7 +1126,8 @@ namespace wolfSSL.CSharp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CTX_set_servername_callback(IntPtr ctx, sni_delegate sni_cb) {
|
public static void CTX_set_servername_callback(IntPtr ctx, sni_delegate sni_cb)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
GCHandle gch = GCHandle.FromIntPtr(ctx);
|
GCHandle gch = GCHandle.FromIntPtr(ctx);
|
||||||
ctx_handle handles = (ctx_handle)gch.Target;
|
ctx_handle handles = (ctx_handle)gch.Target;
|
||||||
@@ -1127,7 +1140,8 @@ namespace wolfSSL.CSharp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int CTX_set_tlsext_servername_callback(IntPtr ctx, sni_delegate sni_cb) {
|
public static int CTX_set_tlsext_servername_callback(IntPtr ctx, sni_delegate sni_cb)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
GCHandle gch = GCHandle.FromIntPtr(ctx);
|
GCHandle gch = GCHandle.FromIntPtr(ctx);
|
||||||
ctx_handle handles = (ctx_handle)gch.Target;
|
ctx_handle handles = (ctx_handle)gch.Target;
|
||||||
@@ -1141,7 +1155,8 @@ namespace wolfSSL.CSharp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int CTX_set_servername_arg(IntPtr ctx, IntPtr arg) {
|
public static int CTX_set_servername_arg(IntPtr ctx, IntPtr arg)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
GCHandle gch = GCHandle.FromIntPtr(ctx);
|
GCHandle gch = GCHandle.FromIntPtr(ctx);
|
||||||
ctx_handle handles = (ctx_handle)gch.Target;
|
ctx_handle handles = (ctx_handle)gch.Target;
|
||||||
@@ -1155,6 +1170,32 @@ namespace wolfSSL.CSharp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int CTX_UseSNI(IntPtr ctx, byte type, IntPtr data, ushort size)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
GCHandle gch = GCHandle.FromIntPtr(ctx);
|
||||||
|
ctx_handle handles = (ctx_handle)gch.Target;
|
||||||
|
|
||||||
|
return wolfSSL_CTX_UseSNI(handles.get_ctx(), type, data, size);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log(ERROR_LOG, "wolfssl ctx use sni error: " + e.ToString());
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int UseSNI(IntPtr ssl, byte type, IntPtr data, ushort size)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
GCHandle gch = GCHandle.FromIntPtr(ssl);
|
||||||
|
ssl_handle handles = (ssl_handle)gch.Target;
|
||||||
|
|
||||||
|
return wolfSSL_UseSNI(handles.get_ssl(), type, data, size);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log(ERROR_LOG, "wolfssl use sni error: " + e.ToString());
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set identity hint to use
|
/// Set identity hint to use
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Reference in New Issue
Block a user