Botan 3.6.1
Crypto and TLS for C&
|
Classes | |
struct | AutoDetect |
class | Bounded_XOF |
class | Strong_Adapter |
class | Strong_Adapter< T > |
class | Strong_Base |
struct | wrapped_type_helper |
struct | wrapped_type_helper< T > |
struct | wrapped_type_helper_with_enum |
struct | wrapped_type_helper_with_enum< T > |
Concepts | |
concept | custom_loadable |
concept | custom_storable |
concept | unsigned_integralish |
Typedefs | |
template<unsigned_integralish T> | |
using | wrapped_type = typename wrapped_type_helper_with_enum<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) |
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, unsigned_integralish WrappedOutT, ranges::contiguous_range< uint8_t > InR> requires (!custom_loadable<strong_type_wrapped_type<WrappedOutT>>) | |
constexpr WrappedOutT | load_any (InR &&in_range) |
template<Endianness endianness, unsigned_integralish WrappedOutT, ranges::contiguous_range< uint8_t > InR> requires (custom_loadable<strong_type_wrapped_type<WrappedOutT>>) | |
constexpr WrappedOutT | 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, 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<Endianness endianness, unsigned_integralish WrappedInT, ranges::contiguous_output_range< uint8_t > OutR> requires (!custom_storable<strong_type_wrapped_type<WrappedInT>>) | |
constexpr void | store_any (WrappedInT wrapped_in, OutR &&out_range) |
template<Endianness endianness, unsigned_integralish WrappedInT, ranges::contiguous_output_range< uint8_t > OutR> requires (custom_storable<strong_type_wrapped_type<WrappedInT>>) | |
constexpr void | store_any (WrappedInT wrapped_in, OutR &&out_range) |
template<unsigned_integralish InT> | |
constexpr auto | unwrap_strong_type_or_enum (InT t) |
template<unsigned_integralish OutT, std::unsigned_integral T> | |
constexpr auto | wrap_strong_type_or_enum (T t) |
Variables | |
template<typename CapabilityT , typename... Tags> | |
constexpr bool | has_capability = (std::is_same_v<CapabilityT, Tags> || ...) |
using Botan::detail::wrapped_type = typename wrapped_type_helper_with_enum<T>::type |
Definition at line 211 of file loadstor.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::unwrap_strong_type().
Referenced by Botan::concat().
|
inline |
Definition at line 780 of file loadstor.h.
References BOTAN_ASSERT_NOMSG, store_any(), and T.
Referenced by Botan::copy_out_be(), and Botan::copy_out_le().
|
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 238 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 260 of file loadstor.h.
References Big, Botan::get_byte(), and Little.
Referenced by store_any().
|
constexpr |
Definition at line 135 of file loadstor.h.
References Big, BOTAN_UNUSED, and Little.
Referenced by load_any(), load_any(), store_any(), and store_any().
|
constexpr |
Definition at line 150 of file loadstor.h.
References Big, BOTAN_UNUSED, and Little.
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 480 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 495 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 358 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 value Definition at line 302 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(), Botan::typecast_copy(), and wrap_strong_type_or_enum().
Referenced by load_any(), load_any(), load_any(), load_any(), load_any(), load_any(), Botan::load_be(), and Botan::load_le().
|
inlineconstexpr |
Load a custom object from a range in either big or little endian byte order
This is the base implementation for custom objects (e.g. SIMD type wrappres), all other overloads are just convenience overloads.
in_range | a fixed-length byte range |
in_range
, as a big-endian value Definition at line 339 of file loadstor.h.
References Botan::ranges::assert_exact_byte_length(), Big, and Botan::wrap_strong_type().
|
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 423 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 381 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 509 of file loadstor.h.
References load_any(), and T.
|
constexpr |
Definition at line 162 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 691 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 631 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 610 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 674 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 739 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 724 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 751 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.
wrapped_in | an unsigned integral to be stored |
out_range | a byte range to store the word into |
Definition at line 551 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(), Botan::typecast_copy(), and unwrap_strong_type_or_enum().
Referenced by copy_out_any_word_aligned_portion(), store_any(), store_any(), store_any(), store_any(), store_any(), store_any(), store_any(), Botan::store_be(), and Botan::store_le().
|
inlineconstexpr |
Store a custom word in either big or little endian byte order into a range
This is the base implementation for storing custom objects, all other overloads are just convenience overloads.
wrapped_in | a custom object to be stored |
out_range | a byte range to store the word into |
Definition at line 587 of file loadstor.h.
References Botan::ranges::assert_exact_byte_length(), Big, and unwrap_strong_type_or_enum().
|
constexpr |
Definition at line 214 of file loadstor.h.
References Botan::unwrap_strong_type().
Referenced by store_any().
|
constexpr |
Definition at line 224 of file loadstor.h.
References Botan::wrap_strong_type().
Referenced by load_any().
|
constexpr |
Checks whether the CapabilityT
is included in the Tags
type pack.
Definition at line 31 of file strong_type.h.