diff options
author | Esme <madewokherd@gmail.com> | 2020-07-29 15:29:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-29 15:29:48 +0300 |
commit | 9a66d68d965ba65ffa8f67b5e36e2113387d5f20 (patch) | |
tree | 8c8d37007f435d663801e485dcddd5a951ac6e40 /mcs | |
parent | 957d1942d131f0dfd46b79b3cf3f761bfb783197 (diff) |
[System] Mark BTLS callbacks as cdecl. (#19872)
Fixes crashes when BTLS is compiled for Windows x86 with Clang.
Co-authored-by: Vincent Povirk <vincent@codeweavers.com>
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/System/Mono.Btls/MonoBtlsBio.cs | 3 | ||||
-rw-r--r-- | mcs/class/System/Mono.Btls/MonoBtlsSsl.cs | 4 | ||||
-rw-r--r-- | mcs/class/System/Mono.Btls/MonoBtlsSslCtx.cs | 3 | ||||
-rw-r--r-- | mcs/class/System/Mono.Btls/MonoBtlsX509LookupMono.cs | 1 |
4 files changed, 11 insertions, 0 deletions
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsBio.cs b/mcs/class/System/Mono.Btls/MonoBtlsBio.cs index 016560fa405..df724cb3dcf 100644 --- a/mcs/class/System/Mono.Btls/MonoBtlsBio.cs +++ b/mcs/class/System/Mono.Btls/MonoBtlsBio.cs @@ -270,8 +270,11 @@ namespace Mono.Btls Flush = 1 } + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int BioReadFunc (IntPtr bio, IntPtr data, int dataLength, out int wantMore); + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int BioWriteFunc (IntPtr bio, IntPtr data, int dataLength); + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate long BioControlFunc (IntPtr bio, ControlCommand command, long arg); [DllImport (BTLS_DYLIB)] diff --git a/mcs/class/System/Mono.Btls/MonoBtlsSsl.cs b/mcs/class/System/Mono.Btls/MonoBtlsSsl.cs index 20678daa127..0497e347e45 100644 --- a/mcs/class/System/Mono.Btls/MonoBtlsSsl.cs +++ b/mcs/class/System/Mono.Btls/MonoBtlsSsl.cs @@ -32,8 +32,11 @@ using System.Runtime.CompilerServices; namespace Mono.Btls { + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int MonoBtlsVerifyCallback (MonoBtlsX509StoreCtx ctx); + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int MonoBtlsSelectCallback (string[] acceptableIssuers); + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int MonoBtlsServerNameCallback (); class MonoBtlsSsl : MonoBtlsObject @@ -259,6 +262,7 @@ namespace Mono.Btls return error; } + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int PrintErrorsCallbackFunc (IntPtr str, IntPtr len, IntPtr ctx); [Mono.Util.MonoPInvokeCallback (typeof (PrintErrorsCallbackFunc))] diff --git a/mcs/class/System/Mono.Btls/MonoBtlsSslCtx.cs b/mcs/class/System/Mono.Btls/MonoBtlsSslCtx.cs index 124370679ae..ebf40e5f932 100644 --- a/mcs/class/System/Mono.Btls/MonoBtlsSslCtx.cs +++ b/mcs/class/System/Mono.Btls/MonoBtlsSslCtx.cs @@ -93,8 +93,11 @@ namespace Mono.Btls [DllImport (BTLS_DYLIB)] extern static void mono_btls_ssl_ctx_set_server_name_callback (IntPtr handle, IntPtr func); + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int NativeVerifyFunc (IntPtr instance, int preverify_ok, IntPtr ctx); + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int NativeSelectFunc (IntPtr instance, int count, IntPtr sizes, IntPtr data); + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int NativeServerNameFunc (IntPtr instance); NativeVerifyFunc verifyFunc; diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509LookupMono.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509LookupMono.cs index a6aa983c02d..264c6bcdf2b 100644 --- a/mcs/class/System/Mono.Btls/MonoBtlsX509LookupMono.cs +++ b/mcs/class/System/Mono.Btls/MonoBtlsX509LookupMono.cs @@ -61,6 +61,7 @@ namespace Mono.Btls [DllImport (BTLS_DYLIB)] extern static int mono_btls_x509_lookup_mono_free (IntPtr handle); + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int BySubjectFunc (IntPtr instance, IntPtr name, out IntPtr x509_ptr); GCHandle gch; |