* [PATCH] dsactl: add support to allow keyless secure erase
@ 2019-03-22 21:35 Dave Jiang
2019-03-22 21:47 ` Dan Williams
0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2019-03-22 21:35 UTC (permalink / raw)
To: vishal.l.verma, dan.j.williams; +Cc: linux-nvdimm
When security is not enabled, we reject secure erase currently. Add
support to allow secure erase to occur without key.
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
Documentation/ndctl/ndctl-sanitize-dimm.txt | 2 ++
ndctl/util/keys.c | 16 +++++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/Documentation/ndctl/ndctl-sanitize-dimm.txt b/Documentation/ndctl/ndctl-sanitize-dimm.txt
index 7f57a115..d9450dd3 100644
--- a/Documentation/ndctl/ndctl-sanitize-dimm.txt
+++ b/Documentation/ndctl/ndctl-sanitize-dimm.txt
@@ -33,6 +33,8 @@ erase. The default is 'crypto-erase', but additionally, an 'overwrite' option
is available which overwrites not only the data area, but also the label area,
thus losing record of any namespaces the given NVDIMM participates in.
+It is possible to crypto-erase or overwrite without a key.
+
OPTIONS
-------
<dimm>::
diff --git a/ndctl/util/keys.c b/ndctl/util/keys.c
index c1f2e843..82c16539 100644
--- a/ndctl/util/keys.c
+++ b/ndctl/util/keys.c
@@ -612,12 +612,18 @@ int ndctl_dimm_remove_key(struct ndctl_dimm *dimm)
int ndctl_dimm_secure_erase_key(struct ndctl_dimm *dimm,
enum ndctl_key_type key_type)
{
- key_serial_t key;
+ key_serial_t key = 0;
int rc;
+ enum ndctl_security_state state;
- key = check_dimm_key(dimm, true, key_type);
- if (key < 0)
- return key;
+ state = ndctl_dimm_get_security(dimm);
+
+ if (key_type != ND_MASTER_KEY &&
+ state != NDCTL_SECURITY_DISABLED) {
+ key = check_dimm_key(dimm, true, key_type);
+ if (key < 0)
+ return key;
+ }
if (key_type == ND_MASTER_KEY)
rc = run_key_op(dimm, key, ndctl_dimm_master_secure_erase,
@@ -630,7 +636,7 @@ int ndctl_dimm_secure_erase_key(struct ndctl_dimm *dimm,
if (rc < 0)
return rc;
- if (key_type == ND_USER_KEY)
+ if (key_type == ND_USER_KEY && key != 0)
return discard_key(dimm);
return 0;
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dsactl: add support to allow keyless secure erase
2019-03-22 21:35 [PATCH] dsactl: add support to allow keyless secure erase Dave Jiang
@ 2019-03-22 21:47 ` Dan Williams
0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2019-03-22 21:47 UTC (permalink / raw)
To: Dave Jiang; +Cc: linux-nvdimm
On Fri, Mar 22, 2019 at 2:35 PM Dave Jiang <dave.jiang@intel.com> wrote:
>
> When security is not enabled, we reject secure erase currently. Add
> support to allow secure erase to occur without key.
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> Documentation/ndctl/ndctl-sanitize-dimm.txt | 2 ++
> ndctl/util/keys.c | 16 +++++++++++-----
> 2 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/ndctl/ndctl-sanitize-dimm.txt b/Documentation/ndctl/ndctl-sanitize-dimm.txt
> index 7f57a115..d9450dd3 100644
> --- a/Documentation/ndctl/ndctl-sanitize-dimm.txt
> +++ b/Documentation/ndctl/ndctl-sanitize-dimm.txt
> @@ -33,6 +33,8 @@ erase. The default is 'crypto-erase', but additionally, an 'overwrite' option
> is available which overwrites not only the data area, but also the label area,
> thus losing record of any namespaces the given NVDIMM participates in.
>
> +It is possible to crypto-erase or overwrite without a key.
> +
> OPTIONS
> -------
> <dimm>::
> diff --git a/ndctl/util/keys.c b/ndctl/util/keys.c
> index c1f2e843..82c16539 100644
> --- a/ndctl/util/keys.c
> +++ b/ndctl/util/keys.c
> @@ -612,12 +612,18 @@ int ndctl_dimm_remove_key(struct ndctl_dimm *dimm)
> int ndctl_dimm_secure_erase_key(struct ndctl_dimm *dimm,
> enum ndctl_key_type key_type)
> {
> - key_serial_t key;
> + key_serial_t key = 0;
> int rc;
> + enum ndctl_security_state state;
>
> - key = check_dimm_key(dimm, true, key_type);
> - if (key < 0)
> - return key;
> + state = ndctl_dimm_get_security(dimm);
> +
> + if (key_type != ND_MASTER_KEY &&
> + state != NDCTL_SECURITY_DISABLED) {
No, I'd rather not assume anything about the state relative to when to
use the zero-key. Make this a "-z / --zero-key" command line option.
Specifically because the Intel DSM security specification is different
than the semantics that are generically supported in ndctl.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-22 21:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 21:35 [PATCH] dsactl: add support to allow keyless secure erase Dave Jiang
2019-03-22 21:47 ` Dan Williams
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).