-
Notifications
You must be signed in to change notification settings - Fork 579
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
Add an FFI-friendly interface for ZFEC encoding and decoding #3196
Conversation
Codecov ReportBase: 88.09% // Head: 88.10% // Increases project coverage by
📣 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 #3196 +/- ##
==========================================
+ Coverage 88.09% 88.10% +0.01%
==========================================
Files 609 610 +1
Lines 68300 68342 +42
Branches 6811 6818 +7
==========================================
+ Hits 60166 60214 +48
+ Misses 5296 5287 -9
- Partials 2838 2841 +3
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 at Codecov. |
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 @exarkun! This already looks very good.
I think the big remaining issue here is to also amend the Python wrapper in src/python/botan2.py
with the appropriate ctypes declarations, plus a reasonably Pythonic wrapper and a simple test (along the lines of what you wrote in C++ already) that it works.
src/lib/ffi/ffi_zfec.cpp
Outdated
*/ | ||
|
||
#include <botan/ffi.h> | ||
#include <botan/zfec.h> |
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.
The include and the functions themselves should be guarded by BOTAN_HAS_ZFEC
, so that it is possible to compile the C layer even if ZFEC is disabled from the build.
The functions themselves should still be defined mind you! And just return BOTAN_FFI_ERROR_NOT_IMPLEMENTED
in that case.
@randombit I think this is ready for another look. Thanks! |
@exarkun Great! I'll review asap. One immediate comment: please rebase and remove the merge commit. |
2a5637f
to
f9e20aa
Compare
@exarkun Sorry I still need to review this! Don't worry though this is definitely going to land for 3.0. I notice there is a merge conflict, can you rebase and resolve? Thanks |
…rect block indexes
The share sizes are always easily predictable. They are totalSize / K. All share sizes are the same. There's no need to pass them out to the caller. Also rename one `size` parameter to `shareSize` so it is not so easily confused with the total input size parameter.
This avoids uncomfortable questions about the choice of allocator in use on either side of an FFI boundary.
Return a not implemented error code if it is unavailable.
paired with Jean-Paul
f9e20aa
to
c26b49e
Compare
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.
This looks very good and basically ready to merge. There are couple of very small issues, basically just the unnecessary checks on the return value in the Python wrapper, plus needing to change the references to the module in the Python tests.
The ffi object already has an `errcheck` which will notice error return codes and raise an exception.
Thanks! I believe I have addressed those points. |
@exarkun Looks good! Just waiting on CI now |
Relates to #3190