Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Fix cryptography errors on macOS 10.13 #21631

Merged
merged 3 commits into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ extern "C" int32_t AppleCryptoNative_CryptorReset(CCCryptorRef cryptor, const ui
if (cryptor == nullptr)
return -1;

// 10.13 Beta reports an error when resetting ECB, which is the only mode which has a null IV.
if (pbIv == nullptr)
return 1;

CCStatus status = CCCryptorReset(cryptor, pbIv);
*pccStatus = status;
return status == kCCSuccess;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,12 @@ static void MergeStatusCodes(CFTypeRef key, CFTypeRef value, void* context)
// (On Windows CERT_CHAIN_PARA.pStrongSignPara is NULL, so "strongness" checks
// are not performed).
}

else if (CFEqual(keyString, CFSTR("StatusCodes")))
{
// 10.13 added a StatusCodes value which may be a numeric rehashing of the string data.
// It doesn't represent a new error code, and we're still getting the old ones, so
// just ignore it for now.
}
else
{
#ifdef DEBUGGING_UNKNOWN_VALUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ public static void TestDispose()
}

[Fact]
// Crashing on macOS 10.13 Beta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we start doing this more, we can add a version detection method to PlatformDetectin.

[ActiveIssue(21436, TestPlatforms.OSX)]
public static void TestResetMethod()
{
using (var sampleCert = new X509Certificate2(TestData.DssCer))
Expand Down