Index | Thread | Search

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

Download raw body.

Thread
On Tue, Jun 11, 2024 at 09:41:37AM +0200, Theo Buehler wrote:
> Not sure how much coffee I was lacking when I did this, but clearly
> using ASN1_tag2str() is quite wrong.
> 
> 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 07:38:38 -0000
> @@ -367,7 +367,7 @@ 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)),
> +		    nid2str(OBJ_obj2nid(mft_asn1->fileHashAlg)),
>  		    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 07:38:26 -0000
> @@ -254,7 +254,7 @@ 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);
> +		    " (NID %d)", fn, nid2str(nid), nid);
>  		return 0;
>  	}
>  

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

Apart from that OK claudio@
-- 
:wq Claudio