Botan 3.8.1
Crypto and TLS for C&
|
#include <blinding.h>
Public Member Functions | |
BigInt | blind (const BigInt &x) const |
Blinder (const Barrett_Reduction &reducer, RandomNumberGenerator &rng, std::function< BigInt(const BigInt &)> fwd_func, std::function< BigInt(const BigInt &)> inv_func) | |
Blinder (const Blinder &)=delete | |
Blinder & | operator= (const Blinder &)=delete |
RandomNumberGenerator & | rng () const |
BigInt | unblind (const BigInt &x) const |
Static Public Attributes | |
static constexpr size_t | ReinitInterval = 64 |
Blinding Function Object.
Definition at line 22 of file blinding.h.
Botan::Blinder::Blinder | ( | const Barrett_Reduction & | reducer, |
RandomNumberGenerator & | rng, | ||
std::function< BigInt(const BigInt &)> | fwd_func, | ||
std::function< BigInt(const BigInt &)> | inv_func ) |
reducer | precomputed Barrett reduction for the modulus |
rng | the RNG to use for generating the nonce |
fwd_func | a function that calculates the modular exponentiation of the public exponent and the given value (the nonce) |
inv_func | a function that calculates the modular inverse of the given value (the nonce) |
Definition at line 12 of file blinding.cpp.
References rng().
Referenced by Blinder(), and operator=().
Blind a value.
The blinding nonce k is freshly generated after ReinitInterval calls to blind().
ReinitInterval = 0 means a fresh nonce is only generated once. On every other call, the next nonce is derived via modular squaring.
x | value to blind |
Definition at line 33 of file blinding.cpp.
References ReinitInterval.
|
inline |
Unblind a value.
x | value to unblind |
Definition at line 49 of file blinding.cpp.
|
staticconstexpr |
Normally blinding is performed by choosing a random starting point (plus its inverse, of a form appropriate to the algorithm being blinded), and then choosing new blinding operands by successive squaring of both values. This is much faster than computing a new starting point but introduces some possible corelation
To avoid possible leakage problems in long-running processes, the blinder periodically reinitializes the sequence. This value specifies how often a new sequence should be started.
If set to zero, reinitialization is disabled
Definition at line 37 of file blinding.h.
Referenced by blind().