diff options
| author | tb <> | 2024-07-13 15:08:58 +0000 | 
|---|---|---|
| committer | tb <> | 2024-07-13 15:08:58 +0000 | 
| commit | 3a6927c782869fec9a91b17f3757e56538e5d418 (patch) | |
| tree | 9bceb8f53165bf9b9a2232987ecac3565db027df /src/lib/libcrypto/x509/x509_skey.c | |
| parent | 57d2f282cacabe0c53399ec9c933b34696835dd2 (diff) | |
| download | openbsd-3a6927c782869fec9a91b17f3757e56538e5d418.tar.gz openbsd-3a6927c782869fec9a91b17f3757e56538e5d418.tar.bz2 openbsd-3a6927c782869fec9a91b17f3757e56538e5d418.zip  | |
Unify X.509v3 extension methods
Use C99 initializers for all structs (some were forgotten).
Make all the structs static, call them x509v3_ext_* matching NID_*.
Add accessors called x509v3_ext_method_* and use these to implement
X509V3_EXT_get_nid().
This adds consistency and avoids a few contortions like grouping
a few extensions in arrays to save a couple externs.
ok beck jsing
Diffstat (limited to 'src/lib/libcrypto/x509/x509_skey.c')
| -rw-r--r-- | src/lib/libcrypto/x509/x509_skey.c | 10 | 
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_skey.c b/src/lib/libcrypto/x509/x509_skey.c index 245ba51586..d2c90b6f1c 100644 --- a/src/lib/libcrypto/x509/x509_skey.c +++ b/src/lib/libcrypto/x509/x509_skey.c  | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_skey.c,v 1.5 2023/02/16 08:38:17 tb Exp $ */ | 1 | /* $OpenBSD: x509_skey.c,v 1.6 2024/07/13 15:08:58 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 | */ | 
| @@ -67,7 +67,7 @@ | |||
| 67 | static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method, | 67 | static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method, | 
| 68 | X509V3_CTX *ctx, char *str); | 68 | X509V3_CTX *ctx, char *str); | 
| 69 | 69 | ||
| 70 | const X509V3_EXT_METHOD v3_skey_id = { | 70 | static const X509V3_EXT_METHOD x509v3_ext_subject_key_identifier = { | 
| 71 | .ext_nid = NID_subject_key_identifier, | 71 | .ext_nid = NID_subject_key_identifier, | 
| 72 | .ext_flags = 0, | 72 | .ext_flags = 0, | 
| 73 | .it = &ASN1_OCTET_STRING_it, | 73 | .it = &ASN1_OCTET_STRING_it, | 
| @@ -84,6 +84,12 @@ const X509V3_EXT_METHOD v3_skey_id = { | |||
| 84 | .usr_data = NULL, | 84 | .usr_data = NULL, | 
| 85 | }; | 85 | }; | 
| 86 | 86 | ||
| 87 | const X509V3_EXT_METHOD * | ||
| 88 | x509v3_ext_method_subject_key_identifier(void) | ||
| 89 | { | ||
| 90 | return &x509v3_ext_subject_key_identifier; | ||
| 91 | } | ||
| 92 | |||
| 87 | char * | 93 | char * | 
| 88 | i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, const ASN1_OCTET_STRING *oct) | 94 | i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, const ASN1_OCTET_STRING *oct) | 
| 89 | { | 95 | { | 
