Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend/Update (public) APIs with std::span overloads #3318

Open
32 of 46 tasks
reneme opened this issue Feb 23, 2023 · 8 comments
Open
32 of 46 tasks

Extend/Update (public) APIs with std::span overloads #3318

reneme opened this issue Feb 23, 2023 · 8 comments
Labels
enhancement Enhancement or new feature

Comments

@reneme
Copy link
Collaborator

reneme commented Feb 23, 2023

Alongside existing std::vector<T, Alloc> and C-style ptr-length APIs we're gradually introducing overloads taking a std::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

Internal APIs and Interfaces

@reneme reneme added the enhancement Enhancement or new feature label Feb 23, 2023
@randombit
Copy link
Owner

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 ...)

@crazydef
Copy link

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.

@randombit
Copy link
Owner

@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

@lieser
Copy link
Collaborator

lieser commented Apr 18, 2023

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.

@crazydef
Copy link

@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.

@reneme reneme changed the title Extend public APIs with std::span overloads Extend/Update (public) APIs with std::span overloads Aug 30, 2023
@CharlesJQuarra
Copy link

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.

@randombit
Copy link
Owner

@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.

@CharlesJQuarra
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or new feature
Projects
None yet
Development

No branches or pull requests

5 participants