|
Botan 3.14.1
Crypto and TLS for C&
|
#include <strong_type.h>
Public Types | |
| using | const_iterator = typename T::const_iterator |
| The const iterator type of the wrapped container. | |
| using | const_pointer = typename T::const_pointer |
| using | iterator = typename T::iterator |
| The iterator type of the wrapped container. | |
| using | pointer = typename T::pointer |
| using | size_type = typename T::size_type |
| using | value_type = typename T::value_type |
| The element type of the wrapped container. | |
| using | wrapped_type = T |
| The type wrapped by this strong type. | |
| using | wrapped_type = T |
| The type wrapped by this strong type. | |
Public Member Functions | |
| constexpr void | _const_time_poison () const |
| constexpr void | _const_time_unpoison () const |
| auto | all_vartime () const |
| auto | any_vartime () const |
| template<typename OutT> | |
| auto | as () const |
| auto | at (size_type i) |
| auto | at (size_type i) const |
| auto | back () |
| auto | back () const |
| decltype(auto) | begin () const noexcept(noexcept(this->get().begin())) |
| decltype(auto) | begin () noexcept(noexcept(this->get().begin())) |
| auto | capacity () const |
| decltype(auto) | cbegin () const noexcept(noexcept(this->get().cbegin())) |
| decltype(auto) | cbegin () noexcept(noexcept(this->get().cbegin())) |
| decltype(auto) | cend () const noexcept(noexcept(this->get().cend())) |
| decltype(auto) | cend () noexcept(noexcept(this->get().cend())) |
| decltype(auto) | data () const noexcept(noexcept(this->get().data())) |
| decltype(auto) | data () noexcept(noexcept(this->get().data())) |
| bool | empty () const noexcept(noexcept(this->get().empty())) |
| decltype(auto) | end () const noexcept(noexcept(this->get().end())) |
| decltype(auto) | end () noexcept(noexcept(this->get().end())) |
| template<bitvectorish OtherT> | |
| auto | equals (const OtherT &other) const |
| decltype(auto) | flip () |
| decltype(auto) | flip (size_type i) |
| auto | from_bytes (std::span< const uint8_t > bytes, std::optional< size_type > bits=std::nullopt) |
| auto | front () |
| auto | front () const |
| constexpr T & | get () & |
| constexpr T & | get () & |
| constexpr T && | get () && |
| constexpr T && | get () && |
| constexpr const T & | get () const & |
| constexpr const T & | get () const & |
| constexpr const T && | get () const && |
| constexpr const T && | get () const && |
| auto | hamming_weight () const |
| auto | has_odd_hamming_weight () const |
| auto | none_vartime () const |
| template<typename U> | |
| decltype(auto) | operator[] (U &&i) const noexcept(noexcept(this->get().operator[](i))) |
| template<typename U> | |
| decltype(auto) | operator[] (U &&i) noexcept(noexcept(this->get().operator[](i))) |
| auto | pop_back () |
| auto | push_back (bool b) |
| auto | push_back (CT::Choice b) |
| auto | reserve (size_type n) |
| void | resize (size_type size) noexcept(noexcept(this->get().resize(size))) |
| decltype(auto) | set (size_type i) |
| decltype(auto) | set_range (size_type offset, size_type length) |
| size_type | size () const noexcept(noexcept(this->get().size())) |
| template<typename OutT> | |
| auto | subvector (size_type pos) const |
| template<bitvectorish OutT = T> | |
| auto | subvector (size_type pos, std::optional< size_type > length=std::nullopt) const |
| template<typename InT> | |
| void | subvector_replace (size_type pos, InT value) |
| template<typename OutT = T> | |
| auto | to_bytes () const |
| auto | to_bytes (std::span< uint8_t > out) const |
| auto | to_string () const |
| decltype(auto) | unset (size_type i) |
| decltype(auto) | unset_range (size_type offset, size_type length) |
Static Public Member Functions | |
| template<typename CapabilityT> | |
| static constexpr bool | has_capability () |
Strong types can be used as wrappers around common types to provide compile time semantics. They usually contribute to more maintainable and less error-prone code especially when dealing with function parameters.
Internally, this provides adapters so that the wrapping strong type behaves as much as the underlying type as possible and desirable.
This implementation was inspired by: https://stackoverflow.com/a/69030899
Definition at line 270 of file strong_type.h.
|
inherited |
The const iterator type of the wrapped container.
Definition at line 130 of file strong_type.h.
|
inherited |
Definition at line 235 of file strong_type.h.
|
inherited |
The iterator type of the wrapped container.
Definition at line 127 of file strong_type.h.
|
inherited |
Definition at line 234 of file strong_type.h.
|
inherited |
Definition at line 1476 of file bitvector.h.
|
inherited |
The element type of the wrapped container.
Definition at line 121 of file strong_type.h.
|
inherited |
The type wrapped by this strong type.
Definition at line 53 of file strong_type.h.
|
inherited |
The type wrapped by this strong type.
Definition at line 53 of file strong_type.h.
|
inlineconstexprinherited |
Definition at line 1566 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineconstexprinherited |
Definition at line 1568 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Definition at line 1498 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
|
inlineinherited |
Definition at line 1481 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
Referenced by Botan::LMOTS_Private_Key::chain_input(), and Botan::Classic_McEliece_Field_Ordering::permute_with_pivots().
|
inlineinherited |
|
inlineinherited |
|
inlinenoexceptinherited |
Iterate the wrapped container
Definition at line 154 of file strong_type.h.
References Botan::detail::Strong_Base< T >::get().
|
inlinenoexceptinherited |
Iterate the wrapped container
Definition at line 150 of file strong_type.h.
References begin(), and Botan::detail::Strong_Base< T >::get().
Referenced by begin(), Container_Strong_Adapter_Base(), Botan::Classic_McEliece_Field_Ordering::create_from_control_bits(), Botan::encode_point(), Botan::Sphincs_Hash_Functions_Sha2::Sphincs_Hash_Functions_Sha2(), Botan::detail::Strong_Adapter< T >::Strong_Adapter(), and Botan::wots_public_key_from_signature().
|
inlineinherited |
|
inlinenoexceptinherited |
Iterate the wrapped container
Definition at line 170 of file strong_type.h.
References Botan::detail::Strong_Base< T >::get().
|
inlinenoexceptinherited |
Iterate the wrapped container
Definition at line 166 of file strong_type.h.
References Botan::detail::Strong_Base< T >::get().
|
inlinenoexceptinherited |
Iterate the wrapped container
Definition at line 178 of file strong_type.h.
References Botan::detail::Strong_Base< T >::get().
|
inlinenoexceptinherited |
Iterate the wrapped container
Definition at line 174 of file strong_type.h.
References Botan::detail::Strong_Base< T >::get().
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
Definition at line 251 of file strong_type.h.
References data(), get(), and Botan::detail::Strong_Base< T >::get().
Referenced by Botan::Classic_McEliece_Field_Ordering::ct_is_equal(), data(), Botan::Kyber_KEM_Decryptor::decapsulate(), and Botan::FrodoMatrix::serialize().
|
inlinenoexceptinherited |
Query whether the wrapped container is empty
Definition at line 186 of file strong_type.h.
References empty(), and Botan::detail::Strong_Base< T >::get().
Referenced by empty(), and Botan::TLS::Client_Hello_12::session_handle().
|
inlinenoexceptinherited |
Iterate the wrapped container
Definition at line 162 of file strong_type.h.
References Botan::detail::Strong_Base< T >::get().
|
inlinenoexceptinherited |
Iterate the wrapped container
Definition at line 158 of file strong_type.h.
References Botan::detail::Strong_Base< T >::get().
Referenced by Container_Strong_Adapter_Base(), Botan::Classic_McEliece_Field_Ordering::create_from_control_bits(), Botan::encode_point(), Botan::Sphincs_Hash_Functions_Sha2::Sphincs_Hash_Functions_Sha2(), and Botan::detail::Strong_Adapter< T >::Strong_Adapter().
|
inlineinherited |
Definition at line 1521 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
|
inlineinherited |
Definition at line 1493 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
Definition at line 1549 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
|
inlineinherited |
|
inlineconstexprinherited |
Access the wrapped value
Definition at line 81 of file strong_type.h.
Referenced by Botan::detail::Strong_Adapter< T >::_const_time_poison(), Botan::detail::Strong_Adapter< T >::_const_time_unpoison(), Botan::detail::Strong_Adapter< T >::all_vartime(), Botan::detail::Strong_Adapter< T >::any_vartime(), Botan::detail::Strong_Adapter< T >::as(), Botan::detail::Strong_Adapter< T >::at(), Botan::detail::Strong_Adapter< T >::at(), Botan::detail::Strong_Adapter< T >::back(), Botan::detail::Strong_Adapter< T >::back(), Botan::detail::Container_Strong_Adapter_Base< T >::begin(), Botan::detail::Container_Strong_Adapter_Base< T >::begin(), Botan::detail::Strong_Adapter< T >::capacity(), Botan::detail::Container_Strong_Adapter_Base< T >::cbegin(), Botan::detail::Container_Strong_Adapter_Base< T >::cbegin(), Botan::detail::Container_Strong_Adapter_Base< T >::cend(), Botan::detail::Container_Strong_Adapter_Base< T >::cend(), Botan::chain_lengths(), Botan::compute_root(), Botan::detail::Strong_Adapter< T >::data(), Botan::detail::Strong_Adapter< T >::data(), Botan::detail::Container_Strong_Adapter_Base< T >::empty(), Botan::Dilithium_Expanded_Keypair_Codec::encode_keypair(), Botan::detail::Container_Strong_Adapter_Base< T >::end(), Botan::detail::Container_Strong_Adapter_Base< T >::end(), Botan::detail::Strong_Adapter< T >::equals(), Botan::GF_Mask::expand(), Botan::detail::Strong_Adapter< T >::flip(), Botan::detail::Strong_Adapter< T >::flip(), Botan::detail::Strong_Adapter< T >::from_bytes(), Botan::detail::Strong_Adapter< T >::front(), Botan::detail::Strong_Adapter< T >::front(), Botan::detail::Strong_Adapter< T >::hamming_weight(), Botan::detail::Strong_Adapter< T >::has_odd_hamming_weight(), Botan::ht_sign(), Botan::ht_verify(), Botan::GF_Mask::if_set_return(), Botan::GF_Mask::is_equal(), Botan::GF_Mask::is_lte(), Botan::GF_Mask::is_zero(), Botan::lmots_compute_pubkeys(), Botan::LMOTS_Private_Key::LMOTS_Private_Key(), Botan::detail::Strong_Adapter< T >::none_vartime(), Botan::operator&(), Botan::operator&(), Botan::operator&(), Botan::operator&=(), Botan::operator&=(), Botan::Classic_McEliece_GF::operator*(), Botan::operator*(), Botan::operator*(), Botan::operator*(), Botan::operator*=(), Botan::operator*=(), Botan::operator+(), Botan::operator+(), Botan::operator+(), Botan::operator++(), Botan::operator++(), Botan::operator+=(), Botan::operator+=(), Botan::operator-(), Botan::operator-(), Botan::operator-(), Botan::operator--(), Botan::operator--(), Botan::operator-=(), Botan::operator-=(), Botan::operator/(), Botan::operator/(), Botan::operator/(), Botan::operator/=(), Botan::operator/=(), Botan::TLS::operator<(), Botan::operator<<(), Botan::operator<<(), Botan::operator<<(), Botan::operator<<(), Botan::operator<<=(), Botan::operator<<=(), Botan::operator<=>(), Botan::operator<=>(), Botan::operator<=>(), Botan::operator==(), Botan::operator==(), Botan::operator==(), Botan::operator>>(), Botan::operator>>(), Botan::operator>>(), Botan::operator>>=(), Botan::operator>>=(), Botan::detail::Container_Strong_Adapter_Base< T >::operator[](), Botan::detail::Container_Strong_Adapter_Base< T >::operator[](), Botan::operator^(), Botan::operator^(), Botan::operator^(), Botan::operator^=(), Botan::operator^=(), Botan::operator|(), Botan::operator|(), Botan::operator|(), Botan::operator|=(), Botan::operator|=(), Botan::HSS_LMS_Params::params_at_level(), Botan::detail::Strong_Adapter< T >::pop_back(), Botan::Sphincs_Hash_Functions::PRF_batch(), Botan::TLS::Cipher_State::psk(), Botan::detail::Strong_Adapter< T >::push_back(), Botan::detail::Strong_Adapter< T >::push_back(), Botan::Classic_McEliece_Encryptor::raw_kem_encrypt(), Botan::detail::Container_Strong_Adapter_Base< T >::reserve(), Botan::detail::Strong_Adapter< T >::reserve(), Botan::detail::Container_Strong_Adapter_Base< T >::resize(), Botan::GF_Mask::select(), Botan::GF_Mask::select(), Botan::detail::Strong_Adapter< T >::set(), Botan::Sphincs_Address::set_chain_address(), Botan::Sphincs_Address::set_hash_address(), Botan::HSS_LMS_PrivateKeyInternal::set_idx(), Botan::Sphincs_Address::set_keypair_address(), Botan::Sphincs_Address::set_layer_address(), Botan::detail::Strong_Adapter< T >::set_range(), Botan::Sphincs_Address::set_tree_address(), Botan::Sphincs_Address::set_tree_height(), Botan::Sphincs_Address::set_tree_index(), Botan::HSS_LMS_PrivateKeyInternal::sign(), Botan::LMS_PrivateKey::sign_and_get_pk(), Botan::HSS_Signature::signed_pub_key(), Botan::detail::Container_Strong_Adapter_Base< T >::size(), Botan::detail::Strong_Adapter< T >::subvector(), Botan::detail::Strong_Adapter< T >::subvector(), Botan::detail::Strong_Adapter< T >::subvector_replace(), Botan::detail::Strong_Adapter< T >::to_bytes(), Botan::detail::Strong_Adapter< T >::to_bytes(), Botan::detail::Strong_Adapter< T >::to_string(), Botan::treehash(), Botan::detail::Strong_Adapter< T >::unset(), Botan::detail::Strong_Adapter< T >::unset_range(), Botan::wots_public_key_from_signature(), Botan::wots_sign_and_pkgen(), and Botan::x448().
|
inlineconstexprinherited |
Access the wrapped value
Definition at line 81 of file strong_type.h.
Referenced by Botan::detail::Strong_Adapter< T >::_const_time_poison(), Botan::detail::Strong_Adapter< T >::_const_time_unpoison(), Botan::detail::Strong_Adapter< T >::all_vartime(), Botan::detail::Strong_Adapter< T >::any_vartime(), Botan::detail::Strong_Adapter< T >::as(), Botan::detail::Strong_Adapter< T >::at(), Botan::detail::Strong_Adapter< T >::at(), Botan::detail::Strong_Adapter< T >::back(), Botan::detail::Strong_Adapter< T >::back(), Botan::detail::Container_Strong_Adapter_Base< T >::begin(), Botan::detail::Container_Strong_Adapter_Base< T >::begin(), Botan::detail::Strong_Adapter< T >::capacity(), Botan::detail::Container_Strong_Adapter_Base< T >::cbegin(), Botan::detail::Container_Strong_Adapter_Base< T >::cbegin(), Botan::detail::Container_Strong_Adapter_Base< T >::cend(), Botan::detail::Container_Strong_Adapter_Base< T >::cend(), Botan::chain_lengths(), Botan::compute_root(), Botan::detail::Strong_Adapter< T >::data(), Botan::detail::Strong_Adapter< T >::data(), Botan::detail::Container_Strong_Adapter_Base< T >::empty(), Botan::Dilithium_Expanded_Keypair_Codec::encode_keypair(), Botan::detail::Container_Strong_Adapter_Base< T >::end(), Botan::detail::Container_Strong_Adapter_Base< T >::end(), Botan::detail::Strong_Adapter< T >::equals(), Botan::GF_Mask::expand(), Botan::detail::Strong_Adapter< T >::flip(), Botan::detail::Strong_Adapter< T >::flip(), Botan::detail::Strong_Adapter< T >::from_bytes(), Botan::detail::Strong_Adapter< T >::front(), Botan::detail::Strong_Adapter< T >::front(), Botan::detail::Strong_Adapter< T >::hamming_weight(), Botan::detail::Strong_Adapter< T >::has_odd_hamming_weight(), Botan::ht_sign(), Botan::ht_verify(), Botan::GF_Mask::if_set_return(), Botan::GF_Mask::is_equal(), Botan::GF_Mask::is_lte(), Botan::GF_Mask::is_zero(), Botan::lmots_compute_pubkeys(), Botan::LMOTS_Private_Key::LMOTS_Private_Key(), Botan::detail::Strong_Adapter< T >::none_vartime(), Botan::operator&(), Botan::operator&(), Botan::operator&(), Botan::operator&=(), Botan::operator&=(), Botan::Classic_McEliece_GF::operator*(), Botan::operator*(), Botan::operator*(), Botan::operator*(), Botan::operator*=(), Botan::operator*=(), Botan::operator+(), Botan::operator+(), Botan::operator+(), Botan::operator++(), Botan::operator++(), Botan::operator+=(), Botan::operator+=(), Botan::operator-(), Botan::operator-(), Botan::operator-(), Botan::operator--(), Botan::operator--(), Botan::operator-=(), Botan::operator-=(), Botan::operator/(), Botan::operator/(), Botan::operator/(), Botan::operator/=(), Botan::operator/=(), Botan::TLS::operator<(), Botan::operator<<(), Botan::operator<<(), Botan::operator<<(), Botan::operator<<(), Botan::operator<<=(), Botan::operator<<=(), Botan::operator<=>(), Botan::operator<=>(), Botan::operator<=>(), Botan::operator==(), Botan::operator==(), Botan::operator==(), Botan::operator>>(), Botan::operator>>(), Botan::operator>>(), Botan::operator>>=(), Botan::operator>>=(), Botan::detail::Container_Strong_Adapter_Base< T >::operator[](), Botan::detail::Container_Strong_Adapter_Base< T >::operator[](), Botan::operator^(), Botan::operator^(), Botan::operator^(), Botan::operator^=(), Botan::operator^=(), Botan::operator|(), Botan::operator|(), Botan::operator|(), Botan::operator|=(), Botan::operator|=(), Botan::HSS_LMS_Params::params_at_level(), Botan::detail::Strong_Adapter< T >::pop_back(), Botan::Sphincs_Hash_Functions::PRF_batch(), Botan::TLS::Cipher_State::psk(), Botan::detail::Strong_Adapter< T >::push_back(), Botan::detail::Strong_Adapter< T >::push_back(), Botan::Classic_McEliece_Encryptor::raw_kem_encrypt(), Botan::detail::Container_Strong_Adapter_Base< T >::reserve(), Botan::detail::Strong_Adapter< T >::reserve(), Botan::detail::Container_Strong_Adapter_Base< T >::resize(), Botan::GF_Mask::select(), Botan::GF_Mask::select(), Botan::detail::Strong_Adapter< T >::set(), Botan::Sphincs_Address::set_chain_address(), Botan::Sphincs_Address::set_hash_address(), Botan::HSS_LMS_PrivateKeyInternal::set_idx(), Botan::Sphincs_Address::set_keypair_address(), Botan::Sphincs_Address::set_layer_address(), Botan::detail::Strong_Adapter< T >::set_range(), Botan::Sphincs_Address::set_tree_address(), Botan::Sphincs_Address::set_tree_height(), Botan::Sphincs_Address::set_tree_index(), Botan::HSS_LMS_PrivateKeyInternal::sign(), Botan::LMS_PrivateKey::sign_and_get_pk(), Botan::HSS_Signature::signed_pub_key(), Botan::detail::Container_Strong_Adapter_Base< T >::size(), Botan::detail::Strong_Adapter< T >::subvector(), Botan::detail::Strong_Adapter< T >::subvector(), Botan::detail::Strong_Adapter< T >::subvector_replace(), Botan::detail::Strong_Adapter< T >::to_bytes(), Botan::detail::Strong_Adapter< T >::to_bytes(), Botan::detail::Strong_Adapter< T >::to_string(), Botan::treehash(), Botan::detail::Strong_Adapter< T >::unset(), Botan::detail::Strong_Adapter< T >::unset_range(), Botan::wots_public_key_from_signature(), Botan::wots_sign_and_pkgen(), and Botan::x448().
|
inlineconstexprinherited |
Access the wrapped value
Definition at line 89 of file strong_type.h.
|
inlineconstexprinherited |
Access the wrapped value
Definition at line 89 of file strong_type.h.
|
inlineconstexprinherited |
Access the wrapped value
Definition at line 85 of file strong_type.h.
|
inlineconstexprinherited |
Access the wrapped value
Definition at line 85 of file strong_type.h.
|
inlineconstexprinherited |
Access the wrapped value
Definition at line 93 of file strong_type.h.
|
inlineconstexprinherited |
Access the wrapped value
Definition at line 93 of file strong_type.h.
|
inlineinherited |
|
inlinestaticconstexpr |
Check whether this strong type was declared with the given capability tag
Definition at line 279 of file strong_type.h.
|
inlineinherited |
|
inlineinherited |
|
inlinenoexceptinherited |
Element access
| i | the index of the element |
Definition at line 212 of file strong_type.h.
References Botan::detail::Strong_Base< T >::get().
|
inlinenoexceptinherited |
Element access
| i | the index of the element |
Definition at line 220 of file strong_type.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
|
inlineinherited |
Definition at line 1525 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
Definition at line 1527 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
Definition at line 1564 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlinenoexceptinherited |
Change the number of elements held
| size | the new number of elements |
Definition at line 194 of file strong_type.h.
References Botan::detail::Strong_Base< T >::get(), and size().
|
inlineinherited |
Definition at line 1485 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
Definition at line 1487 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlinenoexceptinherited |
Query the size of the wrapped container
Definition at line 182 of file strong_type.h.
References Botan::detail::Strong_Base< T >::get(), and size().
Referenced by Botan::compute_root(), Container_Strong_Adapter_Base(), Botan::Classic_McEliece_Field_Ordering::ct_is_equal(), Botan::Kyber_KEM_Decryptor::decapsulate(), Botan::Expanded_Keypair_Codec::decode_keypair(), Botan::Dilithium_Algos::expand_keypair(), Botan::lmots_compute_pubkeys(), reserve(), resize(), size(), and Botan::Sphincs_Hash_Functions_Sha2::Sphincs_Hash_Functions_Sha2().
|
inlineinherited |
Definition at line 1510 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get(), and subvector().
|
inlineinherited |
Definition at line 1503 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get(), and subvector().
Referenced by Botan::Classic_McEliece_Matrix::mul(), subvector(), and subvector().
|
inlineinherited |
Definition at line 1516 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
Definition at line 1554 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get(), and to_bytes().
Referenced by to_bytes().
|
inlineinherited |
Definition at line 1558 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
|
inlineinherited |
Definition at line 1491 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().
|
inlineinherited |
Definition at line 1489 of file bitvector.h.
References Botan::detail::Strong_Base< T >::get().