-
Notifications
You must be signed in to change notification settings - Fork 26
API: add failure mode support for randombytes() #689
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: main
Are you sure you want to change the base?
Conversation
bc4af2c to
535e75e
Compare
21c81f1 to
562f956
Compare
|
Thank you @L-series!
So long as OQS' randombytes has return type #define MLD_CONFIG_CUSTOM_RANDOMBYTES
#if !defined(__ASSEMBLER__)
#include <oqs/rand.h>
#include <stdint.h>
#include "../../mldsa/src/sys.h"
static MLD_INLINE int mld_randombytes(uint8_t *ptr, size_t len)
{
OQS_randombytes(ptr, len);
return 0;
}or am I missing something?
Yes, I see no problem with that.
The CBMC proofs will need to cover the new behavior, but yes, we also need have specific tests that trigger failure of |
No, this is how I implemented it, it does seem like the best solution currently - however it feels slightly wrong.
I'll look into modifying the proofs and adding a testing example. |
Change randombytes() to return int (0 on success, non-zero on failure) instead of void, allowing callers to detect and handle RNG failures. Updated function signature, all call sites to check return values and test files to use CHECK macro. Signed-off-by: Andreas Hatziiliou <[email protected]>
Run the autogen script to reflect the changes made to the randombytes() API. Signed-off-by: Andreas Hatziiliou <[email protected]>
562f956 to
cf649d3
Compare
|
Hey @L-series! How are you getting on? Let us know if you need any input. Otherwise, can you mark the PR as draft until it's ready for review? |
|
Hey @hanno-becker, sorry for the delay. Haven't had much time outside of work recently. Will mark as a draft till I fix the failing CI tests. |
This PR adds failure mode support for the randombytes() interface.
Marking as draft as there are a few points for which I need clarifications. These are the following:
voidon the liboqs side. Do we make a PR to change this on their end also or do we simply modify the return type of our inlinemld_randombytesfunctions defined in filesintegration/liboqs/config_*.h?CHECK(x)macro tobench/test_components_mldsa.c?randombytes()fails?As an aside. It could be a good idea to factor our the
CHECKmacro into its own test header file as the code is currently duplicated in many files across the project. @hanno-becker @mkannwischer please let me know your thoughts.