libnvdimm/security, acpi/nfit: unify zero-key for all security commands
With zero-key defined, we can remove previous detection of key id 0 or null key in order to deal with a zero-key situation. Syncing all security commands to use the zero-key. Helper functions are introduced to return the data that points to the actual key payload or the zero_key. This helps uniformly handle the key material even with zero_key. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Este commit está contenido en:
@@ -122,9 +122,8 @@ static int intel_security_change_key(struct nvdimm *nvdimm,
|
||||
if (!test_bit(cmd, &nfit_mem->dsm_mask))
|
||||
return -ENOTTY;
|
||||
|
||||
if (old_data)
|
||||
memcpy(nd_cmd.cmd.old_pass, old_data->data,
|
||||
sizeof(nd_cmd.cmd.old_pass));
|
||||
memcpy(nd_cmd.cmd.old_pass, old_data->data,
|
||||
sizeof(nd_cmd.cmd.old_pass));
|
||||
memcpy(nd_cmd.cmd.new_pass, new_data->data,
|
||||
sizeof(nd_cmd.cmd.new_pass));
|
||||
rc = nvdimm_ctl(nvdimm, ND_CMD_CALL, &nd_cmd, sizeof(nd_cmd), NULL);
|
||||
@@ -336,9 +335,8 @@ static int __maybe_unused intel_security_overwrite(struct nvdimm *nvdimm,
|
||||
|
||||
/* flush all cache before we erase DIMM */
|
||||
nvdimm_invalidate_cache();
|
||||
if (nkey)
|
||||
memcpy(nd_cmd.cmd.passphrase, nkey->data,
|
||||
sizeof(nd_cmd.cmd.passphrase));
|
||||
memcpy(nd_cmd.cmd.passphrase, nkey->data,
|
||||
sizeof(nd_cmd.cmd.passphrase));
|
||||
rc = nvdimm_ctl(nvdimm, ND_CMD_CALL, &nd_cmd, sizeof(nd_cmd), NULL);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
Referencia en una nueva incidencia
Block a user