diff options
| author | tb <> | 2023-04-21 06:07:10 +0000 |
|---|---|---|
| committer | tb <> | 2023-04-21 06:07:10 +0000 |
| commit | d49347f7949b43730d233c712acdf46d92dafb63 (patch) | |
| tree | 4d803610e410b48b3d018e768095c497a47c0e9d | |
| parent | bed353985c301328078078daa32e94bb7391f930 (diff) | |
| download | openbsd-d49347f7949b43730d233c712acdf46d92dafb63.tar.gz openbsd-d49347f7949b43730d233c712acdf46d92dafb63.tar.bz2 openbsd-d49347f7949b43730d233c712acdf46d92dafb63.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.
| -rw-r--r-- | src/lib/libcrypto/x509/x509_enum.c | 17 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509/x509_utl.c | 18 |
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 | |||
| 96 | char * | ||
| 97 | i2s_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 | } | ||
| 109 | LCRYPTO_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) | |||
| 205 | LCRYPTO_ALIAS(i2s_ASN1_ENUMERATED); | 206 | LCRYPTO_ALIAS(i2s_ASN1_ENUMERATED); |
| 206 | 207 | ||
| 207 | char * | 208 | char * |
| 209 | i2s_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 | } | ||
| 221 | LCRYPTO_ALIAS(i2s_ASN1_ENUMERATED_TABLE); | ||
| 222 | |||
| 223 | char * | ||
| 208 | i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a) | 224 | i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a) |
| 209 | { | 225 | { |
| 210 | BIGNUM *bntmp; | 226 | BIGNUM *bntmp; |
