diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2021-12-14 17:35:22 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2021-12-14 17:35:22 +0000 |
commit | 21fccdcda6a5af59433905ae9f6a20dacb8e371b (patch) | |
tree | ed7cc63ad0ceee0bce4c7c4ecf78527a549e5f4d /lib/libcrypto/asn1/asn1_par.c | |
parent | c229d3008350fb52ed0141aa12f23feade41e147 (diff) |
Consolidate ASN.1 universal tag type data.
There are currently three different tables in three different files that
contain information about ASN.1 universal class tag types. Range checking
is also implemented in three different places (with different
implementations).
Consolidate all of this into a single table, provide a lookup function that
deals with the range checks and wrappers to deal with specific types.
ok inoguchi@ tb@
Diffstat (limited to 'lib/libcrypto/asn1/asn1_par.c')
-rw-r--r-- | lib/libcrypto/asn1/asn1_par.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/lib/libcrypto/asn1/asn1_par.c b/lib/libcrypto/asn1/asn1_par.c index af948c52678..46049305932 100644 --- a/lib/libcrypto/asn1/asn1_par.c +++ b/lib/libcrypto/asn1/asn1_par.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1_par.c,v 1.29 2021/12/13 17:58:41 tb Exp $ */ +/* $OpenBSD: asn1_par.c,v 1.30 2021/12/14 17:35:21 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -380,25 +380,3 @@ end: *pp = p; return (ret); } - -const char * -ASN1_tag2str(int tag) -{ - static const char * const tag2str[] = { - "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */ - "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */ - "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */ - "<ASN1 14>", "<ASN1 15>", "SEQUENCE", "SET", /* 15-17 */ - "NUMERICSTRING", "PRINTABLESTRING", "T61STRING", /* 18-20 */ - "VIDEOTEXSTRING", "IA5STRING", "UTCTIME", "GENERALIZEDTIME", /* 21-24 */ - "GRAPHICSTRING", "VISIBLESTRING", "GENERALSTRING", /* 25-27 */ - "UNIVERSALSTRING", "<ASN1 29>", "BMPSTRING" /* 28-30 */ - }; - - if ((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED)) - tag &= ~0x100; - - if (tag < 0 || tag > 30) - return "(unknown)"; - return tag2str[tag]; -} |