[bcl] Move a few types from the Facades into the framework for netstandard20 compatibility
# We rely on signed overflow to behave
CFLAGS="$CFLAGS -fwrapv"
- # We rely on zero length arrays in structs
- CFLAGS="$CFLAGS -Wno-zero-length-array"
-
CFLAGS="$CFLAGS -DMONO_DLL_EXPORT"
if test x"$disable_visibility_hidden" = xno; then
# Don't export any symbols by default
# https://bugzilla.samba.org/show_bug.cgi?id=8118
WARN="$WARN -Qunused-arguments"
WARN="$WARN -Wno-unused-function -Wno-tautological-compare -Wno-parentheses-equality -Wno-self-assign -Wno-return-stack-address -Wno-constant-logical-operand"
+ # We rely on zero length arrays in structs
+ WARN="$WARN -Wno-zero-length-array"
fi
else
# The Sun Forte compiler complains about inline functions that access static variables
AC_ARG_ENABLE(btls, [ --disable-btls Disable the BoringTls provider], enable_btls=$enableval, enable_btls=$BTLS_SUPPORTED)
AC_ARG_WITH(btls_android_ndk, [ --with-btls-android-ndk Android NDK for BoringTls])
+AC_ARG_ENABLE(dynamic-btls, [ --enable-dynamic-btls Place the BTLS provider into a separate shared library/archive.], enable_dynamic_btls=$enableval, enable_dynamic_btls=no)
+
AM_CONDITIONAL(BTLS, test x$enable_btls = xyes)
+AM_CONDITIONAL(DYNAMIC_BTLS, test x$enable_dynamic_btls = xyes)
btls_android=no
if test "x$enable_btls" = "xyes"; then
AC_SUBST(BTLS_CMAKE_ARGS)
AC_DEFINE(HAVE_BTLS, 1, [BoringTls is supported])
+
+ if test "x$enable_dynamic_btls" = "xyes"; then
+ AC_DEFINE(HAVE_DYNAMIC_BTLS, 1, [BTLS in a shared libraty])
+ fi
else
enable_btls=no
fi
echo "AOT_BUILD_FLAGS=$AOT_BUILD_FLAGS" >> $srcdir/$mcsdir/build/config.make
fi
+ if test "x$enable_dynamic_btls" = "xyes"; then
+ echo "DYNAMIC_BTLS=1" >> $srcdir/$mcsdir/build/config.make
+ fi
fi
)
<dllmap dll="oci" target="libclntsh@libsuffix@" os="!windows"/>
<dllmap dll="db2cli" target="libdb2_36@libsuffix@" os="!windows"/>
<dllmap dll="MonoPosixHelper" target="$mono_libdir/libMonoPosixHelper@libsuffix@" os="!windows" />
+ <dllmap dll="libmono-btls-shared" target="$mono_libdir/libmono-btls-shared@libsuffix@" os="!windows" />
<dllmap dll="i:msvcrt" target="@LIBC@" os="!windows"/>
<dllmap dll="i:msvcrt.dll" target="@LIBC@" os="!windows"/>
<dllmap dll="sqlite" target="@SQLITE@" os="!windows"/>
LIB_MCS_FLAGS = -nowarn:618 -d:CONFIGURATION_2_0 $(REFERENCE_SOURCES_FLAGS) -unsafe $(RESOURCE_FILES:%=-resource:%)
+ifdef DYNAMIC_BTLS
+LIB_MCS_FLAGS += -d:DYNAMIC_BTLS
+endif
+
ifndef NO_THREAD_ABORT
REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_THREAD_ABORT
TEST_MCS_FLAGS += -d:MONO_FEATURE_THREAD_ABORT
return MonoBtlsBioMono.CreateStream (stream, false);
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_bio_read (IntPtr bio, IntPtr data, int len);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_bio_write (IntPtr bio, IntPtr data, int len);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_bio_flush (IntPtr bio);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_bio_indent (IntPtr bio, uint indent, uint max_indent);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_bio_hexdump (IntPtr bio, IntPtr data, int len, uint indent);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_bio_print_errors (IntPtr bio);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_bio_free (IntPtr handle);
public int Read (byte[] buffer, int offset, int size)
class MonoBtlsBioMemory : MonoBtlsBio
{
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_bio_mem_new ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_bio_mem_get_data (IntPtr handle, out IntPtr data);
public MonoBtlsBioMemory ()
delegate int BioWriteFunc (IntPtr bio, IntPtr data, int dataLength);
delegate long BioControlFunc (IntPtr bio, ControlCommand command, long arg);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_bio_mono_new ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_bio_mono_initialize (IntPtr handle, IntPtr instance, IntPtr readFunc, IntPtr writeFunc, IntPtr controlFunc);
long Control (ControlCommand command, long arg)
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-// #if SECURITY_DEP
+#if SECURITY_DEP
using System;
using System.IO;
using System.Text;
{
static class MonoBtlsError
{
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (MonoBtlsObject.BTLS_DYLIB)]
extern static int mono_btls_error_peek_error ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (MonoBtlsObject.BTLS_DYLIB)]
extern static int mono_btls_error_get_error ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (MonoBtlsObject.BTLS_DYLIB)]
extern static void mono_btls_error_clear_error ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (MonoBtlsObject.BTLS_DYLIB)]
extern static void mono_btls_error_get_error_string_n (int error, IntPtr buf, int len);
public static int PeekError ()
}
}
}
-// #endif
+#endif
}
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_key_free (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_key_up_ref (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_key_get_bytes (IntPtr handle, out IntPtr data, out int size, int include_private_bits);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_key_get_bits (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_key_is_rsa (IntPtr handle);
new internal BoringKeyHandle Handle {
{
abstract class MonoBtlsObject : IDisposable
{
+#if DYNAMIC_BTLS
+ internal const string BTLS_DYLIB = "libmono-btls-shared";
+#else
+ internal const string BTLS_DYLIB = "__Internal";
+#endif
+
internal MonoBtlsObject (MonoBtlsHandle handle)
{
this.handle = handle;
CheckError (ret == 1, callerName);
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_free (IntPtr data);
protected void FreeDataPtr (IntPtr data)
get { return (BoringPkcs12Handle)base.Handle; }
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_pkcs12_free (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_pkcs12_new ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_pkcs12_get_count (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_pkcs12_get_cert (IntPtr Handle, int index);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_pkcs12_add_cert (IntPtr chain, IntPtr x509);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern unsafe static int mono_btls_pkcs12_import (IntPtr chain, void* data, int len, IntPtr password);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_pkcs12_has_private_key (IntPtr pkcs12);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_pkcs12_get_private_key (IntPtr pkcs12);
internal MonoBtlsPkcs12 ()
}
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_destroy (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_ssl_new (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_use_certificate (IntPtr handle, IntPtr x509);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_use_private_key (IntPtr handle, IntPtr key);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_add_chain_certificate (IntPtr handle, IntPtr x509);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_accept (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_connect (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_handshake (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_close (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_set_bio (IntPtr handle, IntPtr bio);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_read (IntPtr handle, IntPtr data, int len);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_write (IntPtr handle, IntPtr data, int len);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_get_error (IntPtr handle, int ret_code);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_get_version (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_set_min_version (IntPtr handle, int version);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_set_max_version (IntPtr handle, int version);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_get_cipher (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_get_ciphers (IntPtr handle, out IntPtr data);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_ssl_get_peer_certificate (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_set_cipher_list (IntPtr handle, IntPtr str);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_print_errors_cb (IntPtr func, IntPtr ctx);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_set_verify_param (IntPtr handle, IntPtr param);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_set_server_name (IntPtr handle, IntPtr name);
static BoringSslHandle Create_internal (MonoBtlsSslCtx ctx)
get { return (BoringSslCtxHandle)base.Handle; }
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_ssl_ctx_new ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_ctx_free (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_ssl_ctx_up_ref (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_ctx_initialize (IntPtr handle, IntPtr instance);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_ctx_set_debug_bio (IntPtr handle, IntPtr bio);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_ctx_set_cert_verify_callback (IntPtr handle, IntPtr func, int cert_required);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_ctx_set_cert_select_callback (IntPtr handle, IntPtr func);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_ctx_set_min_version (IntPtr handle, int version);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_ctx_set_max_version (IntPtr handle, int version);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_ctx_is_cipher_supported (IntPtr handle, short value);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_ctx_set_ciphers (IntPtr handle, int count, IntPtr data, int allow_unsupported);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_ctx_set_verify_param (IntPtr handle, IntPtr param);
delegate int NativeVerifyFunc (IntPtr instance, int preverify_ok, IntPtr ctx);
{
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_up_ref (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_from_data (IntPtr data, int len, MonoBtlsX509Format format);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_get_subject_name (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_get_issuer_name (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_get_subject_name_string (IntPtr handle, IntPtr buffer, int size);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_get_issuer_name_string (IntPtr handle, IntPtr buffer, int size);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_get_raw_data (IntPtr handle, IntPtr bio, MonoBtlsX509Format format);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_cmp (IntPtr a, IntPtr b);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_get_hash (IntPtr handle, out IntPtr data);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static long mono_btls_x509_get_not_before (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static long mono_btls_x509_get_not_after (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_get_public_key (IntPtr handle, IntPtr bio);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_get_serial_number (IntPtr handle, IntPtr data, int size, int mono_style);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_get_version (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_get_signature_algorithm (IntPtr handle, IntPtr buffer, int size);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_get_public_key_asn1 (IntPtr handle, IntPtr oid, int oid_size, out IntPtr data, out int size);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_get_public_key_parameters (IntPtr handle, IntPtr oid, int oid_size, out IntPtr data, out int size);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_get_pubkey (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_get_subject_key_identifier (IntPtr handle, out IntPtr data, out int size);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_print (IntPtr handle, IntPtr bio);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_free (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_dup (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_add_trust_object (IntPtr handle, MonoBtlsX509Purpose purpose);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_add_reject_object (IntPtr handle, MonoBtlsX509Purpose purpose);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_add_explicit_trust (IntPtr handle, MonoBtlsX509TrustKind kind);
internal MonoBtlsX509 Copy ()
get { return (BoringX509ChainHandle)base.Handle; }
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_chain_new ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_chain_get_count (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_chain_get_cert (IntPtr Handle, int index);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_chain_add_cert (IntPtr chain, IntPtr x509);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_chain_up_ref (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_chain_free (IntPtr handle);
public MonoBtlsX509Chain ()
{
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_crl_ref (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_crl_from_data (IntPtr data, int len, MonoBtlsX509Format format);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_crl_get_by_cert (IntPtr handle, IntPtr x509);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
unsafe extern static IntPtr mono_btls_x509_crl_get_by_serial (IntPtr handle, void *serial, int len);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_crl_get_revoked_count (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_crl_get_revoked (IntPtr handle, int index);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static long mono_btls_x509_crl_get_last_update (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static long mono_btls_x509_crl_get_next_update (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static long mono_btls_x509_crl_get_version (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_crl_get_issuer (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_crl_free (IntPtr handle);
public static MonoBtlsX509Crl LoadFromData (byte[] buffer, MonoBtlsX509Format format)
get { return (BoringX509LookupHandle)base.Handle; }
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_lookup_new (IntPtr store, MonoBtlsX509LookupType type);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_lookup_load_file (IntPtr handle, IntPtr file, MonoBtlsX509FileType type);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_lookup_add_dir (IntPtr handle, IntPtr dir, MonoBtlsX509FileType type);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_lookup_add_mono (IntPtr handle, IntPtr monoLookup);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_lookup_method_mono_init (
IntPtr handle, IntPtr instance, IntPtr by_subject_func);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_lookup_init (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_lookup_shutdown (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_lookup_by_subject (IntPtr handle, IntPtr name);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_lookup_by_fingerprint (IntPtr handle, IntPtr bytes, int len);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_lookup_free (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_lookup_peek_lookup (IntPtr handle);
MonoBtlsX509LookupType type;
get { return (BoringX509LookupMonoHandle)base.Handle; }
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_lookup_mono_new ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_lookup_mono_init (
IntPtr handle, IntPtr instance, IntPtr by_subject_func);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_lookup_mono_free (IntPtr handle);
delegate int BySubjectFunc (IntPtr instance, IntPtr name, out IntPtr x509_ptr);
}
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_name_print_bio (IntPtr handle, IntPtr bio);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_name_print_string (IntPtr handle, IntPtr buffer, int size);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_name_get_raw_data (IntPtr handle, out IntPtr buffer, int use_canon_enc);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static long mono_btls_x509_name_hash (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static long mono_btls_x509_name_hash_old (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_name_get_entry_count (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static MonoBtlsX509NameEntryType mono_btls_x509_name_get_entry_type (IntPtr name, int index);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_name_get_entry_oid (IntPtr name, int index, IntPtr buffer, int size);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_name_get_entry_oid_data (IntPtr name, int index, out IntPtr data);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_name_get_entry_value (IntPtr name, int index, out int tag, out IntPtr str);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern unsafe static IntPtr mono_btls_x509_name_from_data (void* data, int len, int use_canon_enc);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_name_free (IntPtr handle);
new internal BoringX509NameHandle Handle {
}
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_name_list_new ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_name_list_get_count (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_name_list_add (IntPtr handle, IntPtr name);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_name_list_get_item (IntPtr handle, int index);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_name_list_free (IntPtr handle);
new internal BoringX509NameListHandle Handle {
{
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_revoked_get_serial_number (IntPtr handle, IntPtr data, int size);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static long mono_btls_x509_revoked_get_revocation_date (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_revoked_get_reason (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_revoked_get_sequence (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_revoked_free (IntPtr handle);
public byte[] GetSerialNumber ()
get { return (BoringX509StoreHandle)base.Handle; }
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_new ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_from_ctx (IntPtr ctx);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_from_ssl_ctx (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_store_load_locations (IntPtr handle, IntPtr file, IntPtr path);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_store_set_default_paths (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_store_add_cert (IntPtr handle, IntPtr x509);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_store_get_count (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_store_free (IntPtr handle);
Dictionary<IntPtr,MonoBtlsX509Lookup> lookupHash;
get { return (BoringX509StoreCtxHandle)base.Handle; }
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_ctx_new ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_ctx_from_ptr (IntPtr ctx);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static MonoBtlsX509Error mono_btls_x509_store_ctx_get_error (IntPtr handle, out IntPtr error_string);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_store_ctx_get_error_depth (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_ctx_get_chain (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_store_ctx_init (IntPtr handle, IntPtr store, IntPtr chain);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_store_ctx_set_param (IntPtr handle, IntPtr param);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_store_ctx_verify_cert (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_ctx_get_by_subject (IntPtr handle, IntPtr name);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_ctx_get_current_cert (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_ctx_get_current_issuer (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_ctx_get_verify_param (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_ctx_get_untrusted (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_store_ctx_up_ref (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_store_ctx_free (IntPtr handle);
internal MonoBtlsX509StoreCtx ()
get { return (BoringX509VerifyParamHandle)base.Handle; }
}
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_verify_param_new ();
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_verify_param_copy (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_verify_param_lookup (IntPtr name);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_verify_param_can_modify (IntPtr param);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_verify_param_set_name (IntPtr handle, IntPtr name);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_verify_param_set_host (IntPtr handle, IntPtr name, int namelen);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_verify_param_add_host (IntPtr handle, IntPtr name, int namelen);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static ulong mono_btls_x509_verify_param_get_flags (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_verify_param_set_flags (IntPtr handle, ulong flags);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static MonoBtlsX509VerifyFlags mono_btls_x509_verify_param_get_mono_flags (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_verify_param_set_mono_flags (IntPtr handle, MonoBtlsX509VerifyFlags flags);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_verify_param_set_purpose (IntPtr handle, MonoBtlsX509Purpose purpose);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_verify_param_get_depth (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_verify_param_set_depth (IntPtr handle, int depth);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static int mono_btls_x509_verify_param_set_time (IntPtr handle, long time);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static IntPtr mono_btls_x509_verify_param_get_peername (IntPtr handle);
- [MethodImpl (MethodImplOptions.InternalCall)]
+ [DllImport (BTLS_DYLIB)]
extern static void mono_btls_x509_verify_param_free (IntPtr handle);
internal MonoBtlsX509VerifyParam ()
<Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\ucomienumconnections.cs" />\r
<Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\unknownwrapper.cs" />\r
<Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\variantWrapper.cs" />\r
+ <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\attributes.cs" />\r
+ <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\eventregistrationtoken.cs" />\r
+ <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\eventregistrationtokentable.cs" />\r
+ <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\iactivationfactory.cs" />\r
+ <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\irestrictederrorinfo.cs" />\r
+ <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\windowsruntimemarshal.cs" />\r
<Compile Include="..\referencesource\mscorlib\system\runtime\NgenServicingAttributes.cs" />\r
<Compile Include="..\referencesource\mscorlib\system\runtime\remoting\callcontext.cs" />\r
<Compile Include="..\referencesource\mscorlib\system\runtime\serialization\deserializationeventhandler.cs" />\r
<Compile Include="System.Runtime.CompilerServices\RuntimeHelpers.cs" />\r
<Compile Include="System.Runtime.Hosting\ActivationArguments.cs" />\r
<Compile Include="System.Runtime.Hosting\ApplicationActivator.cs" />\r
- <Compile Include="System.Runtime.InteropServices.WindowsRuntime\DefaultInterfaceAttribute.cs" />\r
<Compile Include="System.Runtime.InteropServices.WindowsRuntime\DesignerNamespaceResolveEventArgs.cs" />\r
- <Compile Include="System.Runtime.InteropServices.WindowsRuntime\EventRegistrationToken.cs" />\r
- <Compile Include="System.Runtime.InteropServices.WindowsRuntime\EventRegistrationTokenTable.cs" />\r
- <Compile Include="System.Runtime.InteropServices.WindowsRuntime\IActivationFactory.cs" />\r
- <Compile Include="System.Runtime.InteropServices.WindowsRuntime\InterfaceImplementedInVersionAttribute.cs" />\r
<Compile Include="System.Runtime.InteropServices.WindowsRuntime\NamespaceResolveEventArgs.cs" />\r
- <Compile Include="System.Runtime.InteropServices.WindowsRuntime\ReadOnlyArrayAttribute.cs" />\r
- <Compile Include="System.Runtime.InteropServices.WindowsRuntime\ReturnValueNameAttribute.cs" />\r
- <Compile Include="System.Runtime.InteropServices.WindowsRuntime\WindowsRuntimeMarshal.cs" />\r
+ <Compile Include="System.Runtime.InteropServices.WindowsRuntime\UnsafeNativeMethods.cs" />\r
<Compile Include="System.Runtime.InteropServices.WindowsRuntime\WindowsRuntimeMetadata.cs" />\r
- <Compile Include="System.Runtime.InteropServices.WindowsRuntime\WriteOnlyArrayAttribute.cs" />\r
<Compile Include="System.Runtime.InteropServices\_Activator.cs" />\r
<Compile Include="System.Runtime.InteropServices\_Assembly.cs" />\r
<Compile Include="System.Runtime.InteropServices\_AssemblyBuilder.cs" />\r
${BORINGSSL_OBJECTS}
)
-if (BUILD_SHARED_LIBS)
+if (BUILD_DYNAMIC_BTLS)
+ add_library (mono-btls-shared SHARED ${MONO_BTLS_SOURCES})
+elseif (BUILD_SHARED_LIBS)
add_library (mono-btls-shared SHARED ${MONO_BTLS_SOURCES})
set_target_properties (mono-btls-shared PROPERTIES RULE_LAUNCH_LINK
- "${PROJECT_SOURCE_DIR}/create-object-library.sh ${CMAKE_BINARY_DIR} mono-btls-shared.txt mono-btls-shared-lo.txt libmono-btls-shared.a shared ${CMAKE_AR} ${CMAKE_RANLIB} <OBJECTS> --"
+ "${PROJECT_SOURCE_DIR}/create-object-library.sh ${CMAKE_BINARY_DIR} mono-btls-shared.txt mono-btls-shared-lo.txt libmono-btls-shared.a shared ${CMAKE_AR} ${CMAKE_RANLIB} <OBJECTS> --"
)
else ()
add_library (mono-btls-static STATIC ${MONO_BTLS_SOURCES})
all-local: $(BTLS_STATIC_LIST) $(BTLS_SHARED_LIST)
+if DYNAMIC_BTLS
+build-shared/Makefile:
+ -mkdir -p build-shared
+ (cd build-shared && $(CMAKE) $(CMAKE_ARGS) $(BTLS_CMAKE_ARGS) -DBUILD_DYNAMIC_BTLS=1 $(abs_top_srcdir)/mono/btls)
+else
build-shared/Makefile:
-mkdir -p build-shared
(cd build-shared && $(CMAKE) $(CMAKE_ARGS) $(BTLS_CMAKE_ARGS) -DBUILD_SHARED_LIBS=1 $(abs_top_srcdir)/mono/btls)
+endif
build-static/Makefile:
-mkdir -p build-static
NULL, NULL, mono_ctrl, mono_new, mono_free, NULL
};
-BIO *
+MONO_API BIO *
mono_btls_bio_mono_new (void)
{
BIO *bio;
return bio;
}
-void
+MONO_API void
mono_btls_bio_mono_initialize (BIO *bio, const void *instance,
MonoBtlsReadFunc read_func, MonoBtlsWriteFunc write_func,
MonoBtlsControlFunc control_func)
bio->init = 1;
}
-int
+MONO_API int
mono_btls_bio_read (BIO *bio, void *data, int len)
{
return BIO_read (bio, data, len);
}
-int
+MONO_API int
mono_btls_bio_write (BIO *bio, const void *data, int len)
{
return BIO_write (bio, data, len);
}
-int
+MONO_API int
mono_btls_bio_flush (BIO *bio)
{
return BIO_flush (bio);
}
-int
+MONO_API int
mono_btls_bio_indent (BIO *bio, unsigned indent, unsigned max_indent)
{
return BIO_indent (bio, indent, max_indent);
}
-int
+MONO_API int
mono_btls_bio_hexdump (BIO *bio, const uint8_t *data, int len, unsigned indent)
{
return BIO_hexdump (bio, data, len, indent);
}
-void
+MONO_API void
mono_btls_bio_print_errors (BIO *bio)
{
BIO_print_errors (bio);
}
-void
+MONO_API void
mono_btls_bio_free (BIO *bio)
{
BIO_free (bio);
}
-BIO *
+MONO_API BIO *
mono_btls_bio_mem_new (void)
{
return BIO_new (BIO_s_mem ());
}
-int
+MONO_API int
mono_btls_bio_mem_get_data (BIO *bio, void **data)
{
return (int)BIO_get_mem_data (bio, (char**)data);
//
#include <btls-error.h>
+#include <btls-util.h>
#include <assert.h>
-int
+MONO_API int
mono_btls_error_peek_error (void)
{
return ERR_peek_error ();
}
-int
+MONO_API int
mono_btls_error_get_error (void)
{
return ERR_get_error ();
}
-void
+MONO_API void
mono_btls_error_clear_error (void)
{
ERR_clear_error ();
}
-void
+MONO_API void
mono_btls_error_get_error_string_n (int error, char *buf, int len)
{
ERR_error_string_n (error, buf, len);
#include <btls-key.h>
-void
+MONO_API void
mono_btls_key_free (EVP_PKEY *pkey)
{
EVP_PKEY_free (pkey);
}
-EVP_PKEY *
+MONO_API EVP_PKEY *
mono_btls_key_up_ref (EVP_PKEY *pkey)
{
return EVP_PKEY_up_ref (pkey);
}
-int
+MONO_API int
mono_btls_key_get_bits (EVP_PKEY *pkey)
{
return EVP_PKEY_bits (pkey);
}
-int
+MONO_API int
mono_btls_key_is_rsa (EVP_PKEY *pkey)
{
return pkey->type == EVP_PKEY_RSA;
}
-int
+MONO_API int
mono_btls_key_get_bytes (EVP_PKEY *pkey, uint8_t **buffer, int *size, int include_private_bits)
{
size_t len;
CRYPTO_refcount_t references;
};
-MonoBtlsPkcs12 *
+MONO_API MonoBtlsPkcs12 *
mono_btls_pkcs12_new (void)
{
MonoBtlsPkcs12 *pkcs12 = (MonoBtlsPkcs12 *)OPENSSL_malloc (sizeof (MonoBtlsPkcs12));
return pkcs12;
}
-int
+MONO_API int
mono_btls_pkcs12_get_count (MonoBtlsPkcs12 *pkcs12)
{
return (int)sk_X509_num (pkcs12->certs);
}
-X509 *
+MONO_API X509 *
mono_btls_pkcs12_get_cert (MonoBtlsPkcs12 *pkcs12, int index)
{
X509 *cert;
return cert;
}
-STACK_OF(X509) *
+MONO_API STACK_OF(X509) *
mono_btls_pkcs12_get_certs (MonoBtlsPkcs12 *pkcs12)
{
return pkcs12->certs;
}
-int
+MONO_API int
mono_btls_pkcs12_free (MonoBtlsPkcs12 *pkcs12)
{
if (!CRYPTO_refcount_dec_and_test_zero (&pkcs12->references))
return 1;
}
-MonoBtlsPkcs12 *
+MONO_API MonoBtlsPkcs12 *
mono_btls_pkcs12_up_ref (MonoBtlsPkcs12 *pkcs12)
{
CRYPTO_refcount_inc (&pkcs12->references);
return pkcs12;
}
-void
+MONO_API void
mono_btls_pkcs12_add_cert (MonoBtlsPkcs12 *pkcs12, X509 *x509)
{
X509_up_ref (x509);
sk_X509_push (pkcs12->certs, x509);
}
-int
+MONO_API int
mono_btls_pkcs12_import (MonoBtlsPkcs12 *pkcs12, const void *data, int len, const void *password)
{
CBS cbs;
return PKCS12_get_key_and_certs (&pkcs12->private_key, pkcs12->certs, &cbs, password);
}
-int
+MONO_API int
mono_btls_pkcs12_has_private_key (MonoBtlsPkcs12 *pkcs12)
{
return pkcs12->private_key != NULL;
}
-EVP_PKEY *
+MONO_API EVP_PKEY *
mono_btls_pkcs12_get_private_key (MonoBtlsPkcs12 *pkcs12)
{
if (!pkcs12->private_key)
void ssl_cipher_preference_list_free (struct ssl_cipher_preference_list_st *cipher_list);
-int
+MONO_API int
mono_btls_ssl_ctx_is_debug_enabled (MonoBtlsSslCtx *ctx)
{
return ctx->debug_bio != NULL;
}
-int
+MONO_API int
mono_btls_ssl_ctx_debug_printf (MonoBtlsSslCtx *ctx, const char *format, ...)
{
va_list args;
return ret;
}
-MonoBtlsSslCtx *
+MONO_API MonoBtlsSslCtx *
mono_btls_ssl_ctx_new (void)
{
MonoBtlsSslCtx *ctx;
return ctx;
}
-MonoBtlsSslCtx *
+MONO_API MonoBtlsSslCtx *
mono_btls_ssl_ctx_up_ref (MonoBtlsSslCtx *ctx)
{
CRYPTO_refcount_inc (&ctx->references);
return ctx;
}
-int
+MONO_API int
mono_btls_ssl_ctx_free (MonoBtlsSslCtx *ctx)
{
if (!CRYPTO_refcount_dec_and_test_zero (&ctx->references))
return 1;
}
-SSL_CTX *
+MONO_API SSL_CTX *
mono_btls_ssl_ctx_get_ctx (MonoBtlsSslCtx *ctx)
{
return ctx->ctx;
}
-void
+MONO_API void
mono_btls_ssl_ctx_set_debug_bio (MonoBtlsSslCtx *ctx, BIO *debug_bio)
{
if (debug_bio)
ctx->debug_bio = NULL;
}
-void
+MONO_API void
mono_btls_ssl_ctx_initialize (MonoBtlsSslCtx *ctx, void *instance)
{
ctx->instance = instance;
return ret;
}
-void
+MONO_API void
mono_btls_ssl_ctx_set_cert_verify_callback (MonoBtlsSslCtx *ptr, MonoBtlsVerifyFunc func, int cert_required)
{
int mode;
return ret;
}
-void
+MONO_API void
mono_btls_ssl_ctx_set_cert_select_callback (MonoBtlsSslCtx *ptr, MonoBtlsSelectFunc func)
{
ptr->select_func = func;
SSL_CTX_set_cert_cb (ptr->ctx, cert_select_callback, ptr);
}
-X509_STORE *
+MONO_API X509_STORE *
mono_btls_ssl_ctx_peek_store (MonoBtlsSslCtx *ctx)
{
return SSL_CTX_get_cert_store (ctx->ctx);
}
-void
+MONO_API void
mono_btls_ssl_ctx_set_min_version (MonoBtlsSslCtx *ctx, int version)
{
SSL_CTX_set_min_version (ctx->ctx, version);
}
-void
+MONO_API void
mono_btls_ssl_ctx_set_max_version (MonoBtlsSslCtx *ctx, int version)
{
SSL_CTX_set_max_version (ctx->ctx, version);
}
-int
+MONO_API int
mono_btls_ssl_ctx_is_cipher_supported (MonoBtlsSslCtx *ctx, uint16_t value)
{
const SSL_CIPHER *cipher;
return cipher != NULL;
}
-int
+MONO_API int
mono_btls_ssl_ctx_set_ciphers (MonoBtlsSslCtx *ctx, int count, const uint16_t *data,
int allow_unsupported)
{
return 0;
}
-int
+MONO_API int
mono_btls_ssl_ctx_set_verify_param (MonoBtlsSslCtx *ctx, const MonoBtlsX509VerifyParam *param)
{
return SSL_CTX_set1_param (ctx->ctx, mono_btls_x509_verify_param_peek_param (param));
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list (SSL *s, const CBS *cbs);
-MonoBtlsSsl *
+MONO_API MonoBtlsSsl *
mono_btls_ssl_new (MonoBtlsSslCtx *ctx)
{
MonoBtlsSsl *ptr;
return ptr;
}
-void
+MONO_API void
mono_btls_ssl_destroy (MonoBtlsSsl *ptr)
{
mono_btls_ssl_close (ptr);
free (ptr);
}
-void
+MONO_API void
mono_btls_ssl_close (MonoBtlsSsl *ptr)
{
;
}
-void
+MONO_API void
mono_btls_ssl_set_bio (MonoBtlsSsl *ptr, BIO *bio)
{
BIO_up_ref (bio);
SSL_set_bio (ptr->ssl, bio, bio);
}
-void
+MONO_API void
mono_btls_ssl_print_errors_cb (ERR_print_errors_callback_t callback, void *ctx)
{
ERR_print_errors_cb (callback, ctx);
}
-int
+MONO_API int
mono_btls_ssl_use_certificate (MonoBtlsSsl *ptr, X509 *x509)
{
return SSL_use_certificate (ptr->ssl, x509);
}
-int
+MONO_API int
mono_btls_ssl_use_private_key (MonoBtlsSsl *ptr, EVP_PKEY *key)
{
return SSL_use_PrivateKey (ptr->ssl, key);
}
-int
+MONO_API int
mono_btls_ssl_add_chain_certificate (MonoBtlsSsl *ptr, X509 *x509)
{
return SSL_add1_chain_cert (ptr->ssl, x509);
}
-int
+MONO_API int
mono_btls_ssl_accept (MonoBtlsSsl *ptr)
{
return SSL_accept (ptr->ssl);
}
-int
+MONO_API int
mono_btls_ssl_connect (MonoBtlsSsl *ptr)
{
return SSL_connect (ptr->ssl);
}
-int
+MONO_API int
mono_btls_ssl_handshake (MonoBtlsSsl *ptr)
{
return SSL_do_handshake (ptr->ssl);
}
-int
+MONO_API int
mono_btls_ssl_read (MonoBtlsSsl *ptr, void *buf, int count)
{
return SSL_read (ptr->ssl, buf, count);
}
-int
+MONO_API int
mono_btls_ssl_write (MonoBtlsSsl *ptr, void *buf, int count)
{
return SSL_write (ptr->ssl, buf, count);
}
-int
+MONO_API int
mono_btls_ssl_get_version (MonoBtlsSsl *ptr)
{
return SSL_version (ptr->ssl);
}
-void
+MONO_API void
mono_btls_ssl_set_min_version (MonoBtlsSsl *ptr, int version)
{
SSL_set_min_version (ptr->ssl, version);
}
-void
+MONO_API void
mono_btls_ssl_set_max_version (MonoBtlsSsl *ptr, int version)
{
SSL_set_max_version (ptr->ssl, version);
}
-int
+MONO_API int
mono_btls_ssl_get_cipher (MonoBtlsSsl *ptr)
{
const SSL_CIPHER *cipher;
return (uint16_t)SSL_CIPHER_get_id (cipher);
}
-int
+MONO_API int
mono_btls_ssl_set_cipher_list (MonoBtlsSsl *ptr, const char *str)
{
return SSL_set_cipher_list(ptr->ssl, str);
}
-int
+MONO_API int
mono_btls_ssl_get_ciphers (MonoBtlsSsl *ptr, uint16_t **data)
{
STACK_OF(SSL_CIPHER) *ciphers;
return count;
}
-X509 *
+MONO_API X509 *
mono_btls_ssl_get_peer_certificate (MonoBtlsSsl *ptr)
{
return SSL_get_peer_certificate (ptr->ssl);
}
-int
+MONO_API int
mono_btls_ssl_get_error (MonoBtlsSsl *ptr, int ret_code)
{
return SSL_get_error (ptr->ssl, ret_code);
}
-int
+MONO_API int
mono_btls_ssl_set_verify_param (MonoBtlsSsl *ptr, const MonoBtlsX509VerifyParam *param)
{
return SSL_set1_param (ptr->ssl, mono_btls_x509_verify_param_peek_param (param));
}
-int
+MONO_API int
mono_btls_ssl_set_server_name (MonoBtlsSsl *ptr, const char *name)
{
return SSL_set_tlsext_host_name (ptr->ssl, name);
extern int asn1_generalizedtime_to_tm (struct tm *tm, const ASN1_GENERALIZEDTIME *d);
-void
+MONO_API void
mono_btls_free (void *data)
{
OPENSSL_free (data);
#include <string.h>
#include <openssl/ssl.h>
+#ifndef MONO_API
+#if defined(_MSC_VER)
+
+#define MONO_API __declspec(dllexport)
+
+#else
+
+#ifdef __GNUC__
+#define MONO_API __attribute__ ((visibility ("default")))
+#else
+#define MONO_API
+#endif
+
+#endif
+#endif
+
void
mono_btls_free (void *data);
CRYPTO_refcount_t references;
};
-MonoBtlsX509Chain *
+MONO_API MonoBtlsX509Chain *
mono_btls_x509_chain_new (void)
{
MonoBtlsX509Chain *chain = (MonoBtlsX509Chain *)OPENSSL_malloc (sizeof (MonoBtlsX509Chain));
return chain;
}
-MonoBtlsX509Chain *
+MONO_API MonoBtlsX509Chain *
mono_btls_x509_chain_from_certs (STACK_OF(X509) *certs)
{
MonoBtlsX509Chain *chain = (MonoBtlsX509Chain *)OPENSSL_malloc (sizeof (MonoBtlsX509Chain));
return chain;
}
-STACK_OF(X509) *
+MONO_API STACK_OF(X509) *
mono_btls_x509_chain_peek_certs (MonoBtlsX509Chain *chain)
{
return chain->certs;
}
-int
+MONO_API int
mono_btls_x509_chain_get_count (MonoBtlsX509Chain *chain)
{
return (int)sk_X509_num(chain->certs);
}
-X509 *
+MONO_API X509 *
mono_btls_x509_chain_get_cert (MonoBtlsX509Chain *chain, int index)
{
X509 *cert;
return cert;
}
-STACK_OF(X509) *
+MONO_API STACK_OF(X509) *
mono_btls_x509_chain_get_certs (MonoBtlsX509Chain *chain)
{
return chain->certs;
}
-int
+MONO_API int
mono_btls_x509_chain_free (MonoBtlsX509Chain *chain)
{
if (!CRYPTO_refcount_dec_and_test_zero(&chain->references))
return 1;
}
-MonoBtlsX509Chain *
+MONO_API MonoBtlsX509Chain *
mono_btls_x509_chain_up_ref (MonoBtlsX509Chain *chain)
{
CRYPTO_refcount_inc(&chain->references);
return chain;
}
-void
+MONO_API void
mono_btls_x509_chain_add_cert (MonoBtlsX509Chain *chain, X509 *x509)
{
X509_up_ref(x509);
CRYPTO_refcount_t references;
};
-MonoBtlsX509Crl *
+MONO_API MonoBtlsX509Crl *
mono_btls_x509_crl_from_data (const void *buf, int len, MonoBtlsX509Format format)
{
MonoBtlsX509Crl *crl;
return crl;
}
-MonoBtlsX509Crl *
+MONO_API MonoBtlsX509Crl *
mono_btls_x509_crl_ref (MonoBtlsX509Crl *crl)
{
CRYPTO_refcount_inc (&crl->references);
return crl;
}
-int
+MONO_API int
mono_btls_x509_crl_free (MonoBtlsX509Crl *crl)
{
if (!CRYPTO_refcount_dec_and_test_zero (&crl->references))
return 1;
}
-MonoBtlsX509Revoked *
+MONO_API MonoBtlsX509Revoked *
mono_btls_x509_crl_get_by_cert (MonoBtlsX509Crl *crl, X509 *x509)
{
X509_REVOKED *revoked;
return mono_btls_x509_revoked_new (crl, revoked);
}
-MonoBtlsX509Revoked *
+MONO_API MonoBtlsX509Revoked *
mono_btls_x509_crl_get_by_serial (MonoBtlsX509Crl *crl, void *serial, int len)
{
ASN1_INTEGER si;
return mono_btls_x509_revoked_new (crl, revoked);
}
-int
+MONO_API int
mono_btls_x509_crl_get_revoked_count (MonoBtlsX509Crl *crl)
{
STACK_OF(X509_REVOKED) *stack;
return (int)sk_X509_REVOKED_num (stack);
}
-MonoBtlsX509Revoked *
+MONO_API MonoBtlsX509Revoked *
mono_btls_x509_crl_get_revoked (MonoBtlsX509Crl *crl, int index)
{
STACK_OF(X509_REVOKED) *stack;
return mono_btls_x509_revoked_new (crl, revoked);
}
-long
+MONO_API long
mono_btls_x509_crl_get_last_update (MonoBtlsX509Crl *crl)
{
return mono_btls_util_asn1_time_to_ticks (X509_CRL_get_lastUpdate (crl->crl));
}
-long
+MONO_API long
mono_btls_x509_crl_get_next_update (MonoBtlsX509Crl *crl)
{
return mono_btls_util_asn1_time_to_ticks (X509_CRL_get_nextUpdate (crl->crl));
}
-long
+MONO_API long
mono_btls_x509_crl_get_version (MonoBtlsX509Crl *crl)
{
return X509_CRL_get_version (crl->crl);
}
-MonoBtlsX509Name *
+MONO_API MonoBtlsX509Name *
mono_btls_x509_crl_get_issuer (MonoBtlsX509Crl *crl)
{
return mono_btls_x509_name_copy (X509_CRL_get_issuer (crl->crl));
MonoLookup *lookup;
};
-MonoBtlsX509LookupMono *
+MONO_API MonoBtlsX509LookupMono *
mono_btls_x509_lookup_mono_new (void)
{
MonoBtlsX509LookupMono *mono;
return mono;
}
-void
+MONO_API void
mono_btls_x509_lookup_mono_init (MonoBtlsX509LookupMono *mono, const void *instance,
MonoBtlsX509LookupMono_BySubject by_subject_func)
{
return 0;
}
-int
+MONO_API int
mono_btls_x509_lookup_mono_free (MonoBtlsX509LookupMono *mono)
{
mono->instance = NULL;
NULL, /* get_by_alias */
};
-X509_LOOKUP_METHOD *
+MONO_API X509_LOOKUP_METHOD *
mono_btls_x509_lookup_mono_method (void)
{
return &mono_lookup_method;
}
-int
+MONO_API int
mono_btls_x509_lookup_add_mono (MonoBtlsX509Lookup *lookup, MonoBtlsX509LookupMono *mono)
{
if (mono_btls_x509_lookup_get_type (lookup) != MONO_BTLS_X509_LOOKUP_TYPE_MONO)
}
}
-MonoBtlsX509Lookup *
+MONO_API MonoBtlsX509Lookup *
mono_btls_x509_lookup_new (MonoBtlsX509Store *store, MonoBtlsX509LookupType type)
{
MonoBtlsX509Lookup *lookup;
return lookup;
}
-int
+MONO_API int
mono_btls_x509_lookup_load_file (MonoBtlsX509Lookup *lookup, const char *file, MonoBtlsX509FileType type)
{
return X509_LOOKUP_load_file (lookup->lookup, file, type);
}
-int
+MONO_API int
mono_btls_x509_lookup_add_dir (MonoBtlsX509Lookup *lookup, const char *dir, MonoBtlsX509FileType type)
{
return X509_LOOKUP_add_dir (lookup->lookup, dir, type);
}
-MonoBtlsX509Lookup *
+MONO_API MonoBtlsX509Lookup *
mono_btls_x509_lookup_up_ref (MonoBtlsX509Lookup *lookup)
{
CRYPTO_refcount_inc (&lookup->references);
return lookup;
}
-int
+MONO_API int
mono_btls_x509_lookup_free (MonoBtlsX509Lookup *lookup)
{
if (!CRYPTO_refcount_dec_and_test_zero (&lookup->references))
return 1;
}
-int
+MONO_API int
mono_btls_x509_lookup_init (MonoBtlsX509Lookup *lookup)
{
return X509_LOOKUP_init (lookup->lookup);
}
-int
+MONO_API int
mono_btls_x509_lookup_shutdown (MonoBtlsX509Lookup *lookup)
{
return X509_LOOKUP_shutdown (lookup->lookup);
}
-MonoBtlsX509LookupType
+MONO_API MonoBtlsX509LookupType
mono_btls_x509_lookup_get_type (MonoBtlsX509Lookup *lookup)
{
return lookup->type;
}
-X509_LOOKUP *
+MONO_API X509_LOOKUP *
mono_btls_x509_lookup_peek_lookup (MonoBtlsX509Lookup *lookup)
{
return lookup->lookup;
}
-X509 *
+MONO_API X509 *
mono_btls_x509_lookup_by_subject (MonoBtlsX509Lookup *lookup, MonoBtlsX509Name *name)
{
X509_OBJECT obj;
return x509;
}
-X509 *
+MONO_API X509 *
mono_btls_x509_lookup_by_fingerprint (MonoBtlsX509Lookup *lookup, unsigned char *bytes, int len)
{
X509_OBJECT obj;
X509_NAME *name;
};
-MonoBtlsX509Name *
+MONO_API MonoBtlsX509Name *
mono_btls_x509_name_from_name (X509_NAME *xn)
{
MonoBtlsX509Name *name;
return name;
}
-MonoBtlsX509Name *
+MONO_API MonoBtlsX509Name *
mono_btls_x509_name_copy (X509_NAME *xn)
{
MonoBtlsX509Name *name;
return name;
}
-void
+MONO_API void
mono_btls_x509_name_free (MonoBtlsX509Name *name)
{
if (name->owns) {
OPENSSL_free(name);
}
-X509_NAME *
+MONO_API X509_NAME *
mono_btls_x509_name_peek_name (MonoBtlsX509Name *name)
{
return name->name;
}
-int
+MONO_API int
mono_btls_x509_name_print_bio (MonoBtlsX509Name *name, BIO *bio)
{
return X509_NAME_print_ex (bio, name->name, 0, ASN1_STRFLGS_RFC2253 | XN_FLAG_FN_SN | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_DN_REV);
}
-int
+MONO_API int
mono_btls_x509_name_get_raw_data (MonoBtlsX509Name *name, void **buffer, int use_canon_enc)
{
int len;
return len;
}
-MonoBtlsX509Name *
+MONO_API MonoBtlsX509Name *
mono_btls_x509_name_from_data (const void *data, int len, int use_canon_enc)
{
MonoBtlsX509Name *name;
return name;
}
-int
+MONO_API int
mono_btls_x509_name_print_string (MonoBtlsX509Name *name, char *buffer, int size)
{
*buffer = 0;
return X509_NAME_oneline (name->name, buffer, size) != NULL;
}
-long
+MONO_API long
mono_btls_x509_name_hash (MonoBtlsX509Name *name)
{
return X509_NAME_hash (name->name);
}
-long
+MONO_API long
mono_btls_x509_name_hash_old (MonoBtlsX509Name *name)
{
return X509_NAME_hash_old (name->name);
}
-int
+MONO_API int
mono_btls_x509_name_get_entry_count (MonoBtlsX509Name *name)
{
return X509_NAME_entry_count (name->name);
}
}
-MonoBtlsX509NameEntryType
+MONO_API MonoBtlsX509NameEntryType
mono_btls_x509_name_get_entry_type (MonoBtlsX509Name *name, int index)
{
X509_NAME_ENTRY *entry;
return nid2mono (OBJ_obj2nid (obj));
}
-int
+MONO_API int
mono_btls_x509_name_get_entry_oid (MonoBtlsX509Name *name, int index, char *buffer, int size)
{
X509_NAME_ENTRY *entry;
return OBJ_obj2txt (buffer, size, obj, 1);
}
-int
+MONO_API int
mono_btls_x509_name_get_entry_oid_data (MonoBtlsX509Name *name, int index, const void **data)
{
X509_NAME_ENTRY *entry;
return obj->length;
}
-int
+MONO_API int
mono_btls_x509_name_get_entry_value (MonoBtlsX509Name *name, int index, int *tag, unsigned char **str)
{
X509_NAME_ENTRY *entry;
X509_REVOKED *revoked;
};
-MonoBtlsX509Revoked *
+MONO_API MonoBtlsX509Revoked *
mono_btls_x509_revoked_new (MonoBtlsX509Crl *owner, X509_REVOKED *revoked)
{
MonoBtlsX509Revoked *instance;
return instance;
}
-void
+MONO_API void
mono_btls_x509_revoked_free (MonoBtlsX509Revoked *revoked)
{
mono_btls_x509_crl_free (revoked->owner);
OPENSSL_free (revoked);
}
-int
+MONO_API int
mono_btls_x509_revoked_get_serial_number (MonoBtlsX509Revoked *revoked, char *buffer, int size)
{
ASN1_INTEGER *serial;
return serial->length;
}
-long
+MONO_API long
mono_btls_x509_revoked_get_revocation_date (MonoBtlsX509Revoked *revoked)
{
ASN1_TIME *date;
return mono_btls_util_asn1_time_to_ticks (date);
}
-int
+MONO_API int
mono_btls_x509_revoked_get_reason (MonoBtlsX509Revoked *revoked)
{
return revoked->revoked->reason;
}
-int
+MONO_API int
mono_btls_x509_revoked_get_sequence (MonoBtlsX509Revoked *revoked)
{
return revoked->revoked->sequence;
MonoBtlsX509Chain *chain;
};
-MonoBtlsX509StoreCtx *
+MONO_API MonoBtlsX509StoreCtx *
mono_btls_x509_store_ctx_from_ptr (X509_STORE_CTX *ptr)
{
MonoBtlsX509StoreCtx *ctx;
return ctx;
}
-MonoBtlsX509StoreCtx *
+MONO_API MonoBtlsX509StoreCtx *
mono_btls_x509_store_ctx_new (void)
{
MonoBtlsX509StoreCtx *ctx;
return ctx;
}
-MonoBtlsX509StoreCtx *
+MONO_API MonoBtlsX509StoreCtx *
mono_btls_x509_store_ctx_up_ref (MonoBtlsX509StoreCtx *ctx)
{
CRYPTO_refcount_inc (&ctx->references);
return ctx;
}
-int
+MONO_API int
mono_btls_x509_store_ctx_free (MonoBtlsX509StoreCtx *ctx)
{
if (!CRYPTO_refcount_dec_and_test_zero (&ctx->references))
return 1;
}
-int
+MONO_API int
mono_btls_x509_store_ctx_get_error (MonoBtlsX509StoreCtx *ctx, const char **error_string)
{
int error;
return error;
}
-int
+MONO_API int
mono_btls_x509_store_ctx_get_error_depth (MonoBtlsX509StoreCtx *ctx)
{
return X509_STORE_CTX_get_error_depth (ctx->ctx);
}
-MonoBtlsX509Chain *
+MONO_API MonoBtlsX509Chain *
mono_btls_x509_store_ctx_get_chain (MonoBtlsX509StoreCtx *ctx)
{
STACK_OF(X509) *certs;
return mono_btls_x509_chain_from_certs (certs);
}
-MonoBtlsX509Chain *
+MONO_API MonoBtlsX509Chain *
mono_btls_x509_store_ctx_get_untrusted (MonoBtlsX509StoreCtx *ctx)
{
STACK_OF(X509) *untrusted;
return mono_btls_x509_chain_from_certs (untrusted);
}
-int
+MONO_API int
mono_btls_x509_store_ctx_init (MonoBtlsX509StoreCtx *ctx,
MonoBtlsX509Store *store, MonoBtlsX509Chain *chain)
{
return 1;
}
-int
+MONO_API int
mono_btls_x509_store_ctx_set_param (MonoBtlsX509StoreCtx *ctx, MonoBtlsX509VerifyParam *param)
{
return X509_VERIFY_PARAM_set1 (X509_STORE_CTX_get0_param (ctx->ctx), mono_btls_x509_verify_param_peek_param (param));
}
-int
+MONO_API int
mono_btls_x509_store_ctx_verify_cert (MonoBtlsX509StoreCtx *ctx)
{
return X509_verify_cert (ctx->ctx);
}
-X509 *
+MONO_API X509 *
mono_btls_x509_store_ctx_get_by_subject (MonoBtlsX509StoreCtx *ctx, MonoBtlsX509Name *name)
{
X509_OBJECT obj;
return x509;
}
-X509 *
+MONO_API X509 *
mono_btls_x509_store_ctx_get_current_cert (MonoBtlsX509StoreCtx *ctx)
{
X509 *x509 = X509_STORE_CTX_get_current_cert (ctx->ctx);
return X509_up_ref (x509);
}
-X509 *
+MONO_API X509 *
mono_btls_x509_store_ctx_get_current_issuer (MonoBtlsX509StoreCtx *ctx)
{
X509 *x509 = X509_STORE_CTX_get0_current_issuer (ctx->ctx);
return X509_up_ref (x509);
}
-MonoBtlsX509VerifyParam *
+MONO_API MonoBtlsX509VerifyParam *
mono_btls_x509_store_ctx_get_verify_param (MonoBtlsX509StoreCtx *ctx)
{
X509_VERIFY_PARAM *param;
return mono_btls_x509_verify_param_from_store_ctx (ctx, param);
}
-int
+MONO_API int
mono_btls_x509_store_ctx_get_foo (MonoBtlsX509StoreCtx *ctx)
{
return 0;
-}
\ No newline at end of file
+}
CRYPTO_refcount_t references;
};
-MonoBtlsX509Store *
+MONO_API MonoBtlsX509Store *
mono_btls_x509_store_from_store (X509_STORE *ctx)
{
MonoBtlsX509Store *store;
return store;
}
-MonoBtlsX509Store *
+MONO_API MonoBtlsX509Store *
mono_btls_x509_store_from_ctx (X509_STORE_CTX *ctx)
{
return mono_btls_x509_store_from_store (ctx->ctx);
}
-MonoBtlsX509Store *
+MONO_API MonoBtlsX509Store *
mono_btls_x509_store_new (void)
{
MonoBtlsX509Store *store;
return store;
}
-X509_STORE *
+MONO_API X509_STORE *
mono_btls_x509_store_peek_store (MonoBtlsX509Store *store)
{
return store->store;
}
-MonoBtlsX509Store *
+MONO_API MonoBtlsX509Store *
mono_btls_x509_store_from_ssl_ctx (MonoBtlsSslCtx *ctx)
{
X509_STORE *store = mono_btls_ssl_ctx_peek_store (ctx);
return mono_btls_x509_store_from_store (store);
}
-int
+MONO_API int
mono_btls_x509_store_free (MonoBtlsX509Store *store)
{
if (!CRYPTO_refcount_dec_and_test_zero(&store->references))
return 1;
}
-MonoBtlsX509Store *
+MONO_API MonoBtlsX509Store *
mono_btls_x509_store_up_ref (MonoBtlsX509Store *store)
{
CRYPTO_refcount_inc (&store->references);
return store;
}
-int
+MONO_API int
mono_btls_x509_store_add_cert (MonoBtlsX509Store *store, X509 *cert)
{
return X509_STORE_add_cert (store->store, cert);
}
-int
+MONO_API int
mono_btls_x509_store_load_locations (MonoBtlsX509Store *store, const char *file, const char *path)
{
return X509_STORE_load_locations (store->store, file, path);
}
-int
+MONO_API int
mono_btls_x509_store_set_default_paths (MonoBtlsX509Store *store)
{
return X509_STORE_set_default_paths (store->store);
}
-int
+MONO_API int
mono_btls_x509_store_get_count (MonoBtlsX509Store *store)
{
return (int)sk_X509_OBJECT_num (store->store->objs);
X509_VERIFY_PARAM *param;
};
-MonoBtlsX509VerifyParam *
+MONO_API MonoBtlsX509VerifyParam *
mono_btls_x509_verify_param_new (void)
{
MonoBtlsX509VerifyParam *param;
return param;
}
-MonoBtlsX509VerifyParam *
+MONO_API MonoBtlsX509VerifyParam *
mono_btls_x509_verify_param_from_store_ctx (MonoBtlsX509StoreCtx *ctx, X509_VERIFY_PARAM *param)
{
MonoBtlsX509VerifyParam *instance;
return instance;
}
-MonoBtlsX509VerifyParam *
+MONO_API MonoBtlsX509VerifyParam *
mono_btls_x509_verify_param_copy (const MonoBtlsX509VerifyParam *from)
{
MonoBtlsX509VerifyParam *param;
return param;
}
-const X509_VERIFY_PARAM *
+MONO_API const X509_VERIFY_PARAM *
mono_btls_x509_verify_param_peek_param (const MonoBtlsX509VerifyParam *param)
{
return param->param;
}
-int
+MONO_API int
mono_btls_x509_verify_param_can_modify (MonoBtlsX509VerifyParam *param)
{
return param->owns;
}
-MonoBtlsX509VerifyParam *
+MONO_API MonoBtlsX509VerifyParam *
mono_btls_x509_verify_param_lookup (const char *name)
{
MonoBtlsX509VerifyParam *param;
return param;
}
-void
+MONO_API void
mono_btls_x509_verify_param_free (MonoBtlsX509VerifyParam *param)
{
if (param->owns) {
OPENSSL_free (param);
}
-int
+MONO_API int
mono_btls_x509_verify_param_set_name (MonoBtlsX509VerifyParam *param, const char *name)
{
if (!param->owns)
return X509_VERIFY_PARAM_set1_name (param->param, name);
}
-int
+MONO_API int
mono_btls_x509_verify_param_set_host (MonoBtlsX509VerifyParam *param, const char *host, int namelen)
{
if (!param->owns)
return X509_VERIFY_PARAM_set1_host (param->param, host, namelen);
}
-int
+MONO_API int
mono_btls_x509_verify_param_add_host (MonoBtlsX509VerifyParam *param, const char *host, int namelen)
{
if (!param->owns)
return X509_VERIFY_PARAM_set1_host (param->param, host, namelen);
}
-unsigned long
+MONO_API unsigned long
mono_btls_x509_verify_param_get_flags (MonoBtlsX509VerifyParam *param)
{
return X509_VERIFY_PARAM_get_flags (param->param);
}
-int
+MONO_API int
mono_btls_x509_verify_param_set_flags (MonoBtlsX509VerifyParam *param, unsigned long flags)
{
if (!param->owns)
return X509_VERIFY_PARAM_set_flags (param->param, flags);
}
-MonoBtlsX509VerifyFlags
+MONO_API MonoBtlsX509VerifyFlags
mono_btls_x509_verify_param_get_mono_flags (MonoBtlsX509VerifyParam *param)
{
MonoBtlsX509VerifyFlags current;
return current;
}
-int
+MONO_API int
mono_btls_x509_verify_param_set_mono_flags (MonoBtlsX509VerifyParam *param, MonoBtlsX509VerifyFlags flags)
{
unsigned long current;
return X509_VERIFY_PARAM_set_flags (param->param, current);
}
-int
+MONO_API int
mono_btls_x509_verify_param_set_purpose (MonoBtlsX509VerifyParam *param, MonoBtlsX509Purpose purpose)
{
if (!param->owns)
return X509_VERIFY_PARAM_set_purpose (param->param, purpose);
}
-int
+MONO_API int
mono_btls_x509_verify_param_get_depth (MonoBtlsX509VerifyParam *param)
{
return X509_VERIFY_PARAM_get_depth (param->param);
}
-int
+MONO_API int
mono_btls_x509_verify_param_set_depth (MonoBtlsX509VerifyParam *param, int depth)
{
if (!param->owns)
return 1;
}
-int
+MONO_API int
mono_btls_x509_verify_param_set_time (MonoBtlsX509VerifyParam *param, long time)
{
if (!param->owns)
return 1;
}
-char *
+MONO_API char *
mono_btls_x509_verify_param_get_peername (MonoBtlsX509VerifyParam *param)
{
char *peer = X509_VERIFY_PARAM_get0_peername (param->param);
#include <openssl/x509v3.h>
#include <openssl/pkcs12.h>
-X509 *
+MONO_API X509 *
mono_btls_x509_from_data (const void *buf, int len, MonoBtlsX509Format format)
{
BIO *bio;
return cert;
}
-X509 *
+MONO_API X509 *
mono_btls_x509_up_ref (X509 *x509)
{
X509_up_ref (x509);
return x509;
}
-void
+MONO_API void
mono_btls_x509_free (X509 *x509)
{
X509_free (x509);
}
-X509 *
+MONO_API X509 *
mono_btls_x509_dup (X509 *x509)
{
return X509_dup (x509);
}
-MonoBtlsX509Name *
+MONO_API MonoBtlsX509Name *
mono_btls_x509_get_subject_name (X509 *x509)
{
return mono_btls_x509_name_copy (X509_get_subject_name (x509));
}
-MonoBtlsX509Name *
+MONO_API MonoBtlsX509Name *
mono_btls_x509_get_issuer_name (X509 *x509)
{
return mono_btls_x509_name_copy (X509_get_issuer_name (x509));
}
-int
+MONO_API int
mono_btls_x509_get_subject_name_string (X509 *name, char *buffer, int size)
{
*buffer = 0;
return X509_NAME_oneline (X509_get_subject_name (name), buffer, size) != NULL;
}
-int
+MONO_API int
mono_btls_x509_get_issuer_name_string (X509 *name, char *buffer, int size)
{
*buffer = 0;
return X509_NAME_oneline (X509_get_issuer_name (name), buffer, size) != NULL;
}
-int
+MONO_API int
mono_btls_x509_get_raw_data (X509 *x509, BIO *bio, MonoBtlsX509Format format)
{
switch (format) {
}
}
-int
+MONO_API int
mono_btls_x509_cmp (const X509 *a, const X509 *b)
{
return X509_cmp (a, b);
}
-int
+MONO_API int
mono_btls_x509_get_hash (X509 *x509, const void **data)
{
X509_check_purpose (x509, -1, 0);
return SHA_DIGEST_LENGTH;
}
-long
+MONO_API long
mono_btls_x509_get_not_before (X509 *x509)
{
return mono_btls_util_asn1_time_to_ticks (X509_get_notBefore (x509));
}
-long
+MONO_API long
mono_btls_x509_get_not_after (X509 *x509)
{
return mono_btls_util_asn1_time_to_ticks (X509_get_notAfter (x509));
}
-int
+MONO_API int
mono_btls_x509_get_public_key (X509 *x509, BIO *bio)
{
EVP_PKEY *pkey;
return ret;
}
-int
+MONO_API int
mono_btls_x509_get_serial_number (X509 *x509, char *buffer, int size, int mono_style)
{
ASN1_INTEGER *serial;
return len;
}
-int
+MONO_API int
mono_btls_x509_get_public_key_algorithm (X509 *x509, char *buffer, int size)
{
X509_PUBKEY *pkey;
return OBJ_obj2txt (buffer, size, ppkalg, 1);
}
-int
+MONO_API int
mono_btls_x509_get_version (X509 *x509)
{
return (int)X509_get_version (x509) + 1;
}
-int
+MONO_API int
mono_btls_x509_get_signature_algorithm (X509 *x509, char *buffer, int size)
{
const ASN1_OBJECT *obj;
return OBJ_obj2txt (buffer, size, obj, 1);
}
-int
+MONO_API int
mono_btls_x509_get_public_key_asn1 (X509 *x509, char *out_oid, int oid_len, uint8_t **buffer, int *size)
{
X509_PUBKEY *pkey;
}
-int
+MONO_API int
mono_btls_x509_get_public_key_parameters (X509 *x509, char *out_oid, int oid_len, uint8_t **buffer, int *size)
{
X509_PUBKEY *pkey;
}
}
-EVP_PKEY *
+MONO_API EVP_PKEY *
mono_btls_x509_get_pubkey (X509 *x509)
{
return X509_get_pubkey (x509);
}
-int
+MONO_API int
mono_btls_x509_get_subject_key_identifier (X509 *x509, uint8_t **buffer, int *size)
{
ASN1_OCTET_STRING *skid;
return 1;
}
-int
+MONO_API int
mono_btls_x509_print (X509 *x509, BIO *bio)
{
return X509_print_ex (bio, x509, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
}
}
-int
+MONO_API int
mono_btls_x509_add_trust_object (X509 *x509, MonoBtlsX509Purpose purpose)
{
ASN1_OBJECT *trust;
return X509_add1_trust_object (x509, trust);
}
-int
+MONO_API int
mono_btls_x509_add_reject_object (X509 *x509, MonoBtlsX509Purpose purpose)
{
ASN1_OBJECT *reject;
return X509_add1_reject_object (x509, reject);
}
-int
+MONO_API int
mono_btls_x509_add_explicit_trust (X509 *x509, MonoBtlsX509TrustKind kind)
{
int ret = 0;
platform_sources += ../../support/libm/complex.c
endif
+if !DYNAMIC_BTLS
if BTLS
btls_file_list := $(shell cat ../btls/build-shared/mono-btls-shared-lo.txt)
btls_static_file_list := $(shell cat ../btls/build-static/mono-btls-static-lo.txt)
btls_static_libs = $(btls_static_file_list)
btls_cflags = -I$(top_srcdir)/external/boringssl/include -I$(top_srcdir)/mono/btls
endif
+endif
#
# libtool is not capable of creating static/shared versions of the same
};
/* type of exception being "on hold" for later processing (see exception_type) */
-enum {
+typedef enum {
MONO_EXCEPTION_NONE = 0,
MONO_EXCEPTION_INVALID_PROGRAM = 3,
MONO_EXCEPTION_UNVERIFIABLE_IL = 4,
MONO_EXCEPTION_INLINE_FAILED = 15,
MONO_EXCEPTION_MONO_ERROR = 16,
/* add other exception type */
-};
+} MonoExceptionType;
/* This struct collects the info needed for the runtime use of a class,
* like the vtables for a domain, the GC descriptor, etc.
ICALL(NATIVEMETHODS_11, "WaitForInputIdle", ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle)
#endif /* !DISABLE_PROCESS_HANDLING */
-#if HAVE_BTLS
+#if defined(HAVE_BTLS) && !defined(HAVE_DYNAMIC_BTLS)
ICALL_TYPE(BTLS_BIO, "Mono.Btls.MonoBtlsBio", BTLS_BIO_1)
ICALL(BTLS_BIO_1, "mono_btls_bio_flush", mono_btls_bio_flush)
ICALL(BTLS_BIO_2, "mono_btls_bio_free", mono_btls_bio_free)
#include <sys/utsname.h>
#endif
-#if HAVE_BTLS
+#if defined(HAVE_BTLS) && !defined(HAVE_DYNAMIC_BTLS)
#include <btls/btls-ssl.h>
#include <btls/btls-bio.h>
#include <btls/btls-error.h>
mono_mb_emit_icon (mb, esize);
mono_mb_emit_byte (mb, CEE_MUL);
mono_mb_emit_byte (mb, CEE_PREFIX1);
- mono_mb_emit_byte (mb, CEE_CPBLK);
+ mono_mb_emit_byte (mb, CEE_CPBLK);
+ mono_mb_patch_branch (mb, label1);
break;
}
#include <mono/metadata/metadata.h>
#include <mono/metadata/image.h>
#include <mono/metadata/loader.h>
+#include <mono/metadata/class-internals.h>
#include <glib.h> /* GSList dep */
MONO_BEGIN_DECLS
typedef struct {
MonoVerifyInfo info;
- int8_t exception_type; /*should be one of MONO_EXCEPTION_* */
+ MonoExceptionType exception_type : 8; /*should be one of MONO_EXCEPTION_* */
} MonoVerifyInfoExtended;
#ifdef HOST_WIN32
" --mixed-mode Enable mixed-mode image support.\n"
#endif
+ " --handlers Install custom handlers, use --help-handlers for details.\n"
);
}
}
#endif
+
+#define MONO_HANDLERS_ARGUMENT "--handlers="
+#define MONO_HANDLERS_ARGUMENT_LEN G_N_ELEMENTS(MONO_HANDLERS_ARGUMENT)-1
+
/**
* mono_main:
* @argc: number of arguments in the argv array
} else if (strcmp (argv [i], "--nacl-null-checks-off") == 0){
nacl_null_checks_off = TRUE;
#endif
+ } else if (strncmp (argv [i], MONO_HANDLERS_ARGUMENT, MONO_HANDLERS_ARGUMENT_LEN) == 0) {
+ //Install specific custom handlers.
+ if (!mono_runtime_install_custom_handlers (argv[i] + MONO_HANDLERS_ARGUMENT_LEN)) {
+ fprintf (stderr, "error: " MONO_HANDLERS_ARGUMENT ", one or more unknown handlers: '%s'\n", argv [i]);
+ return 1;
+ }
+ } else if (strcmp (argv [i], "--help-handlers") == 0) {
+ mono_runtime_install_custom_handlers_usage ();
+ return 0;
} else if (argv [i][0] == '-' && argv [i][1] == '-' && mini_parse_debug_option (argv [i] + 2)) {
} else {
fprintf (stderr, "Unknown command line option: '%s'\n", argv [i]);
/*
* inline_method:
*
- * Return the cost of inlining CMETHOD.
+ * Return the cost of inlining CMETHOD, or zero if it should not be inlined.
*/
static int
inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **sp,
- guchar *ip, guint real_offset, gboolean inline_always)
+ guchar *ip, guint real_offset, gboolean inline_always)
{
MonoError error;
MonoInst *ins, *rvar = NULL;
/*
* mono_method_to_ir:
*
- * Translate the .net IL into linear IR.
+ * Translate the .net IL into linear IR.
+ *
+ * @start_bblock: if not NULL, the starting basic block, used during inlining.
+ * @end_bblock: if not NULL, the ending basic block, used during inlining.
+ * @return_var: if not NULL, the place where the return value is stored, used during inlining.
+ * @inline_args: if not NULL, contains the arguments to the inline call
+ * @inline_offset: if not zero, the real offset from the inline call, or zero otherwise.
+ * @is_virtual_call: whether this method is being called as a result of a call to callvirt
+ *
+ * This method is used to turn ECMA IL into Mono's internal Linear IR
+ * reprensetation. It is used both for entire methods, as well as
+ * inlining existing methods. In the former case, the @start_bblock,
+ * @end_bblock, @return_var, @inline_args are all set to NULL, and the
+ * inline_offset is set to zero.
+ *
+ * Returns: the inline cost, or -1 if there was an error processing this method.
*/
int
mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_bblock, MonoBasicBlock *end_bblock,
MonoThreadInfo *thread = mono_thread_info_current_unchecked ();
if (!thread) {
ctx->valid = FALSE;
- G_BREAKPOINT ();
+ g_error ("Invoked mono_thread_state_init_from_sigctx from non-Mono thread");
return FALSE;
}
/* Not used */
g_assert_not_reached ();
}
+
+// Custom handlers currently only implemented by Windows.
+#ifndef HOST_WIN32
+gboolean
+mono_runtime_install_custom_handlers (const char *handlers)
+{
+ return FALSE;
+}
+
+void
+mono_runtime_install_custom_handlers_usage (void)
+{
+ fprintf (stdout,
+ "Custom Handlers:\n"
+ " --handlers=HANDLERS Enable handler support, HANDLERS is a comma\n"
+ " separated list of available handlers to install.\n"
+ "\n"
+ "No handlers supported on current platform.\n");
+}
+#endif /* HOST_WIN32 */
#include <config.h>
#include <signal.h>
#include <math.h>
+#include <conio.h>
+#include <assert.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/loader.h>
#include <mmsystem.h>
#endif
+#define MONO_HANDLER_DELIMITER ','
+#define MONO_HANDLER_DELIMITER_LEN G_N_ELEMENTS(MONO_HANDLER_DELIMITER)-1
+
+#define MONO_HANDLER_ATEXIT_WAIT_KEYPRESS "atexit-waitkeypress"
+#define MONO_HANDLER_ATEXIT_WAIT_KEYPRESS_LEN G_N_ELEMENTS(MONO_HANDLER_ATEXIT_WAIT_KEYPRESS)-1
+
+// Typedefs used to setup handler table.
+typedef void (*handler)(void);
+
+typedef struct {
+ const char * cmd;
+ const int cmd_len;
+ handler handler;
+} HandlerItem;
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+/**
+* atexit_wait_keypress:
+*
+* This function is installed as an atexit function making sure that the console is not terminated before the end user has a chance to read the result.
+* This can be handy in debug scenarios (running from within the debugger) since an exit of the process will close the console window
+* without giving the end user a chance to look at the output before closed.
+*/
+static void
+atexit_wait_keypress (void)
+{
+
+ fflush (stdin);
+
+ printf ("Press any key to continue . . . ");
+ fflush (stdout);
+
+ _getch ();
+
+ return;
+}
+
+/**
+* install_atexit_wait_keypress:
+*
+* This function installs the wait keypress exit handler.
+*/
+static void
+install_atexit_wait_keypress (void)
+{
+ atexit (atexit_wait_keypress);
+ return;
+}
+
+#else
+
+/**
+* install_atexit_wait_keypress:
+*
+* Not supported on WINAPI family.
+*/
+static void
+install_atexit_wait_keypress (void)
+{
+ return;
+}
+
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+// Table describing handlers that can be installed at process startup. Adding a new handler can be done by adding a new item to the table together with an install handler function.
+const HandlerItem g_handler_items[] = { { MONO_HANDLER_ATEXIT_WAIT_KEYPRESS, MONO_HANDLER_ATEXIT_WAIT_KEYPRESS_LEN, install_atexit_wait_keypress },
+ { NULL, 0, NULL } };
+
+/**
+ * get_handler_arg_len:
+ * @handlers: Get length of next handler.
+ *
+ * This function calculates the length of next handler included in argument.
+ *
+ * Returns: The length of next handler, if available.
+ */
+static size_t
+get_next_handler_arg_len (const char *handlers)
+{
+ assert (handlers != NULL);
+
+ size_t current_len = 0;
+ const char *handler = strchr (handlers, MONO_HANDLER_DELIMITER);
+ if (handler != NULL) {
+ // Get length of next handler arg.
+ current_len = (handler - handlers);
+ } else {
+ // Consume rest as length of next handler arg.
+ current_len = strlen (handlers);
+ }
+
+ return current_len;
+}
+
+/**
+ * install_custom_handler:
+ * @handlers: Handlers included in --handler argument, example "atexit-waitkeypress,someothercmd,yetanothercmd".
+ * @handler_arg_len: Output, length of consumed handler.
+ *
+ * This function installs the next handler included in @handlers parameter.
+ *
+ * Returns: TRUE on successful install, FALSE on failure or unrecognized handler.
+ */
+static gboolean
+install_custom_handler (const char *handlers, size_t *handler_arg_len)
+{
+ gboolean result = FALSE;
+
+ assert (handlers != NULL);
+ assert (handler_arg_len);
+
+ *handler_arg_len = get_next_handler_arg_len (handlers);
+ for (int current_item = 0; current_item < G_N_ELEMENTS (g_handler_items); ++current_item) {
+ const HandlerItem * handler_item = &g_handler_items [current_item];
+
+ if (handler_item->cmd == NULL)
+ continue;
+
+ if (*handler_arg_len == handler_item->cmd_len && strncmp (handlers, handler_item->cmd, *handler_arg_len) == 0) {
+ assert (handler_item->handler != NULL);
+ handler_item->handler ();
+ result = TRUE;
+ break;
+ }
+ }
+ return result;
+}
+
void
mono_runtime_install_handlers (void)
{
#endif
}
+gboolean
+mono_runtime_install_custom_handlers (const char *handlers)
+{
+ gboolean result = FALSE;
+
+ assert (handlers != NULL);
+ while (*handlers != '\0') {
+ size_t handler_arg_len = 0;
+
+ result = install_custom_handler (handlers, &handler_arg_len);
+ handlers += handler_arg_len;
+
+ if (*handlers == MONO_HANDLER_DELIMITER)
+ handlers++;
+ if (!result)
+ break;
+ }
+
+ return result;
+}
+
+void
+mono_runtime_install_custom_handlers_usage (void)
+{
+ fprintf (stdout,
+ "Custom Handlers:\n"
+ " --handlers=HANDLERS Enable handler support, HANDLERS is a comma\n"
+ " separated list of available handlers to install.\n"
+ "\n"
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+ "HANDLERS is composed of:\n"
+ " atexit-waitkeypress Install an atexit handler waiting for a keypress\n"
+ " before exiting process.\n");
+#else
+ "No handlers supported on current platform.\n");
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+}
+
void
mono_runtime_cleanup_handlers (void)
{
guint8 *thunks;
/* Offset between the start of code and the thunks area */
int thunks_offset;
- guint32 exception_type; /* MONO_EXCEPTION_* */
+ MonoExceptionType exception_type; /* MONO_EXCEPTION_* */
guint32 exception_data;
char* exception_message;
gpointer exception_ptr;
* Per-OS implementation functions.
*/
void mono_runtime_install_handlers (void);
+gboolean mono_runtime_install_custom_handlers (const char *handlers);
+void mono_runtime_install_custom_handlers_usage (void);
void mono_runtime_cleanup_handlers (void);
void mono_runtime_setup_stat_profiler (void);
void mono_runtime_shutdown_stat_profiler (void);
return mono_test_marshal_array_delegate1 (null, 0, new ArrayDelegate1 (array_delegate2));
}
+ public delegate int ArrayDelegateBlittable (int i, string j,
+ [In, MarshalAs(UnmanagedType.LPArray,
+ ArraySubType=UnmanagedType.LPStr, SizeParamIndex=0)] int[] arr);
+
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_array_delegate")]
+ public static extern int mono_test_marshal_array_delegate1 (string[] arr, int len, ArrayDelegateBlittable d);
+
+ public static int array_delegate_null_blittable (int i, string j, int[] arr) {
+ return (arr == null) ? 0 : 1;
+ }
+
+ public static int test_0_marshal_array_delegate_null_blittable () {
+ return mono_test_marshal_array_delegate1 (null, 0, new ArrayDelegateBlittable (array_delegate_null_blittable));
+ }
+
public delegate int ArrayDelegate3 (int i,
string j,
[In, MarshalAs(UnmanagedType.LPArray,
etc/mono/config: ../data/config Makefile $(symlinks)
d=`cd ../support && pwd`; \
sed 's,target="$$mono_libdir/libMonoPosixHelper$(libsuffix)",target="'$$d'/libMonoPosixHelper.la",' ../data/config > $@t
+ d=`cd ../mono/btls/build-shared && pwd`; \
+ sed 's,target="$$mono_libdir/libmono-btls-shared$(libsuffix)",target="'$$d'/libmono-btls-shared$(libsuffix)",' $@t > $@tt
if test -z "$(libgdiplus_loc)"; then :; else \
- sed 's,target="$(libgdiplus_install_loc)",target="$(libgdiplus_loc)",' $@t > $@tt; \
- mv -f $@tt $@t; fi
- mv -f $@t $@
+ sed 's,target="$(libgdiplus_install_loc)",target="$(libgdiplus_loc)",' $@tt > $@ttt; \
+ mv -f $@ttt $@tt; fi
+ mv -f $@tt $@
+ rm -f $@t
$(tmpinst)/bin/mono: mono-wrapper etc/mono/config
$(mkinstalldirs) $(tmpinst)/bin