NetBSD Problem Report #59823
From martin@thirdstage.duskware.de Mon Dec 8 09:33:37 2025
Return-Path: <martin@thirdstage.duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id B4BC01A9239
for <gnats-bugs@gnats.NetBSD.org>; Mon, 8 Dec 2025 09:33:37 +0000 (UTC)
Message-Id: <20251208093333.C2C87E20019@mail.duskware.de>
Date: Mon, 08 Dec 2025 10:33:28 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: netpgpverify broken for PGP since switch to gcc 14.3
X-Send-Pr-Version: 3.95
>Number: 59823
>Category: bin
>Synopsis: netpgpverify broken for PGP since switch to gcc 14.3
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Dec 08 09:35:00 +0000 2025
>Last-Modified: Sat Jan 24 03:10:02 +0000 2026
>Originator: Martin Husemann
>Release: NetBSD 11.99.4
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD thirdstage.duskware.de 11.99.4 NetBSD 11.99.4 (MODULAR) #851: Fri Dec 5 05:45:37 CET 2025 martin@thirdstage.duskware.de:/home/martin/current/src/sys/arch/sparc64/compile/MODULAR sparc64
Architecture: sparc64
Machine: sparc64
>Description:
On sparc64 and sparc the netpgpverify tests fail since we switched sparc*
to gcc 14.3.
The tests invokes (besides others):
netpgpverify -k dsa-pubring.gpg in2.asc
and it prints:
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
hash_any: bad algorithm
Signature did not match contents -- Signature on data did not match
This happens because here the "hashed" data is all zeroes, causing
the algorithm (taken from byte hashed[3]) to become 0.
#0 pgpv_digest_memory (
data=0xffffffffffffd068 "Ã\034\215øÛXsG\0067\034\030rÍÄ\017)ûr\v\211W·ü\027.\036J¯@\0261", size=64, mem=0x402f8031, cc=121, hashed=0xffffffffffffaaca "",
hashsize=12, doarmor=119)
at /home/martin/current/src/crypto/external/bsd/netpgp/bin/netpgpverify/../../dist/src/netpgpverify/pgpsum.c:245
#1 0x00000000001226ac in match_sig (cursor=0x402d6000, signature=0x41c16ce8,
pubkey=0x402c2000,
data=0x402f8031 "#\t.NetBSD: Makefile,v 1.5.10.1 2012/05/06 18:14:16 agc Exp . \n\nSUBDIR+=\tlib .WAIT\nSUBDIR+=\tbin\n\n.include <bsd.subdir.mk>\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.11 (NetBSD)\n\niF4EAREIAAYFAlCF"...,
size=121)
at /home/martin/current/src/crypto/external/bsd/netpgp/bin/netpgpverify/../../dist/src/netpgpverify/libverify.c:2862
#2 0x0000000000122c10 in match_sig_id (cursor=0x402d6000, pgp=0x40296000,
signature=0x41c16ce8, litdata=0x41c16be8, primary=0, sub=0)
at /home/martin/current/src/crypto/external/bsd/netpgp/bin/netpgpverify/../../dist/src/netpgpverify/libverify.c:2961
#3 0x0000000000123c7c in pgpv_verify (cursor=0x402d6000, pgp=0x40296000,
p=0xffffffffffffdc21, size=-1)
at /home/martin/current/src/crypto/external/bsd/netpgp/bin/netpgpverify/../../dist/src/netpgpverify/libverify.c:3235
#4 0x0000000000124ba4 in verify_data (pgp=0x40296000, cmd=0x145838 "verify",
inname=0xffffffffffffdc21 "in2.asc", in=0xffffffffffffdc21 "in2.asc",
cc=-1)
at /home/martin/current/src/crypto/external/bsd/netpgp/bin/netpgpverify/../../dist/src/netpgpverify/main.c:117
#5 0x0000000000125018 in main (argc=4, argv=0xffffffffffffd5d8)
at /home/martin/current/src/crypto/external/bsd/netpgp/bin/netpgpverify/../../dist/src/netpgpverify/main.c:185
at frame #1:
2860 if (!match && signature->type == SIGTYPE_TEXT) {
2861 /* second try for cleartext data, ignoring trailing whitespace */
2862 calclen = pgpv_digest_memory(calculated, sizeof(calculated),
2863 data, size,
2864 get_ref(&signature->hashstart), signature->hashlen, 'w');
(gdb) p *signature
$36 = {signer = "&?ç\205bâü~", hashstart = {vp = 0x40296000, offset = 2,
mem = 3}, hash2 = 0xffffffffffffaae2 "", mpi = 0xffffffffffffaae4 "",
birth = 1350912266, keyexpiry = 0, expiry = 0, hashlen = 12,
version = 4 '\004', type = 1 '\001', keyalg = 17 '\021', hashalg = 8 '\b',
trustlevel = 0 '\000', trustamount = 0 '\000', bn = {{bn = 0x4025e140,
bits = 253}, {bn = 0x4025e160, bits = 255}}, regexp = 0x0,
pref_key_server = 0x0, policy = 0x0, features = 0x0, why_revoked = 0x0,
revoke_fingerprint = 0x0, issuer_fingerprint = 0x0, ifver = 0 '\000',
revoke_alg = 0 '\000', revoke_sensitive = 0 '\000', trustsig = 0 '\000',
revocable = 0 '\000', pref_symm_alg = 0 '\000', pref_hash_alg = 0 '\000',
pref_compress_alg = 0 '\000', key_server_modify = 0 '\000',
notation = 0 '\000', type_key = 0 '\000', primary_userid = 0 '\000',
revoked = 0 '\000'}
at frame #0
(gdb) p hashsize
$42 = 12
(gdb) x/12c hashed
0xffffffffffffaaca: 0 '\000' 0 '\000' 0 '\000' 0 '\000'1 '\001' 0 '\000' 0 '\000' 0 '\000'
0xffffffffffffaad2: 0 '\000' 0 '\000' 0 '\000' 0 '\000'
>How-To-Repeat:
cd /usr/tests/usr.bin/netpgpverify && atf-run | atf-report
>Fix:
n/a
>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59823 CVS commit: pkgsrc/security/netpgpverify
Date: Sun, 4 Jan 2026 06:19:40 +0000
Module Name: pkgsrc
Committed By: riastradh
Date: Sun Jan 4 06:19:40 UTC 2026
Modified Files:
pkgsrc/security/netpgpverify: Makefile
pkgsrc/security/netpgpverify/files: Makefile.in libverify.c
Added Files:
pkgsrc/security/netpgpverify/files: gpg2test gpg2test.gpg2
keypubring.gpg2 keysecring.gpg2
Log Message:
security/netpgpverify: Handle issuer fingerprint subpackets.
This is an extremely dodgy stop-gap measure to verify signatures
produced by gpg2. It does nothing to address pervasive problems in
netpgpverify, like PR security/57449 or PR bin/59823, or even more
narrowly scoped problems with using keyids instead of fingerprints.
I'm a little reluctant to even commit this stop-gap because the
problems are so bad, and a band-aid won't fix a spurting carotid.
The symptom is:
> ./netpgpverify -k keypubring.gpg2 gpg2test.gpg2
> Ignoring unusual/reserved signature subpacket 34
> Signature did not match contents -- Signature key id 38fa6a2833ed1efa does not match onepass keyid
Test case generated by:
mkdir -m 0700 gpghome
gpg2 --homedir gpghome --batch --passphrase '' \
--quick-gen-key user@example.com rsa2048 sign never
echo hello world >gpg2test
gpg2 --homedir gpghome --batch --no-comments --no-emit-version \
--output gpg2test.gpg2 --sign gpg2test
gpg2 --homedir gpghome --batch --no-comments --no-emit-version \
--export-secret-keys >keysecring.gpg2
gpg2 --homedir gpghome --batch --no-comments --no-emit-version \
--export >keypubring.gpg2
To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 pkgsrc/security/netpgpverify/Makefile
cvs rdiff -u -r1.9 -r1.10 pkgsrc/security/netpgpverify/files/Makefile.in
cvs rdiff -u -r0 -r1.1 pkgsrc/security/netpgpverify/files/gpg2test \
pkgsrc/security/netpgpverify/files/gpg2test.gpg2 \
pkgsrc/security/netpgpverify/files/keypubring.gpg2 \
pkgsrc/security/netpgpverify/files/keysecring.gpg2
cvs rdiff -u -r1.31 -r1.32 pkgsrc/security/netpgpverify/files/libverify.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59823 CVS commit: [pkgsrc-2025Q4] pkgsrc/security/netpgpverify
Date: Sat, 24 Jan 2026 03:06:29 +0000
Module Name: pkgsrc
Committed By: maya
Date: Sat Jan 24 03:06:29 UTC 2026
Modified Files:
pkgsrc/security/netpgpverify [pkgsrc-2025Q4]: Makefile
pkgsrc/security/netpgpverify/files [pkgsrc-2025Q4]: Makefile.in
libverify.c
Added Files:
pkgsrc/security/netpgpverify/files [pkgsrc-2025Q4]: gpg2test
gpg2test.gpg2 keypubring.gpg2 keysecring.gpg2
Log Message:
Pullup ticket #7047 - requested by wiz
security/netpgpverify: Bug fix
Revisions pulled up:
- security/netpgpverify/Makefile 1.23
- security/netpgpverify/files/Makefile.in 1.10
- security/netpgpverify/files/gpg2test 1.1
- security/netpgpverify/files/gpg2test.gpg2 1.1
- security/netpgpverify/files/keypubring.gpg2 1.1
- security/netpgpverify/files/keysecring.gpg2 1.1
- security/netpgpverify/files/libverify.c 1.32
---
Module Name: pkgsrc
Committed By: riastradh
Date: Sun Jan 4 06:19:40 UTC 2026
Modified Files:
pkgsrc/security/netpgpverify: Makefile
pkgsrc/security/netpgpverify/files: Makefile.in libverify.c
Added Files:
pkgsrc/security/netpgpverify/files: gpg2test gpg2test.gpg2
keypubring.gpg2 keysecring.gpg2
Log Message:
security/netpgpverify: Handle issuer fingerprint subpackets.
This is an extremely dodgy stop-gap measure to verify signatures
produced by gpg2. It does nothing to address pervasive problems in
netpgpverify, like PR security/57449 or PR bin/59823, or even more
narrowly scoped problems with using keyids instead of fingerprints.
I'm a little reluctant to even commit this stop-gap because the
problems are so bad, and a band-aid won't fix a spurting carotid.
The symptom is:
> ./netpgpverify -k keypubring.gpg2 gpg2test.gpg2
> Ignoring unusual/reserved signature subpacket 34
> Signature did not match contents -- Signature key id 38fa6a2833ed1efa does not match onepass keyid
Test case generated by:
mkdir -m 0700 gpghome
gpg2 --homedir gpghome --batch --passphrase '' \
--quick-gen-key user@example.com rsa2048 sign never
echo hello world >gpg2test
gpg2 --homedir gpghome --batch --no-comments --no-emit-version \
--output gpg2test.gpg2 --sign gpg2test
gpg2 --homedir gpghome --batch --no-comments --no-emit-version \
--export-secret-keys >keysecring.gpg2
gpg2 --homedir gpghome --batch --no-comments --no-emit-version \
--export >keypubring.gpg2
To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.42.1 pkgsrc/security/netpgpverify/Makefile
cvs rdiff -u -r1.9 -r1.9.42.1 pkgsrc/security/netpgpverify/files/Makefile.in
cvs rdiff -u -r0 -r1.1.2.2 pkgsrc/security/netpgpverify/files/gpg2test \
pkgsrc/security/netpgpverify/files/gpg2test.gpg2 \
pkgsrc/security/netpgpverify/files/keypubring.gpg2 \
pkgsrc/security/netpgpverify/files/keysecring.gpg2
cvs rdiff -u -r1.31 -r1.31.42.1 \
pkgsrc/security/netpgpverify/files/libverify.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.