All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
To: jarkko@kernel.org, linux-sgx@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: dave.hansen@linux.intel.com, Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
Subject: [PATCH 1/5] selftests/sgx: Fix uninitialized pointer dereference in error path.
Date: Mon, 24 Jul 2023 18:58:28 +0200	[thread overview]
Message-ID: <20230724165832.15797-2-jo.vanbulck@cs.kuleuven.be> (raw)
In-Reply-To: <20230724165832.15797-1-jo.vanbulck@cs.kuleuven.be>

Ensure ctx is zero-initialized, such that the encl_measure function will
not call EVP_MD_CTX_destroy with an uninitialized ctx pointer in case of an
early error during key generation.

Signed-off-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
---
 tools/testing/selftests/sgx/sigstruct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/sgx/sigstruct.c b/tools/testing/selftests/sgx/sigstruct.c
index a07896a46364..dd1fdab90e26 100644
--- a/tools/testing/selftests/sgx/sigstruct.c
+++ b/tools/testing/selftests/sgx/sigstruct.c
@@ -318,9 +318,9 @@ bool encl_measure(struct encl *encl)
 	struct sgx_sigstruct *sigstruct = &encl->sigstruct;
 	struct sgx_sigstruct_payload payload;
 	uint8_t digest[SHA256_DIGEST_LENGTH];
+	EVP_MD_CTX *ctx = NULL;
 	unsigned int siglen;
 	RSA *key = NULL;
-	EVP_MD_CTX *ctx;
 	int i;
 
 	memset(sigstruct, 0, sizeof(*sigstruct));
-- 
2.34.1


  reply	other threads:[~2023-07-24 16:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-24 16:58 [PATCH 0/5] selftests/sgx: Fix compilation errors Jo Van Bulck
2023-07-24 16:58 ` Jo Van Bulck [this message]
2023-07-28 19:03   ` [PATCH 1/5] selftests/sgx: Fix uninitialized pointer dereference in error path Jarkko Sakkinen
2023-08-07  6:06     ` Jo Van Bulck
2023-07-28 19:04   ` Jarkko Sakkinen
2023-08-03  3:51   ` Huang, Kai
2023-08-07  6:15     ` Jo Van Bulck
2023-07-24 16:58 ` [PATCH 2/5] selftests/sgx: Fix function pointer relocation in test enclave Jo Van Bulck
2023-07-28 19:05   ` Jarkko Sakkinen
2023-08-03  3:58   ` Huang, Kai
2023-08-07  7:13     ` Jo Van Bulck
2023-08-18 12:54       ` Huang, Kai
2023-08-19  2:30         ` Jo Van Bulck
2023-08-21 11:04           ` Huang, Kai
2023-08-21 13:24             ` Jo Van Bulck
2023-07-24 16:58 ` [PATCH 3/5] selftests/sgx: Ensure correct secinfo struct alignment " Jo Van Bulck
2023-07-28 19:05   ` Jarkko Sakkinen
2023-08-03  4:00   ` Huang, Kai
2023-08-07  9:21     ` Jo Van Bulck
2023-07-24 16:58 ` [PATCH 4/5] selftests/sgx: Ensure expected enclave data buffer size and placement Jo Van Bulck
2023-07-28 19:19   ` Jarkko Sakkinen
2023-08-07  9:41     ` Jo Van Bulck
2023-08-18 13:07       ` Huang, Kai
2023-08-19  1:11         ` Jo Van Bulck
2023-08-03  4:22   ` Huang, Kai
2023-08-07  9:50     ` Jo Van Bulck
2023-07-24 16:58 ` [PATCH 5/5] selftests/sgx: Enclave freestanding compilation + separate linker options Jo Van Bulck
2023-07-28 19:22   ` Jarkko Sakkinen
2023-08-07 10:03     ` Jo Van Bulck
2023-07-28 19:01 ` [PATCH 0/5] selftests/sgx: Fix compilation errors Jarkko Sakkinen

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=20230724165832.15797-2-jo.vanbulck@cs.kuleuven.be \
    --to=jo.vanbulck@cs.kuleuven.be \
    --cc=dave.hansen@linux.intel.com \
    --cc=jarkko@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.