-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/system.io.mmf/unix-memfdcreate
- Loading branch information
Showing
42 changed files
with
1,496 additions
and
729 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.cs
This file was deleted.
Oops, something went wrong.
81 changes: 81 additions & 0 deletions
81
...ries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EvpPkey.EcDsa.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using System.Runtime.InteropServices; | ||
using System.Security.Cryptography; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class Crypto | ||
{ | ||
[LibraryImport(Libraries.CryptoNative)] | ||
private static partial int CryptoNative_EcDsaSignHash( | ||
SafeEvpPKeyHandle pkey, | ||
IntPtr extraHandle, | ||
ref byte hash, | ||
int hashLength, | ||
ref byte destination, | ||
int destinationLength); | ||
|
||
internal static int EcDsaSignHash( | ||
SafeEvpPKeyHandle pkey, | ||
ReadOnlySpan<byte> hash, | ||
Span<byte> destination) | ||
{ | ||
int written = CryptoNative_EcDsaSignHash( | ||
pkey, | ||
pkey.ExtraHandle, | ||
ref MemoryMarshal.GetReference(hash), | ||
hash.Length, | ||
ref MemoryMarshal.GetReference(destination), | ||
destination.Length); | ||
|
||
if (written < 0) | ||
{ | ||
Debug.Assert(written == -1); | ||
throw CreateOpenSslCryptographicException(); | ||
} | ||
|
||
return written; | ||
} | ||
|
||
[LibraryImport(Libraries.CryptoNative)] | ||
private static partial int CryptoNative_EcDsaVerifyHash( | ||
SafeEvpPKeyHandle pkey, | ||
IntPtr extraHandle, | ||
ref byte hash, | ||
int hashLength, | ||
ref byte signature, | ||
int signatureLength); | ||
|
||
internal static bool EcDsaVerifyHash( | ||
SafeEvpPKeyHandle pkey, | ||
ReadOnlySpan<byte> hash, | ||
ReadOnlySpan<byte> signature) | ||
{ | ||
int ret = CryptoNative_EcDsaVerifyHash( | ||
pkey, | ||
pkey.ExtraHandle, | ||
ref MemoryMarshal.GetReference(hash), | ||
hash.Length, | ||
ref MemoryMarshal.GetReference(signature), | ||
signature.Length); | ||
|
||
if (ret == 1) | ||
{ | ||
return true; | ||
} | ||
|
||
if (ret == 0) | ||
{ | ||
return false; | ||
} | ||
|
||
Debug.Assert(ret == -1); | ||
throw CreateOpenSslCryptographicException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.