diff mbox series

[v2,1/3] ndctl: fix load-keys for user master-key

Message ID 155381182887.13778.15556671056565903543.stgit@djiang5-desk3.ch.intel.com (mailing list archive)
State Accepted
Commit 50da6303f22978c7ef02ec08f19b8dabed21d9c1
Headers show
Series [v2,1/3] ndctl: fix load-keys for user master-key | expand

Commit Message

Dave Jiang March 28, 2019, 10:24 p.m. UTC
load-keys incorrectly assumes that all keys have TPM handles. TPM handle is
only for trusted-keys. Fix in order to allow user master-key to operate.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---

v2:
- Make output go to stderr. (Dan)


 ndctl/load-keys.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/ndctl/load-keys.c b/ndctl/load-keys.c
index 8e4998f2..7d86a94b 100644
--- a/ndctl/load-keys.c
+++ b/ndctl/load-keys.c
@@ -213,10 +213,8 @@  static int load_keys(struct loadkeys *lk_ctx, const char *keypath,
 
 	if (!tpmhandle) {
 		rc = check_tpm_handle(lk_ctx);
-		if (rc < 0) {
-			rc = -errno;
-			goto erropen;
-		}
+		if (rc < 0)
+			fprintf(stderr, "No TPM handle discovered.\n");
 	}
 
 	rc = load_master_key(lk_ctx, param.key_path);