Resolve "you are registering twice the same counter address" warning on Windows Release builds.
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 \
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 \
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
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 \
module.SetDeclaringAssembly (temp);
var importer = new Compiler.ReflectionImporter (module, cc.BuiltinTypes) {
- IgnorePrivateMembers = false
+ IgnorePrivateMembers = false,
+ IgnoreCompilerGeneratedField = false
};
// Import all currently loaded assemblies
+++ /dev/null
-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
-
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <PropertyGroup>\r
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
- <ProductVersion>9.0.30729</ProductVersion>\r
- <SchemaVersion>2.0</SchemaVersion>\r
- <ProjectGuid>{391EDD2B-85AC-4FCA-B607-AAD6C51E6799}</ProjectGuid>\r
- <OutputType>Library</OutputType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
- <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
- <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
- <NoStdLib>True</NoStdLib>\r
- \r
- <NoConfig>True</NoConfig>\r
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
- <AppDesignerFolder>Properties</AppDesignerFolder>\r
- <RootNamespace>\r
- </RootNamespace>\r
- <AssemblyName>Mono.Security.Providers.DotNet</AssemblyName>\r
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
- <FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <SignAssembly>true</SignAssembly>\r
- <DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugSymbols>true</DebugSymbols>\r
- <DebugType>full</DebugType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
- Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
- is a problem to compile the Mono mscorlib.dll -->\r
- <PropertyGroup>\r
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
- </PropertyGroup>\r
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
- <ItemGroup>\r
- <Compile Include="..\..\build\common\Consts.cs" />\r
- <Compile Include="..\..\build\common\Locale.cs" />\r
- <Compile Include=".\Mono.Security.Providers.DotNet\DotNetSslStreamImpl.cs" />\r
- <Compile Include=".\Mono.Security.Providers.DotNet\DotNetTlsProvider.cs" />\r
- <Compile Include=".\Properties\AssemblyInfo.cs" />\r </ItemGroup>\r
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
- Other similar extension points exist, see Microsoft.Common.targets.\r
- <Target Name="BeforeBuild">\r
- </Target>\r
- <Target Name="AfterBuild">\r
- </Target>\r
- -->\r
- <PropertyGroup>\r
- <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
- </PreBuildEvent>\r
- <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
- </PreBuildEvent>\r
- <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
- </PostBuildEvent>\r
- <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
- </PostBuildEvent>\r
- </PropertyGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="../corlib/corlib-net_4_x.csproj">\r
- <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
- <Name>corlib-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../System/System-net_4_x.csproj">\r
- <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
- <Name>System-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">\r
- <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
- <Name>Mono.Security-net_4_x</Name>\r
- </ProjectReference>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <Folder Include="Properties\" />\r
- </ItemGroup>\r
-</Project>\r
-
+++ /dev/null
-./Properties/AssemblyInfo.cs
-../../build/common/Consts.cs
-../../build/common/Locale.cs
-
-./Mono.Security.Providers.DotNet/DotNetTlsProvider.cs
-./Mono.Security.Providers.DotNet/DotNetSslStreamImpl.cs
+++ /dev/null
-//
-// DotNetSslStreamImpl.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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;
- }
- }
- }
-}
-
+++ /dev/null
-//
-// MonoDefaultTlsProvider.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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);
- }
-
- }
-}
-
+++ /dev/null
-//
-// AssemblyInfo.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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.DotNet.dll")]
-[assembly: AssemblyProduct ("MONO CLI")]
-[assembly: AssemblyTitle ("Mono.Security.Providers.DotNet.dll")]
-[assembly: CLSCompliant (true)]
-[assembly: ComVisible (false)]
-[assembly: NeutralResourcesLanguage ("en-US")]
-
+++ /dev/null
-See mcs/class/Mono.Security.Providers.NewSystemSource/README.md for a detailed README.
+++ /dev/null
-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
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <PropertyGroup>\r
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
- <ProductVersion>9.0.30729</ProductVersion>\r
- <SchemaVersion>2.0</SchemaVersion>\r
- <ProjectGuid>{0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}</ProjectGuid>\r
- <OutputType>Library</OutputType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
- <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
- <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
- <NoStdLib>True</NoStdLib>\r
- \r
- <NoConfig>True</NoConfig>\r
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
- <AppDesignerFolder>Properties</AppDesignerFolder>\r
- <RootNamespace>\r
- </RootNamespace>\r
- <AssemblyName>Mono.Security.Providers.NewSystemSource</AssemblyName>\r
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
- <FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <SignAssembly>true</SignAssembly>\r
- <DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugSymbols>true</DebugSymbols>\r
- <DebugType>full</DebugType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <Optimize>false</Optimize>\r
- <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>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <Optimize>true</Optimize>\r
- <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>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
- Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
- is a problem to compile the Mono mscorlib.dll -->\r
- <PropertyGroup>\r
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
- </PropertyGroup>\r
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
- <ItemGroup>\r
- <Compile Include="..\..\build\common\Consts.cs" />\r
- <Compile Include="..\..\build\common\Locale.cs" />\r
- <Compile Include="..\..\build\common\SR.cs" />\r
- <Compile Include="..\referencesource\mscorlib\InternalApis\NDP_Common\inc\PinnableBufferCache.cs" />\r
- <Compile Include="..\referencesource\System\net\System\Net\_LazyAsyncResult.cs" />\r
- <Compile Include="..\referencesource\System\net\System\Net\_LoggingObject.cs" />\r
- <Compile Include="..\referencesource\System\net\System\Net\_NTAuthentication.cs" />\r
- <Compile Include="..\referencesource\System\net\System\Net\_SecureChannel.cs" />\r
- <Compile Include="..\referencesource\System\net\System\Net\_SslSessionsCache.cs" />\r
- <Compile Include="..\referencesource\System\net\System\Net\Logging.cs" />\r
- <Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_FixedSizeReader.cs" />\r
- <Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_HelperAsyncResults.cs" />\r
- <Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_SslState.cs" />\r
- <Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_SslStream.cs" />\r
- <Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\SslStream.cs" />\r
- <Compile Include="..\System\Mono.Net.Security\CallbackHelpers.cs" />\r
- <Compile Include="..\System\Mono.Net.Security\IMonoTlsProvider.cs" />\r
- <Compile Include="..\System\Mono.Net.Security\MonoTlsProviderFactory.cs" />\r
- <Compile Include="..\System\Mono.Net.Security\MonoTlsProviderWrapper.cs" />\r
- <Compile Include="..\System\ReferenceSources\_SecureChannel.cs" />\r
- <Compile Include="..\System\ReferenceSources\_SslState.cs" />\r
- <Compile Include="..\System\ReferenceSources\_SslStream.cs" />\r
- <Compile Include="..\System\ReferenceSources\Internal.cs" />\r
- <Compile Include="..\System\ReferenceSources\SR.cs" />\r
- <Compile Include="..\System\ReferenceSources\SR2.cs" />\r
- <Compile Include="..\System\ReferenceSources\SslStream.cs" />\r
- <Compile Include="..\System\ReferenceSources\SSPIConfiguration.cs" />\r
- <Compile Include="..\System\ReferenceSources\SSPISafeHandles.cs" />\r
- <Compile Include="..\System\ReferenceSources\SSPIWrapper.cs" />\r
- <Compile Include=".\Properties\AssemblyInfo.cs" />\r </ItemGroup>\r
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
- Other similar extension points exist, see Microsoft.Common.targets.\r
- <Target Name="BeforeBuild">\r
- </Target>\r
- <Target Name="AfterBuild">\r
- </Target>\r
- -->\r
- <PropertyGroup>\r
- <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
- </PreBuildEvent>\r
- <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
- </PreBuildEvent>\r
- <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
- </PostBuildEvent>\r
- <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
- </PostBuildEvent>\r
- </PropertyGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="../corlib/corlib-net_4_x.csproj">\r
- <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
- <Name>corlib-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../System/System-net_4_x.csproj">\r
- <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
- <Name>System-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">\r
- <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
- <Name>Mono.Security-net_4_x</Name>\r
- <Aliases>MonoSecurity</Aliases> </ProjectReference>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <Folder Include="Properties\" />\r
- </ItemGroup>\r
-</Project>\r
-
+++ /dev/null
-./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
-
+++ /dev/null
-//
-// AssemblyInfo.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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")]
+++ /dev/null
-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>
-
-
+++ /dev/null
-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
-
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <PropertyGroup>\r
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
- <ProductVersion>9.0.30729</ProductVersion>\r
- <SchemaVersion>2.0</SchemaVersion>\r
- <ProjectGuid>{C8B8E524-BB3A-44E2-8C22-E3313E9F477C}</ProjectGuid>\r
- <OutputType>Library</OutputType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
- <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
- <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
- <NoStdLib>True</NoStdLib>\r
- \r
- <NoConfig>True</NoConfig>\r
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
- <AppDesignerFolder>Properties</AppDesignerFolder>\r
- <RootNamespace>\r
- </RootNamespace>\r
- <AssemblyName>Mono.Security.Providers.NewTls</AssemblyName>\r
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
- <FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <SignAssembly>true</SignAssembly>\r
- <DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugSymbols>true</DebugSymbols>\r
- <DebugType>full</DebugType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
- Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
- is a problem to compile the Mono mscorlib.dll -->\r
- <PropertyGroup>\r
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
- </PropertyGroup>\r
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
- <ItemGroup>\r
- <Compile Include="..\..\build\common\Consts.cs" />\r
- <Compile Include="..\..\build\common\Locale.cs" />\r
- <Compile Include="..\..\build\common\SR.cs" />\r
- <Compile Include=".\Mono.Security.Providers.NewTls\ITlsConfiguration.cs" />\r
- <Compile Include=".\Mono.Security.Providers.NewTls\ITlsContext.cs" />\r
- <Compile Include=".\Mono.Security.Providers.NewTls\MonoNewTlsStream.cs" />\r
- <Compile Include=".\Mono.Security.Providers.NewTls\MonoNewTlsStreamFactory.cs" />\r
- <Compile Include=".\Mono.Security.Providers.NewTls\NewTlsProvider.cs" />\r
- <Compile Include=".\Mono.Security.Providers.NewTls\TlsContextWrapper.cs" />\r
- <Compile Include=".\Mono.Security.Providers.NewTls\TlsProviderFactory.cs" />\r
- <Compile Include=".\Properties\AssemblyInfo.cs" />\r </ItemGroup>\r
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
- Other similar extension points exist, see Microsoft.Common.targets.\r
- <Target Name="BeforeBuild">\r
- </Target>\r
- <Target Name="AfterBuild">\r
- </Target>\r
- -->\r
- <PropertyGroup>\r
- <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
- </PreBuildEvent>\r
- <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
- </PreBuildEvent>\r
- <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
- </PostBuildEvent>\r
- <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
- </PostBuildEvent>\r
- </PropertyGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="../corlib/corlib-net_4_x.csproj">\r
- <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
- <Name>corlib-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../System/System-net_4_x.csproj">\r
- <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
- <Name>System-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">\r
- <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
- <Name>Mono.Security-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj">\r
- <Project>{0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}</Project>\r
- <Name>Mono.Security.Providers.NewSystemSource-net_4_x</Name>\r
- <Aliases>NewSystemSource</Aliases> </ProjectReference>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <Folder Include="Properties\" />\r
- </ItemGroup>\r
-</Project>\r
-
+++ /dev/null
-./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
+++ /dev/null
-//
-// ITlsContext.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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.
-
-using System;
-using System.Security.Cryptography;
-
-using Mono.Security.Interface;
-using MX = Mono.Security.X509;
-
-namespace Mono.Security.Providers.NewTls
-{
- interface ITlsConfiguration
- {
- bool HasCredentials {
- get;
- }
-
- void SetCertificate (MX.X509Certificate certificate, AsymmetricAlgorithm privateKey);
-
- bool? AskForClientCertificate {
- get; set;
- }
- }
-}
+++ /dev/null
-//
-// ITlsContext.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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.Security.Cryptography;
-
-using Mono.Security.Interface;
-using MX = Mono.Security.X509;
-
-namespace Mono.Security.Providers.NewTls
-{
- interface ITlsContext : IDisposable
- {
- bool IsValid {
- get;
- }
-
- TlsException LastError {
- get;
- }
-
- bool ReceivedCloseNotify {
- get;
- }
-
- MonoTlsConnectionInfo ConnectionInfo {
- get;
- }
-
- MX.X509Certificate GetRemoteCertificate (out MX.X509CertificateCollection remoteCertificateStore);
-
- bool VerifyRemoteCertificate ();
-
- int GenerateNextToken (TlsBuffer incoming, TlsMultiBuffer outgoing);
-
- int DecryptMessage (ref TlsBuffer incoming);
-
- int EncryptMessage (ref TlsBuffer incoming);
-
- byte[] CreateAlert (Alert alert);
-
- byte[] CreateHelloRequest ();
- }
-}
-
+++ /dev/null
-//
-// MonoNewTlsStream.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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; }
- }
- }
-}
-
-
+++ /dev/null
-//
-// MonoNewTlsStreamFactory.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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;
- }
- }
-}
+++ /dev/null
-//
-// NewTlsProvider.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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);
- }
- }
-}
-
+++ /dev/null
-//
-// TlsContextWrapper.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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 ();
- }
- }
-}
-
+++ /dev/null
-//
-// TlsProviderFactory.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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 });
- }
- }
-}
+++ /dev/null
-//
-// AssemblyInfo.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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")]
+++ /dev/null
-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
+++ /dev/null
-#include mobile_Mono.Security.Providers.NewTls.dll.sources
+++ /dev/null
-thisdir = class/Mono.Security.Providers.OldTls
-SUBDIRS =
-include ../../build/rules.make
-
-LIBRARY = Mono.Security.Providers.OldTls.dll
-LIB_REFS = System Mono.Security
-LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY_DEP
-
-include ../../build/library.make
-
-$(the_lib): ../Mono.Security/Makefile
-
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <PropertyGroup>\r
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
- <ProductVersion>9.0.30729</ProductVersion>\r
- <SchemaVersion>2.0</SchemaVersion>\r
- <ProjectGuid>{E485E885-59B1-4081-BC66-56AAAFD8771A}</ProjectGuid>\r
- <OutputType>Library</OutputType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
- <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
- <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
- <NoStdLib>True</NoStdLib>\r
- \r
- <NoConfig>True</NoConfig>\r
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
- <AppDesignerFolder>Properties</AppDesignerFolder>\r
- <RootNamespace>\r
- </RootNamespace>\r
- <AssemblyName>Mono.Security.Providers.OldTls</AssemblyName>\r
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
- <FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <SignAssembly>true</SignAssembly>\r
- <DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugSymbols>true</DebugSymbols>\r
- <DebugType>full</DebugType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,1030</NoWarn>\r
- <Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
- Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
- is a problem to compile the Mono mscorlib.dll -->\r
- <PropertyGroup>\r
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
- </PropertyGroup>\r
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
- <ItemGroup>\r
- <Compile Include="..\..\build\common\Consts.cs" />\r
- <Compile Include="..\..\build\common\Locale.cs" />\r
- <Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Cryptography\MD5SHA1.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Cryptography\TlsHMAC.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientCertificate.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientCertificateVerify.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientFinished.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientHello.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientKeyExchange.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerCertificate.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerCertificateRequest.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerFinished.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerHello.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerHelloDone.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerKeyExchange.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientCertificate.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientCertificateVerify.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientFinished.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientHello.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientKeyExchange.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerCertificate.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerCertificateRequest.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerFinished.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerHello.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerHelloDone.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerKeyExchange.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake\ClientCertificateType.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake\HandshakeMessage.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake\HandshakeType.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\Alert.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherAlgorithmType.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherSuite.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherSuiteCollection.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherSuiteFactory.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ClientContext.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ClientRecordProtocol.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ClientSessionCache.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ContentType.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\Context.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\DebugHelper.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ExchangeAlgorithmType.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\HandshakeState.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\HashAlgorithmType.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\HttpsClientStream.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\RecordProtocol.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\RSASslSignatureDeformatter.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\RSASslSignatureFormatter.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SecurityCompressionType.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SecurityParameters.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SecurityProtocolType.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ServerContext.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ServerRecordProtocol.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslCipherSuite.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslClientStream.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslHandshakeHash.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslServerStream.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslStreamBase.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsCipherSuite.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsClientSettings.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsException.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsServerSettings.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsStream.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\AuthorityKeyIdentifierExtension.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\ExtendedKeyUsageExtension.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\GeneralNames.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\NetscapeCertTypeExtension.cs" />\r
- <Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\SubjectAltNameExtension.cs" />\r
- <Compile Include="..\System\Mono.Net.Security\LegacySslStream.cs" />\r
- <Compile Include=".\Mono.Security.Providers.OldTls\OldTlsProvider.cs" />\r
- <Compile Include=".\Properties\AssemblyInfo.cs" />\r </ItemGroup>\r
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
- Other similar extension points exist, see Microsoft.Common.targets.\r
- <Target Name="BeforeBuild">\r
- </Target>\r
- <Target Name="AfterBuild">\r
- </Target>\r
- -->\r
- <PropertyGroup>\r
- <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
- </PreBuildEvent>\r
- <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
- </PreBuildEvent>\r
- <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
- </PostBuildEvent>\r
- <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
- </PostBuildEvent>\r
- </PropertyGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="../corlib/corlib-net_4_x.csproj">\r
- <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
- <Name>corlib-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../System/System-net_4_x.csproj">\r
- <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
- <Name>System-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">\r
- <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
- <Name>Mono.Security-net_4_x</Name>\r
- </ProjectReference>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <Folder Include="Properties\" />\r
- </ItemGroup>\r
-</Project>\r
-
+++ /dev/null
-./Properties/AssemblyInfo.cs
-../../build/common/Consts.cs
-../../build/common/Locale.cs
-../../build/common/MonoTODOAttribute.cs
-
-./Mono.Security.Providers.OldTls/OldTlsProvider.cs
-../System/Mono.Net.Security/LegacySslStream.cs
-
-../Mono.Security/Mono.Security.Cryptography/MD5SHA1.cs
-../Mono.Security/Mono.Security.Cryptography/TlsHMAC.cs
-../Mono.Security/Mono.Security.Protocol.Tls/Alert.cs
-../Mono.Security/Mono.Security.Protocol.Tls/CipherAlgorithmType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/CipherSuite.cs
-../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteCollection.cs
-../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteFactory.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ClientContext.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ClientSessionCache.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ContentType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/Context.cs
-../Mono.Security/Mono.Security.Protocol.Tls/DebugHelper.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/HandshakeState.cs
-../Mono.Security/Mono.Security.Protocol.Tls/HashAlgorithmType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs
-../Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs
-../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs
-../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SecurityCompressionType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SecurityParameters.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SecurityProtocolType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ServerContext.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SslCipherSuite.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SslHandshakeHash.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs
-../Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuite.cs
-../Mono.Security/Mono.Security.Protocol.Tls/TlsClientSettings.cs
-../Mono.Security/Mono.Security.Protocol.Tls/TlsException.cs
-../Mono.Security/Mono.Security.Protocol.Tls/TlsServerSettings.cs
-../Mono.Security/Mono.Security.Protocol.Tls/TlsStream.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs
-../Mono.Security/Mono.Security.X509.Extensions/AuthorityKeyIdentifierExtension.cs
-../Mono.Security/Mono.Security.X509.Extensions/ExtendedKeyUsageExtension.cs
-../Mono.Security/Mono.Security.X509.Extensions/GeneralNames.cs
-../Mono.Security/Mono.Security.X509.Extensions/NetscapeCertTypeExtension.cs
-../Mono.Security/Mono.Security.X509.Extensions/SubjectAltNameExtension.cs
+++ /dev/null
-//
-// OldTlsProvider.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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 ();
- }
- }
-}
-
+++ /dev/null
-//
-// AssemblyInfo.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// 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.OldTls.dll")]
-[assembly: AssemblyProduct ("MONO CLI")]
-[assembly: AssemblyTitle ("Mono.Security.Providers.OldTls.dll")]
-[assembly: CLSCompliant (true)]
-[assembly: ComVisible (false)]
-[assembly: NeutralResourcesLanguage ("en-US")]
-
[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")]
get; set;
}
+ public string PeerDomainName {
+ get; set;
+ }
+
public override string ToString ()
{
return string.Format ("[MonoTlsConnectionInfo: {0}:{1}]", ProtocolVersion, CipherSuiteCode);
+++ /dev/null
-Test/App.config
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<configuration>
+ <connectionStrings>
+ <add name="test-connstring"
+ connectionString="Server=(local);Initial Catalog=someDb;User Id=someUser;Password=somePassword;Application Name=someAppName;Min Pool Size=5;Max Pool Size=500;Connect Timeout=10;Connection Lifetime=29;" />
+ </connectionStrings>
+ <appSettings file="Test/appSettings.config" />
+</configuration>
}
#endif
-#if !MOBILE
public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity)
: base (direction, bufferSize)
{
if (direction == PipeDirection.InOut)
throw new NotSupportedException ("Anonymous pipe direction can only be either in or out.");
+#if MOBILE
+ throw new NotImplementedException ();
+#else
if (IsWindows)
impl = new Win32AnonymousPipeServer (this, direction, inheritability, bufferSize, pipeSecurity);
else
InitializeHandle (impl.Handle, false, false);
IsConnected = true;
- }
#endif
+ }
[MonoTODO]
public AnonymousPipeServerStream (PipeDirection direction, SafePipeHandle serverSafePipeHandle, SafePipeHandle clientSafePipeHandle)
#endif
}
-#if !MOBILE
public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
: base (ToDirection (desiredAccessRights), DefaultBufferSize)
{
if (impersonationLevel != TokenImpersonationLevel.None ||
inheritability != HandleInheritability.None)
throw ThrowACLException ();
-
+#if MOBILE
+ throw new NotImplementedException ();
+#else
if (IsWindows)
impl = new Win32NamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
else
impl = new UnixNamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
- }
#endif
+ }
+
~NamedPipeClientStream () {
Dispose (false);
}
throw new NotImplementedException ();
}
+ protected override internal void CheckPipePropertyOperations () {
+ base.CheckPipePropertyOperations();
+ }
+
public int NumberOfServerInstances {
get {
CheckPipePropertyOperations ();
}
#endif
-#if !MOBILE
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity)
: this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, HandleInheritability.None)
{
{
var rights = ToAccessRights (direction) | additionalAccessRights;
// FIXME: reject some rights declarations (for ACL).
-
+#if MOBILE
+ throw new NotImplementedException ();
+#else
if (IsWindows)
impl = new Win32NamedPipeServer (this, pipeName, maxNumberOfServerInstances, transmissionMode,
rights, options, inBufferSize, outBufferSize,
rights, options, inBufferSize, outBufferSize, inheritability);
InitializeHandle (impl.Handle, false, (options & PipeOptions.Asynchronous) != PipeOptions.None);
- }
#endif
+ }
public NamedPipeServerStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle)
: base (direction, DefaultBufferSize)
impl.Disconnect ();
}
-#if !MOBILE
[MonoTODO]
[SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)]
public void RunAsClient (PipeStreamImpersonationWorker impersonationWorker)
{
throw new NotImplementedException ();
}
-#endif
public void WaitForConnection ()
{
throw new NotImplementedException ();
}
-#if !MOBILE
// async operations
Action wait_connect_delegate;
{
wait_connect_delegate.EndInvoke (asyncResult);
}
-#endif
}
}
return new NotImplementedException ("ACL is not supported in Mono");
}
-#if !MOBILE
internal static PipeAccessRights ToAccessRights (PipeDirection direction)
{
switch (direction) {
throw new ArgumentOutOfRangeException ();
}
}
-#endif
protected PipeStream (PipeDirection direction, int bufferSize)
: this (direction, PipeTransmissionMode.Byte, bufferSize)
set { stream = value; }
}
-#if !MOBILE
protected bool IsHandleExposed { get; private set; }
-#endif
[MonoTODO]
public bool IsMessageComplete { get; private set; }
}
// initialize/dispose/state check
-#if MOBILE
- internal static void CheckPipePropertyOperations ()
- {
- }
-
- static void CheckReadOperations ()
- {
- }
- static void CheckWriteOperations ()
- {
- }
-#else
[MonoTODO]
protected internal virtual void CheckPipePropertyOperations ()
{
this.IsHandleExposed = isExposed;
this.IsAsync = isAsync;
}
-#endif
protected override void Dispose (bool disposing)
{
throw new NotSupportedException ();
}
-#if !MOBILE
public PipeSecurity GetAccessControl ()
{
+#if MOBILE
+ throw new PlatformNotSupportedException ();
+#else
return new PipeSecurity (SafePipeHandle,
AccessControlSections.Owner |
AccessControlSections.Group |
AccessControlSections.Access);
+#endif
}
public void SetAccessControl (PipeSecurity pipeSecurity)
{
+#if MOBILE
+ throw new PlatformNotSupportedException ();
+#else
if (pipeSecurity == null)
throw new ArgumentNullException ("pipeSecurity");
pipeSecurity.Persist (SafePipeHandle);
- }
#endif
+ }
// pipe I/O
// async
-#if !MOBILE
Func<byte [],int,int,int> read_delegate;
[HostProtection (SecurityAction.LinkDemand, ExternalThreading = true)]
{
write_delegate.EndInvoke (asyncResult);
}
-#endif
}
}
[TestFixture]
public class DataTableReadWriteXmlTest
{
- public static readonly string EOL = Environment.NewLine;
void StandardizeXmlFormat(ref string xml)
{
// Get XML for DataSet writes.
sw.GetStringBuilder().Length = 0;
ds.WriteXml(sw);
- string xmlDSNone = sw.ToString().Replace ("\n", EOL);
+ string xmlDSNone = sw.ToString();
sw.GetStringBuilder().Length = 0;
ds.WriteXml(sw, XmlWriteMode.DiffGram);
- string xmlDSDiffGram = sw.ToString().Replace ("\n", EOL);
+ string xmlDSDiffGram = sw.ToString();
sw.GetStringBuilder().Length = 0;
ds.WriteXml(sw, XmlWriteMode.WriteSchema);
sw.GetStringBuilder().Length = 0;
ds.WriteXml(sw);
- xmlDSNone = sw.ToString().Replace ("\n", EOL);
+ xmlDSNone = sw.ToString();
sw.GetStringBuilder().Length = 0;
ds.WriteXml(sw, XmlWriteMode.DiffGram);
- xmlDSDiffGram = sw.ToString().Replace ("\n", EOL);
+ xmlDSDiffGram = sw.ToString();
sw.GetStringBuilder().Length = 0;
ds.WriteXml(sw, XmlWriteMode.WriteSchema);
string TextString = GetNormalizedSchema (writer.ToString ());
//string TextString = writer.ToString ();
- EOL = "\n";
string substring = TextString.Substring (0, TextString.IndexOf (EOL));
TextString = TextString.Substring (TextString.IndexOf (EOL) + EOL.Length);
Assert.AreEqual ("<?xml version=\"1.0\" encoding=\"utf-16\"?>", substring, "test#01");
StringWriter sw = new StringWriter ();
XmlTextWriter xw = new XmlTextWriter (sw);
Doc.DataSet.WriteXml (xw);
- string s = sw.ToString ();
+ string s = sw.ToString ().Replace ("\r", "").Replace ("\n", Environment.NewLine);
Assert.AreEqual (xml, s, "#1");
- Assert.AreEqual (xml, Doc.InnerXml, "#2");
+ Assert.AreEqual (xml, Doc.InnerXml.Replace ("\r", "").Replace ("\n", Environment.NewLine), "#2");
Assert.AreEqual ("EndOfFile", Reader.ReadState.ToString (), "test#01");
DataSet Set = Doc.DataSet;
string SetAlPath (ProcessStartInfo info)
{
if (RuntimeHelpers.RunningOnWindows) {
- info.FileName = MonoExeLocator.MonoPath;
- return MonoExeLocator.AlPath + " ";
+ info.FileName = MonoToolsLocator.Mono;
+ return MonoToolsLocator.AssemblyLinker + " ";
} else {
- info.FileName = MonoExeLocator.AlPath;
+ info.FileName = MonoToolsLocator.AssemblyLinker;
return String.Empty;
}
}
if (Assembly.GetEntryAssembly () == null)
throw new NotSupportedException ("The method 'Restart' is not supported by this application type.");
- string mono_path = MonoExeLocator.MonoPath;
+ string mono_path = MonoToolsLocator.Mono;
//Get command line arguments
StringBuilder argsBuilder = new StringBuilder ();
serializer.Serialize (writer, obj);
writer.Close ();
- Assert.AreEqual (@"<?xml version=""1.0"" encoding=""utf-16""?>
-<Bug594490Class xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xml:lang=""hello world"" />",
+ Assert.AreEqual (@"<?xml version=""1.0"" encoding=""utf-16""?>" + Environment.NewLine +
+ @"<Bug594490Class xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xml:lang=""hello world"" />",
writer.ToString (),
"Novell bug #594490 (https://bugzilla.novell.com/show_bug.cgi?id=594490) not fixed.");
}
[assembly: StringFreezing]
[assembly: DefaultDependency (LoadHint.Always)]
- [assembly: InternalsVisibleTo ("Mono.Security.Providers.NewSystemSource, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
- [assembly: InternalsVisibleTo ("Mono.Security.Providers.OldTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
- [assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
- [assembly: InternalsVisibleTo ("Mono.Security.Providers.DotNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
[assembly: InternalsVisibleTo ("Mono.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
- [assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")]
// FIXME: these lines had better be platform independent.
if (Path.DirectorySeparatorChar == '\\') {
- mcs.StartInfo.FileName = MonoExeLocator.MonoPath;
- mcs.StartInfo.Arguments = "\"" + MonoExeLocator.McsPath + "\" ";
+ mcs.StartInfo.FileName = MonoToolsLocator.Mono;
+ mcs.StartInfo.Arguments = "\"" + MonoToolsLocator.CSharpCompiler + "\" ";
} else {
- mcs.StartInfo.FileName = MonoExeLocator.McsPath;
+ mcs.StartInfo.FileName = MonoToolsLocator.CSharpCompiler;
}
mcs.StartInfo.Arguments += BuildArgs (options, fileNames, ProviderOptions);
string[] vbnc_output_lines;
// FIXME: these lines had better be platform independent.
if (Path.DirectorySeparatorChar == '\\') {
- vbnc.StartInfo.FileName = MonoExeLocator.MonoPath;
- vbnc.StartInfo.Arguments = MonoExeLocator.VbncPath + ' ' + BuildArgs (options, fileNames);
+ vbnc.StartInfo.FileName = MonoToolsLocator.Mono;
+ vbnc.StartInfo.Arguments = MonoToolsLocator.VBCompiler + ' ' + BuildArgs (options, fileNames);
} else {
- vbnc.StartInfo.FileName = MonoExeLocator.VbncPath;
+ vbnc.StartInfo.FileName = MonoToolsLocator.VBCompiler;
vbnc.StartInfo.Arguments = BuildArgs (options, fileNames);
}
//Console.WriteLine (vbnc.StartInfo.Arguments);
static IMonoTlsProvider CreateDefaultProvider ()
{
#if SECURITY_DEP
- MSI.MonoTlsProvider provider = null;
-#if MONO_FEATURE_NEW_SYSTEM_SOURCE
- /*
- * This is a hack, which is used in the Mono.Security.Providers.NewSystemSource
- * assembly, which will provide a "fake" System.dll. Use the public Mono.Security
- * API to get the "real" System.dll's provider via reflection, then wrap it with
- * the "fake" version's perceived view.
- *
- * NewSystemSource needs to compile MonoTlsProviderFactory.cs, IMonoTlsProvider.cs,
- * MonoTlsProviderWrapper.cs and CallbackHelpers.cs from this directory and only these.
- */
- provider = MSI.MonoTlsProviderFactory.GetProvider ();
-#else
- provider = CreateDefaultProviderImpl ();
-#endif
+ MSI.MonoTlsProvider provider = CreateDefaultProviderImpl ();
if (provider != null)
return new Private.MonoTlsProviderWrapper (provider);
#endif
#endregion
-#if SECURITY_DEP && !MONO_FEATURE_NEW_SYSTEM_SOURCE
+#if SECURITY_DEP
static Dictionary<string,string> providerRegistration;
return;
providerRegistration = new Dictionary<string,string> ();
providerRegistration.Add ("legacy", "Mono.Net.Security.Private.MonoLegacyTlsProvider");
- providerRegistration.Add ("newtls", "Mono.Security.Providers.NewTls.NewTlsProvider, Mono.Security.Providers.NewTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
- providerRegistration.Add ("oldtls", "Mono.Security.Providers.OldTls.OldTlsProvider, Mono.Security.Providers.OldTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
#if HAVE_BTLS
if (Mono.Btls.MonoBtlsProvider.IsSupported ())
providerRegistration.Add ("btls", "Mono.Btls.MonoBtlsProvider");
+++ /dev/null
-//
-// Internal.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 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.Runtime.InteropServices;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Net.Security
-{
- //From Schannel.h
- [Flags]
- internal enum SchProtocols
- {
- Zero = 0,
- PctClient = 0x00000002,
- PctServer = 0x00000001,
- Pct = (PctClient | PctServer),
- Ssl2Client = 0x00000008,
- Ssl2Server = 0x00000004,
- Ssl2 = (Ssl2Client | Ssl2Server),
- Ssl3Client = 0x00000020,
- Ssl3Server = 0x00000010,
- Ssl3 = (Ssl3Client | Ssl3Server),
- Tls10Client = 0x00000080,
- Tls10Server = 0x00000040,
- Tls10 = (Tls10Client | Tls10Server),
- Tls11Client = 0x00000200,
- Tls11Server = 0x00000100,
- Tls11 = (Tls11Client | Tls11Server),
- Tls12Client = 0x00000800,
- Tls12Server = 0x00000400,
- Tls12 = (Tls12Client | Tls12Server),
- Ssl3Tls = (Ssl3 | Tls10),
- UniClient = unchecked((int)0x80000000),
- UniServer = 0x40000000,
- Unified = (UniClient | UniServer),
- ClientMask = (PctClient | Ssl2Client | Ssl3Client | Tls10Client | Tls11Client | Tls12Client | UniClient),
- ServerMask = (PctServer | Ssl2Server | Ssl3Server | Tls10Server | Tls11Server | Tls12Server | UniServer)
- }
-
- //From Schannel.h
- [StructLayout (LayoutKind.Sequential)]
- internal class SslConnectionInfo
- {
- public readonly int Protocol;
- public readonly int DataCipherAlg;
- public readonly int DataKeySize;
- public readonly int DataHashAlg;
- public readonly int DataHashKeySize;
- public readonly int KeyExchangeAlg;
- public readonly int KeyExchKeySize;
-
- internal SslConnectionInfo (int protocol)
- {
- Protocol = protocol;
- }
- }
-}
+++ /dev/null
-//
-// SSPIConfiguration.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 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 MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-using MonoSecurity::Mono.Security.Interface;
-#else
-using Mono.Security.Interface;
-#endif
-using Mono.Net.Security;
-
-namespace System.Net.Security
-{
- internal interface SSPIConfiguration
- {
- IMonoTlsProvider Provider {
- get;
- }
-
- MonoTlsSettings Settings {
- get;
- }
-
- IMonoTlsEventSink EventSink {
- get;
- }
- }
-}
-#endif
+++ /dev/null
-//
-// SafeHandles.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 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 MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-using IMonoTlsContext = MonoSecurity::Mono.Security.Interface.IMonoTlsContext;
-#else
-using IMonoTlsContext = Mono.Security.Interface.IMonoTlsContext;
-#endif
-
-using System.Runtime.InteropServices;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Net.Security
-{
- class DummySafeHandle : SafeHandle
- {
- protected DummySafeHandle ()
- : base ((IntPtr)(-1), true)
- {
- }
-
- protected override bool ReleaseHandle ()
- {
- return true;
- }
-
- public override bool IsInvalid {
- get { return handle == (IntPtr)(-1); }
- }
- }
-
- class SafeFreeCertContext : DummySafeHandle
- {
- }
-
- class SafeFreeCredentials : DummySafeHandle
- {
- SecureCredential credential;
-
- public X509Certificate2 Certificate {
- get {
- if (IsInvalid)
- throw new ObjectDisposedException ("Certificate");
- return credential.certificate;
- }
- }
-
- public SafeFreeCredentials (SecureCredential credential)
- {
- this.credential = credential;
- bool success = true;
- DangerousAddRef (ref success);
- }
-
- public override bool IsInvalid {
- get {
- return credential.certificate == null;
- }
- }
-
- protected override bool ReleaseHandle ()
- {
- credential.Clear ();
- return base.ReleaseHandle ();
- }
- }
-
- class SafeDeleteContext : DummySafeHandle
- {
- IMonoTlsContext context;
-
- public IMonoTlsContext Context {
- get {
- if (IsInvalid)
- throw new ObjectDisposedException ("TlsContext");
- return context;
- }
- }
-
- public SafeDeleteContext (IMonoTlsContext context)
- {
- this.context = context;
- }
-
- public override bool IsInvalid {
- get {
- return context == null || !context.IsValid;
- }
- }
-
- protected override bool ReleaseHandle ()
- {
- context.Dispose ();
- context = null;
- return base.ReleaseHandle ();
- }
- }
-
- struct SecureCredential
- {
- public const int CurrentVersion = 0x4;
-
- [Flags]
- public enum Flags
- {
- Zero = 0,
- NoSystemMapper = 0x02,
- NoNameCheck = 0x04,
- ValidateManual = 0x08,
- NoDefaultCred = 0x10,
- ValidateAuto = 0x20,
- SendAuxRecord = 0x00200000,
- UseStrongCrypto = 0x00400000
- }
-
- int version;
- internal X509Certificate2 certificate;
- SchProtocols protocols;
- EncryptionPolicy policy;
-
- public SecureCredential (int version, X509Certificate2 certificate, SecureCredential.Flags flags, SchProtocols protocols, EncryptionPolicy policy)
- {
- this.version = version;
- this.certificate = certificate;
- this.protocols = protocols;
- this.policy = policy;
- }
-
- public void Clear ()
- {
- certificate = null;
- }
- }
-
- internal class SafeCredentialReference : DummySafeHandle
- {
- //
- // Static cache will return the target handle if found the reference in the table.
- //
- internal SafeFreeCredentials _Target;
-
- //
- //
- internal static SafeCredentialReference CreateReference (SafeFreeCredentials target)
- {
- SafeCredentialReference result = new SafeCredentialReference (target);
- if (result.IsInvalid)
- return null;
-
- return result;
- }
-
- private SafeCredentialReference (SafeFreeCredentials target)
- : base ()
- {
- // Bumps up the refcount on Target to signify that target handle is statically cached so
- // its dispose should be postponed
- bool b = false;
- try {
- target.DangerousAddRef (ref b);
- } catch {
- if (b) {
- target.DangerousRelease ();
- b = false;
- }
- } finally {
- if (b) {
- _Target = target;
- SetHandle (new IntPtr (0)); // make this handle valid
- }
- }
- }
-
- override protected bool ReleaseHandle ()
- {
- SafeFreeCredentials target = _Target;
- if (target != null)
- target.DangerousRelease ();
- _Target = null;
- return true;
- }
- }
-
-}
-#endif
+++ /dev/null
-//
-// SSPIWrapper.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 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 MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-#endif
-
-#if MONO_SECURITY_ALIAS
-using MX = MonoSecurity::Mono.Security.X509;
-using MonoSecurity::Mono.Security.Interface;
-#else
-using MX = Mono.Security.X509;
-using Mono.Security.Interface;
-#endif
-
-using System.Runtime.InteropServices;
-using System.Security.Authentication.ExtendedProtection;
-using System.Security.Cryptography.X509Certificates;
-using MNS = Mono.Net.Security;
-
-namespace System.Net.Security
-{
- internal class SSPIInterface
- {
- public IMonoTlsContext Context {
- get;
- private set;
- }
-
- public IMonoTlsEventSink EventSink {
- get;
- private set;
- }
-
- public SSPIInterface (IMonoTlsContext context, IMonoTlsEventSink eventSink)
- {
- Context = context;
- EventSink = eventSink;
- }
- }
-
- internal static class GlobalSSPI
- {
- internal static SSPIInterface Create (string hostname, bool serverMode, SchProtocols protocolFlags, X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
- bool remoteCertRequired, bool checkCertName, bool checkCertRevocationStatus, EncryptionPolicy encryptionPolicy,
- LocalCertSelectionCallback certSelectionDelegate, RemoteCertValidationCallback remoteValidationCallback, SSPIConfiguration userConfig)
- {
- if (userConfig.Settings != null && remoteValidationCallback != null)
- throw new InvalidOperationException ();
- var context = userConfig.Provider.CreateTlsContext (
- hostname, serverMode, (TlsProtocols)protocolFlags, serverCertificate, clientCertificates,
- remoteCertRequired, checkCertName, checkCertRevocationStatus,
- (MonoEncryptionPolicy)encryptionPolicy, userConfig.Settings);
- return new SSPIInterface (context, userConfig.EventSink);
- }
- }
-
- /*
- * SSPIWrapper _is a _class that provides a managed implementation of the equivalent
- * _class _in Microsofts .NET Framework.
- *
- * The SSPIWrapper class is used by the TLS/SSL stack to implement both the
- * protocol handshake as well as the encryption and decryption of messages.
- *
- * Microsoft's implementation of this class is merely a P/Invoke wrapper
- * around the native SSPI APIs on Windows. This implementation instead,
- * provides a managed implementation that uses the cross platform Mono.Security
- * to provide the equivalent functionality.
- *
- * Ideally, this should be abstracted with a different name, and decouple
- * the naming from the SSPIWrapper name, but this allows Mono to reuse
- * the .NET code with minimal changes.
- *
- * The "internal" methods here are the API that is consumed by the class
- * libraries.
- */
- internal static class SSPIWrapper
- {
- static void SetCredentials (SSPIInterface secModule, SafeFreeCredentials credentials)
- {
- if (credentials != null && !credentials.IsInvalid) {
- if (!secModule.Context.HasCredentials && credentials.Certificate != null) {
- var cert = new X509Certificate2 (credentials.Certificate.RawData);
- secModule.Context.SetCertificate (cert, credentials.Certificate.PrivateKey);
- }
- bool success = true;
- credentials.DangerousAddRef (ref success);
- }
- }
-
- /*
- * @safecontext is null on the first use, but it will become non-null for invocations
- * where the connection is being re-negotiated.
- *
- */
- internal static int AcceptSecurityContext (SSPIInterface secModule, ref SafeFreeCredentials credentials, ref SafeDeleteContext safeContext, ContextFlags inFlags, Endianness endianness, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, ref ContextFlags outFlags)
- {
- if (endianness != Endianness.Native)
- throw new NotSupportedException ();
-
- if (safeContext == null) {
- if (credentials == null || credentials.IsInvalid)
- return (int)SecurityStatus.CredentialsNeeded;
-
- secModule.Context.Initialize (secModule.EventSink);
- safeContext = new SafeDeleteContext (secModule.Context);
- }
-
- SetCredentials (secModule, credentials);
-
- var incoming = GetInputBuffer (inputBuffer);
- IBufferOffsetSize outgoing;
-
- var retval = (int)safeContext.Context.GenerateNextToken (incoming, out outgoing);
- UpdateOutput (outgoing, outputBuffer);
- return retval;
- }
-
- internal static int InitializeSecurityContext (SSPIInterface secModule, ref SafeFreeCredentials credentials, ref SafeDeleteContext safeContext, string targetName, ContextFlags inFlags, Endianness endianness, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, ref ContextFlags outFlags)
- {
- if (inputBuffer != null)
- throw new InvalidOperationException ();
-
- if (safeContext == null) {
- secModule.Context.Initialize (secModule.EventSink);
- safeContext = new SafeDeleteContext (secModule.Context);
- }
-
- return InitializeSecurityContext (secModule, credentials, ref safeContext, targetName, inFlags, endianness, null, outputBuffer, ref outFlags);
- }
-
- internal static int InitializeSecurityContext (SSPIInterface secModule, SafeFreeCredentials credentials, ref SafeDeleteContext safeContext, string targetName, ContextFlags inFlags, Endianness endianness, SecurityBuffer[] inputBuffers, SecurityBuffer outputBuffer, ref ContextFlags outFlags)
- {
- if (endianness != Endianness.Native)
- throw new NotSupportedException ();
-
- SetCredentials (secModule, credentials);
-
- SecurityBuffer inputBuffer = null;
- if (inputBuffers != null) {
- if (inputBuffers.Length != 2 || inputBuffers [1].type != BufferType.Empty)
- throw new NotSupportedException ();
- inputBuffer = inputBuffers [0];
- }
-
- var incoming = GetInputBuffer (inputBuffer);
- IBufferOffsetSize outgoing = null;
-
- var retval = (int)safeContext.Context.GenerateNextToken (incoming, out outgoing);
- UpdateOutput (outgoing, outputBuffer);
- return retval;
- }
-
- internal static int EncryptMessage (SSPIInterface secModule, SafeDeleteContext safeContext, SecurityBuffer securityBuffer, uint sequenceNumber)
- {
- var incoming = GetInputBuffer (securityBuffer);
- var retval = (int)safeContext.Context.EncryptMessage (ref incoming);
- UpdateOutput (incoming, securityBuffer);
- return retval;
- }
-
- internal static int DecryptMessage (SSPIInterface secModule, SafeDeleteContext safeContext, SecurityBuffer securityBuffer, uint sequenceNumber)
- {
- var incoming = GetInputBuffer (securityBuffer);
- var retval = (int)safeContext.Context.DecryptMessage (ref incoming);
- UpdateOutput (incoming, securityBuffer);
- return retval;
- }
-
- internal static byte[] CreateShutdownMessage (SSPIInterface secModule, SafeDeleteContext safeContext)
- {
- return safeContext.Context.CreateCloseNotify ();
- }
-
- internal static byte[] CreateHelloRequestMessage (SSPIInterface secModule, SafeDeleteContext safeContext)
- {
- return safeContext.Context.CreateHelloRequest ();
- }
-
- internal static bool IsClosed (SSPIInterface secModule, SafeDeleteContext safeContext)
- {
- return safeContext.Context.ReceivedCloseNotify;
- }
-
- internal static SafeFreeCredentials AcquireCredentialsHandle (SSPIInterface SecModule, string package, CredentialUse intent, SecureCredential scc)
- {
- return new SafeFreeCredentials (scc);
- }
-
- public static ChannelBinding QueryContextChannelBinding (SSPIInterface SecModule, SafeDeleteContext securityContext, ContextAttribute contextAttribute)
- {
- return null;
- }
-
- internal static X509Certificate2 GetRemoteCertificate (SafeDeleteContext safeContext, out X509Certificate2Collection remoteCertificateStore)
- {
- X509CertificateCollection monoCollection;
- if (safeContext == null || safeContext.IsInvalid) {
- remoteCertificateStore = null;
- return null;
- }
- var monoCert = safeContext.Context.GetRemoteCertificate (out monoCollection);
- if (monoCert == null) {
- remoteCertificateStore = null;
- return null;
- }
-
- remoteCertificateStore = new X509Certificate2Collection ();
- foreach (var cert in monoCollection) {
- remoteCertificateStore.Add (cert);
- }
- return (X509Certificate2)monoCert;
- }
-
- internal static bool CheckRemoteCertificate (SafeDeleteContext safeContext)
- {
- return safeContext.Context.VerifyRemoteCertificate ();
- }
-
- internal static MonoTlsConnectionInfo GetMonoConnectionInfo (SSPIInterface SecModule, SafeDeleteContext securityContext)
- {
- return securityContext.Context.GetConnectionInfo ();
- }
-
- internal static SslConnectionInfo GetConnectionInfo (SSPIInterface SecModule, SafeDeleteContext securityContext)
- {
- var info = securityContext.Context.GetConnectionInfo ();
- if (info == null)
- return null;
-
- return new SslConnectionInfo ((int)info.ProtocolVersion);
- }
-
- class InputBuffer : IBufferOffsetSize
- {
- public byte[] Buffer {
- get;
- private set;
- }
-
- public int Offset {
- get;
- private set;
- }
-
- public int Size {
- get;
- private set;
- }
-
- public InputBuffer (byte[] buffer, int offset, int size)
- {
- Buffer = buffer;
- Offset = offset;
- Size = size;
- }
- }
-
- static IBufferOffsetSize GetInputBuffer (SecurityBuffer incoming)
- {
- return incoming != null ? new InputBuffer (incoming.token, incoming.offset, incoming.size) : null;
- }
-
- static void UpdateOutput (IBufferOffsetSize buffer, SecurityBuffer outputBuffer)
- {
- if (buffer != null) {
- outputBuffer.token = buffer.Buffer;
- outputBuffer.offset = buffer.Offset;
- outputBuffer.size = buffer.Size;
- outputBuffer.type = BufferType.Token;
- } else {
- outputBuffer.token = null;
- outputBuffer.size = outputBuffer.offset = 0;
- outputBuffer.type = BufferType.Empty;
- }
- }
- }
-}
-#endif
+++ /dev/null
-//
-// Mono-specific additions to Microsoft's SslStream.cs
-//
-#if MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-using MonoSecurity::Mono.Security.Interface;
-#else
-using Mono.Security.Interface;
-#endif
-using System.Threading;
-using System.Security.Cryptography.X509Certificates;
-using MNS = Mono.Net.Security;
-
-namespace System.Net.Security
-{
- using System.Net.Sockets;
- using System.IO;
-
- partial class SslStream : IMonoTlsEventSink
- {
- #if SECURITY_DEP
- SSPIConfiguration _Configuration;
-
- internal SslStream (Stream innerStream, bool leaveInnerStreamOpen, EncryptionPolicy encryptionPolicy, MonoTlsProvider provider, MonoTlsSettings settings)
- : base (innerStream, leaveInnerStreamOpen)
- {
- if (encryptionPolicy != EncryptionPolicy.RequireEncryption && encryptionPolicy != EncryptionPolicy.AllowNoEncryption && encryptionPolicy != EncryptionPolicy.NoEncryption)
- throw new ArgumentException (SR.GetString (SR.net_invalid_enum, "EncryptionPolicy"), "encryptionPolicy");
-
- var validationHelper = MNS.ChainValidationHelper.CloneWithCallbackWrapper (provider, ref settings, myUserCertValidationCallbackWrapper);
-
- LocalCertSelectionCallback selectionCallback = null;
- if (validationHelper.HasCertificateSelectionCallback)
- selectionCallback = validationHelper.SelectClientCertificate;
-
- var internalProvider = new MNS.Private.MonoTlsProviderWrapper (provider);
- _Configuration = new MyConfiguration (internalProvider, settings, this);
- _SslState = new SslState (innerStream, null, selectionCallback, encryptionPolicy, _Configuration);
- }
-
- /*
- * Mono-specific version of 'userCertValidationCallbackWrapper'; we're called from ChainValidationHelper.ValidateChain() here.
- *
- * Since we're built without the PrebuiltSystem alias, we can't use 'SslPolicyErrors' here. This prevents us from creating a subclass of 'ChainValidationHelper'
- * as well as providing a custom 'ServerCertValidationCallback'.
- */
- bool myUserCertValidationCallbackWrapper (ServerCertValidationCallback callback, X509Certificate certificate, X509Chain chain, MonoSslPolicyErrors sslPolicyErrors)
- {
- m_RemoteCertificateOrBytes = certificate == null ? null : certificate.GetRawCertData ();
- if (callback == null) {
- if (!_SslState.RemoteCertRequired)
- sslPolicyErrors &= ~MonoSslPolicyErrors.RemoteCertificateNotAvailable;
-
- return (sslPolicyErrors == MonoSslPolicyErrors.None);
- }
-
- return MNS.ChainValidationHelper.InvokeCallback (callback, this, certificate, chain, sslPolicyErrors);
- }
-
- class MyConfiguration : SSPIConfiguration
- {
- MNS.IMonoTlsProvider provider;
- MonoTlsSettings settings;
- IMonoTlsEventSink eventSink;
-
- public MyConfiguration (MNS.IMonoTlsProvider provider, MonoTlsSettings settings, IMonoTlsEventSink eventSink)
- {
- this.provider = provider;
- this.settings = settings;
- this.eventSink = eventSink;
- }
-
- public MNS.IMonoTlsProvider Provider {
- get { return provider; }
- }
-
- public MonoTlsSettings Settings {
- get { return settings; }
- }
-
- public IMonoTlsEventSink EventSink {
- get { return eventSink; }
- }
- }
- #endif
-
- internal bool IsClosed {
- get { return _SslState.IsClosed; }
- }
-
- internal Exception LastError {
- get { return lastError; }
- }
-
- #region IMonoTlsEventSink
-
- Exception lastError;
-
- void IMonoTlsEventSink.Error (Exception exception)
- {
- Interlocked.CompareExchange<Exception> (ref lastError, exception, null);
- }
-
- void IMonoTlsEventSink.ReceivedCloseNotify ()
- {
- }
-
- #endregion
-
- internal IAsyncResult BeginShutdown (AsyncCallback asyncCallback, object asyncState)
- {
- return _SslState.BeginShutdown (asyncCallback, asyncState);
- }
-
- internal void EndShutdown (IAsyncResult asyncResult)
- {
- _SslState.EndShutdown (asyncResult);
- }
-
- internal IAsyncResult BeginRenegotiate (AsyncCallback asyncCallback, object asyncState)
- {
- return _SslState.BeginRenegotiate (asyncCallback, asyncState);
- }
-
- internal void EndRenegotiate (IAsyncResult asyncResult)
- {
- _SslState.EndRenegotiate (asyncResult);
- }
-
- internal X509Certificate InternalLocalCertificate {
- get { return _SslState.InternalLocalCertificate; }
- }
-
- internal MonoTlsConnectionInfo GetMonoConnectionInfo ()
- {
- return _SslState.GetMonoConnectionInfo ();
- }
- }
-}
-#endif
+++ /dev/null
-//
-// Mono-specific additions to Microsoft's _SecureChannel.cs
-//
-#if MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-using MonoSecurity::Mono.Security.Interface;
-#else
-using Mono.Security.Interface;
-#endif
-namespace System.Net.Security
-{
- partial class SecureChannel
- {
- internal MonoTlsConnectionInfo GetMonoConnectionInfo ()
- {
- return SSPIWrapper.GetMonoConnectionInfo (m_SecModule, m_SecurityContext);
- }
-
- internal ProtocolToken CreateShutdownMessage ()
- {
- var buffer = SSPIWrapper.CreateShutdownMessage (m_SecModule, m_SecurityContext);
- return new ProtocolToken (buffer, SecurityStatus.ContinueNeeded);
- }
-
- internal ProtocolToken CreateHelloRequestMessage ()
- {
- var buffer = SSPIWrapper.CreateHelloRequestMessage (m_SecModule, m_SecurityContext);
- return new ProtocolToken (buffer, SecurityStatus.ContinueNeeded);
- }
-
- internal bool IsClosed {
- get {
- if (m_SecModule == null || m_SecurityContext == null || m_SecurityContext.IsClosed)
- return true;
- return SSPIWrapper.IsClosed (m_SecModule, m_SecurityContext);
- }
- }
- }
-}
-#endif
+++ /dev/null
-//
-// Mono-specific additions to Microsoft's _SslState.cs
-//
-#if MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-using MonoSecurity::Mono.Security.Interface;
-#else
-using Mono.Security.Interface;
-#endif
-namespace System.Net.Security
-{
- using System.IO;
- using System.Threading;
- using System.Net.Sockets;
-
- partial class SslState
- {
- int _SentShutdown;
-
- internal MonoTlsConnectionInfo GetMonoConnectionInfo ()
- {
- return Context.GetMonoConnectionInfo ();
- }
-
- internal bool IsClosed {
- get { return Context.IsClosed; }
- }
-
- internal ProtocolToken CreateShutdownMessage ()
- {
- return Context.CreateShutdownMessage ();
- }
-
- internal ProtocolToken CreateHelloRequestMessage ()
- {
- return Context.CreateHelloRequestMessage ();
- }
-
- internal IAsyncResult BeginShutdown (AsyncCallback asyncCallback, object asyncState)
- {
- var shutdownResult = new ShutdownAsyncResult (this, asyncState, asyncCallback);
-
- if (Interlocked.CompareExchange (ref _SentShutdown, 1, 0) == 1) {
- shutdownResult.InvokeCallback ();
- return shutdownResult;
- }
-
- try
- {
- CheckThrow (false);
- shutdownResult.SentShutdown = true;
- SecureStream.BeginShutdown (shutdownResult);
- return shutdownResult;
- } catch (Exception e) {
- if (e is IOException)
- throw;
- throw new IOException (SR.GetString (SR.mono_net_io_shutdown), e);
- }
- }
-
- internal void EndShutdown (IAsyncResult asyncResult)
- {
- if (asyncResult == null)
- throw new ArgumentNullException ("asyncResult");
-
- var shutdownResult = asyncResult as ShutdownAsyncResult;
- if (shutdownResult == null)
- throw new ArgumentException (SR.GetString (SR.net_io_async_result, asyncResult.GetType ().FullName), "asyncResult");
-
- if (shutdownResult.SentShutdown)
- SecureStream.EndShutdown (shutdownResult);
- }
-
- internal IAsyncResult BeginRenegotiate (AsyncCallback asyncCallback, object asyncState)
- {
- var lazyResult = new LazyAsyncResult (this, asyncState, asyncCallback);
-
- if (Interlocked.Exchange (ref _NestedAuth, 1) == 1)
- throw new InvalidOperationException (SR.GetString (SR.net_io_invalidnestedcall, "BeginRenegotiate", "renegotiate"));
- if (Interlocked.CompareExchange (ref _PendingReHandshake, 1, 0) == 1)
- throw new InvalidOperationException (SR.GetString (SR.net_io_invalidnestedcall, "BeginRenegotiate", "renegotiate"));
-
- try {
- CheckThrow (false);
- SecureStream.BeginRenegotiate (lazyResult);
- return lazyResult;
- } catch (Exception e) {
- _NestedAuth = 0;
- if (e is IOException)
- throw;
- throw new IOException (SR.GetString (SR.mono_net_io_renegotiate), e);
- }
- }
-
- internal void EndRenegotiate (IAsyncResult result)
- {
- if (result == null)
- throw new ArgumentNullException ("asyncResult");
-
- LazyAsyncResult lazyResult = result as LazyAsyncResult;
- if (lazyResult == null)
- throw new ArgumentException (SR.GetString (SR.net_io_async_result, result.GetType ().FullName), "asyncResult");
-
- if (Interlocked.Exchange (ref _NestedAuth, 0) == 0)
- throw new InvalidOperationException (SR.GetString (SR.net_io_invalidendcall, "EndRenegotiate"));
-
- SecureStream.EndRenegotiate (lazyResult);
- }
-
- internal bool CheckEnqueueHandshakeWrite (byte[] buffer, AsyncProtocolRequest asyncRequest)
- {
- return CheckEnqueueHandshake (buffer, asyncRequest);
- }
-
- internal void StartReHandshake (AsyncProtocolRequest asyncRequest)
- {
- if (IsServer) {
- byte[] buffer = null;
- if (CheckEnqueueHandshakeRead (ref buffer, asyncRequest))
- return;
-
- StartReceiveBlob (buffer, asyncRequest);
- return;
- }
-
- ForceAuthentication (false, null, asyncRequest);
- }
-
- class ShutdownAsyncResult : LazyAsyncResult
- {
- public bool SentShutdown;
-
- internal ShutdownAsyncResult (SslState instance, object userState, AsyncCallback callback)
- : base (instance, userState, callback)
- {
- }
- }
- }
-}
-#endif
+++ /dev/null
-//
-// Mono-specific additions to Microsoft's _SslStream.cs
-//
-#if MONO_FEATURE_NEW_TLS && SECURITY_DEP
-namespace System.Net.Security
-{
- using System.IO;
- using System.Threading;
- using System.Net.Sockets;
-
- partial class _SslStream
- {
- static readonly AsyncCallback _HandshakeWriteCallback = new AsyncCallback (HandshakeWriteCallback);
- static readonly HandshakeProtocolCallback _ResumeHandshakeWriteCallback = new HandshakeProtocolCallback (ResumeHandshakeWriteCallback);
-
- internal void BeginShutdown (LazyAsyncResult lazyResult)
- {
- HandshakeProtocolRequest asyncRequest = new HandshakeProtocolRequest (lazyResult);
-
- if (Interlocked.Exchange (ref _NestedWrite, 1) == 1)
- throw new NotSupportedException (SR.GetString (SR.net_io_invalidnestedcall, (asyncRequest != null ? "BeginShutdown" : "Shutdown"), "shutdown"));
-
- bool failed = false;
- try
- {
- ProtocolToken message = _SslState.CreateShutdownMessage ();
- asyncRequest.SetNextRequest (HandshakeProtocolState.Shutdown, message, _ResumeHandshakeWriteCallback);
-
- StartHandshakeWrite (asyncRequest);
- } catch (Exception e) {
- _SslState.FinishWrite ();
- failed = true;
- throw;
- } finally {
- if (failed)
- _NestedWrite = 0;
- }
- }
-
- internal void EndShutdown (LazyAsyncResult lazyResult)
- {
- if (Interlocked.Exchange (ref _NestedWrite, 0) == 0)
- throw new InvalidOperationException (SR.GetString (SR.net_io_invalidendcall, "EndShutdown"));
-
- // No "artificial" timeouts implemented so far, InnerStream controls timeout.
- lazyResult.InternalWaitForCompletion ();
-
- if (lazyResult.Result is Exception) {
- if (lazyResult.Result is IOException)
- throw (Exception)lazyResult.Result;
- throw new IOException (SR.GetString (SR.mono_net_io_shutdown), (Exception)lazyResult.Result);
- }
- }
-
- internal void BeginRenegotiate (LazyAsyncResult lazyResult)
- {
- HandshakeProtocolRequest asyncRequest = new HandshakeProtocolRequest (lazyResult);
-
- if (Interlocked.Exchange (ref _NestedWrite, 1) == 1)
- throw new NotSupportedException (SR.GetString (SR.net_io_invalidnestedcall, (asyncRequest != null ? "BeginRenegotiate" : "Renegotiate"), "renegotiate"));
-
- bool failed = false;
- try
- {
- if (_SslState.IsServer) {
- ProtocolToken message = _SslState.CreateHelloRequestMessage ();
- asyncRequest.SetNextRequest (HandshakeProtocolState.SendHelloRequest, message, _ResumeHandshakeWriteCallback);
- } else {
- asyncRequest.SetNextRequest (HandshakeProtocolState.ClientRenegotiation, null, _ResumeHandshakeWriteCallback);
- }
-
- StartHandshakeWrite (asyncRequest);
- } catch (Exception e) {
- _SslState.FinishWrite ();
- failed = true;
- throw;
- } finally {
- if (failed)
- _NestedWrite = 0;
- }
- }
-
- internal void EndRenegotiate (LazyAsyncResult lazyResult)
- {
- if (Interlocked.Exchange (ref _NestedWrite, 0) == 0)
- throw new InvalidOperationException (SR.GetString (SR.net_io_invalidendcall, "EndRenegotiate"));
-
- // No "artificial" timeouts implemented so far, InnerStream controls timeout.
- lazyResult.InternalWaitForCompletion();
-
- if (lazyResult.Result is Exception) {
- if (lazyResult.Result is IOException)
- throw (Exception)lazyResult.Result;
- throw new IOException (SR.GetString (SR.mono_net_io_renegotiate), (Exception)lazyResult.Result);
- }
- }
-
- void StartHandshakeWrite (HandshakeProtocolRequest asyncRequest)
- {
- byte[] buffer = null;
- if (asyncRequest.Message != null) {
- buffer = asyncRequest.Message.Payload;
- if (buffer.Length != asyncRequest.Message.Size) {
- buffer = new byte [asyncRequest.Message.Size];
- Buffer.BlockCopy (asyncRequest.Message.Payload, 0, buffer, 0, buffer.Length);
- }
- }
-
- switch (asyncRequest.State) {
- case HandshakeProtocolState.ClientRenegotiation:
- case HandshakeProtocolState.ServerRenegotiation:
- _SslState.StartReHandshake (asyncRequest);
- return;
-
- case HandshakeProtocolState.SendHelloRequest:
- if (_SslState.CheckEnqueueHandshakeWrite (buffer, asyncRequest)) {
- // operation is async and has been queued, return.
- return;
- }
- break;
-
- case HandshakeProtocolState.Shutdown:
- if (_SslState.CheckEnqueueWrite (asyncRequest)) {
- // operation is async and has been queued, return.
- return;
- }
- break;
-
- default:
- throw new InvalidOperationException ();
- }
-
- if (_SslState.LastPayload != null)
- throw new InvalidOperationException ();
-
- // prepare for the next request
- IAsyncResult ar = ((NetworkStream)_SslState.InnerStream).BeginWrite (buffer, 0, buffer.Length, _HandshakeWriteCallback, asyncRequest);
- if (!ar.CompletedSynchronously)
- return;
-
- HandshakeWriteCallback (asyncRequest, ar);
- }
-
- static void HandshakeWriteCallback (IAsyncResult transportResult)
- {
- if (transportResult.CompletedSynchronously)
- return;
-
- HandshakeProtocolRequest asyncRequest = (HandshakeProtocolRequest)transportResult.AsyncState;
-
- SslState sslState = (SslState)asyncRequest.AsyncObject;
- sslState.SecureStream.HandshakeWriteCallback (asyncRequest, transportResult);
- }
-
- void HandshakeWriteCallback (HandshakeProtocolRequest asyncRequest, IAsyncResult transportResult)
- {
- try {
- _SslState.InnerStream.EndWrite (transportResult);
- } catch (Exception e) {
- _SslState.FinishWrite ();
- if (!asyncRequest.IsUserCompleted) {
- asyncRequest.CompleteWithError (e);
- return;
- }
- throw;
- }
-
- if (asyncRequest.State == HandshakeProtocolState.SendHelloRequest) {
- asyncRequest.SetNextRequest (HandshakeProtocolState.ServerRenegotiation, null, _ResumeHandshakeWriteCallback);
- StartHandshakeWrite (asyncRequest);
- return;
- }
-
- try {
- _SslState.FinishWrite ();
- asyncRequest.CompleteUser ();
- } catch (Exception e) {
- if (!asyncRequest.IsUserCompleted) {
- asyncRequest.CompleteWithError (e);
- return;
- }
- throw;
- }
- }
-
- static void ResumeHandshakeWriteCallback (HandshakeProtocolRequest asyncRequest)
- {
- try {
- ((_SslStream)asyncRequest.AsyncObject).StartHandshakeWrite (asyncRequest);
- } catch (Exception e) {
- if (asyncRequest.IsUserCompleted) {
- // This will throw on a worker thread.
- throw;
- }
- ((_SslStream)asyncRequest.AsyncObject)._SslState.FinishWrite ();
- asyncRequest.CompleteWithError (e);
- }
- }
-
- delegate void HandshakeProtocolCallback (HandshakeProtocolRequest asyncRequest);
-
- enum HandshakeProtocolState {
- None,
- Shutdown,
- SendHelloRequest,
- ServerRenegotiation,
- ClientRenegotiation
- }
-
- class HandshakeProtocolRequest : AsyncProtocolRequest
- {
- public ProtocolToken Message;
- public HandshakeProtocolState State;
-
- public HandshakeProtocolRequest (LazyAsyncResult userAsyncResult)
- : base (userAsyncResult)
- {
- State = HandshakeProtocolState.None;
- }
-
- public void SetNextRequest (HandshakeProtocolState state, ProtocolToken message, HandshakeProtocolCallback callback)
- {
- State = state;
- Message = message;
- SetNextRequest (null, 0, 0, (r) => callback ((HandshakeProtocolRequest)r));
- }
- }
- }
-}
-#endif
<Compile Include="Mono.Net.Security\MonoTlsStream.cs" />\r
<Compile Include="Mono.Net.Security\NoReflectionHelper.cs" />\r
<Compile Include="Mono.Net.Security\SystemCertificateValidator.cs" />\r
- <Compile Include="ReferenceSources\_SecureChannel.cs" />\r
- <Compile Include="ReferenceSources\_SslState.cs" />\r
- <Compile Include="ReferenceSources\_SslStream.cs" />\r
<Compile Include="ReferenceSources\AssertWrapper.cs" />\r
<Compile Include="ReferenceSources\AutoWebProxyScriptEngine.cs" />\r
<Compile Include="ReferenceSources\BinaryCompatibility.cs" />\r
<Compile Include="ReferenceSources\EnvironmentHelpers.cs" />\r
<Compile Include="ReferenceSources\HttpApi.cs" />\r
<Compile Include="ReferenceSources\HttpSysSettings.cs" />\r
- <Compile Include="ReferenceSources\Internal.cs" />\r
<Compile Include="ReferenceSources\Logging.cs" />\r
<Compile Include="ReferenceSources\NativeMethods.cs" />\r
<Compile Include="ReferenceSources\RequestCacheProtocol.cs" />\r
<Compile Include="ReferenceSources\SR.cs" />\r
<Compile Include="ReferenceSources\SR2.cs" />\r
<Compile Include="ReferenceSources\SRCategoryAttribute.cs" />\r
- <Compile Include="ReferenceSources\SslStream.cs" />\r
- <Compile Include="ReferenceSources\SSPIConfiguration.cs" />\r
- <Compile Include="ReferenceSources\SSPISafeHandles.cs" />\r
- <Compile Include="ReferenceSources\SSPIWrapper.cs" />\r
<Compile Include="ReferenceSources\Win32Exception.cs" />\r
<Compile Include="System.CodeDom.Compiler\CodeCompiler.cs" />\r
<Compile Include="System.CodeDom.Compiler\CodeDomConfigurationHandler.cs" />\r
<Compile Include="Mono.Net.Security\MonoTlsStream.cs" />\r
<Compile Include="Mono.Net.Security\NoReflectionHelper.cs" />\r
<Compile Include="Mono.Net.Security\SystemCertificateValidator.cs" />\r
- <Compile Include="ReferenceSources\_SecureChannel.cs" />\r
- <Compile Include="ReferenceSources\_SslState.cs" />\r
- <Compile Include="ReferenceSources\_SslStream.cs" />\r
<Compile Include="ReferenceSources\AssertWrapper.cs" />\r
<Compile Include="ReferenceSources\AutoWebProxyScriptEngine.cs" />\r
<Compile Include="ReferenceSources\BinaryCompatibility.cs" />\r
<Compile Include="ReferenceSources\EnvironmentHelpers.cs" />\r
<Compile Include="ReferenceSources\HttpApi.cs" />\r
<Compile Include="ReferenceSources\HttpSysSettings.cs" />\r
- <Compile Include="ReferenceSources\Internal.cs" />\r
<Compile Include="ReferenceSources\Logging.cs" />\r
<Compile Include="ReferenceSources\NativeMethods.cs" />\r
<Compile Include="ReferenceSources\RequestCacheProtocol.cs" />\r
<Compile Include="ReferenceSources\SR.cs" />\r
<Compile Include="ReferenceSources\SR2.cs" />\r
<Compile Include="ReferenceSources\SRCategoryAttribute.cs" />\r
- <Compile Include="ReferenceSources\SslStream.cs" />\r
- <Compile Include="ReferenceSources\SSPIConfiguration.cs" />\r
- <Compile Include="ReferenceSources\SSPISafeHandles.cs" />\r
- <Compile Include="ReferenceSources\SSPIWrapper.cs" />\r
<Compile Include="ReferenceSources\Win32Exception.cs" />\r
<Compile Include="System.CodeDom.Compiler\CodeCompiler.cs" />\r
<Compile Include="System.CodeDom.Compiler\CodeDomConfigurationHandler.cs" />\r
+++ /dev/null
-//
-// ExcludeFromCodeCoverageAttribute.cs
-//
-// Authors:
-// Jb Evain <jbevain@novell.com>
-//
-// Copyright (C) 2010 Novell, Inc (http://www.novell.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 System.Diagnostics.CodeAnalysis {
-
- [AttributeUsage (AttributeTargets.Class
- | AttributeTargets.Struct
- | AttributeTargets.Constructor
- | AttributeTargets.Method
- | AttributeTargets.Property
- | AttributeTargets.Event,
- AllowMultiple = false,
- Inherited = false)]
- public sealed class ExcludeFromCodeCoverageAttribute : Attribute
- {
- public ExcludeFromCodeCoverageAttribute ()
- {
- }
- }
-}
-
* effects on Linux, as the socket option is kludged by
* turning on or off PMTU discovery... */
this.DontFragment = false;
- this.NoDelay = false;
+ if (protocol_type == ProtocolType.Tcp)
+ this.NoDelay = false;
} else if (address_family == AddressFamily.InterNetworkV6) {
this.DualMode = true;
}
set {
ThrowIfDisposedAndClosed ();
ThrowIfUdp ();
-
SetSocketOption (SocketOptionLevel.Tcp, SocketOptionName.NoDelay, value ? 1 : 0);
}
}
System.Diagnostics/TraceImpl.cs
System.Diagnostics/TraceSourceInfo.cs
System.Diagnostics/Win32EventLog.cs
-System.Diagnostics.CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs
System/Platform.cs
System/MonoExeLocator.cs
System.IO.Compression/CompressionLevel.cs
ReferenceSources/ConfigurationManagerInternalFactory.cs
ReferenceSources/CAPI.cs
ReferenceSources/EnvironmentHelpers.cs
-ReferenceSources/Internal.cs
ReferenceSources/HttpApi.cs
ReferenceSources/HttpSysSettings.cs
ReferenceSources/LocalAppContextSwitches.cs
ReferenceSources/SRCategoryAttribute.cs
ReferenceSources/Win32Exception.cs
-ReferenceSources/SSPIConfiguration.cs
-ReferenceSources/SSPISafeHandles.cs
-ReferenceSources/SSPIWrapper.cs
-ReferenceSources/SslStream.cs
-ReferenceSources/_SecureChannel.cs
-ReferenceSources/_SslState.cs
-ReferenceSources/_SslStream.cs
-
../referencesource/System/misc/PrivilegedConfigurationManager.cs
../referencesource/System/regex/system/text/regularexpressions/Regex.cs
../referencesource/System/regex/system/text/regularexpressions/RegexBoyerMoore.cs
../referencesource/System/sys/system/IO/ports/InternalResources.cs
+../referencesource/System/sys/system/Diagnostics/CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs
+
../referencesource/System/sys/system/runtime/interopservices/DefaultParameterValueAttribute.cs
../referencesource/System/sys/system/runtime/interopservices/handlecollector.cs
-using System;
+#if !MOBILE
+
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace System {
- internal static class MonoExeLocator {
-
- public static string GacPath { get; private set; }
- public static string MonoPath { get; private set; }
- public static string McsPath { get; private set; }
- public static string VbncPath { get; private set; }
- public static string AlPath { get; private set; }
-
- static MonoExeLocator () {
-
- PropertyInfo gac = typeof (Environment).GetProperty ("GacPath", BindingFlags.Static | BindingFlags.NonPublic);
- MethodInfo getGacMethod = gac.GetGetMethod (true);
- GacPath = Path.GetDirectoryName ((string) getGacMethod.Invoke (null, null));
+ static class MonoToolsLocator
+ {
+ public static readonly string Mono;
+ public static readonly string CSharpCompiler;
+ public static readonly string VBCompiler;
+ public static readonly string AssemblyLinker;
- string monoPath = null;
- string mcsPath = null;
- string vbncPath = null;
- string alPath = null;
+ // TODO: Should be lazy
+ static MonoToolsLocator ()
+ {
+ var gac = typeof (Environment).GetProperty ("GacPath", BindingFlags.Static | BindingFlags.NonPublic);
+ var getGacMethod = gac.GetGetMethod (true);
+ var GacPath = Path.GetDirectoryName ((string) getGacMethod.Invoke (null, null));
if (Path.DirectorySeparatorChar == '\\') {
string processExe = Process.GetCurrentProcess ().MainModule.FileName;
if (processExe != null) {
string fileName = Path.GetFileName (processExe);
if (fileName.StartsWith ("mono") && fileName.EndsWith (".exe"))
- monoPath = processExe;
+ Mono = processExe;
}
- if (!File.Exists (monoPath))
- monoPath = Path.Combine (
+ if (!File.Exists (Mono))
+ Mono = Path.Combine (
Path.GetDirectoryName (
Path.GetDirectoryName (GacPath)),
"bin\\mono.exe");
- if (!File.Exists (monoPath))
- monoPath = Path.Combine (
+ if (!File.Exists (Mono))
+ Mono = Path.Combine (
Path.GetDirectoryName (
Path.GetDirectoryName (
Path.GetDirectoryName (GacPath))),
"mono\\mini\\mono.exe");
- if (!File.Exists (monoPath))
- throw new FileNotFoundException ("Windows mono path not found: " + monoPath);
+ //if (!File.Exists (Mono))
+ // throw new FileNotFoundException ("Windows mono path not found: " + Mono);
- mcsPath = Path.Combine (GacPath, "4.5\\mcs.exe");
- if (!File.Exists (mcsPath))
- mcsPath = Path.Combine (Path.GetDirectoryName (GacPath), "lib\\build\\mcs.exe");
+ CSharpCompiler = Path.Combine (GacPath, "4.5\\mcs.exe");
+ if (!File.Exists (CSharpCompiler))
+ CSharpCompiler = Path.Combine (Path.GetDirectoryName (GacPath), "lib\\build\\mcs.exe");
- if (!File.Exists (mcsPath))
- throw new FileNotFoundException ("Windows mcs path not found: " + mcsPath);
+ //if (!File.Exists (CSharpCompiler))
+ // throw new FileNotFoundException ("C# compiler not found at " + CSharpCompiler);
- vbncPath = Path.Combine (GacPath, "4.5\\vbnc.exe");
- vbncPath = Path.Combine (GacPath, "4.5\\vbnc.exe");
- alPath = Path.Combine (GacPath, "4.5\\al.exe");
+ VBCompiler = Path.Combine (GacPath, "4.5\\vbnc.exe");
+ AssemblyLinker = Path.Combine (GacPath, "4.5\\al.exe");
- if (!File.Exists (alPath)) {
- alPath = Path.Combine (Path.GetDirectoryName (GacPath), "lib\\net_4_x\\al.exe");
- if (!File.Exists (alPath))
- throw new FileNotFoundException ("Windows al path not found: " + alPath);
+ if (!File.Exists (AssemblyLinker)) {
+ AssemblyLinker = Path.Combine (Path.GetDirectoryName (GacPath), "lib\\net_4_x\\al.exe");
+ // if (!File.Exists (AssemblyLinker))
+ // throw new FileNotFoundException ("Windows al path not found: " + AssemblyLinker);
}
} else {
- monoPath = Path.Combine (GacPath, "bin/mono");
- if (!File.Exists (MonoPath))
- monoPath = "mono";
+ Mono = Path.Combine (GacPath, "bin", "mono");
+ if (!File.Exists (Mono))
+ Mono = "mono";
var mscorlibPath = new Uri (typeof (object).Assembly.CodeBase).LocalPath;
- mcsPath = Path.GetFullPath( Path.Combine (mscorlibPath, "..", "..", "..", "..", "bin", "mcs"));
- if (!File.Exists (mcsPath))
- mcsPath = "mcs";
+ CSharpCompiler = Path.GetFullPath (Path.Combine (mscorlibPath, "..", "..", "..", "..", "bin", "mcs"));
+ if (!File.Exists (CSharpCompiler))
+ CSharpCompiler = "mcs";
- vbncPath = Path.Combine (Path.GetDirectoryName (mcsPath), "vbnc");
- if (!File.Exists (vbncPath))
- vbncPath = "vbnc";
+ VBCompiler = Path.GetFullPath (Path.Combine (mscorlibPath, "..", "..", "..", "..", "bin", "vbnc"));
+ if (!File.Exists (VBCompiler))
+ VBCompiler = "vbnc";
- alPath = "al";
+ AssemblyLinker = Path.GetFullPath (Path.Combine (mscorlibPath, "..", "..", "..", "..", "bin", "al"));
+ if (!File.Exists (AssemblyLinker))
+ AssemblyLinker = "al";
}
-
- McsPath = mcsPath;
- MonoPath = monoPath;
- VbncPath = vbncPath;
- AlPath = alPath;
}
-
-
}
}
+
+#endif
Assert.AreEqual (-2147467259, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
- Assert.AreEqual (2, ex.NativeErrorCode, "#6");
+ // TODO: On windows we get ACCESS_DENIED (5) instead of FILE_NOT_FOUND (2) and .NET
+ // gives ERROR_INVALID_PARAMETER (87). See https://bugzilla.xamarin.com/show_bug.cgi?id=44514
+ Assert.IsTrue (ex.NativeErrorCode == 2 || ex.NativeErrorCode == 5 || ex.NativeErrorCode == 87, "#6");
}
}
Assert.AreEqual (-2147467259, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
- Assert.AreEqual (2, ex.NativeErrorCode, "#6");
+ // TODO: On windows we get ACCESS_DENIED (5) instead of FILE_NOT_FOUND (2) and .NET
+ // gives ERROR_INVALID_PARAMETER (87). See https://bugzilla.xamarin.com/show_bug.cgi?id=44514
+ Assert.IsTrue (ex.NativeErrorCode == 2 || ex.NativeErrorCode == 5 || ex.NativeErrorCode == 87, "#6");
}
}
path = "/bin/cat";
#endif
return new ProcessStartInfo (path);
- } else
- return new ProcessStartInfo ("type");
+ } else {
+ var psi = new ProcessStartInfo ("findstr");
+ psi.Arguments = "\"^\"";
+ return psi;
+ }
}
#endif // MONO_FEATURE_PROCESS_START
StringBuilder sb = new StringBuilder ();
sb.AppendFormat ("Could not found: {0} {1}\n", name.Name, name.Version);
- sb.AppendLine ("Looked in assemblies:");
+ sb.AppendLine ("Looked in modules:");
foreach (var o in modules) {
var m = (ProcessModule) o;
[Category ("NotDotNet")]
public void UnixAbsoluteFilePath_WithSpecialChars1 ()
{
+ if (isWin32)
+ Assert.Ignore ();
+
Uri unixuri = new Uri ("/home/user/a@b");
Assert.AreEqual ("file", unixuri.Scheme, "UnixAbsoluteFilePath_WithSpecialChars #1");
}
[Category ("NotDotNet")]
public void UnixAbsoluteFilePath_WithSpecialChars2 ()
{
+ if (isWin32)
+ Assert.Ignore ();
+
Uri unixuri = new Uri ("/home/user/a:b");
Assert.AreEqual ("file", unixuri.Scheme, "UnixAbsoluteFilePath_WithSpecialChars #2");
}
[Category ("NotDotNet")]
public void UnixAbsolutePath_ReplaceRelative ()
{
+ if (isWin32)
+ Assert.Ignore ();
+
var u1 = new Uri ("/Users/demo/Projects/file.xml");
var u2 = new Uri (u1, "b.jpg");
[Test]
public void DotNetRelativeOrAbsoluteTest ()
{
+ // On windows the path /foo is parsed as BadFormat and checking
+ // if this is relative or absolute doesn't make sense.
+ if (isWin32)
+ Assert.Ignore();
+
FieldInfo useDotNetRelativeOrAbsoluteField = null;
bool useDotNetRelativeOrAbsoluteOld = false;
[Test]
public void ImplicitUnixFileWithUnicode ()
{
+ if (isWin32)
+ Assert.Ignore ();
+
string value = "/Library/Frameworks/System.Runtim…ee";
Uri uri;
Assert.IsTrue (Uri.TryCreate (value, UriKind.Absolute, out uri));
ReferenceSources/CAPI.cs
ReferenceSources/EnvironmentHelpers.cs
ReferenceSources/HttpApi.cs
-ReferenceSources/Internal.cs
ReferenceSources/LocalAppContextSwitches.cs
ReferenceSources/HttpSysSettings.cs
ReferenceSources/Logging.cs
../referencesource/System/net/System/Net/NetworkInformation/nodetype.cs
../referencesource/System/net/System/Net/NetworkInformation/pingexception.cs
+../referencesource/System/sys/system/Diagnostics/CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs
+
../referencesource/System/sys/system/IO/ports/InternalResources.cs
../referencesource/System/sys/system/runtime/interopservices/DefaultParameterValueAttribute.cs
../referencesource/System/sys/system/threading/Barrier.cs
../referencesource/System/sys/system/threading/semaphore.cs
+../referencesource/System/sys/system/windows/markup/ValueSerializerAttribute.cs
+
../referencesource/System/security/system/security/Authentication/ExtendedProtection/TokenBinding.cs
../referencesource/System/security/system/security/cryptography/oid.cs
[assembly: InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
#endif
-[assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")]
[assembly: Guid ("BED7F4EA-1A96-11D2-8F08-00A0C9A6186D")]
public abstract class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable {
#endif
internal class ResolveEventHolder {
+#pragma warning disable 67
public event ModuleResolveEventHandler ModuleResolve;
+#pragma warning restore
}
internal class UnmanagedMemoryStreamForModule : UnmanagedMemoryStream
const int COR_E_TARGET = unchecked ((int)0x80131603L);
const int COR_E_TARGETINVOCATION = unchecked ((int)0x80131604L);
const int COR_E_TARGETPARAMCOUNT = unchecked ((int)0x8002000EL);
- const int COR_E_THREADABORTED = unchecked ((int)0x80131530L);
+ //const int COR_E_THREADABORTED = unchecked ((int)0x80131530L);
const int COR_E_THREADINTERRUPTED = unchecked ((int)0x80131519L);
const int COR_E_THREADSTATE = unchecked ((int)0x80131520L);
- const int COR_E_THREADSTOP = unchecked ((int)0x80131521L);
+ //const int COR_E_THREADSTOP = unchecked ((int)0x80131521L);
const int COR_E_TYPEINITIALIZATION = unchecked ((int)0x80131534L);
const int COR_E_VERIFICATION = unchecked ((int)0x8013150DL);
//const int COR_E_WEAKREFERENCE = unchecked ((int)?);
[return: MarshalAs (UnmanagedType.Bool)]
static extern bool IsValidSecurityDescriptor (IntPtr descriptor);
+ /*
struct SecurityDescriptor
{
public byte Revision, Size;
public ushort ControlFlags;
public IntPtr Owner, Group, Sacl, Dacl;
}
+ */
#endregion
#endif
}
private IntPtr thread_pinning_ref;
private IntPtr abort_protected_block_count;
private int priority = (int) ThreadPriority.Normal;
+ private IntPtr owned_mutex;
/*
* These fields are used to avoid having to increment corlib versions
* when a new field is added to the unmanaged MonoThread structure.
* of icalls, do not require an increment.
*/
#pragma warning disable 169
- private const int mono_corlib_version = 155;
+ private const int mono_corlib_version = 156;
#pragma warning restore 169
[ComVisible (true)]
+++ /dev/null
-//
-// System.GC.cs
-//
-// Author:
-// Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.Runtime.CompilerServices;
-using System.Runtime.ConstrainedExecution;
-using System.Security.Permissions;
-
-namespace System
-{
- public static class GC
- {
-
- public extern static int MaxGeneration {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
- }
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- extern static void InternalCollect (int generation);
-
- public static void Collect () {
- InternalCollect (MaxGeneration);
- }
-
- public static void Collect (int generation) {
- if (generation < 0)
- throw new ArgumentOutOfRangeException ("generation");
- InternalCollect (generation);
- }
-
- [MonoDocumentationNote ("mode parameter ignored")]
- public static void Collect (int generation, GCCollectionMode mode) {
- Collect (generation);
- }
-
- [MonoDocumentationNote ("mode and blocking parameters ignored")]
- public static void Collect (int generation, GCCollectionMode mode, bool blocking) {
- Collect (generation);
- }
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- public extern static int GetGeneration (object obj);
-
- public static int GetGeneration (WeakReference wo) {
- object obj = wo.Target;
- if (obj == null)
- throw new ArgumentException ();
- return GetGeneration (obj);
- }
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- public extern static long GetTotalMemory (bool forceFullCollection);
-
- /* this icall has weird semantics check the docs... */
- [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- public extern static void KeepAlive (object obj);
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- public extern static void ReRegisterForFinalize (object obj);
-
- [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- public extern static void SuppressFinalize (object obj);
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- public extern static void WaitForPendingFinalizers ();
-
- [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- public extern static int CollectionCount (int generation);
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- private extern static void RecordPressure (long bytesAllocated);
-
- public static void AddMemoryPressure (long bytesAllocated) {
- RecordPressure (bytesAllocated);
- }
-
- public static void RemoveMemoryPressure (long bytesAllocated) {
- RecordPressure (-bytesAllocated);
- }
-
- [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
- [MonoTODO]
- public static GCNotificationStatus WaitForFullGCApproach () {
- throw new NotImplementedException ();
- }
-
- [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
- [MonoTODO]
- public static GCNotificationStatus WaitForFullGCApproach (int millisecondsTimeout) {
- throw new NotImplementedException ();
- }
-
- [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
- [MonoTODO]
- public static GCNotificationStatus WaitForFullGCComplete () {
- throw new NotImplementedException ();
- }
-
- [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
- [MonoTODO]
- public static GCNotificationStatus WaitForFullGCComplete (int millisecondsTimeout) {
- throw new NotImplementedException ();
- }
-
- [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
- public static void RegisterForFullGCNotification (int maxGenerationThreshold, int largeObjectHeapThreshold) {
- if (maxGenerationThreshold < 1 || maxGenerationThreshold > 99)
- throw new ArgumentOutOfRangeException ("maxGenerationThreshold", maxGenerationThreshold, "maxGenerationThreshold must be between 1 and 99 inclusive");
- if (largeObjectHeapThreshold < 1 || largeObjectHeapThreshold > 99)
- throw new ArgumentOutOfRangeException ("largeObjectHeapThreshold", largeObjectHeapThreshold, "largeObjectHeapThreshold must be between 1 and 99 inclusive");
- throw new NotImplementedException ();
- }
-
- [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
- public static void CancelFullGCNotification () {
- throw new NotImplementedException ();
- }
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- internal extern static void register_ephemeron_array (Ephemeron[] array);
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- extern static object get_ephemeron_tombstone ();
-
- internal static readonly object EPHEMERON_TOMBSTONE = get_ephemeron_tombstone ();
- }
-}
+++ /dev/null
-//
-// System.GCCollectionMode.cs
-//
-
-//
-// Copyright (C) 2007 Novell, Inc (http://www.novell.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.
-//
-
-// Net 3.5 type
-
-namespace System
-{
- [Serializable]
- public enum GCCollectionMode {
- Default = 0,
- Forced = 1,
- Optimized = 2
- }
-}
+++ /dev/null
-//
-// System.GCNotificationStatus.cs
-//
-// Authors:
-// Gonzalo Paniagua (gonzalo@ximian.com)
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Collections.Generic;
-using System.Runtime.ConstrainedExecution;
-
-namespace System {
- public enum GCNotificationStatus {
- Succeeded,
- Failed,
- Canceled,
- Timeout,
- NotApplicable
- }
-}
case 'O': // logical
int second = stack.Pop().Int32; // it's a stack... the second value was pushed last
int first = stack.Pop().Int32;
- char c = format[pos];
- stack.Push(
- c == '+' ? (first + second) :
- c == '-' ? (first - second) :
- c == '*' ? (first * second) :
- c == '/' ? (first / second) :
- c == 'm' ? (first % second) :
- c == '^' ? (first ^ second) :
- c == '&' ? (first & second) :
- c == '|' ? (first | second) :
- c == '=' ? AsInt(first == second) :
- c == '>' ? AsInt(first > second) :
- c == '<' ? AsInt(first < second) :
- c == 'A' ? AsInt(AsBool(first) && AsBool(second)) :
- c == 'O' ? AsInt(AsBool(first) || AsBool(second)) :
- 0); // not possible; we just validated above
+ int res;
+ switch (format[pos]) {
+ case '+':
+ res = first + second;
+ break;
+ case '-':
+ res = first - second;
+ break;
+ case '*':
+ res = first * second;
+ break;
+ case '/':
+ res = first / second;
+ break;
+ case 'm':
+ res = first % second;
+ break;
+ case '^':
+ res = first ^ second;
+ break;
+ case '&':
+ res = first & second;
+ break;
+ case '|':
+ res = first | second;
+ break;
+ case '=':
+ res = AsInt(first == second);
+ break;
+ case '>':
+ res = AsInt(first > second);
+ break;
+ case '<':
+ res = AsInt(first < second);
+ break;
+ case 'A':
+ res = AsInt(AsBool(first) && AsBool(second));
+ break;
+ case 'O':
+ res = AsInt(AsBool(first) || AsBool(second));
+ break;
+ default:
+ res = 0;
+ break;
+ }
+ stack.Push(res);
break;
// Unary operations
System/EmptyArray.cs
System/Environment.cs
System/EnvironmentVariableTarget.cs
-System/GC.cs
-System/GCCollectionMode.cs
-System/GCNotificationStatus.cs
System/Guid.cs
System/IConsoleDriver.cs
System/IntPtr.cs
System.Reflection.Emit/ConstructorBuilder.cs
System.Reflection.Emit/ConstructorOnTypeBuilderInst.cs
System.Reflection.Emit/CustomAttributeBuilder.cs
-System.Reflection.Emit/CustomAttributeBuilder.pns.cs
System.Reflection.Emit/DerivedTypes.cs
System.Reflection.Emit/DynamicILInfo.cs
System.Reflection.Emit/DynamicMethod.cs
System.Reflection.Emit/FlowControl.cs
System.Reflection.Emit/GenericTypeParameterBuilder.cs
System.Reflection.Emit/ILGenerator.cs
-System.Reflection.Emit/ILGenerator.pns.cs
System.Reflection.Emit/Label.cs
System.Reflection.Emit/LocalBuilder.cs
System.Reflection.Emit/MethodBuilder.cs
System.Reflection.Emit/OperandType.cs
System.Reflection.Emit/PackingSize.cs
System.Reflection.Emit/ParameterBuilder.cs
-System.Reflection.Emit/ParameterBuilder.pns.cs
System.Reflection.Emit/ParameterToken.cs
System.Reflection.Emit/PEFileKinds.cs
System.Reflection.Emit/PropertyBuilder.cs
System.Reflection.Emit/PropertyOnTypeBuilderInst.cs
System.Reflection.Emit/PropertyToken.cs
System.Reflection.Emit/SignatureHelper.cs
-System.Reflection.Emit/SignatureHelper.pns.cs
System.Reflection.Emit/SignatureToken.cs
System.Reflection.Emit/StackBehaviour.cs
System.Reflection.Emit/StringToken.cs
../referencesource/mscorlib/system/flagsattribute.cs
../referencesource/mscorlib/system/formatexception.cs
../referencesource/mscorlib/system/FormattableString.cs
+../referencesource/mscorlib/system/gc.cs
../referencesource/mscorlib/system/guid.cs
../referencesource/mscorlib/system/iappdomain.cs
../referencesource/mscorlib/system/iappdomainsetup.cs
/// attached property.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
+#if !MOBILE
[TypeForwardedFrom("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
+#endif
public sealed class ValueSerializerAttribute : Attribute
{
/// <summary>
public static class GC
{
+#if MONO
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ extern static int GetCollectionCount (int generation);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ extern static int GetMaxGeneration ();
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ extern static void InternalCollect (int generation);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ extern static void RecordPressure (long bytesAllocated);
+
+ // TODO: Move following to ConditionalWeakTable
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ internal extern static void register_ephemeron_array (Ephemeron[] array);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ extern static object get_ephemeron_tombstone ();
+
+ internal static readonly object EPHEMERON_TOMBSTONE = get_ephemeron_tombstone ();
+#else
[System.Security.SecurityCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ResourceExposure(ResourceScope.None)]
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
private static extern void _RemoveMemoryPressure(UInt64 bytesAllocated);
+#endif
[System.Security.SecurityCritical] // auto-generated_required
public static void AddMemoryPressure (long bytesAllocated) {
}
Contract.EndContractBlock();
+#if MONO
+ RecordPressure (bytesAllocated);
+#else
_AddMemoryPressure((ulong)bytesAllocated);
+#endif
}
[System.Security.SecurityCritical] // auto-generated_required
}
Contract.EndContractBlock();
+#if MONO
+ RecordPressure (-bytesAllocated);
+#else
_RemoveMemoryPressure((ulong) bytesAllocated);
+#endif
}
//
[System.Security.SecuritySafeCritical] // auto-generated
public static void Collect() {
+#if MONO
+ InternalCollect (MaxGeneration);
+#else
//-1 says to GC all generations.
_Collect(-1, (int)InternalGCCollectionMode.Blocking);
+#endif
}
[System.Security.SecuritySafeCritical] // auto-generated
iInternalModes |= (int)InternalGCCollectionMode.NonBlocking;
}
+#if MONO
+ InternalCollect (generation);
+#else
_Collect(generation, iInternalModes);
+#endif
}
[System.Security.SecuritySafeCritical] // auto-generated
throw new ArgumentOutOfRangeException("generation", Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
}
Contract.EndContractBlock();
+
+#if MONO
+ return GetCollectionCount(generation);
+#else
return _CollectionCount(generation, 0);
+#endif
}
+#if !MONO
// pass in true to get the BGC or FGC count.
[System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
Contract.EndContractBlock();
return _CollectionCount(generation, (getSpecialGCCount ? 1 : 0));
}
+#endif
// This method DOES NOT DO ANYTHING in and of itself. It's used to
// prevent a finalizable object from losing any outstanding references
//
[System.Security.SecuritySafeCritical] // auto-generated
public static int GetGeneration(WeakReference wo) {
+#if MONO
+ object obj = wo.Target;
+ if (obj == null)
+ throw new ArgumentException ();
+ return GetGeneration (obj);
+#else
int result = GetGenerationWR(wo.m_handle);
KeepAlive(wo);
return result;
+#endif
}
// Returns the maximum GC generation. Currently assumes only 1 heap.
get { return GetMaxGeneration(); }
}
+#if MONO
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void WaitForPendingFinalizers ();
+#else
[System.Security.SecurityCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
[SuppressUnmanagedCodeSecurity]
private static extern void _WaitForPendingFinalizers();
+
[System.Security.SecuritySafeCritical] // auto-generated
public static void WaitForPendingFinalizers() {
// QCalls can not be exposed from mscorlib directly, need to wrap it.
_WaitForPendingFinalizers();
}
+#endif
// Indicates that the system should not call the Finalize() method on
// an object that would normally require this call.
// the GC heap. This does not return the total size of the GC heap, but
// only the live objects in the GC heap.
//
+#if MONO
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static long GetTotalMemory (bool forceFullCollection);
+
+ static bool _RegisterForFullGCNotification(int maxGenerationPercentage, int largeObjectHeapPercentage)
+ {
+ throw new NotImplementedException ();
+ }
+
+ static bool _CancelFullGCNotification ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ static int _WaitForFullGCApproach (int millisecondsTimeout)
+ {
+ throw new NotImplementedException ();
+ }
+
+ static int _WaitForFullGCComplete (int millisecondsTimeout)
+ {
+ throw new NotImplementedException ();
+ }
+
+#else
[System.Security.SecuritySafeCritical] // auto-generated
public static long GetTotalMemory(bool forceFullCollection) {
long size = GetTotalMemory();
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern int _WaitForFullGCComplete(int millisecondsTimeout);
+#endif
[SecurityCritical]
public static void RegisterForFullGCNotification(int maxGenerationThreshold, int largeObjectHeapThreshold)
[SecurityCritical]
static bool StartNoGCRegionWorker(long totalSize, bool hasLohSize, long lohSize, bool disallowFullBlockingGC)
{
+#if MONO
+ throw new NotImplementedException ();
+#else
StartNoGCRegionStatus status = (StartNoGCRegionStatus)_StartNoGCRegion(totalSize, hasLohSize, lohSize, disallowFullBlockingGC);
if (status == StartNoGCRegionStatus.AmountTooLarge)
throw new ArgumentOutOfRangeException("totalSize",
else if (status == StartNoGCRegionStatus.NotEnoughMemory)
return false;
return true;
+#endif
}
[SecurityCritical]
[SecurityCritical]
static EndNoGCRegionStatus EndNoGCRegionWorker()
{
+#if MONO
+ throw new NotImplementedException ();
+#else
EndNoGCRegionStatus status = (EndNoGCRegionStatus)_EndNoGCRegion();
if (status == EndNoGCRegionStatus.NotInProgress)
throw new InvalidOperationException("NoGCRegion mode must be set");
throw new InvalidOperationException("Allocated memory exceeds specified memory for NoGCRegion mode");
return EndNoGCRegionStatus.Succeeded;
+#endif
}
[SecurityCritical]
--- /dev/null
+// CS0219: The constant `C' is never used
+// Line: 9
+// Compiler options: -warn:3 -warnaserror
+
+class C
+{
+ public static void Main ()
+ {
+ const int C = 1;
+ }
+}
\ No newline at end of file
compiled_types = new Dictionary<MetaType, TypeSpec> (40, ReferenceEquality<MetaType>.Default);
assembly_2_definition = new Dictionary<Assembly, IAssemblyDefinition> (ReferenceEquality<Assembly>.Default);
IgnorePrivateMembers = true;
+ IgnoreCompilerGeneratedField = true;
}
#region Properties
public bool IgnorePrivateMembers { get; set; }
+ public bool IgnoreCompilerGeneratedField { get; set; }
+
#endregion
public abstract void AddCompiledType (TypeBuilder builder, TypeSpec spec);
break;
default:
// Ignore private fields (even for error reporting) to not require extra dependencies
- if ((IgnorePrivateMembers && !declaringType.IsStruct) ||
- HasAttribute (CustomAttributeData.GetCustomAttributes (fi), "CompilerGeneratedAttribute", CompilerServicesNamespace))
+ if (IgnorePrivateMembers && !declaringType.IsStruct)
+ return null;
+
+ if (IgnoreCompilerGeneratedField && HasAttribute (CustomAttributeData.GetCustomAttributes (fi), "CompilerGeneratedAttribute", CompilerServicesNamespace))
return null;
mod = Modifiers.PRIVATE;
backing_field = new Field (Parent,
new TypeExpression (MemberType, Location),
- Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
+ Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.DEBUGGER_HIDDEN | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
MemberName, null);
Parent.PartialContainer.Members.Add (backing_field);
backing_field.Initializer = Initializer;
- backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED;
// Call define because we passed fields definition
backing_field.Define ();
public override void Emit (EmitContext ec)
{
+ if (!Variable.IsUsed)
+ ec.Report.Warning (219, 3, loc, "The constant `{0}' is never used", Variable.Name);
+
// Nothing to emit, not even sequence point
}
}
}
+ public bool IsUsed {
+ get {
+ return (flags & Flags.Used) != 0;
+ }
+ }
+
public bool IsFixed {
get {
return (flags & Flags.FixedVariable) != 0;
public Expression CreateReferenceExpression (ResolveContext rc, Location loc)
{
- if (IsConstant && const_value != null)
+ if (IsConstant && const_value != null) {
+ SetIsUsed ();
return Constant.CreateConstantFromValue (Type, const_value.GetValue (), loc);
+ }
return new LocalVariableReference (this, loc);
}
using System;
using System.Reflection;
+using System.Runtime.CompilerServices;
[assembly: Test]
Assert (ei.GetRemoveMethod ().GetCustomAttributes (true), false, 44);
Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), false, 45);
FieldInfo fi = typeof(Test_3).GetField ("e_1", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
- Assert (fi.GetCustomAttributes (true), true, 46);
+ Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 46);
+ Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), true, 47);
ei = typeof(Test_3).GetEvent ("e_2");
Assert (ei.GetCustomAttributes (true), false, 51);
Assert (ei.GetRemoveMethod ().GetCustomAttributes (true), true, 54);
Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), false, 55);
fi = typeof(Test_3).GetField ("e_2", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
- Assert (fi.GetCustomAttributes (true), false, 56);
+ Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 56);
+ Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), false, 57);
ei = typeof(Test_4).GetEvent ("e_2");
Assert (ei.GetCustomAttributes (true), false, 71);
Assert (ei.GetRemoveMethod ().GetCustomAttributes (true), false, 74);
Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), true, 75);
fi = typeof(Test_3).GetField ("e_2", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
- Assert (fi.GetCustomAttributes (true), false, 76);
+ Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 76);
+ Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), false, 77);
ei = typeof(Test_4).GetEvent ("e_3");
Assert (ei.GetCustomAttributes (true), false, 81);
Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), false, 86);
Assert (ei.GetRemoveMethod ().GetParameters ()[0].GetCustomAttributes (true), true, 87);
fi = typeof(Test_3).GetField ("e_2", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
- Assert (fi.GetCustomAttributes (true), false, 88);
+ Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 86);
+ Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), false, 87);
return failed ? 1 : 0;
}
<size>80</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>1169</size>
+ <size>1309</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
SUBDIRS =
include ../../build/rules.make
-LIB_REFS = Mono.Security
-LOCAL_MCS_FLAGS = -unsafe
+LIB_REFS = System Mono.Security System.Security
+LOCAL_MCS_FLAGS = -unsafe -define:NO_SYMBOL_WRITER
PROGRAM = gacutil.exe
using System.IO;
using System.Diagnostics;
using System.Text;
-using System.Reflection;
using System.Collections;
using System.Globalization;
using System.Runtime.InteropServices;
using Mono.Security;
using Mono.Security.Cryptography;
+using IKVM.Reflection;
+
namespace Mono.Tools {
public class Driver {
private static bool silent;
static bool in_bootstrap;
+ private static Universe _universe;
public static int Main (string [] args)
{
AssemblyName an = null;
try {
- assembly = Assembly.LoadFrom (name);
+ assembly = ReflectionOnlyLoadFrom (name);
} catch {
WriteLine (string.Format (failure_msg, name) + "The file specified is not a valid assembly.");
return false;
}
}
+ private static Universe GetUniverse () {
+ if (_universe == null) {
+ _universe = new Universe (UniverseOptions.MetadataOnly);
+ }
+ return _universe;
+ }
+
+ private static Assembly ReflectionOnlyLoadFrom (string fileName)
+ {
+ return GetUniverse ().LoadFile (fileName);
+ }
+ private static AssemblyName GetCorlibName ()
+ {
+ return GetUniverse ().Mscorlib.GetName ();
+ }
+
private static bool CheckReferencedAssemblies (AssemblyName an)
{
- AppDomain d = null;
try {
- Assembly a = Assembly.LoadFrom (an.CodeBase);
- AssemblyName corlib = typeof (object).Assembly.GetName ();
+ Assembly a = ReflectionOnlyLoadFrom (an.CodeBase);
+ AssemblyName corlib = GetCorlibName ();
foreach (AssemblyName ref_an in a.GetReferencedAssemblies ()) {
if (ref_an.Name == corlib.Name) // Just do a string compare so we can install on diff versions
} catch (Exception e) {
WriteLine (e.ToString ()); // This should be removed pre beta3
return false;
- } finally {
- if (d != null) {
- try {
- AppDomain.Unload (d);
- } catch { }
- }
}
return true;
static bool LoadConfig (bool quiet)
{
- MethodInfo config = typeof (System.Environment).GetMethod ("GetMachineConfigPath",
- BindingFlags.Static | BindingFlags.NonPublic);
+ System.Reflection.MethodInfo config = typeof (System.Environment).GetMethod ("GetMachineConfigPath",
+ System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
if (config != null) {
string path = (string) config.Invoke (null, null);
// Note: MustVerify is based on the original token (by design). Public key
// remapping won't affect if the assembly is verified or not.
- if (StrongNameManager.MustVerify (an)) {
+ if (StrongNameManager.MustVerify (new System.Reflection.AssemblyName (an.FullName))) {
RSA rsa = CryptoConvert.FromCapiPublicKeyBlob (publicKey, 12);
StrongName sn = new StrongName (rsa);
if (sn.Verify (assemblyFile)) {
public static extern int symlink (string oldpath, string newpath);
private static string GetGacDir () {
- PropertyInfo gac = typeof (System.Environment).GetProperty ("GacPath",
- BindingFlags.Static|BindingFlags.NonPublic);
+ System.Reflection.PropertyInfo gac = typeof (System.Environment).GetProperty ("GacPath",
+ System.Reflection.BindingFlags.Static|System.Reflection.BindingFlags.NonPublic);
if (gac == null) {
WriteLine ("ERROR: Mono runtime not detected, please use " +
"the mono runtime for gacutil.exe");
Environment.Exit (1);
}
- MethodInfo get_gac = gac.GetGetMethod (true);
+ System.Reflection.MethodInfo get_gac = gac.GetGetMethod (true);
return (string) get_gac.Invoke (null, null);
}
private static string GetLibDir () {
- MethodInfo libdir = typeof (System.Environment).GetMethod ("internalGetGacPath",
- BindingFlags.Static|BindingFlags.NonPublic);
+ System.Reflection.MethodInfo libdir = typeof (System.Environment).GetMethod ("internalGetGacPath",
+ System.Reflection.BindingFlags.Static|System.Reflection.BindingFlags.NonPublic);
if (libdir == null) {
WriteLine ("ERROR: Mono runtime not detected, please use " +
"the mono runtime for gacutil.exe");
driver.cs
../security/StrongNameManager.cs
+../../../external/ikvm/reflect/*.cs
+../../../external/ikvm/reflect/Metadata/*.cs
+../../../external/ikvm/reflect/Emit/*.cs
+../../../external/ikvm/reflect/Reader/*.cs
+../../../external/ikvm/reflect/Writer/*.cs
+../../../external/ikvm/reflect/Impl/ITypeOwner.cs
+../../../external/ikvm/reflect/Impl/SymbolSupport.cs
PROGRAM = mono-symbolicate.exe
LOCAL_MCS_FLAGS = \
- /D:NO_AUTHENTICODE
+ /D:NO_AUTHENTICODE /D:CECIL
-LIB_REFS = Mono.Cecil Mono.Cecil.Mdb System.Xml System.Core System
+LIB_REFS = System.Xml System.Core System
include ../../build/executable.make
SymbolManager.cs
Logger.cs
../../class/Mono.Options/Mono.Options/Options.cs
+
+../../../external/cecil/Mono/*.cs
+../../../external/cecil/Mono.Cecil/ArrayType.cs
+../../../external/cecil/Mono.Cecil/AssemblyDefinition.cs
+../../../external/cecil/Mono.Cecil/AssemblyFlags.cs
+../../../external/cecil/Mono.Cecil/AssemblyHashAlgorithm.cs
+../../../external/cecil/Mono.Cecil/AssemblyLinkedResource.cs
+../../../external/cecil/Mono.Cecil/AssemblyNameDefinition.cs
+../../../external/cecil/Mono.Cecil/AssemblyNameReference.cs
+../../../external/cecil/Mono.Cecil/AssemblyReader.cs
+../../../external/cecil/Mono.Cecil/AssemblyWriter.cs
+../../../external/cecil/Mono.Cecil/BaseAssemblyResolver.cs
+../../../external/cecil/Mono.Cecil/CallSite.cs
+../../../external/cecil/Mono.Cecil/CustomAttribute.cs
+../../../external/cecil/Mono.Cecil/DefaultAssemblyResolver.cs
+../../../external/cecil/Mono.Cecil/EmbeddedResource.cs
+../../../external/cecil/Mono.Cecil/EventAttributes.cs
+../../../external/cecil/Mono.Cecil/EventDefinition.cs
+../../../external/cecil/Mono.Cecil/EventReference.cs
+../../../external/cecil/Mono.Cecil/ExportedType.cs
+../../../external/cecil/Mono.Cecil/FieldAttributes.cs
+../../../external/cecil/Mono.Cecil/FieldDefinition.cs
+../../../external/cecil/Mono.Cecil/FieldReference.cs
+../../../external/cecil/Mono.Cecil/FileAttributes.cs
+../../../external/cecil/Mono.Cecil/FunctionPointerType.cs
+../../../external/cecil/Mono.Cecil/GenericInstanceMethod.cs
+../../../external/cecil/Mono.Cecil/GenericInstanceType.cs
+../../../external/cecil/Mono.Cecil/GenericParameter.cs
+../../../external/cecil/Mono.Cecil/GenericParameterAttributes.cs
+../../../external/cecil/Mono.Cecil/IConstantProvider.cs
+../../../external/cecil/Mono.Cecil/ICustomAttributeProvider.cs
+../../../external/cecil/Mono.Cecil/IGenericInstance.cs
+../../../external/cecil/Mono.Cecil/IGenericParameterProvider.cs
+../../../external/cecil/Mono.Cecil/IMarshalInfoProvider.cs
+../../../external/cecil/Mono.Cecil/IMemberDefinition.cs
+../../../external/cecil/Mono.Cecil/IMetadataScope.cs
+../../../external/cecil/Mono.Cecil/IMetadataTokenProvider.cs
+../../../external/cecil/Mono.Cecil/IMethodSignature.cs
+../../../external/cecil/Mono.Cecil/Import.cs
+../../../external/cecil/Mono.Cecil/LinkedResource.cs
+../../../external/cecil/Mono.Cecil/ManifestResourceAttributes.cs
+../../../external/cecil/Mono.Cecil/MarshalInfo.cs
+../../../external/cecil/Mono.Cecil/MemberDefinitionCollection.cs
+../../../external/cecil/Mono.Cecil/MemberReference.cs
+../../../external/cecil/Mono.Cecil/MetadataResolver.cs
+../../../external/cecil/Mono.Cecil/MetadataSystem.cs
+../../../external/cecil/Mono.Cecil/MethodAttributes.cs
+../../../external/cecil/Mono.Cecil/MethodCallingConvention.cs
+../../../external/cecil/Mono.Cecil/MethodDefinition.cs
+../../../external/cecil/Mono.Cecil/MethodImplAttributes.cs
+../../../external/cecil/Mono.Cecil/MethodReference.cs
+../../../external/cecil/Mono.Cecil/MethodReturnType.cs
+../../../external/cecil/Mono.Cecil/MethodSemanticsAttributes.cs
+../../../external/cecil/Mono.Cecil/MethodSpecification.cs
+../../../external/cecil/Mono.Cecil/Modifiers.cs
+../../../external/cecil/Mono.Cecil/ModuleDefinition.cs
+../../../external/cecil/Mono.Cecil/ModuleKind.cs
+../../../external/cecil/Mono.Cecil/ModuleReference.cs
+../../../external/cecil/Mono.Cecil/NativeType.cs
+../../../external/cecil/Mono.Cecil/ParameterAttributes.cs
+../../../external/cecil/Mono.Cecil/ParameterDefinition.cs
+../../../external/cecil/Mono.Cecil/ParameterDefinitionCollection.cs
+../../../external/cecil/Mono.Cecil/ParameterReference.cs
+../../../external/cecil/Mono.Cecil/PinnedType.cs
+../../../external/cecil/Mono.Cecil/PInvokeAttributes.cs
+../../../external/cecil/Mono.Cecil/PInvokeInfo.cs
+../../../external/cecil/Mono.Cecil/PointerType.cs
+../../../external/cecil/Mono.Cecil/PropertyAttributes.cs
+../../../external/cecil/Mono.Cecil/PropertyDefinition.cs
+../../../external/cecil/Mono.Cecil/PropertyReference.cs
+../../../external/cecil/Mono.Cecil/ReferenceType.cs
+../../../external/cecil/Mono.Cecil/Resource.cs
+../../../external/cecil/Mono.Cecil/SecurityDeclaration.cs
+../../../external/cecil/Mono.Cecil/SentinelType.cs
+../../../external/cecil/Mono.Cecil/TargetRuntime.cs
+../../../external/cecil/Mono.Cecil/Treatments.cs
+../../../external/cecil/Mono.Cecil/TypeAttributes.cs
+../../../external/cecil/Mono.Cecil/TypeDefinition.cs
+../../../external/cecil/Mono.Cecil/TypeDefinitionCollection.cs
+../../../external/cecil/Mono.Cecil/TypeParser.cs
+../../../external/cecil/Mono.Cecil/TypeReference.cs
+../../../external/cecil/Mono.Cecil/TypeSpecification.cs
+../../../external/cecil/Mono.Cecil/TypeSystem.cs
+../../../external/cecil/Mono.Cecil/VariantType.cs
+../../../external/cecil/Mono.Cecil/WindowsRuntimeProjections.cs
+../../../external/cecil/Mono.Cecil.Cil/*.cs
+../../../external/cecil/Mono.Cecil.Metadata/*.cs
+../../../external/cecil/Mono.Cecil.PE/*.cs
+../../../external/cecil/Mono.Collections.Generic/*.cs
+../../../external/cecil/Mono.Security.Cryptography/*.cs
+../../../external/cecil/System.Security.Cryptography/*.cs
+../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs
+../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbWriter.cs
+../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/*.cs
#include <mono/metadata/assembly.h>
#include <mono/metadata/appdomain.h>
#include <mono/utils/bsearch.h>
+#include <mono/utils/mono-counters.h>
static void setup_filter (MonoImage *image);
static gboolean should_include_type (int idx);
exit (1);
}
+static void
+thread_state_init (MonoThreadUnwindState *ctx)
+{
+}
+
int
main (int argc, char *argv [])
{
+ MonoThreadInfoRuntimeCallbacks ticallbacks;
+
GList *input_files = NULL, *l;
int i, j;
if (input_files == NULL)
usage ();
+ CHECKED_MONO_INIT ();
+ mono_counters_init ();
+ memset (&ticallbacks, 0, sizeof (ticallbacks));
+ ticallbacks.thread_state_init = thread_state_init;
+#ifndef HOST_WIN32
+ mono_w32handle_init ();
+#endif
+ mono_threads_runtime_init (&ticallbacks);
+
mono_install_assembly_load_hook (monodis_assembly_load_hook, NULL);
mono_install_assembly_search_hook (monodis_assembly_search_hook, NULL);
* Changes which are already detected at runtime, like the addition
* of icalls, do not require an increment.
*/
-#define MONO_CORLIB_VERSION 155
+#define MONO_CORLIB_VERSION 156
typedef struct
{
--- /dev/null
+/*
+ * Copyright 2015 Xamarin Inc
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_ASSEMBLY_INTERNALS_H__
+#define __MONO_METADATA_ASSEMBLY_INTERNALS_H__
+
+#include <mono/metadata/assembly.h>
+
+MONO_API MonoImage* mono_assembly_load_module_checked (MonoAssembly *assembly, uint32_t idx, MonoError *error);
+
+#endif /* __MONO_METADATA_ASSEMBLY_INTERNALS_H__ */
#include <string.h>
#include <stdlib.h>
#include "assembly.h"
+#include "assembly-internals.h"
#include "image.h"
+#include "image-internals.h"
#include "object-internals.h"
#include <mono/metadata/loader.h>
#include <mono/metadata/tabledefs.h>
MonoImage*
mono_assembly_load_module (MonoAssembly *assembly, guint32 idx)
{
- return mono_image_load_file_for_image (assembly->image, idx);
+ MonoError error;
+ MonoImage *result = mono_assembly_load_module_checked (assembly, idx, &error);
+ mono_error_assert_ok (&error);
+ return result;
}
+MONO_API MonoImage*
+mono_assembly_load_module_checked (MonoAssembly *assembly, uint32_t idx, MonoError *error)
+{
+ return mono_image_load_file_for_image_checked (assembly->image, idx, error);
+}
+
+
/**
* mono_assembly_foreach:
* @func: function to invoke for each assembly loaded
#ifndef _MONONET_METADATA_ASSEMBLY_H_
#define _MONONET_METADATA_ASSEMBLY_H_
+#include <mono/utils/mono-error.h>
#include <mono/metadata/image.h>
MONO_BEGIN_DECLS
MONO_API void mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *aname);
MONO_API void mono_assembly_load_reference (MonoImage *image, int index);
MONO_API void mono_assembly_load_references (MonoImage *image, MonoImageOpenStatus *status);
-MONO_API MonoImage* mono_assembly_load_module (MonoAssembly *assembly, uint32_t idx);
+MONO_RT_EXTERNAL_ONLY MONO_API MonoImage* mono_assembly_load_module (MonoAssembly *assembly, uint32_t idx);
MONO_API void mono_assembly_close (MonoAssembly *assembly);
MONO_API void mono_assembly_setrootdir (const char *root_dir);
MONO_API MONO_CONST_RETURN char *mono_assembly_getrootdir (void);
static void
boehm_thread_unregister (MonoThreadInfo *p);
static void
+boehm_thread_detach (MonoThreadInfo *p);
+static void
register_test_toggleref_callback (void);
#define BOEHM_GC_BIT_FINALIZER_AWARE 1
memset (&cb, 0, sizeof (cb));
cb.thread_register = boehm_thread_register;
cb.thread_unregister = boehm_thread_unregister;
+ cb.thread_detach = boehm_thread_detach;
cb.mono_method_is_critical = (gboolean (*)(void *))mono_runtime_is_critical_method;
mono_threads_init (&cb, sizeof (MonoThreadInfo));
mono_threads_add_joinable_thread ((gpointer)tid);
}
+static void
+boehm_thread_detach (MonoThreadInfo *p)
+{
+ if (mono_thread_internal_current_is_attached ())
+ mono_thread_detach_internal (mono_thread_internal_current ());
+}
+
gboolean
mono_object_is_alive (MonoObject* o)
{
#include <string.h>
#include <stdlib.h>
#include <mono/metadata/image.h>
+#include <mono/metadata/image-internals.h>
#include <mono/metadata/assembly.h>
+#include <mono/metadata/assembly-internals.h>
#include <mono/metadata/metadata.h>
#include <mono/metadata/metadata-internals.h>
#include <mono/metadata/profiler-private.h>
goto done;
case MONO_RESOLUTION_SCOPE_MODULEREF:
- module = mono_image_load_module (image, idx);
+ module = mono_image_load_module_checked (image, idx, error);
if (module)
res = mono_class_from_name_checked (module, nspace, name, error);
goto done;
if (cols [MONO_FILE_FLAGS] == FILE_CONTAINS_NO_METADATA)
continue;
- file_image = mono_image_load_file_for_image (image, i + 1);
+ file_image = mono_image_load_file_for_image_checked (image, i + 1, error);
if (file_image) {
klass = mono_class_from_name_checked (file_image, name_space, name, error);
if (klass || !is_ok (error))
impl = cols [MONO_EXP_TYPE_IMPLEMENTATION];
if ((impl & MONO_IMPLEMENTATION_MASK) == MONO_IMPLEMENTATION_FILE) {
- loaded_image = mono_assembly_load_module (image->assembly, impl >> MONO_IMPLEMENTATION_BITS);
+ loaded_image = mono_assembly_load_module_checked (image->assembly, impl >> MONO_IMPLEMENTATION_BITS, error);
if (!loaded_image)
return NULL;
klass = mono_class_from_name_checked_aux (loaded_image, name_space, name, visited_images, error);
ICALL(ENV_20, "set_ExitCode", mono_environment_exitcode_set)
ICALL_TYPE(GC, "System.GC", GC_0)
-ICALL(GC_0, "CollectionCount", mono_gc_collection_count)
+ICALL(GC_0, "GetCollectionCount", mono_gc_collection_count)
ICALL(GC_0a, "GetGeneration", mono_gc_get_generation)
+ICALL(GC_0b, "GetMaxGeneration", mono_gc_max_generation)
ICALL(GC_1, "GetTotalMemory", ves_icall_System_GC_GetTotalMemory)
ICALL(GC_2, "InternalCollect", ves_icall_System_GC_InternalCollect)
ICALL(GC_3, "KeepAlive", ves_icall_System_GC_KeepAlive)
-ICALL(GC_4, "ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize)
+ICALL(GC_4, "_ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize)
ICALL(GC_4a, "RecordPressure", mono_gc_add_memory_pressure)
-ICALL(GC_5, "SuppressFinalize", ves_icall_System_GC_SuppressFinalize)
ICALL(GC_6, "WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers)
-ICALL(GC_7, "get_MaxGeneration", mono_gc_max_generation)
+ICALL(GC_7, "_SuppressFinalize", ves_icall_System_GC_SuppressFinalize)
ICALL(GC_9, "get_ephemeron_tombstone", ves_icall_System_GC_get_ephemeron_tombstone)
ICALL(GC_8, "register_ephemeron_array", ves_icall_System_GC_register_ephemeron_array)
#include <mono/metadata/threadpool-ms-io.h>
#include <mono/metadata/monitor.h>
#include <mono/metadata/reflection.h>
+#include <mono/metadata/image-internals.h>
#include <mono/metadata/assembly.h>
+#include <mono/metadata/assembly-internals.h>
#include <mono/metadata/tabledefs.h>
#include <mono/metadata/exception.h>
#include <mono/metadata/exception-internals.h>
/* if we have no info we are optimistic and assume there is enough room */
if (!stack_addr)
return TRUE;
-#ifdef HOST_WIN32
- // FIXME: Windows dynamically extends the stack, so stack_addr might be close
- // to the current sp
- return TRUE;
-#endif
current = (guint8 *)&stack_addr;
if (current > stack_addr) {
if ((current - stack_addr) < min_size)
g_assert ((impl & MONO_IMPLEMENTATION_MASK) == MONO_IMPLEMENTATION_FILE);
file_idx = impl >> MONO_IMPLEMENTATION_BITS;
- module = mono_image_load_file_for_image (assembly->assembly->image, file_idx);
- if (!module)
+ module = mono_image_load_file_for_image_checked (assembly->assembly->image, file_idx, &error);
+ if (mono_error_set_pending_exception (&error) || !module)
return NULL;
}
else
mono_array_setref (res, j, rm);
}
else {
- MonoImage *m = mono_image_load_file_for_image (image, i + 1);
+ MonoImage *m = mono_image_load_file_for_image_checked (image, i + 1, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
if (!m) {
MonoString *fname = mono_string_new (mono_domain_get (), mono_metadata_string_heap (image, cols [MONO_FILE_NAME]));
mono_set_pending_exception (mono_get_exception_file_not_found2 (NULL, fname));
/* Append data from all modules in the assembly */
for (i = 0; i < table->rows; ++i) {
if (!(mono_metadata_decode_row_col (table, i, MONO_FILE_FLAGS) & FILE_CONTAINS_NO_METADATA)) {
- MonoImage *loaded_image = mono_assembly_load_module (image->assembly, i + 1);
+ MonoImage *loaded_image = mono_assembly_load_module_checked (image->assembly, i + 1, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
if (loaded_image) {
MonoArray *ex2;
MonoArray *res2;
MonoImage *
mono_find_image_owner (void *ptr);
+MonoImage*
+mono_image_load_file_for_image_checked (MonoImage *image, int fileidx, MonoError *error);
+
+MonoImage*
+mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error);
+
#endif /* __MONO_METADATA_IMAGE_INTERNALS_H__ */
};
static GHashTable *loaded_images_hashes [4] = {NULL, NULL, NULL, NULL};
-static GHashTable *get_loaded_images_hash (gboolean refonly)
+static GHashTable *
+get_loaded_images_hash (gboolean refonly)
{
int idx = refonly ? IMAGES_HASH_PATH_REFONLY : IMAGES_HASH_PATH;
return loaded_images_hashes [idx];
}
-static GHashTable *get_loaded_images_by_name_hash (gboolean refonly)
+static GHashTable *
+get_loaded_images_by_name_hash (gboolean refonly)
{
int idx = refonly ? IMAGES_HASH_NAME_REFONLY : IMAGES_HASH_NAME;
return loaded_images_hashes [idx];
}
+// Change the assembly set in `image` to the assembly set in `assemblyImage`. Halt if overwriting is attempted.
+// Can be used on modules loaded through either the "file" or "module" mechanism
+static gboolean
+assign_assembly_parent_for_netmodule (MonoImage *image, MonoImage *assemblyImage, MonoError *error)
+{
+ // Assembly to assign
+ MonoAssembly *assembly = assemblyImage->assembly;
+
+ while (1) {
+ // Assembly currently assigned
+ MonoAssembly *assemblyOld = image->assembly;
+ if (assemblyOld) {
+ if (assemblyOld == assembly)
+ return TRUE;
+ mono_error_set_bad_image (error, assemblyImage, "Attempted to load module %s which has already been loaded by assembly %s. This is not supported in Mono.", image->name, assemblyOld->image->name);
+ return FALSE;
+ }
+ gpointer result = InterlockedExchangePointer((gpointer *)&image->assembly, assembly);
+ if (result == assembly)
+ return TRUE;
+ }
+}
+
static gboolean debug_assembly_unload = FALSE;
#define mono_images_lock() if (mutex_inited) mono_os_mutex_lock (&images_mutex)
}
/**
- * mono_image_load_module:
+ * mono_image_load_module_checked:
*
* Load the module with the one-based index IDX from IMAGE and return it. Return NULL if
- * it cannot be loaded.
+ * it cannot be loaded. NULL without MonoError being set will be interpreted as "not found".
*/
MonoImage*
-mono_image_load_module (MonoImage *image, int idx)
+mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error)
{
MonoTableInfo *t;
MonoTableInfo *file_table;
GList *list_iter, *valid_modules = NULL;
MonoImageOpenStatus status;
+ mono_error_init (error);
+
if ((image->module_count == 0) || (idx > image->module_count || idx <= 0))
return NULL;
if (image->modules_loaded [idx - 1])
}
if (valid) {
module_ref = g_build_filename (base_dir, name, NULL);
- image->modules [idx - 1] = mono_image_open_full (module_ref, &status, refonly);
- if (image->modules [idx - 1]) {
- mono_image_addref (image->modules [idx - 1]);
- image->modules [idx - 1]->assembly = image->assembly;
+ MonoImage *moduleImage = mono_image_open_full (module_ref, &status, refonly);
+ if (moduleImage) {
+ if (!assign_assembly_parent_for_netmodule (moduleImage, image, error)) {
+ mono_image_close (moduleImage);
+ g_free (module_ref);
+ g_free (base_dir);
+ g_list_free (valid_modules);
+ return NULL;
+ }
+
+ image->modules [idx - 1] = image;
+
#ifdef HOST_WIN32
if (image->modules [idx - 1]->is_module_handle)
mono_image_fixup_vtable (image->modules [idx - 1]);
return image->modules [idx - 1];
}
+MonoImage*
+mono_image_load_module (MonoImage *image, int idx)
+{
+ MonoError error;
+ MonoImage *result = mono_image_load_module_checked (image, idx, &error);
+ mono_error_assert_ok (&error);
+ return result;
+}
+
static gpointer
class_key_extract (gpointer value)
{
free_hash (cache->thunk_invoke_cache);
}
+static void
+mono_image_close_except_pools_all (MonoImage**images, int image_count)
+{
+ for (int i = 0; i < image_count; ++i) {
+ if (images [i]) {
+ if (!mono_image_close_except_pools (images [i]))
+ images [i] = NULL;
+ }
+ }
+}
+
/*
* Returns whether mono_image_close_finish() must be called as well.
* We must unload images in two steps because clearing the domain in
g_free (image->name);
g_free (image->guid);
g_free (image->version);
- g_free (image->files);
}
if (image->method_cache)
g_free (image->image_info);
}
- for (i = 0; i < image->module_count; ++i) {
- if (image->modules [i]) {
- if (!mono_image_close_except_pools (image->modules [i]))
- image->modules [i] = NULL;
- }
- }
+ mono_image_close_except_pools_all (image->files, image->file_count);
+ mono_image_close_except_pools_all (image->modules, image->module_count);
if (image->modules_loaded)
g_free (image->modules_loaded);
return TRUE;
}
+static void
+mono_image_close_all (MonoImage**images, int image_count)
+{
+ for (int i = 0; i < image_count; ++i) {
+ if (images [i])
+ mono_image_close_finish (images [i]);
+ }
+ if (images)
+ g_free (images);
+}
+
void
mono_image_close_finish (MonoImage *image)
{
image->references = NULL;
}
- for (i = 0; i < image->module_count; ++i) {
- if (image->modules [i])
- mono_image_close_finish (image->modules [i]);
- }
- if (image->modules)
- g_free (image->modules);
+ mono_image_close_all (image->files, image->file_count);
+ mono_image_close_all (image->modules, image->module_count);
#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->loader_bytes -= mono_mempool_get_allocated (image->mempool);
return data;
}
+// Returning NULL with no error set will be interpeted as "not found"
MonoImage*
-mono_image_load_file_for_image (MonoImage *image, int fileidx)
+mono_image_load_file_for_image_checked (MonoImage *image, int fileidx, MonoError *error)
{
char *base_dir, *name;
MonoImage *res;
const char *fname;
guint32 fname_id;
+ mono_error_init (error);
+
if (fileidx < 1 || fileidx > t->rows)
return NULL;
} else {
int i;
/* g_print ("loaded file %s from %s (%p)\n", name, image->name, image->assembly); */
- res->assembly = image->assembly;
+ if (!assign_assembly_parent_for_netmodule (res, image, error)) {
+ mono_image_unlock (image);
+ mono_image_close (res);
+ return NULL;
+ }
+
for (i = 0; i < res->module_count; ++i) {
if (res->modules [i] && !res->modules [i]->assembly)
res->modules [i]->assembly = image->assembly;
}
- if (!image->files)
+ if (!image->files) {
image->files = g_new0 (MonoImage*, t->rows);
+ image->file_count = t->rows;
+ }
image->files [fileidx - 1] = res;
mono_image_unlock (image);
/* vtable fixup can't happen with the image lock held */
return res;
}
+MonoImage*
+mono_image_load_file_for_image (MonoImage *image, int fileidx)
+{
+ MonoError error;
+ MonoImage *result = mono_image_load_file_for_image_checked (image, fileidx, &error);
+ mono_error_assert_ok (&error);
+ return result;
+}
+
/**
* mono_image_get_strong_name:
* @image: a MonoImage
#include <stdio.h>
#include <mono/utils/mono-publib.h>
+#include <mono/utils/mono-error.h>
MONO_BEGIN_DECLS
MONO_API uint32_t mono_image_get_entry_point (MonoImage *image);
MONO_API const char *mono_image_get_resource (MonoImage *image, uint32_t offset, uint32_t *size);
-MONO_API MonoImage* mono_image_load_file_for_image (MonoImage *image, int fileidx);
+MONO_RT_EXTERNAL_ONLY MONO_API MonoImage* mono_image_load_file_for_image (MonoImage *image, int fileidx);
-MONO_API MonoImage* mono_image_load_module (MonoImage *image, int idx);
+MONO_RT_EXTERNAL_ONLY MONO_API MonoImage* mono_image_load_module (MonoImage *image, int idx);
MONO_API const char* mono_image_get_name (MonoImage *image);
MONO_API const char* mono_image_get_filename (MonoImage *image);
struct _MonoImage {
/*
- * The number of assemblies which reference this MonoImage though their 'image'
- * field plus the number of images which reference this MonoImage through their
- * 'modules' field, plus the number of threads holding temporary references to
- * this image between calls of mono_image_open () and mono_image_close ().
+ * This count is incremented during these situations:
+ * - An assembly references this MonoImage though its 'image' field
+ * - This MonoImage is present in the 'files' field of an image
+ * - This MonoImage is present in the 'modules' field of an image
+ * - A thread is holding a temporary reference to this MonoImage between
+ * calls to mono_image_open and mono_image_close ()
*/
int ref_count;
MonoAssembly **references;
int nreferences;
- /* Code files in the assembly. */
+ /* Code files in the assembly. The main assembly has a "file" table and also a "module"
+ * table, where the module table is a subset of the file table. We track both lists,
+ * and because we can lazy-load them at different times we reference-increment both.
+ */
MonoImage **modules;
guint32 module_count;
gboolean *modules_loaded;
- /*
- * Files in the assembly. Items are either NULL or alias items in modules, so this does not impact ref_count.
- * Protected by the image lock.
- */
MonoImage **files;
+ guint32 file_count;
gpointer aot_module;
gpointer thread_pinning_ref;
gsize abort_protected_block_count;
gint32 priority;
+ GPtrArray *owned_mutexes;
/*
* These fields are used to avoid having to increment corlib versions
* when a new field is added to this structure.
info->client_info.signal = 0;
#endif
- /* On win32, stack_start_limit should be 0, since the stack can grow dynamically */
mono_thread_info_get_stack_bounds (&staddr, &stsize);
if (staddr) {
-#ifndef HOST_WIN32
info->client_info.stack_start_limit = staddr;
-#endif
info->client_info.stack_end = staddr + stsize;
} else {
gsize stack_bottom = (gsize)stack_bottom_fallback;
* so we assume that if the domain is still registered, we can detach
* the thread
*/
- if (mono_domain_get ())
+ if (mono_thread_internal_current_is_attached ())
mono_thread_detach_internal (mono_thread_internal_current ());
}
CloseHandle (handle);
- return result != (DWORD)-1;
+ return result != (DWORD)-1 && result > 0;
}
gboolean
typedef struct {
gint32 ref;
- MonoCoopSem sem;
+ MonoCoopCond cond;
} ThreadPoolDomainCleanupSemaphore;
typedef enum {
ThreadPoolDomainCleanupSemaphore *cleanup_semaphore;
cleanup_semaphore = g_new0 (ThreadPoolDomainCleanupSemaphore, 1);
cleanup_semaphore->ref = 2;
- mono_coop_sem_init (&cleanup_semaphore->sem, 0);
+ mono_coop_cond_init (&cleanup_semaphore->cond);
g_assert(!domain->cleanup_semaphore);
domain->cleanup_semaphore = cleanup_semaphore;
g_assert (removed);
cleanup_semaphore = (ThreadPoolDomainCleanupSemaphore*) tpdomain->domain->cleanup_semaphore;
+ g_assert (cleanup_semaphore);
+
+ mono_coop_cond_signal (&cleanup_semaphore->cond);
- g_assert(cleanup_semaphore);
- mono_coop_sem_post (&cleanup_semaphore->sem);
if (InterlockedDecrement (&cleanup_semaphore->ref) == 0) {
- mono_coop_sem_destroy (&cleanup_semaphore->sem);
+ mono_coop_cond_destroy (&cleanup_semaphore->cond);
g_free (cleanup_semaphore);
tpdomain->domain->cleanup_semaphore = NULL;
}
gboolean
mono_threadpool_ms_remove_domain_jobs (MonoDomain *domain, int timeout)
{
- gint res;
- gint64 now, end;
+ gint64 end;
ThreadPoolDomain *tpdomain;
ThreadPoolDomainCleanupSemaphore *cleanup_semaphore;
+ gboolean ret;
g_assert (domain);
g_assert (timeout >= -1);
return TRUE;
}
- mono_coop_mutex_unlock(&threadpool->domains_lock);
-
g_assert (domain->cleanup_semaphore);
-
cleanup_semaphore = (ThreadPoolDomainCleanupSemaphore*) domain->cleanup_semaphore;
- if (timeout == -1) {
- res = mono_coop_sem_wait (&cleanup_semaphore->sem, MONO_SEM_FLAGS_NONE);
- g_assert (res == MONO_SEM_TIMEDWAIT_RET_SUCCESS);
- } else {
- now = mono_msec_ticks();
- if (now > end)
- return FALSE;
- res = mono_coop_sem_timedwait (&cleanup_semaphore->sem, end - now, MONO_SEM_FLAGS_NONE);
- }
+ ret = TRUE;
+
+ do {
+ if (timeout == -1) {
+ mono_coop_cond_wait (&cleanup_semaphore->cond, &threadpool->domains_lock);
+ } else {
+ gint64 now;
+ gint res;
+
+ now = mono_msec_ticks();
+ if (now > end) {
+ ret = FALSE;
+ break;
+ }
+
+ res = mono_coop_cond_timedwait (&cleanup_semaphore->cond, &threadpool->domains_lock, end - now);
+ if (res != 0) {
+ ret = FALSE;
+ break;
+ }
+ }
+ } while (tpdomain->outstanding_request != 0);
if (InterlockedDecrement (&cleanup_semaphore->ref) == 0) {
- mono_coop_sem_destroy (&cleanup_semaphore->sem);
+ mono_coop_cond_destroy (&cleanup_semaphore->cond);
g_free (cleanup_semaphore);
domain->cleanup_semaphore = NULL;
}
- return res == MONO_SEM_TIMEDWAIT_RET_SUCCESS;
+ mono_coop_mutex_unlock(&threadpool->domains_lock);
+
+ return ret;
}
void
void mono_threads_end_abort_protected_block (void);
MonoException* mono_thread_try_resume_interruption (void);
+gboolean
+mono_thread_internal_current_is_attached (void);
+
+void
+mono_thread_internal_describe (MonoInternalThread *internal, GString *str);
+
+gboolean
+mono_thread_internal_is_current (MonoInternalThread *internal);
+
#endif /* _MONO_METADATA_THREADS_TYPES_H_ */
#include <mono/utils/mono-error-internals.h>
#include <mono/utils/w32handle.h>
#include <mono/metadata/w32event.h>
+#include <mono/metadata/w32mutex.h>
#include <mono/metadata/gc-internals.h>
#include <mono/metadata/reflection-internals.h>
* for the current thead */
mono_thread_cleanup_apartment_state ();
- thread_cleanup (internal);
+ mono_thread_detach_internal (internal);
internal->tid = 0;
- /* Remove the reference to the thread object in the TLS data,
- * so the thread object can be finalized. This won't be
- * reached if the thread threw an uncaught exception, so those
- * thread handles will stay referenced :-( (This is due to
- * missing support for scanning thread-specific data in the
- * Boehm GC - the io-layer keeps a GC-visible hash of pointers
- * to TLS data.)
- */
- SET_CURRENT_OBJECT (NULL);
-
return(0);
}
MonoNativeThreadId tid;
gsize stack_ptr;
- if ((internal = mono_thread_internal_current ())) {
+ if (mono_thread_internal_current_is_attached ()) {
if (domain != mono_domain_get ())
mono_domain_set (domain, TRUE);
/* Already attached */
THREAD_DEBUG (g_message ("%s: mono_thread_detach for %p (%"G_GSIZE_FORMAT")", __func__, thread, (gsize)thread->tid));
+#ifndef HOST_WIN32
+ mono_w32mutex_abandon ();
+#endif
+
thread_cleanup (thread);
SET_CURRENT_OBJECT (NULL);
return FALSE;
}
+gboolean
+mono_thread_internal_current_is_attached (void)
+{
+ MonoInternalThread *internal;
+
+ internal = GET_CURRENT_OBJECT ();
+ if (!internal)
+ return FALSE;
+
+ return TRUE;
+}
+
void
mono_thread_exit (void)
{
THREAD_DEBUG (g_message ("%s: mono_thread_exit for %p (%"G_GSIZE_FORMAT")", __func__, thread, (gsize)thread->tid));
- thread_cleanup (thread);
- SET_CURRENT_OBJECT (NULL);
- mono_domain_unset ();
+ mono_thread_detach_internal (thread);
/* we could add a callback here for embedders to use. */
if (mono_thread_get_main () && (thread == mono_thread_get_main ()->internal_thread))
exit (mono_environment_exitcode_get ());
+
mono_thread_info_exit ();
}
UNLOCK_THREAD (current_thread);
}
- /*since we're killing the thread, unset the current domain.*/
- mono_domain_unset ();
+ /*since we're killing the thread, detach it.*/
+ mono_thread_detach_internal (current_thread);
/* Wake up other threads potentially waiting for us */
mono_thread_info_exit ();
#if 0
/* This no longer works with remote unwinding */
g_string_append_printf (text, " tid=0x%p this=0x%p ", (gpointer)(gsize)thread->tid, thread);
- mono_thread_info_describe (info, text);
+ mono_thread_internal_describe (thread, text);
g_string_append (text, "\n");
#endif
UNLOCK_THREAD (thread);
return TRUE;
-}
\ No newline at end of file
+}
+
+void
+mono_thread_internal_describe (MonoInternalThread *internal, GString *text)
+{
+ g_string_append_printf (text, ", thread handle : %p", internal->handle);
+
+ if (internal->thread_info) {
+ g_string_append (text, ", state : ");
+ mono_thread_info_describe_interrupt_token ((MonoThreadInfo*) internal->thread_info, text);
+ }
+
+ if (internal->owned_mutexes) {
+ int i;
+
+ g_string_append (text, ", owns : [");
+ for (i = 0; i < internal->owned_mutexes->len; i++)
+ g_string_append_printf (text, i == 0 ? "%p" : ", %p", g_ptr_array_index (internal->owned_mutexes, i));
+ g_string_append (text, "]");
+ }
+}
+
+gboolean
+mono_thread_internal_is_current (MonoInternalThread *internal)
+{
+ g_assert (internal);
+ return mono_native_thread_id_equals (mono_native_thread_id_get (), MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid));
+}
*/
#include "w32mutex.h"
-#include "w32mutex-utils.h"
#include <pthread.h>
#include "w32handle-namespace.h"
#include "mono/io-layer/io-layer.h"
+#include "mono/metadata/object-internals.h"
#include "mono/utils/mono-logger-internals.h"
#include "mono/utils/mono-threads.h"
#include "mono/utils/w32handle.h"
MonoW32HandleNamespace sharedns;
};
+static void
+thread_own_mutex (MonoInternalThread *internal, gpointer handle)
+{
+ mono_w32handle_ref (handle);
+
+ /* if we are not on the current thread, there is a
+ * race condition when allocating internal->owned_mutexes */
+ g_assert (mono_thread_internal_is_current (internal));
+
+ if (!internal->owned_mutexes)
+ internal->owned_mutexes = g_ptr_array_new ();
+
+ g_ptr_array_add (internal->owned_mutexes, handle);
+}
+
+static void
+thread_disown_mutex (MonoInternalThread *internal, gpointer handle)
+{
+ gboolean removed;
+
+ g_assert (mono_thread_internal_is_current (internal));
+
+ g_assert (internal->owned_mutexes);
+ removed = g_ptr_array_remove (internal->owned_mutexes, handle);
+ g_assert (removed);
+
+ mono_w32handle_unref (handle);
+}
+
static gboolean
mutex_handle_own (gpointer handle, MonoW32HandleType type, guint32 *statuscode)
{
return FALSE;
}
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p, tid %p, recursion %u",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p, before: [tid: %p, recursion: %d], after: [tid: %p, recursion: %d], abandoned: %s",
+ __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion, (gpointer) pthread_self (), mutex_handle->recursion + 1, mutex_handle->abandoned ? "true" : "false");
+
+ if (mutex_handle->recursion != 0) {
+ g_assert (pthread_equal (pthread_self (), mutex_handle->tid));
+ mutex_handle->recursion++;
+ } else {
+ mutex_handle->tid = pthread_self ();
+ mutex_handle->recursion = 1;
- mono_thread_info_own_mutex (mono_thread_info_current (), handle);
+ thread_own_mutex (mono_thread_internal_current (), handle);
+ }
- mutex_handle->tid = pthread_self ();
- mutex_handle->recursion++;
if (mutex_handle->abandoned) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: mutex handle %p was abandoned", __func__, handle);
mutex_handle->abandoned = FALSE;
*statuscode = WAIT_ABANDONED_0;
}
__func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self ());
return TRUE;
} else {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p not owned by %p, but locked %d times by %p",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self (), mutex_handle->recursion, (gpointer) mutex_handle->tid);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p not owned by %p, tid: %p recursion: %d",
+ __func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self (), (gpointer) mutex_handle->tid, mutex_handle->recursion);
return FALSE;
}
}
return FALSE;
}
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p, tid: %p recursion: %d",
+ __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
thr_ret = mono_w32handle_lock_handle (handle);
g_assert (thr_ret == 0);
mutex_handle->recursion--;
if (mutex_handle->recursion == 0) {
- mono_thread_info_disown_mutex (mono_thread_info_current (), handle);
+ thread_disown_mutex (mono_thread_internal_current (), handle);
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking %s handle %p, tid: %p recusion : %d",
+ __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
mutex_handle->tid = 0;
mono_w32handle_set_signal_state (handle, TRUE, FALSE);
}
void
-mono_w32mutex_abandon (gpointer handle, MonoNativeThreadId tid)
+mono_w32mutex_abandon (void)
{
- MonoW32HandleType type;
- MonoW32HandleMutex *mutex_handle;
- int thr_ret;
+ MonoInternalThread *internal;
- switch (type = mono_w32handle_get_type (handle)) {
- case MONO_W32HANDLE_MUTEX:
- case MONO_W32HANDLE_NAMEDMUTEX:
- break;
- default:
- g_assert_not_reached ();
- }
+ g_assert (mono_thread_internal_current_is_attached ());
- if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
- g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ internal = mono_thread_internal_current ();
+ g_assert (internal);
+
+ if (!internal->owned_mutexes)
return;
- }
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandon %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ while (internal->owned_mutexes->len) {
+ MonoW32HandleType type;
+ MonoW32HandleMutex *mutex_handle;
+ MonoNativeThreadId tid;
+ gpointer handle;
+ int thr_ret;
+
+ handle = g_ptr_array_index (internal->owned_mutexes, 0);
+
+ switch (type = mono_w32handle_get_type (handle)) {
+ case MONO_W32HANDLE_MUTEX:
+ case MONO_W32HANDLE_NAMEDMUTEX:
+ break;
+ default:
+ g_assert_not_reached ();
+ }
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
+ g_error ("%s: error looking up %s handle %p",
+ __func__, mono_w32handle_ops_typename (type), handle);
+ }
+
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoning %s handle %p",
+ __func__, mono_w32handle_ops_typename (type), handle);
+
+ tid = MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid);
+
+ if (!pthread_equal (mutex_handle->tid, tid))
+ g_error ("%s: trying to release mutex %p acquired by thread %p from thread %p",
+ __func__, handle, (gpointer) mutex_handle->tid, (gpointer) tid);
+
+ thr_ret = mono_w32handle_lock_handle (handle);
+ g_assert (thr_ret == 0);
- if (pthread_equal (mutex_handle->tid, tid)) {
mutex_handle->recursion = 0;
mutex_handle->tid = 0;
mutex_handle->abandoned = TRUE;
mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+ thread_disown_mutex (internal, handle);
+
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoned %s handle %p",
__func__, mono_w32handle_ops_typename (type), handle);
+
+ thr_ret = mono_w32handle_unlock_handle (handle);
+ g_assert (thr_ret == 0);
}
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ g_ptr_array_free (internal->owned_mutexes, TRUE);
+ internal->owned_mutexes = NULL;
}
MonoW32HandleNamespace*
+++ /dev/null
-
-/* This is just a hack so we can call mono_w32mutex_abandon
- * from mono/utils/mono-threads-posix.c, without importing
- * the whole object.h
- * In the best of all world, mutex owning + disowning + abandoning
- * should be done in metadata/ */
-
-#ifndef _MONO_METADATA_W32MUTEX_UTILS_H_
-#define _MONO_METADATA_W32MUTEX_UTILS_H_
-
-#include <config.h>
-#include <glib.h>
-
-#include "mono/utils/mono-threads.h"
-
-void
-mono_w32mutex_abandon (gpointer handle, MonoNativeThreadId tid);
-
-#endif /* _MONO_METADATA_W32MUTEX_UTILS_H_ */
-
MonoW32HandleNamespace*
mono_w32mutex_get_namespace (MonoW32HandleNamedMutex *mutex);
+#ifndef HOST_WIN32
+void
+mono_w32mutex_abandon (void);
+#endif
+
#endif /* _MONO_METADATA_W32MUTEX_H_ */
g_string_append (text, "\n\"<unnamed thread>\"");
g_string_append_printf (text, " tid=0x%p this=0x%p ", (gpointer)(gsize)thread->tid, thread);
- mono_thread_info_describe ((MonoThreadInfo*) thread->thread_info, text);
+ mono_thread_internal_describe (thread, text);
g_string_append (text, "\n");
#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
FEATUREFUL_RUNTIME_TEST = test-appdomain-unload
endif
-check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-cattr-type-load test-reflection-load-with-context test_platform \
+check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-multi-netmodule test-cattr-type-load test-reflection-load-with-context test_platform \
test-console-output test-messages test-env-options test-unhandled-exception-2 $(FEATUREFUL_RUNTIME_TEST) test-process-stress rm-empty-logs
check-full: test-sgen check-local
check-parallel: compile-tests check-full
@echo "Testing load-exception.exe..."
@$(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr
+EXTRA_DIST += test-multi-netmodule-1-netmodule.cs test-multi-netmodule-2-dll1.cs test-multi-netmodule-3-dll2.cs test-multi-netmodule-4-exe.cs
+test-multi-netmodule:
+ @$(MCS) -t:module test-multi-netmodule-1-netmodule.cs
+ @$(MCS) -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library test-multi-netmodule-2-dll1.cs
+ @$(MCS) -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library test-multi-netmodule-3-dll2.cs
+ @$(MCS) -r:test-multi-netmodule-2-dll1.dll test-multi-netmodule-4-exe.cs
+ $(RUNTIME) test-multi-netmodule-4-exe.exe > test-multi-netmodule-4-exe.exe.stdout 2> test-multi-netmodule-4-exe.exe.stderr
+
EXTRA_DIST += custom-attr-errors.cs custom-attr-errors-lib.cs
test-cattr-type-load: $(TEST_DRIVER_DEPEND) custom-attr-errors.cs custom-attr-errors-lib.cs
$(MCS) -D:WITH_MEMBERS /t:library $(srcdir)/custom-attr-errors-lib.cs
--- /dev/null
+// Compiler options: -t:module
+
+public class M1 {
+}
--- /dev/null
+// Compiler options: -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library
+
+public class M2 {
+ public M1 m1 = new M1();
+}
--- /dev/null
+// Compiler options: -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library
+
+public class M3 {
+ public M1 m1 = new M1();
+}
--- /dev/null
+// Compiler options: -r:test-multi-netmodule-2-dll1.dll
+
+using System;
+using System.Reflection;
+
+public class M4 {
+ public static int Main () {
+ M2 m2 = new M2();
+
+ // Expecting failure
+ try {
+ var DLL = Assembly.LoadFile(@"test-multi-netmodule-3-dll2.dll");
+ var m3Type = DLL.GetType("M3");
+ var m3 = Activator.CreateInstance(m3Type);
+ var m3m1Field = m3Type.GetField("m1");
+
+ Console.WriteLine("M3 assembly:" + m3Type.Assembly);
+ Console.WriteLine("M3.M1 assembly:" + m3m1Field.DeclaringType.Assembly);
+ } catch (System.TypeLoadException) {
+ return 0;
+ }
+
+ Console.WriteLine("M2 assembly:" + typeof (M2).Assembly);
+ Console.WriteLine("M2.M1 assembly:" + m2.m1.GetType().Assembly);
+
+ return 1;
+ }
+}
// For each queued image visit all directly referenced images
int inner_idx;
+ // 'files' and 'modules' semantically contain the same items but because of lazy loading we must check both
+ for (inner_idx = 0; !success && inner_idx < checking->file_count; inner_idx++)
+ {
+ CHECK_IMAGE_VISIT (checking->files[inner_idx]);
+ }
+
for (inner_idx = 0; !success && inner_idx < checking->module_count; inner_idx++)
{
CHECK_IMAGE_VISIT (checking->modules[inner_idx]);
for (inner_idx = 0; !success && inner_idx < checking->nreferences; inner_idx++)
{
- // References are lazy-loaded and thus allowed to be NULL.
- // If they are NULL, we don't care about them for this search, because they haven't impacted ref_count yet.
- if (checking->references[inner_idx])
- {
- CHECK_IMAGE_VISIT (checking->references[inner_idx]->image);
- }
+ CHECK_IMAGE_VISIT (checking->references[inner_idx]->image);
}
mono_image_unlock (checking);
#include <mono/utils/mono-threads-posix-signals.h>
#include <mono/utils/mono-coop-semaphore.h>
#include <mono/metadata/gc-internals.h>
-#include <mono/metadata/w32mutex-utils.h>
#include <mono/utils/w32handle.h>
#include <errno.h>
{
gpointer thread_handle;
- info->owned_mutexes = g_ptr_array_new ();
-
thread_handle = mono_w32handle_new (MONO_W32HANDLE_THREAD, NULL);
if (thread_handle == INVALID_HANDLE_VALUE)
g_error ("%s: failed to create handle", __func__);
void
mono_threads_platform_set_exited (MonoThreadInfo *info)
{
- gpointer mutex_handle;
- int i, thr_ret;
- pthread_t tid;
+ int thr_ret;
g_assert (info->handle);
-
if (mono_w32handle_issignalled (info->handle))
g_error ("%s: handle %p thread %p has already exited, it's handle is signalled", __func__, info->handle, mono_thread_info_get_tid (info));
if (mono_w32handle_get_type (info->handle) == MONO_W32HANDLE_UNUSED)
g_error ("%s: handle %p thread %p has already exited, it's handle type is 'unused'", __func__, info->handle, mono_thread_info_get_tid (info));
- tid = pthread_self ();
-
- for (i = 0; i < info->owned_mutexes->len; i++) {
- mutex_handle = g_ptr_array_index (info->owned_mutexes, i);
- mono_w32mutex_abandon (mutex_handle, tid);
- mono_thread_info_disown_mutex (info, mutex_handle);
- }
-
- g_ptr_array_free (info->owned_mutexes, TRUE);
-
thr_ret = mono_w32handle_lock_handle (info->handle);
g_assert (thr_ret == 0);
info->handle = NULL;
}
-void
-mono_threads_platform_describe (MonoThreadInfo *info, GString *text)
-{
- int i;
-
- g_string_append_printf (text, "thread handle %p state : ", info->handle);
-
- mono_thread_info_describe_interrupt_token (info, text);
-
- g_string_append_printf (text, ", owns (");
- for (i = 0; i < info->owned_mutexes->len; i++)
- g_string_append_printf (text, i > 0 ? ", %p" : "%p", g_ptr_array_index (info->owned_mutexes, i));
- g_string_append_printf (text, ")");
-}
-
-void
-mono_threads_platform_own_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
- mono_w32handle_ref (mutex_handle);
-
- g_ptr_array_add (info->owned_mutexes, mutex_handle);
-}
-
-void
-mono_threads_platform_disown_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
- mono_w32handle_unref (mutex_handle);
-
- g_ptr_array_remove (info->owned_mutexes, mutex_handle);
-}
-
static const gchar* thread_typename (void)
{
return "Thread";
info->handle = NULL;
}
-void
-mono_threads_platform_describe (MonoThreadInfo *info, GString *text)
-{
- /* TODO */
-}
-
-void
-mono_threads_platform_own_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
- g_assert_not_reached ();
-}
-
-void
-mono_threads_platform_disown_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
- g_assert_not_reached ();
-}
-
void
mono_threads_platform_init (void)
{
g_assert (mono_thread_info_is_current (info));
return mono_threads_platform_duplicate_handle (info);
}
-
-void
-mono_thread_info_describe (MonoThreadInfo *info, GString *text)
-{
- mono_threads_platform_describe (info, text);
-}
-
-void
-mono_thread_info_own_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
- mono_threads_platform_own_mutex (info, mutex_handle);
-}
-
-void
-mono_thread_info_disown_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
- mono_threads_platform_disown_mutex (info, mutex_handle);
-}
/* Stack mark for targets that explicitly require one */
gpointer stack_mark;
-
-#if defined(_POSIX_VERSION) || defined(__native_client__)
- /* This is the data that was stored in the w32 handle */
- GPtrArray *owned_mutexes;
-#endif
} MonoThreadInfo;
typedef struct {
HANDLE mono_threads_platform_open_thread_handle (HANDLE handle, MonoNativeThreadId tid);
void mono_threads_platform_close_thread_handle (HANDLE handle);
void mono_threads_platform_set_exited (THREAD_INFO_TYPE *info);
-void mono_threads_platform_describe (THREAD_INFO_TYPE *info, GString *text);
-void mono_threads_platform_own_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle);
-void mono_threads_platform_disown_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle);
gpointer mono_threads_platform_duplicate_handle (THREAD_INFO_TYPE *info);
void mono_threads_coop_begin_global_suspend (void);
gpointer
mono_thread_info_duplicate_handle (THREAD_INFO_TYPE *info);
-void
-mono_thread_info_describe (THREAD_INFO_TYPE *info, GString *text);
-
-void
-mono_thread_info_own_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle);
-
-void
-mono_thread_info_disown_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle);
-
#endif /* __MONO_THREADS_H__ */
static gboolean
mono_w32handle_unref_core (gpointer handle, MonoW32HandleBase *handle_data, guint minimum)
{
+ MonoW32HandleType type;
guint old, new;
+ type = handle_data->type;
+
do {
old = handle_data->ref;
if (!(old >= minimum))
new = old - 1;
} while (InterlockedCompareExchange ((gint32*) &handle_data->ref, new, old) != old);
+ /* handle_data might contain invalid data from now on, if
+ * another thread is unref'ing this handle at the same time */
+
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: unref %s handle %p, ref: %d -> %d destroy: %s",
- __func__, mono_w32handle_ops_typename (handle_data->type), handle, old, new, new == 0 ? "true" : "false");
+ __func__, mono_w32handle_ops_typename (type), handle, old, new, new == 0 ? "true" : "false");
return new == 0;
}
<resources>System.Web.Http.WebHost.Properties.CommonWebApiResources,../../../external/aspnetwebstack/src/Common/CommonWebApiResources.resx System.Web.Http.WebHost.Properties.SRResources,../../../external/aspnetwebstack/src/System.Web.Http.WebHost/Properties/SRResources.resx</resources>
<response>System.Web.Http.WebHost.dll.sources</response>
</project>
- <project dir="class/Mono.Security.Providers.NewSystemSource" library="Mono.Security.Providers.NewSystemSource-net_4_x">
- <boot>false</boot>
- <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -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 -d:MONO_SECURITY_ALIAS -r:./../../class/lib/net_4_x/System.dll -r:MonoSecurity=./../../class/lib/net_4_x/Mono.Security.dll</flags>
- <output>Mono.Security.Providers.NewSystemSource.dll</output>
- <built_sources></built_sources>
- <library_output>./../../class/lib/net_4_x/Mono.Security.Providers.NewSystemSource.dll</library_output>
- <fx_version>4.5</fx_version>
- <profile>net_4_x</profile>
- <resources></resources>
- <response>Mono.Security.Providers.NewSystemSource.dll.sources</response>
- </project>
- <project dir="class/Mono.Security.Providers.NewTls" library="Mono.Security.Providers.NewTls-net_4_x">
- <boot>false</boot>
- <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:NewSystemSource=./../../class/lib/net_4_x/Mono.Security.Providers.NewSystemSource.dll</flags>
- <output>Mono.Security.Providers.NewTls.dll</output>
- <built_sources></built_sources>
- <library_output>./../../class/lib/net_4_x/Mono.Security.Providers.NewTls.dll</library_output>
- <fx_version>4.5</fx_version>
- <profile>net_4_x</profile>
- <resources></resources>
- <response>Mono.Security.Providers.NewTls.dll.sources</response>
- </project>
<project dir="class/System.Runtime.InteropServices.RuntimeInformation" library="System.Runtime.InteropServices.RuntimeInformation-net_4_x">
<boot>false</boot>
<flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.dll</flags>
<resources></resources>
<response>System.Xml.Serialization.dll.sources</response>
</project>
- <project dir="class/Mono.Security.Providers.DotNet" library="Mono.Security.Providers.DotNet-net_4_x">
- <boot>false</boot>
- <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Security.dll</flags>
- <output>Mono.Security.Providers.DotNet.dll</output>
- <built_sources></built_sources>
- <library_output>./../../class/lib/net_4_x/Mono.Security.Providers.DotNet.dll</library_output>
- <fx_version>4.5</fx_version>
- <profile>net_4_x</profile>
- <resources></resources>
- <response>Mono.Security.Providers.DotNet.dll.sources</response>
- </project>
- <project dir="class/Mono.Security.Providers.OldTls" library="Mono.Security.Providers.OldTls-net_4_x">
- <boot>false</boot>
- <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY_DEP -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Security.dll</flags>
- <output>Mono.Security.Providers.OldTls.dll</output>
- <built_sources></built_sources>
- <library_output>./../../class/lib/net_4_x/Mono.Security.Providers.OldTls.dll</library_output>
- <fx_version>4.5</fx_version>
- <profile>net_4_x</profile>
- <resources></resources>
- <response>Mono.Security.Providers.OldTls.dll.sources</response>
- </project>
<project dir="class/System.DirectoryServices.Protocols" library="System.DirectoryServices.Protocols-net_4_x">
<boot>false</boot>
<flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.DirectoryServices.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Web.Http.WebHost-net_4_x", "mcs/class/System.Web.Http.WebHost/System.Web.Http.WebHost-net_4_x.csproj", "{2AF7E697-07BA-439E-89BF-076AEE4AE04C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.NewSystemSource-net_4_x", "mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj", "{0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.NewTls-net_4_x", "mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls-net_4_x.csproj", "{C8B8E524-BB3A-44E2-8C22-E3313E9F477C}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Build.Framework-net_4_x", "mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework-net_4_x.csproj", "{5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Build.Utilities-net_4_x", "mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities-net_4_x.csproj", "{8E5728E0-CEAF-431F-963E-EB1DEE15C506}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Xml.Serialization-net_4_x", "mcs/class/System.Xml.Serialization/System.Xml.Serialization-net_4_x.csproj", "{2210873E-99FC-48A2-A261-D650BAE33A1C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.DotNet-net_4_x", "mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet-net_4_x.csproj", "{391EDD2B-85AC-4FCA-B607-AAD6C51E6799}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.OldTls-net_4_x", "mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls-net_4_x.csproj", "{E485E885-59B1-4081-BC66-56AAAFD8771A}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.DirectoryServices.Protocols-net_4_x", "mcs/class/System.DirectoryServices.Protocols/System.DirectoryServices.Protocols-net_4_x.csproj", "{EF08F249-31A1-4E62-8391-ECBA5227B686}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.VisualC-net_4_x", "mcs/class/Microsoft.VisualC/Microsoft.VisualC-net_4_x.csproj", "{ACA2694D-9F07-4AE2-9171-9AB5DD1A8C18}"
{2AF7E697-07BA-439E-89BF-076AEE4AE04C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2AF7E697-07BA-439E-89BF-076AEE4AE04C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2AF7E697-07BA-439E-89BF-076AEE4AE04C}.Release|Any CPU.Build.0 = Release|Any CPU
- {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Release|Any CPU.Build.0 = Release|Any CPU
- {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Release|Any CPU.Build.0 = Release|Any CPU
{5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2210873E-99FC-48A2-A261-D650BAE33A1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2210873E-99FC-48A2-A261-D650BAE33A1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2210873E-99FC-48A2-A261-D650BAE33A1C}.Release|Any CPU.Build.0 = Release|Any CPU
- {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Release|Any CPU.Build.0 = Release|Any CPU
- {E485E885-59B1-4081-BC66-56AAAFD8771A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E485E885-59B1-4081-BC66-56AAAFD8771A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E485E885-59B1-4081-BC66-56AAAFD8771A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E485E885-59B1-4081-BC66-56AAAFD8771A}.Release|Any CPU.Build.0 = Release|Any CPU
{EF08F249-31A1-4E62-8391-ECBA5227B686}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF08F249-31A1-4E62-8391-ECBA5227B686}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF08F249-31A1-4E62-8391-ECBA5227B686}.Release|Any CPU.ActiveCfg = Release|Any CPU