ell.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] pem: Write encrypted flag in load_container with .crt format
@ 2021-03-10 23:22 Andrew Zaborowski
  2021-03-11  0:52 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Zaborowski @ 2021-03-10 23:22 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]

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(+)

diff --git a/ell/cert.c b/ell/cert.c
index 8463a1d..c489f60 100644
--- a/ell/cert.c
+++ b/ell/cert.c
@@ -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;
 		}
 
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pem: Write encrypted flag in load_container with .crt format
  2021-03-10 23:22 [PATCH] pem: Write encrypted flag in load_container with .crt format Andrew Zaborowski
@ 2021-03-11  0:52 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-03-11  0:52 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 797 bytes --]

Hi Andrew,

On 3/10/21 5:22 PM, Andrew Zaborowski wrote:
> 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(+)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-11  0:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 23:22 [PATCH] pem: Write encrypted flag in load_container with .crt format Andrew Zaborowski
2021-03-11  0:52 ` Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).