From dd5ec406241e6a3de13e6feaa4331bc7703a2e14 Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Tue, 31 May 2022 18:41:44 +0000 Subject: Remove now unused ASN1_frame() and cms_econtent_version() ok claudio job --- usr.sbin/rpki-client/cms.c | 60 +------------------------------------------ usr.sbin/rpki-client/extern.h | 7 +---- 2 files changed, 2 insertions(+), 65 deletions(-) (limited to 'usr.sbin/rpki-client') diff --git a/usr.sbin/rpki-client/cms.c b/usr.sbin/rpki-client/cms.c index 109f9e5f8e2..ba1127fe1a4 100644 --- a/usr.sbin/rpki-client/cms.c +++ b/usr.sbin/rpki-client/cms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms.c,v 1.19 2022/05/15 16:43:34 tb Exp $ */ +/* $OpenBSD: cms.c,v 1.20 2022/05/31 18:41:43 tb Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -272,61 +272,3 @@ out: return res; } - -/* - * Wrapper around ASN1_get_object() that preserves the current start - * state and returns a more meaningful value. - * Return zero on failure, non-zero on success. - */ -int -ASN1_frame(const char *fn, size_t sz, - const unsigned char **cnt, long *cntsz, int *tag) -{ - int ret, pcls; - - ret = ASN1_get_object(cnt, cntsz, tag, &pcls, sz); - if ((ret & 0x80)) { - cryptowarnx("%s: ASN1_get_object", fn); - return 0; - } - return ASN1_object_size((ret & 0x01) ? 2 : 0, *cntsz, *tag); -} - -/* - * Check the version field in eContent. - * Returns -1 on failure, zero on success. - */ -int -cms_econtent_version(const char *fn, const unsigned char **d, size_t dsz, - long *version) -{ - ASN1_INTEGER *aint = NULL; - long plen; - int ptag, rc = -1; - - if (!ASN1_frame(fn, dsz, d, &plen, &ptag)) - goto out; - if (ptag != 0) { - warnx("%s: eContent version: expected explicit tag [0]", fn); - goto out; - } - - aint = d2i_ASN1_INTEGER(NULL, d, plen); - if (aint == NULL) { - cryptowarnx("%s: eContent version: failed d2i_ASN1_INTEGER", - fn); - goto out; - } - - *version = ASN1_INTEGER_get(aint); - if (*version < 0) { - warnx("%s: eContent version: expected positive integer, got:" - " %ld", fn, *version); - goto out; - } - - rc = 0; -out: - ASN1_INTEGER_free(aint); - return rc; -} diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h index bc29217872e..509b58c8b0c 100644 --- a/usr.sbin/rpki-client/extern.h +++ b/usr.sbin/rpki-client/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.139 2022/05/31 18:33:16 tb Exp $ */ +/* $OpenBSD: extern.h,v 1.140 2022/05/31 18:41:43 tb Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -513,11 +513,6 @@ int valid_rsc(const char *, struct auth *, struct rsc *); unsigned char *cms_parse_validate(X509 **, const char *, const unsigned char *, size_t, const ASN1_OBJECT *, size_t *); -int cms_econtent_version(const char *, const unsigned char **, - size_t, long *); -/* Helper for ASN1 parsing */ -int ASN1_frame(const char *, size_t, - const unsigned char **, long *, int *); /* Work with RFC 3779 IP addresses, prefixes, ranges. */ -- cgit v1.2.3