[Bug 254966] geli setkey not working with detached provider

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 24 May 2021 19:55:36 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254966

Arjan de Vet <freebsd@devet.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |freebsd@devet.org

--- Comment #3 from Arjan de Vet <freebsd@devet.org> ---
I might have found the problem. It seems to be caused by the use of
cached_passphrase (to attach multiple providers with the same passphrase).
However, when using geli setkey on a detached provider it does not make any
sense. This patch (13.0) works for me:

--- geom_eli.c.ORIG     2021-05-24 21:11:15.718321000 +0200
+++ geom_eli.c  2021-05-24 21:30:47.511489000 +0200
@@ -1387,6 +1387,12 @@
        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(req, md, key, true) == NULL) {
                explicit_bzero(key, sizeof(key));

-- 
You are receiving this mail because:
You are the assignee for the bug.