ell.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: ell@lists.01.org
Subject: [PATCH] pem: Write encrypted flag in load_container with .crt format
Date: Thu, 11 Mar 2021 00:22:57 +0100	[thread overview]
Message-ID: <20210310232257.955127-1-andrew.zaborowski@intel.com> (raw)

[-- 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

             reply	other threads:[~2021-03-10 23:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 23:22 Andrew Zaborowski [this message]
2021-03-11  0:52 ` [PATCH] pem: Write encrypted flag in load_container with .crt format Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210310232257.955127-1-andrew.zaborowski@intel.com \
    --to=andrew.zaborowski@intel.com \
    --cc=ell@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).