-
Notifications
You must be signed in to change notification settings - Fork 411
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
Return value from OQS_randombytes #1750
Comments
I agree that the Modifying I suppose that it might not be too difficult to change the |
It would be great to hear a little more about your use case and if that latter option would be helpful for you. (And if it would be helpful enough, please feel free to submit a PR proposing the change!) |
Thanks for the explanation! It makes sense (but still is a bit unfortunate). My use cases are mainly hypothetical at this time, but I am thinking of cases where a long-running system may for example temporarily run out of good entropy. In this case I would expect the cryptographic operations to fail, so that the calling code could remedy the situation (the obvious workaround here is to let the custom randombytes function handle it, which may or may not be a good idea) or shut down the system gracefully. I'm not sure it would be a good idea to let |
Absolutely agreed: All functions based on this (in upstream-imported algorithms) must stop working if entropy is bad.
Also agreed, but maybe thinking in reverse: What about adding such (result-returning) call to the public |
Ah, yes, I see. That sounds like a good plan! |
PR welcome :-) Time permitting, of course. |
The current signature of
OQS_Randombytes()
is to returnvoid
. This might be a limiting factor, which is also noted inOQS_randombytes_openssl()
with the following comment:and the failure handling of this function is therefore to terminate the execution via
exit()
.In cases where we supply our own randomness algorithm via
OQS_randombytes_custom_algorithm()
, the same problem applies. We have no other means of handling a failure than forcefully exiting. It is not unthinkable that the higher level code would want to take care of this situation in a custom way without having to resort to using an exit handler.Would it be feasible to change this signature to returning a status value, which can then be propagated through the higher level functions? For example, the keypair and encaps functions already return an
OQS_STATUS
value, which can be taken care of in the calling code. Wouldn't it make sense if OQS_ERROR was returned if an underlying randomness call failed?The text was updated successfully, but these errors were encountered: