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

Commit

Permalink
Returns error code rather than asserting
Browse files Browse the repository at this point in the history
  • Loading branch information
maryamariyan committed Jul 9, 2018
1 parent b67bfdf commit 9366919
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ AppleCryptoNative_X509GetPublicKey(SecCertificateRef cert, SecKeyRef* pPublicKey
*pOSStatusOut = noErr;

if (cert == NULL || pPublicKeyOut == NULL || pOSStatusOut == NULL)
return kErrorBadInput;
return kErrorUnknownState;

pthread_once (&once, InitCertificateCopy);
// SecCertificateCopyPublicKey was deprecated in 10.14, so use SecCertificateCopyKey on the systems that have it (10.14+),
Expand All @@ -70,11 +70,14 @@ AppleCryptoNative_X509GetPublicKey(SecCertificateRef cert, SecKeyRef* pPublicKey
{
*pPublicKeyOut = (*secCertificateCopyKey)(cert);
}
else
else if (secCertificateCopyPublicKey != NULL)
{
assert(secCertificateCopyPublicKey != NULL);
*pOSStatusOut = (*secCertificateCopyPublicKey)(cert, pPublicKeyOut);
}
else
{
return kErrorBadInput;
}
return (*pOSStatusOut == noErr);
}

Expand Down

0 comments on commit 9366919

Please sign in to comment.