-
Notifications
You must be signed in to change notification settings - Fork 28
Optimize FIPS CAST startup tests #351
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?
Optimize FIPS CAST startup tests #351
Conversation
…ead safe lazy CAST
…_fips_cast_optimization
|
jenkins retest this please |
| #define WP_CHECK_FIPS_ALGO(algo) \ | ||
| do { \ | ||
| if (wp_init_cast(algo) != 1) { \ | ||
| WOLFPROV_ERROR_MSG(WP_LOG_COMP_PROVIDER, \ |
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.
There could be a code size hit due to the frequency of these macros (mainly from duplicate logs). Is that ok?
Could convert to functions I suppose, but might make the caller size a bit less clean.
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.
Or just move the log into wp_init_cast
| /* Dispatch to algorithm-specific inner function */ | ||
| switch (algo) { | ||
| #ifdef WP_HAVE_AES | ||
| case WP_CAST_ALGO_AES: |
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 indentation looks off in this switch
| } | ||
|
|
||
| if (castAlgos[algo].init == 0) { | ||
| if (wp_lock(wp_get_cast_mutex(algo)) != 1) { |
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.
wp_get_cast_mutex is only called from this function, and this function already indexes into castAlgos[algo]. I'd say to use castAlgos[algo].mutex directly here.
| * @return Initialization state (0 = not initialized, 1 = initialized). | ||
| * @return 0 if algo is out of range. | ||
| */ | ||
| int wp_get_cast_init(int algo) |
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 function doesn't appear to be called
| * @param [in] algo Algorithm category (WP_CAST_ALGO_*). | ||
| * @param [in] init Initialization state to set. | ||
| */ | ||
| void wp_set_cast_init(int algo, int init) |
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.
Also seemingly not called
| * @return 1 on success. | ||
| * @return 0 on failure. | ||
| */ | ||
| static int wp_rsa_init_cast_inner(void) |
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.
Why all the wrapper functions? Can we do the calls to wc_RunCast_* directly in the switch?
Optimize FIPS CAST startup tests with per algo mutex handling for thread safe lazy CAST.