diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/pkcs12/pkcs12.h | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/src/lib/libcrypto/pkcs12/pkcs12.h b/src/lib/libcrypto/pkcs12/pkcs12.h index 5e61e4086c..ead29fd717 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.12 2014/06/12 15:49:30 deraadt Exp $ */ | 1 | /* $OpenBSD: pkcs12.h,v 1.13 2014/07/08 09:27:21 jsing 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 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -97,27 +97,27 @@ extern "C" { | |||
97 | #define KEY_SIG 0x80 | 97 | #define KEY_SIG 0x80 |
98 | 98 | ||
99 | typedef struct { | 99 | typedef struct { |
100 | X509_SIG *dinfo; | 100 | X509_SIG *dinfo; |
101 | ASN1_OCTET_STRING *salt; | 101 | ASN1_OCTET_STRING *salt; |
102 | ASN1_INTEGER *iter; /* defaults to 1 */ | 102 | ASN1_INTEGER *iter; /* defaults to 1 */ |
103 | } PKCS12_MAC_DATA; | 103 | } PKCS12_MAC_DATA; |
104 | 104 | ||
105 | typedef struct { | 105 | typedef struct { |
106 | ASN1_INTEGER *version; | 106 | ASN1_INTEGER *version; |
107 | PKCS12_MAC_DATA *mac; | 107 | PKCS12_MAC_DATA *mac; |
108 | PKCS7 *authsafes; | 108 | PKCS7 *authsafes; |
109 | } PKCS12; | 109 | } PKCS12; |
110 | 110 | ||
111 | typedef struct { | 111 | typedef struct { |
112 | ASN1_OBJECT *type; | 112 | ASN1_OBJECT *type; |
113 | union { | 113 | union { |
114 | struct pkcs12_bag_st *bag; /* secret, crl and certbag */ | 114 | struct pkcs12_bag_st *bag; /* secret, crl and certbag */ |
115 | struct pkcs8_priv_key_info_st *keybag; /* keybag */ | 115 | struct pkcs8_priv_key_info_st *keybag; /* keybag */ |
116 | X509_SIG *shkeybag; /* shrouded key bag */ | 116 | X509_SIG *shkeybag; /* shrouded key bag */ |
117 | STACK_OF(PKCS12_SAFEBAG) *safes; | 117 | STACK_OF(PKCS12_SAFEBAG) *safes; |
118 | ASN1_TYPE *other; | 118 | ASN1_TYPE *other; |
119 | }value; | 119 | } value; |
120 | STACK_OF(X509_ATTRIBUTE) *attrib; | 120 | STACK_OF(X509_ATTRIBUTE) *attrib; |
121 | } PKCS12_SAFEBAG; | 121 | } PKCS12_SAFEBAG; |
122 | 122 | ||
123 | DECLARE_STACK_OF(PKCS12_SAFEBAG) | 123 | DECLARE_STACK_OF(PKCS12_SAFEBAG) |
@@ -125,14 +125,14 @@ DECLARE_ASN1_SET_OF(PKCS12_SAFEBAG) | |||
125 | DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG) | 125 | DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG) |
126 | 126 | ||
127 | typedef struct pkcs12_bag_st { | 127 | typedef struct pkcs12_bag_st { |
128 | ASN1_OBJECT *type; | 128 | ASN1_OBJECT *type; |
129 | union { | 129 | union { |
130 | ASN1_OCTET_STRING *x509cert; | 130 | ASN1_OCTET_STRING *x509cert; |
131 | ASN1_OCTET_STRING *x509crl; | 131 | ASN1_OCTET_STRING *x509crl; |
132 | ASN1_OCTET_STRING *octet; | 132 | ASN1_OCTET_STRING *octet; |
133 | ASN1_IA5STRING *sdsicert; | 133 | ASN1_IA5STRING *sdsicert; |
134 | ASN1_TYPE *other; /* Secret or other bag */ | 134 | ASN1_TYPE *other; /* Secret or other bag */ |
135 | }value; | 135 | } value; |
136 | } PKCS12_BAGS; | 136 | } PKCS12_BAGS; |
137 | 137 | ||
138 | #define PKCS12_ERROR 0 | 138 | #define PKCS12_ERROR 0 |
@@ -144,7 +144,7 @@ union { | |||
144 | #define M_PKCS12_x509crl2certbag PKCS12_x509crl2certbag | 144 | #define M_PKCS12_x509crl2certbag PKCS12_x509crl2certbag |
145 | 145 | ||
146 | #define M_PKCS12_certbag2x509 PKCS12_certbag2x509 | 146 | #define M_PKCS12_certbag2x509 PKCS12_certbag2x509 |
147 | #define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl | 147 | #define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl |
148 | 148 | ||
149 | #define M_PKCS12_unpack_p7data PKCS12_unpack_p7data | 149 | #define M_PKCS12_unpack_p7data PKCS12_unpack_p7data |
150 | #define M_PKCS12_pack_authsafes PKCS12_pack_authsafes | 150 | #define M_PKCS12_pack_authsafes PKCS12_pack_authsafes |
@@ -172,65 +172,66 @@ PKCS12_SAFEBAG *PKCS12_x509crl2certbag(X509_CRL *crl); | |||
172 | X509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag); | 172 | X509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag); |
173 | X509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag); | 173 | X509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag); |
174 | 174 | ||
175 | PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, int nid1, | 175 | PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, |
176 | int nid2); | 176 | int nid1, int nid2); |
177 | PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8); | 177 | PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8); |
178 | PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass, int passlen); | 178 | PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass, int passlen); |
179 | PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(PKCS12_SAFEBAG *bag, const char *pass, | 179 | PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(PKCS12_SAFEBAG *bag, const char *pass, |
180 | int passlen); | 180 | int passlen); |
181 | X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, | 181 | X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, |
182 | const char *pass, int passlen, | 182 | const char *pass, int passlen, unsigned char *salt, int saltlen, int iter, |
183 | unsigned char *salt, int saltlen, int iter, | 183 | PKCS8_PRIV_KEY_INFO *p8); |
184 | PKCS8_PRIV_KEY_INFO *p8); | ||
185 | PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, | 184 | PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, |
186 | int passlen, unsigned char *salt, | 185 | int passlen, unsigned char *salt, int saltlen, int iter, |
187 | int saltlen, int iter, | 186 | PKCS8_PRIV_KEY_INFO *p8); |
188 | PKCS8_PRIV_KEY_INFO *p8); | ||
189 | PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); | 187 | PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); |
190 | STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); | 188 | STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); |
191 | PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, | 189 | PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, |
192 | unsigned char *salt, int saltlen, int iter, | 190 | unsigned char *salt, int saltlen, int iter, STACK_OF(PKCS12_SAFEBAG) *bags); |
193 | STACK_OF(PKCS12_SAFEBAG) *bags); | 191 | STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, |
194 | STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, int passlen); | 192 | int passlen); |
195 | 193 | ||
196 | int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); | 194 | int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); |
197 | STACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12); | 195 | STACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12); |
198 | 196 | ||
199 | int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen); | 197 | int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, |
198 | int namelen); | ||
200 | int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, | 199 | int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, |
201 | int namelen); | 200 | int namelen); |
202 | int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, | 201 | int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, |
203 | int namelen); | 202 | int namelen); |
204 | int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, const unsigned char *name, | 203 | int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, const unsigned char *name, |
205 | int namelen); | 204 | int namelen); |
206 | int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); | 205 | int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); |
207 | ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid); | 206 | ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid); |
208 | char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); | 207 | char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); |
209 | unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, | 208 | unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, |
210 | int passlen, unsigned char *in, int inlen, | 209 | int passlen, unsigned char *in, int inlen, unsigned char **data, |
211 | unsigned char **data, int *datalen, int en_de); | 210 | int *datalen, int en_de); |
212 | void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it, | 211 | void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it, |
213 | const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf); | 212 | const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf); |
214 | ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it, | 213 | ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, |
215 | const char *pass, int passlen, | 214 | const ASN1_ITEM *it, const char *pass, int passlen, void *obj, int zbuf); |
216 | void *obj, int zbuf); | ||
217 | PKCS12 *PKCS12_init(int mode); | 215 | PKCS12 *PKCS12_init(int mode); |
218 | int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, | 216 | int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, |
219 | int saltlen, int id, int iter, int n, | 217 | int saltlen, int id, int iter, int n, unsigned char *out, |
220 | unsigned char *out, const EVP_MD *md_type); | 218 | const EVP_MD *md_type); |
221 | int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, int saltlen, int id, int iter, int n, unsigned char *out, const EVP_MD *md_type); | 219 | int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, |
220 | int saltlen, int id, int iter, int n, unsigned char *out, | ||
221 | const EVP_MD *md_type); | ||
222 | int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 222 | int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
223 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type, | 223 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type, |
224 | int en_de); | 224 | int en_de); |
225 | int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, | 225 | int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, |
226 | unsigned char *mac, unsigned int *maclen); | 226 | unsigned char *mac, unsigned int *maclen); |
227 | int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); | 227 | int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); |
228 | int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, | 228 | int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, |
229 | unsigned char *salt, int saltlen, int iter, | 229 | unsigned char *salt, int saltlen, int iter, |
230 | const EVP_MD *md_type); | 230 | const EVP_MD *md_type); |
231 | int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, | 231 | int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, |
232 | int saltlen, const EVP_MD *md_type); | 232 | int saltlen, const EVP_MD *md_type); |
233 | unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen); | 233 | unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, |
234 | unsigned char **uni, int *unilen); | ||
234 | char *OPENSSL_uni2asc(unsigned char *uni, int unilen); | 235 | char *OPENSSL_uni2asc(unsigned char *uni, int unilen); |
235 | 236 | ||
236 | DECLARE_ASN1_FUNCTIONS(PKCS12) | 237 | DECLARE_ASN1_FUNCTIONS(PKCS12) |
@@ -243,17 +244,16 @@ DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) | |||
243 | 244 | ||
244 | void PKCS12_PBE_add(void); | 245 | void PKCS12_PBE_add(void); |
245 | int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, | 246 | int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, |
246 | STACK_OF(X509) **ca); | 247 | STACK_OF(X509) **ca); |
247 | PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, | 248 | PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, |
248 | STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter, | 249 | STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter, |
249 | int mac_iter, int keytype); | 250 | int mac_iter, int keytype); |
250 | 251 | ||
251 | PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); | 252 | PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); |
252 | PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, EVP_PKEY *key, | 253 | PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, EVP_PKEY *key, |
253 | int key_usage, int iter, | 254 | int key_usage, int iter, int key_nid, char *pass); |
254 | int key_nid, char *pass); | ||
255 | int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, | 255 | int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, |
256 | int safe_nid, int iter, char *pass); | 256 | int safe_nid, int iter, char *pass); |
257 | PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); | 257 | PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); |
258 | 258 | ||
259 | int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); | 259 | int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); |