OPENSSL_INSTRUMENT_BUS(3ossl)
π NAME π
okay so bestie, this is OPENSSL_instrument_bus(3ossl) β the manual page for OPENSSL_instrument_bus and OPENSSL_instrument_bus2, and their whole thing is literally to instrument references to memory bus. yes, thatβs the assignment. π
β¨ SYNOPSIS β¨
the whole vibe is guarded by #ifdef OPENSSL_CPUID_OBJ, donβt forget that part:
#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 lore: it was empirically found that timings of references to primary memory are subject to irregular, apparently non-deterministic variations. not the timing chaos π The subroutines in question instrument these references for purposes of gathering randomness for random number generator.
In order to make it bus-bound a 'flush cache line' instruction is used between probes. In addition probes are added to vector elements in atomic or interlocked manner, which should contribute additional noise on multi-processor systems. This also means that vector[num] should be zeroed upon invocation (if you want to retrieve actual probe values). yes, zero it, bestie β actual probe values said so. π
OPENSSL_instrument_bus() performs num probes and records the number of oscillator cycles every probe took. slay, very demure, very cycle-counting. β±οΈ
OPENSSL_instrument_bus2() on the other hand accumulates consecutive probes with the same value, i.e. in a way it records duration of periods when probe values appeared deterministic. The subroutine performs at most max probes in attempt to fill the vector[num], with max value of 0 meaning "as many as it takes." iconic βweβll be here a whileβ energy. π«Ά
π RETURN VALUES π
Return value of 0 indicates that CPU is not capable of performing the benchmark, either because oscillator counter or 'flush cache line' is not available on current platform. For reference, on x86 'flush cache line' was introduced with the SSE2 extensions.
Otherwise number of recorded values is returned. thatβs the count, periodt. β¨
π 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 page, bestie β itβs from OpenSSL 3.5.0, dated 2026-09-25, and itβs the OPENSSL_INSTRUMENT_BUS(3ossl) manual page. mwah π
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms