Botan 3.5.0
Crypto and TLS for C&
|
Classes | |
struct | AutoDetect |
class | Strong_Adapter |
class | Strong_Adapter< T > |
class | Strong_Base |
struct | unwrap_type |
struct | unwrap_type< T > |
Concepts | |
concept | int_or_strong_type |
concept | unsigned_integralish |
Typedefs | |
template<int_or_strong_type T> | |
using | unwrap_type_t = typename unwrap_type<T>::type |
Enumerations | |
enum class | Endianness : bool { Big , Little } |
Functions | |
template<ranges::spanable_range OutR, ranges::spanable_range... Rs> requires (concepts::reservable_container<OutR> || ranges::statically_spanable_range<OutR>) | |
constexpr OutR | concatenate (Rs &&... ranges) |
template<Endianness endianness, unsigned_integralish T> | |
size_t | copy_out_any_word_aligned_portion (std::span< uint8_t > &out, std::span< const T > &in) |
constexpr uint16_t | ct_int_div_kyber_q (uint32_t a) |
template<Endianness endianness, std::unsigned_integral OutT, ranges::contiguous_range< uint8_t > InR> | |
constexpr OutT | fallback_load_any (InR &&in_range) |
template<Endianness endianness, std::unsigned_integral InT, ranges::contiguous_output_range< uint8_t > OutR> | |
constexpr void | fallback_store_any (InT in, OutR &&out_range) |
constexpr bool | is_native (Endianness endianness) |
constexpr bool | is_opposite (Endianness endianness) |
template<Endianness endianness, unsigned_integralish OutT> | |
constexpr OutT | load_any (const uint8_t in[], size_t off) |
template<Endianness endianness, typename OutT , unsigned_integralish... Ts> requires (sizeof...(Ts) > 0 && all_same_v<Ts...> && ((std::same_as<AutoDetect, OutT> && all_same_v<Ts...>) || (unsigned_integralish<OutT> && all_same_v<OutT, Ts...>))) | |
constexpr void | load_any (const uint8_t in[], Ts &... outs) |
template<Endianness endianness, typename OutT , ranges::contiguous_range< uint8_t > InR, unsigned_integralish... Ts> requires (sizeof...(Ts) > 0) && ((std::same_as<AutoDetect, OutT> && all_same_v<Ts...>) || (unsigned_integralish<OutT> && all_same_v<OutT, Ts...>)) | |
constexpr void | load_any (InR &&in, Ts &... outs) |
template<Endianness endianness, std::unsigned_integral OutT, ranges::contiguous_range< uint8_t > InR> | |
constexpr OutT | load_any (InR &&in_range) |
template<Endianness endianness, typename OutT , ranges::contiguous_range< uint8_t > InR> requires (std::is_enum_v<OutT> && std::unsigned_integral<std::underlying_type_t<OutT>>) | |
constexpr OutT | load_any (InR &&in_range) |
template<Endianness endianness, typename OutT , ranges::contiguous_range< uint8_t > InR> requires (std::same_as<AutoDetect, OutT> || ((ranges::statically_spanable_range<OutT> || concepts::resizable_container<OutT>) && unsigned_integralish<typename OutT::value_type>)) | |
constexpr auto | load_any (InR &&in_range) |
template<Endianness endianness, typename OutT , ranges::contiguous_output_range OutR, ranges::contiguous_range< uint8_t > InR> requires (unsigned_integralish<std::ranges::range_value_t<OutR>> && (std::same_as<AutoDetect, OutT> || std::same_as<OutT, std::ranges::range_value_t<OutR>>)) | |
constexpr void | load_any (OutR &&out, InR &&in) |
template<Endianness endianness, typename OutT , unsigned_integralish T> requires (std::same_as<AutoDetect, OutT> || std::same_as<T, OutT>) | |
constexpr void | load_any (T out[], const uint8_t in[], size_t count) |
template<Endianness endianness> | |
constexpr bool | native_endianness_is_unknown () |
template<Endianness endianness, typename OutR , ranges::spanable_range InR> requires (std::same_as<AutoDetect, OutR> || (ranges::statically_spanable_range<OutR> && std::default_initializable<OutR>) || concepts::resizable_byte_buffer<OutR>) | |
constexpr auto | store_any (InR &&in_range) |
template<Endianness endianness, std::unsigned_integral InT, ranges::contiguous_output_range< uint8_t > OutR> | |
constexpr void | store_any (InT in, OutR &&out_range) |
template<Endianness endianness, typename InT , ranges::contiguous_output_range< uint8_t > OutR> requires (std::is_enum_v<InT> && std::unsigned_integral<std::underlying_type_t<InT>>) | |
constexpr void | store_any (InT in, OutR &&out_range) |
template<Endianness endianness, typename InT , ranges::contiguous_output_range< uint8_t > OutR, ranges::spanable_range InR> requires (std::same_as<AutoDetect, InT> || std::same_as<InT, std::ranges::range_value_t<InR>>) | |
constexpr void | store_any (OutR &&out, InR &&in) |
template<Endianness endianness, typename InT , ranges::contiguous_output_range< uint8_t > OutR, unsigned_integralish... Ts> requires (sizeof...(Ts) > 0) && ((std::same_as<AutoDetect, InT> && all_same_v<Ts...>) || (unsigned_integralish<InT> && all_same_v<InT, Ts...>)) | |
constexpr void | store_any (OutR &&out, Ts... ins) |
template<Endianness endianness, typename InT , unsigned_integralish T, ranges::contiguous_output_range< uint8_t > OutR> requires std::same_as<AutoDetect, InT> | |
constexpr void | store_any (T in, OutR &&out_range) |
template<Endianness endianness, typename InT , unsigned_integralish T> requires (std::same_as<AutoDetect, InT> || std::same_as<T, InT>) | |
constexpr void | store_any (T in, uint8_t out[]) |
template<Endianness endianness, typename OutR , unsigned_integralish... Ts> requires all_same_v<Ts...> | |
constexpr auto | store_any (Ts... ins) |
template<Endianness endianness, typename InT , unsigned_integralish T0, unsigned_integralish... Ts> requires (std::same_as<AutoDetect, InT> || std::same_as<T0, InT>) && all_same_v<T0, Ts...> | |
constexpr void | store_any (uint8_t out[], T0 in0, Ts... ins) |
template<int_or_strong_type T> | |
constexpr auto | unwrap (T t) -> unwrap_type_t< T > |
template<int_or_strong_type T> | |
constexpr auto | wrap (unwrap_type_t< T > t) -> T |
Variables | |
template<typename CapabilityT , typename... Tags> | |
constexpr bool | has_capability = (std::is_same_v<CapabilityT, Tags> || ...) |
using Botan::detail::unwrap_type_t = typename unwrap_type<T>::type |
Definition at line 72 of file int_utils.h.
|
strong |
Enumerator | |
---|---|
Big | |
Little |
Definition at line 126 of file loadstor.h.
|
constexpr |
Helper function that performs range size-checks as required given the selected output and input range types. If all lengths are known at compile time, this check will be performed at compile time as well. It will then instantiate an output range and concatenate the input ranges' contents.
Definition at line 204 of file stl_util.h.
References BOTAN_ARG_CHECK, and Botan::unpack().
Referenced by Botan::concat().
|
inline |
Definition at line 714 of file loadstor.h.
References BOTAN_ASSERT_NOMSG, store_any(), and T.
Referenced by Botan::copy_out_be(), and Botan::copy_out_le().
|
inlineconstexpr |
Constant time implementation for computing an unsigned integer division with KyberConstants::Q = 3329.
It enforces the optimization of various compilers, replacing the division operation with multiplication and shifts.
This implementation is only valid for integers <= 2**20
Definition at line 45 of file kyber_structures.h.
References BOTAN_DEBUG_ASSERT.
Referenced by Botan::Polynomial::to_message().
|
inlineconstexpr |
Manually load a word from a range in either big or little endian byte order. This will be used only if the endianness of the target platform is unknown at compile time.
Definition at line 181 of file loadstor.h.
Referenced by load_any().
|
inlineconstexpr |
Manually store a word into a range in either big or little endian byte order. This will be used only if the endianness of the target platform is unknown at compile time.
Definition at line 203 of file loadstor.h.
References Big, Botan::get_byte(), and Little.
Referenced by store_any().
|
constexpr |
Definition at line 135 of file loadstor.h.
Referenced by load_any(), load_any(), store_any(), and store_any().
|
constexpr |
Definition at line 149 of file loadstor.h.
Referenced by load_any(), and store_any().
|
inlineconstexpr |
Load a word from in
at some offset off
in | a pointer to some bytes |
off | an offset into the array |
Definition at line 417 of file loadstor.h.
References load_any().
|
inlineconstexpr |
Load many words from in
in | a pointer to some bytes |
outs | a arbitrary-length parameter list of unsigned integers to be loaded |
Definition at line 432 of file loadstor.h.
References load_any().
|
inlineconstexpr |
Load many unsigned integers
in | a fixed-length span to some bytes |
outs | a arbitrary-length parameter list of unsigned integers to be loaded |
Definition at line 295 of file loadstor.h.
References Botan::ranges::assert_exact_byte_length(), load_any(), and T.
|
inlineconstexpr |
Load a word from a range in either big or little endian byte order
This is the base implementation, all other overloads are just convenience wrappers. It is assumed that the range has the correct size for the word.
Template arguments of all overloads of load_any() share the same semantics:
Endianness::Big
or Endianness::Little
, that will eventually select the byte order translation mode implemented in this base function.AutoDetect
, an unsigned integer or a container holding an unsigned integer type. AutoDetect
means that the caller did not explicitly specify the type and expects the type to be inferred from the input.3+. Argument types Typically, those are input and output ranges of bytes or unsigned integers. Or one or more unsigned integers acting as output parameters.
in_range | a fixed-length byte range |
in_range
, as a big-endian valueOverload for loading into a strong type holding an unsigned integer
Definition at line 244 of file loadstor.h.
References Botan::ranges::assert_exact_byte_length(), fallback_load_any(), is_native(), is_opposite(), native_endianness_is_unknown(), Botan::reverse_bytes(), and Botan::typecast_copy().
Referenced by load_any(), load_any(), load_any(), load_any(), load_any(), load_any(), Botan::load_be(), and Botan::load_le().
|
inlineconstexpr |
Overload for loading into an enum type that uses an unsigned integer as its underlying type.
Definition at line 282 of file loadstor.h.
References load_any().
|
inlineconstexpr |
Load one or more unsigned integers, auto-detect the output type if possible. Otherwise, use the specified integer or integer container type.
in_range | a statically-sized range with some bytes |
Definition at line 360 of file loadstor.h.
References BOTAN_ARG_CHECK, and load_any().
|
inlineconstexpr |
Load a variable number of words from in
into out
. The byte length of the out
and in
ranges must match.
out | the output range of words |
in | the input range of bytes |
Definition at line 318 of file loadstor.h.
References Botan::ranges::assert_equal_byte_lengths(), is_native(), load_any(), and Botan::typecast_copy().
|
inlineconstexpr |
Load a variable number of words from in
into out
.
out | the output array of words |
in | the input array of bytes |
count | how many words are in in |
Definition at line 446 of file loadstor.h.
References load_any(), and T.
|
constexpr |
Definition at line 160 of file loadstor.h.
Referenced by load_any(), and store_any().
|
inlineconstexpr |
The caller provided some integer values in a collection but did not provide the output container. Let's create one for them, fill it with one of the overloads above and return it. This will default to a std::array if the caller did not specify the desired output container type.
in_range | a range of words that should be stored |
Definition at line 625 of file loadstor.h.
References store_any().
|
inlineconstexpr |
Store a word in either big or little endian byte order into a range
This is the base implementation, all other overloads are just convenience wrappers. It is assumed that the range has the correct size for the word.
Template arguments of all overloads of store_any() share the same semantics as those of load_any(). See the documentation of this function for more details.
in | an unsigned integral to be stored |
out_range | a byte range to store the word into |
Overload for loading into a strong type holding an unsigned integer
Definition at line 487 of file loadstor.h.
References Botan::ranges::assert_exact_byte_length(), fallback_store_any(), is_native(), is_opposite(), native_endianness_is_unknown(), Botan::reverse_bytes(), and Botan::typecast_copy().
Referenced by copy_out_any_word_aligned_portion(), store_any(), store_any(), store_any(), store_any(), store_any(), store_any(), store_any(), store_any(), Botan::store_be(), and Botan::store_le().
|
inlineconstexpr |
Overload for storing an enum type that uses an unsigned integer as its underlying type.
Definition at line 527 of file loadstor.h.
References store_any().
|
inlineconstexpr |
Store a variable number of words given in in
into out
. The byte lengths of in
and out
must be consistent.
out | the output range of bytes |
in | the input range of words |
Definition at line 565 of file loadstor.h.
References Botan::ranges::assert_equal_byte_lengths(), is_native(), store_any(), and Botan::typecast_copy().
|
inlineconstexpr |
Store many unsigned integers words into a byte range
out | a sized range of some bytes |
ins | a arbitrary-length parameter list of unsigned integers to be stored |
Definition at line 544 of file loadstor.h.
References Botan::ranges::assert_exact_byte_length(), store_any(), and T.
|
inlineconstexpr |
Infer InT from a single unsigned integer input parameter.
TODO: we might consider dropping this overload (i.e. out-range as second parameter) and make this a "special case" of the overload below, that takes a variadic number of input parameters.
in | an unsigned integer to be stored |
out_range | a range of bytes to store the word into |
Definition at line 608 of file loadstor.h.
References store_any().
|
inlineconstexpr |
Store a single unsigned integer into a raw pointer
in | the input unsigned integer |
out | the byte array to write to |
Definition at line 673 of file loadstor.h.
References store_any(), and T.
|
inlineconstexpr |
The caller provided some integer values but did not provide the output container. Let's create one for them, fill it with one of the overloads above and return it. This will default to a std::array if the caller did not specify the desired output container type.
ins | some words that should be stored |
Definition at line 658 of file loadstor.h.
References store_any().
|
inlineconstexpr |
Store many unsigned integers words into a raw pointer
ins | a arbitrary-length parameter list of unsigned integers to be stored |
out | the byte array to write to |
Definition at line 685 of file loadstor.h.
References store_any().
|
constexpr |
Definition at line 75 of file int_utils.h.
Referenced by Botan::checked_cast_to_or_throw().
|
constexpr |
Definition at line 84 of file int_utils.h.
References T.
Referenced by Botan::checked_cast_to_or_throw().
|
constexpr |
Checks whether the CapabilityT
is included in the Tags
type pack.
Definition at line 31 of file strong_type.h.