gpg-agent cannot protect Kyber keys since libgcrypt 1.12.3: "(seed" rejected by agent_protect

Ben Wolfaardt benjaminwolfaardt at gmail.com
Wed Nov 18 21:52:47 CET 2026


Hi,

Since libgcrypt 1.12.3, gpg-agent cannot put a passphrase on a Kyber
key: "genkey" with protection and a later "PASSWD <keygrip>" both fail
with "Invalid S-expression". Seen with GnuPG 2.5.24 and libgcrypt
1.12.4; agent/protect.c on master is unchanged.

libgcrypt commit e099ccfe makes a Kyber private key

    (private-key(kyber768(p ...)(s ...)(seed ...)))

but agent_protect() lists Kyber in protect_info as "ps" and rejects
anything after (s ...).

To reproduce, in an empty GNUPGHOME with allow-loopback-pinentry:

    gpg-connect-agent "OPTION pinentry-mode=loopback" \
      "/let param (genkey(kyber768))" "/definq KEYPARAM param" \
      "/let pw test" "/definq NEW_PASSPHRASE pw" "genkey" /bye
    ERR 67108947 Invalid S-expression <GPG Agent>

This also breaks the workaround in T7653. Removing "(seed ...)" from
an unprotected key file lets PASSWD protect it, and a ky768_cv25519
composite with the ECC half on an OpenPGP card then decrypts normally.

Happy to test a patch.


More information about the Gnupg-devel mailing list