Botan 3.6.1
Crypto and TLS for C&
|
#include <ct_utils.h>
Public Member Functions | |
constexpr std::optional< T > | as_optional_vartime () const |
constexpr Choice | has_value () const |
Return true if this Option contains a value. | |
constexpr CT::Option< T > | operator&& (CT::Choice also) |
Return a new CT::Option that is set if also is set as well. | |
constexpr | Option () |
Construct an unset option with a default inner value. | |
constexpr | Option (T v) |
Construct a set option with the provided value. | |
constexpr | Option (T v, Choice valid) |
Construct an Option which contains the specified value, and is set or not. | |
template<std::invocable< const T & > F> | |
constexpr auto | transform (F f) const -> Option< std::remove_cvref_t< std::invoke_result_t< F, const T & > > > |
constexpr const T & | value () const |
Either returns the value or throws an exception. | |
constexpr T | value_or (T other) const |
constexpr T | value_or (T other) const |
A CT::Option<T> is either a valid T, or not
To maintain constant time behavior a value must always be stored. A CT::Choice tracks if the value is valid or not. It is not possible to access the inner value if the Choice is unset.
Definition at line 622 of file ct_utils.h.
|
inlineconstexpr |
Construct an Option which contains the specified value, and is set or not.
Definition at line 625 of file ct_utils.h.
|
inlineconstexpr |
Construct a set option with the provided value.
Definition at line 628 of file ct_utils.h.
|
inlineconstexpr |
|
inlineconstexpr |
Convert this Option into a std::optional
This is not constant time, leaking if the Option had a value or not
Definition at line 682 of file ct_utils.h.
References Botan::CT::Choice::as_bool().
|
inlineconstexpr |
Return true if this Option contains a value.
Definition at line 636 of file ct_utils.h.
|
inlineconstexpr |
Return a new CT::Option that is set if also
is set as well.
Definition at line 691 of file ct_utils.h.
|
inlineconstexpr |
Apply a function to the inner value and return a new Option which contains that value. This is constant time only if f
is.
Definition at line 646 of file ct_utils.h.
|
inlineconstexpr |
Either returns the value or throws an exception.
Definition at line 651 of file ct_utils.h.
References Botan::CT::Choice::as_bool(), and BOTAN_STATE_CHECK.
|
inlineconstexpr |
Returns either the inner value or the alternative, in constant time
This variant is used for types which explicitly define a function conditional_assign which takes a CT::Choice as the conditional.
Definition at line 660 of file ct_utils.h.
|
inlineconstexpr |
Returns either the inner value or the alternative, in constant time
This variant is used for integer types where CT::Mask can perform a constant time selection
Definition at line 671 of file ct_utils.h.
References Botan::CT::Mask< T >::from_choice().