-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Darwin] add API to get public key without leaks (with fixes) #36340
base: master
Are you sure you want to change the base?
Conversation
PR #36340: Size comparison from b0cc28a to d5bfe8d Full report (68 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
Co-authored-by: Boris Zbarsky <[email protected]>
…onal method calls
it's a test; this is the best we can do with an optional protocol method
remove comment - not this method's job to worry about other implementation's potential side-effects
Co-authored-by: Boris Zbarsky <[email protected]>
PR #36340: Size comparison from f3a9fe9 to 47e264a Full report (68 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
check compatibility in CI before going back and removing
PR #36340: Size comparison from f3a9fe9 to 8dbbcaa Full report (68 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #36340: Size comparison from f3a9fe9 to d328eaf Full report (68 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #36340: Size comparison from 50ad31c to fbbd06a Full report (68 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #36340: Size comparison from 62a4a97 to fdbd53c Full report (68 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
@@ -79,9 +79,27 @@ - (SecKeyRef)publicKey | |||
}; | |||
_mPublicKey = SecKeyCreateWithData((__bridge CFDataRef) publicKeyNSData, (__bridge CFDictionaryRef) attributes, nullptr); | |||
} | |||
} | |||
|
|||
- (SecKeyRef)publicKey |
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.
Seems fine, but why do we need this bit still here?
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.
Looks like cruft from when I was just trying to get things compiling. I'll remove it and unwind the extraction of _populatePublicKeyIfNecessary
.
CHIP_ERROR MTRP256KeypairBridge::setPubkey() | ||
{ | ||
if ([mKeypair respondsToSelector:@selector(copyPublicKey)]) { | ||
return MatterPubKeyFromSecKeyRef([mKeypair copyPublicKey], &mPubkey); |
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.
Isn't this a leak?
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.
Sure was!
SecKeyRef originalKeyRef = [testKeys publicKey]; | ||
SecKeyRef originalKeyRef; | ||
if ([testKeys respondsToSelector:@selector(copyPublicKey)]) { | ||
originalKeyRef = [testKeys copyPublicKey]; |
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.
This also looks like a leak.
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.
It was!
reverted because mergify landed it with failing checks...?
CFAutorelease
on CoreFoundation typed public key copiescopyPublicKey
forMTRTestKeys
; add TODO note about optional method callscopyPublicKey
callscopyPublicKey
inMTRTestKeys