BN_SET_FLAGS(3) | Library Functions Manual | BN_SET_FLAGS(3) |
BN_set_flags
,
BN_get_flags
— enable and
inspect flags on BIGNUM objects
#include
<openssl/bn.h>
void
BN_set_flags
(BIGNUM *b,
int flags);
int
BN_get_flags
(const BIGNUM *b,
int flags);
BN_set_flags
()
enables the given flags on b.
The flags argument can contain zero or more of the
following constants OR'ed together:
BN_FLG_CONSTTIME
This flag is off by default for BIGNUM objects created with BN_new(3).
BN_FLG_MALLOCED
BN_FLG_STATIC_DATA
BN_get_flags
()
interpretes flags as a bitmask and returns those of
the given flags that are set in b, OR'ed together, or
0 if none of the given flags is set. The
flags argument has the same syntax as for
BN_set_flags
().
These functions are currently implemented as macros, but they are likely to become real functions in the future when the BIGNUM data type will be made opaque.
BN_get_flags
() returns zero or more of the
above constants, OR'ed together.
BN_mod_exp(3), BN_mod_inverse(3), BN_new(3), BN_with_flags(3)
BN_set_flags
() and
BN_get_flags
() first appeared in SSLeay 0.9.1 and
have been available since OpenBSD 2.6.
No public interface exists to clear a flag once it is set. So
think twice before using BN_set_flags
().
Even if the BN_FLG_CONSTTIME
flag is set
on a or b,
BN_gcd
() neither fails nor operates in constant
time, potentially allowing timing side-channel attacks.
Even if the BN_FLG_CONSTTIME
flag is set
on p, if the modulus m is even,
BN_mod_exp(3) does not operate in
constant time, potentially allowing timing side-channel attacks.
If BN_FLG_CONSTTIME
is set on
p, BN_exp
() fails instead of
operating in constant time.
April 29, 2018 | OpenBSD-current |