Skip to content
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 telltale error handling in void functions #1456

Open
baentsch opened this issue May 12, 2023 · 0 comments
Open

Add telltale error handling in void functions #1456

baentsch opened this issue May 12, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@baentsch
Copy link
Member

Many OQS functions return void "for historical reasons". Nevertheless they can fail. Right now two (pretty user unfriendly) macros are used (sporadically) to react to internal failures:

/**
* Macro for terminating the program if x is
* a null pointer.
*/
#define OQS_EXIT_IF_NULLPTR(x) \
do { \
if ( (x) == (void*)0 ) \
exit(EXIT_FAILURE); \
} while (0)
/**
* This macro is intended to replace those assert()s
* involving side-effecting statements in aes/aes_ossl.c.
*
* assert() becomes a no-op when -DNDEBUG is defined,
* which causes compilation failures when the statement
* being checked also results in side-effects.
*
* This is a temporary workaround until a better error
* handling strategy is developed.
*/
#define OQS_OPENSSL_GUARD(x) \
do { \
if( 1 != (x) ) { \
exit(EXIT_FAILURE); \
} \
} while (0)

This issue is to recommend improving them, e.g., along the lines suggested in #1454 (comment) and then use them in all cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant