Add tests that cover msan explicit_bzero issue

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2023-03-16 12:00:24 +00:00
parent 2a44ac245f
commit ecd649205d
2 changed files with 34 additions and 0 deletions

View file

@ -21,3 +21,27 @@ mbedtls_platform_zeroize:127:0
Zeroize len 128
mbedtls_platform_zeroize:128:0
Zeroize uninitialised 1 0
mbedtls_platform_zeroize_uninitialised:1:0
Zeroize uninitialised 16 0
mbedtls_platform_zeroize_uninitialised:16:0
Zeroize uninitialised 16 1
mbedtls_platform_zeroize_uninitialised:16:1
Zeroize uninitialised 16 10
mbedtls_platform_zeroize_uninitialised:16:10
Zeroize uninitialised 16 15
mbedtls_platform_zeroize_uninitialised:16:15
Zeroize uninitialised 128 0
mbedtls_platform_zeroize_uninitialised:128:0
Zeroize uninitialised 128 64
mbedtls_platform_zeroize_uninitialised:128:64
Zeroize uninitialised 128 127
mbedtls_platform_zeroize_uninitialised:128:127

View file

@ -39,3 +39,13 @@ void mbedtls_platform_zeroize(int len, int null)
TEST_EQUAL(buf[len + 1], 2);
}
/* END_CASE */
/* BEGIN_CASE */
void mbedtls_platform_zeroize_uninitialised(int len, int p)
{
char buf[128];
mbedtls_platform_zeroize(buf, len);
TEST_EQUAL(buf[p], 0);
}
/* END_CASE */