|
Packit |
c4476c |
=pod
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
=head1 NAME
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
OPENSSL_instrument_bus, OPENSSL_instrument_bus2 - instrument references to memory bus
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
=head1 SYNOPSIS
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
#ifdef OPENSSL_CPUID_OBJ
|
|
Packit |
c4476c |
size_t OPENSSL_instrument_bus(int *vector, size_t num);
|
|
Packit |
c4476c |
size_t OPENSSL_instrument_bus2(int *vector, size_t num, size_t max);
|
|
Packit |
c4476c |
#endif
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
=head1 DESCRIPTION
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
It was empirically found that timings of references to primary memory
|
|
Packit |
c4476c |
are subject to irregular, apparently non-deterministic variations. The
|
|
Packit |
c4476c |
subroutines in question instrument these references for purposes of
|
|
Packit |
c4476c |
gathering randomness for random number generator. In order to make it
|
|
Packit |
c4476c |
bus-bound a 'flush cache line' instruction is used between probes. In
|
|
Packit |
c4476c |
addition probes are added to B<vector> elements in atomic or
|
|
Packit |
c4476c |
interlocked manner, which should contribute additional noise on
|
|
Packit |
c4476c |
multi-processor systems. This also means that B<vector[num]> should be
|
|
Packit |
c4476c |
zeroed upon invocation (if you want to retrieve actual probe values).
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
OPENSSL_instrument_bus() performs B<num> probes and records the number of
|
|
Packit |
c4476c |
oscillator cycles every probe took.
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
OPENSSL_instrument_bus2() on the other hand B<accumulates> consecutive
|
|
Packit |
c4476c |
probes with the same value, i.e. in a way it records duration of
|
|
Packit |
c4476c |
periods when probe values appeared deterministic. The subroutine
|
|
Packit |
c4476c |
performs at most B<max> probes in attempt to fill the B<vector[num]>,
|
|
Packit |
c4476c |
with B<max> value of 0 meaning "as many as it takes."
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
=head1 RETURN VALUES
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
Return value of 0 indicates that CPU is not capable of performing the
|
|
Packit |
c4476c |
benchmark, either because oscillator counter or 'flush cache line' is
|
|
Packit |
c4476c |
not available on current platform. For reference, on x86 'flush cache
|
|
Packit |
c4476c |
line' was introduced with the SSE2 extensions.
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
Otherwise number of recorded values is returned.
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
=head1 COPYRIGHT
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
Copyright 2011-2018 The OpenSSL Project Authors. All Rights Reserved.
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
Licensed under the OpenSSL license (the "License"). You may not use
|
|
Packit |
c4476c |
this file except in compliance with the License. You can obtain a copy
|
|
Packit |
c4476c |
in the file LICENSE in the source distribution or at
|
|
Packit |
c4476c |
L<https://www.openssl.org/source/license.html>.
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
=cut
|