diff options
Diffstat (limited to 'src/lib/libcrypto/pkcs12/pkcs12.h')
-rw-r--r-- | src/lib/libcrypto/pkcs12/pkcs12.h | 71 |
1 files changed, 7 insertions, 64 deletions
diff --git a/src/lib/libcrypto/pkcs12/pkcs12.h b/src/lib/libcrypto/pkcs12/pkcs12.h index a40659fcf3..44dbb38153 100644 --- a/src/lib/libcrypto/pkcs12/pkcs12.h +++ b/src/lib/libcrypto/pkcs12/pkcs12.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkcs12.h,v 1.26 2022/08/03 20:16:06 tb Exp $ */ | 1 | /* $OpenBSD: pkcs12.h,v 1.27 2022/09/11 17:30:13 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 | */ |
@@ -96,43 +96,16 @@ extern "C" { | |||
96 | #define KEY_EX 0x10 | 96 | #define KEY_EX 0x10 |
97 | #define KEY_SIG 0x80 | 97 | #define KEY_SIG 0x80 |
98 | 98 | ||
99 | typedef struct { | 99 | typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA; |
100 | X509_SIG *dinfo; | 100 | |
101 | ASN1_OCTET_STRING *salt; | 101 | typedef struct PKCS12_st PKCS12; |
102 | ASN1_INTEGER *iter; /* defaults to 1 */ | 102 | |
103 | } PKCS12_MAC_DATA; | 103 | typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG; |
104 | |||
105 | typedef struct { | ||
106 | ASN1_INTEGER *version; | ||
107 | PKCS12_MAC_DATA *mac; | ||
108 | PKCS7 *authsafes; | ||
109 | } PKCS12; | ||
110 | |||
111 | typedef struct { | ||
112 | ASN1_OBJECT *type; | ||
113 | union { | ||
114 | struct pkcs12_bag_st *bag; /* secret, crl and certbag */ | ||
115 | struct pkcs8_priv_key_info_st *keybag; /* keybag */ | ||
116 | X509_SIG *shkeybag; /* shrouded key bag */ | ||
117 | STACK_OF(PKCS12_SAFEBAG) *safes; | ||
118 | ASN1_TYPE *other; | ||
119 | } value; | ||
120 | STACK_OF(X509_ATTRIBUTE) *attrib; | ||
121 | } PKCS12_SAFEBAG; | ||
122 | 104 | ||
123 | DECLARE_STACK_OF(PKCS12_SAFEBAG) | 105 | DECLARE_STACK_OF(PKCS12_SAFEBAG) |
124 | DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG) | 106 | DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG) |
125 | 107 | ||
126 | typedef struct pkcs12_bag_st { | 108 | typedef struct pkcs12_bag_st PKCS12_BAGS; |
127 | ASN1_OBJECT *type; | ||
128 | union { | ||
129 | ASN1_OCTET_STRING *x509cert; | ||
130 | ASN1_OCTET_STRING *x509crl; | ||
131 | ASN1_OCTET_STRING *octet; | ||
132 | ASN1_IA5STRING *sdsicert; | ||
133 | ASN1_TYPE *other; /* Secret or other bag */ | ||
134 | } value; | ||
135 | } PKCS12_BAGS; | ||
136 | 109 | ||
137 | #define PKCS12_ERROR 0 | 110 | #define PKCS12_ERROR 0 |
138 | #define PKCS12_OK 1 | 111 | #define PKCS12_OK 1 |
@@ -155,16 +128,8 @@ typedef struct pkcs12_bag_st { | |||
155 | #define M_PKCS12_decrypt_skey PKCS12_decrypt_skey | 128 | #define M_PKCS12_decrypt_skey PKCS12_decrypt_skey |
156 | #define M_PKCS8_decrypt PKCS8_decrypt | 129 | #define M_PKCS8_decrypt PKCS8_decrypt |
157 | 130 | ||
158 | #if !defined(LIBRESSL_NEXT_API) | ||
159 | #define M_PKCS12_bag_type(bg) OBJ_obj2nid((bg)->type) | ||
160 | #define M_PKCS12_cert_bag_type(bg) OBJ_obj2nid((bg)->value.bag->type) | ||
161 | #define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type | ||
162 | #endif | ||
163 | |||
164 | #endif /* !LIBRESSL_INTERNAL */ | 131 | #endif /* !LIBRESSL_INTERNAL */ |
165 | 132 | ||
166 | #if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_INTERNAL) | ||
167 | |||
168 | #define M_PKCS12_bag_type PKCS12_bag_type | 133 | #define M_PKCS12_bag_type PKCS12_bag_type |
169 | #define M_PKCS12_cert_bag_type PKCS12_cert_bag_type | 134 | #define M_PKCS12_cert_bag_type PKCS12_cert_bag_type |
170 | #define M_PKCS12_crl_bag_type PKCS12_cert_bag_type | 135 | #define M_PKCS12_crl_bag_type PKCS12_cert_bag_type |
@@ -210,28 +175,6 @@ const STACK_OF(PKCS12_SAFEBAG) * | |||
210 | PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag); | 175 | PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag); |
211 | const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag); | 176 | const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag); |
212 | 177 | ||
213 | #else /* !LIBRESSL_NEXT_API && !LIBRESSL_INTERNAL*/ | ||
214 | |||
215 | #define PKCS12_get_attr(bag, attr_nid) \ | ||
216 | PKCS12_get_attr_gen(bag->attrib, attr_nid) | ||
217 | |||
218 | #define PKCS8_get_attr(p8, attr_nid) \ | ||
219 | PKCS12_get_attr_gen(p8->attributes, attr_nid) | ||
220 | |||
221 | #define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0) | ||
222 | |||
223 | PKCS12_SAFEBAG *PKCS12_x5092certbag(X509 *x509); | ||
224 | PKCS12_SAFEBAG *PKCS12_x509crl2certbag(X509_CRL *crl); | ||
225 | X509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag); | ||
226 | X509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag); | ||
227 | |||
228 | PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8); | ||
229 | PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, | ||
230 | int passlen, unsigned char *salt, int saltlen, int iter, | ||
231 | PKCS8_PRIV_KEY_INFO *p8); | ||
232 | |||
233 | #endif /* !LIBRESSL_NEXT_API && !LIBRESSL_INTERNAL */ | ||
234 | |||
235 | PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, | 178 | PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, |
236 | int nid1, int nid2); | 179 | int nid1, int nid2); |
237 | PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass, | 180 | PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass, |