Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/pem/pem_all.c |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /* $OpenBSD: pem_all.c,v 1.17 2016/09/04 16:10:38 jsing Exp $ */ | - | ||||||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | - | ||||||
3 | * All rights reserved. | - | ||||||
4 | * | - | ||||||
5 | * This package is an SSL implementation written | - | ||||||
6 | * by Eric Young (eay@cryptsoft.com). | - | ||||||
7 | * The implementation was written so as to conform with Netscapes SSL. | - | ||||||
8 | * | - | ||||||
9 | * This library is free for commercial and non-commercial use as long as | - | ||||||
10 | * the following conditions are aheared to. The following conditions | - | ||||||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | - | ||||||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | - | ||||||
13 | * included with this distribution is covered by the same copyright terms | - | ||||||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | - | ||||||
15 | * | - | ||||||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | - | ||||||
17 | * the code are not to be removed. | - | ||||||
18 | * If this package is used in a product, Eric Young should be given attribution | - | ||||||
19 | * as the author of the parts of the library used. | - | ||||||
20 | * This can be in the form of a textual message at program startup or | - | ||||||
21 | * in documentation (online or textual) provided with the package. | - | ||||||
22 | * | - | ||||||
23 | * Redistribution and use in source and binary forms, with or without | - | ||||||
24 | * modification, are permitted provided that the following conditions | - | ||||||
25 | * are met: | - | ||||||
26 | * 1. Redistributions of source code must retain the copyright | - | ||||||
27 | * notice, this list of conditions and the following disclaimer. | - | ||||||
28 | * 2. Redistributions in binary form must reproduce the above copyright | - | ||||||
29 | * notice, this list of conditions and the following disclaimer in the | - | ||||||
30 | * documentation and/or other materials provided with the distribution. | - | ||||||
31 | * 3. All advertising materials mentioning features or use of this software | - | ||||||
32 | * must display the following acknowledgement: | - | ||||||
33 | * "This product includes cryptographic software written by | - | ||||||
34 | * Eric Young (eay@cryptsoft.com)" | - | ||||||
35 | * The word 'cryptographic' can be left out if the rouines from the library | - | ||||||
36 | * being used are not cryptographic related :-). | - | ||||||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | - | ||||||
38 | * the apps directory (application code) you must include an acknowledgement: | - | ||||||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | - | ||||||
40 | * | - | ||||||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | - | ||||||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | - | ||||||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | - | ||||||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | - | ||||||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | - | ||||||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | - | ||||||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | - | ||||||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | - | ||||||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | - | ||||||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | - | ||||||
51 | * SUCH DAMAGE. | - | ||||||
52 | * | - | ||||||
53 | * The licence and distribution terms for any publically available version or | - | ||||||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | - | ||||||
55 | * copied and put under another distribution licence | - | ||||||
56 | * [including the GNU Public Licence.] | - | ||||||
57 | */ | - | ||||||
58 | /* ==================================================================== | - | ||||||
59 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | - | ||||||
60 | * | - | ||||||
61 | * Redistribution and use in source and binary forms, with or without | - | ||||||
62 | * modification, are permitted provided that the following conditions | - | ||||||
63 | * are met: | - | ||||||
64 | * | - | ||||||
65 | * 1. Redistributions of source code must retain the above copyright | - | ||||||
66 | * notice, this list of conditions and the following disclaimer. | - | ||||||
67 | * | - | ||||||
68 | * 2. Redistributions in binary form must reproduce the above copyright | - | ||||||
69 | * notice, this list of conditions and the following disclaimer in | - | ||||||
70 | * the documentation and/or other materials provided with the | - | ||||||
71 | * distribution. | - | ||||||
72 | * | - | ||||||
73 | * 3. All advertising materials mentioning features or use of this | - | ||||||
74 | * software must display the following acknowledgment: | - | ||||||
75 | * "This product includes software developed by the OpenSSL Project | - | ||||||
76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | - | ||||||
77 | * | - | ||||||
78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | - | ||||||
79 | * endorse or promote products derived from this software without | - | ||||||
80 | * prior written permission. For written permission, please contact | - | ||||||
81 | * openssl-core@openssl.org. | - | ||||||
82 | * | - | ||||||
83 | * 5. Products derived from this software may not be called "OpenSSL" | - | ||||||
84 | * nor may "OpenSSL" appear in their names without prior written | - | ||||||
85 | * permission of the OpenSSL Project. | - | ||||||
86 | * | - | ||||||
87 | * 6. Redistributions of any form whatsoever must retain the following | - | ||||||
88 | * acknowledgment: | - | ||||||
89 | * "This product includes software developed by the OpenSSL Project | - | ||||||
90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | - | ||||||
91 | * | - | ||||||
92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | - | ||||||
93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | - | ||||||
94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | - | ||||||
95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | - | ||||||
96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | - | ||||||
97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | - | ||||||
98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | ||||||
99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | - | ||||||
100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | - | ||||||
101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | - | ||||||
102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | - | ||||||
103 | * OF THE POSSIBILITY OF SUCH DAMAGE. | - | ||||||
104 | * ==================================================================== | - | ||||||
105 | * | - | ||||||
106 | * This product includes cryptographic software written by Eric Young | - | ||||||
107 | * (eay@cryptsoft.com). This product includes software written by Tim | - | ||||||
108 | * Hudson (tjh@cryptsoft.com). | - | ||||||
109 | * | - | ||||||
110 | */ | - | ||||||
111 | - | |||||||
112 | #include <stdio.h> | - | ||||||
113 | - | |||||||
114 | #include <openssl/opensslconf.h> | - | ||||||
115 | - | |||||||
116 | #include <openssl/bio.h> | - | ||||||
117 | #include <openssl/evp.h> | - | ||||||
118 | #include <openssl/pem.h> | - | ||||||
119 | #include <openssl/pkcs7.h> | - | ||||||
120 | #include <openssl/x509.h> | - | ||||||
121 | - | |||||||
122 | #ifndef OPENSSL_NO_DH | - | ||||||
123 | #include <openssl/dh.h> | - | ||||||
124 | #endif | - | ||||||
125 | #ifndef OPENSSL_NO_DSA | - | ||||||
126 | #include <openssl/dsa.h> | - | ||||||
127 | #endif | - | ||||||
128 | #ifndef OPENSSL_NO_RSA | - | ||||||
129 | #include <openssl/rsa.h> | - | ||||||
130 | #endif | - | ||||||
131 | - | |||||||
132 | #ifndef OPENSSL_NO_RSA | - | ||||||
133 | static RSA *pkey_get_rsa(EVP_PKEY *key, RSA **rsa); | - | ||||||
134 | #endif | - | ||||||
135 | #ifndef OPENSSL_NO_DSA | - | ||||||
136 | static DSA *pkey_get_dsa(EVP_PKEY *key, DSA **dsa); | - | ||||||
137 | #endif | - | ||||||
138 | - | |||||||
139 | #ifndef OPENSSL_NO_EC | - | ||||||
140 | static EC_KEY *pkey_get_eckey(EVP_PKEY *key, EC_KEY **eckey); | - | ||||||
141 | #endif | - | ||||||
142 | - | |||||||
143 | - | |||||||
144 | X509_REQ * | - | ||||||
145 | PEM_read_X509_REQ(FILE *fp, X509_REQ **x, pem_password_cb *cb, void *u) | - | ||||||
146 | { | - | ||||||
147 | return PEM_ASN1_read((d2i_of_void *)d2i_X509_REQ, PEM_STRING_X509_REQ, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_X509_REQ, "CERTIFICATE REQUEST", fp, (void **)x, cb, u); | 0 | ||||||
148 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_X509_REQ, "CERTIFICATE REQUEST", fp, (void **)x, cb, u); | 0 | ||||||
149 | } | - | ||||||
150 | - | |||||||
151 | int | - | ||||||
152 | PEM_write_X509_REQ(FILE *fp, X509_REQ *x) | - | ||||||
153 | { | - | ||||||
154 | return PEM_ASN1_write((i2d_of_void *)i2d_X509_REQ, PEM_STRING_X509_REQ, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_X509_REQ, "CERTIFICATE REQUEST", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
155 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_X509_REQ, "CERTIFICATE REQUEST", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
156 | } | - | ||||||
157 | - | |||||||
158 | X509_REQ * | - | ||||||
159 | PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x, pem_password_cb *cb, void *u) | - | ||||||
160 | { | - | ||||||
161 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_X509_REQ, PEM_STRING_X509_REQ, bp, never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_X509_REQ, "CERTIFICATE REQUEST", bp, (void **)x, cb, u); | 0 | ||||||
162 | (void **)x, cb, u); never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_X509_REQ, "CERTIFICATE REQUEST", bp, (void **)x, cb, u); | 0 | ||||||
163 | } | - | ||||||
164 | - | |||||||
165 | int | - | ||||||
166 | PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x) | - | ||||||
167 | { | - | ||||||
168 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_REQ, PEM_STRING_X509_REQ, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_REQ, "CERTIFICATE REQUEST", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
169 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_REQ, "CERTIFICATE REQUEST", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
170 | } | - | ||||||
171 | - | |||||||
172 | int | - | ||||||
173 | PEM_write_X509_REQ_NEW(FILE *fp, X509_REQ *x) | - | ||||||
174 | { | - | ||||||
175 | return PEM_ASN1_write((i2d_of_void *)i2d_X509_REQ, PEM_STRING_X509_REQ_OLD, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_X509_REQ, "NEW CERTIFICATE REQUEST", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
176 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_X509_REQ, "NEW CERTIFICATE REQUEST", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
177 | } | - | ||||||
178 | - | |||||||
179 | int | - | ||||||
180 | PEM_write_bio_X509_REQ_NEW(BIO *bp, X509_REQ *x) | - | ||||||
181 | { | - | ||||||
182 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_REQ, PEM_STRING_X509_REQ_OLD, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_REQ, "NEW CERTIFICATE REQUEST", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
183 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_REQ, "NEW CERTIFICATE REQUEST", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
184 | } | - | ||||||
185 | - | |||||||
186 | X509_CRL * | - | ||||||
187 | PEM_read_X509_CRL(FILE *fp, X509_CRL **x, pem_password_cb *cb, void *u) | - | ||||||
188 | { | - | ||||||
189 | return PEM_ASN1_read((d2i_of_void *)d2i_X509_CRL, PEM_STRING_X509_CRL, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_X509_CRL, "X509 CRL", fp, (void **)x, cb, u); | 0 | ||||||
190 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_X509_CRL, "X509 CRL", fp, (void **)x, cb, u); | 0 | ||||||
191 | } | - | ||||||
192 | - | |||||||
193 | int | - | ||||||
194 | PEM_write_X509_CRL(FILE *fp, X509_CRL *x) | - | ||||||
195 | { | - | ||||||
196 | return PEM_ASN1_write((i2d_of_void *)i2d_X509_CRL, PEM_STRING_X509_CRL, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_X509_CRL, "X509 CRL", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
197 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_X509_CRL, "X509 CRL", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
198 | } | - | ||||||
199 | - | |||||||
200 | X509_CRL * | - | ||||||
201 | PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x, pem_password_cb *cb, void *u) | - | ||||||
202 | { | - | ||||||
203 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_X509_CRL, PEM_STRING_X509_CRL, bp, never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_X509_CRL, "X509 CRL", bp, (void **)x, cb, u); | 0 | ||||||
204 | (void **)x, cb, u); never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_X509_CRL, "X509 CRL", bp, (void **)x, cb, u); | 0 | ||||||
205 | } | - | ||||||
206 | - | |||||||
207 | int | - | ||||||
208 | PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x) | - | ||||||
209 | { | - | ||||||
210 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_CRL, PEM_STRING_X509_CRL, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_CRL, "X509 CRL", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
211 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_X509_CRL, "X509 CRL", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
212 | } | - | ||||||
213 | - | |||||||
214 | PKCS7 * | - | ||||||
215 | PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb, void *u) | - | ||||||
216 | { | - | ||||||
217 | return PEM_ASN1_read((d2i_of_void *)d2i_PKCS7, PEM_STRING_PKCS7, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_PKCS7, "PKCS7", fp, (void **)x, cb, u); | 0 | ||||||
218 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_PKCS7, "PKCS7", fp, (void **)x, cb, u); | 0 | ||||||
219 | } | - | ||||||
220 | - | |||||||
221 | int | - | ||||||
222 | PEM_write_PKCS7(FILE *fp, PKCS7 *x) | - | ||||||
223 | { | - | ||||||
224 | return PEM_ASN1_write((i2d_of_void *)i2d_PKCS7, PEM_STRING_PKCS7, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_PKCS7, "PKCS7", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
225 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_PKCS7, "PKCS7", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
226 | } | - | ||||||
227 | - | |||||||
228 | PKCS7 * | - | ||||||
229 | PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb, void *u) | - | ||||||
230 | { | - | ||||||
231 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_PKCS7, PEM_STRING_PKCS7, bp, executed 3 times by 1 test: return PEM_ASN1_read_bio((d2i_of_void *)d2i_PKCS7, "PKCS7", bp, (void **)x, cb, u); Executed by:
| 3 | ||||||
232 | (void **)x, cb, u); executed 3 times by 1 test: return PEM_ASN1_read_bio((d2i_of_void *)d2i_PKCS7, "PKCS7", bp, (void **)x, cb, u); Executed by:
| 3 | ||||||
233 | } | - | ||||||
234 | - | |||||||
235 | int | - | ||||||
236 | PEM_write_bio_PKCS7(BIO *bp, PKCS7 *x) | - | ||||||
237 | { | - | ||||||
238 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_PKCS7, PEM_STRING_PKCS7, bp, executed 3 times by 1 test: return PEM_ASN1_write_bio((i2d_of_void *)i2d_PKCS7, "PKCS7", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); Executed by:
| 3 | ||||||
239 | x, NULL, NULL, 0, NULL, NULL); executed 3 times by 1 test: return PEM_ASN1_write_bio((i2d_of_void *)i2d_PKCS7, "PKCS7", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); Executed by:
| 3 | ||||||
240 | } | - | ||||||
241 | - | |||||||
242 | int | - | ||||||
243 | PEM_write_NETSCAPE_CERT_SEQUENCE(FILE *fp, NETSCAPE_CERT_SEQUENCE *x) | - | ||||||
244 | { | - | ||||||
245 | return PEM_ASN1_write((i2d_of_void *)i2d_NETSCAPE_CERT_SEQUENCE, PEM_STRING_X509, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_NETSCAPE_CERT_SEQUENCE, "CERTIFICATE", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
246 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_NETSCAPE_CERT_SEQUENCE, "CERTIFICATE", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
247 | } | - | ||||||
248 | - | |||||||
249 | NETSCAPE_CERT_SEQUENCE * | - | ||||||
250 | PEM_read_NETSCAPE_CERT_SEQUENCE(FILE *fp, NETSCAPE_CERT_SEQUENCE **x, pem_password_cb *cb, void *u) | - | ||||||
251 | { | - | ||||||
252 | return PEM_ASN1_read((d2i_of_void *)d2i_NETSCAPE_CERT_SEQUENCE, PEM_STRING_X509, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_NETSCAPE_CERT_SEQUENCE, "CERTIFICATE", fp, (void **)x, cb, u); | 0 | ||||||
253 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_NETSCAPE_CERT_SEQUENCE, "CERTIFICATE", fp, (void **)x, cb, u); | 0 | ||||||
254 | } | - | ||||||
255 | - | |||||||
256 | NETSCAPE_CERT_SEQUENCE * | - | ||||||
257 | PEM_read_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, NETSCAPE_CERT_SEQUENCE **x, pem_password_cb *cb, void *u) | - | ||||||
258 | { | - | ||||||
259 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_NETSCAPE_CERT_SEQUENCE, PEM_STRING_X509, bp, never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_NETSCAPE_CERT_SEQUENCE, "CERTIFICATE", bp, (void **)x, cb, u); | 0 | ||||||
260 | (void **)x, cb, u); never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_NETSCAPE_CERT_SEQUENCE, "CERTIFICATE", bp, (void **)x, cb, u); | 0 | ||||||
261 | } | - | ||||||
262 | - | |||||||
263 | int | - | ||||||
264 | PEM_write_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, NETSCAPE_CERT_SEQUENCE *x) | - | ||||||
265 | { | - | ||||||
266 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_NETSCAPE_CERT_SEQUENCE, PEM_STRING_X509, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_NETSCAPE_CERT_SEQUENCE, "CERTIFICATE", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
267 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_NETSCAPE_CERT_SEQUENCE, "CERTIFICATE", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
268 | } | - | ||||||
269 | - | |||||||
270 | #ifndef OPENSSL_NO_RSA | - | ||||||
271 | - | |||||||
272 | /* We treat RSA or DSA private keys as a special case. | - | ||||||
273 | * | - | ||||||
274 | * For private keys we read in an EVP_PKEY structure with | - | ||||||
275 | * PEM_read_bio_PrivateKey() and extract the relevant private | - | ||||||
276 | * key: this means can handle "traditional" and PKCS#8 formats | - | ||||||
277 | * transparently. | - | ||||||
278 | */ | - | ||||||
279 | - | |||||||
280 | static RSA * | - | ||||||
281 | pkey_get_rsa(EVP_PKEY *key, RSA **rsa) | - | ||||||
282 | { | - | ||||||
283 | RSA *rtmp; | - | ||||||
284 | - | |||||||
285 | if (!key)
| 0 | ||||||
286 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||
287 | rtmp = EVP_PKEY_get1_RSA(key); | - | ||||||
288 | EVP_PKEY_free(key); | - | ||||||
289 | if (!rtmp)
| 0 | ||||||
290 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||
291 | if (rsa) {
| 0 | ||||||
292 | RSA_free(*rsa); | - | ||||||
293 | *rsa = rtmp; | - | ||||||
294 | } never executed: end of block | 0 | ||||||
295 | return rtmp; never executed: return rtmp; | 0 | ||||||
296 | } | - | ||||||
297 | - | |||||||
298 | RSA * | - | ||||||
299 | PEM_read_RSAPrivateKey(FILE *fp, RSA **rsa, pem_password_cb *cb, void *u) | - | ||||||
300 | { | - | ||||||
301 | EVP_PKEY *pktmp; | - | ||||||
302 | - | |||||||
303 | pktmp = PEM_read_PrivateKey(fp, NULL, cb, u); | - | ||||||
304 | return pkey_get_rsa(pktmp, rsa); never executed: return pkey_get_rsa(pktmp, rsa); | 0 | ||||||
305 | } | - | ||||||
306 | - | |||||||
307 | int | - | ||||||
308 | PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, | - | ||||||
309 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) | - | ||||||
310 | { | - | ||||||
311 | return PEM_ASN1_write((i2d_of_void *)i2d_RSAPrivateKey, PEM_STRING_RSA, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_RSAPrivateKey, "RSA PRIVATE KEY", fp, x, enc, kstr, klen, cb, u); | 0 | ||||||
312 | x, enc, kstr, klen, cb, u); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_RSAPrivateKey, "RSA PRIVATE KEY", fp, x, enc, kstr, klen, cb, u); | 0 | ||||||
313 | } | - | ||||||
314 | - | |||||||
315 | RSA * | - | ||||||
316 | PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **rsa, pem_password_cb *cb, void *u) | - | ||||||
317 | { | - | ||||||
318 | EVP_PKEY *pktmp; | - | ||||||
319 | - | |||||||
320 | pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u); | - | ||||||
321 | return pkey_get_rsa(pktmp, rsa); never executed: return pkey_get_rsa(pktmp, rsa); | 0 | ||||||
322 | } | - | ||||||
323 | - | |||||||
324 | int | - | ||||||
325 | PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, | - | ||||||
326 | const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, | - | ||||||
327 | void *u) | - | ||||||
328 | { | - | ||||||
329 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSAPrivateKey, PEM_STRING_RSA, bp, executed 1 time by 1 test: return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSAPrivateKey, "RSA PRIVATE KEY", bp, x, enc, kstr, klen, cb, u); Executed by:
| 1 | ||||||
330 | x, enc, kstr, klen, cb, u); executed 1 time by 1 test: return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSAPrivateKey, "RSA PRIVATE KEY", bp, x, enc, kstr, klen, cb, u); Executed by:
| 1 | ||||||
331 | } | - | ||||||
332 | - | |||||||
333 | RSA * | - | ||||||
334 | PEM_read_RSAPublicKey(FILE *fp, RSA **x, pem_password_cb *cb, void *u) | - | ||||||
335 | { | - | ||||||
336 | return PEM_ASN1_read((d2i_of_void *)d2i_RSAPublicKey, PEM_STRING_RSA_PUBLIC, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_RSAPublicKey, "RSA PUBLIC KEY", fp, (void **)x, cb, u); | 0 | ||||||
337 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_RSAPublicKey, "RSA PUBLIC KEY", fp, (void **)x, cb, u); | 0 | ||||||
338 | } | - | ||||||
339 | - | |||||||
340 | int | - | ||||||
341 | PEM_write_RSAPublicKey(FILE *fp, const RSA *x) | - | ||||||
342 | { | - | ||||||
343 | return PEM_ASN1_write((i2d_of_void *)i2d_RSAPublicKey, PEM_STRING_RSA_PUBLIC, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_RSAPublicKey, "RSA PUBLIC KEY", fp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
344 | (void *)x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_RSAPublicKey, "RSA PUBLIC KEY", fp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
345 | } | - | ||||||
346 | - | |||||||
347 | RSA * | - | ||||||
348 | PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x, pem_password_cb *cb, void *u) | - | ||||||
349 | { | - | ||||||
350 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_RSAPublicKey, PEM_STRING_RSA_PUBLIC, bp, never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_RSAPublicKey, "RSA PUBLIC KEY", bp, (void **)x, cb, u); | 0 | ||||||
351 | (void **)x, cb, u); never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_RSAPublicKey, "RSA PUBLIC KEY", bp, (void **)x, cb, u); | 0 | ||||||
352 | } | - | ||||||
353 | - | |||||||
354 | int | - | ||||||
355 | PEM_write_bio_RSAPublicKey(BIO *bp, const RSA *x) | - | ||||||
356 | { | - | ||||||
357 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSAPublicKey, PEM_STRING_RSA_PUBLIC, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSAPublicKey, "RSA PUBLIC KEY", bp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
358 | (void *)x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSAPublicKey, "RSA PUBLIC KEY", bp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
359 | } | - | ||||||
360 | - | |||||||
361 | RSA * | - | ||||||
362 | PEM_read_RSA_PUBKEY(FILE *fp, RSA **x, pem_password_cb *cb, void *u) | - | ||||||
363 | { | - | ||||||
364 | return PEM_ASN1_read((d2i_of_void *)d2i_RSA_PUBKEY, PEM_STRING_PUBLIC, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_RSA_PUBKEY, "PUBLIC KEY", fp, (void **)x, cb, u); | 0 | ||||||
365 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_RSA_PUBKEY, "PUBLIC KEY", fp, (void **)x, cb, u); | 0 | ||||||
366 | } | - | ||||||
367 | - | |||||||
368 | int | - | ||||||
369 | PEM_write_RSA_PUBKEY(FILE *fp, RSA *x) | - | ||||||
370 | { | - | ||||||
371 | return PEM_ASN1_write((i2d_of_void *)i2d_RSA_PUBKEY, PEM_STRING_PUBLIC, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_RSA_PUBKEY, "PUBLIC KEY", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
372 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_RSA_PUBKEY, "PUBLIC KEY", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
373 | } | - | ||||||
374 | - | |||||||
375 | RSA * | - | ||||||
376 | PEM_read_bio_RSA_PUBKEY(BIO *bp, RSA **x, pem_password_cb *cb, void *u) | - | ||||||
377 | { | - | ||||||
378 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_RSA_PUBKEY, PEM_STRING_PUBLIC, bp, never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_RSA_PUBKEY, "PUBLIC KEY", bp, (void **)x, cb, u); | 0 | ||||||
379 | (void **)x, cb, u); never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_RSA_PUBKEY, "PUBLIC KEY", bp, (void **)x, cb, u); | 0 | ||||||
380 | } | - | ||||||
381 | - | |||||||
382 | int | - | ||||||
383 | PEM_write_bio_RSA_PUBKEY(BIO *bp, RSA *x) | - | ||||||
384 | { | - | ||||||
385 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSA_PUBKEY, PEM_STRING_PUBLIC, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSA_PUBKEY, "PUBLIC KEY", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
386 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSA_PUBKEY, "PUBLIC KEY", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
387 | } | - | ||||||
388 | - | |||||||
389 | #endif | - | ||||||
390 | - | |||||||
391 | #ifndef OPENSSL_NO_DSA | - | ||||||
392 | - | |||||||
393 | static DSA * | - | ||||||
394 | pkey_get_dsa(EVP_PKEY *key, DSA **dsa) | - | ||||||
395 | { | - | ||||||
396 | DSA *dtmp; | - | ||||||
397 | - | |||||||
398 | if (!key)
| 0 | ||||||
399 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||
400 | dtmp = EVP_PKEY_get1_DSA(key); | - | ||||||
401 | EVP_PKEY_free(key); | - | ||||||
402 | if (!dtmp)
| 0 | ||||||
403 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||
404 | if (dsa) {
| 0 | ||||||
405 | DSA_free(*dsa); | - | ||||||
406 | *dsa = dtmp; | - | ||||||
407 | } never executed: end of block | 0 | ||||||
408 | return dtmp; never executed: return dtmp; | 0 | ||||||
409 | } | - | ||||||
410 | - | |||||||
411 | DSA * | - | ||||||
412 | PEM_read_DSAPrivateKey(FILE *fp, DSA **dsa, pem_password_cb *cb, void *u) | - | ||||||
413 | { | - | ||||||
414 | EVP_PKEY *pktmp; | - | ||||||
415 | - | |||||||
416 | pktmp = PEM_read_PrivateKey(fp, NULL, cb, u); | - | ||||||
417 | return pkey_get_dsa(pktmp, dsa); /* will free pktmp */ never executed: return pkey_get_dsa(pktmp, dsa); | 0 | ||||||
418 | } | - | ||||||
419 | - | |||||||
420 | int | - | ||||||
421 | PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, | - | ||||||
422 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) | - | ||||||
423 | { | - | ||||||
424 | return PEM_ASN1_write((i2d_of_void *)i2d_DSAPrivateKey, PEM_STRING_DSA, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_DSAPrivateKey, "DSA PRIVATE KEY", fp, x, enc, kstr, klen, cb, u); | 0 | ||||||
425 | x, enc, kstr, klen, cb, u); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_DSAPrivateKey, "DSA PRIVATE KEY", fp, x, enc, kstr, klen, cb, u); | 0 | ||||||
426 | } | - | ||||||
427 | - | |||||||
428 | DSA * | - | ||||||
429 | PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb, void *u) | - | ||||||
430 | { | - | ||||||
431 | EVP_PKEY *pktmp; | - | ||||||
432 | - | |||||||
433 | pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u); | - | ||||||
434 | return pkey_get_dsa(pktmp, dsa); /* will free pktmp */ never executed: return pkey_get_dsa(pktmp, dsa); | 0 | ||||||
435 | } | - | ||||||
436 | - | |||||||
437 | int | - | ||||||
438 | PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, | - | ||||||
439 | const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, | - | ||||||
440 | void *u) | - | ||||||
441 | { | - | ||||||
442 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAPrivateKey, PEM_STRING_DSA, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAPrivateKey, "DSA PRIVATE KEY", bp, x, enc, kstr, klen, cb, u); | 0 | ||||||
443 | x, enc, kstr, klen, cb, u); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAPrivateKey, "DSA PRIVATE KEY", bp, x, enc, kstr, klen, cb, u); | 0 | ||||||
444 | } | - | ||||||
445 | - | |||||||
446 | DSA * | - | ||||||
447 | PEM_read_DSA_PUBKEY(FILE *fp, DSA **x, pem_password_cb *cb, void *u) | - | ||||||
448 | { | - | ||||||
449 | return PEM_ASN1_read((d2i_of_void *)d2i_DSA_PUBKEY, PEM_STRING_PUBLIC, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_DSA_PUBKEY, "PUBLIC KEY", fp, (void **)x, cb, u); | 0 | ||||||
450 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_DSA_PUBKEY, "PUBLIC KEY", fp, (void **)x, cb, u); | 0 | ||||||
451 | } | - | ||||||
452 | - | |||||||
453 | int | - | ||||||
454 | PEM_write_DSA_PUBKEY(FILE *fp, DSA *x) | - | ||||||
455 | { | - | ||||||
456 | return PEM_ASN1_write((i2d_of_void *)i2d_DSA_PUBKEY, PEM_STRING_PUBLIC, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_DSA_PUBKEY, "PUBLIC KEY", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
457 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_DSA_PUBKEY, "PUBLIC KEY", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
458 | } | - | ||||||
459 | - | |||||||
460 | int | - | ||||||
461 | PEM_write_bio_DSA_PUBKEY(BIO *bp, DSA *x) | - | ||||||
462 | { | - | ||||||
463 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSA_PUBKEY, PEM_STRING_PUBLIC, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSA_PUBKEY, "PUBLIC KEY", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
464 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSA_PUBKEY, "PUBLIC KEY", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
465 | } | - | ||||||
466 | - | |||||||
467 | DSA * | - | ||||||
468 | PEM_read_bio_DSA_PUBKEY(BIO *bp, DSA **x, pem_password_cb *cb, void *u) | - | ||||||
469 | { | - | ||||||
470 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_DSA_PUBKEY, PEM_STRING_PUBLIC, bp, never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_DSA_PUBKEY, "PUBLIC KEY", bp, (void **)x, cb, u); | 0 | ||||||
471 | (void **)x, cb, u); never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_DSA_PUBKEY, "PUBLIC KEY", bp, (void **)x, cb, u); | 0 | ||||||
472 | } | - | ||||||
473 | - | |||||||
474 | DSA * | - | ||||||
475 | PEM_read_DSAparams(FILE *fp, DSA **x, pem_password_cb *cb, void *u) | - | ||||||
476 | { | - | ||||||
477 | return PEM_ASN1_read((d2i_of_void *)d2i_DSAparams, PEM_STRING_DSAPARAMS, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_DSAparams, "DSA PARAMETERS", fp, (void **)x, cb, u); | 0 | ||||||
478 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_DSAparams, "DSA PARAMETERS", fp, (void **)x, cb, u); | 0 | ||||||
479 | } | - | ||||||
480 | - | |||||||
481 | int | - | ||||||
482 | PEM_write_DSAparams(FILE *fp, const DSA *x) | - | ||||||
483 | { | - | ||||||
484 | return PEM_ASN1_write((i2d_of_void *)i2d_DSAparams, PEM_STRING_DSAPARAMS, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_DSAparams, "DSA PARAMETERS", fp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
485 | (void *)x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_DSAparams, "DSA PARAMETERS", fp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
486 | } | - | ||||||
487 | - | |||||||
488 | DSA * | - | ||||||
489 | PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb, void *u) | - | ||||||
490 | { | - | ||||||
491 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_DSAparams, PEM_STRING_DSAPARAMS, bp, never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_DSAparams, "DSA PARAMETERS", bp, (void **)x, cb, u); | 0 | ||||||
492 | (void **)x, cb, u); never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_DSAparams, "DSA PARAMETERS", bp, (void **)x, cb, u); | 0 | ||||||
493 | } | - | ||||||
494 | - | |||||||
495 | int | - | ||||||
496 | PEM_write_bio_DSAparams(BIO *bp, const DSA *x) | - | ||||||
497 | { | - | ||||||
498 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAparams, PEM_STRING_DSAPARAMS, bp, executed 1 time by 1 test: return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAparams, "DSA PARAMETERS", bp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); Executed by:
| 1 | ||||||
499 | (void *)x, NULL, NULL, 0, NULL, NULL); executed 1 time by 1 test: return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAparams, "DSA PARAMETERS", bp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); Executed by:
| 1 | ||||||
500 | } | - | ||||||
501 | - | |||||||
502 | #endif | - | ||||||
503 | - | |||||||
504 | - | |||||||
505 | #ifndef OPENSSL_NO_EC | - | ||||||
506 | static EC_KEY * | - | ||||||
507 | pkey_get_eckey(EVP_PKEY *key, EC_KEY **eckey) | - | ||||||
508 | { | - | ||||||
509 | EC_KEY *dtmp; | - | ||||||
510 | - | |||||||
511 | if (!key)
| 0 | ||||||
512 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||
513 | dtmp = EVP_PKEY_get1_EC_KEY(key); | - | ||||||
514 | EVP_PKEY_free(key); | - | ||||||
515 | if (!dtmp)
| 0 | ||||||
516 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||
517 | if (eckey) {
| 0 | ||||||
518 | EC_KEY_free(*eckey); | - | ||||||
519 | *eckey = dtmp; | - | ||||||
520 | } never executed: end of block | 0 | ||||||
521 | return dtmp; never executed: return dtmp; | 0 | ||||||
522 | } | - | ||||||
523 | - | |||||||
524 | EC_GROUP * | - | ||||||
525 | PEM_read_ECPKParameters(FILE *fp, EC_GROUP **x, pem_password_cb *cb, void *u) | - | ||||||
526 | { | - | ||||||
527 | return PEM_ASN1_read((d2i_of_void *)d2i_ECPKParameters, PEM_STRING_ECPARAMETERS, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_ECPKParameters, "EC PARAMETERS", fp, (void **)x, cb, u); | 0 | ||||||
528 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_ECPKParameters, "EC PARAMETERS", fp, (void **)x, cb, u); | 0 | ||||||
529 | } | - | ||||||
530 | - | |||||||
531 | int | - | ||||||
532 | PEM_write_ECPKParameters(FILE *fp, const EC_GROUP *x) | - | ||||||
533 | { | - | ||||||
534 | return PEM_ASN1_write((i2d_of_void *)i2d_ECPKParameters, PEM_STRING_ECPARAMETERS, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_ECPKParameters, "EC PARAMETERS", fp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
535 | (void *)x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_ECPKParameters, "EC PARAMETERS", fp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
536 | } | - | ||||||
537 | - | |||||||
538 | EC_GROUP * | - | ||||||
539 | PEM_read_bio_ECPKParameters(BIO *bp, EC_GROUP **x, pem_password_cb *cb, void *u) | - | ||||||
540 | { | - | ||||||
541 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_ECPKParameters, PEM_STRING_ECPARAMETERS, bp, never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_ECPKParameters, "EC PARAMETERS", bp, (void **)x, cb, u); | 0 | ||||||
542 | (void **)x, cb, u); never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_ECPKParameters, "EC PARAMETERS", bp, (void **)x, cb, u); | 0 | ||||||
543 | } | - | ||||||
544 | - | |||||||
545 | int | - | ||||||
546 | PEM_write_bio_ECPKParameters(BIO *bp, const EC_GROUP *x) | - | ||||||
547 | { | - | ||||||
548 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_ECPKParameters, PEM_STRING_ECPARAMETERS, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_ECPKParameters, "EC PARAMETERS", bp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
549 | (void *)x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_ECPKParameters, "EC PARAMETERS", bp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
550 | } | - | ||||||
551 | - | |||||||
552 | EC_KEY * | - | ||||||
553 | PEM_read_ECPrivateKey(FILE *fp, EC_KEY **eckey, pem_password_cb *cb, void *u) | - | ||||||
554 | { | - | ||||||
555 | EVP_PKEY *pktmp; | - | ||||||
556 | - | |||||||
557 | pktmp = PEM_read_PrivateKey(fp, NULL, cb, u); | - | ||||||
558 | return pkey_get_eckey(pktmp, eckey); /* will free pktmp */ never executed: return pkey_get_eckey(pktmp, eckey); | 0 | ||||||
559 | } | - | ||||||
560 | - | |||||||
561 | int | - | ||||||
562 | PEM_write_ECPrivateKey(FILE *fp, EC_KEY *x, const EVP_CIPHER *enc, | - | ||||||
563 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) | - | ||||||
564 | { | - | ||||||
565 | return PEM_ASN1_write((i2d_of_void *)i2d_ECPrivateKey, PEM_STRING_ECPRIVATEKEY, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_ECPrivateKey, "EC PRIVATE KEY", fp, x, enc, kstr, klen, cb, u); | 0 | ||||||
566 | x, enc, kstr, klen, cb, u); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_ECPrivateKey, "EC PRIVATE KEY", fp, x, enc, kstr, klen, cb, u); | 0 | ||||||
567 | } | - | ||||||
568 | - | |||||||
569 | EC_KEY * | - | ||||||
570 | PEM_read_bio_ECPrivateKey(BIO *bp, EC_KEY **key, pem_password_cb *cb, void *u) | - | ||||||
571 | { | - | ||||||
572 | EVP_PKEY *pktmp; | - | ||||||
573 | pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u); | - | ||||||
574 | return pkey_get_eckey(pktmp, key); /* will free pktmp */ never executed: return pkey_get_eckey(pktmp, key); | 0 | ||||||
575 | } | - | ||||||
576 | - | |||||||
577 | int | - | ||||||
578 | PEM_write_bio_ECPrivateKey(BIO *bp, EC_KEY *x, | - | ||||||
579 | const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, | - | ||||||
580 | void *u) | - | ||||||
581 | { | - | ||||||
582 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_ECPrivateKey, PEM_STRING_ECPRIVATEKEY, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_ECPrivateKey, "EC PRIVATE KEY", bp, x, enc, kstr, klen, cb, u); | 0 | ||||||
583 | x, enc, kstr, klen, cb, u); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_ECPrivateKey, "EC PRIVATE KEY", bp, x, enc, kstr, klen, cb, u); | 0 | ||||||
584 | } | - | ||||||
585 | - | |||||||
586 | EC_KEY * | - | ||||||
587 | PEM_read_EC_PUBKEY(FILE *fp, EC_KEY **x, pem_password_cb *cb, void *u) | - | ||||||
588 | { | - | ||||||
589 | return PEM_ASN1_read((d2i_of_void *)d2i_EC_PUBKEY, PEM_STRING_PUBLIC, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_EC_PUBKEY, "PUBLIC KEY", fp, (void **)x, cb, u); | 0 | ||||||
590 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_EC_PUBKEY, "PUBLIC KEY", fp, (void **)x, cb, u); | 0 | ||||||
591 | } | - | ||||||
592 | - | |||||||
593 | int | - | ||||||
594 | PEM_write_EC_PUBKEY(FILE *fp, EC_KEY *x) | - | ||||||
595 | { | - | ||||||
596 | return PEM_ASN1_write((i2d_of_void *)i2d_EC_PUBKEY, PEM_STRING_PUBLIC, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_EC_PUBKEY, "PUBLIC KEY", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
597 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_EC_PUBKEY, "PUBLIC KEY", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
598 | } | - | ||||||
599 | - | |||||||
600 | EC_KEY * | - | ||||||
601 | PEM_read_bio_EC_PUBKEY(BIO *bp, EC_KEY **x, pem_password_cb *cb, void *u) | - | ||||||
602 | { | - | ||||||
603 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_EC_PUBKEY, PEM_STRING_PUBLIC, bp, never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_EC_PUBKEY, "PUBLIC KEY", bp, (void **)x, cb, u); | 0 | ||||||
604 | (void **)x, cb, u); never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_EC_PUBKEY, "PUBLIC KEY", bp, (void **)x, cb, u); | 0 | ||||||
605 | } | - | ||||||
606 | - | |||||||
607 | int | - | ||||||
608 | PEM_write_bio_EC_PUBKEY(BIO *bp, EC_KEY *x) | - | ||||||
609 | { | - | ||||||
610 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_EC_PUBKEY, PEM_STRING_PUBLIC, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_EC_PUBKEY, "PUBLIC KEY", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
611 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_EC_PUBKEY, "PUBLIC KEY", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
612 | } | - | ||||||
613 | - | |||||||
614 | #endif | - | ||||||
615 | - | |||||||
616 | #ifndef OPENSSL_NO_DH | - | ||||||
617 | - | |||||||
618 | DH * | - | ||||||
619 | PEM_read_DHparams(FILE *fp, DH **x, pem_password_cb *cb, void *u) | - | ||||||
620 | { | - | ||||||
621 | return PEM_ASN1_read((d2i_of_void *)d2i_DHparams, PEM_STRING_DHPARAMS, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_DHparams, "DH PARAMETERS", fp, (void **)x, cb, u); | 0 | ||||||
622 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_DHparams, "DH PARAMETERS", fp, (void **)x, cb, u); | 0 | ||||||
623 | } | - | ||||||
624 | - | |||||||
625 | int | - | ||||||
626 | PEM_write_DHparams(FILE *fp, const DH *x) | - | ||||||
627 | { | - | ||||||
628 | return PEM_ASN1_write((i2d_of_void *)i2d_DHparams, PEM_STRING_DHPARAMS, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_DHparams, "DH PARAMETERS", fp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
629 | (void *)x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_DHparams, "DH PARAMETERS", fp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
630 | } | - | ||||||
631 | - | |||||||
632 | DH * | - | ||||||
633 | PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u) | - | ||||||
634 | { | - | ||||||
635 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_DHparams, PEM_STRING_DHPARAMS, bp, never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_DHparams, "DH PARAMETERS", bp, (void **)x, cb, u); | 0 | ||||||
636 | (void **)x, cb, u); never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_DHparams, "DH PARAMETERS", bp, (void **)x, cb, u); | 0 | ||||||
637 | } | - | ||||||
638 | - | |||||||
639 | int | - | ||||||
640 | PEM_write_bio_DHparams(BIO *bp, const DH *x) | - | ||||||
641 | { | - | ||||||
642 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_DHparams, PEM_STRING_DHPARAMS, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_DHparams, "DH PARAMETERS", bp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
643 | (void *)x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_DHparams, "DH PARAMETERS", bp, (void *)x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
644 | } | - | ||||||
645 | - | |||||||
646 | #endif | - | ||||||
647 | - | |||||||
648 | EVP_PKEY * | - | ||||||
649 | PEM_read_PUBKEY(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u) | - | ||||||
650 | { | - | ||||||
651 | return PEM_ASN1_read((d2i_of_void *)d2i_PUBKEY, PEM_STRING_PUBLIC, fp, never executed: return PEM_ASN1_read((d2i_of_void *)d2i_PUBKEY, "PUBLIC KEY", fp, (void **)x, cb, u); | 0 | ||||||
652 | (void **)x, cb, u); never executed: return PEM_ASN1_read((d2i_of_void *)d2i_PUBKEY, "PUBLIC KEY", fp, (void **)x, cb, u); | 0 | ||||||
653 | } | - | ||||||
654 | - | |||||||
655 | int | - | ||||||
656 | PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x) | - | ||||||
657 | { | - | ||||||
658 | return PEM_ASN1_write((i2d_of_void *)i2d_PUBKEY, PEM_STRING_PUBLIC, fp, never executed: return PEM_ASN1_write((i2d_of_void *)i2d_PUBKEY, "PUBLIC KEY", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
659 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write((i2d_of_void *)i2d_PUBKEY, "PUBLIC KEY", fp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
660 | } | - | ||||||
661 | - | |||||||
662 | EVP_PKEY * | - | ||||||
663 | PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u) | - | ||||||
664 | { | - | ||||||
665 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_PUBKEY, PEM_STRING_PUBLIC, bp, never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_PUBKEY, "PUBLIC KEY", bp, (void **)x, cb, u); | 0 | ||||||
666 | (void **)x, cb, u); never executed: return PEM_ASN1_read_bio((d2i_of_void *)d2i_PUBKEY, "PUBLIC KEY", bp, (void **)x, cb, u); | 0 | ||||||
667 | } | - | ||||||
668 | - | |||||||
669 | int | - | ||||||
670 | PEM_write_bio_PUBKEY(BIO *bp, EVP_PKEY *x) | - | ||||||
671 | { | - | ||||||
672 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_PUBKEY, PEM_STRING_PUBLIC, bp, never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_PUBKEY, "PUBLIC KEY", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
673 | x, NULL, NULL, 0, NULL, NULL); never executed: return PEM_ASN1_write_bio((i2d_of_void *)i2d_PUBKEY, "PUBLIC KEY", bp, x, ((void *)0) , ((void *)0) , 0, ((void *)0) , ((void *)0) ); | 0 | ||||||
674 | } | - | ||||||
Source code | Switch to Preprocessed file |