Merge pull request #4033 from ntherning/no-stdcall-for-icalls-on-windows-32-bit
[mono.git] / mcs / class / Mono.Security / Mono.Security.Protocol.Tls / CipherSuiteFactory.cs
index 13573cbaab194db8840cde072c567428eb7b3dcc..cdba0f655ddfeac0ba081d312390aba953612af4 100644 (file)
@@ -32,7 +32,7 @@ namespace Mono.Security.Protocol.Tls
 {
        internal static class CipherSuiteFactory
        {
-#if !INSIDE_SYSTEM && !BOOTSTRAP_BASIC
+#if false && !INSIDE_SYSTEM && !BOOTSTRAP_BASIC
                static Type spm = typeof (ServicePointManager);
                static PropertyInfo client_callback;
                static PropertyInfo server_callback;
@@ -40,65 +40,16 @@ namespace Mono.Security.Protocol.Tls
 
                public static CipherSuiteCollection GetSupportedCiphers (bool server, SecurityProtocolType protocol)
                {
-                       CipherSuiteCollection suites;
                        switch (protocol) {
                        case SecurityProtocolType.Default:
                        case SecurityProtocolType.Tls:                          
-                               suites = CipherSuiteFactory.GetTls1SupportedCiphers ();
-                               break;
+                               return CipherSuiteFactory.GetTls1SupportedCiphers ();
                        case SecurityProtocolType.Ssl3:
-                               suites = CipherSuiteFactory.GetSsl3SupportedCiphers ();
-                               break;
+                               return CipherSuiteFactory.GetSsl3SupportedCiphers ();
                        case SecurityProtocolType.Ssl2:
                        default:
                                throw new NotSupportedException ("Unsupported security protocol type");
                        }
-
-                       IEnumerable<string> list = null;
-#if INSIDE_SYSTEM
-                       // if SSL/TLS support is built-in System.dll (e.g. monotouch) then we can access ServicePointManager
-                       // extension directly
-                       var cb = server ? ServicePointManager.ServerCipherSuitesCallback : ServicePointManager.ClientCipherSuitesCallback;
-                       if (cb == null)
-                               return suites; // e.g. no callback was set
-
-                       list = cb ((System.Net.SecurityProtocolType) (int) protocol, suites.GetNames ());
-#elif !BOOTSTRAP_BASIC
-                       // Mono.Security must work on MS.NET so it cannot depend on any Mono-specific extensions
-                       PropertyInfo pi = null;
-                       if (server) {
-                               if (server_callback == null)
-                                       server_callback = spm.GetProperty ("ServerCipherSuitesCallback", BindingFlags.Static | BindingFlags.Public);
-                               pi = server_callback;
-                       } else {
-                               if (client_callback == null)
-                                       client_callback = spm.GetProperty ("ClientCipherSuitesCallback", BindingFlags.Static | BindingFlags.Public);
-                               pi = client_callback;
-                       }
-                       if (pi == null)
-                               return suites; // e.g. MS runtime - return every supported suites
-
-                       var cb = (Delegate) pi.GetGetMethod ().Invoke (null, null);
-                       if (cb == null)
-                               return suites; // e.g. no callback was set - return every supported suites
-
-                       list = (IEnumerable<string>) cb.DynamicInvoke (new object[] { 
-                               (System.Net.SecurityProtocolType) (int) protocol, suites.GetNames () 
-                       });
-#else
-                       // TODO: right now the callback is only available when using System.Net.* types for SSL/TLS
-                       return suites;
-#endif
-                       CipherSuiteCollection allowed = new CipherSuiteCollection (protocol);
-                       if (list != null) {
-                               foreach (var name in list) {
-                                       // add any supported (ignore unknowns) ciphers requested by the callback
-                                       var cipher = suites [name];
-                                       if (cipher != null)
-                                               allowed.Add (cipher);
-                               }
-                       }
-                       return allowed;
                }
 
                #region Private Static Methods