- Notifications
You must be signed in to change notification settings - Fork5.2k
[macOS] Specify kSecUseDataProtectionKeychain when generating RSA/ECC keys#52759
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
ghost commentedMay 14, 2021
Tagging subscribers to this area:@bartonjs,@vcsjones,@krwq,@GrabYourPitchforks Issue DetailsFixes#36107.
|
vcsjones commentedMay 14, 2021
Did you actually see improvements in benchmarks? I'm a bit behind in responding to issues, but I did give this a shot and I did not see an improvement in performance. |
filipnavara commentedMay 14, 2021
I'll re-run the benchmarks to make double sure that it takes the right code path. |
filipnavara commentedMay 14, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
BenchmarkDotNet=v0.12.1.20210514-develop, OS=macOS Big Sur 11.3 (20E232) [Darwin 20.4.0]
(ignore the "allocated" column; the branch is few commits apart from the |
vcsjones commentedMay 14, 2021
Woohoo. |
filipnavara commentedMay 14, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Looks like the tests fail on all the recent PRs, so the failures are unrelated. |
src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.c OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
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.
The Apple docs for this are... lacking. What's the effect? Does this let us get rid of the temporary keychains, and therefore make ephemeral load work?
If someone does PersistKeySet (where we load it into the default keychain for them) does this do anything weird?
filipnavaraMay 14, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
The temporary keychains were already removed here in previous PR (#51620) that unified the key generation between iOS and macOS. However, by default macOS still generates ephemeral legacy CSSM keys that could be imported into (legacy) keychains. This attribute causes the code to create the iOS-style data keys instead. They don't interoperate with the legacy keychain SecItem* APIs well but that's never directly used in .NET (X509Certificate2.CopyWithPrivateKey will go through export and re-import using old APIs).
filipnavaraMay 14, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Note that the attribute existed in earlier macOS versions under the namekSecAttrNoLegacy which was more fitting (but private API).
filipnavara commentedMay 15, 2021
RSA key generation benchmarkBenchmarkDotNet=v0.12.1.20210515-develop, OS=macOS Big Sur 11.3 (20E232) [Darwin 20.4.0]
|
bartonjs commentedMay 17, 2021
While many PRs are failing on building MacCatalyst and iOSSimulator, I can't bring myself to accept a merge here with that being true, since I can't convince myself that the __builtin_available / kSecUseDataProtectionKeychain aren't related. |
filipnavara commentedMay 17, 2021
The problem with MacCatalyst / iOSSimulator should be fixed in |
filipnavara commentedMay 17, 2021
/azp run runtime-staging |
filipnavara commentedMay 18, 2021
Apparently the build was still picking the broken Mono :-/ I expected it to build the PR merge commit and not the PR tip commit. I rebased it, so let's try again... |
steveisok commentedJun 2, 2021
@bartonjs Can you give this another review? |
Fixes#36107.
Ref:#36107 (comment)