about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-08-31 07:57:56 +0200
committerGitHub <noreply@github.com>2022-08-31 07:57:56 +0200
commit1484742f4ab19cbca9de4156bf42a67d08a3c58f (patch)
tree97128860ff00b0b31396b3927b8ad8099d08d255 /compiler/rustc_codegen_llvm/src
parentb2a8d9d86c02eb0a248cdeed0ca77da589e05572 (diff)
parent3fc35b5b935e390c61ea2bbf744838b2632b2df1 (diff)
downloadrust-1484742f4ab19cbca9de4156bf42a67d08a3c58f.tar.gz
rust-1484742f4ab19cbca9de4156bf42a67d08a3c58f.zip
Rollup merge of #101011 - BlackHoleFox:apple-random-improvements, r=thomcc
Use getentropy when possible on all Apple platforms

As the current code comments say, `SecRandomCopyBytes` is very heavyweight (regardless of purpose) compared to just asking the kernel directly for bytes from its own CSPRNG. We were not previously making an attempt to use the more efficient `getentropy` call on other Apple targets, instead solely using it on macOS. As the function is available on newer versions of Apple's different OSes, this changes the random filling to always attempt it first everywhere, only falling back to the less ideal alternatives after. This also cleans up the multiple Apple `imp` blocks into one.

It also should give a perf improvement, even if its likely unnoticeably small.

Refed XCode header for `getentropy` in the SDK:
```h
int getentropy(void* buffer, size_t size) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
```

r? ``@thomcc``
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions