Merge remote-tracking branch 'upstream/main' into HEAD
authorElinor Fung <elfung@microsoft.com>
Fri, 11 Jun 2021 17:04:20 +0000 (10:04 -0700)
committerElinor Fung <elfung@microsoft.com>
Fri, 11 Jun 2021 17:04:20 +0000 (10:04 -0700)
18 files changed:
1  2 
Directory.Build.targets
eng/Versions.props
src/libraries/Common/src/Interop/BSD/System.Native/Interop.Sysctl.cs
src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Hmac.cs
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509.cs
src/libraries/Common/src/System/Net/Http/WinInetProxyHelper.cs
src/libraries/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj
src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketPal.Unix.cs
src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Unix.cs
src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Win32.cs
src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Unix.cs
src/libraries/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj

Simple merge
      <!-- Docs -->
      <MicrosoftPrivateIntellisenseVersion>5.0.0-preview-20201009.2</MicrosoftPrivateIntellisenseVersion>
      <!-- ILLink -->
-     <MicrosoftNETILLinkTasksVersion>6.0.100-preview.5.21267.3</MicrosoftNETILLinkTasksVersion>
+     <MicrosoftNETILLinkTasksVersion>6.0.100-preview.6.21308.1</MicrosoftNETILLinkTasksVersion>
      <MicrosoftNETILLinkAnalyzerPackageVersion>$(MicrosoftNETILLinkTasksVersion)</MicrosoftNETILLinkAnalyzerPackageVersion>
      <!-- ICU -->
-     <MicrosoftNETCoreRuntimeICUTransportVersion>6.0.0-preview.6.21268.1</MicrosoftNETCoreRuntimeICUTransportVersion>
+     <MicrosoftNETCoreRuntimeICUTransportVersion>6.0.0-preview.6.21307.1</MicrosoftNETCoreRuntimeICUTransportVersion>
      <!-- Mono LLVM -->
-     <runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>9.0.1-alpha.1.21267.1</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
-     <runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>9.0.1-alpha.1.21267.1</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
-     <runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>9.0.1-alpha.1.21267.1</runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
-     <runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>9.0.1-alpha.1.21267.1</runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
-     <runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>9.0.1-alpha.1.21267.1</runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
-     <runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>9.0.1-alpha.1.21267.1</runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
-     <runtimeosx1012x64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>9.0.1-alpha.1.21267.1</runtimeosx1012x64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
-     <runtimeosx1012x64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>9.0.1-alpha.1.21267.1</runtimeosx1012x64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
+     <runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>11.1.0-alpha.1.21308.1</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
+     <runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>11.1.0-alpha.1.21308.1</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
+     <runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>11.1.0-alpha.1.21308.1</runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
+     <runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>11.1.0-alpha.1.21308.1</runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
+     <runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>11.1.0-alpha.1.21308.1</runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
+     <runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>11.1.0-alpha.1.21308.1</runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
+     <runtimeosx1012x64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>11.1.0-alpha.1.21308.1</runtimeosx1012x64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
+     <runtimeosx1012x64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>11.1.0-alpha.1.21308.1</runtimeosx1012x64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
+     <!-- emscripten / Node -->
+     <MicrosoftNETRuntimeEmscripten2021Nodewinx64Version>6.0.0-preview.6.21275.1</MicrosoftNETRuntimeEmscripten2021Nodewinx64Version>
+     <MicrosoftNETRuntimeEmscriptenVersion>$(MicrosoftNETRuntimeEmscripten2021Nodewinx64Version)</MicrosoftNETRuntimeEmscriptenVersion>
 +    <!-- Experimental -->
 +    <MicrosoftInteropDllImportGeneratorVersion>1.0.0-alpha.21301.2</MicrosoftInteropDllImportGeneratorVersion>
    </PropertyGroup>
-   <!-- Override isolated build dependency versions with versions from Repo API. -->
-   <Import Project="$(DotNetPackageVersionPropsPath)" Condition="'$(DotNetPackageVersionPropsPath)' != ''" />
  </Project>
@@@ -33,8 -33,19 +33,19 @@@ internal static partial class Intero
          internal static int HmacCurrent(SafeHmacHandle ctx, ReadOnlySpan<byte> output) =>
              HmacCurrent(ctx, ref MemoryMarshal.GetReference(output), output.Length);
  
 -        [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacCurrent")]
 -        private static extern int HmacCurrent(SafeHmacHandle ctx, ref byte pbOutput, int cbOutput);
 +        [GeneratedDllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacCurrent")]
 +        private static partial int HmacCurrent(SafeHmacHandle ctx, ref byte pbOutput, int cbOutput);
+         [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacOneShot")]
+         internal static unsafe extern int HmacOneShot(
+             PAL_HashAlgorithm algorithm,
+             byte* pKey,
+             int cbKey,
+             byte* pData,
+             int cbData,
+             byte* pOutput,
+             int cbOutput,
+             out int cbDigest);
      }
  }
  
@@@ -27,50 -27,52 +27,52 @@@ internal static partial class Intero
              return ret;
          }
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_BioSeek")]
 -        internal static extern int BioSeek(SafeBioHandle bio, int pos);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_BioSeek")]
 +        internal static partial int BioSeek(SafeBioHandle bio, int pos);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509Thumbprint")]
 -        private static extern int GetX509Thumbprint(SafeX509Handle x509, byte[]? buf, int cBuf);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509Thumbprint")]
 +        private static partial int GetX509Thumbprint(SafeX509Handle x509, byte[]? buf, int cBuf);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509NameRawBytes")]
 -        private static extern int GetX509NameRawBytes(IntPtr x509Name, byte[]? buf, int cBuf);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509NameRawBytes")]
 +        private static partial int GetX509NameRawBytes(IntPtr x509Name, byte[]? buf, int cBuf);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_ReadX509AsDerFromBio")]
 -        internal static extern SafeX509Handle ReadX509AsDerFromBio(SafeBioHandle bio);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_ReadX509AsDerFromBio")]
 +        internal static partial SafeX509Handle ReadX509AsDerFromBio(SafeBioHandle bio);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509CrlNextUpdate")]
 -        internal static extern IntPtr GetX509CrlNextUpdate(SafeX509CrlHandle crl);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509CrlNextUpdate")]
 +        internal static partial IntPtr GetX509CrlNextUpdate(SafeX509CrlHandle crl);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509Version")]
 -        internal static extern int GetX509Version(SafeX509Handle x509);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509Version")]
 +        internal static partial int GetX509Version(SafeX509Handle x509);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509PublicKeyParameterBytes")]
 -        private static extern int GetX509PublicKeyParameterBytes(SafeX509Handle x509, byte[]? buf, int cBuf);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509PublicKeyParameterBytes")]
 +        private static partial int GetX509PublicKeyParameterBytes(SafeX509Handle x509, byte[]? buf, int cBuf);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509EkuFieldCount")]
 -        internal static extern int GetX509EkuFieldCount(SafeEkuExtensionHandle eku);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509EkuFieldCount")]
 +        internal static partial int GetX509EkuFieldCount(SafeEkuExtensionHandle eku);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509EkuField")]
 -        internal static extern IntPtr GetX509EkuField(SafeEkuExtensionHandle eku, int loc);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509EkuField")]
 +        internal static partial IntPtr GetX509EkuField(SafeEkuExtensionHandle eku, int loc);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509NameInfo")]
 -        internal static extern SafeBioHandle GetX509NameInfo(SafeX509Handle x509, int nameType, [MarshalAs(UnmanagedType.Bool)] bool forIssuer);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509NameInfo")]
 +        internal static partial SafeBioHandle GetX509NameInfo(SafeX509Handle x509, int nameType, [MarshalAs(UnmanagedType.Bool)] bool forIssuer);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetAsn1StringBytes")]
 -        private static extern int GetAsn1StringBytes(IntPtr asn1, byte[]? buf, int cBuf);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetAsn1StringBytes")]
 +        private static partial int GetAsn1StringBytes(IntPtr asn1, byte[]? buf, int cBuf);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_PushX509StackField")]
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_PushX509StackField")]
          [return: MarshalAs(UnmanagedType.Bool)]
 -        internal static extern bool PushX509StackField(SafeX509StackHandle stack, SafeX509Handle x509);
 +        internal static partial bool PushX509StackField(SafeX509StackHandle stack, SafeX509Handle x509);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_PushX509StackField")]
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_PushX509StackField")]
          [return: MarshalAs(UnmanagedType.Bool)]
 -        internal static extern bool PushX509StackField(SafeSharedX509StackHandle stack, SafeX509Handle x509);
 +        internal static partial bool PushX509StackField(SafeSharedX509StackHandle stack, SafeX509Handle x509);
  
-         internal static string? GetX509RootStorePath()
+         internal static string? GetX509RootStorePath(out bool defaultPath)
          {
-             return Marshal.PtrToStringAnsi(GetX509RootStorePath_private());
+             IntPtr ptr = GetX509RootStorePath_private(out byte usedDefault);
+             defaultPath = (usedDefault != 0);
+             return Marshal.PtrToStringAnsi(ptr);
          }
  
          internal static string? GetX509RootStoreFile()
          }
  
          [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509RootStorePath")]
-         private static extern IntPtr GetX509RootStorePath_private();
+         private static extern IntPtr GetX509RootStorePath_private(out byte defaultPath);
  
          [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509RootStoreFile")]
-         private static extern IntPtr GetX509RootStoreFile_private();
+         private static extern IntPtr GetX509RootStoreFile_private(out byte defaultPath);
  
 -        [DllImport(Libraries.CryptoNative)]
 -        private static extern int CryptoNative_X509StoreSetVerifyTime(
 +        [GeneratedDllImport(Libraries.CryptoNative)]
 +        private static partial int CryptoNative_X509StoreSetVerifyTime(
              SafeX509StoreHandle ctx,
              int year,
              int month,
@@@ -21,13 -22,37 +22,37 @@@ internal static partial class Intero
          internal static int HmacUpdate(SafeHmacCtxHandle ctx, ReadOnlySpan<byte> data, int len) =>
              HmacUpdate(ctx, ref MemoryMarshal.GetReference(data), len);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacUpdate")]
 -        private static extern int HmacUpdate(SafeHmacCtxHandle ctx, ref byte data, int len);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacUpdate")]
 +        private static partial int HmacUpdate(SafeHmacCtxHandle ctx, ref byte data, int len);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacFinal")]
 -        internal static extern int HmacFinal(SafeHmacCtxHandle ctx, ref byte data, ref int len);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacFinal")]
 +        internal static partial int HmacFinal(SafeHmacCtxHandle ctx, ref byte data, ref int len);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacCurrent")]
 -        internal static extern int HmacCurrent(SafeHmacCtxHandle ctx, ref byte data, ref int len);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacCurrent")]
 +        internal static partial int HmacCurrent(SafeHmacCtxHandle ctx, ref byte data, ref int len);
+         [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacOneShot")]
+         private static unsafe extern int HmacOneShot(IntPtr type, byte* key, int keySize, byte* source, int sourceSize, byte* md, ref int mdSize);
+         internal static unsafe int HmacOneShot(IntPtr type, ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination)
+         {
+             int size = destination.Length;
+             const int Success = 1;
+             fixed (byte* pKey = key)
+             fixed (byte* pSource = source)
+             fixed (byte* pDestination = destination)
+             {
+                 int result = HmacOneShot(type, pKey, key.Length, pSource, source.Length, pDestination, ref size);
+                 if (result != Success)
+                 {
+                     Debug.Assert(result == 0);
+                     throw CreateOpenSslCryptographicException();
+                 }
+             }
+             return size;
+         }
      }
  }
@@@ -68,15 -68,15 +68,15 @@@ internal static partial class Intero
              return result;
          }
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslWrite", SetLastError = true)]
 -        internal static extern int SslWrite(SafeSslHandle ssl, ref byte buf, int num);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslWrite", SetLastError = true)]
 +        internal static partial int SslWrite(SafeSslHandle ssl, ref byte buf, int num);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslRead", SetLastError = true)]
 -        internal static extern int SslRead(SafeSslHandle ssl, ref byte buf, int num);
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslRead", SetLastError = true)]
-         internal static unsafe partial int SslRead(SafeSslHandle ssl, byte* buf, int num);
++        internal static partial int SslRead(SafeSslHandle ssl, ref byte buf, int num);
  
 -        [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_IsSslRenegotiatePending")]
 +        [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_IsSslRenegotiatePending")]
          [return: MarshalAs(UnmanagedType.Bool)]
 -        internal static extern bool IsSslRenegotiatePending(SafeSslHandle ssl);
 +        internal static partial bool IsSslRenegotiatePending(SafeSslHandle ssl);
  
          [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslShutdown")]
          internal static extern int SslShutdown(IntPtr ssl);