OPENSSL_INSTRUMENT_BUS(3ossl)
π OPENSSL_INSTRUMENT_BUS π
okay bestie, so this is the manual for OPENSSL_instrument_bus and OPENSSL_instrument_bus2 β the 3ossl girlies π
, aka the OpenSSL library pages. Pull up a chair, we're timing memory bus stuff and it's lowkey fascinating, no cap.
β¨ NAME β¨
OPENSSL_instrument_bus, OPENSSL_instrument_bus2 β instrument references to memory bus π¦
πΈ SYNOPSIS πΈ
#ifdef OPENSSL_CPUID_OBJ
size_t OPENSSL_instrument_bus(unsigned int *vector, size_t num);
size_t OPENSSL_instrument_bus2(unsigned int *vector, size_t num, size_t max);
#endif
π DESCRIPTION π
So here's the tea β: it was empirically found that the timings of references to primary memory are subject to irregular, apparently non-deterministic variations. Like, they're just chaotic bestie, it's giving β¨entropyβ¨.
The subroutines in question instrument these references for the purposes of gathering randomness for a random number generator. Iconic behaviour honestly.
In order to make it bus-bound, a 'flush cache line' instruction is used between probes. And on top of that, probes get added to vector elements in an atomic or interlocked manner β which should contribute additional noise on multi-processor systems π (noise is the goal here, that's the whole point, we love that for us).
π«Ά This also means that vector[num] should be zeroed upon invocation β but only if you actually want to retrieve the actual probe values. Just fyi bestie, don't come for me if you skip this.
OPENSSL_instrument_bus() performs num probes and records the number of oscillator cycles every probe took. Simple, clean, slay.
OPENSSL_instrument_bus2() on the other hand is the messier sibling π β it accumulates consecutive probes with the same value, i.e. in a way it records the duration of periods when probe values appeared deterministic. She performs at most max probes in an attempt to fill vector[num], and a max value of 0 means "as many as it takes." Periodt. π
π RETURN VALUES π
A return value of 0 means the CPU is not capable of performing the benchmark β either because the oscillator counter or 'flush cache line' isn't available on the current platform. π
For reference: on x86, 'flush cache line' was introduced with the SSE2 extensions. iykyk.
Otherwise, the number of recorded values is returned. π
π COPYRIGHT π
Copyright 2011-2018 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html.
okay that's the whole thing bestie, you ate that πβ¨ this was version 3.5.9, dated 2026-09-29, and it's the OPENSSL_INSTRUMENT_BUS(3ossl) era β go forth and gather your randomness, main character π«Άπ
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms