git: b785ac18c7d3 - stable/13 - geli: Fix geli setkey -J for detached providers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 04 Sep 2023 12:55:35 UTC
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=b785ac18c7d36cfa84ce8ff8705dc10edd7d2013
commit b785ac18c7d36cfa84ce8ff8705dc10edd7d2013
Author: Arjan de Vet <freebsd@devet.org>
AuthorDate: 2023-08-28 14:54:18 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-09-04 12:55:15 +0000
geli: Fix geli setkey -J for detached providers
Clear cached_passphrase before generating a new key, otherwise the
operation nonsensically tries to reuse the old passphrase.
PR: 254966
Pull Request: https://github.com/freebsd/freebsd-src/pull/780
MFC after: 1 week
(cherry picked from commit 88d13bf33754bd4b0c5df92eef83d6fadb9b4944)
---
lib/geom/eli/geom_eli.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/geom/eli/geom_eli.c b/lib/geom/eli/geom_eli.c
index 6cbb23230fa5..1efb760830c4 100644
--- a/lib/geom/eli/geom_eli.c
+++ b/lib/geom/eli/geom_eli.c
@@ -1421,6 +1421,12 @@ eli_setkey_detached(struct gctl_req *req, const char *prov,
bcopy(mkey, mkeydst, sizeof(mkey));
explicit_bzero(mkey, sizeof(mkey));
+ /*
+ * The previous eli_genkey() set cached_passphrase, we do not want to
+ * use that for the new passphrase so always prompt for it
+ */
+ explicit_bzero(cached_passphrase, sizeof(cached_passphrase));
+
/* Generate key for Master Key encryption. */
if (eli_genkey_single(req, md, key, true) == NULL) {
explicit_bzero(key, sizeof(key));