pem: Write encrypted flag in load_container with .crt format
PATCH 1/1 pem: Write encrypted flag in load_container with .crt format
Make sure a value is written to *out_encrypted whenever l_cert_load_container_file() returns success. Specifically we were forgetting to do this with raw DER-encoded certificates. Fixes the following valgrind warning (sometimes test failure) in test-pem:
==1142== Conditional jump or move depends on uninitialised value(s)
==1142== at 0x10B427: test_load_file (test-pem.c:369) ==1142== by 0x10CF53: l_test_run (test.c:83) ==1142== by 0x10BC19: main (test-pem.c:523) ==1142== test-pem: unit/test-pem.c:369: test_load_file: Assertion `encrypted == params->expect_encrypted' failed. --- ell/cert.c | 3 +++ 1 file changed, 3 insertions(+)
ell/cert.c +3 -0
@@ -1413,6 +1413,9 @@ static int cert_try_load_der_format(const uint8_t *content, size_t content_len,if (out_privkey) *out_privkey =NULL ; +if (out_encrypted) + *out_encrypted = false; +return 0 ; }
Signature · 1 line
2.27.0
Denis Kenzior
AppliedHi Andrew,
Quoted 6 lines · Andrew Zaborowski
Make sure a value is written to
*out_encryptedwheneverl_cert_load_container_file()returns success. Specifically we were forgetting to do this with raw DER-encoded certificates. Fixes the following valgrind warning (sometimes test failure) in test-pem:==1142== Conditional jump or move depends on uninitialised value(s)
Quoted 9 lines
==1142== at 0x10B427: test_load_file (test-pem.c:369) ==1142== by 0x10CF53: l_test_run (test.c:83) ==1142== by 0x10BC19: main (test-pem.c:523) ==1142== test-pem: unit/test-pem.c:369: test_load_file: Assertion `encrypted == params->expect_encrypted' failed. --- ell/cert.c | 3 +++ 1 file changed, 3 insertions(+)
Applied, thanks.
Regards,
-Denis