summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2023-04-21 06:07:10 +0000
committertb <>2023-04-21 06:07:10 +0000
commitaf98f5cdbc5f574e1562f0b8b599d38cbeb1f6ac (patch)
tree4d803610e410b48b3d018e768095c497a47c0e9d /src/lib
parent80636c1a555b4cf47882282b4398a903ee25812e (diff)
downloadopenbsd-af98f5cdbc5f574e1562f0b8b599d38cbeb1f6ac.tar.gz
openbsd-af98f5cdbc5f574e1562f0b8b599d38cbeb1f6ac.tar.bz2
openbsd-af98f5cdbc5f574e1562f0b8b599d38cbeb1f6ac.zip
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.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/x509/x509_enum.c17
-rw-r--r--src/lib/libcrypto/x509/x509_utl.c18
2 files changed, 18 insertions, 17 deletions
diff --git a/src/lib/libcrypto/x509/x509_enum.c b/src/lib/libcrypto/x509/x509_enum.c
index 7eabab7483..0f3bfea4c7 100644
--- a/src/lib/libcrypto/x509/x509_enum.c
+++ b/src/lib/libcrypto/x509/x509_enum.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_enum.c,v 1.5 2023/04/21 06:00:24 tb Exp $ */ 1/* $OpenBSD: x509_enum.c,v 1.6 2023/04/21 06:07:10 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -92,18 +92,3 @@ const X509V3_EXT_METHOD v3_crl_reason = {
92 .r2i = NULL, 92 .r2i = NULL,
93 .usr_data = crl_reasons, 93 .usr_data = crl_reasons,
94}; 94};
95
96char *
97i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method, const ASN1_ENUMERATED *e)
98{
99 BIT_STRING_BITNAME *enam;
100 long strval;
101
102 strval = ASN1_ENUMERATED_get(e);
103 for (enam = method->usr_data; enam->lname; enam++) {
104 if (strval == enam->bitnum)
105 return strdup(enam->lname);
106 }
107 return i2s_ASN1_ENUMERATED(method, e);
108}
109LCRYPTO_ALIAS(i2s_ASN1_ENUMERATED_TABLE);
diff --git a/src/lib/libcrypto/x509/x509_utl.c b/src/lib/libcrypto/x509/x509_utl.c
index 08151f16d5..6a907ffac9 100644
--- a/src/lib/libcrypto/x509/x509_utl.c
+++ b/src/lib/libcrypto/x509/x509_utl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_utl.c,v 1.7 2023/04/10 14:10:26 tb Exp $ */ 1/* $OpenBSD: x509_utl.c,v 1.8 2023/04/21 06:07:10 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -61,6 +61,7 @@
61#include <stdio.h> 61#include <stdio.h>
62#include <string.h> 62#include <string.h>
63 63
64#include <openssl/asn1.h>
64#include <openssl/bn.h> 65#include <openssl/bn.h>
65#include <openssl/conf.h> 66#include <openssl/conf.h>
66#include <openssl/err.h> 67#include <openssl/err.h>
@@ -205,6 +206,21 @@ i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *method, const ASN1_ENUMERATED *a)
205LCRYPTO_ALIAS(i2s_ASN1_ENUMERATED); 206LCRYPTO_ALIAS(i2s_ASN1_ENUMERATED);
206 207
207char * 208char *
209i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method, const ASN1_ENUMERATED *e)
210{
211 BIT_STRING_BITNAME *enam;
212 long strval;
213
214 strval = ASN1_ENUMERATED_get(e);
215 for (enam = method->usr_data; enam->lname; enam++) {
216 if (strval == enam->bitnum)
217 return strdup(enam->lname);
218 }
219 return i2s_ASN1_ENUMERATED(method, e);
220}
221LCRYPTO_ALIAS(i2s_ASN1_ENUMERATED_TABLE);
222
223char *
208i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a) 224i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a)
209{ 225{
210 BIGNUM *bntmp; 226 BIGNUM *bntmp;