Open reneme opened 1 year ago
Another one, from #3411
Kyber_PublicKey(const AlgorithmIdentifier& alg_id,
- const std::vector<uint8_t>& key_bits);
+ std::span<const uint8_t> key_bits);
Would be nice to do this for all of the key types.
(This might require some work on BER_Decoder
though ...)
It would be nice if Botan detected the C++ version in the headers and didn't expose unsupported/new features to C++ compilers that didn't support them.
I am currently trying to integrate Botan into a codebase that can't be built with C++20 (because other libraries we're using don't support it yet) and having to wrap everything is becoming a royal pain in the ass.
@crazydef Don't do that. Use Botan2, which is still supported and probably will be for years, and is C++11.
Or (for some functionality) you can use the C89 API in ffi.h
because other libraries we're using don't support it yet
Do this libraries really break if compiled with C++20? I would expect most older code to work without a problem if compiled with a newer C++ standard.
@lieser C++17 deprecated a lot of stuff and removed even more. One particular library I have to deal with still only supports C++14 because of the mess that is C++17.
I'm just trying to build from tag 3.2.0, and I'm seeing the #include <span>
breaking compilation for C++17. make is building with the following options:
g++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++17 -D_REENTRANT -O3 -DBOTAN_IS_BEING_BUILT -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -Wold-style-cast -Wsuggest-override -Wshadow -Wextra-semi -I build/include -isystem build/include/external
As I'm sure you are aware, #include <span>
is only supported for C++20. Not sure if this is somehow supported as an extension by other compilers but on g++ 8.4.0 it is certainly not.
@CharlesJQuarra Botan 3.0 and higher requires C++20 and minimum GCC at least 11.2
That you're seeing precisely this error is surprising in that configure.py
should have detected that the version of GCC is too old, and immediately errored out.
@randombit my bad, I ran make
directly, as it worked on previous pulls, once I ran configure.py
I saw the updated warnings that C++17 is no longer supported for v3
Alongside existing
std::vector<T, Alloc>
and C-style ptr-length APIs we're gradually introducing overloads taking astd::span
from C++20. This ticket is an attempt to create/maintain a list of interfaces that should get such overloads.Public APIs and Interfaces
RandomNumberGenerator
(https://github.com/randombit/botan/pull/3195)Buffered_Computation
(https://github.com/randombit/botan/pull/3294, https://github.com/randombit/botan/pull/3681)Symmetric_Algorithm
(https://github.com/randombit/botan/pull/3297)Cipher_Mode
(https://github.com/randombit/botan/pull/3392)StreamCipher
(forset_iv()
,write_keystream()
) (#3395)AEAD_Mode
(https://github.com/randombit/botan/pull/3317)BlockCipher
(https://github.com/randombit/botan/pull/3394)pubkey.h
(and friends) (https://github.com/randombit/botan/pull/3400)BigInt
(eg. c'tors,::encode
,::binary_encode
, ...)big_rand.cpp
,big_ops*.cpp
,big_code.cpp
)Compression_Algorithm
/Decompression_Algorithm
ec_group.h
HashFunction
(https://github.com/randombit/botan/pull/3681)mem_ops.h
(https://github.com/randombit/botan/pull/3715)Internal APIs and Interfaces
EMSA
Buffered_Computation
(https://github.com/randombit/botan/pull/3681)SymmetricAlgorithm
(https://github.com/randombit/botan/pull/3684)Cipher_Mode
TLS_CBC_HMAC_AEAD_Mode
BlockCipher
(encrypt_n()
,decrypt_n()
) (https://github.com/randombit/botan/pull/3870)Tweakable_Block_Cipher
(set_tweak()
) (https://github.com/randombit/botan/pull/3872)MessageAuthenticationCode
(https://github.com/randombit/botan/pull/3713)MDx_HashFunction
(https://github.com/randombit/botan/pull/3705)StreamCipher
(cipher_bytes()
,generate_keystream()
,set_iv_bytes()
)pk_ops.h
Encryption
(#4239)Decryption
(#4239)Verification
(#4239)Signature
(#4239)Key_Agreement
(#4239)KEM_Encryption
(#3611)KEM_Decryption
(#3611)SQL_Database
(has methods returningstd::pair<uint8_t*, size_t>
)load_be
/store_be
(https://github.com/randombit/botan/pull/3707, https://github.com/randombit/botan/pull/3869)ct_utils.h