From: Elinor Fung Date: Fri, 11 Jun 2021 17:04:20 +0000 (-0700) Subject: Merge remote-tracking branch 'upstream/main' into HEAD X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~12628^2~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6271751fcac9b1190ba66df27821695ac92c2292;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Merge remote-tracking branch 'upstream/main' into HEAD --- 6271751fcac9b1190ba66df27821695ac92c2292 diff --cc eng/Versions.props index f26cbe7,872d251..cd5836f --- a/eng/Versions.props +++ b/eng/Versions.props @@@ -161,22 -159,21 +159,23 @@@ 5.0.0-preview-20201009.2 - 6.0.100-preview.5.21267.3 + 6.0.100-preview.6.21308.1 $(MicrosoftNETILLinkTasksVersion) - 6.0.0-preview.6.21268.1 + 6.0.0-preview.6.21307.1 - 9.0.1-alpha.1.21267.1 - 9.0.1-alpha.1.21267.1 - 9.0.1-alpha.1.21267.1 - 9.0.1-alpha.1.21267.1 - 9.0.1-alpha.1.21267.1 - 9.0.1-alpha.1.21267.1 - 9.0.1-alpha.1.21267.1 - 9.0.1-alpha.1.21267.1 + 11.1.0-alpha.1.21308.1 + 11.1.0-alpha.1.21308.1 + 11.1.0-alpha.1.21308.1 + 11.1.0-alpha.1.21308.1 + 11.1.0-alpha.1.21308.1 + 11.1.0-alpha.1.21308.1 + 11.1.0-alpha.1.21308.1 + 11.1.0-alpha.1.21308.1 + + 6.0.0-preview.6.21275.1 + $(MicrosoftNETRuntimeEmscripten2021Nodewinx64Version) + + 1.0.0-alpha.21301.2 - - diff --cc src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs index 7c75a84,7cedae4..2e62e64 --- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs +++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs @@@ -33,8 -33,19 +33,19 @@@ internal static partial class Intero internal static int HmacCurrent(SafeHmacHandle ctx, ReadOnlySpan 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); } } diff --cc src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs index 9af05f6,9e692c7..00055f3 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs @@@ -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() @@@ -79,13 -81,13 +81,13 @@@ } [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, diff --cc src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Hmac.cs index 1aeef24,6074351..ec0b3a2 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Hmac.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Hmac.cs @@@ -21,13 -22,37 +22,37 @@@ internal static partial class Intero internal static int HmacUpdate(SafeHmacCtxHandle ctx, ReadOnlySpan 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 key, ReadOnlySpan source, Span 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; + } } } diff --cc src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs index 8ce0c8e,d080cf2..4f8ab7c --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs @@@ -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);