-
Notifications
You must be signed in to change notification settings - Fork 623
Update deprecated mem_ops.h function calls to use std::span-based versions and resolve some TODOs #4783
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
base: master
Are you sure you want to change the base?
Update deprecated mem_ops.h function calls to use std::span-based versions and resolve some TODOs #4783
Conversation
e1d1cb2 to
47f27ae
Compare
This comment was marked as resolved.
This comment was marked as resolved.
7356fa8 to
bfc033b
Compare
reneme
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now. Thank you for taking this on!
For the record: The mem_ops.h header is marked as "future internal header". So, technically, we don't even need to mark the typecast_copy and xor_buf overloads as "deprecated", because for library users the entire header is going to go away in a future major release.
Personally, I still think your change in mem_ops.h makes sense as-is, for documentation purposes.
@randombit, over to you. :)
bfc033b to
86c9a43
Compare
86c9a43 to
837c30c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
b376fe2 to
5375c3c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
reneme
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience with this. I left a few suggestions for simplification (mostly unnecessary explicit construction of std::span).
Regarding the changes in xts.cpp: I think we should postpone those until some more top-down modernization has landed. Most notably #4880 and similar effort to spanify process_msg and start_msg. Once that is done, the abstract interface of all cipher mode implementations will be purely span-based and ready for such modernizations.
4b2c40a to
0698936
Compare
|
I have addressed all feedback from the review:
roughtime std::span modernization proposal I will follow the results of the CI tests and then we can merge if you see fit. I see you're quite busy with clang-tidy today, I'll rebase it from time to time if needed, just FYI. |
reneme
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for your efforts.
Thank you for your time and for sharing your expertise. Your guidance has been very helpful throughout this process. I’ll need to spend some additional time getting more familiar with the span construct. Since I'm currently use the C++11 standard, I've not using it in job. @randombit, this development is ready to be merged at your discretion. Best regards. |
0698936 to
a14398a
Compare
a14398a to
89b2c15
Compare
89b2c15 to
c673d5c
Compare
d60dafa to
237d1e6
Compare
randombit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the wait here. Changes are generally fine but the issue is mem_ops.h is currently a public header but I don't think the library should be in the business of providing general utility functions like this, which is why the header is deprecated and will be removed in Botan4. Any new functionality along these lines should go into the (internal) mem_utils.h header. Ideally we can update all of the callers within the library and then guard the declarations here, which are no longer used internally but which we must continue to provide for now for compatability, with !defined(BOTAN_IS_BEING_BUILT) as is done with various other functions, so it's not possible to add new code to the library which uses them.
I recall we previously discussed removing the header file here. Actually, adding a new function for ‘mem_ops.h’ in this branch is not currently on the agenda. I was only focused on the TODO message; my goal was to deprecate the use of existing function calls and update them with std::span-based overloads. Within the project, the use of functions marked with the declaration I thought moving them to the (internal) mem_utils.h header would be a separate task. I'm not sure, maybe I misunderstood. Some time has passed, so I need to review it again, but if you guide me step by step, I can work on it as soon as possible and apply the update you want. |
|
Given that this PR doesn't add any functionality to
|
Thank you for informing me and guiding me @reneme. I would like to take on this task in this thread and in the pull request that will be opened later. Is @randombit suitable for you? Updates:
|
237d1e6 to
cc0aec0
Compare
cc0aec0 to
19299fe
Compare
7fa74c1 to
b1d6285
Compare
…s and make others todo
b1d6285 to
1e9606e
Compare
|
Hello @randombit, @reneme, First, I wish you a healthy, peaceful, and successful New Year. I hope to contribute more to the project in 2026. I wanted to share a note regarding this long-standing development branch. Some of my branches have been open for a long time and for some I’ll even need to revisit the details to fully recall what I did (there are ones approaching a year). For this reason, we could follow the approach @reneme outlined in this comment. Another idea I have is: if avoiding changes to the header file ( I would really like to contribute to this development. Unfortunately, I don’t have much practical experience with std::span yet, as I haven’t been using the latest standard extensively. However, I am always open to your guidance and feedback. Kind regards. |
Hello,
This draft PR includes updates to modernize the codebase by replacing deprecated mem_ops.h function calls with their
std::span-based counterparts in line with C++20 standards. Additionally, I also discussed some TODO comments that I thought would be quick fixes.My reference points the C++ Core Guidelines and CppReference. Since I am not actively developing in C++20 at the moment, I am marking this PR as a draft to review and feedback.
Changes made:
Confirmed that builds and test suites pass with:
Check code format with:
Outstanding considerations:
I intentionally did not modify the following function, as it touches multiple areas and could introduce bugs without extensive review:
Files affected by this function;
Additional notes:
There is a change in TLS, so additional checking may be required.
Thanks in advance for your time and guidance.