From 4b51fbb124ecef67cb933bb690632d8e64da51e1 Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 21 Apr 2023 06:07:10 +0000 Subject: [PATCH] Move i2s_ASN1_ENUMERATED_TABLE() next to i2s_ASN1_ENUMERATED() These functions probably belong into asn1/ but they definitely don't belong into separate files. --- lib/libcrypto/x509/x509_enum.c | 17 +---------------- lib/libcrypto/x509/x509_utl.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/libcrypto/x509/x509_enum.c b/lib/libcrypto/x509/x509_enum.c index 7eabab74836..0f3bfea4c74 100644 --- a/lib/libcrypto/x509/x509_enum.c +++ b/lib/libcrypto/x509/x509_enum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_enum.c,v 1.5 2023/04/21 06:00:24 tb Exp $ */ +/* $OpenBSD: x509_enum.c,v 1.6 2023/04/21 06:07:10 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -92,18 +92,3 @@ const X509V3_EXT_METHOD v3_crl_reason = { .r2i = NULL, .usr_data = crl_reasons, }; - -char * -i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method, const ASN1_ENUMERATED *e) -{ - BIT_STRING_BITNAME *enam; - long strval; - - strval = ASN1_ENUMERATED_get(e); - for (enam = method->usr_data; enam->lname; enam++) { - if (strval == enam->bitnum) - return strdup(enam->lname); - } - return i2s_ASN1_ENUMERATED(method, e); -} -LCRYPTO_ALIAS(i2s_ASN1_ENUMERATED_TABLE); diff --git a/lib/libcrypto/x509/x509_utl.c b/lib/libcrypto/x509/x509_utl.c index 08151f16d58..6a907ffac9e 100644 --- a/lib/libcrypto/x509/x509_utl.c +++ b/lib/libcrypto/x509/x509_utl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_utl.c,v 1.7 2023/04/10 14:10:26 tb Exp $ */ +/* $OpenBSD: x509_utl.c,v 1.8 2023/04/21 06:07:10 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -61,6 +61,7 @@ #include #include +#include #include #include #include @@ -204,6 +205,21 @@ i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *method, const ASN1_ENUMERATED *a) } LCRYPTO_ALIAS(i2s_ASN1_ENUMERATED); +char * +i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method, const ASN1_ENUMERATED *e) +{ + BIT_STRING_BITNAME *enam; + long strval; + + strval = ASN1_ENUMERATED_get(e); + for (enam = method->usr_data; enam->lname; enam++) { + if (strval == enam->bitnum) + return strdup(enam->lname); + } + return i2s_ASN1_ENUMERATED(method, e); +} +LCRYPTO_ALIAS(i2s_ASN1_ENUMERATED_TABLE); + char * i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a) { -- 2.20.1