OPENSSL_INSTRUMENT_BUS(3ossl)
π OPENSSL_INSTRUMENT_BUS π
okay so this is page OPENSSL_INSTRUMENT_BUS(3ossl) from the OpenSSL fam β yes the 3ossl bit is the manual section, we love a labeled queen π
β¨ NAME β¨
OPENSSL_instrument_bus, OPENSSL_instrument_bus2 β these two literally exist to instrument references to the 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
bestie note: yes the #ifdef OPENSSL_CPUID_OBJ is doing the heavy lifting there, don't forget it π
π₯ 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 out here being chaotic. The subroutines in question instrument these references for the purposes of gathering randomness for a random number generator. Iconic behavior honestly.
To make it bus-bound, a 'flush cache line' instruction is used between probes β¨ In addition, probes are added to vector elements in an atomic or interlocked manner, which should contribute additional noise on multi-processor systems. Main character energy on the multi-processor front, fr fr.
π heads up: this also means that vector[num] should be zeroed upon invocation (if you want to retrieve actual probe values). Don't skip that step bestie, it's giving undefined-vibes otherwise.
OPENSSL_instrument_bus() performs num probes and records the number of oscillator cycles every probe took π«Ά
OPENSSL_instrument_bus2() on the other hand accumulates consecutive probes with the same value, i.e. in a way it records the duration of periods when probe values appeared deterministic. The subroutine performs at most max probes in an attempt to fill the vector[num], with a max value of 0 meaning "as many as it takes." no cap, it will literally go until it's done π
β RETURN VALUES β
A return value of 0 indicates that the CPU is not capable of performing the benchmark β either because the oscillator counter or 'flush cache line' is not 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>.
aaaand that's the whole page, bestie π this was version 3.5.6, dated 2026-04-07, brought to you by the OPENSSL_INSTRUMENT_BUS(3ossl) girlies β slay and read your licenses ππ§
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms