From 1731179d99a5114f9b9915e3a010e72b1f0fbc81 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 11 Jun 2024 10:38:40 +0000 Subject: [PATCH] rpki-client: fix incorrect use of ASN1_tag2str() This goes back to the initial import in mft.c and was then copied to rsc.c. ASN1_tag2str() doesn't take a nid but rather an ASN.1 tag. Use nid2str() instead. ok claudio (who helped me use nid2str() correctly) --- usr.sbin/rpki-client/mft.c | 7 +++---- usr.sbin/rpki-client/rsc.c | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/usr.sbin/rpki-client/mft.c b/usr.sbin/rpki-client/mft.c index 46c57dbf1bf..8fa8f6ad51f 100644 --- a/usr.sbin/rpki-client/mft.c +++ b/usr.sbin/rpki-client/mft.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mft.c,v 1.116 2024/05/24 12:57:20 tb Exp $ */ +/* $OpenBSD: mft.c,v 1.117 2024/06/11 10:38:40 tb Exp $ */ /* * Copyright (c) 2022 Theo Buehler * Copyright (c) 2019 Kristaps Dzonsons @@ -366,9 +366,8 @@ mft_parse_econtent(const char *fn, struct mft *mft, const unsigned char *d, 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; } diff --git a/usr.sbin/rpki-client/rsc.c b/usr.sbin/rpki-client/rsc.c index 19dddde3631..4a849a18892 100644 --- a/usr.sbin/rpki-client/rsc.c +++ b/usr.sbin/rpki-client/rsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsc.c,v 1.34 2024/02/21 09:17:06 tb Exp $ */ +/* $OpenBSD: rsc.c,v 1.35 2024/06/11 10:38:40 tb Exp $ */ /* * Copyright (c) 2022 Theo Buehler * Copyright (c) 2022 Job Snijders @@ -253,8 +253,8 @@ rsc_check_digesttype(const char *fn, struct rsc *rsc, const X509_ALGOR *alg) } 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; } -- 2.20.1