Skip to content

random-drbg: fix missing error check from _gcry_rngdrbg_cavs_test() #15

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AntonMoryakov
Copy link

The return value of _gcry_rngdrbg_cavs_test() was immediately overwritten by memcmp() result, leading to potential loss of error information. This could cause the health check to succeed even if the internal CAVS test function failed.

This issue was reported by a static analyzer:

Return value of function '_gcry_rngdrbg_cavs_test' passed to 'ret'
at random-drbg.c:2378 will be rewritten later.

To fix this, we now check the return code of _gcry_rngdrbg_cavs_test() and only call memcmp() if the test execution succeeded.

The return value of `_gcry_rngdrbg_cavs_test()` was immediately overwritten
by `memcmp()` result, leading to potential loss of error information. This
could cause the health check to succeed even if the internal CAVS test
function failed.

This issue was reported by a static analyzer:
> Return value of function '_gcry_rngdrbg_cavs_test' passed to 'ret'
> at random-drbg.c:2378 will be rewritten later.

To fix this, we now check the return code of `_gcry_rngdrbg_cavs_test()` and
only call `memcmp()` if the test execution succeeded.

Signed-off-by: Anton Moryakov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant