Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[System/build]: Add two MONO_SECURITY_ALIAS and MONO_X509_ALIAS condi…
…tionals.

These should be used instead of MOBILE / MONOTOUCH / MONODROID to select
extern alias directives to make them work independently from the mobile profile.

* MONO_SECURITY_ALIAS: whether or not to use 'extern alias MonoSecurity'.

* MONO_X509_ALIAS: whether or not to use

    extern alias PrebuiltSystem;
    using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;

* MONO_FEATURE_NEW_TLS: ignore, this is not enabled in the default build.
  • Loading branch information
Martin Baulig committed Oct 9, 2015
1 parent 5348243 commit 48b95ec
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 32 deletions.
11 changes: 5 additions & 6 deletions mcs/class/System/Makefile
Expand Up @@ -33,14 +33,13 @@ RESOURCE_STRINGS = ../../../external/referencesource/System/System.txt
#
ifdef MOBILE_PROFILE
ifeq ($(PROFILE),xammac)
EXTERN_ALIAS_FLAGS = -d:MONO_SECURITY_ALIAS -d:MONO_X509_ALIAS
LIB_MCS_FLAGS += -d:INSIDE_SYSTEM
else
LIB_MCS_FLAGS += -d:INSIDE_SYSTEM -d:SECURITY_DEP
endif
endif


ifndef MOBILE_PROFILE
else
EXTERN_ALIAS_FLAGS = -d:MONO_SECURITY_ALIAS -d:MONO_X509_ALIAS
FINAL_MCS_FLAGS = -r:System.Configuration.dll -d:CONFIGURATION_DEP
endif

Expand All @@ -50,15 +49,15 @@ endif
ifeq (secxml/, $(intermediate))
LOCAL_MCS_FLAGS = -lib:$(bare_libdir)
LIB_REFS += System.Xml MonoSecurity=Mono.Security
LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP -r:PrebuiltSystem=$(bare_libdir)/System.dll
LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP -r:PrebuiltSystem=$(bare_libdir)/System.dll $(EXTERN_ALIAS_FLAGS)
endif

#
# Flags used to build the final version of System (when intermediate is not defined)
#
ifndef intermediate
LIB_REFS += System.Xml MonoSecurity=Mono.Security
LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP -r:PrebuiltSystem=$(secxml_libdir)/System.dll $(FINAL_MCS_FLAGS)
LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP -r:PrebuiltSystem=$(secxml_libdir)/System.dll $(EXTERN_ALIAS_FLAGS) $(FINAL_MCS_FLAGS)
endif

EXTRA_DISTFILES = \
Expand Down
3 changes: 2 additions & 1 deletion mcs/class/System/System.Net.Security/EncryptionPolicy.cs
Expand Up @@ -25,7 +25,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#if SECURITY_DEP && !MONO_FEATURE_NEW_TLS
namespace System.Net.Security
{
public enum EncryptionPolicy
Expand All @@ -35,3 +35,4 @@ public enum EncryptionPolicy
NoEncryption
}
}
#endif
Expand Up @@ -28,10 +28,8 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#if SECURITY_DEP

#if !MONOTOUCH && !MONODROID
#if SECURITY_DEP && !MONO_FEATURE_NEW_TLS
#if MONO_X509_ALIAS
extern alias PrebuiltSystem;
using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
#endif
Expand Down
Expand Up @@ -28,6 +28,11 @@
// 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
#if MONO_X509_ALIAS
extern alias PrebuiltSystem;
using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
#endif

using System.Security.Cryptography.X509Certificates;

Expand All @@ -39,4 +44,4 @@ namespace System.Net.Security
X509Chain chain,
SslPolicyErrors sslPolicyErrors);
}

#endif
3 changes: 2 additions & 1 deletion mcs/class/System/System.Net.Security/SslPolicyErrors.cs
Expand Up @@ -25,7 +25,7 @@
// 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
namespace System.Net.Security
{
[Flags]
Expand All @@ -37,3 +37,4 @@ public enum SslPolicyErrors
RemoteCertificateChainErrors = 4,
}
}
#endif
37 changes: 18 additions & 19 deletions mcs/class/System/System.Net.Security/SslStream.cs
Expand Up @@ -32,37 +32,36 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#if SECURITY_DEP
#if SECURITY_DEP && !MONO_FEATURE_NEW_TLS

#if MONOTOUCH || MONODROID
using Mono.Security.Protocol.Tls;

using CipherAlgorithmType = System.Security.Authentication.CipherAlgorithmType;
using HashAlgorithmType = System.Security.Authentication.HashAlgorithmType;
using ExchangeAlgorithmType = System.Security.Authentication.ExchangeAlgorithmType;
#if MONO_X509_ALIAS
extern alias PrebuiltSystem;
#endif
#if MONO_SECURITY_ALIAS
extern alias MonoSecurity;
#endif

#if MONO_SECURITY_ALIAS
using MonoCipherAlgorithmType = MonoSecurity::Mono.Security.Protocol.Tls.CipherAlgorithmType;
using MonoHashAlgorithmType = MonoSecurity::Mono.Security.Protocol.Tls.HashAlgorithmType;
using MonoExchangeAlgorithmType = MonoSecurity::Mono.Security.Protocol.Tls.ExchangeAlgorithmType;
using MonoSecurityProtocolType = MonoSecurity::Mono.Security.Protocol.Tls.SecurityProtocolType;
using MonoSecurity::Mono.Security.Protocol.Tls;
#else
using MonoCipherAlgorithmType = Mono.Security.Protocol.Tls.CipherAlgorithmType;
using MonoHashAlgorithmType = Mono.Security.Protocol.Tls.HashAlgorithmType;
using MonoExchangeAlgorithmType = Mono.Security.Protocol.Tls.ExchangeAlgorithmType;
using MonoSecurityProtocolType = Mono.Security.Protocol.Tls.SecurityProtocolType;
#else
extern alias PrebuiltSystem;
extern alias MonoSecurity;

using Mono.Security.Protocol.Tls;
#endif
#if MONO_X509_ALIAS
using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
#endif

using CipherAlgorithmType = System.Security.Authentication.CipherAlgorithmType;
using HashAlgorithmType = System.Security.Authentication.HashAlgorithmType;
using ExchangeAlgorithmType = System.Security.Authentication.ExchangeAlgorithmType;

using MonoCipherAlgorithmType = MonoSecurity::Mono.Security.Protocol.Tls.CipherAlgorithmType;
using MonoHashAlgorithmType = MonoSecurity::Mono.Security.Protocol.Tls.HashAlgorithmType;
using MonoExchangeAlgorithmType = MonoSecurity::Mono.Security.Protocol.Tls.ExchangeAlgorithmType;
using MonoSecurityProtocolType = MonoSecurity::Mono.Security.Protocol.Tls.SecurityProtocolType;

using MonoSecurity::Mono.Security.Protocol.Tls;
#endif

using System;
using System.IO;
using System.Net;
Expand Down

0 comments on commit 48b95ec

Please sign in to comment.