diff options
Diffstat (limited to 'sbin/geom')
-rw-r--r-- | sbin/geom/class/eli/geom_eli.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/geom/class/eli/geom_eli.c b/sbin/geom/class/eli/geom_eli.c index 987392f..a5f7964 100644 --- a/sbin/geom/class/eli/geom_eli.c +++ b/sbin/geom/class/eli/geom_eli.c @@ -727,6 +727,11 @@ eli_setkey_detached(struct gctl_req *req, const char *prov, unsigned nkey; int error; + if (md->md_keys == 0) { + gctl_error(req, "No valid keys on %s.", prov); + return; + } + /* Generate key for Master Key decryption. */ if (eli_genkey(req, md, key, 0) == NULL) { bzero(key, sizeof(key)); @@ -838,11 +843,6 @@ eli_setkey(struct gctl_req *req) if (eli_metadata_read(req, prov, &md) == -1) return; - if (md.md_keys == 0) { - gctl_error(req, "No valid keys on %s.", prov); - return; - } - if (eli_is_attached(prov)) eli_setkey_attached(req, prov, &md); else |