From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: linux-sgx@vger.kernel.org
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Subject: [PATCH v2 1/2] selftests/x86: sgxsign: Do not query RSA password
Date: Fri, 30 Aug 2019 01:15:18 +0300 [thread overview]
Message-ID: <20190829221519.13243-1-jarkko.sakkinen@linux.intel.com> (raw)
Pass NULL as the value for @cb in PEM_read_RSAPrivateKey() and remove
pem_password_cb(). According to the man page [1], when both @cb and @u
are NULL, a default callback provided by OpenSSL will be used to query
the password. Since our key is not sealed, this is dead functionality.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
tools/testing/selftests/x86/sgx/sgxsign.c | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/tools/testing/selftests/x86/sgx/sgxsign.c b/tools/testing/selftests/x86/sgx/sgxsign.c
index 0b89823fc703..3d9007af40c9 100644
--- a/tools/testing/selftests/x86/sgx/sgxsign.c
+++ b/tools/testing/selftests/x86/sgx/sgxsign.c
@@ -20,8 +20,6 @@ struct sgx_sigstruct_payload {
struct sgx_sigstruct_body body;
};
-static const char *sign_key_pass;
-
static bool check_crypto_errors(void)
{
int err;
@@ -50,18 +48,6 @@ static void exit_usage(const char *program)
exit(1);
}
-static int pem_passwd_cb(char *buf, int size, int rwflag, void *u)
-{
- if (!sign_key_pass)
- return -1;
-
- strncpy(buf, sign_key_pass, size);
- /* no retry */
- sign_key_pass = NULL;
-
- return strlen(buf) >= size ? size - 1 : strlen(buf);
-}
-
static inline const BIGNUM *get_modulus(RSA *key)
{
#if OPENSSL_VERSION_NUMBER < 0x10100000L
@@ -85,7 +71,7 @@ static RSA *load_sign_key(const char *path)
return NULL;
}
key = RSA_new();
- if (!PEM_read_RSAPrivateKey(f, &key, pem_passwd_cb, NULL))
+ if (!PEM_read_RSAPrivateKey(f, &key, NULL, NULL))
return NULL;
fclose(f);
@@ -455,7 +441,6 @@ int main(int argc, char **argv)
#endif
ss.body.xfrm = 3,
- sign_key_pass = getenv("KBUILD_SGX_SIGN_PIN");
program = argv[0];
do {
--
2.20.1
next reply other threads:[~2019-08-29 22:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-29 22:15 Jarkko Sakkinen [this message]
2019-08-29 22:15 ` [PATCH v2 2/2] selftests/x86/sgx: Read encl.bin and encl.ss from the file system Jarkko Sakkinen
2019-08-29 22:28 ` 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=20190829221519.13243-1-jarkko.sakkinen@linux.intel.com \
--to=jarkko.sakkinen@linux.intel.com \
--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 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).