Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: rpki-client: fix two nid-related warnings
To:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Cc:
tech@openbsd.org
Date:
Tue, 11 Jun 2024 12:23:29 +0200

Download raw body.

Thread
> nid2str() returns a string in the form of "nid %d (%s)" so I think
> we can drop the (NID %d) in these warnx() calls. 

Thanks, I completely forgot that we made this smarter. This should be
better:

Index: mft.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/mft.c,v
diff -u -p -r1.116 mft.c
--- mft.c	24 May 2024 12:57:20 -0000	1.116
+++ mft.c	11 Jun 2024 10:20:26 -0000
@@ -366,9 +366,8 @@ mft_parse_econtent(const char *fn, struc
 
 	if (OBJ_obj2nid(mft_asn1->fileHashAlg) != NID_sha256) {
 		warnx("%s: RFC 6486 section 4.2.1: fileHashAlg: "
-		    "want SHA256 object, have %s (NID %d)", fn,
-		    ASN1_tag2str(OBJ_obj2nid(mft_asn1->fileHashAlg)),
-		    OBJ_obj2nid(mft_asn1->fileHashAlg));
+		    "want SHA256 object, have %s", fn,
+		    nid2str(OBJ_obj2nid(mft_asn1->fileHashAlg)));
 		goto out;
 	}
 
Index: rsc.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/rsc.c,v
diff -u -p -r1.34 rsc.c
--- rsc.c	21 Feb 2024 09:17:06 -0000	1.34
+++ rsc.c	11 Jun 2024 10:21:58 -0000
@@ -253,8 +253,8 @@ rsc_check_digesttype(const char *fn, str
 	}
 
 	if ((nid = OBJ_obj2nid(obj)) != NID_sha256) {
-		warnx("%s: RSC DigestAlgorithmIdentifier: want SHA256, have %s"
-		    " (NID %d)", fn, ASN1_tag2str(nid), nid);
+		warnx("%s: RSC DigestAlgorithmIdentifier: want SHA256, have %s",
+		    fn, nid2str(nid));
 		return 0;
 	}