botan
botan copied to clipboard
std::byte support
Hi,
from my perspective, the way to go for the future is to support std::byte as a native byte type. But Botan actually makes it hard to use std::byte. One of the most critical parts is actually this requirement of secure_alloacator:
template <typename T>
#if !defined(_ITERATOR_DEBUG_LEVEL) || _ITERATOR_DEBUG_LEVEL == 0
/*
* Assert exists to prevent someone from doing something that will
* probably crash anyway (like secure_vector<non_POD_t> where ~non_POD_t
* deletes a member pointer which was zeroed before it ran).
* MSVC in debug mode uses non-integral proxy types in container types
* like std::vector, thus we disable the check there.
*/
requires std::is_integral<T>::value
#endif
It is still Botan 2 because Botan 3 still does not have a conan recipe. But I would at least allow the std::byte type here. In the long run, it will be very beneficial as well, that the implementer can use the API with std::byte as well.
Best regards, Trafo
[EDIT] But in general awesome work. If there were std::byte support in general, it would be super easy and modern to use crypto lib, which gives many possibilities. Could we just replace std::uint8_t with a botan_byte? Where implementers can define if they want std::byte or for legacy reasons std::uint8_t?