Compare commits

...
502 Commits
Author SHA1 Message Date
Andi McClure 1a7b8af8c4 Manually merge orbis-branch-30 and mono-4.8.0-branch 2017-02-14 16:00:36 -05:00
Andi McClure 0341e1fe48 Continued fixes for link errors; partially back out faulty change in previous commit 2017-02-14 14:18:21 -05:00
Andi McClure 25a2f3c30a Exclude missing pinvokes in orbis mono-static 2017-02-14 13:13:16 -05:00
Andi McClure bec53f1408 More orbis build fixes: localtime_r and gitpid should be configure.ac checked, BTLS should not be in the BCL 2017-02-13 16:01:41 -05:00
Martin Baulig 26e18c0dc8 [btls]: Partial merge of #4318 and #4337. (#4345) (#4367)
* [btls]: Partial merge of #4318 and #4337.

Partially merged commits 4ecb683 and 4c6c6f0 from master without adding
'MonoTlsSettings.CertificateSearchPath'.

* Add MonoBtlsProvider.SetupCertificateStore(MonoBtlsX509Store,MonoTlsSettings,bool)
  overload, which adds 'settings.TrustAnchors' if applicable.

* MonoBtlsContext: call it instead of having our own custom implementation.

* [btls]: Fix MonoBtlsX509Store.cs.AddTrustedRoots(). (#4340)

This internal method is only called from Mono.Btls.Interface.BtlsStore
and used by the web-tests.

Call MonoBtlsProvider.SetupCertificateStore(store) to make its
behavior consistent with the internal implementation.
(cherry picked from commit 8b18c84289)

* [btls]: Partial merge of #4318, #4337 and #4340.

Partially merged commits 4ecb683, 4c6c6f0 and 8b18c84 from master
(without adding 'MonoTlsSettings.CertificateSearchPath').

* Add MonoBtlsProvider.SetupCertificateStore(MonoBtlsX509Store,MonoTlsSettings,bool)
  overload, which adds 'settings.TrustAnchors' if applicable.

* MonoBtlsContext: call it instead of having our own custom implementation.

* Fix MonoBtlsX509Store.cs.AddTrustedRoots(). (#4340)

  This internal method is only called from Mono.Btls.Interface.BtlsStore
  and used by the web-tests. Call MonoBtlsProvider.SetupCertificateStore(store)
  to make its behavior consistent with the internal implementation.

(cherry picked from commit 50c26943d4)
2017-02-13 13:32:09 +01:00
Rodrigo Kumpera 0e2d4331e2 Merge pull request #4265 from ludovic-henry/4.8-fix-51545
[4.8][threads] Fix crash on unknown policy
2017-02-10 16:22:18 -05:00
Alexander Köplinger 9ac5bf2f02 [Mono.Security] Check NewLocalMachinePath too for deciding if store is machine store (#4357)
The code in X509Store only checked the legacy X509StoreManager.LocalMachinePath
when deciding whether CspProviderFlags.UseMachineKeyStore should be
set when dealing with private keys.

However, with BTLS we now also have X509StoreManager.NewLocalMachinePath.

This caused an issue/regression in the recent 4.8 builds that
started importing into the BTLS cert store when using cert-sync:
https://github.com/mono/mono/commit/968c60a0f32c7a4c92568c3feda7503f99b98c94

Because cert-sync is ran at package installation time as root
on Linux we would erroneously not pass UseMachineKeyStore (because
the paths between legacy and BTLS store are different), which in turn
causes KeyPairPersistence to look into the user directory, e.g.
~/.config/.mono/keypairs. Since on a clean machine that directory
hierarchy doesn't exist, it goes on and creates it -> we now have
the ~/.config directory owned by root which means a normal user
application can't write to it anymore (like NuGet) and crashes.

The fix is to check for the BTLS store path as well so KeyPairPersistence
uses the machine path and ~/.config is not created on package installation.

See e.g. https://github.com/travis-ci/travis-ci/issues/7271
(cherry picked from commit 12b44a0e94)
2017-02-09 18:32:15 +01:00
Alexander Köplinger 8aed84d16d [ci] Temporarily use http url to download server until cert is fixed
(cherry picked from commit 9281d4a7e6)
2017-02-09 15:56:00 +01:00
Andi McClure 6a097608e5 mobile_static modifications for 4.8 compatibility. Includes manual cherrypick from Koeplinger master commit 1d87187a1b, "Skip AOTing profile assemblies if AOT_BUILD_FLAGS is not set". 2017-02-08 11:08:40 -05:00
Alexander Köplinger df82e0775c Make sure .sh files always have LF line ending on Windows
This removes the need to set core.autocrlf=input when compiling
Mono on Windows via cygwin.

Always use LF line endings for config.rpath/configure.host as well
Add .sh extension to update_submodules so it gets correct line ending

Cherry-picked from:
b112f67c45
a16103f4b4
8aba97e42a
7ef66cccd9
2017-02-03 22:02:51 +01:00
Zoltan Varga 9b5bcfb740 [runtime] Change the vtable->initialized bitfield into a byte so its easier to load it from JITted code, the previous version was not using offsets infrastructure so it might not work when cross compiling. (#4068) 2017-02-03 14:07:20 -05:00
Zoltan Varga e33b8850ad [sdb] Add a Domain property to AssemblyMirror. (#4309) 2017-02-03 14:01:22 -05:00
Zoltan Varga 4760ebf8f1 [sdb] Add a SetThis () method to StackFrame which can be used to set the fields of the receiver for valuetype instance methods. Fixes #44341. (#3605) 2017-02-03 14:01:22 -05:00
Andi McClure 16453a8e98 Custom mobile_static modifications for orbis, part 2
Previous commit was missing changes to mobile_System.dll.sources.
2017-02-03 13:51:21 -05:00
Andi McClure c3385c4b93 Custom mobile_static modifications for orbis
Because this branch is already Orbis-only, hardcode in various changes that are needed in mobile_static to support orbis with the direct-pinvoke option. If thisis merged forward to newer mono branches, Orbis should get its own profile rather than taking over mobile_static.
2017-02-03 13:50:29 -05:00
Zoltan Varga e5f4843417 [runtime] Change the vtable->initialized bitfield into a byte so its easier to load it from JITted code, the previous version was not using offsets infrastructure so it might not work when cross compiling. 2017-02-03 13:50:15 -05:00
Vlad Brezae 8ca2285894 [sgen] Emit fast inline wbarrier instead of the wrapper one
Which seems to be about 4 times slower than the inline one.
2017-02-03 13:50:04 -05:00
Sebastien Pouliot ba7f16981e [cecil][linker] Bump cecil (cycle9 branch) and use the new setter for ExportedType.Scope. Fixes #51805 (#4324)
Older Cecil (0.9) were saving the scope of the actual type. This changed
with Cecil 0.10 where the ExportedType.Scope is saved, which could lead
to invalid assemblies being saved with the current linker code (which
could not update the scope without the cecil bump)

reference:
https://bugzilla.xamarin.com/show_bug.cgi?id=51805
2017-02-03 13:27:52 -05:00
Martin Baulig 78c1011587 Merge pull request #4316 from mono/work-51562
[btls]: Allow importing a null `byte[]`.  Fixes #51562.
(cherry picked from commit e4b4e981d6)
2017-02-02 12:07:27 +01:00
Jonathan Chambers afc625c7a3 Send assembly and type load events in the domain that contains them rather than the root domain in the attach/defer case. (#4314) 2017-02-01 14:58:41 -05:00
Zoltan Varga bfe78373f0 [x86] Fix a race in the single stepping seq point assembly, we were doing a null check using cmp_membase, following by a call_membase, but the value could change between the two instructions, leading to a nullref. Fixes #50117. (#4308) 2017-02-01 12:57:01 -05:00
Marek Safar 135ebeecfc [mono] Update ignored assemblies list to include System.Reflection.DispatchProxy 2017-01-30 17:48:19 +01:00
Zoltan Varga 084f91256b [bcl] Use FULL_AOT_RUNTIME instead of MOBILE_STATIC to disable some tests. Fixes #51331. 2017-01-27 13:56:06 -05:00
Rodrigo Kumpera 2aade3299a Merge pull request #4166 from evincarofautumn/fix-xmm-scanning-mac-4.8
Backport #3764 (Mac SIMD register scanning + ARM fix) to 4.8
2017-01-24 23:17:49 -05:00
Bernhard Urban 2b1791a189 [mono-sha1] make SHA1Transform thread-safe
should fix https://bugzilla.xamarin.com/show_bug.cgi?id=41133

The bug exposed itself as System.MethodAccessExceptionMethod which is
thrown when a method isn't allowed to call another method.  Several
things are checked for this: Among other things, the runtime checks if
the public key in the friend list of the caller assembly matches the
public key in the callee assembly.

The issue here was that two threads computed the SHA1 at the same time,
using the same buffer and therefore computing garbage.
2017-01-23 13:44:59 +01:00
Zoltan Varga ad21f86ce4 [aot] Allow the redirection of aot profile output to an already opened fd using outfile=#<fdnum>. 2017-01-23 05:49:14 -05:00
Zoltan Varga 6f90ed1612 [aot] Init the plt before setting acfg->methods_loaded which is accessed outside the lock. 2017-01-21 07:02:10 -05:00
Alexander Köplinger 214f1d3582 [profiler] Add mono-profiler-aot.h to EXTRA_DIST
This broke the tarball build.

(cherry picked from commit 3ec54319a3)
2017-01-20 18:27:59 +01:00
Alexander Köplinger 62b78ef7eb [System.Transactions] Add stubs and visibility fixes for netstandard20 APIs
(cherry picked from commit 59af66cfe9)
2017-01-20 03:08:46 +01:00
Shay Rojansky 2ce39b5677 Add unimplemented Transaction.PromoteAndEnlistDurable (#4129)
Which was added to .NET 4.5.2.
(cherry picked from commit 5612117861)
2017-01-20 03:04:51 +01:00
Rodrigo Kumpera 0de3c27f0e [runtime] A pair of small fixes for the ignore assembly work.
image.c (do_mono_image_load): Ignore refonly images when checking for ignorable assemblies.

icall.c (ves_icall_System_Reflection_Assembly_InternalGetAssemblyName): Load the image in ref only mode.
2017-01-19 10:31:31 -08:00
Alexander Köplinger bce6ecb205 [btls] Disable RC4 cipher suites by default
They should not be used anymore according to https://tools.ietf.org/html/rfc7465
and browser like Chrome, Firefox and Edge/IE [1] already removed them.

We should to do the same. To have everything in one place I also moved
the disabling of SSLv2/v3 to the mono_btls_ssl_ctx_new function as well
instead of disabling it on each single connection.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=51625

[1] https://blogs.windows.com/msedgedev/2016/08/09/rc4-now-deprecated/

(cherry picked from commit 7fca4572d9)
2017-01-18 21:58:59 +01:00
Rodrigo Kumpera 1bdd465b2c Merge pull request #4267 from kumpera/backport-nuget-fix
[runtime] Backport of the ignored assemblies workaround for nuget.
2017-01-18 14:15:14 -05:00
Rodrigo Kumpera e0faa61821 Fix the windows build. 2017-01-18 10:22:46 -08:00
Rodrigo Kumpera fd447a82fa [tools] Add nuget-hash-extractor tool to help produce the runtime ignored assemblies table.
This tool takes a folder full of nupkg file and print macro invocations to add to image.c:ignored_assemblies.

Usage:

make download
make run

The download.sh script downloads all nugets we want to ignore. So update it before running if you have more you want to add.
2017-01-18 10:22:39 -08:00
Rodrigo Kumpera 25d7403976 [runtime] Deny loading images that belong to a set of well known bad images.
Matching is done by assembly name and GUID. This should be enough to narrow
down the effect.

This approach is not very efficient as it waits for quite some of the loading
process to be on its way before detection. It works in the case that only a few
rare images are matched.
2017-01-18 10:22:34 -08:00
Ludovic Henry 4cf4ce8380 [threads] Fix crash on unknown policy
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=51545
2017-01-18 11:45:53 -05:00
Zoltan Varga 05491f8e34 Aot profiler 4.8 (#4256)
* [aot] Rewrite the AOT profiler. (#4176)

* [aot] Rewrite the AOT profiler.

The AOT profiler is used to collect the methods/instances used at runtime.
Usage:
* mono --profile=aot:output=out.aotprof <app>
* mono --aot=profile=out.aotprof <assembly>

The first command will run <app>, collecting the list of methods it uses into the out.aotprof file.
The second command passes the profile file to the AOT compiler to have it generate additional generic instances.

* [docs] Add a section for AOT profiling to the mono(1) man page.

* [build] Collect AOT profile info from building mscorlib in the build profile, and use it when aot-ing the csc assemblies.

* [runtime] Add missing mono-profiler-aot.h file.

* [runtime] Tidy up usage of MONO_PROFILER_API.

* [aot] Improve error handling in the aot profiler.

* [aot] Improve error handling, add more diagnostics.

* [aot] Add support for loading multiple profile files.

* [aot] Add a 'verbose' argument to the aot compiler, use it to print out more information on profile loading errors.

* [aot] Add 'profile-only' argument to only aot methods found in the profile file.

* [aot] Fix the build.
2017-01-17 22:28:43 -05:00
Zoltan Varga f11214c2b9 [lldb] Embed the actual entry in the jit descriptor structure to avoid a roundtrip. Add a timer for the amount of time spent in __mono_jit_debug_register_code (). Avoid emitting info for specific trampolines for now. 2017-01-17 04:13:59 -05:00
Zoltan Varga 8a89435e61 Lldb 4.8 (#4252)
* Lldb support code for mono (#4225)

* Initial version of lldb support code.

* [lldb] Keep all the debug entries in a linked list so lldb can read it after attaching to the process.

* [lldb] Add an --enable-minimal=lldb option to disable the code. Add locking.

* [lldb] Add support for dynamic methods by adding a new protocol entry for unloading code regions.

* [lldb] Add beginnings of a test suite using the lldb python bindings.

* [lldb] Emit line number info for methods, not used yet.

* [lldb] Add dummy fields to structures to make sure 64 bit fields are 64 bit aligned.

* [lldb] Finish emission of line number info.

* [lldb] Use mono_method_full_name () for computing method names.

* [lldb] Emit info for specific trampolines as well.

* [lldb] Add tests for line number info.

* [lldb] Fix unwind info encoding on x86.

* [lldb] Skip seq points with no native offset.

* [lldb] Add tests for breakpoints.

* [lldb] Use mono_unwind_get_cie_program () instead of mono_arch_get_cie_program () which might not be available on all platforms.

* [lldb] Avoid a crash in mono_lldb_remove_method () if lldb is not enabled.
2017-01-17 01:13:35 -05:00
Alexander Köplinger cd26828a8e [btls] Remove btls-cert-sync and integrate it into cert-sync
cert-sync already knew how to import into the BTLS cert store,
update it to always import into both stores so we don't need
the btls-cert-sync tool anymore.

(cherry picked from commit 968c60a0f3)
2017-01-13 14:58:39 +01:00
Alexander Köplinger cf9ec6d715 [Mono.Security] Consider _newFormat when building certificate collection in X509Store
It only looked at the legacy format where certificates had the *.cer
extension, the new BTLS store uses *.0 extension.

(cherry picked from commit 3aa59f2e6b)
2017-01-13 14:56:04 +01:00
Alexander Köplinger 0e142e1ac4 [corlib] Disable a few tests that are not supported on MOBILE_STATIC for now
They were added in 895f3f5ae8.
2017-01-12 19:51:05 -05:00
Aleksey Kliger dd8ecf3a1d [runtime] Fix compile error in mono_domain_from_appdomain when DISABLE_REMOTING is defined
mono_defaults.transparent_proxy_class is #ifdef'd out when remoting is disabled.
2017-01-12 17:39:07 -05:00
Bernhard Urban 52b33a97f8 [unwind] respect link register on ppc and use right dwarf register for PC depending on ELF spec version
fixes a regression introduced by 3baad19c6c
2017-01-12 19:26:45 +01:00
Zoltan Varga 0c793ed911 [runtime] Support TransparentProxy-es in mono_domain_from_appdomain (). 2017-01-12 13:19:46 -05:00
Marek Safar 61002255ab Merge pull request #4236 from marek-safar/cecil-cycle9
Bump external/cecil to the cycle9 branch
2017-01-12 14:57:06 +01:00
Vlad Brezae b02e6216c9 [sgen] Trim worker gray queue after finishing concurrent mark
This was keeping around potentially many unused gray queue sections, or even constantly leaking in the case of many majors since every time we start a concurrent major we redirect some additional gray queue sections from main to worker thread gray queues, leading to unbounded growth. The gc thread always trims its gray queues at the end of the collection.

On graph8 this reduces memory usage by 5%. Fixes mem leak from #41995
2017-01-12 14:11:05 +02:00
Marek Habersack 28d9c96aec [BCL,Android] Get DNS server addresses from Android
This change implements retrieving a list of DNS server addresses from Android
instead of attempting to parse `/etc/resolv.conf` which doesn't exist on
Android.
The list is retrieved by calling native function in Xamarin.Android that gets
the data from the system.

Part 2 of fix for https://bugzilla.xamarin.com/show_bug.cgi?id=48016
2017-01-12 12:59:42 +01:00
Marek Safar 51e93d4f4c Bump cecil to cycle9 branch 2017-01-12 10:54:12 +01:00
Zoltan Varga eae40d43e0 [lldb] Avoid a crash in mono_lldb_remove_method () if lldb is not enabled. 2017-01-11 17:56:34 -05:00
Chris Hamons ac56f51c12 Rewrite two tests to pass in 4.8 without nunit fixes from master 2017-01-11 16:51:09 -06:00
Chris Hamons f4096a8128 Mono BCL test fixes so XM can run them (#4210) 2017-01-11 16:51:08 -06:00
Alexander Köplinger 1bd57d124a Merge pull request #4223 from spouliot/mono-4.8-bump-cecil
[cecil] Bump external/cecil to the current head
2017-01-11 23:39:06 +01:00
Martin Baulig 0181639447 [BTLS]: Fix callback method signatures.
(cherry picked from commit 41b471428a)
2017-01-11 23:37:18 +01:00
Martin Baulig a3ad9dcefa [BTLS]: Remove unused local variables.
(cherry picked from commit 0bb7e2e421)
2017-01-11 23:37:17 +01:00
Alexander Köplinger bd4ac72845 [btls] Create a native BTLS key handle for X509CertificateImplBtls.PrivateKey
When setting X509CertificateImplBtls.PrivateKey we'd previously just
update the fallback instance. This causes problems if other code
internal to System.dll like MonoBtlsContext.SetPrivateCertificate()
tries to fetch the NativePrivateKey since it'd be null at that point.

This scenario happens e.g. with HttpListener, it supports a special
directory in ~/.config/.mono/httplistener which contains <port>.cer
and <port>.pvk files (public and private key) that will be used
as the server certificate. In that code we're reading the private
key from the file and assigning it to X509CertificateImplBtls.PrivateKey
without ever having a native BTLS handle.

The fix is to create such a native BTLS handle from the managed
private key when needed.

Note that we can't simply always do this e.g. in the PrivateKey
setter because the setter will be used with instances that
don't actually contain a private key. We can't throw in those
cases so instead we do it only when NativePrivateKey is accessed.

To make the code clearer and easier to read, `privateKey` was
renamed to `nativePrivateKey` in X509CertificateImplBtls.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=46602

(cherry picked from commit a9d75b4b66
and commit e135936e2f)
2017-01-11 23:37:17 +01:00
Alexander Köplinger 549577783b [btls] Call Reset() in X509CertificateImplBtls.Import()
Otherwise we'd not clear the fields like subjectName, issuerName, etc.
and the properties they're backing would continue to return old values.

(cherry picked from commit af85a09321)
2017-01-11 23:37:16 +01:00
Alexander Köplinger c38864e93c [btls] Free handle returned by EVP_PKEY_get1_RSA
From the header docs:

> The |get1| functions return a fresh reference to the underlying
> object or NULL if |pkey| is not of the correct type.

(cherry picked from commit 2cadd74de8)
2017-01-11 23:37:15 +01:00
Zoltan Varga cb2b62de5c [msvc] Add lldb.c to the vs project. 2017-01-11 16:51:54 -05:00
Zoltan Varga 798f8800f2 [lldb] Use mono_unwind_get_cie_program () instead of mono_arch_get_cie_program () which might not be available on all platforms. 2017-01-11 16:23:06 -05:00
Alexander Köplinger 5412bf83f4 Fix build break due to Cecil API change
https://github.com/jbevain/cecil/commit/42db79cc16f1cbe8dbab558904e188352dba2b41
2017-01-11 14:30:33 -05:00
Zoltan Varga 498a47eab3 Lldb support code for mono (#4225)
* Initial version of lldb support code.

* [lldb] Keep all the debug entries in a linked list so lldb can read it after attaching to the process.

* [lldb] Add an --enable-minimal=lldb option to disable the code. Add locking.

* [lldb] Add support for dynamic methods by adding a new protocol entry for unloading code regions.

* [lldb] Add beginnings of a test suite using the lldb python bindings.

* [lldb] Emit line number info for methods, not used yet.

* [lldb] Add dummy fields to structures to make sure 64 bit fields are 64 bit aligned.

* [lldb] Finish emission of line number info.

* [lldb] Use mono_method_full_name () for computing method names.

* [lldb] Emit info for specific trampolines as well.

* [lldb] Add tests for line number info.

* [lldb] Fix unwind info encoding on x86.

* [lldb] Skip seq points with no native offset.

* [lldb] Add tests for breakpoints.
2017-01-11 12:45:49 -05:00
Sebastien Pouliot 0c88911717 [cecil] Bump external/cecil to the current head
xamarin-macios/cycle9 needs this to fix #51336 [1] and handle broken
.mdb [2]

[1] https://bugzilla.xamarin.com/show_bug.cgi?id=51336
[2] https://github.com/mono/cecil/commit/045b0f9729905dd456d46e33436a2dadc9e2a52d
2017-01-10 14:50:10 -05:00
Alexander Köplinger 8a272caeb7 [bcl] Remove System.Activities.Presentation folder from referencesource
We won't import it into Mono anytime soon and the long paths
cause issues when checking out Mono on Windows.

(cherry picked from commit ca5104094c)

Marek requested this being backported to the 4.8 branch.
2017-01-10 16:34:17 +01:00
Alexander Köplinger dd3ec5387e [btls] Capture inner exception in MobileAuthenticatedStream
Previously we'd just throw the catched exception again
which overwrites its stacktrace, making it less useful
since all you can see is e.g. a NullReferenceException
(re)thrown at MobileAuthenticatedStream:218.

We now capture the original exception information so
the stacktrace is more complete.

(cherry picked from commit 0007e99a87)
2017-01-09 19:54:48 +01:00
Alexander Köplinger a414782e79 [btls] Use MONODROID ifdef instead of ANDROID
We use the former everywhere else in the codebase.

(cherry picked from commit ecf1f25fcd)
2017-01-09 19:54:45 +01:00
Alexander Köplinger 6fb1799afd [btls] Fix wrong path returned from MonoBtlsProvider.GetSystemStoreLocation()
The path ".mono/certs/NewTrust" doesn't actually exist,
it's called ".mono/new-certs/Trust". Look it up from
MonoBtlsX509StoreManager instead.

This API isn't used anywhere in the BTLS code, that's
probably why it wasn't noticed.

(cherry picked from commit 6d2420f49a)
2017-01-09 19:54:42 +01:00
Alexander Köplinger f15b641caa [Mono.Security] Add message to obsolete APIs with replacements
It's very confusing to get an "obsolete" warning
without knowing what to replace the API with.

(cherry picked from commit 8c95b57796)
2017-01-09 19:54:28 +01:00
Zoltan Varga e0baa814b0 [aot] Avoid a crash in the aot compiler if a delegate doesn't have a BeginInvoke ()/EndInvoke () method. Fixes #51206. 2017-01-05 19:47:46 -05:00
Alexander Köplinger 9e8f0ee257 [btls] Pass CC and CXX to the BTLS CMake and disable BTLS on older GCC (#4200)
CMake doesn't pick up the compiler from the PATH by default,
it only looks in default locations so without this we might
end up using a different compiler for BTLS than for the main
Mono build which we don't want.

BTLS also requires a fairly new GCC which includes C++11
features, added a quick check for stdalign.h which BTLS
requires and disable it if the header isn't found.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=46712

(cherry picked from commit 488b550ac0)
2017-01-04 19:53:03 +01:00
Zoltan Varga 7e89965aed Fix a warning. 2017-01-04 12:53:22 -05:00
Zoltan Varga da06f25114 [runtime] For delegate invoke wrappers, store the generic invoke method in the wrapper info and inflate it when inflating the wrapper. Fixes ipy failure. (#3821) 2017-01-04 12:28:30 -05:00
Zoltan Varga 6e9281a325 [aot] Make sure generic wrappers are unique by creating shared versions of the them in the same order that AOT creates them (shared method -> wrapper). 2017-01-04 12:28:22 -05:00
Marek Safar 038ff4a439 [mcs] Disable more array interpolation on user code. Fixes #51166 2017-01-02 19:13:14 +01:00
David Karlaš b61b37b192 [Debugger] Fixed bug where we loop randomly long(+1 part) and optimised stepping in(over) non-user code 2016-12-28 09:34:57 -05:00
Alexander Köplinger d9a9f4edf5 [btls] Backport warning fixes to reduce diff with master 2016-12-22 14:32:26 +01:00
faulpeltz 335aa396c9 Fix MonoBtlsX509StoreManager machine store paths (#4027)
The machineXYZPath fields are initialized with machinePath instead of
userPath which caused the machine stores not to work at all
(cherry picked from commit 10e1dc5314)
2016-12-22 14:09:28 +01:00
Marek Safar e4df973be9 [System.Xml] Disable failing tests on old xslt implementation 2016-12-22 10:32:04 +01:00
Marek Safar 75c4e9e2ec Merge pull request #4186 from rolfbjarne/dynamic-method-ios-4.8.0
[test] DynamicMethod isn't available on iOS.
2016-12-21 16:46:25 +01:00
Rolf Bjarne Kvinge 28aec735e4 [test] Use FULL_AOT_RUNTIME instead of MONOTOUCH. 2016-12-21 16:33:09 +01:00
Ubuntu 991a5177e8 Fix bug 48516 2016-12-21 09:49:24 -05:00
Rodrigo Kumpera 521fc975d7 Merge pull request #4181 from kumpera/symbolificate-fixes-backport
Backport of the symbolificate changes from master. Should fix #43417 and #43199.
2016-12-21 11:03:02 -02:00
Rolf Bjarne Kvinge 2fa80018e9 [test] DynamicMethod isn't available on iOS. 2016-12-21 11:43:02 +01:00
Alexander Kyte d5e3a644ba [runtime] Always expire a non-resolved hostname's cache
This addresses a regression here:

https://bugzilla.xamarin.com/show_bug.cgi?id=45761

The commits
97e51abfcf and
d35b5d2188

changed control flow such that if the host can't be resolved
and host is set to null, then the later check will return null
for the duration that HasTimedOut is false.
2016-12-21 11:07:49 +01:00
Zoltan Varga a35b282ab8 [jit] Allow simple TLS accesses in gsharedvt methods. Properly propagate errors in fill_runtime_generic_context (). Fixes #49056. 2016-12-20 18:23:33 -05:00
Rolf Bjarne Kvinge 2b01b54eaf [System] Fix ClientWebSocketTest to not throw exceptions in the constructor, but instead in the individual tests. Fixes #47167. (#4180)
Finding a free port on watchOS fails with a PlatformNotSupportedException, but
if the exception is thrown in the constructor, the ExpectedException attribute
isn't taken into account, causing the test to error out.

https://bugzilla.xamarin.com/show_bug.cgi?id=47167
2016-12-20 21:48:12 +01:00
Jo Shields 0e7e6acf97 [mkbundle] Don't use Path.GetDirectoryName on directory (#4130)
`directory` is already a directory. It's in the name.

`Path.GetDirectoryName ("/path/to/a/thing")` returns `"/path/to/a"`, whether
`thing` is a directory or not. If there's a trailing `/` then it returns
the directory, not the parent - but we don't have a trailing `/`.

This fixes an issue where the path needs to be created by hand before an
SDK can be downloaded.
(cherry picked from commit 031d79c2c4)
2016-12-20 20:02:45 +01:00
Rodrigo Kumpera 60fbf13e0d [mono-symbolificate] Add test for nested type arguments and ambiguous matches. 2016-12-20 15:05:53 -02:00
Rodrigo Kumpera e56681a5b1 [mono-symbolificate] Add support for runtime generated stacktraces and fix a bug.
First the bug fix.
If we hit a method with a nested type as argument, we would not include the outer types and fail to match.

Now for the big change.
The runtime now includes mvid and aotid in the stacktraces it generates. This makes them symboficatable but
with the side effect that the runtime adopts a more compact and slightly different format. Differences includes:

- short name for primitives (int, object, string, etc)
- <> for generic instances
- / for type nesting
- generics vars are appended with _REF
2016-12-20 13:59:12 -02:00
Rodrigo Kumpera 20ba0fa18c [mini] Implement callback that gives metadata access to seqpoint information. 2016-12-20 12:49:56 -02:00
Rodrigo Kumpera d18e04fb82 [runtime] Include seqpoints, mvid and aotid on runtime generated stack traces. 2016-12-20 12:48:40 -02:00
Rodrigo Kumpera b17cb80f03 [runtime] Extract mono_runtime_get_aotid from the icall code. 2016-12-20 12:48:37 -02:00
Rodrigo Kumpera 0062606983 [runtime] Use commas for array rank instead of a number when stringifying. 2016-12-20 12:48:32 -02:00
Miguel de Icaza 4fb5d0a83f [btls] Fix the intended behavior, btls is not a default on macOS 2016-12-20 09:38:10 -05:00
Marek Safar 7042e7de8a [System.Xml] Add support for msxsl format functions. Fixes #50242 2016-12-20 14:49:34 +01:00
Niklas Therning 0531e5d86e Fix broken Windows build due to missing mini-exceptions-native-unwinder.c
Commit 41272d634b removed mono/mini/mini-
exceptions-native-unwinder.c from the source tree but didn't update msvc
/libmono-static.vcxproj accordingly causing the VS build to fail.
2016-12-20 13:39:27 +01:00
Bernhard Urban 91bd1f1596 [exception] remove dynamic loading of libunwind/libcorkscrew on Android
we will rely on the output of debuggerd in order to get a native stack
trace.  The arguments to support that:

(a) native stack trace by debuggerd is at least as good as the one we get via
    libunwind (most of the time the trace provided by libunwind is useless?)

(b) we cannot screw up by accident (e.g. we have seen issues with a too small altstack)

(c) we don't need to maintain the libunwind integration into mono (which we
    sort of had to do because of the upcoming dlopen limitation in Android 7.0
    Nougat).

(d) the libmonosgen-2.0.so had about one megabyte more footprint (16mb ->
    17mb). I'm talking about a debug build here though.

See mailing list discussion for more information:
http://lists.dot.net/pipermail/android-devel/2016-December/000026.html

partial cherry-pick of #4124
2016-12-20 00:20:38 +01:00
Bernhard Urban ff5dc2a04c [exception] print process map when crashing on Linux
backport of 5247fa62ed
2016-12-20 00:20:38 +01:00
Bernhard Urban 6a79b26d42 [unwinding] set DUMPABLE, so debuggerd can ptrace us
backport of c54da4dbf9
2016-12-20 00:20:38 +01:00
Bernhard Urban 57cbadd21a [unwind] reduce frame size of mono_unwind_frame ()
on arm32 it goes down from 5120 bytes to 676 bytes in terms of frame
size.

backport of 3baad19c6c
2016-12-20 00:20:38 +01:00
Zoltan Varga ad24537514 [arm] Fix llvm support for HFA arguments. 2016-12-19 18:03:34 -05:00
Miguel de Icaza cbaaac5b40 [btls] Do not make BTLS the default on Mac 2016-12-19 16:47:04 -05:00
Miguel de Icaza d2de9a0652 Mono 4.8.0 use btls (#4137)
* Change default to use BTLS
2016-12-19 10:33:45 -05:00
Jon Purdy 940a7c4827 [runtime] Fix Mach ARM assert.
This changes mono_mach_arch_get_thread_fpstate_size to return a value,
rather than asserting. The actual float state isn't used yet. This also
assumes NEON, which may not be correct.
2016-12-16 12:06:25 -08:00
Sebastien Pouliot df81fe40c5 Fix marking types inside custom attributes. Fixes #47064 (#4126)
The existing code for marking custom attributes was only marking the type
and the lowest element type, i.e. marking (1) would also mark (3) but
would miss (2).

1. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[][]))]
2. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[]))]
3. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>))]

That's generally not an issue since the type is marked (elsewhere).
However, in the case of custom attributes, we need to update the Scope
to what was resolved (and that was missed).

That lack of updated Scope means that a PCL assembly would still keep
references to System.Runtime, which is something that the linker is
eliminating (causing a TypeLoadException at runtime)

reference:
* https://bugzilla.xamarin.com/show_bug.cgi?id=47064

Note: The linker is not in mono/master and there's a PR in the new
linker repo for the same https://github.com/mono/linker/pull/7
2016-12-16 11:13:57 -05:00
Jon Purdy ae7ea78de8 [runtime] Fix scanning of SIMD registers on Mac.
Include XMM regs in context. Use names instead of hardcoded offsets.
2016-12-15 13:00:54 -08:00
Bernhard Urban 1e31bd78e6 [aot] fix linker invocation for llvm mode on linux
clang++ should only be used for llvm_only (aka. bitcode) mode.

this is a follow up fix for:
https://github.com/mono/mono/commit/7d238ddd5edeeb42cec5e07b6d6527d16332f921
and
https://github.com/mono/mono/commit/fc5305d2af1b6891b05cb82342bf92d4659546e1

fixes https://bugzilla.xamarin.com/show_bug.cgi?id=46375
2016-12-15 13:50:04 +01:00
Ankit Jain 8a1a7d51be [xbuild] Bump buildtools to get support for netstandard 1.6
https://github.com/mono/buildtools/commit/9b6ee8686be55a983d886938165b6206cda50772
2016-12-14 15:21:47 -05:00
Sebastien Pouliot 9153ecfe60 [system] Remove port number from TLS Server Name Identification (SNI). Fixes #46549 (#4120)
The port number should not be included along the host name. Otherwise
the server will refuse the connection (and we'll throw). This is a
problem when servers are not using the default (443) SSL/TLS port.

ref: https://bugzilla.xamarin.com/show_bug.cgi?id=46549

The BTLS provider was fixed but the old MonoTLS (managed) provider had
the same issue.

Another PR will be made to fix AppleTLS in xamarin-macios repo [2]

[1] https://github.com/mono/mono/pull/3939
[2] https://bugzilla.xamarin.com/show_bug.cgi?id=45994
(cherry picked from commit faf2a56710)
2016-12-14 20:26:40 +01:00
Marek Safar 01d3930018 Merge pull request #4141 from lambdageek/bug-49686-c9
[C9][sre] Implement DynamicMethod.GetCustomAttributes() and IsDefined() (Fixes #49686)
2016-12-14 11:08:57 +01:00
Aleksey Kliger 29827d656b [sre] Implement DynamicMethod.GetCustomAttributes() and IsDefined ()
Per .NET documentation, DynamicMethod does not support custom attributes
exception the MethodImplAttribute pseudo-custom attribute.

Also change GetMethodImplementationFlags to include NoInlining as on .NET

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=49686
2016-12-13 17:14:39 -05:00
Aleksey Kliger 2bd5559653 [test] Test for System.Linq.Expressions.MethodCallExpression with a DynamicMethod
Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=49686
2016-12-13 17:10:15 -05:00
Aleksey Kliger bc647488db [test] Test for System.Reflection.Emit.DynamicMethod.GetCustomAttributes 2016-12-13 17:10:14 -05:00
Vlad Brezae ded59a04ce [arm] Disable fast tls on embedded mono with __thread
We don't have MONO_THREAD_VAR_OFFSET on embedded mono. Fixes #44918.
2016-12-13 23:51:10 +02:00
Vlad Brezae 6f4130a485 [arm] Disable no fast tls warning
It scares people and we no longer care if we're fallbacking to pthread or not since we plan to only and directly use pthread in the future.
2016-12-13 23:50:43 +02:00
Vlad Brezae 7f6d9038eb [runtime] Fix monitor exception throwing
mono_monitor_ensure_owned used to throw exception directly and not return. After switching the runtime to use pending exceptions, monitor code would continue running assuming we owned to monitor.

Fixes 46994
2016-12-13 23:48:51 +02:00
Zoltan Varga 6b66745741 [arm64] Handle fp regs in mono_sigctx_to_monoctx () on linux, recent gcc versions generate code which store object references in them, so sgen now requires this. (#4127) 2016-12-13 01:05:55 +01:00
Marek Safar 9b0d22277e [Microsoft.CSharp] Tweaks 76f97e3073 to not call new API from Microsoft.CSharp. Fixes #47353
This is a workaround for runtime assembly loading bug always preferring local assembly
2016-12-12 17:29:09 +01:00
Rolf Bjarne Kvinge aca1492e70 [llvm] Fix intrinsic Selector.GetHandle support. (#4105)
An OBJC_IMAGE_INFO section must be emitted when we emit the native equivalent
of @selector for Selector.GetHandle, otherwise the Objective-C runtime will
not process the selectors in this image at runtime (and we may end up with
duplicate selectors in memory).

The AOT compiler already does this here: https://github.com/mono/mono/blob/2eda626316fd8f70cd98947af2f89b7ca9b0ebe5/mono/mini/aot-compiler.c#L9657-L9661
2016-12-06 18:50:04 -05:00
Alexander Köplinger 6c326d3938 Merge pull request #4095 from lewurm/libdir-4.8
[4.8] Handle relocatable libMonoPosixHelper.so when --libdir= isn't lib/
2016-12-06 01:57:33 +01:00
Bernhard Urban d2623ed2af [mono-config] fix warning (#3820)
```
mono-config.c:324:14: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                                        g_free (libdir);
                                                ^~~~~~
../../eglib/src/glib.h:125:20: note: passing argument to parameter 'ptr' here
void g_free (void *ptr);
                   ^
1 warning generated.
```
2016-12-05 18:53:18 +01:00
Bernhard Urban b50663aceb [assembly] indicate the caller is responsible to free the string for mono_native_getrootdir ()
partial backport of 1fb083d2d4
2016-12-05 18:53:15 +01:00
Bernhard Urban 8fd763d4cd [mono-config] Handle relocatable libMonoPosixHelper.so when --libdir= isn't lib/
Backported from PR #3591 (a342bb00ca)

This change is critical on 64-bit Redhat based distributions
2016-12-05 18:52:49 +01:00
Alexander Köplinger b7df98a4e1 Merge pull request #4008 from ludovic-henry/4.8-backport-1c9e34cce5e53ec5126d546a3014bc1493425219
[4.8][threads] Check InternalThread.last just after checking corlib version
2016-12-05 18:47:49 +01:00
Marek Safar 5e1b0a0252 [mcs] Fixes runtimemetadataversion option check 2016-11-30 16:54:11 +01:00
Alexander Köplinger 1f515263ca Merge pull request #4025 from akoeplinger/4.8-monodl
[4.8][runtime] Don't add mono-dl.h to loader.h. Move the internal function…
2016-11-28 11:19:16 +01:00
Alexander Köplinger 902b4a903d [Facades] Don't build System.Drawing.Primitives.dll by default for monotouch_watch profile
It needs special logic like the other monotouch profiles in the products
since we don't have a System.Drawing assembly/types for these profiles in Mono
and don't embed the types in the facade anymore after 1074fe91bd.

(cherry picked from commit 1562fc6fe5)
2016-11-25 20:51:14 +01:00
Marek Safar aa07a3cd80 [Facades] Remove watch special System.Drawing.Primitives, all types are now available in watchos.dll 2016-11-25 18:02:14 +01:00
Rodrigo Kumpera 07a1753c51 [runtime] Don't add mono-dl.h to loader.h. Move the internal function to an internal header.
(cherry picked from commit 2df8d8091e)
2016-11-25 17:13:15 +01:00
Alexander Köplinger b89ab049a0 [mkbundle] Print error message when assemblies couldn't be loaded
There were two places in mkbundle where it'd simply exit without printing anything,
leading to confusion such as in https://bugzilla.xamarin.com/show_bug.cgi?id=46479.

(cherry picked from commit cea5f28d2c)
2016-11-25 17:08:49 +01:00
Alexander Köplinger 5dfd0f3802 [corlib] Move ComAwareEventInfo stub into System.Core
It was mistakenly added to corlib, it is in System.Core.dll on .NET

(cherry picked from commit 7669c811ff)
2016-11-25 12:48:47 +01:00
Marek Safar 2148d34f9f [mcs] Count arity correctly for deeply nested types 2016-11-24 12:00:51 +01:00
Martin Baulig d2891e0c2e Merge pull request #3962 from mkorkalo/fix_MonoBtlsContext_memory_leak
fix a massive memory leak in MonoBtlsContext
(cherry picked from commit c8f2e68962)
2016-11-23 16:52:31 +01:00
Ludovic Henry 896fa81970 [runtime] Fix build 2016-11-23 09:21:58 -05:00
Zoltan Varga 2eda626316 [runtime] Allocate the temporary vtable array using g_malloc in mono_class_setup_vtable (), alloca can overflow for large vtable sizes. Hopefully fixes #45140. (#4006) 2016-11-22 22:26:37 -05:00
Ludovic Henry 2a38c3fad8 [threads] Check InternalThread.last just after checking corlib version 2016-11-22 15:23:52 -05:00
Martin Baulig 7335f3aa1f Merge pull request #3975 from mono/cherry-pick-3967
Merge pull request #3967 from atsushieno/fix-linux-btls
2016-11-22 15:17:34 +01:00
Marek Safar 87f3182f8f [System] Add range check for empty URI prefix when it also contains unicode character. Fixes #47205 2016-11-18 18:28:20 +01:00
Zoltan Varga c14675323c [sdb] Error out when trying to obtain objects from unloaded domains, we have to check domain->state as well since the object references become invalid before we received the domain unloaded profiler event. Fixes #44381. 2016-11-17 14:07:33 -05:00
Ankit Jain 7deecb5006 Merge pull request #3982 from radical/fix-xbuild-tgt-4.8
[xbuild] Handle a repeat build of a target, when building through ..
2016-11-17 13:41:42 -05:00
Aleksey Kliger (λgeek) 41cce14fe5 Merge pull request #3978 from lambdageek/c9-stack-mark-pop
[C9][coop] Fix mono_stack_mark_pop
2016-11-17 11:19:06 -05:00
Alexander Köplinger 37fe814682 [ci] Add option to not run tests via CI_TAGS
(cherry picked from commit 7b2dcdae0d)
2016-11-17 16:09:47 +01:00
João Matos 99f12ea907 Merge pull request #3954 from rolfbjarne/offsets-tool-autoreclone-4.8.0
[offsets-tool] Make sure to re-clone when the hash for the cpp binaries changes.
2016-11-17 13:29:35 +00:00
Alexander Köplinger 4c51a5caac [ci] Reduce make parallelism on ppc64
-j4 seems to fail the build.

(cherry picked from commit f53186653c)
2016-11-17 03:59:09 +01:00
Ankit Jain 87181decdc [xbuild] Handle a repeat build of a target, when building through ..
.. `Project.Build(..)`. For example, in:

```
	<MSBuild Projects="bar.proj" Targets="foo;foo" />
```

The second invocation of `foo`, in the *same* `Project.Build(..)` call,
would get skipped, but BuildTarget assumed that no previous `outputs`
entry existed in the `targetOutputs` dictionary.

System.Exception: MSBuild operation failed ---> System.ArgumentException: Item has already been added. Key in dictionary: 'foo'  Key being added: 'foo'
  at System.Collections.Hashtable.Insert (System.Object key, System.Object nvalue, System.Boolean add) [0x00200] in <94fd79a3b7144c54b4cb162b50fc7761>:0
  at System.Collections.Hashtable.Add (System.Object key, System.Object value) [0x00000] in <94fd79a3b7144c54b4cb162b50fc7761>:0
  at Microsoft.Build.BuildEngine.Project.BuildTarget (System.String target_name, System.Collections.IDictionary targetOutputs) [0x0007e] in <b1524340ac7e4c06b22fac1b2db62c08>:0
  at Microsoft.Build.BuildEngine.Project.BuildInternal (System.String[] targetNames, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings buildFlags) [0x00134] in <b1524340ac7e4c06b22fac1b2db62c08>:0
  at Microsoft.Build.BuildEngine.Project.Build (System.String[] targetNames, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings buildFlags) [0x0004b] in <b1524340ac7e4c06b22fac1b2db62c08>:0

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=44549
2016-11-16 21:55:33 -05:00
Alexander Köplinger 36dd163c91 [corlib] Remove public ctor from IncrementalHash
It doesn't have a public constructor in netstandard/corefx.
2016-11-17 03:33:35 +01:00
Aleksey Kliger 67121311ab [coop] Fix mono_stack_mark_pop
We need to restore the old size into the old top chunk, not the current
top chunk.
2016-11-16 17:16:09 -05:00
Martin Baulig 05c682197b Merge pull request #3956 from directhex/install-btls-certs-in-jenkins
[btls] Download & extract BTLS certs, on Linux builds.
(cherry picked from commit 4adc1028a5)
2016-11-16 22:03:37 +01:00
Martin Baulig d990810997 Merge pull request #3967 from atsushieno/fix-linux-btls
Fix btls build for Linux.
(cherry picked from commit 75ba28a0bb)
2016-11-16 21:57:41 +01:00
Martin Baulig e6aa904d9d Merge pull request #3950 from mono/work-btls-sni-2
[BTLS]: Add MonoBtlsSsl.GetServerName() and set MonoTlsConnectionInfo.PeerDomainName
2016-11-16 21:48:14 +01:00
Martin Baulig 93bd12af10 Merge pull request #3947 from akihikodaki/mono-4.8.0-branch
[btls] Set CMAKE_POSITION_INDEPENDENT_CODE TRUE for BUILD_DYNAMIC_BTLS
2016-11-16 21:47:13 +01:00
Zoltan Varga 5f07299b3d [jit] Optimize out the early pinvoke address loading done by emit_native_wrapper () when coop+direct pinvokes is enabled, since its not needed, and it generates MONO_PATCH_INFO_ICALL_ADDR relocations which cause pinvoke lookups at runtime on platforms where its not supported like watchos. Fixes #45369. (#3960) 2016-11-15 12:52:17 -05:00
Marek Safar 42027df368 Remove global ipv6 disabled setting. Fixes #35536 2016-11-15 13:13:39 +01:00
Rodrigo Kumpera f5fbc321b4 Merge pull request #3916 from ludovic-henry/4.8-fix-suspend-watchos
[4.8][threads] Fix suspend on watchos
2016-11-14 14:05:24 -05:00
Rodrigo Kumpera 890670ab80 Merge pull request #3917 from ludovic-henry/4.8-fix-suspend-posix
[4.8][threads] Fix Posix async resume
2016-11-14 14:05:12 -05:00
Rodrigo Kumpera fab452a7a8 Merge pull request #3918 from ludovic-henry/4.8-fix-threadpool-hang
[4.8][threadpool] Fix hang on domain unloading
2016-11-14 14:04:57 -05:00
Rolf Bjarne Kvinge ffdf97bd50 [offsets-tool] Make sure to re-clone when the hash for the cpp binaries changes. 2016-11-14 17:03:13 +01:00
Martin Baulig f2f40fa60e [BTLS]: Add MonoBtlsSsl.GetServerName() and set MonoTlsConnectionInfo.PeerDomainName. 2016-11-14 15:06:29 +01:00
Martin Baulig 3fac1383a3 [BTLS]: Use host name without port for the Server Name Indication (SNI). Bug #46549. (#3939) 2016-11-14 15:05:01 +01:00
173210 1514322fc9 [btls] Set CMAKE_POSITION_INDEPENDENT_CODE TRUE for BUILD_DYNAMIC_BTLS
While CMAKE_POSITION_INDEPENDENT_CODE will be automatically set if
BUILD_SHARED_LIBS is TRUE, it won't if BUILD_DYNAMIC_BTLS is TRUE.
This change sets CMAKE_POSITION_INDEPENDENT_CODE manually in such a case.
2016-11-14 17:32:24 +09:00
Miguel de Icaza db3db35fe8 Backport fix from Aleksey 2016-11-11 12:29:26 -05:00
Martin Baulig 20e0914e03 [BTLS]: Use host name without port for the Server Name Indication (SNI). Bug #46549. 2016-11-11 16:42:12 +01:00
Joao Matos 2949ce7ead [offsets-tool] Fixed the Makefile to clone into the base directory instead. 2016-11-11 12:58:34 +00:00
Ankit Jain 868c619fd0 [xbuild] Don't reevaluate project when setting metadata in a dynamic ..
.. item.

If we have a project, that sets some properties or items at runtime,
like in a target:

```
        <Target Name="Build">
                <PropertyGroup>
                        <Bar>Bar01</Bar>
                </PropertyGroup>
```

.. such a property can be accessed as `$(Bar)` subsequently.

Then at later point, a target tries to update metadata on an item group
with existing items, like:

```
	<ItemGroup>
		<FooItem Include="xyz" />
	</ItemGroup>

	<Target Name="Foo">
                <ItemGroup>
                        <FooItem>
                                <SomeMetadata>MetadataValue</SomeMetadata>
                        </FooItem>
                </ItemGroup>
```

.. then it is seen that the value for the earlier created `$(Bar)` disappears!
So, if we try to print the value of `$(Bar)` right after that item
group, it would appear as `''`!

The issue is that the metadata update in target `Foo` caused the project
to get re-evaluated, which meant that items/properites created after the
project load were lost! We should not be reevaluating the project when
setting metadata on the basis of dynamic items, like in the target
`Foo`.

These dynamic item groups in a target are represented as
`BuildItemTask`, and these create BuildItems which have their
`IsDynamic` property set. And this is used to avoid re-evaluating the
project in `BuildItem.SetMetadata`.

But when updating metadata (`BuildItem.UpdateMetadata`), we need to
update metadata on the *existing* items, which might not have been
created from such dynamic item groups! So, their `IsDynamic==false`.
Hence, trying to `SetMetadata` on such items would cause the project to
be reevaluated, and thus properties/items like `$(Bar)` would be lost!

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=45137

In this particular case, `Bar` was the `DesignTimeBuild` property, which
was losing it's value when `ProjectReference`'s `AdditionalProperties`
metadata was set in:

```
 <Target Name="BclBuildAddProjectReferenceProperties"
    <ItemGroup>
      <ProjectReference>
         <AdditionalProperties>$(_BclBuildProjectReferenceProperties);%(ProjectReference.AdditionalProperties)</AdditionalProperties>
     </ProjectReference>
    </ItemGroup>
```
2016-11-10 18:19:27 -05:00
Rodrigo Kumpera 8093a8f124 Merge pull request #3934 from lewurm/mono-4.8.0-arm64-fixed-cacheline-size-for-flushing
[C9][arm64] always assume a cache line size of 4
2016-11-10 14:41:04 -08:00
Bernhard Urban 9182938d25 [arm64] always assume a cache line size of 4
otherwise we still have the theoretical chance of a race.
2016-11-10 23:36:02 +01:00
Joao Matos f63ae59412 [offsets-tool] Updated build scripts to handle multiple platforms. 2016-11-10 19:28:35 +00:00
Joao Matos 77a1de7001 [offsets-tool] Fixed whitespace inconsistency. 2016-11-10 19:28:34 +00:00
Joao Matos 230cd898d1 Updated offsets tool to latest CppSharp. 2016-11-10 19:28:33 +00:00
Marek Safar d3399c8233 [System.Xml] Add XElement array handling to serialization interpreter. Fixes #12571 2016-11-10 18:43:51 +01:00
Zoltan Varga f3857e2a10 [runtime] Fix the ios build.
(cherry picked from commit c8ae9af395)
2016-11-10 17:26:23 +01:00
Alexander Köplinger a6ef4bc024 Add mono-package-runtime to EXTRA_DIST
The file was added in 15b6ef60e4
(cherry picked from commit 844b800098)
2016-11-10 15:33:37 +01:00
Alexander Köplinger 0bb2b5c69b Fix tarball build
(cherry picked from commit 8e8dcd24e4)
2016-11-10 15:05:27 +01:00
Jo Shields ee6362dff3 Add EXTRA_DIST listing all the files from btls
Apparently there's no way to get CMake to just spit out its own uncached variables, so we can't do this programatically.

(cherry picked from commit 6843f6d61d)
2016-11-10 15:05:27 +01:00
Jo Shields de92ba6397 Remove useless BTLS_DEPS variable
(cherry picked from commit 503b18e07f)
2016-11-10 15:05:26 +01:00
Zoltan Varga 6094da8d8e [sdb] Avoid asserting when trying to single step on a thread with no managed frames. Fixes #34802. 2016-11-09 21:59:41 -05:00
Zoltan Varga f42685a7ef [sdb] Avoid asserting when trying to single step on a thread with no managed frames. Fixes #34802. 2016-11-09 14:53:12 -05:00
Alexander Köplinger def42333a4 [System] Fix a few type members on WatchOS
The .platformnotsupported.cs versions of some classes were
inconsistent with their "real" counterparts.

(cherry picked from commit 10f86fb5fe)
2016-11-09 20:21:42 +01:00
Alexander Köplinger 4c3e3e9760 [btls] Include stdint.h header file in btls-time64.c
Fixes "error: unknown type name 'int64_t'" on Alpine/musl libc.

(cherry picked from commit 941bf17f1b)
2016-11-08 20:06:34 +01:00
Ludovic Henry 7def1ee268 [threadpool] Fix hang on domain unloading (#3904)
Because we wouldn't return the correct ThreadPoolDomain for the requested domain, we would simply wait on the last inserted MonoDomain. This would lead to a hang when unloading the domain, as we wouldn't wait on the correct domain.
2016-11-08 12:11:25 -05:00
Ludovic Henry ca9e4a836e [threads] Fix Posix async resume (#3861)
If we fail to send the signal, we should not add a pending operation, as the signal handler is never going to answer this operation (via mono_threads_notify_initiator_of_resume).
2016-11-08 12:08:33 -05:00
Ludovic Henry c606270c9b [threads] Fix suspend on watchos
Because certain platform (such as WatchOS) do not support syscall abort, we need to ensure that it is supported before we call the `mono_threads_suspend_abort_syscall` function.
2016-11-08 12:04:35 -05:00
Zoltan Varga ace3b63d26 [arm64] Set a flag in MonoContext if the fp regs are saved, and only restore them if they are. These registers are not saved when the context is created from a ucontext. (#3890) 2016-11-08 11:19:00 -05:00
Zoltan Varga 800dbae049 [arm64] Save+restore fp regs from the context in the call filter trampoline, the JITted code doesn't use them, but if the called code throws an exception, the throw context for the inner throw needs to contain the same values as the original throw context. (#3877) 2016-11-08 11:18:52 -05:00
Alexander Köplinger 128491307c [corlib] Add Marshal.CleanupUnusedObjectsInCurrentContext() stub
https://github.com/dotnet/standard/issues/94
(cherry picked from commit 05b68a1d35)
2016-11-08 12:47:16 +01:00
Alexander Köplinger 479888bec9 [corlib] Expose Marshal.PtrToStringBSTR on mobile
The SecureStringHelper from referencesource I added in #3887
relies on this to convert from SecureString to plaintext.

It failed on mobile because we always throw a NotImplementedException there,
but we actually have an implementation on the runtime side (even in the DISABLE_COM case).

(cherry-picked from df1475d95e)
2016-11-08 12:42:24 +01:00
Aleksey Kliger (λgeek) c55bf4ad91 Merge pull request #3886 from lambdageek/c9-46250
[C9][runtime] Ensure generic type definition arity matches generic context arity
2016-11-07 15:19:05 -05:00
Alexander Köplinger e6b9ba8908 [System.ServiceModel] Recognize 'faultactor' in SOAP fault message
It's an optional element according to [1] and we were simply
throwing a NotImplementedException when encountering it.

Fixed by reading the element value instead. I noticed that we
had a 'details' variable that was never assigned, so the check
for `details == null` was always true and can be removed.
This makes inlining the body of the CreateFault() call easier
since we no longer need to choose different overloads and makes
the code consistent with the CreateFault12 method.
Also added a better exception in case of an unrecognized element.

The CreateFault12 method (handles SOAP 1.2) does not need a similar
fix since actor is not an element in that version [2].

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=42226

[1] https://www.w3.org/TR/soap11/#_Toc478383507
[2] https://www.w3.org/TR/soap12/#soapfault

(cherry picked from commit 69b3397c8e)
2016-11-07 18:25:39 +01:00
Martin Baulig 2365067bda [BTLS]: Use int64_t instead of long in the native API. (#3857)
* [BTLS]: Use `int64_t` instead of `long` in the native API.

* Copy time64.c from Android's source code to get a 64-bit timegm64().

* Rename into btls_timegm64() and remove everything we don't need.
2016-11-07 18:23:42 +01:00
Marek Safar dea12ad837 [mcs] Consider method candidates with misplaced named arguments not applicable. Fixes #46190 2016-11-04 18:36:18 +01:00
Marek Safar 161569b8ba [mcs] Remove debug check 2016-11-04 18:36:09 +01:00
Marek Safar 504fd1bea6 [mcs] More work on debug scopes declared out of order. Fixes #45774 2016-11-04 16:05:44 +01:00
Alexander Köplinger f4b4f97fc8 [System] Replace NetworkCredential with referencesource
Fixes an issue where the Mono implementation wasn't converting
between the SecureString and the plaintext version of the password.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=44109

(cherry picked from commit 3d10e1c039)
2016-11-04 13:53:44 +01:00
Aleksey Kliger 76c1bcb099 [runtime] Ensure generic type definition arity matches generic context arity
Don't instantiate generic type definitions (like Dictionary`2) with too few or too many
type arguments.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=46250
2016-11-03 17:25:36 -04:00
Aleksey Kliger 4bf6c02cc0 [tests] Test System.Type.GetType() on generics with wrong arity. 2016-11-03 17:25:36 -04:00
Marek Safar c7cb8e90ad Merge pull request #3882 from radical/mono-4.8.0-branch
[mcs] Accept and ignore command line args supported by csc that we don't
2016-11-03 16:27:39 +01:00
Ankit Jain 8dc83f0c68 [mcs] Accept and ignore command line args supported by csc that we don't
.. support:

	/deterministic+
	/deterministic-
2016-11-03 11:25:28 -04:00
Ludovic Henry d2927b605a [4.8][hybrid-aot] Make it work on Android (#3872)
* [aot-compiler] Add generic class and gsharedvt for hybrid AOT mode

* [aot-compiler] Remove dead code

* [hybrid-aot] Add --hybrid-aot for future use

* [aot-compiler] Cleanup GSharedVT check

* [aot-compiler] Enable partial sharing for hybrid AOT

* [aot] Enable GSharedVT for Android

* [aot] Ensure GSharedVT is supported at runtime as well as compile time

* [aot] Factor aot mode setting
2016-11-03 11:05:03 -04:00
Ludovic Henry 972c7e8998 Remove exception when using SO_REUSEADDR on Linux (#3856) (#3873)
SO_REUSEADDR and SO_REUSEPORT are fundamentally different. This
exception seems to have been put in place to address the lack of
the latter on older Linux kernels for TCP. However, the change in
fact raises an exception when SO_REUSEADDR is used, which causes
failures in server applications, which may use SO_REUSEADDR to
avoid WAIT state timeouts.

Description of SO_REUSEADDR and SO_REUSEPORT differences:

http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t

Some problems caused by raising this exception:

https://github.com/zeromq/netmq/issues/623
https://github.com/zeromq/netmq/issues/592
https://github.com/fsprojects/IfSharp/issues/90
2016-11-03 10:59:47 -04:00
Miguel de Icaza a87e8cd4a9 [mkbundle] Fix the argument order to put the entry point on argv[1] (#3880)
* [mkbundle] - Add support for bundling native libraries.

* [mkbundle] add support for bundling native libraries

* [glib] add g_mkdtemp

* mono: Load the various library payloads for bundled executables

* [msvc] Export mono_dl_open and mono_loader_register_module

* [scripts] Add script to package the basic runtime to reuse by mkbundle

* [mkbundle] Add diagnostics, fix crash, fix registered path to match runtime name on embedded MonoImages (#3669)

* Resolve

* Complete the work, it should be working now

* Remove stray code from cherry pick

* [mkbundle] Fix the argument order to put the entry point on argv[1]
2016-11-03 10:58:29 -04:00
Alexander Köplinger 26cf538ac6 [System] Disable a test that reads a file on mobile
We don't have a way to pass the file to our mobile test runners at the moment.
2016-11-03 10:29:55 +00:00
Joao Matos e27a0c066f [System.IO.Compression] Fixed potential bug when keeping track of total read bytes of input stream.
This didn't manifest as a bug, to to be on the safe side, replicate the behavior
introduced in https://github.com/mono/mono/commit/b4d5016b5e42fec226d93fd13260b6cac80eb384
and use the same approach when calculating the total of the read bytes of the input stream.
2016-11-03 10:29:53 +00:00
Joao Matos 204d3695c7 [System.IO.Compression] Fixed DeflateStream input stream EOF condition.
What was happening is that we set the stream EOF flag to true when we
could not read any more input data, and that made us early out before
fully finishing the processing of the compressed data.

Now the only EOF flag is set to true is if zlib's inflate() has actually
finished processing the data.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=44994#c2.
2016-11-03 10:29:52 +00:00
Joao Matos 75cd6fb9f8 [System.IO.Compression] Fixed DeflateStream inflate() decompression loop.
This reworks the fix from https://github.com/mono/mono/commit/7c4d41a518aaf0370b882f9430752ebcd5544c10.

That fix introduced a regression when handling some inputs, which lead us to ignore
some left-over data from zlib's inflate output buffer.

Now we only break from the loop if inflate() returns Z_BUF_ERROR.

This makes sure all data is fully processed before returning to managed code.

Fixes one of the bugs in https://bugzilla.xamarin.com/show_bug.cgi?id=44994#c2.
2016-11-03 10:29:51 +00:00
Zoltan Varga 241c64c46f [runtime] Fix the exception message to include the proper type name and calling assembly when Type.GetType () fails. Fix some warnings. (#3876) 2016-11-02 22:58:27 -04:00
Aleksey Kliger (λgeek) f2448c8a85 Merge pull request #3868 from lambdageek/c9-42584-take4
[C9][custom attr] Add low-level metadata iterator for assembly custom attributes

And use it to check for the reference assembly attribute.

Using the low level APIs means we don't trigger load of referenced
assemblies and we don't need to take locks, so it is safe to call this
during assembly loading.

Follow-up work for https://bugzilla.xamarin.com/show_bug.cgi?id=42584
2016-11-02 14:52:40 -04:00
Marek Safar a2d8263be9 [mcs] Remove unknown warnings reporting to match latest csc 2016-11-02 17:03:15 +01:00
Zoltan Varga e8f4c7c216 [runtime] Fix the build. 2016-11-02 03:24:24 -04:00
Zoltan Varga 9129faee43 [arm] Call the tls get trampoline through a GOT slot instead of directly, since a direct call could go through the trampoline code which would fail if the thread is not attached to the runtime. Fixes #45371. (#3850) 2016-11-02 03:24:02 -04:00
Zoltan Varga ffecf56a40 [jit] Simplify the code generation for the mkrefany opcode, the same code can handle the aot and non-aot case. The non-aot case was emitting OP_STOREP_MEMBASE_IMM opcodes with 64 bit immediates, and some platforms like arm64 couldn't handle that. 2016-11-02 03:23:47 -04:00
Zoltan Varga 2b31b6957b [arm] Fix MONO_CONTEXT_GET_CURRENT (), the inline assembly block was using pre-increment addressing instead of post increment. (#3866) 2016-11-02 03:23:35 -04:00
Alexander Köplinger 18f6b64356 [corlib] Map SHA*Cng algorithms to SHA*Managed on monodroid
This is a followup to e9205142b2.
Monodroid is missing the Cng and CryptoServiceProvider variants of the SHA
algorithms as well so we need to map to the Managed variants there too,
like on monotouch.

(cherry picked from commit e796ded61a)
2016-11-02 00:53:04 +01:00
Aleksey Kliger 4e4a87dddb [custom attr] Iterate over methoddef custom attrs
Make mono_assembly_metadata_foreach_custom_attr iterate over
MethodDef custom attributes in addition to MemberRef.
2016-11-01 17:55:17 -04:00
Aleksey Kliger 5396c60248 [loader] treat corlib same as other assemblies when checking ReferenceAssemblyAttribute
Now that we're using a metadata-only ReferenceAssemblyAttribute check,
we can treat corlib the same as any other assembly - if we see
ReferenceAssemblyAttribute when loading a candidate assembly, skip it.
2016-11-01 17:55:16 -04:00
Aleksey Kliger 7ece22c72f [custom-attrs] Add low-level metadata iterator for assembly custom attributes
And use it to check for the reference assembly attribute.

Using the low level APIs means we don't trigger load of referenced
assemblies and we don't need to take locks, so it is safe to call this
during assembly loading.
2016-11-01 17:55:15 -04:00
Zoltan Varga c44892d7d4 [runtime] Perform the reference assembly attribute check using the low level metadata apis outside of a lock. 2016-11-01 17:54:38 -04:00
Aleksey Kliger (λgeek) c42036b51b Merge pull request #3788 from lambdageek/c9-42584-take2
[C9] Check for ReferenceAssemblyAttribute when loading for execution
2016-10-31 10:16:48 -04:00
Marek Safar b153e1d93d [corlib] SharedStatics from referencesource. Fixes #46175 2016-10-31 12:57:30 +01:00
Alexander Köplinger 2a8afac254 [System] Fix monodroid build when BTLS is disabled 2016-10-31 02:25:54 +01:00
Miguel de Icaza 244124e617 Backport to 4.8.0 of mkbundle SDK + native library support (#3834)
This backports the mkbundle support that allows mkbundle to use complete SDKs, as opposed to a single runtime to bundle packages as completing the native library loading support.

* [mkbundle] - Add support for bundling native libraries.

* [mkbundle] add support for bundling native libraries

* [glib] add g_mkdtemp

* mono: Load the various library payloads for bundled executables

* [msvc] Export mono_dl_open and mono_loader_register_module

* [scripts] Add script to package the basic runtime to reuse by mkbundle

* [mkbundle] Add diagnostics, fix crash, fix registered path to match runtime name on embedded MonoImages (#3669)
2016-10-30 10:07:15 -04:00
Alexander Köplinger e51aa0a704 Merge pull request #3848 from rolfbjarne/btls-remove-unused-pinvokes-4.8
[System] Remove unused BTLS P/Invokes.
2016-10-28 16:03:49 +02:00
Alexander Köplinger 03e08ac9b5 [bcl] Disable BTLS on xammac and xammac_net_4_5 profiles
(cherry picked from commit 4c8069a5e1)
2016-10-28 15:59:39 +02:00
Alexander Köplinger d8e83dff76 [btls] Fix library install
We need to ensure the directory is created and doesn't have an extraneous '/' char.

(cherry picked from commit d1555df244)
2016-10-28 15:57:52 +02:00
Zoltan Varga d38b7ffedd [btls] Install the btls shared library on make install. (#3825)
(cherry picked from commit 2b09b5fd6b)
2016-10-28 15:57:01 +02:00
Rolf Bjarne Kvinge 7c0ec405fc [System] Remove unused BTLS P/Invokes.
They point to internal functions that don't exist, causing compilation
problems for Xamarin.Mac apps.

Example test/compile failure: https://gist.github.com/rolfbjarne/43cf2228816bbe8a863f331da3e07c0d
2016-10-28 08:19:20 +02:00
Aleksey Kliger a06e82f6c0 [coop handles] Don't scan null object references
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=45223
2016-10-27 16:12:46 -04:00
Martin Baulig 43558a209d [bcl]: Fix 'Mono.Btls.Interface' build logic. 2016-10-27 17:04:12 +02:00
Alexander Köplinger bc72a85bea Merge pull request #3830 from rolfbjarne/watchos-fix-defaultproxy-test-4.8
[System] Tweak define to exclude System.Net.WebProxy.CreateDefaultProxy and update corresponding test.
2016-10-27 00:32:31 +02:00
Rolf Bjarne Kvinge 16b8979fd1 [System] Tweak define to exclude System.Net.WebProxy.CreateDefaultProxy and update corresponding test. 2016-10-26 20:36:19 +02:00
Zoltan Varga 8b8d4c41d2 [llvm] Use the global llvm context instead of creating a new one for each aot module, since the latter seems to cause random memory corruption/crashes. 2016-10-26 14:09:58 -04:00
Ludovic Henry 8864f4c6e9 [threadpool-ms] Fix race condition on domain unload (#3592)
This race condition has been introduced with 348d793ebb. This is because we would wait on the cleanup_semaphore outside of the threadpool->domains_lock lock.

By using a cond variable instead of a semaphore, we avoid a potential deadlock.
2016-10-25 22:12:57 -04:00
Alexander Köplinger 5807bf100a [bcl] Only build Mono.Btls.Interface and btls tool when BTLS is enabled
(cherry picked from commit 3c26e4e5b9)
2016-10-25 22:34:13 +02:00
Alexander Köplinger 78619b1580 [System] Don't build managed BTLS code on monotouch
After 2fb07d6c6d BTLS can be used as a shared lib,
but this caused an issue in some monotouch tools which grepped the P/Invokes for `__Internal`
since these icalls wouldn't resolve on monotouch since BTLS is disabled there.

Instead, we now completely leave out building the managed parts of BTLS when
BTLS is not enabled.

(cherry picked from commit db21455da9)
2016-10-25 22:33:55 +02:00
Martin Baulig 9fa2060ae2 Bump boringssl. 2016-10-25 17:42:19 +02:00
Marek Safar 5c8fb06829 Merge pull request #3813 from rolfbjarne/watchos-no-cfnetwork-4.8
[System] Remove any CFNetwork usage from the watchOS profile. Fixes #45847.
2016-10-25 16:18:32 +02:00
Martin Baulig c9a67ffc5a [BTLS]: Fix a ref-counting leak in X509ChainImplBtls. Fixes #45687. (#3811)
* [BTLS]: Fix a ref-counting leak in X509ChainImplBtls.  Fixes #45687.

* Set 'untrusted = null' in Dispose().
2016-10-25 15:42:08 +02:00
Marek Safar 6ec4d74fb7 Fixes commit 24a439d9b7 2016-10-25 14:51:05 +02:00
Rolf Bjarne Kvinge c023b2b30a [System] Remove any CFNetwork usage from the watchOS profile. Fixes #45847.
The MacProxy class uses CFNetwork, but since CFNetwork is not a public
framework on watchOS, we can't use it.

So remove MacProxy completely (it only contains internal classes), and throw
PlatformNotSupportedException in any API that used it (the managed networking
stack is not supported on watchOS anyway, so this should be safe).

https://bugzilla.xamarin.com/show_bug.cgi?id=45847
2016-10-24 19:54:42 +02:00
Aleksey Kliger 6a0acd9a03 [tests] Missing custom attr on an assembly should not crash mono. 2016-10-24 13:37:08 -04:00
Alexander Köplinger 9f4abcc38a [bcl] Move a few types from the Facades into the framework for netstandard20 compatibility
See https://github.com/dotnet/standard/pull/76.

Also moved IncrementalHash from System.Core.dll to mscorlib.dll as per discussion with Wes.

(cherry picked from commit adcc481705)
2016-10-24 16:44:19 +02:00
Zoltan Varga 085b653a74 [btls] Convert BTLS icalls to pinvokes by invoking them using [DllImp… (#3799)
* [btls] Convert BTLS icalls to pinvokes by invoking them using [DllImport("__Internal")], which will make it easier to redirect them to a separate dylib in the future.

* [btls] Add a --enable-dynamic-btls configure flag to enable compiling btls into a separate shared library instead of embedding it into the runtime.
2016-10-21 22:12:35 -04:00
Zoltan Varga a2ebdcf9de [runtime] Fix the native-to-managed marshalling of null blittable arrays. Fixes #45788. 2016-10-21 22:12:26 -04:00
Aleksey Kliger 482548a503 [loader] Set image assembly before reference attribute assembly check.
In mono_assembly_load_from_full, the call to
mono_assembly_has_reference_assembly_attribute has to come after
image->assembly is set.  This is because image->assembly->base_dir is
used for probing for referenced assemblies, and the reference assembly
attribute check will probe for assemblies referenced by the custom
attributes on the assembly in image being loaded.
2016-10-21 10:03:20 -04:00
Aleksey Kliger 90c3eb80e7 [loader] Write fully-qualified field names in mono_field_resolve_type errors. 2016-10-21 10:03:12 -04:00
Aleksey Kliger 012d17c539 [custom_attrs] Don't return NULL if a single custom attr is missing.
Add 'ignore_missing' argument to mono_custom_attrs_from_index_checked:
if it is TRUE, a single custom attribute constructor that can't be
resolved to a MonoMethod won't cause the whole method to return NULL.
if 'ignore_missing' is FALSE, use existing behavior.

Updated all the call sites to pass FALSE, except
mono_custom_attrs_from_assembly_checked which also gets a new
'ignore_missing' arg.

Updated 'mono_assembly_has_reference_assembly_attribute to pass TRUE for
ignore_missing.
2016-10-21 09:53:27 -04:00
Aleksey Kliger 036d1c8deb [loader] Disable mono_assembly_has_reference_assembly_attribute
It relies on mono_custom_attrs_from_assembly_checked which is not
sufficiently robust to missing assemblies when trying to look for custom
attributes.
2016-10-21 09:53:26 -04:00
Martin Baulig 4917a53814 [System]: Distinguish between empty hostnames and no hostnames for certificate validation.
SecPolicyCreateSSL() distinguishes between an empty string (validation will fail
if the certificate contains host name constraints) and a null pointer (no host name
checking will be performed) for the hostname.

We incorrectly used `string.IsNullOrEmpty (host)` in a few places.

(cherry picked from commit 00f252d01f)
2016-10-20 19:00:37 +02:00
Martin Baulig a63e7484e0 [System]: ChainValidationHelper: always set 'status11' on error.
(cherry picked from commit 7fdd730928)
2016-10-20 19:00:29 +02:00
Martin Baulig e41ab19f36 [boringssl]: Merge latest chromium-stable branch from Google.
(cherry picked from commit 9a073a2929)
2016-10-20 19:00:21 +02:00
Aleksey Kliger 9c54615875 [runtime] Check for ReferenceAssemblyAttribute when loading for execution.
An assembly with a System.Runtime.CompilerServices.ReferenceAssemblyAttribute
may be loaded in a reflection-only context, but not for execution.

When loading assembly refs, or when loading assemblies by name (as
opposed to file path), a reference assembly will be skipped over and
other assemblies from the GAC and the load path will be tried.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=42584
2016-10-18 16:21:04 -04:00
Aleksey Kliger 279597ca63 [loader] Tests for RefereceAssemblyAttribute support
This reverts commit 8612b548ee.

Which itself reverted commit 31de4df835.
2016-10-18 16:19:47 -04:00
Aleksey Kliger 953a8cb68d [runtime] Let mono_custom_attrs_has_attr ignore malformed attributes 2016-10-18 16:19:01 -04:00
Aleksey Kliger 17814af191 [runtime] Don't build temporary array in mono_custom_attrs_get_attr_checked
Just return the first matching attribute as soon as it's found, don't
build a temporary array and then index into it.
2016-10-18 16:19:01 -04:00
Aleksey Kliger 52925e9fd0 [runtime] Mark mono_custom_attrs_get_attr external only
Runtime should use mono_custom_attrs_get_attr_checked.
2016-10-18 16:19:00 -04:00
Aleksey Kliger f40ef277f6 [runtime] Add assembly name to message in FileNotFoundException
when using mono_error_set_assembly_load_simple ()
2016-10-18 16:18:59 -04:00
Zoltan Varga 8be6ecc66f [runtime] Avoid freeing IMT thunks, some threads might still be executing them. This creates a memory leak, but its bounded. Fixes #39832. (#3767) 2016-10-18 14:12:34 -04:00
Alexander Köplinger c101a34944 Bump boringssl submodule 2016-10-18 19:34:26 +02:00
Marek Safar 24a439d9b7 [System] Implements Socket::ConnectAsync. Fixes #44406 2016-10-18 17:44:40 +02:00
Marek Safar 412e531404 Bump cecil to get recent fixes 2016-10-18 14:16:55 +02:00
Marek Habersack 1db9061145 With Android 7.0 (Nougat) it is no longer possible to read some
information about network interfaces from the /sys filesystem. Google
placed restrictions on two files used by the Mono BCL to read
information about the interface:

      /sys/class/net/[DEVICE]/flags
      /sys/class/net/[DEVICE]/operstate

The information we used to read from `flags` let us determine whether
the interface supports multicast and the `operstate` file provided us
with detailed information on the current device state.

Additionally, it is now impossible to read the hardware MAC address used
by any interface. This bit of information is also unavailable when using
the Java APIs and therefore applications running on devices with API
24 (and possibly newer) will not be able to access this information.

More details about the issue are available from the upstream Android
bug:

      https://code.google.com/p/android/issues/detail?id=205565

In order to obtain the required information, we now need to use the Java
APIs on devices with API 24+ and this commit implements the backend to
retrieve this information. It is done in C in order to avoid overhead of
creating mirror .NET objects when calling Java, thus saving time and
memory during an operation which may be performed by some applications
quite frequently.

This patch implements code that calls into the Xamarin.Android
runtime when runnin under API24 or newer to obtain the information.

Part of fix for https://bugzilla.xamarin.com/show_bug.cgi?id=44296
2016-10-17 23:58:45 +02:00
Marek Safar 27210fe3dd Merge pull request #3770 from slluis/fix-RSACertificateExtensions
Implemented System.Security.Cryptography.X509Certificates.RSACertific…
2016-10-17 17:12:11 +02:00
Marius Ungureanu b7a0a48637 Grab a new build 2016-10-17 11:39:50 +03:00
Alexander Köplinger d6fdb0187f [System] Fix expected default value in test for ServicePointManager.ConnectionLimit on XA
The default was aligned with XI on https://github.com/mono/mono/commit/d06354174070d01394f5e75ffcfc9c1110a1e7db

(cherry picked from commit dcf4ddd097)
2016-10-15 01:09:56 +02:00
Alex Rønne Petersen c7ed10cd30 Merge pull request #3774 from alexrp/main-thread-name-c9
[4.8.0][runtime] Don't change the native name of the main thread.
2016-10-14 23:16:19 +02:00
Rodrigo Kumpera fa6fba7f8b Merge pull request #3768 from kumpera/backport-machine-config-fixes
Backport of the machine config fixes for remoting.
2016-10-14 12:46:16 -04:00
Alex Rønne Petersen a9abf98848 [runtime] Don't change the native name of the main thread.
This makes it hard to differentiate multiple Mono processes in `top`.

We still report the name of the main thread as "Main" to the profiler.
2016-10-14 18:25:47 +02:00
Alexander Köplinger d6aba05c4d [System.ServiceModel] Move a few types into System.IdentityModel
They were moved there in MS.NET 4.5. Added typeforwards so existing references continue to work.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=35662

(cherry picked from commit 34f6aab87e)
2016-10-14 16:18:18 +02:00
Lluis Sanchez d4e09f5c35 Implement some missing methods in RSACryptoServiceProvider 2016-10-14 15:27:31 +02:00
Lluis Sanchez 04a376b2ab Implemented System.Security.Cryptography.X509Certificates.RSACertificateExtensions 2016-10-14 09:27:08 +02:00
Marek Safar f15d5eb557 [System.Xml] Update supported time formats for mobile version of XML deserializer. Fixes #42843 2016-10-14 09:10:54 +02:00
Rodrigo Kumpera bdf32af198 [icalls] Multiple fixes to get_bundled_machine_config.
Enviroment::get_bundled_machine_config icall should be ves_icall_System_Environment_get_bundled_machine_config.

Mark all icalls doing get_bundled_machine_config as ICALL_EXPORT so maccore can link them in/out.
2016-10-13 13:16:43 -07:00
Rodrigo Kumpera 4fbcd0a817 [corlib] RemotingConfiguration now try to use the bundled machine.config first. 2016-10-13 13:15:43 -07:00
Rodrigo Kumpera 2613ab4063 [corlib] Don't load the machine config file if it's missing. Fixes #44707 2016-10-13 13:15:36 -07:00
Alexander Köplinger bd1dc2169c [System] Add tests for IPv6-enabled FtpWebRequest
(cherry picked from commit d91796e39c)
2016-10-13 20:32:41 +02:00
Alexander Köplinger da5839ee45 [System] Add IPv6 support to FtpWebRequest
When connecting to an FTP server we weren't handling the RFC2428
extension to the FTP protocol which allows connections over IPv6
for the data channel.

We'd try to connect via IPv4 and the server would return an error
saying that this protocol is not supported.

The fix is to add handling for the protocol extension, namely
to use EPSV (for passive FTP) or EPRT (for active FTP) when opening
the data channel and send/parse the IPv6 addresses.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=44025

Note: we're now using the IP address of the the control channel we connected to for the
data channel instead of the address that is returned by the server in the FTP response message.
The reason is that for EPSV there's no IP returned by the server, and it should be
more reliable for normal PASV as well since the server might not know the
correct external address. This is also what MS does in referencesource.

(cherry picked from commit aebed51257)
2016-10-13 20:32:33 +02:00
Alexander Köplinger 4865590736 [System] Make sure FtpWebRequest processing happens in a background thread
We don't want it to block app shutdown.

(cherry picked from commit 26f23dbde3)
2016-10-13 20:32:26 +02:00
Marek Safar 6e8bb472af [System] SocketAsyncEventArgs::Dispose does not free any managed resources. Fixes #44757 2016-10-13 16:46:07 +02:00
Martin Baulig 90699022b6 [System]: Move MonoBtlsProvider.IsSupported() -> MonoTlsProviderFactory.IsBtlsSupported() (#3760)
* [System]: Move MonoBtlsProvider.IsSupported() -> MonoTlsProviderFactory.IsBtlsSupported().

Move the intern-call which is used to determine whether we're using BTLS out of MonoBtlsProvider
to allow the managed linker to eliminate the Mono.Btls.* classes when it's not supported.

* Fix Android build.
2016-10-13 16:26:40 +02:00
Rodrigo Kumpera f07d3d7f1d [System] Another round of hardening around disposal of Process while doing async reads.
This round ensures stream and decoder are protected from dispose and that we properly
bail out to the EOS case.
2016-10-12 11:17:03 -07:00
Bernhard Urban 0e6db9e499 [coop] fix compiliation issue on ARM 2016-10-12 17:47:39 +02:00
Marek Safar 6d39b0c188 [mcs] Handle interpolated strings with escaped quotes. Fixes #45286 2016-10-12 17:35:08 +02:00
Marek Safar 97588a349d Bump ikvm for mcs fixes 2016-10-12 15:52:17 +02:00
Marek Safar 5cbb67c54c [Mono.Data.Sqlite] Regression introduced by 04162ffbbd which changed _datetimeFormats order. Fixes #40603 2016-10-12 12:07:23 +02:00
Zoltan Varga c84d659693 [llvm] Avoid generating invalid IL for valuetypes+vphi+volatile variables in gsharedvt methods. Fixes part of #45270. 2016-10-11 16:04:37 -04:00
Zoltan Varga 1085ce7424 [llvm] Make sure the initlocals_bb is not treated as part of a try block if one starts at IL offset 0, since it could mess up the control flow if it contains calls. (#3718) 2016-10-11 16:04:30 -04:00
Martin Baulig 46379bda6d [cert-sync]: Change back to using the '--btls' argument.
Without arguments, 'cert-sync' now operates on the old certificate store
again, like it was before.  To test BTLS, you need to explicitly run it
with '--btls'.
2016-10-11 18:13:14 +02:00
Alexander Köplinger dca5ff953f [io-layer] Correctly detect a PE32+ assembly as managed when starting process
We weren't checking whether a PE file is in PE32 or PE32+ format,
causing us to use the PE32 offsets on the newer format as well.

This means that using Process.Start() on a managed assembly didn't
always work when a PE32+ file was in play. Such a file is created
when targeting x64 e.g. via the -platform:x64 csc.exe/mcs option.

The reason why we probably didn't notice until now is that in an
assembly produced by mcs there happens to be some data at the PE32
CLR header offset even in a PE32+ file, causing the check to "work".

This doesn't apply to csc.exe/roslyn though and so we couldn't
execute those assemblies via Process.Start() even though they're
perfectly managed. Since the .NET Core project.json toolchain
produces x64-targeted assemblies by default more people ran into
the issue trying to run those on Mono: https://github.com/cake-build/cake/issues/1247

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=44937

PE/COFF spec at https://msdn.microsoft.com/en-us/library/windows/desktop/ms680547(v=vs.85).aspx

(cherry picked from commit 68bcbb4b77)
2016-10-11 17:28:37 +02:00
Marek Safar 8594aa3456 [System] Set more error details on failed https proxy connect. Fixes #45108 2016-10-11 14:25:49 +02:00
Alan McGovern 79baed228a Trigger a build
Includes the fix for

https://bugzilla.xamarin.com/show_bug.cgi?id=45232
2016-10-11 11:43:42 +01:00
Zoltan Varga 4fde35fdfb [runtime] Fix the blittable flag and the instance size for pointer types. Fixes #45131. (#3735) 2016-10-10 17:48:21 -04:00
Alexander Köplinger de6a46ee3c [corlib] Add missing constructors to RNGCryptoServiceProvider on monotouch
Those were missed in cb46f78eef because there's a separate
implementation for monotouch in an unrelated file.

(cherry picked from commit dac829dbe9)
2016-10-10 20:14:41 +02:00
Martin Baulig 1ac809aad7 [System]: Fix a typo in X500DistinguishedName.AreEqual(). 2016-10-10 18:29:27 +02:00
Alexander Köplinger b77e7ab021 [btls] Use UTC for the Unix epoch in the managed BTLS code (#3702)
The epoch is specified as being in UTC, but the DateTime(int, int, int) constructor
creates a DateTime with an 'Unspecified' timezone, which could lead to problems later on.
(cherry picked from commit 8d1a65128a)
2016-10-10 18:04:28 +02:00
Martin Baulig 1a55680bfa [BTLS]: Correctly handle certificates with negative serial numbers. (#3719)
In mono_btls_x509_get_serial_number(), first call i2c_ASN1_INTEGER()
which takes care of padding and computing the 2s complement for negative
numbers, then reverse the buffer.
2016-10-10 18:02:26 +02:00
Marek Safar 0865083699 [System.Data] Use same socket family for data receiver as it has its client. Fixes #44624 2016-10-10 16:25:43 +02:00
Alexander Köplinger cd557f4992 [corlib] Add CLSComplaint(false) to a few EventSource methods
We did it in master already, those are needed so the generated
library source in dotnet/standard builds out of the box.
2016-10-10 15:17:05 +02:00
Alexander Köplinger 4a3b9d4bce [bcl] Expose a few more APIs on mobile to match with netstandard
See https://github.com/dotnet/standard/issues/47.

(cherry picked from commit cb46f78eef)
2016-10-10 13:39:58 +02:00
Alex Rønne Petersen e897a5d7e4 Merge pull request #3743 from alexrp/profiler-c9-fixes-4.8
[4.8.0][profiler] Start the helper thread before the writer thread.
2016-10-08 13:23:16 +02:00
Alex Rønne Petersen 4919fb1938 [profiler] Start the helper thread before the writer thread.
This fixes a regression introduced in 0db428169a
which caused the profiler to not report the correct command port in the file
header on startup.
2016-10-08 11:56:45 +02:00
Aleksey Kliger (λgeek) 9bd0647bba Merge pull request #3733 from lambdageek/c9-bug-42271
[C9][coop] Switch to GC SAFE for backtrace() and backtrace_symbols()
2016-10-07 13:14:17 -04:00
Rodrigo Kumpera bd34946f14 Merge pull request #3724 from kumpera/fix_process_stream_dispose-backport
Fix process stream dispose backport
2016-10-07 13:11:27 -04:00
Marek Safar 9c029cc9cd [System] Use default parsing rules for Uri.IsWellFormedUriString. Fixes #45129 2016-10-07 13:56:57 +02:00
Aleksey Kliger f41c45460f [runtime] System.Configuration.InternalConfigurationHost:get_bundled_machine_config
needs HANDLES

The method (which also goes by
System.Configuration.DefaultConfig:get_bundled_machine_config) was
converted to use coop handles earlier, but we missed this declaration.
2016-10-06 21:22:27 -04:00
Rodrigo Kumpera e066377aea [System] Add some hardening when disposing a AsyncStreamReader as it will have things happening concurrently. 2016-10-06 15:53:53 -07:00
Aleksey Kliger d28e482915 [mempool] Fix indentation in mono_backtrace () 2016-10-06 12:25:39 -04:00
Aleksey Kliger ecbbb82986 [coop] Switch to GC SAFE for backtrace() and backtrace_symbols()
Fixes [#42271](https://bugzilla.xamarin.com/show_bug.cgi?id=42271)
2016-10-06 12:25:12 -04:00
Rodrigo Kumpera ead28ef4ed [System] Dispose all streams in Process::Close if they were not exposed to the user. Fixes a RS import regression.
RS takes the stance that redirected streams should not be closed by the Process class because they might
be referenced from the outside.

That would be ok if it was true. If you use Process::BeginOutputReadLine, the output stream becomes inaccessible
with no way to dispose them by any mean but GC.Collect. You get an exception when accessing Process::StandardOutput
once async reading starts.

This change addresses the case where the streams are not accessible. This is tracked by the *StreamReadMode variables
that are set on stream getters or Begin*ReadLine.
2016-10-05 14:55:45 -07:00
Rodrigo Kumpera d1a58bc9bb [runtime] Don't do logging from a signal handler. It's not signal safe.
I found this while trying to MONO_LOG_LEVEL=debug an process way bug and the removed log statements
would hang mono in a matter of seconds.
2016-10-05 14:55:42 -07:00
Marek Safar 951f3c8837 [System.Net.Http] Wrap certain exceptions into HttpRequestException. Fixes #44978 2016-10-05 17:57:20 +02:00
Marek Safar ba04892f92 [mcs] Don't report version mismatch error for FX assemblies 2016-10-05 15:03:14 +02:00
Alexander Köplinger fb01e0742c Merge pull request #3708 from rolfbjarne/linker-mark-nested-types-4.8.0
[linker] We need to mark nested types even if the declaring type isn't marked.
2016-10-05 13:50:49 +02:00
Alexander Köplinger 960ae16ebc [ci] Correctly set the MONO_TLS_PROVIDER env var 2016-10-05 13:13:10 +02:00
Martin Baulig 9638ee9ece [BTLS]: Certificate cleanups and fixes. (#3706)
* [BTLS]: Allow fallback to MX.X509Certificate in X509CertificateImplBtls.

* [BTLS]: Fix X509Certificate2.MonoCertificate.

* X509Certificate2Impl.FallbackImpl: make abstract.

* X509Helper2.GetMonoCertificate(): new internal helper method.

* X509Certificate2.MonoCertificate: use X509Helper2.GetMonoCertificate().
  This is only used by X509ChainImplMono; we should investigate whether we
  could implement the missing APIs in BTLS.

* [BTLS]: Fully implement X509CertificateImplBtls.Import() and use correct semantics.

.NET's X509Certificate2.Import() uses several implicit fallbacks which we previously
did not handle in BTLS.

* you may provide a (unused) password when importing an unencrypted PKCS#8.

* when using null as password, it will attempt to use string.Empty if importing
  without password fails.

* [BTLS]: Implement X509CertificateImplBtls.PrivateKey.

* [BTLS]: Implement X509CertificateImplBtls.Export().

* [BTLS]: Implement X509CertificateImplBtls.Verify().

* [BTLS]: Fix X500DistinguishedName quoting.

* MonoBtlsUtils: don't quote special chars in UTF-16 strings.

* X500DistinguishedName: don't decode raw data when passed in a name.

* [ci] Test System.dll with both the legacy and btls TLS provider

* [ci] Only run the additional btls System.dll test run on OSX for now

Otherwise we might run it on platforms where btls isn't supported yet and get errors.
2016-10-05 13:05:24 +02:00
Cinerar 1b234b0667 Nowdays Content-Range From could be much more than 2147483647 2016-10-05 10:19:05 +02:00
Aleksey Kliger 6209317c15 [MonoError] Don't overwrite computed TypeLoadException message with empty string
Fixes [#44729](https://bugzilla.xamarin.com/show_bug.cgi?id=44729).
2016-10-04 17:24:26 -04:00
Rolf Bjarne Kvinge 3090df7136 [linker] We don't need to mark nested types more than once. 2016-10-04 18:53:00 +02:00
Alexander Köplinger 08c6cb22b7 Merge pull request #3694 from rolfbjarne/watchos-simplify-http-message-handler-selection-4.8.0
[System.Net.Http] Simplify default http message handler for watchOS since there's only one valid value.
2016-10-04 18:39:41 +02:00
Alexander Köplinger e66a9c7086 Merge pull request #3703 from rolfbjarne/watchos-servicepointmanager-4.8.0
[System] Add back a few ServicePointManager properties that can be used by multiple networking stacks.
2016-10-04 18:35:54 +02:00
Rolf Bjarne Kvinge de8c6e6e42 [linker] We need to mark nested types even if the declaring type isn't marked. 2016-10-04 16:38:08 +02:00
Rolf Bjarne Kvinge 0851acb468 [System] Add back a few ServicePointManager properties that can be used by multiple networking stacks. 2016-10-04 10:37:45 +02:00
Alex Rønne Petersen 9bcb1f5081 Merge pull request #3701 from alexrp/profiler-c9-fixes-4.8
[4.8.0][profiler] Fix a regression that caused all buffers to have a zero thread ID.
2016-10-04 04:58:42 +02:00
Alex Rønne Petersen 815b3b210a [profiler] Use macro constants instead of passing a bunch of bools. 2016-10-04 04:55:50 +02:00
Alex Rønne Petersen 4e283b76d2 [profiler] Update a stale comment. 2016-10-04 04:08:59 +02:00
Alex Rønne Petersen 33670c335f [profiler] Add some asserts. 2016-10-04 04:08:54 +02:00
Alex Rønne Petersen 18bea6c1c0 [profiler] Simplify send_log_unsafe (). 2016-10-04 04:08:50 +02:00
Alex Rønne Petersen 50fdd4483d [profiler] Fix a regression that caused all buffers to have a zero thread ID.
This was introduced in 928b840dad.
2016-10-04 04:08:38 +02:00
Alexander Köplinger 1598ce194b [btls] Add missing icall definition for mono_btls_x509_revoked_get_revocation_date
(cherry picked from commit 65c849b377)
2016-10-04 02:40:01 +02:00
Alex Rønne Petersen 5f612a6044 Merge pull request #3699 from alexrp/profiler-c9-fixes
[4.8.0] More C9 profiler fixes
2016-10-04 00:15:42 +02:00
Alex Rønne Petersen fa98e7cc3b [profiler] Fix BYTE_SIZE macro conflict on OS X. 2016-10-04 00:11:18 +02:00
Alex Rønne Petersen fad0111583 [profiler] Fix PROF_TLS_FREE () on pthread TLS systems. 2016-10-04 00:11:12 +02:00
Rodrigo Kumpera b1d68b0200 [profiler] Fix the build on Android (missing fcntl.h include). 2016-10-04 00:11:07 +02:00
Martin Baulig 7b2a96fbd3 [metadata]: Unconditionally enable ves_icall_Mono_Btls_Provider_IsSupported().
The MonoBtlsProvider.IsSupported() icalls ves_icall_Mono_Btls_Provider_IsSupported()
needs to be available whether BTLS is available or not because it is used at
runtime to decide whether or not to enable BTLS.
2016-10-03 22:01:31 +02:00
Martin Baulig 04379d5d73 Oops, actually correctly revert that commit. 2016-10-03 21:21:36 +02:00
Martin Baulig cd1b0b8edf [System]: Temporarily switch the default TLS provider back to "legacy".
Also revert the Jenkins commit in c462f4e603.
2016-10-03 21:13:19 +02:00
Rolf Bjarne Kvinge 81b800cf0c [System.Net.Http] Simplify default http message handler for watchOS since there's only one valid value. 2016-10-03 18:24:47 +02:00
Alexander Köplinger c462f4e603 [ci] Temporarily switch back to legacy TLS provider
(cherry picked from commit 993f805cb7)
2016-10-03 17:11:33 +02:00
Alexander Köplinger f9b5ea2d04 Merge branch 'watchos-ssl-4.8.0' into mono-4.8.0-branch 2016-10-03 13:13:36 +02:00
Rolf Bjarne Kvinge 053458ce22 [System] Update tests after API change for watchOS. 2016-10-03 13:11:46 +02:00
Rolf Bjarne Kvinge 40bd0c0bce [System] Throw PlatformNotSupportedExceptions in the networking stack for watchOS. 2016-10-03 13:11:45 +02:00
Rolf Bjarne Kvinge efaeebcb60 [System.Data] Update tests after API change in watchOS. 2016-10-03 13:08:12 +02:00
Rolf Bjarne Kvinge c09e0d9ee5 [System.Data] System.Data.SqlClient is not supported in watchOS.
System.Data.SqlClient is not supported in watchOS, because it depends on a
working managed networking stack, which we don't have on watchOS.
2016-10-03 13:08:11 +02:00
Rolf Bjarne Kvinge d99a0d5382 [System] Don't reference/build Mono.Security.dll when building for watchOS.
This means we can't build Mono.Data.Tds.dll either, since it uses
Mono.Security.dll extensively. In any case Mono.Data.Tds.dll is useless
without a working networking stack, and since it's a Mono-only dll (i.e. not
part of netstandard or facades), just remove the entire assembly from the
watchOS profile.

System.Security.dll uses Mono.Security.dll as well, but the required classes
are available inside mscorlib.dll (as internal classes), so just open up
mscorlib internals to System.Security.dll.
2016-10-03 13:08:10 +02:00
Alexander Köplinger a1b9700735 [btls] Fix i386 build on Linux by setting -arch on Darwin only
The -arch option is an Apple extension, it caused failures on i386 Linux: "unrecognized command line option '-arch'"

(cherry picked from commit aad01ff4db)
2016-10-03 00:34:08 +02:00
Alex Rønne Petersen 613fbda594 Merge pull request #3690 from alexrp/mono-4.8.0-branch
[4.8.0] Profiler fixes for C9
2016-10-02 22:36:10 +02:00
Alex Rønne Petersen 6efdbf52f1 [profiler] Fix GC finalize object end event not getting invoked. 2016-10-02 22:33:23 +02:00
Alex Rønne Petersen a32cff4490 Revert "[domain] Report domain unloads to the profiler when finalizing the domain."
This reverts commit c8b2029080.

This caused ordering problems with app domain events: https://bugzilla.xamarin.com/show_bug.cgi?id=44552

Conflicts:

	mono/metadata/gc.c
2016-10-02 22:33:21 +02:00
Alex Rønne Petersen a13a0a6764 [profiler] Build fix for 4.8.0. 2016-10-02 22:25:59 +02:00
Alex Rønne Petersen aa5012088e [profiler] Bump profiler version to v1.1. 2016-10-02 22:23:53 +02:00
Alex Rønne Petersen 3bba08400b [profiler] Don't emit enter/leave events in onlycoverage mode. 2016-10-02 22:23:52 +02:00
Alex Rønne Petersen dc6448964a [profiler] Add a nocounters option. 2016-10-02 22:23:51 +02:00
Alex Rønne Petersen 0e0b1537db [profiler] Address a couple of FIXMEs in the counters sampling code. 2016-10-02 22:23:51 +02:00
Alex Rønne Petersen 9259c0d43b [profiler] Use eglib alloc/free functions everywhere. 2016-10-02 22:23:50 +02:00
Alex Rønne Petersen 3af315a5f8 [profiler] Warn if we can't detect the CPU count. 2016-10-02 22:23:50 +02:00
Alex Rønne Petersen 27e89dadba [profiler] Use the native thread wrapper functions to manage threads. 2016-10-02 22:23:49 +02:00
Alex Rønne Petersen 323c660694 [utils/threads] Add and export a mono_native_thread_join () function. 2016-10-02 22:23:48 +02:00
Alex Rønne Petersen 6d68435660 [utils/threads] Export all native thread functions. 2016-10-02 22:23:48 +02:00
Alex Rønne Petersen 4b18517404 [profiler] Access in_shutdown atomically. 2016-10-02 22:23:47 +02:00
Alex Rønne Petersen ee6bfbb041 [profiler] Drop support for perf events on Linux. 2016-10-02 22:23:47 +02:00
Alex Rønne Petersen 00a04f8feb [utils/lfa] Add a missing #include to fix the profiler build. 2016-10-02 22:23:46 +02:00
Alex Rønne Petersen 84fb54be56 [profiler] Disable GC move events when allocation events are disabled.
They serve no purpose when allocation profiling is enabled, and just make log
files bigger than they have to be.
2016-10-02 22:23:45 +02:00
Alex Rønne Petersen 70db685357 [profiler] Clean up and improve the helper thread code.
* Don't invoke undefined behavior if an fd is >= FD_SETSIZE.
* Allow multiple command sockets.
* Close the command socket(s) on shutdown.
* Properly run cleanup logic on shutdown.
2016-10-02 22:23:45 +02:00
Alex Rønne Petersen fa7a3ddc9b [profiler] Process requests in method_jitted (). 2016-10-02 22:23:44 +02:00
Alex Rønne Petersen c910d330c3 [profiler] Remove the need to pass a MonoProfiler argument to some functions.
This is now available on the MonoProfilerThread structure.
2016-10-02 22:23:44 +02:00
Alex Rønne Petersen 36662ae5c8 [profiler] Fix the way the profiler frees hazardous data on shutdown. 2016-10-02 22:23:43 +02:00
Alex Rønne Petersen e614f44499 [profiler] Replace a check with an assert in coverage_filter (). 2016-10-02 22:23:43 +02:00
Alex Rønne Petersen 5bfd110124 [profiler] Add messages to most assertions. 2016-10-02 22:23:42 +02:00
Alex Rønne Petersen 8340747664 [profiler] Remove the ign_res () hack. 2016-10-02 22:23:41 +02:00
Alex Rønne Petersen 60fc6c5649 [profiler] Clean up the #include mess in mono-profiler-log.c.
Half of these aren't even needed - get rid of those. Sort the rest.
2016-10-02 22:23:41 +02:00
Alex Rønne Petersen 9f5247c4b3 [profiler] Remove mono_threads_attach_tools_thread () declaration.
We get this from mono-threads.h now.
2016-10-02 22:23:40 +02:00
Alex Rønne Petersen 30633ffd58 [profiler] Remove some broken, commented-out code from register_method_local (). 2016-10-02 22:23:40 +02:00
Alex Rønne Petersen 3a1da6e5c9 [profiler] assert () -> g_assert (). 2016-10-02 22:23:39 +02:00
Alex Rønne Petersen 9014c62f06 [profiler] Always enable the helper thread.
We need it in all cases now that we use it to periodically flush all buffers.
The only platforms it was disabled on was NaCl, which we haven't bothered to
support in a while anyway.
2016-10-02 22:23:38 +02:00
Alex Rønne Petersen 17c2e47270 [profiler] Encapsulate some common logic in the ENTER_LOG/EXIT_LOG macros.
This also has the nice effect of reducing the amount of times we attempt to
take the reader lock. Now we take it and release it once for a single event.
2016-10-02 22:23:38 +02:00
Alex Rønne Petersen 7c8d6480e0 [profiler] Add a missing deinit_thread () call to the helper thread. 2016-10-02 22:23:37 +02:00
Alex Rønne Petersen 5d0406ce13 [profiler] Fix several race conditions in accessing MonoProfilerThread.buffer.
Only in very few situations is it okay to access this field without first
taking the reader lock or exclusive lock.

Fixes some crashes observed in the profiler stress tests.
2016-10-02 22:23:37 +02:00
Alex Rønne Petersen 43babda1a0 [profiler] Don't flush empty log buffers. 2016-10-02 22:23:36 +02:00
Alex Rønne Petersen cac2b2402e [profiler] Add an extra assert. 2016-10-02 22:23:36 +02:00
Alex Rønne Petersen 3e22fd4852 [sgen] Always report object moves on the GC thread.
This avoids exposing the SGen worker threads through the profiler APIs. Doing
so had two main problems:

* It's easy for a user of the profiler API to accidentally mess with the state
  of the worker thread in all sorts of ways, which could break the GC.
* It's been a long-standing guarantee that any profiler API callback will be
  invoked on a thread that is, at the very least, attached to the runtime via
  the mono-threads infrastructure. This is not the case for SGen workers.

This fixes a deadlock in the log profiler when using major=marksweep-conc.
2016-10-02 22:23:35 +02:00
Alex Rønne Petersen e1b914a97f [profiler] Rename decode.c to mprof-report.c. 2016-10-02 22:23:34 +02:00
Alex Rønne Petersen f5f92d5d39 [profiler] Rename proflog.{c,h} to mono-profiler-log.{c,h} for consistency with other profilers. 2016-10-02 22:23:34 +02:00
Alex Rønne Petersen 99342a6654 [profiler] Remove utils.c/utils.h, move the code to proflog.c/decode.c, and clean it up.
* Drop support for fast/null timers.
* Use Mono runtime functions for getting the thread ID and allocating buffers.
2016-10-02 22:23:33 +02:00
Alex Rønne Petersen c4e7de38d5 [acceptance-tests] Improve the profiler-stress test runner.
* Emit an NUnit test report file.
* Set a timeout of 6 hours per test.
* Do a thread dump for timed-out tests.
* Don't print stdout/stderr for passing tests.
2016-10-02 22:23:33 +02:00
Alex Rønne Petersen 1f533cf45b [ci] Bump the timeout of the profiler stress test suite to 24 hours. 2016-10-02 22:23:32 +02:00
Alex Rønne Petersen 3ecb96bc26 [sgen] Remove bogus mono_profiler_events assert.
This variable can be changed at any time by any thread. It makes no sense to
assert that it has a particular flag.
2016-10-02 22:23:32 +02:00
Alex Rønne Petersen 818fd2a032 [utils] Move MONO_DEPRECATED to mono-publib.h and make it imply MONO_API + MONO_RT_EXTERNAL_ONLY.
Also make it work with MSVC.
2016-10-02 22:23:31 +02:00
Alex Rønne Petersen b2b6a6effa [profiler] Remove the long-obsolete hsmode option.
Also refactor the heap walk code a bit.
2016-10-02 22:23:31 +02:00
Alex Rønne Petersen 510399644b [profiler] Document and fix the onlycoverage option. 2016-10-02 22:23:30 +02:00
Alex Rønne Petersen 60fdc682f1 [profiler] Remove the countersonly option.
It was never documented and is no longer functional.
2016-10-02 22:23:29 +02:00
Alex Rønne Petersen 9167d1def0 [man] Update mprof-report.1 to indicate the correct default maxframes value. 2016-10-02 22:23:29 +02:00
Alex Rønne Petersen 96e2b7d9ea [profiler] Use the signal shutdown logic for the sampling thread for more cases. 2016-10-02 22:23:28 +02:00
Alex Rønne Petersen d5ab942572 [profiler] Remove some indirection in setting up GC events.
* mono_gc_enable_events: This did nothing for SGen and we called it
  unconditionally for Boehm. So no point in having it around.
* mono_gc_enable_alloc_events: The performance difference between checking
  a static alloc_events variable versus checking mono_profiler_events is
  marginal at best and doesn't justify the indirection, especially now that
  we support managed allocators while profiling.
2016-10-02 22:23:28 +02:00
Alex Rønne Petersen 2849de826a [profiler] Lift profiler limitation in mono_class_get_allocation_ftn ().
This has not actually been necessary since allocation reporting was moved into
the GC implementations.
2016-10-02 22:23:27 +02:00
Alex Rønne Petersen 074e535380 [profiler] Don't leak counter data structures on shutdown. 2016-10-02 22:23:27 +02:00
Alex Rønne Petersen f9f1147466 [profiler] Simplify counters initialization. 2016-10-02 22:23:26 +02:00
Alex Rønne Petersen 3f46eb6b06 [profiler] Don't emit a perf counters sample event if none are registered. 2016-10-02 22:23:26 +02:00
Alex Rønne Petersen 099ddf1b78 [profiler] Fix the code that synthesizes thread end events.
It could previously fail to process a newly allocated buffer.
2016-10-02 22:23:25 +02:00
Alex Rønne Petersen cf30f6102c [profiler] Add counters for all event types. 2016-10-02 22:23:24 +02:00
Vlad Brezae c03c5c8e5a [runtime] Replace uses of alloc functions with glib variants 2016-10-02 22:23:22 +02:00
Zoltan Varga bf6cffb88e [runtime] Pass the initial context to mono_walk_stack_with_ctx () in mono_stack_walk_async_safe (). Hopefully fixes #44164. 2016-10-02 22:22:49 +02:00
Alexander Köplinger dd7e330373 [btls] Fix bashism in create-object-library.sh
Found by checkbashisms(1) as "unsafe echo with backslash". Some shells don't expand embedded \n in a string by default,
which broke the build on systems like ArchLinux or Alpine where /bin/sh points to those shells because the generated .lo
file contained just a single line instead of two.

Thanks to @JustArchi for researching this on the Mono Gitter channel, it made fixing the issue a lot easier!

(cherry picked from commit 1958bb8b34)
2016-10-02 17:16:18 +02:00
Martin Baulig 7c88bf755e Put back the MonoBtlsContext.cs change that I accidentally reverted. 2016-10-01 21:32:16 +02:00
Martin Baulig 4d28eb4b88 [System]: ChainValidationHelper: ignore port number when validating a certificate's host name. 2016-10-01 21:30:36 +02:00
Martin Baulig baebc1d8c0 [BTLS]: Ignore port number when validating certificates. 2016-10-01 21:20:29 +02:00
Martin Baulig 2602c52de4 [BTLS]: Send server name extension on the client. 2016-10-01 21:20:29 +02:00
Alexander Köplinger deac4585cb Fix build break from 81fb20737f
The HttpWebResponse stub that is used e.g. on the monotouch_watch profile was missing an overload that this commit was using.

(cherry picked from commit f4475ff013)
2016-10-01 02:58:51 +02:00
Marek Safar f04a619165 [System] Fill more WebException details when CONNECT fails. Fixes #19594 2016-10-01 00:11:57 +02:00
Martin Baulig 30fabaedd3 [scripts]: Add 'btls-cert-sync' script. 2016-09-30 22:50:39 +02:00
Martin Baulig 7002264dd2 [System]: Fix MonoTlsProviderFactory.TryDynamicLoad() logic.
If the MONO_TLS_PROVIDER environment variable is missing, use "default".
2016-09-30 22:45:30 +02:00
Martin Baulig b894d5ce4a [System]: Make BTLS the default TLS Provider on Desktop.
(cherry picked from commit 069a1e4f78)
2016-09-30 17:37:22 +02:00
Martin Baulig 9827f491f0 [cert-sync]: Make the new store the default and add '--legacy' for the old one.
(cherry picked from commit ecdc3ef482)
2016-09-30 17:30:36 +02:00
Martin Baulig b39ff26269 [BTLS]: Remove some debugging methods.
(cherry picked from commit aa320774ed)
2016-09-30 17:12:51 +02:00
Alexander Köplinger f0f53513f3 Merge pull request #3680 from rolfbjarne/fix-monotouch-build-4.8.0
[System] Fix monotouch* build.
2016-09-30 17:03:08 +02:00
Martin Baulig e81c051ab3 [System]: Enable AndroidPlatform.CertStoreLookup().
Uses reflection to call into AndroidEnvironment.CertStoreLookup()
(which as been added in https://github.com/xamarin/xamarin-android/pull/246).

(cherry picked from commit 0b045d2b6e)
2016-09-30 16:27:20 +02:00
Rolf Bjarne Kvinge 90d6fc7082 [System] Fix monotouch* build. 2016-09-30 16:23:23 +02:00
Alexander Köplinger 36ffc29d19 Bump boringssl to fix the build
(cherry picked from commit 2417bf1861)
2016-09-30 16:14:41 +02:00
Alexander Köplinger ec7374048f [btls] Only use cmake policies CMP0026/CMP0042 if cmake supports it
Some older cmake versions don't.

(cherry picked from commit bd1d7650ec)
2016-09-30 15:58:31 +02:00
Martin Baulig 9e46b5744b [System]: AndroidPlatform.CertStoreLookup(): add to the build, but return null.
This needs to have support added to xamarin-android before we can enable it.
2016-09-30 15:17:34 +02:00
Chris Hamons 6392e1746f Add Mono.Runtime to XM 4.5 profile
- Extends https://github.com/mono/mono/pull/3624

(cherry picked from commit 0c64f16bcb)
2016-09-30 14:57:45 +02:00
Martin Baulig a71f2b45c6 [BTLS]: Add managed BTLS sources.
* external/boringssl: unmanaged code from Google (added earlier).

* mono/btls: unmanaged BTLS lives here (added earlier).

* System/Mono.Btls: managed BTLS lives here.

* Mono.Btls.Interface: The purpose of this assembly is to allow test suites
  such as xamarin/web-tests to test parts of the BTLS APIs without making
  System.dll's internals visible.  It is not a stable and maintained API.

(cherry picked from commit 0f8f0c543c)
2016-09-30 14:21:08 +02:00
Martin Baulig 07fc3dc95b [Mono.Security]: Add the new certificate store.
BTLS uses a different format and naming scheme for the local certificate store.

Before using BTLS for the first time on desktop, you need to convert the local
certificate store by either using the new `btls-cert-sync` tool (which will convert
your existing certificate store to the new new format) or `cert-sync` with the
`--btls` argument.

The new format and naming scheme is identically to what you'll find in
'/system/etc/security/cacerts/' on an Android device.  It stores the certificates
in PEM format (with a human-readable text section added) using filenames which
are based on the certificate's subject name hash.

Previously, Mono stored the certificates in binary DER format, using a filename
based on either the Subject-Key-Identifier (if available) or the thumbprint.

We cannot access this from BTLS because computing these filenames requires
reading the entire X509 certificate (including the X509v3 extensions), but
their native lookup code only gives us the SubjectName.

This transitioning won't affect Android users as we're using the system
certificate store (including the user certificate store, via a Java callback).

* Mono.Security.X509.X509Store and X509Stores:
  Support both the old and the new format.  Using the new format requires BTLS.

* Mono.Security.X509.X509StoreManager:
  Add `NewCurrentUserPath` and `NewLocalMachinePath` properties for the
  new path names (~/.config/.mono/new-certs).

* Mono.Security.X509.X509StoreManager:
  Add `NewCurrentUser` and `NewLocalMachine` properties.  Requires BTLS.

* tools/security/cert-sync:
  Add new `--btls` argument to use the new store.

(cherry picked from commit fb93be4490)
2016-09-30 13:39:24 +02:00
Martin Baulig c5c809d6dc [System]: Add AndroidPlatform.CertStoreLookup().
This is conditional to HAVE_BTLS and needs to have support added
to xamarin-android first.

(cherry picked from commit 52b290680c)
2016-09-30 13:04:45 +02:00
Martin Baulig 334d0f84d9 [System]: New X509Helper2 APIs for BTLS.
The managed HAVE_BTLS conditionals will be removed once BTLS itself has landed.

(cherry picked from commit d88ce91459)
2016-09-30 13:04:45 +02:00
Marek Safar 4cbb1922c3 [System.Data] Implements SqlClient async readers. Fixes #44843 2016-09-30 12:09:38 +02:00
Martin Baulig b4b21d081b [BTLS]: Add the native BTLS sources.
(cherry picked from commit c950be01ac)
2016-09-30 11:48:18 +02:00
Martin Baulig 63c0803b2b [Mono.Security]: Cleanup the MonoTlsProvider's certificate validation code. (#3674)
* [Mono.Security]: Remove Mono.Security.Interface.IMonoTlsContext.

This interface is not actually used anywhere anymore, so we can also
just get rid of it.

* [System]: Removed unused private TLS classes.

* [Mono.Security]: Cleanup the MonoTlsProvider's certificate validation code.

Each TLS Provider now has its own certificate validator and there is no
automatic fallback anymore.  We only have three different TLS Providers,
"legacy", "appletls" and "btls" - and legacy is the only one which used
the managed validator.  Both AppleTls and BTLS provider their own validator,
which invokes some native API.

All of the following were internal APIs.

* MonoTlsProvider.HasCustomSystemCertificateValidator has been removed.

* MonoTlsProvider.InvokeSystemCertificateValidator() has been renamed
  into ValidateCertificate() and is now abstract.
2016-09-29 22:47:28 +02:00
Marek Safar fc6b2d359d [mcs] Branch visited labels cache for conditional block. Fixes #44751 2016-09-29 22:40:22 +02:00
Alexander Köplinger 8f689a60fe Merge pull request #3672 from rolfbjarne/pr-fix-system-tests-4.8
[System] Fix tests that regressed in e6536dd.
2016-09-29 15:00:52 +02:00
Rolf Bjarne Kvinge 5f174dd217 [System] Fix tests that regressed in e6536dd.
* I got confused between [TestFixtureSetup] and [Setup], so fix tests whose
  [Setup] methods were changed/removed to properly clean up after each test
  (using a [TearDown] method) so that the next time the on-demand creation of
  objects works as expected (i.e. objects created in the [Setup] method should
  be created on-demand once for each method instead of once for each class).

* Also fix SocketAcceptAsyncTest, the change to properly catch exceptions on
  background threads was incorrect.
2016-09-29 13:56:26 +02:00
Rodrigo Kumpera 5e454f9c20 [logging] Fix logging on iOS. We lost asl redirection and it was sending to stdout instead. 2016-09-28 17:08:53 -07:00
Martin Baulig 1935a43f60 [configure] Add configure.ac checks for BTLS. (#3668)
(cherry picked from commit 1055069416)
2016-09-29 01:11:32 +02:00
Martin Baulig 9437553e54 [System]: Rename MonoLegacyTlsProvider into LegacyTlsProvider. (#3666)
LegacyTlsProvider now lives in the 'Mono.Net.Security' namespace
(previously 'Mono.Net.Security.Private') and derives directly from
the public 'Mono.Security.Interface.MonoTlsProvider'.

This allows it to be used by products, for instance replacing
xamarin-macios/src/Security/Tls/OldTlsProvider.cs.

The idea is to have all 'MonoTlsProvider' implementations inside
System.dll and not access any of the private APIs from outside of it.
2016-09-29 00:53:03 +02:00
Marek Safar 01dcbdd3fc [corlib] Improve test added in 54ea12e4fa 2016-09-29 00:29:49 +02:00
Rolf Bjarne Kvinge aaaead4d5b [corlib] Add API to uninstall/reinstall signal handlers.
This API is provided to be used by libraries providing crash reporting, so
that those libraries can install signal handlers and at the same time not
interfere with Mono's signals.

The intended pattern is this:

    Mono.Runtime.RemoveSignalHandlers ();
    InstallThirdPartySignalHandlers ();
    Mono.Runtime.InstallSignalHandlers ();

This ensures that Mono is always notified first of any signals, and will then
chain to the third-party signal handlers if the signal did not originate in
managed code.

Mono's signals must first be removed, so that if third-party signal handler
does signal chaining, we don't end up in Mono's signal handler again.

Mailing-list thread: http://lists.dot.net/pipermail/macios-devel/2016-September/000016.html [Signal-chaining & crash reporters]
Example usage: https://github.com/rolfbjarne/HockeySDK-Xamarin/commit/862721199f1adec210bfc7b1943f975ffb8048a9
2016-09-28 19:47:02 +02:00
Rolf Bjarne Kvinge f2ff1683aa [mini] Provide a free function to the saved signal handler hash table.
This makes the cleanup code simpler, and also makes it easier to
replace saved signal handlers without having to worry about
leaking memory.
2016-09-28 19:47:02 +02:00
Marek Safar c5e917ca96 [System] Reduce duration of SendGenericExceedBuffer test 2016-09-28 18:13:11 +02:00
Aleksey Kliger 18ae0d10fc [runtime] Fix MonoMethod.get_base_method when abstract methods are not overridden
When there is an abstract class in the middle of an inheritance
hierarchy that doesn't override a method, get_base_methods needs to search
the parent class instead aborting early.

Example:

```
abstract class Root {
  public abstract void Foo ();
}
abstract class Abs : Root { }
class Derived : Abs {
  public override void Foo () { }
}
```

If we ask for the base method of Derived.Foo we used to get Derived.Foo
back because Abs did not provide an override.  Instead we should skip
abs and look in Root.
2016-09-28 11:02:59 -04:00
Aleksey Kliger 662513e62b [coop handles] Add some memory fences
When running with async suspend (ie, not coop), a user thread might be
suspended while its manipulating the coop handle stack.  In that case,
we want to present a consitent view to mono_handle_stack_scan () by
adding memory fences to code that updates the stack chunks.  In
particular we want to ensure that the chunk size is increased after
the new slot has a valid (null) value.  Also when creating new chunks
make sure their size is initialized before the chunk stack is updated.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=43921 (at least the
one stack trace observed in [comment 1](https://bugzilla.xamarin.com/show_bug.cgi?id=43921#c1)).
2016-09-28 10:18:14 -04:00
Ludovic Henry 37b8dc4fab [w32handle] Ensure we initialize begore the gc attach the current thread (#3648) 2016-09-28 16:04:09 +02:00
Martin Baulig 0d07c695b5 [System]: Cleanup the internal MobileTlsContext.
* Add SelectClientCertificate().
* ValidateCertificate() now returns bool.
* Add ValidateCertificate() overload.
2016-09-28 13:39:47 +02:00
Martin Baulig fcc570920d [Mono.Security]: Cleanup the internal ICertificateValidator2. 2016-09-28 13:39:37 +02:00
Martin Baulig c155563d1e Remove all MONO_FEATURE_NEW_TLS conditionals. 2016-09-28 13:39:30 +02:00
Martin Baulig 5b412212cd Cleanup; with the removal of 'PrebuiltSystemAlias', we don't need to use XX509* anymore. 2016-09-28 13:39:22 +02:00
Martin Baulig c2e7ca6c99 [System]: Make Test/System.Net.Sockets compile. 2016-09-28 13:36:03 +02:00
Martin Baulig 7c3ae83b31 [Mono.Security.Interface] Cleanup and simplify MonoTlsProviderFactory.
The "global" TLS Provider (returned by MonoTlsProviderFactory.GetProvider())
may only be modified at application startup (before any of the TLS / Certificate
code has been used).

* MonoTlsProviderFactory.HasProvider has been removed.

  This property used to initialize the TLS Subsystem without throwing any
  exceptions.  However, properties with side-effects is a bad design principle.

* Add MonoTlsProviderFactory.IsInitialized.

  Does not have any side-effects.

* Add MonoTlsProviderFactory.Initialize() and Initialize(string).

  May only be called at application startup and explicitly initializes the
  TLS Subsystem.

* Rename MonoTlsProviderFactory.GetDefaultProvider() into GetProvider()
  and removed MonoTlsProviderFactory.GetCurrentProvider().

  We do not distinguish between a "default" and a "current" provider anymore;
  there is only one "global" provider.

* Add MonoTlsProviderFactory.IsProviderSupported(string).

  Checks whether a specific TLS Provider is supported, without having side-effects.

* Make the old APIs [Obsolete] until products have been updated.

* Add some documentation to MonoTlsProviderFactory.
2016-09-27 22:21:13 +02:00
Rolf Bjarne Kvinge ddf9f2359d [System*] Throw a PlatformNotSupported exception when using the networking stack on watchOS. (#3655)
* [System] Fix line endings for a few files.

Best reviewed by not showing whitespace changes (should be empty diff in that case).

* [System] Fix potential crash in CookieParserTests.

Socket.EndAccept can throw an exception, which will crash the process if it
happens on a threadpool. So handle any exceptions when calling
Socket.EndAccept, and propagate those exceptions out of any threadpool code.

* [System.Net.Http] Throw a PlatformNotSupported exception when using HttpClientHandler on watchOS.

* [System.Net.Http] Tweak tests after watchOS API change.

Unfortunately the [ExpectedException] attribute can't be put on an entire
class, so remove the [Category ("RequiresBSDSockets")] attribute on the class
and instead decorate each test with an [ExpectedException] attribute.

* [System] Extract the HttpListenerResponseHelper class to a separate file.

Extract the HttpListenerResponseHelper class to a separate file so that it's
easier to replace the HttpListenerResponse implementation by using a different
file.

* [System] Throw a PlatformNotSupported exception when using the networking stack on watchOS.

* [System] Tweak tests after watchOS API changes.

Unfortunately the [ExpectedException] attribute can't be put on an entire
class, so remove the [Category ("RequiresBSDSockets")] attribute on the class
and instead decorate each test with an [ExpectedException] attribute.

* [System] Fix potential crash in SocketAcceptAsyncTest.

Fix potential crash in SocketAcceptAsyncTest by catching any exceptions in
code executed on the threadpool so that we never end up with unhandled
exceptions (which may terminate the process).

* [System] Avoid logic in SetUp attributes in tests.

Any type of exception in [SetUp] attributes causes all tests to fail with that
exception.

This even happens for tests that do not need the logic in the [SetUp]
attribute.

So rewrite tests a bit to not use [SetUp] when we can reasonably avoid it, and
instead instantiate class-level variables on first use. This ensures that any
exceptions that occur when initializing those variables are attributed to the
corresponding test, and not all of them.

* [System] Make exception handler (for test) catch more exceptions to avoid unhandled exceptions causing process termination.

* [System] Remove Obsolete attribute on API that throws PNSE.
2016-09-27 21:15:11 +02:00
Marek Habersack 88a98e08c1 Fix trace logging on Android
Introduction of the structured trace logger accidentally broke Android
logcat logging. The reason for this is that the default logging handler
defined in eglib (in goutput.c) for Android was never called, instead it
was superseeded by the log file logger defined in mono-logger.c

The net effect was that Mono tried to write the messages to some file on
Android leaving logcat devoid of any trace of life :)

This commit fixes the issue by introducing a set of structured logging
functions for Android.

As a side note - file logging on Android is not that useful. Writing to
a file on external storage medium requires app permissions and writing
to a location on internal storage medium, while allowed, might be
subject to space limitations and should not be used for possibly
voluminous data. It's therefore not very practical on Android.
2016-09-27 20:35:47 +02:00
Martin Baulig fc99fc4313 [Mono.Security]: Cleanup Mono.Security.Interface.CertificateValidationHelper.
* CertificateValidationHelper.GetDefaultValidator(): rename this internal method into
  GetInternalValidator() (keeping the old as [Obsolete] until products have been updated).

* CertificateValidationHelper.GetValidator(): remove the 'provider' argument.

This is part of a set of cleanups and simplifications for the upcoming BTLS integration.

(cherry picked from commit 61d76d9642)
2016-09-27 11:40:44 +02:00
Marek Safar 84fbbb8de7 [System] Fixes SendGenericExceedBuffer test 2016-09-26 20:47:01 +02:00
Marek Safar c162180aee [System] netstandard compatible Process collections 2016-09-26 16:58:32 +02:00
Zoltan Varga 18235dfff1 [jit] Resurrect the Monitor.Enter () v4 optimization. (#3632) 2016-09-25 18:41:49 -04:00
Alexander Köplinger 5381bdc290 [System] Add ISupportInitialize on mobile FileSystemWatcher
The interface was missing on the mobile stub.

(cherry picked from commit 4d325a0674)
2016-09-25 14:00:47 +02:00
Alexander Köplinger 1c40419bc7 [System] Remove obsolete HttpWebRequest/Response constructors again
They were removed from a later revision of netstandard2.0 so we don't need to add them.

(cherry picked from commit 566f0a78b0)
2016-09-25 13:03:35 +02:00
Alex Earl 529502bf41 Fix issue with VB projects
Fixed GenerateFullPathToTool for Vbc task to match behavior of the Csc
task. This allows VB.NET projects to build successfully.

See https://bugzilla.xamarin.com/show_bug.cgi?id=44714

(cherry picked from commit d6bb144980)
2016-09-25 01:55:29 +02:00
Martin Baulig 2a3e4002ea [AppleTls]: Flush the write queue before finishing the handshake.
It is possible for SSLHandshake() to return SslStatus.Success while we're still
having a pending write (AsyncOperationStatus.WantWrite).

This is because our managed write callback must never return 'WouldBlock', so
SSLHandshake() things that all data have been sent while we still have them in
our write queue.

When this happens, we currently flush the write queue then call SSLHandshake()
again via AsyncOperationStatus.WantWrite -> AsyncOperationStatus.Continue.

This returns SslStatus.Protocol on iOS 10.

(cherry picked from commit 2cc1b887c1)
2016-09-24 07:38:35 +02:00
Zoltan Varga 5c2d1761e9 [llvm] Add static rgctx trampolines to array access methods in the aot+llvm case too. (#3616) 2016-09-23 17:40:43 -04:00
Martin Baulig f3bd113611 Fix mono/tests/Makefile.am (blank line after trailing backslash). 2016-09-23 18:20:48 +02:00
Alexander Köplinger 58bf33a539 [bcl] Add missing APIs for netstandard parity and expose a few APIs on mobile
This ensures we're compliant with the upcoming netstandard2.0 API surface area.

(cherry picked from commit 112631f5c6)
2016-09-23 17:58:04 +02:00
Alexander Köplinger feeeb1cd3f [bcl] Add CLSComplaint(false) to a few types/methods that aren't compliant
(cherry picked from commit fa986f1e36)
2016-09-23 17:57:56 +02:00
Alexander Köplinger 64ce52fa6a [System.Core] Expose a few more System.IO.Pipes APIs on mobile
Required for netstandard matching.

(cherry picked from commit f5836956c6)
2016-09-23 17:57:27 +02:00
Zoltan Varga 3ab4fe29ab Revert "[loader] Tests for RefereceAssemblyAttribute support"
This reverts commit 31de4df835.

Revert this as the corresponding fix was reverted.
2016-09-23 10:11:10 -04:00
Marek Safar 9208eb2070 [corcompare] More hacks to make breaking change not too disruptive 2016-09-23 14:45:04 +02:00
Marek Safar 610984e83b [bcl] Base type update to match netstandard apis 2016-09-23 12:19:39 +02:00
Zoltan Varga b591e86c1a [arm64] Handle thunks with ARM64_B relocations as well. 2016-09-22 19:30:18 -04:00
Marek Safar 81822428e9 Merge pull request #3603 from ninjarobot/socket-write
Send all data to a socket before exit from Socket.Send.
2016-09-22 23:14:20 +02:00
Marek Safar 210801836e [corcompare] Another try to make breaking change not too discruptive 2016-09-22 20:12:16 +02:00
Marek Safar 25d7170248 Add missing file 2016-09-22 14:46:43 +02:00
Marek Safar 6f075050c2 [colrib] Fixes aecdb91a06 and add GC tests 2016-09-22 14:46:25 +02:00
Marek Safar 7a87a23651 [corcompare] Drop ParameterAttributes from method signature 2016-09-22 12:27:42 +02:00
Martin Baulig f2558db1a7 [runtime]: Move "_ReRegisterForFinalize" in icall-def.h.
Fixes the sort order to make the warnings go away.
2016-09-22 08:10:34 +02:00
Martin Baulig 0bafe8c3c7 [Mono.Security]: Add 'MonoTlsConnectionInfo.PeerDomainName'. 2016-09-22 07:38:09 +02:00
Martin Baulig 7b7b7c9b64 Remove obsolete Mono.Security.Providers.* assemblies (#3595)
* Remove Mono.Security.Providers.NewSystemSource and Mono.Security.Providers.NewTls.

* Remove InternalVisible for "Xamarin.BoringTls".

* Remove Mono.Security.Providers.OldTls and Mono.Security.Providers.DotNet.
2016-09-22 07:20:00 +02:00
Zoltan Varga 94acdcf647 [runtime] Fix the managed name of the ReRegisterForFinalize () icall. 2016-09-21 17:52:25 -04:00
Marek Safar 5da8cfe05d [mcs] Add compilergenerated attribute for private event backing fields to match newer csc 2016-09-21 12:55:05 +02:00
Henric Müller 95744eb659 Only set NoDelay by default for protocol TCP
(cherry picked from commit cd40eb318e)
2016-09-21 11:38:17 +02:00
Alexander Köplinger c05627e24b [Facades] Another define fix
It was missed in https://github.com/mono/mono/commit/c84760250884989e10d707c049fd0aacae79c93e.
2016-09-21 09:00:25 +02:00
Marek Safar 4044840804 [Facades] Use correct define 2016-09-21 09:00:25 +02:00
Alan McGovern f484d0d9c0 Bump to pull in a new gtk with this build 2016-09-20 18:24:06 -04:00
Alexander Köplinger 6a5c925b65 Fix Linux build break due to case sensitivity
(cherry picked from commit de8a76a1c1)
2016-09-20 20:07:48 +02:00
Marek Safar 7919e9abf8 [System] Add more types to mobile profile 2016-09-20 17:56:08 +02:00
Marek Safar 1f03b3ff35 [corlib] GC from referencesource 2016-09-20 17:29:38 +02:00
Alexander Köplinger 158a79950a Merge pull request #3581 from radical/mcs-ignore-args
[mcs] Accept and ignore command line args supported by csc that we don't
2016-09-19 18:11:19 +02:00
Ankit Jain 52bb524f49 [mcs] Accept and ignore command line args supported by csc that we don't
.. support:

	/publicsign+
	/publicsign-
2016-09-19 12:08:26 -04:00
Marek Safar 919b89954a [bcl] Add more reflection types to monotouch 2016-09-19 16:58:39 +02:00
Katharina Bogad 475c58eaff [System.Web] HttpCookie load defaults from Web.config
HttpCookie now loads default values from the Web.config,
just like the reference source does.
2016-09-19 16:53:40 +02:00
Marek Safar 6387e9c6d0 [mcs] Fixes codegen of predefined pointer arithmetic operators with user defined operator conversion for one of operands. Fixes #44440 2016-09-19 16:52:42 +02:00
Marek Habersack af086b0c70 [mkbundle] support satellite assemblies (#3448)
Satellite assemblies are special in that they all share the same file
name, but they live in separate directories named after the locale the
satellite assemblies pack. mkbundle currently doesn't support "clashing"
assembly filenames and will not be able to store the satellite
assemblies in the bundle for that reason.

This patch adds support for storing satellite assemblies with their
culture path prefix (e.g. en-US/MyAssembly.resources.dll) in the bundle
and also special code in the assembly loader to support such filenames
in the code which loads assemblies from the bundle.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=27061
2016-09-19 12:32:51 +02:00
Vlad Brezae d341594fac [jit] Fix missing wbarrier for array generic setter
The generic setter receives the element by reference which means we will never emit the write barrier since a reference to a reference is not a reference (mini_type_is_reference). Check the actual value instead. Fixes #42903.
2016-09-16 20:47:09 +03:00
Marek Safar 45bde6931d [corlib] Add missing apis 2016-09-16 18:06:30 +02:00
Marek Safar d364710817 [System.Net.Http] Show invalid values added to HttpHeaderValueCollection. to Fixes #44413. 2016-09-16 15:49:10 +02:00
Marek Safar 66f6456e86 [mcs] Delay array base type interfaces initialization. Fixes #44402 2016-09-16 13:14:01 +02:00
Marek Safar 4a3bbf5b42 Merge pull request #3572 from rolfbjarne/tests-system-dns-make-failures-not-crash-app-4.8
[System] Rewrite Dns tests so that failures don't cause the process to crash.
2016-09-16 12:34:36 +02:00
Rolf Bjarne Kvinge 3c2e1c56b2 [System] Rewrite Dns tests so that failures don't cause the process to crash.
Previously the tests were written so that some failures might occur on the
threadpool in methods that did not catch exceptions. In that case the process
would terminate due to an unhandled exception. So rewrite the tests to catch
exceptions in any code that doesn't run on the main thread, and forward those
exceptions to the main thread.

Also wait for async operations to complete on the main thread, and remove
asserts that are not supposed to be hit.

This is a backport of PR #3558.
2016-09-16 11:56:21 +02:00
Marek Safar fee3014cd3 [mcs] Report more errors for nameof expressions. Fixes #44168 2016-09-16 10:58:15 +02:00
Zoltan Varga c1c53bcfca Revert "[runtime] Check for ReferenceAssemblyAttribute when loading for execution."
This reverts commit bc9461168e.

Revert this to see if it fixes the wrench build.
2016-09-15 15:01:57 -04:00
Zoltan Varga 05b93203a5 [winx64] Mark some inline functions static to hopefully fix the mxe build. 2016-09-15 14:07:26 -04:00
Marek Safar 377041fd6e [build] Add System.Numerics.Vectors to xammac profile 2016-09-15 14:18:03 +02:00
Marek Safar 28194f79fe [mcs] Improve member lookup rules when type parameter has both non-object effective base class and interface constraint(s) 2016-09-15 13:40:51 +02:00
Marek Safar 9e16432697 [mcs] Move type constraints checks after base type definition. Fixes #44212 2016-09-14 15:43:09 +02:00
Marek Habersack 482ab094eb Set DefaultPersistentConnectionLimit to 10 for Xamarin.Android
This is to make it the same as the Xamarin.iOS setting and
fixes https://bugzilla.xamarin.com/show_bug.cgi?id=7467
2016-09-14 11:19:35 +02:00
Marek Safar f8a716bf29 [System] Don't compress custom http headers in httplistener response. Fixes #34715 2016-09-13 16:12:03 +02:00
Zoltan Varga 762d337187 Bump version to 4.8.0 2016-09-12 19:30:35 +02:00
1357 changed files with 32891 additions and 117162 deletions

No files matched your search

+5 -2
View File
@@ -1,11 +1,14 @@
# ensure LF endings on all checkouts
configure.ac crlf=input
configure.ac crlf=input
config.rpath crlf=input
configure.host crlf=input
mkinstalldirs crlf=input
*.sh crlf=input
# ensure native line endings on checkout
*.c crlf
*.h crlf
*.cs crlf
*.sh crlf
*.il crlf
.gitattributes crlf
+4
View File
@@ -39,3 +39,7 @@
path = external/cecil-legacy
url = git://github.com/mono/cecil.git
branch = mono-legacy-0.9.5
[submodule "external/boringssl"]
path = external/boringssl
url = git://github.com/mono/boringssl.git
branch = mono
+1 -1
View File
@@ -19,7 +19,7 @@ all: update_submodules
SUBMODULE_ERROR='Could not recursively update all git submodules. You may experience compilation problems if some submodules are out of date'
update_submodules:
@$(srcdir)/scripts/update_submodules
@$(srcdir)/scripts/update_submodules.sh
.PHONY: update_submodules
+2 -1
View File
@@ -4,7 +4,8 @@ SYS_REFS = \
System.Data.dll \
System.Runtime.Serialization.dll \
System.Xml.dll \
System.Xml.Linq.dll
System.Xml.Linq.dll \
Mono.Posix.dll
check-profiler-stress:
@$(MAKE) validate-benchmarker RESET_VERSIONS=1
+188 -18
View File
@@ -1,7 +1,14 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Xml;
using Mono.Unix.Native;
using Newtonsoft.Json;
// Shut up CLS compliance warnings from Json.NET.
@@ -10,7 +17,8 @@ using Newtonsoft.Json;
namespace Mono.Profiling.Tests.Stress {
// https://github.com/xamarin/benchmarker/blob/master/tools/libdbmodel/Benchmark.cs
class Benchmark {
sealed class Benchmark {
public string Name { get; set; }
public string TestDirectory { get; set; }
public bool OnlyExplicit { get; set; }
@@ -24,8 +32,24 @@ namespace Mono.Profiling.Tests.Stress {
}
}
sealed class TestResult {
public Benchmark Benchmark { get; set; }
public ProcessStartInfo StartInfo { get; set; }
public Stopwatch Stopwatch { get; set; } = new Stopwatch ();
public int? ExitCode { get; set; }
public StringBuilder StandardOutput { get; set; } = new StringBuilder ();
public StringBuilder StandardError { get; set; } = new StringBuilder ();
}
static class Program {
static readonly TimeSpan _timeout = TimeSpan.FromHours (6);
static string FilterInvalidXmlChars (string text) {
return Regex.Replace (text, @"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]", string.Empty);
}
static int Main ()
{
var depDir = Path.Combine ("..", "external", "benchmarker");
@@ -44,8 +68,7 @@ namespace Mono.Profiling.Tests.Stress {
var rand = new Random ();
var cpus = Environment.ProcessorCount;
var successes = 0;
var failures = 0;
var results = new List<TestResult> (benchmarks.Length);
var sw = Stopwatch.StartNew ();
@@ -66,6 +89,8 @@ namespace Mono.Profiling.Tests.Stress {
WorkingDirectory = Path.Combine (testDir, bench.TestDirectory),
FileName = monoPath,
Arguments = $"--debug --profile=log:{profOptions} " + string.Join (" ", bench.CommandLine),
RedirectStandardOutput = true,
RedirectStandardError = true,
};
info.EnvironmentVariables.Clear ();
@@ -77,32 +102,177 @@ namespace Mono.Profiling.Tests.Stress {
Console.WriteLine ($"[{sw.Elapsed.ToString ("G")}] {progress} Running {bench.Name} with profiler options: {profOptions}");
Console.ResetColor ();
var sw2 = Stopwatch.StartNew ();
var result = new TestResult {
Benchmark = bench,
StartInfo = info,
};
using (var proc = Process.Start (info)) {
proc.WaitForExit ();
sw2.Stop ();
using (var proc = new Process ()) {
proc.StartInfo = info;
Console.WriteLine ();
proc.OutputDataReceived += (sender, args) => {
if (args.Data != null)
result.StandardOutput.AppendLine (args.Data);
};
if (proc.ExitCode != 0)
failures++;
else
successes++;
proc.ErrorDataReceived += (sender, args) => {
if (args.Data != null)
result.StandardError.AppendLine (args.Data);
};
Console.ForegroundColor = proc.ExitCode != 0 ? ConsoleColor.Red : ConsoleColor.Green;
Console.WriteLine ($"[{sw.Elapsed.ToString ("G")}] {progress} {bench.Name} took {sw2.Elapsed.ToString ("G")} and exited with code: {proc.ExitCode}");
Console.ResetColor ();
result.Stopwatch.Start ();
proc.Start ();
proc.BeginOutputReadLine ();
proc.BeginErrorReadLine ();
if (!proc.WaitForExit ((int) _timeout.TotalMilliseconds)) {
// Force a thread dump.
Syscall.kill (proc.Id, Signum.SIGQUIT);
Thread.Sleep (1000);
try {
proc.Kill ();
} catch (Exception) {
}
} else
result.ExitCode = proc.ExitCode;
result.Stopwatch.Stop ();
}
var resultStr = result.ExitCode == null ? "timed out" : $"exited with code: {result.ExitCode}";
Console.ForegroundColor = result.ExitCode != 0 ? ConsoleColor.Red : ConsoleColor.Green;
Console.WriteLine ($"[{sw.Elapsed.ToString ("G")}] {progress} {bench.Name} took {result.Stopwatch.Elapsed.ToString ("G")} and {resultStr}");
Console.ResetColor ();
if (result.ExitCode != 0) {
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine ("===== stdout =====");
Console.ResetColor ();
Console.WriteLine (result.StandardOutput.ToString ());
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine ("===== stderr =====");
Console.ResetColor ();
Console.WriteLine (result.StandardError.ToString ());
}
results.Add (result);
}
sw.Stop ();
Console.ForegroundColor = failures != 0 ? ConsoleColor.Red : ConsoleColor.Green;
Console.WriteLine ($"[{sw.Elapsed.ToString ("G")}] Finished with {successes}/{benchmarks.Length} passing tests");
var successes = results.Count (r => r.ExitCode == 0);
var failures = results.Count (r => r.ExitCode != null && r.ExitCode != 0);
var timeouts = results.Count (r => r.ExitCode == null);
var settings = new XmlWriterSettings {
NewLineOnAttributes = true,
Indent = true,
};
using (var writer = XmlWriter.Create ("TestResult-profiler-stress.xml", settings)) {
writer.WriteStartDocument ();
writer.WriteComment ("This file represents the results of running a test suite");
writer.WriteStartElement ("test-results");
writer.WriteAttributeString ("name", "profiler-stress-tests.dummy");
writer.WriteAttributeString ("total", results.Count.ToString ());
writer.WriteAttributeString ("failures", failures.ToString ());
writer.WriteAttributeString ("not-run", "0");
writer.WriteAttributeString ("date", DateTime.Now.ToString ("yyyy-MM-dd"));
writer.WriteAttributeString ("time", DateTime.Now.ToString ("HH:mm:ss"));
writer.WriteStartElement ("environment");
writer.WriteAttributeString ("nunit-version", "2.4.8.0");
writer.WriteAttributeString ("clr-version", Environment.Version.ToString ());
writer.WriteAttributeString ("os-version", Environment.OSVersion.ToString ());
writer.WriteAttributeString ("platform", Environment.OSVersion.Platform.ToString ());
writer.WriteAttributeString ("cwd", Environment.CurrentDirectory);
writer.WriteAttributeString ("machine-name", Environment.MachineName);
writer.WriteAttributeString ("user", Environment.UserName);
writer.WriteAttributeString ("user-domain", Environment.UserDomainName);
writer.WriteEndElement ();
writer.WriteStartElement ("culture-info");
writer.WriteAttributeString ("current-culture", CultureInfo.CurrentCulture.Name);
writer.WriteAttributeString ("current-uiculture", CultureInfo.CurrentUICulture.Name);
writer.WriteEndElement ();
writer.WriteStartElement ("test-suite");
writer.WriteAttributeString ("name", "profiler-stress-tests.dummy");
writer.WriteAttributeString ("success", (failures + timeouts == 0).ToString ());
writer.WriteAttributeString ("time", ((int) sw.Elapsed.TotalSeconds).ToString ());
writer.WriteAttributeString ("asserts", (failures + timeouts).ToString ());
writer.WriteStartElement ("results");
writer.WriteStartElement ("test-suite");
writer.WriteAttributeString ("name", "MonoTests");
writer.WriteAttributeString ("success", (failures + timeouts == 0).ToString ());
writer.WriteAttributeString ("time", ((int) sw.Elapsed.TotalSeconds).ToString ());
writer.WriteAttributeString ("asserts", (failures + timeouts).ToString ());
writer.WriteStartElement ("results");
writer.WriteStartElement ("test-suite");
writer.WriteAttributeString ("name", "profiler-stress");
writer.WriteAttributeString ("success", (failures + timeouts == 0).ToString ());
writer.WriteAttributeString ("time", ((int) sw.Elapsed.TotalSeconds).ToString ());
writer.WriteAttributeString ("asserts", (failures + timeouts).ToString ());
writer.WriteStartElement ("results");
foreach (var result in results) {
var timeoutStr = result.ExitCode == null ? "_timeout" : string.Empty;
writer.WriteStartElement ("test-case");
writer.WriteAttributeString ("name", $"MonoTests.profiler-stress.{result.Benchmark.Name}{timeoutStr}");
writer.WriteAttributeString ("executed", "True");
writer.WriteAttributeString ("success", (result.ExitCode == 0).ToString ());
writer.WriteAttributeString ("time", ((int) result.Stopwatch.Elapsed.TotalSeconds).ToString ());
writer.WriteAttributeString ("asserts", result.ExitCode == 0 ? "0" : "1");
if (result.ExitCode != 0) {
writer.WriteStartElement ("failure");
writer.WriteStartElement ("message");
writer.WriteCData (FilterInvalidXmlChars (result.StandardOutput.ToString ()));
writer.WriteEndElement ();
writer.WriteStartElement ("stack-trace");
writer.WriteCData (FilterInvalidXmlChars (result.StandardError.ToString ()));
writer.WriteEndElement ();
writer.WriteEndElement ();
}
writer.WriteEndElement ();
}
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.WriteEndDocument ();
}
var failureStr = failures + timeouts != 0 ? $" ({failures} failures, {timeouts} timeouts)" : string.Empty;
Console.ForegroundColor = failures + timeouts != 0 ? ConsoleColor.Red : ConsoleColor.Green;
Console.WriteLine ($"[{sw.Elapsed.ToString ("G")}] Finished with {successes}/{results.Count} passing tests{failureStr}");
Console.ResetColor ();
return failures;
return failures + timeouts;
}
}
}
+179 -24
View File
@@ -2,7 +2,7 @@
#AC_PREREQ([2.62])
# when bumping version number below, keep it in sync with man/mono.1 too
AC_INIT(mono, [4.7.0],
AC_INIT(mono, [4.8.0],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
@@ -52,6 +52,8 @@ CPPFLAGS_FOR_LIBGC=$CPPFLAGS
CFLAGS_FOR_LIBGC=$CFLAGS
CPPFLAGS_FOR_EGLIB=$CPPFLAGS
CFLAGS_FOR_EGLIB=$CFLAGS
CPPFLAGS_FOR_BTLS=$CPPFLAGS
CFLAGS_FOR_BTLS=$CFLAGS
# libgc uses some deprecated APIs
CFLAGS_FOR_LIBGC="$CFLAGS -Wno-deprecated-declarations"
@@ -66,7 +68,11 @@ AC_SUBST(libmono_cflags)
AC_SUBST(libmono_ldflags)
# Variable to have relocatable .pc files (lib, or lib64)
reloc_libdir=`basename ${libdir}`
# realpath isn't always available, and requires that all but the tip of the provided
# path exists. Fall back to the old behaviour, but realpath allows depth >1
# e.g. Debian puts Mono in /usr/bin and libs in /usr/lib/x86_64-linux-gnu/ which is
# too deep for the old method to work
reloc_libdir=`realpath --relative-to=${prefix} ${libdir} 2> /dev/null || basename ${libdir}`
AC_SUBST(reloc_libdir)
# Set to yes if Unix sockets cannot be created in an anonymous namespace
@@ -941,7 +947,7 @@ fi
AC_ARG_ENABLE(minimal, [ --enable-minimal=LIST drop support for LIST subsystems.
LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug, appdomains, verifier,
reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, perfcounters, normalization, assembly_remapping, shared_perfcounters, remoting,
security, sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying.],
security, lldb, sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying.],
[
for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
eval "mono_feature_disable_$feature='yes'"
@@ -1091,6 +1097,11 @@ if test "x$mono_feature_disable_security" = "xyes"; then
AC_MSG_NOTICE([Disabled CAS/CoreCLR security manager (used e.g. for Moonlight)])
fi
if test "x$mono_feature_disable_lldb" = "xyes"; then
AC_DEFINE(DISABLE_LLDB, 1, [Disable support code for the LLDB plugin.])
AC_MSG_NOTICE([Disabled LLDB plugin support code.])
fi
if test "x$mono_feature_disable_sgen_remset" = "xyes"; then
AC_DEFINE(DISABLE_SGEN_REMSET, 1, [Disable wbarrier=remset support in SGEN.])
AC_MSG_NOTICE([Disabled wbarrier=remset support in SGEN.])
@@ -1156,20 +1167,6 @@ AC_COMPILE_IFELSE([
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for deprecated __attribute__)
AC_TRY_COMPILE([
int doit (void) __attribute__ ((deprecated));
int doit (void) { return 0; }
], [
return 0;
], [
have_deprecated=yes
AC_MSG_RESULT(yes)
], [
have_deprecated=no
AC_MSG_RESULT(no)
])
dnl
dnl Boehm GC configuration
dnl
@@ -2288,6 +2285,8 @@ if test x$host_win32 = xno; then
AC_CHECK_FUNCS(system)
AC_CHECK_FUNCS(fork execv execve)
AC_CHECK_FUNCS(accept4)
AC_CHECK_FUNCS(getpid)
AC_CHECK_FUNCS(localtime_r)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_TYPES([blksize_t], [AC_DEFINE(HAVE_BLKSIZE_T)], ,
[#include <sys/types.h>
@@ -2666,12 +2665,6 @@ fi
AC_ARG_ENABLE(bcl-opt, [ --disable-bcl-opt BCL is compiled with no optimizations (allows accurate BCL debugging)], test_bcl_opt=$enableval, test_bcl_opt=yes)
AC_ARG_ENABLE(perf-events, [ --enable-perf-events Enable using `perf` for profiling on Linux], test_perf_events=$enableval, test_perf_events=no)
if test "x$test_perf_events" = "xyes"; then
AC_DEFINE(ENABLE_PERF_EVENTS, 1, [Enable using `perf` for profiling on Linux])
AC_SUBST(ENABLE_PERF_EVENTS)
fi
AC_MSG_CHECKING([if big-arrays are to be enabled])
AC_ARG_ENABLE(big-arrays, [ --enable-big-arrays Enable the allocation and indexing of arrays greater than Int32.MaxValue], enable_big_arrays=$enableval, enable_big_arrays=no)
if test "x$enable_big_arrays" = "xyes" ; then
@@ -2947,6 +2940,8 @@ sizeof_register="SIZEOF_VOID_P"
jit_wanted=true
boehm_supported=true
BTLS_SUPPORTED=no
BTLS_PLATFORM=
case "$host" in
mips*)
TARGET=MIPS;
@@ -2999,9 +2994,14 @@ case "$host" in
;;
linux*)
AOT_SUPPORTED="yes"
BTLS_SUPPORTED=yes
BTLS_PLATFORM=i386
AC_CHECK_HEADER(stdalign.h,[],[BTLS_SUPPORTED=no])
;;
darwin*)
AOT_SUPPORTED="yes"
BTLS_SUPPORTED=yes
BTLS_PLATFORM=i386
;;
openbsd*|freebsd*|kfreebsd-gnu*)
;;
@@ -3017,9 +3017,14 @@ case "$host" in
case $host_os in
linux*)
AOT_SUPPORTED="yes"
BTLS_SUPPORTED=yes
BTLS_PLATFORM=x86_64
AC_CHECK_HEADER(stdalign.h,[],[BTLS_SUPPORTED=no])
;;
darwin*)
AOT_SUPPORTED="yes"
BTLS_SUPPORTED=yes
BTLS_PLATFORM=x86_64
;;
openbsd*|freebsd*|kfreebsd-gnu*)
;;
@@ -3140,6 +3145,7 @@ HOST=$TARGET
if test "x$host" != "x$target"; then
AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
enable_mcs_build=no
BTLS_SUPPORTED=no
case "$target" in
arm*-darwin*)
TARGET=ARM;
@@ -3425,10 +3431,12 @@ if test "x$target_mach" = "xyes"; then
AC_DEFINE(TARGET_WATCHOS,1,[The JIT/AOT targets WatchOS])
CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_WATCHOS"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_WATCHOS"
BTLS_SUPPORTED=no
elif test "x$TARGET" = "xARM" -o "x$TARGET" = "xARM64"; then
AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
BTLS_SUPPORTED=no
else
AC_TRY_COMPILE([#include "TargetConditionals.h"],[
#if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
@@ -3443,6 +3451,7 @@ if test "x$target_mach" = "xyes"; then
AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
BTLS_SUPPORTED=no
])
fi
AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
@@ -3750,6 +3759,45 @@ if test ${TARGET} = unknown; then
AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
fi
if test "x$platform_android" = "xyes"; then
case "x${TARGET}" in
xARM)
case "x$arm_ver" in
xARMv5)
BTLS_SUPPORTED=yes
BTLS_PLATFORM=android-armv5
;;
xARMv6)
BTLS_SUPPORTED=yes
BTLS_PLATFORM=android-armv6
;;
xARMv7)
BTLS_SUPPORTED=yes
BTLS_PLATFORM=android-armv7
;;
*)
BTLS_SUPPORTED=no
;;
esac
;;
xARM64)
BTLS_SUPPORTED=yes
BTLS_PLATFORM=android-v8a
;;
xX86)
BTLS_SUPPORTED=yes
BTLS_PLATFORM=android-x86
;;
xAMD64)
BTLS_SUPPORTED=yes
BTLS_PLATFORM=android-x64
;;
*)
BTLS_SUPPORTED=no
;;
esac
fi
if test ${ACCESS_UNALIGNED} = no; then
CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
fi
@@ -3872,6 +3920,95 @@ else
fi
AC_SUBST(LIBMONO_LA)
dnl **************
dnl *** Btls ***
dnl **************
AC_ARG_ENABLE(btls, [ --disable-blts 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_PATH_PROG(CMAKE, [cmake], [no], [$PATH:/Applications/CMake.app/Contents/bin:/usr/local/bin])
if test "x$CMAKE" = "xno"; then
AC_MSG_ERROR("cmake not found")
fi
BTLS_ROOT=`cd $srcdir && pwd`/external/boringssl
AC_SUBST(BTLS_ROOT)
btls_arch=
btls_cflags=
BTLS_CMAKE_ARGS=
case "$BTLS_PLATFORM" in
i386)
btls_arch=i386
btls_cflags="-m32"
case $host_os in
darwin*)
btls_cflags="$btls_cflags -arch i386"
esac
;;
x86_64)
btls_arch=x86_64
;;
android-armv5)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi\" -DANDROID_NATIVE_API_LEVEL=12"
;;
android-armv6)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi\" -DANDROID_NATIVE_API_LEVEL=12"
;;
android-armv7)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi-v7a\" -DANDROID_NATIVE_API_LEVEL=12"
;;
android-v8a)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"arm64-v8a\" -DANDROID_NATIVE_API_LEVEL=12"
;;
android-x86)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"x86\" -DANDROID_NATIVE_API_LEVEL=12"
;;
android-x64)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"x86_64\" -DANDROID_NATIVE_API_LEVEL=12"
;;
*)
AC_MSG_ERROR(Invalid BTLS platform)
esac
if test "x$platform_android" = "xyes"; then
btls_android=yes
BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=$BTLS_ROOT/util/android-cmake/android.toolchain.cmake"
if test "x$with_btls_android_ndk" != "x"; then
BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DANDROID_NDK=\"$with_btls_android_ndk\""
fi
fi
if test "x$btls_arch" != "x"; then
BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DBTLS_ARCH=\"$btls_arch\""
fi
BTLS_CFLAGS="$CPPFLAGS_FOR_BTLS $btls_cflags"
AC_SUBST(BTLS_ARCH)
AC_SUBST(BTLS_CFLAGS)
AC_SUBST(BTLS_PLATFORM)
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
AM_CONDITIONAL(BTLS_ANDROID, test x$btls_android = xyes)
if test x$DISABLE_MCS_DOCS = xyes; then
docs_dir=""
else
@@ -4108,6 +4245,7 @@ llvm/Makefile
scripts/mono-find-provides
scripts/mono-find-requires
mono/Makefile
mono/btls/Makefile
mono/utils/Makefile
mono/metadata/Makefile
mono/dis/Makefile
@@ -4178,7 +4316,7 @@ po/Makefile
])
# Update all submodules recursively to ensure everything is checked out
$srcdir/scripts/update_submodules
$srcdir/scripts/update_submodules.sh
if test x$host_win32 = xyes; then
# Get rid of 'cyg' prefixes in library names
@@ -4273,12 +4411,28 @@ fi
echo "AOT_BUILD_FLAGS=$AOT_BUILD_FLAGS" >> $srcdir/$mcsdir/build/config.make
fi
if test "x$enable_btls" = "xyes"; then
echo "HAVE_BTLS=1" >> $srcdir/$mcsdir/build/config.make
if test "x$enable_dynamic_btls" = "xyes"; then
echo "HAVE_DYNAMIC_BTLS=1" >> $srcdir/$mcsdir/build/config.make
fi
fi
fi
)
libgdiplus_msg=${libgdiplus_loc:-assumed to be installed}
btls_platform_string=
if test x$enable_btls = xyes; then
if test x$btls_android = xyes; then
btls_platform_string=" (android:$BTLS_PLATFORM)"
else
btls_platform_string=" ($BTLS_PLATFORM)"
fi
fi
echo "
mcs source: $mcsdir
@@ -4304,6 +4458,7 @@ echo "
JNI support: $jdk_headers_found
libgdiplus: $libgdiplus_msg
zlib: $zlib_msg
BTLS: $enable_btls$btls_platform_string
$disabled
"
if test x$with_static_mono = xno -a "x$host_win32" != "xyes"; then
+1
View File
@@ -11,6 +11,7 @@
<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"/>
-3
View File
@@ -74,9 +74,6 @@
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</webRequestModules>
<settings>
<ipv6 enabled="false"/>
</settings>
</system.net>
<system.web>
<httpHandlers>
-3
View File
@@ -118,9 +118,6 @@
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</webRequestModules>
<settings>
<ipv6 enabled="false"/>
</settings>
</system.net>
<system.runtime.remoting>
-3
View File
@@ -135,9 +135,6 @@
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</webRequestModules>
<settings>
<ipv6 enabled="false"/>
</settings>
</system.net>
<system.runtime.remoting>
-3
View File
@@ -138,9 +138,6 @@
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</webRequestModules>
<settings>
<ipv6 enabled="false"/>
</settings>
</system.net>
<system.runtime.remoting>
+21
View File
@@ -35,6 +35,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#include <direct.h>
#ifdef G_OS_WIN32
#include <io.h>
@@ -68,6 +69,26 @@ int mkstemp (char *tmp_template)
return fd;
}
gchar *
g_mkdtemp (char *tmp_template)
{
gunichar2* utf16_template;
utf16_template = u8to16 (tmp_template);
utf16_template = _wmktemp(utf16_template);
if (utf16_template && *utf16_template) {
if (_wmkdir (utf16_template) == 0){
char *ret = u16to8 (utf16_template);
g_free (utf16_template);
return ret;
}
}
g_free (utf16_template);
return NULL;
}
#ifdef _MSC_VER
#pragma warning(disable:4701)
#endif
+6
View File
@@ -887,6 +887,12 @@ gboolean g_file_test (const gchar *filename, GFileTest test);
#define g_ascii_strtod strtod
#define g_ascii_isalnum isalnum
#ifdef WIN32
gchar *g_mkdtemp (gchar *tmpl);
#else
#define g_mkdtemp mkdtemp
#endif
/*
* Pattern matching
*/
Vendored Submodule
+1
Submodule external/boringssl added at c06ac6b33d.
+1 -1
+1 -1
+2
View File
@@ -1,2 +1,4 @@
ltconfig crlf=input
install-sh crlf=input
/BCC_MAKEFILE -crlf
/digimars.mak -crlf
+42 -7
View File
@@ -24,7 +24,8 @@ dependencies referenced, use the "--deps" command line option.
There are two modes of operation, one uses an existing Mono binary or
a server-hosted list of binaries and is enabled when you use either
the
.B --cross
.B --cross,
.B --sdk
or the
.B --runtime
command line options.
@@ -119,10 +120,19 @@ are using (1.0 or 2.0)
When passed, DIR will be set for the MONO_CFG_DIR environment variable
.TP
.I "--cross target"
Creates a bundle for the specified target platform. The target
must be a directory in ~/.mono/targets/ that contains a "mono"
binary. You can fetch various targets using the --fetch-target
command line option.
Use this to request mkbundle generate a cross-compiled binary. It
Creates a bundle for the specified target platform. The target must
be a directory in ~/.mono/targets/ that contains an SDK installation
as produced by the mono-package-runtime tool. You can get a list of
the precompiled versions of the runtime using --list-targets and you
can fetch a specific target using the --fetch-target command line
option.
.Sp
This flag is mutually exclusive with
.I --sdk
which is used to specify an absolute path to resolve the Mono runtime
from and the --runtime option which is used to manually construct the
cross-platform package.
.TP
.I "--deps"
This option will bundle all of the referenced assemblies for the
@@ -159,10 +169,16 @@ flag to bundle all available encodings.
Or you can use a comma delimited list of the workds CJK, MidWest,
Other, Rare and West to specificy which encoding assemblies to distribute.
.TP
.TP
.I "-L path"
Adds the `path' do the search list for assemblies. The rules are the
same as for the compiler -lib: or -L flags.
.TP
.I "--library [LIB,]PATH"
Embeds the dynamic library file pointed to by `PATH' and optionally
give it the name `LIB' into the bundled executable. This is used to
ship native library dependencies that are unpacked at startup and
loaded from the runtime.
.TP
.I "--lists-targets"
Lists all of the available local cross compilation targets available
as precompiled binaries on the Mono distribution server.
@@ -197,7 +213,26 @@ executed.
Additionally, users of your binary can still configure their own
options by setting the
.I MONO_ENV_OPTIONS
environment variable.
environment variable.
.TP
.I "--sdk SDK_PATH"
Use this flag to specify a path from which mkbundle will resolve the
Mono SDK from. The SDK path should be the prefix path that you used
to configure a Mono installation. And would typically contain files
lik
.I SDK_PATH/bin/mono
,
.I SDK_PATH/lib/mono/4.5
and so on.
.Sp
When this flag is specified,
.I mkbundle
will resolve the runtime, the framework libraries, unmanaged resources
and configuration files from the files located in this directory.
.Sp
This flag is mutually exlusive with
.I --cross
.
.TP
.I "--target-server SERVER"
By default the mkbundle tool will download from a Mono server the
+20
View File
@@ -844,6 +844,26 @@ The offsets displayed are IL offsets.
.PP
A more powerful coverage tool is available in the module `monocov'.
See the monocov(1) man page for details.
.SH AOT PROFILING
You can improve startup performance by using the AOT profiler.
.PP
Typically the AOT compiler (\fBmono --aot\fR) will not generate code
for generic instantiations. To solve this, you can run Mono with the
AOT profiler to find out all the generic instantiations that are used,
and then instructing the AOT compiler to produce code for these.
.PP
This command will run the specified app.exe and produce the
\fBout.aotprof\fR file with the data describing the generic
instantiations that are needed:
.nf
$ mono --profile=aot:output=out.aotprof app.exe
.fi
.PP
Once you have this data, you can pass this to Mono's AOT compiler to
instruct it to generate code for it:
.nf
$ mono --aot=profile=out.aotprof
.fi
.SH DEBUGGING AIDS
To debug managed applications, you can use the
.B mdb
+10 -49
View File
@@ -92,7 +92,7 @@ provided by the Mono runtime and write them to a file named
\f[I]output.mlpd\f[].
When no option is specified, it is equivalent to using:
.PP
\f[B]--profile=log:calls,alloc,output=output.mlpd,maxframes=8,calldepth=100\f[]
\f[B]--profile=log:calls,alloc,output=output.mlpd,maxframes=32,calldepth=100\f[]
.PP
The following options can be used to modify this default behaviour.
Each option is separated from the next by a \f[B],\f[] character,
@@ -139,41 +139,16 @@ garbage collections
to the control port
.RE
.IP \[bu] 2
\f[I]sample[=TYPE[/FREQ]]\f[]: collect statistical samples of the
\f[I]sample[=FREQ]\f[]: collect statistical samples of the
program behaviour.
The default is to collect a 100 times per second (100 Hz) the
instruction pointer.
This is equivalent to the value \[lq]cycles/100\[rq].
This is equivalent to the value \[lq]100\[rq].
A value of zero for \f[I]FREQ\f[] effectively disables sampling.
On some systems, like with recent Linux kernels, it is possible to
cause the sampling to happen for other events provided by the
performance counters of the cpu.
In this case, \f[I]TYPE\f[] can be one of:
.RS 2
.IP \[bu] 2
\f[I]cycles\f[]: processor cycles
.IP \[bu] 2
\f[I]instr\f[]: executed instructions
.IP \[bu] 2
\f[I]cacherefs\f[]: cache references
.IP \[bu] 2
\f[I]cachemiss\f[]: cache misses
.IP \[bu] 2
\f[I]branches\f[]: executed branches
.IP \[bu] 2
\f[I]branchmiss\f[]: mispredicted branches
.RE
.IP \[bu] 2
\f[I]time=TIMER\f[]: use the TIMER timestamp mode.
TIMER can have the following values:
.RS 2
.IP \[bu] 2
\f[I]fast\f[]: a usually faster but possibly more inaccurate timer
.RE
.IP \[bu] 2
\f[I]maxframes=NUM\f[]: when a stack trace needs to be performed,
collect \f[I]NUM\f[] frames at the most.
The default is 8.
The default is 32.
.IP \[bu] 2
\f[I]maxsamples=NUM\f[]: stop allocating reusable sample events
once \f[I]NUM\f[] events have been allocated (a value of zero for
@@ -234,16 +209,15 @@ The following commands are available:
\f[I]heapshot\f[]: perform a heapshot as soon as possible
.RE
.IP \[bu] 2
\f[I]counters\f[]: sample counters values every 1 second. This allow
a really lightweight way to have insight in some of the runtime key
metrics. Counters displayed in non verbose mode are : Methods from AOT,
Methods JITted using mono JIT, Methods JITted using LLVM, Total time
spent JITting (sec), User Time, System Time, Total Time, Working Set,
Private Bytes, Virtual Bytes, Page Faults and CPU Load Average (1min,
5min and 15min).
\f[I]nocounters\f[]: disables sampling of runtime and performance
counters, which is normally done every 1 second.
.IP \[bu] 2
\f[I]coverage\f[]: collect code coverage data. This implies enabling
the \f[I]calls\f[] option.
.IP \[bu] 2
\f[I]onlycoverage\f[]: can only be used with \f[I]coverage\f[]. This
disables most other events so that the profiler mostly only collects
coverage data.
.RE
.SS Analyzing the profile data
.PP
@@ -274,10 +248,6 @@ with the \f[I]--maxframes=NUM\f[] option:
The stack trace info will be available if method enter/leave events
have been recorded or if stack trace collection wasn't explicitly
disabled with the \f[I]maxframes=0\f[] profiler option.
Note that the profiler will collect up to 8 frames by default at
specific events when the \f[I]nocalls\f[] option is used, so in
that case, if more stack frames are required in mprof-report, a
bigger value for maxframes when profiling must be used, too.
.PP
The \f[I]--traces\f[] option also controls the reverse reference
feature in the heapshot report: for each class it reports how many
@@ -487,15 +457,6 @@ option: especially if the managed heap is big, since every object
needs to be inspected.
The \f[I]MODE\f[] parameter of the \f[I]heapshot\f[] option can be
used to reduce the frequency of the heap shots.
.IP "\f[I]Reduce the timestamp overhead\f[]" 4
.Sp
On many operating systems or architectures what actually slows down
profiling is the function provided by the system to get timestamp
information.
The \f[I]time=fast\f[] profiler option can be usually used to speed
up this operation, but, depending on the system, time accounting
may have some level of approximation (though statistically the data
should be still fairly valuable).
.SS Dealing with the size of the data files
.PP
When collecting a lot of information about a profiled program, huge
+2
View File
@@ -42,7 +42,9 @@ executable_CLEAN_FILES += $(build_lib) $(build_lib).so $(build_lib).mdb $(build_
makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag
ifndef NO_BUILD
all-local: $(the_lib) $(PROGRAM_config)
endif
install-local: all-local
test-local: all-local
+2 -1
View File
@@ -22,7 +22,7 @@ PROFILE_MCS_FLAGS = \
-d:NET_4_5 \
-d:MONO \
-d:NETSTANDARD \
-d:MOBILE,MOBILE_STATIC,MOBILE_LEGACY \
-d:MOBILE,MOBILE_STATIC,MOBILE_LEGACY,ORBIS \
-d:FULL_AOT_RUNTIME \
-d:DISABLE_REMOTING \
-d:DISABLE_COM \
@@ -39,6 +39,7 @@ NO_INSTALL = yes
MOBILE_STATIC = yes
MOBILE_PROFILE = yes
NO_VTS_TEST = yes
PROFILE_DISABLE_BTLS = yes
# Note need for trailing comma. If you add, keep it
PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS,
@@ -39,3 +39,5 @@ FRAMEWORK_VERSION = 2.1
NO_INSTALL = yes
MOBILE_STATIC = yes
MOBILE_PROFILE = yes
PROFILE_DISABLE_BTLS=1
+2
View File
@@ -1,9 +1,11 @@
include $(topdir)/build/profiles/monotouch.make
PROFILE_MCS_FLAGS += \
-d:FEATURE_NO_BSD_SOCKETS \
-d:MONOTOUCH_WATCH
NO_THREAD_ABORT=1
NO_THREAD_SUSPEND_RESUME=1
NO_MULTIPLE_APPDOMAINS=1
NO_PROCESS_START=1
NO_MONO_SECURITY=1
@@ -1,6 +1,7 @@
include $(topdir)/build/profiles/monotouch_runtime.make
PROFILE_MCS_FLAGS += \
-d:FEATURE_NO_BSD_SOCKETS \
-d:MONOTOUCH_WATCH
NO_THREAD_ABORT=1
@@ -8,3 +9,4 @@ NO_THREAD_SUSPEND_RESUME=1
# The binding generator (bwatch) still needs to execute processes,
# so we need a System.dll that can do that.
#NO_PROCESS_START=1
NO_MONO_SECURITY=1
+2
View File
@@ -35,3 +35,5 @@ NO_TEST = yes
NO_INSTALL = yes
MOBILE_DYNAMIC = yes
MOBILE_PROFILE = yes
PROFILE_DISABLE_BTLS=1
+2
View File
@@ -15,3 +15,5 @@ NO_SYSTEM_DRAWING_DEPENDENCY=1
NO_SYSTEM_SERVICEMODEL_ACTIVATION_DEPENDENCY=1
NO_SYSTEM_DESIGN_DEPENDENCY=1
NO_SYSTEM_DIRECTORY_SERVICES_DEPENDENCY=1
PROFILE_DISABLE_BTLS=1
+5
View File
@@ -196,7 +196,12 @@ AOT_PROFILE_ASSEMBLIES = $(shell $(AOT_PROFILE_ASSEMBLIES_CMD_SAFE))
# This can run in parallel
.PHONY: aot-all-profile
ifdef AOT_BUILD_FLAGS
aot-all-profile: $(patsubst %,$(topdir)/class/lib/$(PROFILE)/%$(PLATFORM_AOT_SUFFIX),$(AOT_PROFILE_ASSEMBLIES))
else
aot-all-profile:
echo AOT_BUILD_FLAGS not set, skipping AOT.
endif
$(topdir)/class/lib/$(PROFILE)/%$(PLATFORM_AOT_SUFFIX): $(topdir)/class/lib/$(PROFILE)/%
@ mkdir -p $(topdir)/class/lib/$(PROFILE)/$*_bitcode_tmp
@@ -1,3 +1,2 @@
TypeForwarders.cs
AssemblyInfo.cs
EventCounter.cs
@@ -44,3 +44,7 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventTask))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventWrittenEventArgs))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.NonEventAttribute))]
#if NETSTANDARD
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventCounter))]
#endif
@@ -1 +0,0 @@
#include embedded_System.Drawing.Primitives.dll.sources
@@ -1,5 +1,2 @@
TypeForwarders.cs
AssemblyInfo.cs
SocketReceiveFromResult.cs
SocketReceiveMessageFromResult.cs
SocketTaskExtensions.cs
@@ -46,4 +46,8 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.UdpClient))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.UdpReceiveResult))]
#if NETSTANDARD
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketReceiveFromResult))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketReceiveMessageFromResult))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketTaskExtensions))]
#endif
@@ -0,0 +1,136 @@
//
// DynamicMethod.cs
//
// Authors:
// Marek Safar ([email protected])
//
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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 FULL_AOT_RUNTIME
namespace System.Reflection.Emit
{
public abstract class DynamicMethod : MethodInfo, ICustomAttributeProvider
{
public DynamicMethod (string name, Type returnType, Type[] parameterTypes)
{
throw new PlatformNotSupportedException ();
}
public DynamicMethod (string name, Type returnType, Type[] parameterTypes, bool restrictedSkipVisibility)
{
throw new PlatformNotSupportedException ();
}
public DynamicMethod (string name, Type returnType, Type[] parameterTypes, Module m)
{
throw new PlatformNotSupportedException ();
}
public DynamicMethod (string name, Type returnType, Type[] parameterTypes, Type owner)
{
throw new PlatformNotSupportedException ();
}
public DynamicMethod (string name, Type returnType, Type[] parameterTypes, Module m, bool skipVisibility)
{
throw new PlatformNotSupportedException ();
}
public DynamicMethod (string name, Type returnType, Type[] parameterTypes, Type owner, bool skipVisibility)
{
throw new PlatformNotSupportedException ();
}
public DynamicMethod (string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Module m, bool skipVisibility)
{
throw new PlatformNotSupportedException ();
}
public DynamicMethod (string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type owner, bool skipVisibility)
{
throw new PlatformNotSupportedException ();
}
public override MethodAttributes Attributes {
get {
throw new PlatformNotSupportedException ();
}
}
public override CallingConventions CallingConvention {
get {
throw new PlatformNotSupportedException ();
}
}
public override Type DeclaringType {
get {
throw new PlatformNotSupportedException ();
}
}
public bool InitLocals { get; set; }
public override MethodImplAttributes MethodImplementationFlags {
get {
throw new PlatformNotSupportedException ();
}
}
public override string Name {
get {
throw new PlatformNotSupportedException ();
}
}
public override ParameterInfo ReturnParameter {
get {
throw new PlatformNotSupportedException ();
}
}
public override Type ReturnType {
get {
throw new PlatformNotSupportedException ();
}
}
public ILGenerator GetILGenerator ()
{
throw new PlatformNotSupportedException ();
}
public ILGenerator GetILGenerator (int streamSize)
{
throw new PlatformNotSupportedException ();
}
public override ParameterInfo[] GetParameters ()
{
throw new PlatformNotSupportedException ();
}
}
}
#endif
@@ -1,3 +1,3 @@
TypeForwarders.cs
AssemblyInfo.cs
DynamicMethod.cs
@@ -20,5 +20,6 @@
// THE SOFTWARE.
//
#if !FULL_AOT_RUNTIME
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.DynamicMethod))]
#endif
+4 -6
View File
@@ -24,7 +24,7 @@ System.Security.Cryptography.Encryption.Aes System.Security.Cryptography.Encrypt
System.Security.Cryptography.Hashing.Algorithms System.Security.Cryptography.RSA System.Security.Cryptography.RandomNumberGenerator \
System.Security.Principal.Windows System.Threading.Thread System.Threading.ThreadPool \
System.Xml.XPath System.Xml.XmlDocument System.Xml.Xsl.Primitives Microsoft.Win32.Registry.AccessControl System.Diagnostics.StackTrace System.Globalization.Extensions \
System.IO.FileSystem.AccessControl System.Reflection.TypeExtensions \
System.IO.FileSystem.AccessControl System.Reflection.TypeExtensions System.Reflection.Emit.Lightweight System.Reflection.Emit.ILGeneration System.Reflection.Emit \
System.Security.SecureString System.Threading.AccessControl System.Threading.Overlapped System.Xml.XPath.XDocument \
System.Security.Cryptography.Primitives System.Text.Encoding.CodePages System.IO.FileSystem.Watcher \
System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.IO.Pipes
@@ -34,8 +34,6 @@ common_DEPS_SUBDIRS = System.Security.Cryptography.X509Certificates System.Servi
drawing_DEPS_SUBDIRS = System.Drawing.Primitives
reflection_PARALLEL_SUBDIRS = System.Reflection.Emit.ILGeneration System.Reflection.Emit.Lightweight System.Reflection.Emit
monotouch_SUBDIRS = $(common_DEPS_SUBDIRS) $(mobile_only_DEPS_SUBDIRS)
monotouch_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS)
@@ -43,10 +41,10 @@ mobile_static_SUBDIRS = $(monotouch_SUBDIRS)
mobile_static_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
net_4_x_SUBDIRS = $(common_DEPS_SUBDIRS) $(drawing_DEPS_SUBDIRS)
net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS)
monodroid_SUBDIRS = $(monotouch_SUBDIRS)
monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
xammac_SUBDIRS = $(monotouch_SUBDIRS)
xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
@@ -54,7 +52,7 @@ xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
xammac_net_4_5_SUBDIRS = $(net_4_x_SUBDIRS)
xammac_net_4_5_PARALLEL_SUBDIRS = $(net_4_x_PARALLEL_SUBDIRS)
monotouch_watch_SUBDIRS = $(monotouch_SUBDIRS) $(drawing_DEPS_SUBDIRS)
monotouch_watch_SUBDIRS = $(monotouch_SUBDIRS)
monotouch_watch_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
monotouch_tv_SUBDIRS = $(monotouch_SUBDIRS)
+13 -15
View File
@@ -51,9 +51,6 @@ mobile_common_dirs := \
System.Xml.Serialization \
Mono.CSharp \
Microsoft.CSharp \
Mono.Security.Providers.DotNet \
Mono.Security.Providers.NewSystemSource \
Mono.Security.Providers.NewTls \
System.Runtime.InteropServices.RuntimeInformation \
System.Reflection.DispatchProxy \
System.Xml.XPath.XmlDocument \
@@ -68,6 +65,12 @@ mobile_static_dirs := \
Mono.Simd \
$(pcl_facade_dirs)
mobile_static_exclude_dirs := \
Microsoft.CSharp \
Mono.CSharp \
Mono.Data.Sqlite \
SMDiagnostics
mobile_dynamic_dirs := \
$(mobile_common_dirs) \
Mono.CompilerServices.SymbolWriter \
@@ -77,12 +80,13 @@ xammac_dirs := \
$(mobile_dynamic_dirs)
monodroid_dirs := \
$(mobile_dynamic_dirs)
$(mobile_dynamic_dirs) \
Mono.Btls.Interface
monotouch_dirs := \
$(mobile_static_dirs)
monotouch_watch_dirs := $(monotouch_dirs)
monotouch_watch_dirs := $(filter-out Mono.Security Mono.Data.Tds,$(monotouch_dirs))
monotouch_tv_dirs := $(monotouch_dirs)
monotouch_runtime_dirs := \
@@ -93,7 +97,7 @@ monotouch_runtime_dirs := \
System.XML \
Mono.CSharp
monotouch_watch_runtime_dirs := $(monotouch_runtime_dirs)
monotouch_watch_runtime_dirs := $(filter-out Mono.Security Mono.Data.Tds,$(monotouch_runtime_dirs))
monotouch_tv_runtime_dirs := $(monotouch_runtime_dirs)
xammac_4_5_dirs := \
@@ -108,6 +112,7 @@ xammac_4_5_dirs := \
System.ServiceModel.Internals \
SMDiagnostics \
System.Numerics \
System.Numerics.Vectors \
Mono.Data.Tds \
System.Transactions \
System.EnterpriseServices \
@@ -139,10 +144,6 @@ xammac_4_5_dirs := \
System.Data.Linq \
System.Net.Http \
System.Net.Http.WebRequest \
Mono.Security.Providers.DotNet \
Mono.Security.Providers.OldTls \
Mono.Security.Providers.NewSystemSource \
Mono.Security.Providers.NewTls \
System.Runtime.InteropServices.RuntimeInformation \
System.Reflection.Context \
System.Net.Http.WinHttpHandler \
@@ -231,8 +232,6 @@ net_4_x_dirs := \
System.Web.Http \
System.Web.Http.SelfHost \
System.Web.Http.WebHost \
Mono.Security.Providers.NewSystemSource \
Mono.Security.Providers.NewTls \
System.Runtime.InteropServices.RuntimeInformation
# These are the subdirs which depends on libs in net_4_x_dirs
@@ -240,6 +239,7 @@ net_4_x_dirs := \
net_4_x_parallel_dirs := \
PEAPI \
I18N \
Mono.Btls.Interface \
Mono.Http \
Mono.Cairo \
Mono.Cecil \
@@ -276,8 +276,6 @@ net_4_x_parallel_dirs := \
System.ComponentModel.Composition.4.5 \
System.Windows \
System.Xml.Serialization \
Mono.Security.Providers.DotNet \
Mono.Security.Providers.OldTls \
System.DirectoryServices.Protocols \
RabbitMQ.Client \
Microsoft.VisualC \
@@ -311,7 +309,7 @@ monotouch_tv_SUBDIRS := $(monotouch_tv_dirs)
monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs)
monotouch_watch_runtime_SUBDIRS := $(monotouch_watch_runtime_dirs)
monotouch_tv_runtime_SUBDIRS := $(monotouch_tv_runtime_dirs)
mobile_static_SUBDIRS := $(mobile_static_dirs)
mobile_static_SUBDIRS := $(filter-out $(mobile_static_exclude_dirs),$(mobile_static_dirs))
mobile_SUBDIRS := $(mobile_dynamic_dirs)
xammac_SUBDIRS := $(xammac_dirs)
xammac_net_4_5_SUBDIRS := $(xammac_4_5_dirs)
@@ -226,6 +226,14 @@ namespace Microsoft.Build.BuildEngine {
public void SetMetadata (string metadataName,
string metadataValue,
bool treatMetadataValueAsLiteral)
{
SetMetadata (metadataName, metadataValue, treatMetadataValueAsLiteral, false);
}
void SetMetadata (string metadataName,
string metadataValue,
bool treatMetadataValueAsLiteral,
bool fromDynamicItem)
{
if (metadataName == null)
throw new ArgumentNullException ("metadataName");
@@ -251,9 +259,11 @@ namespace Microsoft.Build.BuildEngine {
} else if (HasParentItem) {
if (parent_item.child_items.Count > 1)
SplitParentItem ();
parent_item.SetMetadata (metadataName, metadataValue, treatMetadataValueAsLiteral);
parent_item.SetMetadata (metadataName, metadataValue, treatMetadataValueAsLiteral, fromDynamicItem);
}
if (FromXml || HasParentItem) {
// We don't want to reevalute the project for dynamic items
if (!fromDynamicItem && !IsDynamic && (FromXml || HasParentItem)) {
parent_item_group.ParentProject.MarkProjectAsDirty ();
parent_item_group.ParentProject.NeedToReevaluate ();
}
@@ -374,7 +384,7 @@ namespace Microsoft.Build.BuildEngine {
continue;
foreach (string name in evaluatedMetadata.Keys) {
item.SetMetadata (name, (string)evaluatedMetadata [name]);
item.SetMetadata (name, (string)evaluatedMetadata [name], false, IsDynamic);
}
AddAndRemoveMetadata (project, item);
@@ -374,10 +374,8 @@ namespace Microsoft.Build.BuildEngine {
return false;
ITaskItem[] outputs;
if (ParentEngine.BuiltTargetsOutputByName.TryGetValue (key, out outputs)) {
if (targetOutputs != null)
targetOutputs.Add (target_name, outputs);
}
if (targetOutputs != null && ParentEngine.BuiltTargetsOutputByName.TryGetValue (key, out outputs))
targetOutputs [target_name] = outputs;
return true;
}
@@ -284,6 +284,51 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
t [0].RemoveTask (null);
}
[Test]
public void TestRunTargetTwice ()
{
string documentString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<Target Name=""Foo"">
<Message Text=""Foo ran""/>
</Target>
<Target Name=""Main"">
<MSBuild Projects=""$(MSBuildProjectFile)"" Targets=""Foo;Foo"" />
</Target>
</Project>";
var filepath = Path.GetTempFileName ();
try {
File.WriteAllText (filepath, documentString);
var engine = new Engine (Consts.BinPath);
var project = engine.CreateNewProject ();
project.Load (filepath);
var logger = new TestMessageLogger ();
engine.RegisterLogger (logger);
var result = project.Build ("Main");
if (!result) {
logger.DumpMessages ();
Assert.Fail ("Build failed, see the logs");
}
Assert.AreEqual(1, logger.NormalMessageCount, "Expected number of messages");
logger.CheckLoggedMessageHead ("Foo ran", "A1");
Assert.AreEqual(0, logger.NormalMessageCount, "Extra messages found");
Assert.AreEqual(0, logger.WarningMessageCount, "Extra warning messages found");
Assert.AreEqual(2, logger.TargetStarted, "TargetStarted count");
Assert.AreEqual(2, logger.TargetFinished, "TargetFinished count");
Assert.IsTrue (result);
} finally {
File.Delete (filepath);
}
}
[Test]
public void TestTargetOutputs1 ()
{
@@ -697,6 +742,33 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
</Project>", "D");
}
[Test]
public void ItemGroupInsideTarget_UpdateMetadata ()
{
ItemGroupInsideTarget (
@"<Project ToolsVersion=""4.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<ItemGroup>
<ProjectReference Include='xyz'/>
</ItemGroup>
<Target Name='Main' DependsOnTargets='CreateBar'>
<Message Text='Before: $(Bar)'/>
<ItemGroup>
<ProjectReference>
<AdditionalProperties>A=b</AdditionalProperties>
</ProjectReference>
</ItemGroup>
<Message Text='After: $(Bar)'/>
</Target>
<Target Name='CreateBar'>
<PropertyGroup>
<Bar>Bar01</Bar>
</PropertyGroup>
</Target>
</Project>", 2, "Before: Bar01", "After: Bar01");
}
[Test]
public void ItemGroupInsideTarget_Batching ()
{
@@ -153,7 +153,10 @@ namespace Microsoft.Build.Tasks {
{
if (!string.IsNullOrEmpty (ToolPath))
return Path.Combine (ToolPath, ToolExe);
return ToolLocationHelper.GetPathToDotNetFrameworkFile (ToolExe, TargetDotNetFrameworkVersion.VersionLatest);
var possibleToolPath = ToolLocationHelper.GetPathToDotNetFrameworkFile (ToolExe, TargetDotNetFrameworkVersion.VersionLatest);
if (!string.IsNullOrEmpty(possibleToolPath))
return possibleToolPath;
return ToolLocationHelper.GetPathToDotNetFrameworkBinFile(ToolExe);
}
[MonoTODO]
@@ -1,11 +1,18 @@
thisdir = class/Mono.Security.Providers.OldTls
thisdir = class/Mono.Btls.Interface
SUBDIRS =
include ../../build/rules.make
LIBRARY = Mono.Security.Providers.OldTls.dll
LIBRARY = Mono.Btls.Interface.dll
LIB_REFS = System Mono.Security
LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY_DEP
ifndef HAVE_BTLS
NO_INSTALL = yes
NO_SIGN_ASSEMBLY = yes
NO_TEST = yes
NO_BUILD = yes
endif
include ../../build/library.make
$(the_lib): ../Mono.Security/Makefile
@@ -0,0 +1,22 @@
./Properties/AssemblyInfo.cs
../../build/common/Consts.cs
../../build/common/Locale.cs
../../build/common/MonoTODOAttribute.cs
Mono.Btls.Interface/BtlsObject.cs
Mono.Btls.Interface/BtlsProvider.cs
Mono.Btls.Interface/BtlsX509.cs
Mono.Btls.Interface/BtlsX509Chain.cs
Mono.Btls.Interface/BtlsX509Error.cs
Mono.Btls.Interface/BtlsX509Format.cs
Mono.Btls.Interface/BtlsX509Lookup.cs
Mono.Btls.Interface/BtlsX509Name.cs
Mono.Btls.Interface/BtlsX509Purpose.cs
Mono.Btls.Interface/BtlsX509Store.cs
Mono.Btls.Interface/BtlsX509StoreCtx.cs
Mono.Btls.Interface/BtlsX509StoreManager.cs
Mono.Btls.Interface/BtlsX509StoreType.cs
Mono.Btls.Interface/BtlsX509TrustKind.cs
Mono.Btls.Interface/BtlsX509VerifyFlags.cs
Mono.Btls.Interface/BtlsX509VerifyParam.cs
Mono.Btls.Interface/VersionInfo.cs
@@ -1,10 +1,10 @@
//
// ITlsContext.cs
// BtlsObject.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015-2016 Xamarin, Inc.
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -23,48 +23,51 @@
// 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.
extern alias NewSystemSource;
using System;
using System.Security.Cryptography;
using Mono.Security.Interface;
using MX = Mono.Security.X509;
namespace Mono.Security.Providers.NewTls
namespace Mono.Btls.Interface
{
interface ITlsContext : IDisposable
public abstract class BtlsObject : IDisposable
{
bool IsValid {
get;
MonoBtlsObject instance;
internal MonoBtlsObject Instance {
get {
if (!IsValid)
throw new ObjectDisposedException (GetType ().Name);
return instance;
}
}
TlsException LastError {
get;
internal BtlsObject (MonoBtlsObject instance)
{
this.instance = instance;
}
bool ReceivedCloseNotify {
get;
public bool IsValid {
get { return instance != null && instance.IsValid; }
}
MonoTlsConnectionInfo ConnectionInfo {
get;
protected void Dispose (bool disposing)
{
if (disposing) {
if (instance != null) {
instance.Dispose ();
instance = null;
}
}
}
MX.X509Certificate GetRemoteCertificate (out MX.X509CertificateCollection remoteCertificateStore);
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
bool VerifyRemoteCertificate ();
int GenerateNextToken (TlsBuffer incoming, TlsMultiBuffer outgoing);
int DecryptMessage (ref TlsBuffer incoming);
int EncryptMessage (ref TlsBuffer incoming);
byte[] CreateAlert (Alert alert);
byte[] CreateHelloRequest ();
~BtlsObject ()
{
Dispose (false);
}
}
}
@@ -0,0 +1,107 @@
//
// BtlsProvider.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
using Mono.Security.Interface;
using System.Security.Cryptography.X509Certificates;
using MNS = Mono.Net.Security;
namespace Mono.Btls.Interface
{
public static class BtlsProvider
{
public static bool IsSupported ()
{
return MNS.MonoTlsProviderFactory.IsBtlsSupported ();
}
public static MonoTlsProvider GetProvider ()
{
return new MonoBtlsProvider ();
}
public static BtlsX509 CreateNative (byte[] data, BtlsX509Format format)
{
var x509 = MonoBtlsX509.LoadFromData (data, (MonoBtlsX509Format)format);
return new BtlsX509 (x509);
}
public static X509Certificate CreateCertificate (byte[] data, BtlsX509Format format, bool disallowFallback = false)
{
return MonoBtlsProvider.CreateCertificate (data, (MonoBtlsX509Format)format, disallowFallback);
}
public static X509Certificate2 CreateCertificate2 (byte[] data, BtlsX509Format format, bool disallowFallback = false)
{
return MonoBtlsProvider.CreateCertificate2 (data, (MonoBtlsX509Format)format, disallowFallback);
}
public static X509Certificate2 CreateCertificate2 (byte[] data, string password, bool disallowFallback = false)
{
return MonoBtlsProvider.CreateCertificate2 (data, password, disallowFallback);
}
public static BtlsX509Chain CreateNativeChain ()
{
return new BtlsX509Chain (new MonoBtlsX509Chain ());
}
public static BtlsX509Store CreateNativeStore ()
{
return new BtlsX509Store (new MonoBtlsX509Store ());
}
public static BtlsX509StoreCtx CreateNativeStoreCtx ()
{
return new BtlsX509StoreCtx (new MonoBtlsX509StoreCtx ());
}
public static X509Chain CreateChain ()
{
return MonoBtlsProvider.CreateChain ();
}
public static string GetSystemStoreLocation ()
{
return MonoBtlsProvider.GetSystemStoreLocation ();
}
public static BtlsX509VerifyParam GetVerifyParam_SslClient ()
{
return new BtlsX509VerifyParam (MonoBtlsX509VerifyParam.GetSslClient ());
}
public static BtlsX509VerifyParam GetVerifyParam_SslServer ()
{
return new BtlsX509VerifyParam (MonoBtlsX509VerifyParam.GetSslServer ());
}
public static X509Chain GetManagedChain (BtlsX509Chain chain)
{
return MonoBtlsProvider.GetManagedChain (chain.Instance);
}
}
}
@@ -0,0 +1,132 @@
//
// BtlsX509.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
using System.IO;
using System.Security.Cryptography;
namespace Mono.Btls.Interface
{
public class BtlsX509 : BtlsObject
{
new internal MonoBtlsX509 Instance {
get { return (MonoBtlsX509)base.Instance; }
}
internal BtlsX509 (MonoBtlsX509 x509)
: base (x509)
{
}
public BtlsX509Name GetSubjectName ()
{
return new BtlsX509Name (Instance.GetSubjectName ());
}
public BtlsX509Name GetIssuerName ()
{
return new BtlsX509Name (Instance.GetIssuerName ());
}
public string GetSubjectNameString ()
{
return Instance.GetSubjectNameString ();
}
public string GetIssuerNameString ()
{
return Instance.GetIssuerNameString ();
}
public byte[] GetRawData (BtlsX509Format format)
{
return Instance.GetRawData ((MonoBtlsX509Format)format);
}
public byte[] GetCertHash ()
{
return Instance.GetCertHash ();
}
public DateTime GetNotBefore ()
{
return Instance.GetNotBefore ();
}
public DateTime GetNotAfter ()
{
return Instance.GetNotAfter ();
}
public byte[] GetPublicKeyData ()
{
return Instance.GetPublicKeyData ();
}
public byte[] GetSerialNumber (bool mono_style)
{
return Instance.GetSerialNumber (mono_style);
}
public int GetVersion ()
{
return Instance.GetVersion ();
}
public Oid GetSignatureAlgorithm ()
{
return Instance.GetSignatureAlgorithm ();
}
public AsnEncodedData GetPublicKeyAsn1 ()
{
return Instance.GetPublicKeyAsn1 ();
}
public AsnEncodedData GetPublicKeyParameters ()
{
return Instance.GetPublicKeyParameters ();
}
public long GetSubjectNameHash ()
{
using (var name = GetSubjectName ())
return name.GetHash ();
}
public void Print (Stream stream)
{
using (var bio = MonoBtlsBio.CreateMonoStream (stream))
Instance.Print (bio);
}
public void ExportAsPEM (Stream stream, bool includeHumanReadableForm)
{
using (var bio = MonoBtlsBio.CreateMonoStream (stream))
Instance.ExportAsPEM (bio, includeHumanReadableForm);
}
}
}
@@ -0,0 +1,58 @@
//
// BtlsX509Chain.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
namespace Mono.Btls.Interface
{
public class BtlsX509Chain : BtlsObject
{
new internal MonoBtlsX509Chain Instance {
get { return (MonoBtlsX509Chain)base.Instance; }
}
internal BtlsX509Chain (MonoBtlsX509Chain chain)
: base (chain)
{
}
public int Count {
get { return Instance.Count; }
}
public BtlsX509 this[int index] {
get {
var x509 = Instance.GetCertificate (index);
return new BtlsX509 (x509.Copy ());
}
}
public void Add (BtlsX509 x509)
{
Instance.AddCertificate (x509.Instance);
}
}
}
@@ -0,0 +1,110 @@
//
// BtlsX509Error.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
namespace Mono.Btls.Interface
{
// Keep in sync with NativeBoringX509Error
public enum BtlsX509Error
{
OK = 0,
/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */
UNABLE_TO_GET_ISSUER_CERT = 2,
UNABLE_TO_GET_CRL = 3,
UNABLE_TO_DECRYPT_CERT_SIGNATURE = 4,
UNABLE_TO_DECRYPT_CRL_SIGNATURE = 5,
UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY = 6,
CERT_SIGNATURE_FAILURE = 7,
CRL_SIGNATURE_FAILURE = 8,
CERT_NOT_YET_VALID = 9,
CERT_HAS_EXPIRED = 10,
CRL_NOT_YET_VALID = 11,
CRL_HAS_EXPIRED = 12,
ERROR_IN_CERT_NOT_BEFORE_FIELD = 13,
ERROR_IN_CERT_NOT_AFTER_FIELD = 14,
ERROR_IN_CRL_LAST_UPDATE_FIELD = 15,
ERROR_IN_CRL_NEXT_UPDATE_FIELD = 16,
OUT_OF_MEM = 17,
DEPTH_ZERO_SELF_SIGNED_CERT = 18,
SELF_SIGNED_CERT_IN_CHAIN = 19,
UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 20,
UNABLE_TO_VERIFY_LEAF_SIGNATURE = 21,
CERT_CHAIN_TOO_LONG = 22,
CERT_REVOKED = 23,
INVALID_CA = 24,
PATH_LENGTH_EXCEEDED = 25,
INVALID_PURPOSE = 26,
CERT_UNTRUSTED = 27,
CERT_REJECTED = 28,
/* These are 'informational' when looking for issuer cert */
SUBJECT_ISSUER_MISMATCH = 29,
AKID_SKID_MISMATCH = 30,
AKID_ISSUER_SERIAL_MISMATCH = 31,
KEYUSAGE_NO_CERTSIGN = 32,
UNABLE_TO_GET_CRL_ISSUER = 33,
UNHANDLED_CRITICAL_EXTENSION = 34,
KEYUSAGE_NO_CRL_SIGN = 35,
UNHANDLED_CRITICAL_CRL_EXTENSION = 36,
INVALID_NON_CA = 37,
PROXY_PATH_LENGTH_EXCEEDED = 38,
KEYUSAGE_NO_DIGITAL_SIGNATURE = 39,
PROXY_CERTIFICATES_NOT_ALLOWED = 40,
INVALID_EXTENSION = 41,
INVALID_POLICY_EXTENSION = 42,
NO_EXPLICIT_POLICY = 43,
DIFFERENT_CRL_SCOPE = 44,
UNSUPPORTED_EXTENSION_FEATURE = 45,
UNNESTED_RESOURCE = 46,
PERMITTED_VIOLATION = 47,
EXCLUDED_VIOLATION = 48,
SUBTREE_MINMAX = 49,
UNSUPPORTED_CONSTRAINT_TYPE = 51,
UNSUPPORTED_CONSTRAINT_SYNTAX = 52,
UNSUPPORTED_NAME_SYNTAX = 53,
CRL_PATH_VALIDATION_ERROR = 54,
/* Suite B mode algorithm violation */
SUITE_B_INVALID_VERSION = 56,
SUITE_B_INVALID_ALGORITHM = 57,
SUITE_B_INVALID_CURVE = 58,
SUITE_B_INVALID_SIGNATURE_ALGORITHM = 59,
SUITE_B_LOS_NOT_ALLOWED = 60,
SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 = 61,
/* Host, email and IP check errors */
HOSTNAME_MISMATCH = 62,
EMAIL_MISMATCH = 63,
IP_ADDRESS_MISMATCH = 64,
/* The application is not happy */
APPLICATION_VERIFICATION = 50
}
}
@@ -0,0 +1,37 @@
//
// BtlsX509Format.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
namespace Mono.Btls.Interface
{
// Keep in sync with NativeBoringX509Format
public enum BtlsX509Format
{
DER = 1,
PEM = 2
}
}
@@ -1,10 +1,10 @@
//
// IMonoTlsContext.cs
// BtlsX509Lookup.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -24,48 +24,49 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Interface
namespace Mono.Btls.Interface
{
interface IMonoTlsContext : IDisposable
public class BtlsX509Lookup : BtlsObject
{
bool IsServer {
get;
new internal MonoBtlsX509Lookup Instance {
get { return (MonoBtlsX509Lookup)base.Instance; }
}
bool IsValid {
get;
internal BtlsX509Lookup (MonoBtlsX509Lookup lookup)
: base (lookup)
{
}
void Initialize (IMonoTlsEventSink eventSink);
bool HasCredentials {
get;
public void Initialize ()
{
Instance.Initialize ();
}
void SetCertificate (X509Certificate certificate, AsymmetricAlgorithm privateKey);
int GenerateNextToken (IBufferOffsetSize incoming, out IBufferOffsetSize outgoing);
int EncryptMessage (ref IBufferOffsetSize incoming);
int DecryptMessage (ref IBufferOffsetSize incoming);
bool ReceivedCloseNotify {
get;
public void Shutdown ()
{
Instance.Shutdown ();
}
byte[] CreateCloseNotify ();
public BtlsX509 LookupBySubject (BtlsX509Name name)
{
var x509 = Instance.LookupBySubject (name.Instance);
if (x509 == null)
return null;
byte[] CreateHelloRequest ();
return new BtlsX509 (x509);
}
X509Certificate GetRemoteCertificate (out X509CertificateCollection remoteCertificateStore);
public void LoadFile (string file, BtlsX509Format type)
{
Instance.LoadFile (file, (MonoBtlsX509FileType)type);
}
bool VerifyRemoteCertificate ();
MonoTlsConnectionInfo GetConnectionInfo ();
public void AddDirectory (string dir, BtlsX509Format type)
{
Instance.AddDirectory (dir, (MonoBtlsX509FileType)type);
}
}
}
@@ -0,0 +1,62 @@
//
// BtlsX509Name.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
namespace Mono.Btls.Interface
{
public class BtlsX509Name : BtlsObject
{
new internal MonoBtlsX509Name Instance {
get { return (MonoBtlsX509Name)base.Instance; }
}
internal BtlsX509Name (MonoBtlsX509Name name)
: base (name)
{
}
public string GetString ()
{
return Instance.GetString ();
}
public byte[] GetRawData (bool use_canon_enc)
{
return Instance.GetRawData (use_canon_enc);
}
public long GetHash ()
{
return Instance.GetHash ();
}
public long GetHashOld ()
{
return Instance.GetHashOld ();
}
}
}
@@ -0,0 +1,43 @@
//
// BtlsX509Purpose.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
namespace Mono.Btls.Interface
{
// Keep in sync with NativeBoringX509Purpose
public enum BtlsX509Purpose
{
SSL_CLIENT = 1,
SSL_SERVER = 2,
NS_SSL_SERVER = 3,
SMIME_SIGN = 4,
SMIME_ENCRYPT = 5,
CRL_SIGN = 6,
ANY = 7,
OCSP_HELPER = 8,
TIMESTAMP_SIGN = 9,
}
}
@@ -0,0 +1,91 @@
//
// BtlsX509Store.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
using System.Security.Cryptography.X509Certificates;
namespace Mono.Btls.Interface
{
public class BtlsX509Store : BtlsObject
{
new internal MonoBtlsX509Store Instance {
get { return (MonoBtlsX509Store)base.Instance; }
}
internal BtlsX509Store (MonoBtlsX509Store store)
: base (store)
{
}
public void LoadLocations (string file, string path)
{
Instance.LoadLocations (file, path);
}
public void AddTrustedRoots ()
{
Instance.AddTrustedRoots ();
}
public void AddCertificate (BtlsX509 x509)
{
Instance.AddCertificate (x509.Instance);
}
public int GetCount ()
{
return Instance.GetCount ();
}
public void AddLookup (X509CertificateCollection certificates, BtlsX509TrustKind trust)
{
Instance.AddCollection (certificates, (MonoBtlsX509TrustKind)trust);
}
static MonoBtlsX509FileType GetFileType (BtlsX509Format format)
{
switch (format) {
case BtlsX509Format.DER:
return MonoBtlsX509FileType.ASN1;
case BtlsX509Format.PEM:
return MonoBtlsX509FileType.PEM;
default:
throw new NotSupportedException ();
}
}
public void AddDirectoryLookup (string dir, BtlsX509Format format)
{
Instance.AddDirectoryLookup (dir, GetFileType (format));
}
public void AddFileLookup (string file, BtlsX509Format format)
{
Instance.AddFileLookup (file, GetFileType (format));
}
}
}
@@ -0,0 +1,71 @@
//
// BtlsX509StoreCtx.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
namespace Mono.Btls.Interface
{
public class BtlsX509StoreCtx : BtlsObject
{
new internal MonoBtlsX509StoreCtx Instance {
get { return (MonoBtlsX509StoreCtx)base.Instance; }
}
internal BtlsX509StoreCtx (MonoBtlsX509StoreCtx ctx)
: base (ctx)
{
}
public void Initialize (BtlsX509Store store, BtlsX509Chain chain)
{
Instance.Initialize (store.Instance, chain.Instance);
}
public void SetVerifyParam (BtlsX509VerifyParam param)
{
Instance.SetVerifyParam (param.Instance);
}
public int Verify ()
{
return Instance.Verify ();
}
public BtlsX509Error GetError ()
{
return (BtlsX509Error)Instance.GetError ();
}
public Exception GetException ()
{
return Instance.GetException ();
}
public BtlsX509Chain GetChain ()
{
return new BtlsX509Chain (Instance.GetChain ());
}
}
}
@@ -0,0 +1,44 @@
//
// BtlsX509StoreManager.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
using System.IO;
using System.Security.Cryptography;
namespace Mono.Btls.Interface
{
public static class BtlsX509StoreManager
{
public static bool HasStore (BtlsX509StoreType type)
{
return MonoBtlsX509StoreManager.HasStore ((MonoBtlsX509StoreType)type);
}
public static string GetStorePath (BtlsX509StoreType type)
{
return MonoBtlsX509StoreManager.GetStorePath ((MonoBtlsX509StoreType)type);
}
}
}
@@ -1,10 +1,10 @@
//
// ITlsContext.cs
// BtlsX509StoreType.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015-2016 Xamarin, Inc.
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -23,25 +23,21 @@
// 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.
using System;
using System.IO;
using System.Security.Cryptography;
using Mono.Security.Interface;
using MX = Mono.Security.X509;
namespace Mono.Security.Providers.NewTls
namespace Mono.Btls.Interface
{
interface ITlsConfiguration
// Keep in sync with MonoBtlsX509StoreType
public enum BtlsX509StoreType
{
bool HasCredentials {
get;
}
void SetCertificate (MX.X509Certificate certificate, AsymmetricAlgorithm privateKey);
bool? AskForClientCertificate {
get; set;
}
Custom,
MachineTrustedRoots,
MachineIntermediateCA,
MachineUntrusted,
UserTrustedRoots,
UserIntermediateCA,
UserUntrusted
}
}
@@ -0,0 +1,42 @@
//
// BtlsX509TrustKind.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
namespace Mono.Btls.Interface
{
// Keep in sync with MonoBtlsX509TrustKind
[Flags]
public enum BtlsX509TrustKind
{
DEFAULT = 0,
TRUST_CLIENT = 1,
TRUST_SERVER = 2,
TRUST_ALL = 4,
REJECT_CLIENT = 32,
REJECT_SERVER = 64,
REJECT_ALL = 128
}
}
@@ -0,0 +1,38 @@
//
// BtlsX509VerifyFlags.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
namespace Mono.Btls.Interface
{
// Keep in sync with NativeBoringX509VerifyFlags
public enum BtlsX509VerifyFlags
{
DEFAULT = 0,
CRL_CHECK = 1,
CRL_CHECK_ALL = 2,
X509_STRIC = 4
}
}
@@ -0,0 +1,91 @@
//
// BtlsX509VerifyParam.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
namespace Mono.Btls.Interface
{
public class BtlsX509VerifyParam : BtlsObject
{
new internal MonoBtlsX509VerifyParam Instance {
get { return (MonoBtlsX509VerifyParam)base.Instance; }
}
internal BtlsX509VerifyParam (MonoBtlsX509VerifyParam param)
: base (param)
{
}
public BtlsX509VerifyParam Copy ()
{
return new BtlsX509VerifyParam (Instance.Copy ());
}
public void SetName (string name)
{
Instance.SetName (name);
}
public void SetHost (string name)
{
Instance.SetHost (name);
}
public void AddHost (string name)
{
Instance.AddHost (name);
}
public BtlsX509VerifyFlags GetFlags ()
{
return (BtlsX509VerifyFlags)Instance.GetFlags ();
}
public void SetFlags (BtlsX509VerifyFlags flags)
{
Instance.SetFlags ((ulong)flags);
}
public void SetPurpose (BtlsX509Purpose purpose)
{
Instance.SetPurpose ((MonoBtlsX509Purpose)purpose);
}
public int GetDepth ()
{
return Instance.GetDepth ();
}
public void SetDepth (int depth)
{
Instance.SetDepth (depth);
}
public void SetTime (DateTime time)
{
Instance.SetTime (time);
}
}
}
@@ -0,0 +1,34 @@
//
// VersionInfo.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
namespace Mono.Btls.Interface
{
public static class VersionInfo
{
public const string Version = "1.0.0";
}
}
@@ -1,10 +1,11 @@
//
//
// AssemblyInfo.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -36,10 +37,10 @@ using System.Runtime.InteropServices;
[assembly: AssemblyVersion (Consts.FxVersion)]
[assembly: AssemblyCompany ("MONO development team")]
[assembly: AssemblyCopyright ("(c) 2015 Xamarin")]
[assembly: AssemblyDescription ("Mono.Security.Providers.DotNet.dll")]
[assembly: AssemblyCopyright ("(c) 2016 Xamarin")]
[assembly: AssemblyDescription ("Mono.Btls.Interface")]
[assembly: AssemblyProduct ("MONO CLI")]
[assembly: AssemblyTitle ("Mono.Security.Providers.DotNet.dll")]
[assembly: AssemblyTitle ("Mono.Btls.Interface")]
[assembly: CLSCompliant (true)]
[assembly: ComVisible (false)]
[assembly: NeutralResourcesLanguage ("en-US")]
+9
View File
@@ -0,0 +1,9 @@
Mono.Btls.Interface
===================
The purpose of this assembly is to allow test suites such as xamarin/web-tests
(https://github.com/xamarin/web-tests/tree/stable) to test parts of BTLS without
making System.dll internals visible.
It should not be considered a stable and maintained API for third parties.
@@ -1,13 +1,4 @@
#include Mono.CSharp.dll.sources
../corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
../corlib/System.Reflection.Emit/FlowControl.cs
../corlib/System.Reflection.Emit/OpCode.cs
../corlib/System.Reflection.Emit/OpCodeNames.cs
../corlib/System.Reflection.Emit/OpCodes.cs
../corlib/System.Reflection.Emit/OpCodeType.cs
../corlib/System.Reflection.Emit/OperandType.cs
../corlib/System.Reflection.Emit/PEFileKinds.cs
../corlib/System.Reflection.Emit/Label.cs
../corlib/System.Reflection.Emit/MethodToken.cs
../corlib/System.Reflection.Emit/StackBehaviour.cs
monotouch.cs
-304
View File
@@ -28,66 +28,6 @@
namespace System.Reflection.Emit
{
public class ILGenerator
{
public void BeginCatchBlock (Type exceptionType)
{
throw new NotSupportedException ();
}
public Label BeginExceptionBlock ()
{
throw new NotSupportedException ();
}
public void BeginExceptFilterBlock ()
{
throw new NotSupportedException ();
}
public void BeginFinallyBlock ()
{
throw new NotSupportedException ();
}
public LocalBuilder DeclareLocal (params object[] args)
{
throw new NotSupportedException ();
}
public Label DefineLabel ()
{
throw new NotSupportedException ();
}
public void Emit (OpCode opcode)
{
throw new NotSupportedException ();
}
public void Emit (OpCode opcode, object args)
{
throw new NotSupportedException ();
}
public void EmitCall (OpCode opcode, params object[] args)
{
throw new NotSupportedException ();
}
public void EndExceptionBlock ()
{
throw new NotSupportedException ();
}
public void MarkLabel (Label loc)
{
throw new NotSupportedException ();
}
public int ILOffset { get; set; }
}
public class TypeBuilder : Type
{
#region implemented abstract members of MemberInfo
@@ -528,230 +468,6 @@ namespace System.Reflection.Emit
}
}
public class LocalBuilder : LocalVariableInfo
{
}
public class GenericTypeParameterBuilder : Type
{
#region implemented abstract members of MemberInfo
public override bool IsDefined (Type attributeType, bool inherit)
{
throw new NotSupportedException ();
}
public override object[] GetCustomAttributes (bool inherit)
{
throw new NotSupportedException ();
}
public override object[] GetCustomAttributes (Type attributeType, bool inherit)
{
throw new NotSupportedException ();
}
public override string Name {
get {
throw new NotSupportedException ();
}
}
#endregion
#region implemented abstract members of Type
public override Type GetInterface (string name, bool ignoreCase)
{
throw new NotSupportedException ();
}
public override Type[] GetInterfaces ()
{
throw new NotSupportedException ();
}
public override Type GetElementType ()
{
throw new NotSupportedException ();
}
public override EventInfo GetEvent (string name, BindingFlags bindingAttr)
{
throw new NotSupportedException ();
}
public override EventInfo[] GetEvents (BindingFlags bindingAttr)
{
throw new NotSupportedException ();
}
public override FieldInfo GetField (string name, BindingFlags bindingAttr)
{
throw new NotSupportedException ();
}
public override FieldInfo[] GetFields (BindingFlags bindingAttr)
{
throw new NotSupportedException ();
}
public override MemberInfo[] GetMembers (BindingFlags bindingAttr)
{
throw new NotSupportedException ();
}
protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
{
throw new NotSupportedException ();
}
public override MethodInfo[] GetMethods (BindingFlags bindingAttr)
{
throw new NotSupportedException ();
}
public override Type GetNestedType (string name, BindingFlags bindingAttr)
{
throw new NotSupportedException ();
}
public override Type[] GetNestedTypes (BindingFlags bindingAttr)
{
throw new NotSupportedException ();
}
public override PropertyInfo[] GetProperties (BindingFlags bindingAttr)
{
throw new NotSupportedException ();
}
protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
{
throw new NotSupportedException ();
}
protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
{
throw new NotSupportedException ();
}
protected override TypeAttributes GetAttributeFlagsImpl ()
{
throw new NotSupportedException ();
}
protected override bool HasElementTypeImpl ()
{
throw new NotSupportedException ();
}
protected override bool IsArrayImpl ()
{
throw new NotSupportedException ();
}
protected override bool IsByRefImpl ()
{
throw new NotSupportedException ();
}
protected override bool IsCOMObjectImpl ()
{
throw new NotSupportedException ();
}
protected override bool IsPointerImpl ()
{
throw new NotSupportedException ();
}
protected override bool IsPrimitiveImpl ()
{
throw new NotSupportedException ();
}
public override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr)
{
throw new NotSupportedException ();
}
public override object InvokeMember (string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters)
{
throw new NotSupportedException ();
}
public override Assembly Assembly {
get {
throw new NotSupportedException ();
}
}
public override string AssemblyQualifiedName {
get {
throw new NotSupportedException ();
}
}
public override Type BaseType {
get {
throw new NotSupportedException ();
}
}
public override string FullName {
get {
throw new NotSupportedException ();
}
}
public override Guid GUID {
get {
throw new NotSupportedException ();
}
}
public override Module Module {
get {
throw new NotSupportedException ();
}
}
public override string Namespace {
get {
throw new NotSupportedException ();
}
}
public override Type UnderlyingSystemType {
get {
throw new NotSupportedException ();
}
}
#endregion
public void SetCustomAttribute (params object[] args)
{
throw new NotSupportedException ();
}
public void SetGenericParameterAttributes (GenericParameterAttributes genericParameterAttributes)
{
throw new NotSupportedException ();
}
public void SetInterfaceConstraints (params Type[] interfaceConstraints)
{
throw new NotSupportedException ();
}
public void SetBaseTypeConstraint (Type baseTypeConstraint)
{
throw new NotSupportedException ();
}
}
public class ConstructorBuilder : MethodBase
{
#region implemented abstract members of MemberInfo
@@ -1087,19 +803,6 @@ namespace System.Reflection.Emit
}
}
public class ParameterBuilder : ParameterInfo
{
public void SetConstant (object arg)
{
throw new NotSupportedException ();
}
public void SetCustomAttribute (params object[] args)
{
throw new NotSupportedException ();
}
}
public class EventBuilder
{
public void SetAddOnMethod (MethodBuilder mdBuilder)
@@ -1118,11 +821,4 @@ namespace System.Reflection.Emit
}
}
public class CustomAttributeBuilder
{
public CustomAttributeBuilder (params object[] args)
{
throw new NotSupportedException ();
}
}
}
@@ -187,13 +187,54 @@ namespace Mono.CompilerServices.SymbolWriter
public void DefineMethod (MonoSymbolFile file, int token)
{
var blocks = Blocks;
if (blocks.Length > 0) {
//
// When index is provided by user it can be inserted in
// any order but mdb format does not store its value. It
// uses stored order as the index instead.
//
var sorted = new List<CodeBlockEntry> (blocks.Length);
int max_index = 0;
for (int i = 0; i < blocks.Length; ++i) {
max_index = System.Math.Max (max_index, blocks [i].Index);
}
//
// When index is provided by user it can be inserted in
// any order but mdb format does not store its value. It
// uses store order instead as the index.
//
Array.Sort (blocks, (x, y) => x.Index.CompareTo (y.Index));
for (int i = 0; i < max_index; ++i) {
var scope_index = i + 1;
//
// Common fast path
//
if (i < blocks.Length && blocks [i].Index == scope_index) {
sorted.Add (blocks [i]);
continue;
}
bool found = false;
for (int ii = 0; ii < blocks.Length; ++ii) {
if (blocks [ii].Index == scope_index) {
sorted.Add (blocks [ii]);
found = true;
break;
}
}
if (found)
continue;
//
// Ideally this should never happen but with current design we can
// generate scope index for unreachable code before reachable code
//
sorted.Add (new CodeBlockEntry (scope_index, -1, CodeBlockEntry.Type.CompilerGenerated, 0));
}
blocks = sorted.ToArray ();
//for (int i = 0; i < blocks.Length; ++i) {
// if (blocks [i].Index - 1 != i)
// throw new ArgumentException ("CodeBlocks cannot be converted to mdb format");
//}
}
var entry = new MethodEntry (
file, _comp_unit.Entry, token, ScopeVariables,
@@ -221,7 +221,7 @@ namespace Mono.Data.Sqlite
case SQLiteDateFormats.UnixEpoch:
return ((long)(dateValue.Subtract(UnixEpoch).Ticks / TimeSpan.TicksPerSecond)).ToString();
default:
return dateValue.ToString(_datetimeFormats[7], CultureInfo.InvariantCulture);
return dateValue.ToString(_datetimeFormats[5], CultureInfo.InvariantCulture);
}
}
@@ -6,4 +6,4 @@ SqliteExceptionUnitTests.cs
SqliteParameterUnitTests.cs
SqliteFunctionTests.cs
Bug27864.cs
SqliteTests.cs
@@ -0,0 +1,102 @@
//
// SqliteTests.cs
//
// Authors:
// Marek Safar <[email protected]>
//
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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.
//
using System;
using System.Data;
using System.IO;
using System.Text;
using Mono.Data.Sqlite;
using NUnit.Framework;
namespace MonoTests.Mono.Data.Sqlite
{
[TestFixture]
public class SqliteTests
{
string _databasePath;
[SetUp]
public void Setup ()
{
var dataFolder = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "SqlTest");
_databasePath = Path.Combine (dataFolder, "database.db");
if (!Directory.Exists (dataFolder)) {
Directory.CreateDirectory (dataFolder);
}
File.Delete (_databasePath);
}
[TearDown]
public void TearDown ()
{
try {
File.Delete (_databasePath);
} catch {
}
}
[Test]
public void DateTimeConvert ()
{
var dateTime = new DateTime (2016, 9, 15, 12, 1, 53);
var guid = Guid.NewGuid ();
using (var connection = new SqliteConnection ("Data Source=" + _databasePath)) {
connection.Open ();
var sqlCreate = "CREATE TABLE TestTable (ID uniqueidentifier PRIMARY KEY, Modified datetime)";
using (var cmd = new SqliteCommand (sqlCreate, connection)) {
cmd.ExecuteNonQuery ();
}
var sqlInsert = "INSERT INTO TestTable (ID, Modified) VALUES (@id, @mod)";
using (var cmd = new SqliteCommand (sqlInsert, connection)) {
cmd.Parameters.Add (new SqliteParameter ("@id", guid));
cmd.Parameters.Add (new SqliteParameter ("@mod", dateTime));
cmd.ExecuteNonQuery ();
}
}
using (var connection = new SqliteConnection ("Data Source=" + _databasePath)) {
connection.Open ();
var sqlSelect = "SELECT * from TestTable";
using (var cmd = new SqliteCommand (sqlSelect, connection))
using (var reader = cmd.ExecuteReader ()) {
while (reader.Read ()) {
Assert.AreEqual (guid, reader.GetGuid (0), "#1");
Assert.AreEqual (dateTime, reader.GetDateTime (1), "#2");
}
}
}
}
}
}
@@ -14,6 +14,7 @@ namespace Mono.Debugger.Soft
ModuleMirror main_module;
AssemblyName aname;
AssemblyDefinition meta;
AppDomainMirror domain;
Dictionary<string, long> typeCacheIgnoreCase = new Dictionary<string, long> (StringComparer.InvariantCultureIgnoreCase);
Dictionary<string, long> typeCache = new Dictionary<string, long> ();
@@ -50,6 +51,17 @@ namespace Mono.Debugger.Soft
}
}
// Since Protocol version 2.45
public AppDomainMirror Domain {
get {
if (domain == null) {
vm.CheckProtocolVersion (2, 45);
domain = vm.GetDomain (vm.conn.Assembly_GetIdDomain (id));
}
return domain;
}
}
public virtual AssemblyName GetName () {
if (aname == null) {
string name = vm.conn.Assembly_GetName (id);
@@ -420,7 +420,7 @@ namespace Mono.Debugger.Soft
* with newer runtimes, and vice versa.
*/
internal const int MAJOR_VERSION = 2;
internal const int MINOR_VERSION = 43;
internal const int MINOR_VERSION = 45;
enum WPSuspendPolicy {
NONE = 0,
@@ -532,7 +532,8 @@ namespace Mono.Debugger.Soft
GET_MANIFEST_MODULE = 3,
GET_OBJECT = 4,
GET_TYPE = 5,
GET_NAME = 6
GET_NAME = 6,
GET_DOMAIN = 7
}
enum CmdModule {
@@ -590,6 +591,7 @@ namespace Mono.Debugger.Soft
GET_THIS = 2,
SET_VALUES = 3,
GET_DOMAIN = 4,
SET_THIS = 5,
}
enum CmdArrayRef {
@@ -2113,6 +2115,10 @@ namespace Mono.Debugger.Soft
return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_NAME, new PacketWriter ().WriteId (id)).ReadString ();
}
internal long Assembly_GetIdDomain (long id) {
return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_DOMAIN, new PacketWriter ().WriteId (id)).ReadId ();
}
/*
* TYPE
*/
@@ -2410,6 +2416,10 @@ namespace Mono.Debugger.Soft
return SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.GET_DOMAIN, new PacketWriter ().WriteId (thread_id).WriteId (id)).ReadId ();
}
internal void StackFrame_SetThis (long thread_id, long id, ValueImpl value) {
SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.SET_THIS, new PacketWriter ().WriteId (thread_id).WriteId (id).WriteValue (value));
}
/*
* ARRAYS
*/
@@ -166,6 +166,15 @@ namespace Mono.Debugger.Soft
return vm.DecodeValue (vm.conn.StackFrame_GetThis (thread.Id, Id));
}
// Since protocol version 2.44
public void SetThis (Value value) {
if (value == null)
throw new ArgumentNullException ("value");
if (Method.IsStatic || !Method.DeclaringType.IsValueType)
throw new InvalidOperationException ("The frame's method needs to be a valuetype instance method.");
vm.conn.StackFrame_SetThis (thread.Id, Id, vm.EncodeValue (value));
}
public void SetValue (LocalVariable var, Value value) {
if (var == null)
throw new ArgumentNullException ("var");
@@ -430,6 +430,7 @@ public class Tests : TestsBase, ITest2
ss_recursive2 (1);
ss_recursive_chaotic ();
ss_fp_clobber ();
ss_no_frames ();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
@@ -679,6 +680,25 @@ public class Tests : TestsBase, ITest2
public static void ss_fp_clobber_2 (double d) {
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void ss_no_frames () {
Action a = ss_no_frames_2;
var ar = a.BeginInvoke (null, null);
ar.AsyncWaitHandle.WaitOne ();
// Avoid waiting every time this runs
if (static_i == 56)
Thread.Sleep (200);
ss_no_frames_3 ();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void ss_no_frames_2 () {
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void ss_no_frames_3 () {
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static bool is_even (int i) {
return i % 2 == 0;
@@ -1302,6 +1322,8 @@ public class Tests : TestsBase, ITest2
o.invoke_2 ();
o.assembly_load ();
AppDomain.Unload (domain);
domains_3 ();
@@ -1333,6 +1355,11 @@ public class Tests : TestsBase, ITest2
public static void invoke_in_domain_2 () {
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void assembly_load_in_domain () {
Assembly.Load ("System.Transactions");
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void dynamic_methods () {
var m = new DynamicMethod ("dyn_method", typeof (void), new Type [] { typeof (int) }, typeof (object).Module);
@@ -1613,6 +1640,10 @@ public class CrossDomain : MarshalByRefObject
public int invoke_3 () {
return 42;
}
public void assembly_load () {
Tests.assembly_load_in_domain ();
}
}
public class Foo
@@ -890,6 +890,28 @@ public class DebuggerTests
req.Disable ();
}
[Test]
public void SingleSteppingNoFrames () {
//
// Test what happens when starting a single step operation on a thread
// with no managed frames
//
// Run a delegate on a tp thread
var e = run_until ("ss_no_frames_2");
var this_type = e.Thread.GetFrames ()[0].Method.DeclaringType;
this_type.SetValue (this_type.GetField ("static_i"), vm.CreateValue (56));
var thread = e.Thread;
var e2 = run_until ("ss_no_frames_3");
// The tp thread should be idle now
step_req = vm.CreateStepRequest (thread);
step_req.Depth = StepDepth.Over;
AssertThrows<Exception> (delegate {
step_req.Enable ();
});
}
[Test]
public void MethodEntryExit () {
run_until ("single_stepping");
@@ -1767,6 +1789,16 @@ public class DebuggerTests
AssertValue ("T", s ["s"]);
AssertValue (45, s ["k"]);
// Test SetThis ()
s ["i"] = vm.CreateValue (55);
frame.SetThis (s);
obj = frame.GetThis ();
Assert.IsTrue (obj is StructMirror);
s = obj as StructMirror;
AssertValue (55, s ["i"]);
AssertValue ("T", s ["s"]);
AssertValue (45, s ["k"]);
// this on static vtype methods
e = run_until ("vtypes3");
e = step_until (e.Thread, "static_foo");
@@ -3267,6 +3299,7 @@ public class DebuggerTests
// d_method is from another domain
MethodMirror d_method = (e as BreakpointEvent).Method;
Assert.IsTrue (m != d_method);
Assert.AreEqual (domain, d_method.DeclaringType.Assembly.Domain);
var frames = e.Thread.GetFrames ();
Assert.AreEqual ("invoke_in_domain", frames [0].Method.Name);
@@ -3297,6 +3330,9 @@ public class DebuggerTests
vm.Resume ();
e = GetNextEvent ();
if (e is AssemblyUnloadEvent) {
AssertThrows<Exception> (delegate () {
var assembly_obj = (e as AssemblyUnloadEvent).Assembly.GetAssemblyObject ();
});
continue;
} else {
break;
@@ -1,14 +0,0 @@
thisdir = class/Mono.Security.Providers.DotNet
SUBDIRS =
include ../../build/rules.make
LIBRARY = Mono.Security.Providers.DotNet.dll
LIB_REFS = System Mono.Security
LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign
EXTRA_DISTFILES = README.md
include ../../build/library.make
$(the_lib): ../Mono.Security/Makefile
@@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{391EDD2B-85AC-4FCA-B607-AAD6C51E6799}</ProjectGuid>
<OutputType>Library</OutputType>
<NoWarn>1699,1030</NoWarn>
<OutputPath>./../../class/lib/net_4_x</OutputPath>
<IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<NoStdLib>True</NoStdLib>
<NoConfig>True</NoConfig>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>
</RootNamespace>
<AssemblyName>Mono.Security.Providers.DotNet</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<DelaySign>true</DelaySign>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<NoWarn>1699,1030</NoWarn>
<Optimize>false</Optimize>
<DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<NoWarn>1699,1030</NoWarn>
<Optimize>true</Optimize>
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="..\..\build\common\Locale.cs" />
<Compile Include=".\Mono.Security.Providers.DotNet\DotNetSslStreamImpl.cs" />
<Compile Include=".\Mono.Security.Providers.DotNet\DotNetTlsProvider.cs" />
<Compile Include=".\Properties\AssemblyInfo.cs" />␍ </ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PostBuildEvent>
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../corlib/corlib-net_4_x.csproj">
<Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>
<Name>corlib-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../System/System-net_4_x.csproj">
<Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>
<Name>System-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">
<Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>
<Name>Mono.Security-net_4_x</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
@@ -1,6 +0,0 @@
./Properties/AssemblyInfo.cs
../../build/common/Consts.cs
../../build/common/Locale.cs
./Mono.Security.Providers.DotNet/DotNetTlsProvider.cs
./Mono.Security.Providers.DotNet/DotNetSslStreamImpl.cs
@@ -1,317 +0,0 @@
//
// DotNetSslStreamImpl.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Threading.Tasks;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Security.Principal;
using System.Security.Cryptography;
using MSI = Mono.Security.Interface;
namespace Mono.Security.Providers.DotNet
{
class DotNetSslStreamImpl : MSI.IMonoSslStream
{
DotNetTlsProvider provider;
SslStream impl;
internal SslStream Impl {
get {
CheckDisposed ();
return impl;
}
}
public DotNetSslStreamImpl (
Stream innerStream, bool leaveInnerStreamOpen, DotNetTlsProvider provider,
RemoteCertificateValidationCallback userCertificateValidationCallback,
LocalCertificateSelectionCallback userCertificateSelectionCallback)
{
this.provider = provider;
impl = new SslStream (
innerStream, leaveInnerStreamOpen,
userCertificateValidationCallback,
userCertificateSelectionCallback);
}
public void AuthenticateAsClient (string targetHost)
{
Impl.AuthenticateAsClient (targetHost);
}
public void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
Impl.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
}
public IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginAuthenticateAsClient (targetHost, asyncCallback, asyncState);
}
public IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginAuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
}
public void EndAuthenticateAsClient (IAsyncResult asyncResult)
{
Impl.EndAuthenticateAsClient (asyncResult);
}
public void AuthenticateAsServer (X509Certificate serverCertificate)
{
Impl.AuthenticateAsServer (serverCertificate);
}
public void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
Impl.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
}
public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginAuthenticateAsServer (serverCertificate, asyncCallback, asyncState);
}
public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
}
public void EndAuthenticateAsServer (IAsyncResult asyncResult)
{
Impl.EndAuthenticateAsServer (asyncResult);
}
public Task AuthenticateAsClientAsync (string targetHost)
{
return Impl.AuthenticateAsClientAsync (targetHost);
}
public Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
return Impl.AuthenticateAsClientAsync (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
}
public Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
{
return Impl.AuthenticateAsServerAsync (serverCertificate);
}
public Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
}
public void Flush ()
{
Impl.Flush ();
}
public int Read (byte[] buffer, int offset, int count)
{
return Impl.Read (buffer, offset, count);
}
public void Write (byte[] buffer)
{
Impl.Write (buffer);
}
public void Write (byte[] buffer, int offset, int count)
{
Impl.Write (buffer, offset, count);
}
public IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginRead (buffer, offset, count, asyncCallback, asyncState);
}
public int EndRead (IAsyncResult asyncResult)
{
return Impl.EndRead (asyncResult);
}
public IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginWrite (buffer, offset, count, asyncCallback, asyncState);
}
public void EndWrite (IAsyncResult asyncResult)
{
Impl.EndWrite (asyncResult);
}
public TransportContext TransportContext {
get { throw new NotSupportedException (); }
}
public bool IsAuthenticated {
get { return Impl.IsAuthenticated; }
}
public bool IsMutuallyAuthenticated {
get { return Impl.IsMutuallyAuthenticated; }
}
public bool IsEncrypted {
get { return Impl.IsEncrypted; }
}
public bool IsSigned {
get { return Impl.IsSigned; }
}
public bool IsServer {
get { return Impl.IsServer; }
}
public CipherAlgorithmType CipherAlgorithm {
get { return Impl.CipherAlgorithm; }
}
public int CipherStrength {
get { return Impl.CipherStrength; }
}
public HashAlgorithmType HashAlgorithm {
get { return Impl.HashAlgorithm; }
}
public int HashStrength {
get { return Impl.HashStrength; }
}
public ExchangeAlgorithmType KeyExchangeAlgorithm {
get { return Impl.KeyExchangeAlgorithm; }
}
public int KeyExchangeStrength {
get { return KeyExchangeStrength; }
}
public bool CanRead {
get { return Impl.CanRead; }
}
public bool CanTimeout {
get { return Impl.CanTimeout; }
}
public bool CanWrite {
get { return Impl.CanWrite; }
}
public long Length {
get { return Impl.Length; }
}
public long Position {
get { return Impl.Position; }
}
public void SetLength (long value)
{
Impl.SetLength (value);
}
public AuthenticatedStream AuthenticatedStream {
get { return Impl; }
}
public int ReadTimeout {
get { return Impl.ReadTimeout; }
set { Impl.ReadTimeout = value; }
}
public int WriteTimeout {
get { return Impl.WriteTimeout; }
set { Impl.WriteTimeout = value; }
}
public bool CheckCertRevocationStatus {
get { return Impl.CheckCertRevocationStatus; }
}
public X509Certificate InternalLocalCertificate {
get {
try {
return LocalCertificate;
} catch {
return null;
}
}
}
public X509Certificate LocalCertificate {
get { return Impl.LocalCertificate; }
}
public X509Certificate RemoteCertificate {
get { return Impl.RemoteCertificate; }
}
public SslProtocols SslProtocol {
get { return Impl.SslProtocol; }
}
MSI.MonoTlsProvider MSI.IMonoSslStream.Provider {
get { return provider; }
}
MSI.MonoTlsConnectionInfo MSI.IMonoSslStream.GetConnectionInfo ()
{
return null;
}
void CheckDisposed ()
{
if (impl == null)
throw new ObjectDisposedException ("MonoSslStream");
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
protected void Dispose (bool disposing)
{
if (impl != null && disposing) {
impl.Dispose ();
impl = null;
}
}
}
}
@@ -1,118 +0,0 @@
//
// MonoDefaultTlsProvider.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using Mono.Security.Interface;
namespace Mono.Security.Providers.DotNet
{
/*
* This provider only uses the public .NET APIs from System.dll.
*
* It is primarily intended for testing.
*/
public class DotNetTlsProvider : MonoTlsProvider
{
static readonly Guid id = new Guid ("3a7b3a26-0dbd-4572-a5b8-fdce766bf0dd");
public override Guid ID {
get { return id; }
}
public override string Name {
get { return "dotnet"; }
}
public override bool SupportsSslStream {
get { return true; }
}
public override bool SupportsConnectionInfo {
get { return false; }
}
public override bool SupportsMonoExtensions {
get { return false; }
}
internal override bool SupportsTlsContext {
get { return false; }
}
public override SslProtocols SupportedProtocols {
get { return (SslProtocols)ServicePointManager.SecurityProtocol; }
}
public override IMonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MonoTlsSettings settings = null)
{
if (settings != null)
throw new NotSupportedException ("Mono-specific API Extensions not available.");
RemoteCertificateValidationCallback validation_callback = null;
LocalCertificateSelectionCallback selection_callback = null;
if (settings != null) {
validation_callback = ConvertCallback (settings.RemoteCertificateValidationCallback);
selection_callback = ConvertCallback (settings.ClientCertificateSelectionCallback);
}
return new DotNetSslStreamImpl (innerStream, leaveInnerStreamOpen, this, validation_callback, selection_callback);
}
internal override IMonoTlsContext CreateTlsContext (
string hostname, bool serverMode, TlsProtocols protocolFlags,
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
MonoTlsSettings settings)
{
throw new NotSupportedException ();
}
internal static RemoteCertificateValidationCallback ConvertCallback (MonoRemoteCertificateValidationCallback callback)
{
if (callback == null)
return null;
return (s, c, ch, e) => callback (null, c, ch, (MonoSslPolicyErrors)e);
}
internal static LocalCertificateSelectionCallback ConvertCallback (MonoLocalCertificateSelectionCallback callback)
{
if (callback == null)
return null;
return (s, t, lc, rc, ai) => callback (t, lc, rc, ai);
}
}
}
@@ -1 +0,0 @@
See mcs/class/Mono.Security.Providers.NewSystemSource/README.md for a detailed README.
@@ -1,24 +0,0 @@
thisdir = class/Mono.Security.Providers.NewSystemSource
SUBDIRS =
include ../../build/rules.make
LIB_REFS = System
LIBRARY = Mono.Security.Providers.NewSystemSource.dll
LIB_MCS_FLAGS = -d:SECURITY_DEP \
-unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:MONO -d:FEATURE_PAL -d:MONO_FEATURE_NEW_TLS \
-d:MONO_FEATURE_NEW_SYSTEM_SOURCE -d:DISABLE_CAS_USE
ifdef MOBILE_PROFILE
LIB_REFS += Mono.Security
else
LIB_REFS += MonoSecurity=Mono.Security
LIB_MCS_FLAGS += -d:MONO_SECURITY_ALIAS
endif
EXTRA_DISTFILES = README.md
include ../../build/library.make
$(the_lib): ../Mono.Security/Makefile
@@ -1,126 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}</ProjectGuid>
<OutputType>Library</OutputType>
<NoWarn>1699,1030</NoWarn>
<OutputPath>./../../class/lib/net_4_x</OutputPath>
<IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<NoStdLib>True</NoStdLib>
<NoConfig>True</NoConfig>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>
</RootNamespace>
<AssemblyName>Mono.Security.Providers.NewSystemSource</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<DelaySign>true</DelaySign>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<NoWarn>1699,1030</NoWarn>
<Optimize>false</Optimize>
<DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP;MONO;FEATURE_PAL;MONO_FEATURE_NEW_TLS;MONO_FEATURE_NEW_SYSTEM_SOURCE;DISABLE_CAS_USE;MONO_SECURITY_ALIAS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<NoWarn>1699,1030</NoWarn>
<Optimize>true</Optimize>
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP;MONO;FEATURE_PAL;MONO_FEATURE_NEW_TLS;MONO_FEATURE_NEW_SYSTEM_SOURCE;DISABLE_CAS_USE;MONO_SECURITY_ALIAS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="..\..\build\common\Locale.cs" />
<Compile Include="..\..\build\common\SR.cs" />
<Compile Include="..\referencesource\mscorlib\InternalApis\NDP_Common\inc\PinnableBufferCache.cs" />
<Compile Include="..\referencesource\System\net\System\Net\_LazyAsyncResult.cs" />
<Compile Include="..\referencesource\System\net\System\Net\_LoggingObject.cs" />
<Compile Include="..\referencesource\System\net\System\Net\_NTAuthentication.cs" />
<Compile Include="..\referencesource\System\net\System\Net\_SecureChannel.cs" />
<Compile Include="..\referencesource\System\net\System\Net\_SslSessionsCache.cs" />
<Compile Include="..\referencesource\System\net\System\Net\Logging.cs" />
<Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_FixedSizeReader.cs" />
<Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_HelperAsyncResults.cs" />
<Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_SslState.cs" />
<Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_SslStream.cs" />
<Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\SslStream.cs" />
<Compile Include="..\System\Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="..\System\Mono.Net.Security\IMonoTlsProvider.cs" />
<Compile Include="..\System\Mono.Net.Security\MonoTlsProviderFactory.cs" />
<Compile Include="..\System\Mono.Net.Security\MonoTlsProviderWrapper.cs" />
<Compile Include="..\System\ReferenceSources\_SecureChannel.cs" />
<Compile Include="..\System\ReferenceSources\_SslState.cs" />
<Compile Include="..\System\ReferenceSources\_SslStream.cs" />
<Compile Include="..\System\ReferenceSources\Internal.cs" />
<Compile Include="..\System\ReferenceSources\SR.cs" />
<Compile Include="..\System\ReferenceSources\SR2.cs" />
<Compile Include="..\System\ReferenceSources\SslStream.cs" />
<Compile Include="..\System\ReferenceSources\SSPIConfiguration.cs" />
<Compile Include="..\System\ReferenceSources\SSPISafeHandles.cs" />
<Compile Include="..\System\ReferenceSources\SSPIWrapper.cs" />
<Compile Include=".\Properties\AssemblyInfo.cs" />␍ </ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PostBuildEvent>
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../corlib/corlib-net_4_x.csproj">
<Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>
<Name>corlib-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../System/System-net_4_x.csproj">
<Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>
<Name>System-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">
<Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>
<Name>Mono.Security-net_4_x</Name>
<Aliases>MonoSecurity</Aliases> </ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
@@ -1,33 +0,0 @@
./Properties/AssemblyInfo.cs
../../build/common/SR.cs
../../build/common/Consts.cs
../../build/common/Locale.cs
../referencesource/System/net/System/Net/Logging.cs
../referencesource/System/net/System/Net/_SslSessionsCache.cs
../referencesource/System/net/System/Net/_LazyAsyncResult.cs
../referencesource/System/net/System/Net/_LoggingObject.cs
../referencesource/System/net/System/Net/_NTAuthentication.cs
../referencesource/System/net/System/Net/_SecureChannel.cs
../referencesource/System/net/System/Net/SecureProtocols/SslStream.cs
../referencesource/System/net/System/Net/SecureProtocols/_SslState.cs
../referencesource/System/net/System/Net/SecureProtocols/_SslStream.cs
../referencesource/System/net/System/Net/SecureProtocols/_FixedSizeReader.cs
../referencesource/System/net/System/Net/SecureProtocols/_HelperAsyncResults.cs
../referencesource/mscorlib/InternalApis/NDP_Common/inc/PinnableBufferCache.cs
../System/ReferenceSources/SR.cs
../System/ReferenceSources/SR2.cs
../System/ReferenceSources/Internal.cs
../System/ReferenceSources/SSPIWrapper.cs
../System/ReferenceSources/SSPISafeHandles.cs
../System/ReferenceSources/SslStream.cs
../System/ReferenceSources/_SslState.cs
../System/ReferenceSources/_SslStream.cs
../System/ReferenceSources/_SecureChannel.cs
../System/ReferenceSources/SSPIConfiguration.cs
../System/Mono.Net.Security/CallbackHelpers.cs
../System/Mono.Net.Security/IMonoTlsProvider.cs
../System/Mono.Net.Security/MonoTlsProviderFactory.cs
../System/Mono.Net.Security/MonoTlsProviderWrapper.cs
@@ -1,48 +0,0 @@
//
// AssemblyInfo.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
using System.Reflection;
using System.Resources;
using System.Security;
using System.Security.Permissions;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about the system assembly
[assembly: AssemblyVersion (Consts.FxVersion)]
[assembly: AssemblyCompany ("MONO development team")]
[assembly: AssemblyCopyright ("(c) 2015 Xamarin")]
[assembly: AssemblyDescription ("Mono.Security.Providers.NewSystemSource.dll")]
[assembly: AssemblyProduct ("MONO CLI")]
[assembly: AssemblyTitle ("Mono.Security.Providers.NewSystemSource.dll")]
[assembly: CLSCompliant (true)]
[assembly: ComVisible (false)]
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")]
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
@@ -1,95 +0,0 @@
Mono.Security.Interface / Mono.Security.Providers
=================================================
This is not a public API yet, but will eventually become public.
Mono.Security.Interface
-----------------------
`Mono.Security.Interface` provides an abstraction layer for the TLS
APIs that are currently being used by Mono's class libraries.
The main API entry points are `MonoTlsProviderFactory.GetProvider()`
and `MonoTlsProviderFactory.InstallProvider()`.
Mono.Net.Security
-----------------
`Mono.Net.Security` provides the internal implementation and lives
inside `System.dll` as private and internal APIs. `Mono.Security.dll`
uses reflection to access these.
On Mobile, the `Mono.Security.Interface` APIs are included as public
APIs in `System.dll`.
Mono.Security.Providers
-----------------------
Implementations of the `Mono.Security.Interface.MonoTlsProvider` class
to provide TLS functionality.
The default provider is inside `System.dll` - it will be used automatically
if you don't explicitly install a custom provider, so simply call
`MonoTlsProviderFactory.GetProvider()` to use it.
* DotNet:
Provides the default `SslStream` implementation from `System.dll`, only using
public .NET types.
* NewSystemSource:
Compiles several referencesource files which would normally live inside
`System.dll` if we compiled it with their `SslStream` implementation.
This allows to keep the code in `System.dll` as-is, while still providing the
new `SslStream`, which will be required by the new TLS code.
`System.dll` needs to make its internals visible and we're using several compiler /
external alias tricks in here to make this work.
In this configuration, `MONO_SYSTEM_ALIAS`, `MONO_FEATURE_NEW_TLS` and
`MONO_FEATURE_NEW_SYSTEM_SOURCE` (defining conditional for this configuration)
are defined. We do not define `MONO_X509_ALIAS here`.
The `Mono.Security.Providers.DotNet` and `Mono.Security.Providers.NewSystemSource` directory is currently
enabled in the top-level `Makefile`, but the resulting binaries should only be used to test the new TLS
code and not shipped as stable APIs.
Pending changes
---------------
This code is not actually being used in `System.dll` yet. I have some
local changes which will switch the existing code in `WebClient`,
`SmptClient` and `FtpWebRequest` over, but these need to be carefully
tested.
At the moment, this work branch only provides new code and build
changes, which shuffle some stuff around. There are also several
new files which are conditional and not actually being built by
default.
Build Configurations
--------------------
* Normal build:
Builds everything as before with some new APIs added, but without
modifying any existing functionality.
* Build with the `newtls` profile:
Builds `System.dll` with the new `SslStream` implementation from the
referencesource. This is currently a "build then throw away" profile
and not enabled from the top-level Makefile. The resulting `System.dll`
won't actually work at runtime since it's missing the new TLS code;
building it helps find problems and ensures that it will actually
be possible to build this once we deploy it.
* Mono.Security.Providers:
The new TLS code requires the newly built `System` and `Mono.Security.Providers.NewSystemSource`
from this branch installed in the system. It is recommended to install it
into a custom prefix and set that as custom runtime in Xamarin Studio.
Last changed March 07th, 2015,
Martin Baulig <martin.baulig@xamarin.com>
@@ -1,12 +0,0 @@
thisdir = class/Mono.Security.Providers.NewTls
SUBDIRS =
include ../../build/rules.make
LIBRARY = Mono.Security.Providers.NewTls.dll
LIB_REFS = System NewSystemSource=Mono.Security.Providers.NewSystemSource Mono.Security
LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign
include ../../build/library.make
$(the_lib): ../Mono.Security/Makefile
@@ -1,111 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C8B8E524-BB3A-44E2-8C22-E3313E9F477C}</ProjectGuid>
<OutputType>Library</OutputType>
<NoWarn>1699,1030</NoWarn>
<OutputPath>./../../class/lib/net_4_x</OutputPath>
<IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<NoStdLib>True</NoStdLib>
<NoConfig>True</NoConfig>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>
</RootNamespace>
<AssemblyName>Mono.Security.Providers.NewTls</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<DelaySign>true</DelaySign>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<NoWarn>1699,1030</NoWarn>
<Optimize>false</Optimize>
<DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<NoWarn>1699,1030</NoWarn>
<Optimize>true</Optimize>
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="..\..\build\common\Locale.cs" />
<Compile Include="..\..\build\common\SR.cs" />
<Compile Include=".\Mono.Security.Providers.NewTls\ITlsConfiguration.cs" />
<Compile Include=".\Mono.Security.Providers.NewTls\ITlsContext.cs" />
<Compile Include=".\Mono.Security.Providers.NewTls\MonoNewTlsStream.cs" />
<Compile Include=".\Mono.Security.Providers.NewTls\MonoNewTlsStreamFactory.cs" />
<Compile Include=".\Mono.Security.Providers.NewTls\NewTlsProvider.cs" />
<Compile Include=".\Mono.Security.Providers.NewTls\TlsContextWrapper.cs" />
<Compile Include=".\Mono.Security.Providers.NewTls\TlsProviderFactory.cs" />
<Compile Include=".\Properties\AssemblyInfo.cs" />␍ </ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PostBuildEvent>
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../corlib/corlib-net_4_x.csproj">
<Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>
<Name>corlib-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../System/System-net_4_x.csproj">
<Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>
<Name>System-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">
<Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>
<Name>Mono.Security-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj">
<Project>{0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}</Project>
<Name>Mono.Security.Providers.NewSystemSource-net_4_x</Name>
<Aliases>NewSystemSource</Aliases> </ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
@@ -1,13 +0,0 @@
./Properties/AssemblyInfo.cs
../../build/common/SR.cs
../../build/common/Consts.cs
../../build/common/Locale.cs
./Mono.Security.Providers.NewTls/ITlsConfiguration.cs
./Mono.Security.Providers.NewTls/ITlsContext.cs
./Mono.Security.Providers.NewTls/MonoNewTlsStream.cs
./Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs
./Mono.Security.Providers.NewTls/NewTlsProvider.cs
./Mono.Security.Providers.NewTls/TlsContextWrapper.cs
./Mono.Security.Providers.NewTls/TlsProviderFactory.cs
@@ -1,93 +0,0 @@
//
// MonoNewTlsStream.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
extern alias NewSystemSource;
using EncryptionPolicy = NewSystemSource::System.Net.Security.EncryptionPolicy;
using LocalCertificateSelectionCallback = NewSystemSource::System.Net.Security.LocalCertificateSelectionCallback;
using RemoteCertificateValidationCallback = NewSystemSource::System.Net.Security.RemoteCertificateValidationCallback;
using SslStream = NewSystemSource::System.Net.Security.SslStream;
using System;
using System.IO;
using System.Threading.Tasks;
using MSI = Mono.Security.Interface;
using XAuthenticatedStream = System.Net.Security.AuthenticatedStream;
using System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Providers.NewTls
{
public class MonoNewTlsStream : SslStream, MSI.IMonoSslStream
{
MSI.MonoTlsProvider provider;
internal MonoNewTlsStream (Stream innerStream, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings)
: this (innerStream, false, provider, settings)
{
}
internal MonoNewTlsStream (Stream innerStream, bool leaveOpen, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings)
: base (innerStream, leaveOpen, EncryptionPolicy.RequireEncryption, provider, settings)
{
this.provider = provider;
}
public MSI.MonoTlsProvider Provider {
get { return provider; }
}
new public bool IsClosed {
get { return base.IsClosed; }
}
public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
{
return GetMonoConnectionInfo ();
}
public Task Shutdown ()
{
return Task.Factory.FromAsync ((state, result) => BeginShutdown (state, result), EndShutdown, null);
}
public Task RequestRenegotiation ()
{
return Task.Factory.FromAsync ((state, result) => BeginRenegotiate (state, result), EndRenegotiate, null);
}
X509Certificate MSI.IMonoSslStream.InternalLocalCertificate {
get { return InternalLocalCertificate; }
}
XAuthenticatedStream MSI.IMonoSslStream.AuthenticatedStream {
get { return this; }
}
}
}
@@ -1,91 +0,0 @@
//
// MonoNewTlsStreamFactory.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
extern alias NewSystemSource;
using XEncryptionPolicy = NewSystemSource::System.Net.Security.EncryptionPolicy;
using XSslPolicyErrors = NewSystemSource::System.Net.Security.SslPolicyErrors;
using XLocalCertificateSelectionCallback = NewSystemSource::System.Net.Security.LocalCertificateSelectionCallback;
using XRemoteCertificateValidationCallback = NewSystemSource::System.Net.Security.RemoteCertificateValidationCallback;
using System;
using System.IO;
using System.Net.Security;
using System.Security.Authentication;
using Mono.Security.Interface;
using PSSCX = System.Security.Cryptography.X509Certificates;
using SSCX = System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Providers.NewTls
{
public static class MonoNewTlsStreamFactory
{
internal static IMonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MonoTlsProvider provider, MonoTlsSettings settings = null)
{
return new MonoNewTlsStream (innerStream, leaveInnerStreamOpen, provider, settings);
}
public static MonoNewTlsStream CreateServer (
Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings,
SSCX.X509Certificate serverCertificate, bool clientCertificateRequired,
SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, settings);
try {
stream.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
} catch (Exception ex) {
var tlsEx = stream.LastError;
if (tlsEx != null)
throw new AggregateException (ex, tlsEx);
throw;
}
return stream;
}
public static MonoNewTlsStream CreateClient (
Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings,
string targetHost, PSSCX.X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, settings);
try {
stream.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
} catch (Exception ex) {
var tlsEx = stream.LastError;
if (tlsEx != null)
throw new AggregateException (ex, tlsEx);
throw;
}
return stream;
}
}
}
@@ -1,95 +0,0 @@
//
// NewTlsProvider.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
extern alias NewSystemSource;
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Authentication;
using MSI = Mono.Security.Interface;
using MX = Mono.Security.X509;
using PSSCX = System.Security.Cryptography.X509Certificates;
using SSCX = System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Providers.NewTls
{
public class NewTlsProvider : MSI.MonoTlsProvider
{
static readonly Guid id = new Guid ("e5ff34f1-8b7a-4aa6-aff9-24719d709693");
public override Guid ID {
get { return id; }
}
public override string Name {
get { return "newtls"; }
}
public override bool SupportsSslStream {
get { return true; }
}
public override bool SupportsConnectionInfo {
get { return true; }
}
public override bool SupportsMonoExtensions {
get { return true; }
}
internal override bool SupportsTlsContext {
get { return true; }
}
public override SslProtocols SupportedProtocols {
get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
}
public override MSI.IMonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MSI.MonoTlsSettings settings = null)
{
return MonoNewTlsStreamFactory.CreateSslStream (innerStream, leaveInnerStreamOpen, this, settings);
}
internal override MSI.IMonoTlsContext CreateTlsContext (
string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
SSCX.X509Certificate serverCertificate, PSSCX.X509CertificateCollection clientCertificates,
bool remoteCertRequired, MSI.MonoEncryptionPolicy encryptionPolicy,
MSI.MonoTlsSettings settings)
{
var config = TlsProviderFactory.CreateTlsConfiguration (
hostname, serverMode, protocolFlags, serverCertificate,
remoteCertRequired, settings);
return new TlsContextWrapper (config, serverMode);
}
}
}
@@ -1,221 +0,0 @@
//
// TlsContextWrapper.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
extern alias NewSystemSource;
using System;
using System.Security.Cryptography;
using SSCX = System.Security.Cryptography.X509Certificates;
using PSSCX = System.Security.Cryptography.X509Certificates;
using MSI = Mono.Security.Interface;
using MX = Mono.Security.X509;
namespace Mono.Security.Providers.NewTls
{
class TlsContextWrapper : IDisposable, MSI.IMonoTlsContext
{
ITlsConfiguration config;
ITlsContext context;
bool serverMode;
public TlsContextWrapper (ITlsConfiguration config, bool serverMode)
{
this.config = config;
this.serverMode = serverMode;
}
public bool IsServer {
get { return serverMode; }
}
public bool IsValid {
get { return context != null && context.IsValid; }
}
public void Initialize (MSI.IMonoTlsEventSink eventSink)
{
if (context != null)
throw new InvalidOperationException ();
context = TlsProviderFactory.CreateTlsContext (config, serverMode, eventSink);
}
void Clear ()
{
if (context != null) {
context.Dispose ();
context = null;
}
}
public ITlsConfiguration Configuration {
get {
if (config == null)
throw new ObjectDisposedException ("TlsConfiguration");
return config;
}
}
public ITlsContext Context {
get {
if (!IsValid)
throw new ObjectDisposedException ("TlsContext");
return context;
}
}
public bool HasCredentials {
get { return Configuration.HasCredentials; }
}
public void SetCertificate (SSCX.X509Certificate certificate, AsymmetricAlgorithm privateKey)
{
var monoCert = new MX.X509Certificate (certificate.GetRawCertData ());
Configuration.SetCertificate (monoCert, privateKey);
}
public int GenerateNextToken (MSI.IBufferOffsetSize incoming, out MSI.IBufferOffsetSize outgoing)
{
var input = incoming != null ? new MSI.TlsBuffer (BOSWrapper.Wrap (incoming)) : null;
var output = new MSI.TlsMultiBuffer ();
var retval = Context.GenerateNextToken (input, output);
if (output.IsEmpty)
outgoing = null;
outgoing = BOSWrapper.Wrap (output.StealBuffer ());
return (int)retval;
}
public int EncryptMessage (ref MSI.IBufferOffsetSize incoming)
{
var buffer = new MSI.TlsBuffer (BOSWrapper.Wrap (incoming));
var retval = Context.EncryptMessage (ref buffer);
incoming = BOSWrapper.Wrap (buffer.GetRemaining ());
return (int)retval;
}
public int DecryptMessage (ref MSI.IBufferOffsetSize incoming)
{
var buffer = new MSI.TlsBuffer (BOSWrapper.Wrap (incoming));
var retval = Context.DecryptMessage (ref buffer);
incoming = buffer != null ? BOSWrapper.Wrap (buffer.GetRemaining ()) : null;
return (int)retval;
}
class BOSWrapper : MSI.IBufferOffsetSize
{
public byte[] Buffer {
get;
private set;
}
public int Offset {
get;
private set;
}
public int Size {
get;
private set;
}
BOSWrapper (byte[] buffer, int offset, int size)
{
Buffer = buffer;
Offset = offset;
Size = size;
}
public static BOSWrapper Wrap (MSI.IBufferOffsetSize bos)
{
return bos != null ? new BOSWrapper (bos.Buffer, bos.Offset, bos.Size) : null;
}
}
public byte[] CreateCloseNotify ()
{
return Context.CreateAlert (new MSI.Alert (MSI.AlertLevel.Warning, MSI.AlertDescription.CloseNotify));
}
public byte[] CreateHelloRequest ()
{
return Context.CreateHelloRequest ();
}
public SSCX.X509Certificate GetRemoteCertificate (out PSSCX.X509CertificateCollection remoteCertificateStore)
{
MX.X509CertificateCollection monoCollection;
var remoteCert = Context.GetRemoteCertificate (out monoCollection);
if (remoteCert == null) {
remoteCertificateStore = null;
return null;
}
remoteCertificateStore = new PSSCX.X509CertificateCollection ();
foreach (var cert in monoCollection) {
remoteCertificateStore.Add (new PSSCX.X509Certificate2 (cert.RawData));
}
return new PSSCX.X509Certificate2 (remoteCert.RawData);
}
public bool VerifyRemoteCertificate ()
{
return Context.VerifyRemoteCertificate ();
}
public Exception LastError {
get {
if (context != null)
return context.LastError;
return null;
}
}
public bool ReceivedCloseNotify {
get {
return Context.ReceivedCloseNotify;
}
}
public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
{
return Context.ConnectionInfo;
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
void Dispose (bool disposing)
{
Clear ();
}
}
}
@@ -1,97 +0,0 @@
//
// TlsProviderFactory.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015-2016 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
extern alias NewSystemSource;
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Authentication;
using MSI = Mono.Security.Interface;
using MX = Mono.Security.X509;
using PSSCX = System.Security.Cryptography.X509Certificates;
using SSCX = System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Providers.NewTls
{
static class TlsProviderFactory
{
const string assemblyName = "Mono.Security.NewTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=84e3aee7225169c2";
const string tlsConfigTypeName = "Mono.Security.NewTls.TlsConfiguration";
const string tlsContextTypeName = "Mono.Security.NewTls.TlsContext";
static object CreateInstance (string typeName, object[] args)
{
var type = Type.GetType (typeName + ", " + assemblyName);
return Activator.CreateInstance (type, args);
}
internal static ITlsConfiguration CreateTlsConfiguration (
string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
SSCX.X509Certificate serverCertificate, bool remoteCertRequired,
MSI.MonoTlsSettings settings)
{
object[] args;
ITlsConfiguration config;
if (serverMode) {
var cert = (PSSCX.X509Certificate2)serverCertificate;
var monoCert = new MX.X509Certificate (cert.RawData);
args = new object[] {
(MSI.TlsProtocols)protocolFlags,
(MSI.MonoTlsSettings)settings,
monoCert,
cert.PrivateKey
};
} else {
args = new object[] {
(MSI.TlsProtocols)protocolFlags,
(MSI.MonoTlsSettings)settings,
hostname
};
}
config = (ITlsConfiguration)CreateInstance (tlsConfigTypeName, args);
if (serverMode && remoteCertRequired)
config.AskForClientCertificate = true;
return config;
}
internal static ITlsContext CreateTlsContext (
ITlsConfiguration config, bool serverMode,
MSI.IMonoTlsEventSink eventSink)
{
return (ITlsContext)CreateInstance (
tlsContextTypeName,
new object[] { config, serverMode, eventSink });
}
}
}
@@ -1,47 +0,0 @@
//
// AssemblyInfo.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
using System.Reflection;
using System.Resources;
using System.Security;
using System.Security.Permissions;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about the system assembly
[assembly: AssemblyVersion (Consts.FxVersion)]
[assembly: AssemblyCompany ("Xamarin")]
[assembly: AssemblyCopyright ("(c) 2015 Xamarin")]
[assembly: AssemblyDescription ("Mono.Security.Providers.NewTls.dll")]
[assembly: AssemblyProduct ("MONO CLI")]
[assembly: AssemblyTitle ("Mono.Security.Providers.NewTls.dll")]
[assembly: CLSCompliant (false)]
[assembly: ComVisible (false)]
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: InternalsVisibleTo ("Mono.Security.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")]
@@ -1,7 +0,0 @@
Properties/AssemblyInfo.cs
Mono.Security.Providers.NewTls/ITlsConfiguration.cs
Mono.Security.Providers.NewTls/ITlsContext.cs
Mono.Security.Providers.NewTls/MonoNewTlsStream.cs
Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs
@@ -1 +0,0 @@
#include mobile_Mono.Security.Providers.NewTls.dll.sources
@@ -1,167 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E485E885-59B1-4081-BC66-56AAAFD8771A}</ProjectGuid>
<OutputType>Library</OutputType>
<NoWarn>1699,1030</NoWarn>
<OutputPath>./../../class/lib/net_4_x</OutputPath>
<IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<NoStdLib>True</NoStdLib>
<NoConfig>True</NoConfig>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>
</RootNamespace>
<AssemblyName>Mono.Security.Providers.OldTls</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<DelaySign>true</DelaySign>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<NoWarn>1699,1030</NoWarn>
<Optimize>false</Optimize>
<DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<NoWarn>1699,1030</NoWarn>
<Optimize>true</Optimize>
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="..\..\build\common\Locale.cs" />
<Compile Include="..\..\build\common\MonoTODOAttribute.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Cryptography\MD5SHA1.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Cryptography\TlsHMAC.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientCertificate.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientCertificateVerify.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientFinished.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientHello.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientKeyExchange.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerCertificate.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerCertificateRequest.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerFinished.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerHello.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerHelloDone.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerKeyExchange.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientCertificate.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientCertificateVerify.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientFinished.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientHello.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientKeyExchange.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerCertificate.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerCertificateRequest.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerFinished.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerHello.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerHelloDone.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerKeyExchange.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake\ClientCertificateType.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake\HandshakeMessage.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake\HandshakeType.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\Alert.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherAlgorithmType.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherSuite.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherSuiteCollection.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherSuiteFactory.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ClientContext.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ClientRecordProtocol.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ClientSessionCache.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ContentType.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\Context.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\DebugHelper.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ExchangeAlgorithmType.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\HandshakeState.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\HashAlgorithmType.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\HttpsClientStream.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\RecordProtocol.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\RSASslSignatureDeformatter.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\RSASslSignatureFormatter.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SecurityCompressionType.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SecurityParameters.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SecurityProtocolType.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ServerContext.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ServerRecordProtocol.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslCipherSuite.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslClientStream.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslHandshakeHash.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslServerStream.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslStreamBase.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsCipherSuite.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsClientSettings.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsException.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsServerSettings.cs" />
<Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsStream.cs" />
<Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\AuthorityKeyIdentifierExtension.cs" />
<Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\ExtendedKeyUsageExtension.cs" />
<Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\GeneralNames.cs" />
<Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\NetscapeCertTypeExtension.cs" />
<Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\SubjectAltNameExtension.cs" />
<Compile Include="..\System\Mono.Net.Security\LegacySslStream.cs" />
<Compile Include=".\Mono.Security.Providers.OldTls\OldTlsProvider.cs" />
<Compile Include=".\Properties\AssemblyInfo.cs" />␍ </ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PostBuildEvent>
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../corlib/corlib-net_4_x.csproj">
<Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>
<Name>corlib-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../System/System-net_4_x.csproj">
<Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>
<Name>System-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">
<Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>
<Name>Mono.Security-net_4_x</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
@@ -1,87 +0,0 @@
//
// OldTlsProvider.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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.
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using Mono.Security.Interface;
using MNS = Mono.Net.Security;
namespace Mono.Security.Providers.OldTls
{
public class OldTlsProvider : MonoTlsProvider
{
static readonly Guid id = new Guid ("cf8baa0d-c6ed-40ae-b512-dec8d097e9af");
public override Guid ID {
get { return id; }
}
public override string Name {
get { return "old"; }
}
public override bool SupportsSslStream {
get { return true; }
}
public override bool SupportsMonoExtensions {
get { return false; }
}
public override bool SupportsConnectionInfo {
get { return false; }
}
internal override bool SupportsTlsContext {
get { return false; }
}
public override SslProtocols SupportedProtocols {
get { return SslProtocols.Tls; }
}
public override IMonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MonoTlsSettings settings = null)
{
var impl = new MNS.Private.LegacySslStream (innerStream, leaveInnerStreamOpen, this, settings);
return new MNS.Private.MonoSslStreamImpl (impl);
}
internal override IMonoTlsContext CreateTlsContext (
string hostname, bool serverMode, TlsProtocols protocolFlags,
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
MonoTlsSettings settings)
{
throw new NotSupportedException ();
}
}
}
@@ -66,8 +66,3 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo ("System, PublicKey=00000000000000000400000000000000")]
#endif
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
[assembly: InternalsVisibleTo ("Mono.Security.Providers.OldTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
[assembly: InternalsVisibleTo ("Mono.Security.Providers.DotNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewSystemSource, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
[assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")]
Loaded 100 of 1357 files, more files were not shown because too many files have changed in this diff. Show more