This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Add API to enable comparision of corefx's OpenSSL with a 3rd party P/Invoke #32900
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0a3f0ea
Add OpenSslVersionNumber
bartonjs 16f3c9c
Fix native compilation
bartonjs 3aad931
Seed some API doc comments
bartonjs 354da96
Add a test
bartonjs 3fed162
Move (test) PlatformDetection's OpenSslVersion into PlatformDetection.
bartonjs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
30 changes: 30 additions & 0 deletions
30
src/System.Security.Cryptography.OpenSsl/tests/SafeEvpPKeyHandleTests.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,30 @@ | ||
using Xunit; | ||
|
||
namespace System.Security.Cryptography.OpenSsl.Tests | ||
{ | ||
public static class SafeEvpPKeyHandleTests | ||
{ | ||
[Fact] | ||
public static void TestOpenSslVersion() | ||
{ | ||
long version = SafeEvpPKeyHandle.OpenSslVersion; | ||
long version2 = SafeEvpPKeyHandle.OpenSslVersion; | ||
|
||
Assert.Equal(version, version2); | ||
|
||
// A value representing OpenSSL 1.0.0's development (pre-beta) build. | ||
const long MinValue = 0x10000000; | ||
|
||
// Until a platform+build is discovered which violates this constraint, assert that it | ||
// is between 1.0.0-devel and (signed) int.MaxValue as a sanity check on reading the | ||
// value. | ||
// | ||
// NOTE: The OpenSslVersion value should not be depended upon for anything other than | ||
// an equality check, to assert that a component outside of .NET Core which is utilizing | ||
// SafeEvpPKeyHandle is using the same version as .NET Core (to avoid sending the pointers | ||
// from one library into another). The exception is this test, in asserting that we're | ||
// getting "sensible" values. | ||
Assert.InRange(version, MinValue, int.MaxValue); | ||
} | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this used? I'm just surprised to see us parsing it like this, given that we explicitly opted to expose a long due to it being opaque data. Is this just for test code? And if so, should this OpenSslVersion property be moved into a test assembly somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah.
What a remarkably reasonable question that means I have more work to do. Okie dokie 😄.