diff options
| author | bors <bors@rust-lang.org> | 2023-10-24 06:11:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-24 06:11:51 +0000 |
| commit | 6eb3e97d5549f81bbdb8a5e94a005a338bc284ec (patch) | |
| tree | 2e40f46ee1ba861d99dcb49dc6b7d5d2b4f2cc08 /library/std/src/sys/unix/mod.rs | |
| parent | e918db897df677d9bbda64d82ebbb8f1bc9e557f (diff) | |
| parent | 090e9de5708388a21d66adbec91c871a48ac355e (diff) | |
| download | rust-6eb3e97d5549f81bbdb8a5e94a005a338bc284ec.tar.gz rust-6eb3e97d5549f81bbdb8a5e94a005a338bc284ec.zip | |
Auto merge of #116319 - BlackHoleFox:apple-rand-take-2, r=thomcc
Remove Apple RNG fallbacks and simplify implementation Now that we have [higher Apple platform requirements](https://github.com/rust-lang/rust/pull/104385), the RNG code can be simplified a lot. Since `getentropy` still doesn't look to be usable outside macOS this implementation: - Removes any macOS fallback paths and unconditionally links to `getentropy` - Minimizes the implementation for everything else (iOS, watchOS, etc). `CCRandomGenerateBytes` was added in iOS 8 which means that we can use it now. It and `SecRandomCopyBytes` have the exact same functionality, but the former has a simpler API and no longer requires libstd to link to `Security.framework` for one function. Its also available in all the other target's SDKs. Why care about `getentropy` then though on macOS? Well, its still much more performant. Benchmarking shows it runs at ~2x the speed of `CCRandomGenerateBytes`, which makes sense since it directly pulls from the kernel vs going through its own generator etc. Semi-related to a previous, but reverted, attempt at improving this logic in https://github.com/rust-lang/rust/pull/101011
Diffstat (limited to 'library/std/src/sys/unix/mod.rs')
| -rw-r--r-- | library/std/src/sys/unix/mod.rs | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index da05620fd16..4b28f6feba5 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -415,7 +415,6 @@ cfg_if::cfg_if! { } else if #[cfg(any(target_os = "ios", target_os = "tvos", target_os = "watchos"))] { #[link(name = "System")] #[link(name = "objc")] - #[link(name = "Security", kind = "framework")] #[link(name = "Foundation", kind = "framework")] extern "C" {} } else if #[cfg(target_os = "fuchsia")] { |
