-
Notifications
You must be signed in to change notification settings - Fork 574
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
std::span for Botan::Cipher_Mode #3392
Conversation
7fc8b1f
to
9f63da9
Compare
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #3392 +/- ##
=======================================
Coverage 88.13% 88.14%
=======================================
Files 617 617
Lines 70358 70350 -8
Branches 6984 6987 +3
=======================================
- Hits 62011 62010 -1
+ Misses 5402 5398 -4
+ Partials 2945 2942 -3
... and 9 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
TBH I'm pretty unhappy with the whole cipher API as it exists. For context, originally it was designed to handle arbitrary transformations with minimal copies. (Until #475 cipher modes and compression shared a base class.) But as a cipher-specific interface it leaves a bit to be desired, and is not so easy to use, especially in incremental mode. I think a new cipher API is happening at some point, and we can try to apply some lessons learned. |
I read that you don't foresee this for Botan 3.0, right? With today's PRs I'm trying to reach a somewhat consistent API re: the adoption of |
No, not at this stage of things certainly. I don't even know what exactly a new API would look like at this point.
👍 absolutely, this PR series is a good improvement over status quo |
Two things:
Cipher_Mode::process()
andCipher_Mode::start()
for arbitrary contiguous containersconcepts::resizable_byte_buffer
for the in/out parameters ofCipher_Mode::update()
andCipher_Mode::finish()
.To do that properly a "virtual entrypoint" indirection was introduced. Namely
Cipher_Mode::process_msg()
andCipher_Mode::finish_msg()
.Note that
Cipher_Mode::finish()
with anything butBotan::secure_vector<uint8_t>
will introduce additional data copies. We might be able to address this later on (by generalizing the virtual entrypoint forCipher_Mode
). But that felt entirely out of scope here. FWIW: Users that had their data stored in some other container were previously forced to do the same copy ceremony before in their application code. That's a hot take, maybe. I'm open for better approaches.