On Thu, Mar 28, 2019 at 12:07 PM Dave Jiang <dave.jiang(a)intel.com> wrote:
The syntax for loading user master key is different than loading a trusted
key. Fix so we can load user key properly.
Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
---
ndctl/load-keys.c | 13 +++++--------
ndctl/util/keys.c | 20 +++++++++++++++-----
ndctl/util/keys.h | 10 ++++++++--
3 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/ndctl/load-keys.c b/ndctl/load-keys.c
index 19380152..c0d0d743 100644
--- a/ndctl/load-keys.c
+++ b/ndctl/load-keys.c
@@ -25,12 +25,7 @@ static struct parameters {
const char *tpm_handle;
} param;
-enum key_type {
- KEY_USER = 0,
- KEY_TRUSTED,
-};
-
-static const char *key_names[] = {"user", "trusted"};
+static const char *key_names[] = {"user", "trusted",
"encrypted"};
static struct loadkeys {
enum key_type key_type;
@@ -44,6 +39,7 @@ static int load_master_key(struct loadkeys *lk_ctx, const char
*keypath)
char *blob;
int size, rc;
char path[PATH_MAX];
+ enum key_type;
rc = sprintf(path, "%s/nvdimm-master.blob", keypath);
if (rc < 0)
@@ -65,7 +61,8 @@ static int load_master_key(struct loadkeys *lk_ctx, const char
*keypath)
return -errno;
}
- blob = ndctl_load_key_blob(path, &size, param.tpm_handle, -1);
+ blob = ndctl_load_key_blob(path, &size, param.tpm_handle, -1,
+ lk_ctx->key_type);
Where is lk_ctx->key_type set? I don't think I see any assignments in
this patch.