Cryptography library error injection #1391
steven-bellock
started this conversation in
General
Replies: 1 comment
-
Good idea on error injection. I dont suggest we change any code in the original function. I suggest to use wrapper function. For example:
Then when this library is built, it will expose a different symbol.
The error on/off is controlled in the wrapper function. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The time has come to inject errors into the cryptography library, and other HALs, so that code coverage can be improved. The question is how should this be implemented? I think the main requirement is that none of the files in
libspdm/library
should be edited to support this. So that means editing the files inlibspdm/os_stub
andlibspdm/unit_test
. One way would be to edit the cryptography implementations inlibrary/os_stub
to allow for error injection. For examplelibspdm/os_stub/cryptlib_mbedtls/hash/sha.c
Lines 195 to 202 in 37e58c7
When
LIBSPDM_TEST_ERROR_ENABLE
is enabled this would lead to the creation of two new libraries,cryptlib_openssl_test
andcryptlib_mbedtls_test
. The Integrator would obviously need to be careful to not link to these libraries when in production.Beta Was this translation helpful? Give feedback.
All reactions