-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drafted fix #25
Drafted fix #25
Conversation
db53bec
to
ed3262d
Compare
|
||
if (!checked) | ||
{ | ||
secCertificateCopyKey = (SecKeyRef (*)(SecCertificateRef))dlsym(RTLD_DEFAULT, "SecCertificateCopyKey"); |
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.
@janvorli is there a way we could call dlsym only once in this code snippet?
{ | ||
secCertificateCopyKey = (SecKeyRef (*)(SecCertificateRef))dlsym(RTLD_DEFAULT, "SecCertificateCopyKey"); | ||
secCertificateCopyPublicKey = (OSStatus (*)(SecCertificateRef, SecKeyRef*))dlsym(RTLD_DEFAULT, "SecCertificateCopyPublicKey"); | ||
checked = 1; |
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.
In C# I'd do this as Volatile.Write(ref checked, 1)
, or declare checked
as volatile
. Is declaring checked
volatile
here the right way to prevent a reordering race condition, @janvorli?
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.
(Or is my static local
-fu weak, and we don't need to do a lazy initializer manually, because static locals guarantee that they only run their initializer once? (and therefore the two dlsym calls should move up to variable initializers))
@@ -42,7 +42,7 @@ Returns 1 on success, 0 on failure, any other value on invalid state. | |||
|
|||
Output: | |||
pPublicKeyOut: Receives a CFRetain()ed SecKeyRef for the public key | |||
pOSStatusOut: Receives the result of SecCertificateCopyPublicKey | |||
pOSStatusOut: Receives the result of SecCertificateCopyKey |
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.
Receives the result of SecCertificateCopyKey or SecCertificateCopyPublicKey, depending on the OS version.
f12652e
to
4327a05
Compare
…jave by using dlsym to call available API rather than suppressing deprecation warnings. Fixes: #30599
Closing this PR and opening dotnet#30815 on corefx fork instead |
cc: @janvorli, @bartonjs
Proper fix for compilation issue caused by deprecated API in macOS Mojave by
using dlsym to call available API rather than suppressing deprecation warnings.
Fixes: #30599