Skip to content
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

getentropy apparently considered private on non-macOS darwin #102643

Closed
thomcc opened this issue Oct 4, 2022 · 1 comment · Fixed by #102693
Closed

getentropy apparently considered private on non-macOS darwin #102643

thomcc opened this issue Oct 4, 2022 · 1 comment · Fixed by #102693
Assignees
Labels
O-ios Operating system: iOS regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Milestone

Comments

@thomcc
Copy link
Member

thomcc commented Oct 4, 2022

Ugh. #101011 probably needs reverting before 1.65 hits stable, or Rust apps may1 fail AppStore review on iOS and tvOS.

Apparently, getentropy on Darwin platforms is actually only considered public API on MacOS. This is surprising, since there are several indications to the contrary:

  1. In the declaration in the public header (sys/random.h) on MacOS, it has a availability annotation that indicates it's fine in iOS/tvOS 10.0 and watchOS 3.0:

    int getentropy(void* buffer, size_t size) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
  2. Apple's security guidelines say to use it for random number generation.

Sadly, does seem to indeed be true that sys/random.h does not exist in any of the platform SDKs aside from MacOSX.sdk, and it also seems to have lead to one to iOS App Store rejection. TBH, it being an accidentally missing file feels plausible, but who knows and it doesn't matter anyway.

This is a bummer, and I guess now I know, I can't really trust the the available annotations anymore.

Footnotes

  1. There's actually a good chance that our use of weak! evades this detection, but I don't want to rely on this or make random Rust apps test it for us.

@thomcc thomcc added O-ios Operating system: iOS T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 4, 2022
@Mark-Simulacrum Mark-Simulacrum added this to the 1.65.0 milestone Oct 4, 2022
@Mark-Simulacrum Mark-Simulacrum added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Oct 4, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 4, 2022
@BlackHoleFox
Copy link
Contributor

@rustbot claim

@bors bors closed this as completed in 6d8cea6 Oct 6, 2022
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 26, 2022
thomcc pushed a commit to tcdi/postgrestd that referenced this issue Feb 10, 2023
…r=thomcc

Revert "Use getentropy when possible on all Apple platforms"

Per rust-lang/rust#102643, This reverts commit 3fc35b5b935e390c61ea2bbf744838b2632b2df1 to avoid breaking any Rust on iOS users.

Closes rust-lang/rust#102643
kristapsdz added a commit to kristapsdz/oconfigure that referenced this issue Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-ios Operating system: iOS regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants