From nobody Fri Dec 6 17:19:17 2024 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y4dKL0t0Fz5gZF4 for ; Fri, 06 Dec 2024 17:19:18 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y4dKK4qZzz4dq9 for ; Fri, 6 Dec 2024 17:19:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733505557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TtS9q01PQ2DhMhA/ZpXzmv2fIm7pk+0MzXYov982bgM=; b=Pjzqa4YSao5ASgRRJdJAMhg1AqfproxKyCFyb9lWbHaSuxchbFsIoCi45+BVHHIf1UvuEZ y0Yiy8En96dmq/EW5KFHXh9KUv23ipFuOjzYB/TjGQSg/x7b4nxhlDKTiTQhV68dn6yPEa /WXqTUX7ZxnVOTl4HeLk4dZe5AFa6rqkUVH9JmRqFBvSKui4173geR/oSk9DJHNQwV86/j WzXM9LBhYB3kJMqZHZXAuSfEgmyiVIbT1T43gUednWasWDoRZJYAmxkhU7QMKd5e+P1/ZV 7A8/o7gJ3xPcdaaCY/zQnhS8P+Hry87Vi32gwQZV1usoJZDIJMHuBLYEcs8MAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733505557; a=rsa-sha256; cv=none; b=X/5scCXoMNX56W7FC9jyNLlyCoixo3/KdZ3R8HK5lUQn0KGyCycx3Scj3Nz5GAVUll4lWI MNyysGqu8X358Mw1zFFATA9zwxD2jC5BEQ4fdjK5F7cWk0tyV/2VJHgNI/0nw/U/DLLBbP Mah2krp2qRoSAPf70+t0XAtQ6/sY37jqk18YNbJVA7C3Dy35Nm9XLVQvOGVLiODPGg3hCK ZAeluHfvyofIaDfJxq9m8DcmcBzFJbZiwHZiHpBFt3iMp/qrMmArNv5wGpTmA9KzJUl4u2 UkX/agJCAd0KJga4e0Uvh4hvdHGX/PcXZDfPUPUTBf/RbRVvy2D1GF3PUYsBqg== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y4dKK3pb6zmqL for ; Fri, 6 Dec 2024 17:19:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 4B6HJHFM023191 for ; Fri, 6 Dec 2024 17:19:17 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 4B6HJHmk023190 for bugs@FreeBSD.org; Fri, 6 Dec 2024 17:19:17 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 283043] gptboot fails to read the encrypted rootfs if geli authentication (geli -a) is used Date: Fri, 06 Dec 2024 17:19:17 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 14.1-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: jhb@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D283043 John Baldwin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jhb@FreeBSD.org --- Comment #2 from John Baldwin --- Hmm, I think we aren't deriving the encryption key correctly when auth is configured. The code in the kernel for this case in sys/geom/eli/g_eli_key= .c: /* * Find and decrypt Master Key encrypted with 'key' at slot 'nkey'. * Return 0 on success, > 0 on failure, -1 on bad key. */ int g_eli_mkey_decrypt(const struct g_eli_metadata *md, const unsigned char *ke= y, unsigned char *mkey, unsigned nkey) { unsigned char tmpmkey[G_ELI_MKEYLEN]; unsigned char enckey[SHA512_MDLEN]; /* Key for encryption. */ const unsigned char *mmkey; int bit, error; if (nkey > G_ELI_MKEYLEN) return (-1); /* * The key for encryption is: enckey =3D HMAC_SHA512(Derived-Key, 1) */ g_eli_crypto_hmac(key, G_ELI_USERKEYLEN, "\x01", 1, enckey, 0); ... but in geliboot.c we have: if ((gdev->sc.sc_flags & G_ELI_FLAG_AUTH) =3D=3D 0) { bcopy(mkp, gdev->sc.sc_ekey, G_ELI_DATAKEYLEN); } else { /* * The encryption key is: ekey =3D HMAC_SHA512(Data-Key, 0x= 10) */ g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, (const uint8_t *)"\x10", 1, gdev->sc.sc_ekey, 0); } Try this change to see if it works: diff --git a/stand/libsa/geli/geliboot.c b/stand/libsa/geli/geliboot.c index 04c53e73b29a..bdb288d2733c 100644 --- a/stand/libsa/geli/geliboot.c +++ b/stand/libsa/geli/geliboot.c @@ -286,9 +286,9 @@ geli_probe(struct geli_dev *gdev, const char *passphras= e, u_char *mkeyp) bcopy(mkp, gdev->sc.sc_ekey, G_ELI_DATAKEYLEN); } else { /* - * The encryption key is: ekey =3D HMAC_SHA512(Data-Key, 0x= 10) + * The encryption key is: ekey =3D HMAC_SHA512(Derived-Key,= 1) */ - g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, (const uint8_t *)"\x10", 1, + g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, (const uint8_t *)"\x01", 1, gdev->sc.sc_ekey, 0); } explicit_bzero(mkey, sizeof(mkey)); --=20 You are receiving this mail because: You are the assignee for the bug.=