summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/x_crl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/x_crl.c')
-rw-r--r--src/lib/libcrypto/asn1/x_crl.c164
1 files changed, 87 insertions, 77 deletions
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c
index ea94f026b2..674cca4a1c 100644
--- a/src/lib/libcrypto/asn1/x_crl.c
+++ b/src/lib/libcrypto/asn1/x_crl.c
@@ -5,21 +5,21 @@
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA, 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 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 13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com). 14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 * 15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in 16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed. 17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution 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. 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 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. 21 * in documentation (online or textual) provided with the package.
22 * 22 *
23 * Redistribution and use in source and binary forms, with or without 23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions 24 * modification, are permitted provided that the following conditions
25 * are met: 25 * are met:
@@ -34,10 +34,10 @@
34 * Eric Young (eay@cryptsoft.com)" 34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library 35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-). 36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from 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: 38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 * 40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 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 50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE. 51 * SUCH DAMAGE.
52 * 52 *
53 * The licence and distribution terms for any publically available version or 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 54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
@@ -64,23 +64,23 @@
64#include <openssl/x509v3.h> 64#include <openssl/x509v3.h>
65 65
66static int X509_REVOKED_cmp(const X509_REVOKED * const *a, 66static int X509_REVOKED_cmp(const X509_REVOKED * const *a,
67 const X509_REVOKED * const *b); 67 const X509_REVOKED * const *b);
68static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp); 68static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp);
69 69
70ASN1_SEQUENCE(X509_REVOKED) = { 70ASN1_SEQUENCE(X509_REVOKED) = {
71 ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER), 71 ASN1_SIMPLE(X509_REVOKED, serialNumber, ASN1_INTEGER),
72 ASN1_SIMPLE(X509_REVOKED,revocationDate, ASN1_TIME), 72 ASN1_SIMPLE(X509_REVOKED, revocationDate, ASN1_TIME),
73 ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION) 73 ASN1_SEQUENCE_OF_OPT(X509_REVOKED, extensions, X509_EXTENSION)
74} ASN1_SEQUENCE_END(X509_REVOKED) 74} ASN1_SEQUENCE_END(X509_REVOKED)
75 75
76static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r); 76static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r);
77static int def_crl_lookup(X509_CRL *crl, 77static int def_crl_lookup(X509_CRL *crl, X509_REVOKED **ret,
78 X509_REVOKED **ret, ASN1_INTEGER *serial, X509_NAME *issuer); 78 ASN1_INTEGER *serial, X509_NAME *issuer);
79 79
80static X509_CRL_METHOD int_crl_meth = 80static X509_CRL_METHOD int_crl_meth = {
81{ 81 0,
82 0,
82 0, 83 0,
83 0,0,
84 def_crl_lookup, 84 def_crl_lookup,
85 def_crl_verify 85 def_crl_verify
86}; 86};
@@ -91,18 +91,19 @@ static const X509_CRL_METHOD *default_crl_method = &int_crl_meth;
91 * Since we cache the original encoding the signature wont be affected by 91 * Since we cache the original encoding the signature wont be affected by
92 * reordering of the revoked field. 92 * reordering of the revoked field.
93 */ 93 */
94static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, 94static int
95 void *exarg) 95crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg)
96{ 96{
97 X509_CRL_INFO *a = (X509_CRL_INFO *)*pval; 97 X509_CRL_INFO *a = (X509_CRL_INFO *)*pval;
98 98
99 if(!a || !a->revoked) return 1; 99 if (!a || !a->revoked)
100 switch(operation) { 100 return 1;
101 switch (operation) {
101 /* Just set cmp function here. We don't sort because that 102 /* Just set cmp function here. We don't sort because that
102 * would affect the output of X509_CRL_print(). 103 * would affect the output of X509_CRL_print().
103 */ 104 */
104 case ASN1_OP_D2I_POST: 105 case ASN1_OP_D2I_POST:
105 (void)sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp); 106 (void)sk_X509_REVOKED_set_cmp_func(a->revoked, X509_REVOKED_cmp);
106 break; 107 break;
107 } 108 }
108 return 1; 109 return 1;
@@ -123,9 +124,9 @@ ASN1_SEQUENCE_enc(X509_CRL_INFO, enc, crl_inf_cb) = {
123 * Check for unhandled critical CRL entry extensions. 124 * Check for unhandled critical CRL entry extensions.
124 */ 125 */
125 126
126static int crl_set_issuers(X509_CRL *crl) 127static int
128crl_set_issuers(X509_CRL *crl)
127{ 129{
128
129 int i, j; 130 int i, j;
130 GENERAL_NAMES *gens, *gtmp; 131 GENERAL_NAMES *gens, *gtmp;
131 STACK_OF(X509_REVOKED) *revoked; 132 STACK_OF(X509_REVOKED) *revoked;
@@ -138,9 +139,8 @@ static int crl_set_issuers(X509_CRL *crl)
138 STACK_OF(X509_EXTENSION) *exts; 139 STACK_OF(X509_EXTENSION) *exts;
139 ASN1_ENUMERATED *reason; 140 ASN1_ENUMERATED *reason;
140 X509_EXTENSION *ext; 141 X509_EXTENSION *ext;
141 gtmp = X509_REVOKED_get_ext_d2i(rev, 142 gtmp = X509_REVOKED_get_ext_d2i(rev, NID_certificate_issuer,
142 NID_certificate_issuer, 143 &j, NULL);
143 &j, NULL);
144 if (!gtmp && (j != -1)) { 144 if (!gtmp && (j != -1)) {
145 crl->flags |= EXFLAG_INVALID; 145 crl->flags |= EXFLAG_INVALID;
146 return 1; 146 return 1;
@@ -159,7 +159,7 @@ static int crl_set_issuers(X509_CRL *crl)
159 rev->issuer = gens; 159 rev->issuer = gens;
160 160
161 reason = X509_REVOKED_get_ext_d2i(rev, NID_crl_reason, 161 reason = X509_REVOKED_get_ext_d2i(rev, NID_crl_reason,
162 &j, NULL); 162 &j, NULL);
163 if (!reason && (j != -1)) { 163 if (!reason && (j != -1)) {
164 crl->flags |= EXFLAG_INVALID; 164 crl->flags |= EXFLAG_INVALID;
165 return 1; 165 return 1;
@@ -169,7 +169,7 @@ static int crl_set_issuers(X509_CRL *crl)
169 rev->reason = ASN1_ENUMERATED_get(reason); 169 rev->reason = ASN1_ENUMERATED_get(reason);
170 ASN1_ENUMERATED_free(reason); 170 ASN1_ENUMERATED_free(reason);
171 } else 171 } else
172 rev->reason = CRL_REASON_NONE; 172 rev->reason = CRL_REASON_NONE;
173 173
174 /* Check for critical CRL entry extensions */ 174 /* Check for critical CRL entry extensions */
175 175
@@ -179,32 +179,29 @@ static int crl_set_issuers(X509_CRL *crl)
179 ext = sk_X509_EXTENSION_value(exts, j); 179 ext = sk_X509_EXTENSION_value(exts, j);
180 if (ext->critical > 0) { 180 if (ext->critical > 0) {
181 if (OBJ_obj2nid(ext->object) == 181 if (OBJ_obj2nid(ext->object) ==
182 NID_certificate_issuer) 182 NID_certificate_issuer)
183 continue; 183 continue;
184 crl->flags |= EXFLAG_CRITICAL; 184 crl->flags |= EXFLAG_CRITICAL;
185 break; 185 break;
186 } 186 }
187 } 187 }
188
189
190 } 188 }
191 189
192 return 1; 190 return 1;
193
194} 191}
195 192
196/* The X509_CRL structure needs a bit of customisation. Cache some extensions 193/* The X509_CRL structure needs a bit of customisation. Cache some extensions
197 * and hash of the whole CRL. 194 * and hash of the whole CRL.
198 */ 195 */
199static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, 196static int
200 void *exarg) 197crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg)
201{ 198{
202 X509_CRL *crl = (X509_CRL *)*pval; 199 X509_CRL *crl = (X509_CRL *)*pval;
203 STACK_OF(X509_EXTENSION) *exts; 200 STACK_OF(X509_EXTENSION) *exts;
204 X509_EXTENSION *ext; 201 X509_EXTENSION *ext;
205 int idx; 202 int idx;
206 203
207 switch(operation) { 204 switch (operation) {
208 case ASN1_OP_NEW_POST: 205 case ASN1_OP_NEW_POST:
209 crl->idp = NULL; 206 crl->idp = NULL;
210 crl->akid = NULL; 207 crl->akid = NULL;
@@ -223,23 +220,23 @@ static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
223 X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL); 220 X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL);
224#endif 221#endif
225 crl->idp = X509_CRL_get_ext_d2i(crl, 222 crl->idp = X509_CRL_get_ext_d2i(crl,
226 NID_issuing_distribution_point, NULL, NULL); 223 NID_issuing_distribution_point, NULL, NULL);
227 if (crl->idp) 224 if (crl->idp)
228 setup_idp(crl, crl->idp); 225 setup_idp(crl, crl->idp);
229 226
230 crl->akid = X509_CRL_get_ext_d2i(crl, 227 crl->akid = X509_CRL_get_ext_d2i(crl,
231 NID_authority_key_identifier, NULL, NULL); 228 NID_authority_key_identifier, NULL, NULL);
232 229
233 crl->crl_number = X509_CRL_get_ext_d2i(crl, 230 crl->crl_number = X509_CRL_get_ext_d2i(crl,
234 NID_crl_number, NULL, NULL); 231 NID_crl_number, NULL, NULL);
235 232
236 crl->base_crl_number = X509_CRL_get_ext_d2i(crl, 233 crl->base_crl_number = X509_CRL_get_ext_d2i(crl,
237 NID_delta_crl, NULL, NULL); 234 NID_delta_crl, NULL, NULL);
238 /* Delta CRLs must have CRL number */ 235 /* Delta CRLs must have CRL number */
239 if (crl->base_crl_number && !crl->crl_number) 236 if (crl->base_crl_number && !crl->crl_number)
240 crl->flags |= EXFLAG_INVALID; 237 crl->flags |= EXFLAG_INVALID;
241 238
242 /* See if we have any unhandled critical CRL extensions and 239 /* See if we have any unhandled critical CRL extensions and
243 * indicate this in a flag. We only currently handle IDP so 240 * indicate this in a flag. We only currently handle IDP so
244 * anything else critical sets the flag. 241 * anything else critical sets the flag.
245 * 242 *
@@ -257,15 +254,14 @@ static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
257 crl->flags |= EXFLAG_FRESHEST; 254 crl->flags |= EXFLAG_FRESHEST;
258 if (ext->critical > 0) { 255 if (ext->critical > 0) {
259 /* We handle IDP and deltas */ 256 /* We handle IDP and deltas */
260 if ((nid == NID_issuing_distribution_point) 257 if ((nid == NID_issuing_distribution_point) ||
261 || (nid == NID_delta_crl)) 258 (nid == NID_delta_crl))
262 break;; 259 break;;
263 crl->flags |= EXFLAG_CRITICAL; 260 crl->flags |= EXFLAG_CRITICAL;
264 break; 261 break;
265 } 262 }
266 } 263 }
267 264
268
269 if (!crl_set_issuers(crl)) 265 if (!crl_set_issuers(crl))
270 return 0; 266 return 0;
271 267
@@ -294,9 +290,11 @@ static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
294 290
295/* Convert IDP into a more convenient form */ 291/* Convert IDP into a more convenient form */
296 292
297static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp) 293static void
294setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp)
298{ 295{
299 int idp_only = 0; 296 int idp_only = 0;
297
300 /* Set various flags according to IDP */ 298 /* Set various flags according to IDP */
301 crl->idp_flags |= IDP_PRESENT; 299 crl->idp_flags |= IDP_PRESENT;
302 if (idp->onlyuser > 0) { 300 if (idp->onlyuser > 0) {
@@ -324,7 +322,7 @@ static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp)
324 crl->idp_reasons = idp->onlysomereasons->data[0]; 322 crl->idp_reasons = idp->onlysomereasons->data[0];
325 if (idp->onlysomereasons->length > 1) 323 if (idp->onlysomereasons->length > 1)
326 crl->idp_reasons |= 324 crl->idp_reasons |=
327 (idp->onlysomereasons->data[1] << 8); 325 (idp->onlysomereasons->data[1] << 8);
328 crl->idp_reasons &= CRLDP_ALL_REASONS; 326 crl->idp_reasons &= CRLDP_ALL_REASONS;
329 } 327 }
330 328
@@ -342,60 +340,65 @@ IMPLEMENT_ASN1_FUNCTIONS(X509_CRL_INFO)
342IMPLEMENT_ASN1_FUNCTIONS(X509_CRL) 340IMPLEMENT_ASN1_FUNCTIONS(X509_CRL)
343IMPLEMENT_ASN1_DUP_FUNCTION(X509_CRL) 341IMPLEMENT_ASN1_DUP_FUNCTION(X509_CRL)
344 342
345static int X509_REVOKED_cmp(const X509_REVOKED * const *a, 343static int
346 const X509_REVOKED * const *b) 344X509_REVOKED_cmp(const X509_REVOKED * const *a, const X509_REVOKED * const *b)
347{ 345{
348 return(ASN1_STRING_cmp( 346 return(ASN1_STRING_cmp(
349 (ASN1_STRING *)(*a)->serialNumber, 347 (ASN1_STRING *)(*a)->serialNumber,
350 (ASN1_STRING *)(*b)->serialNumber)); 348 (ASN1_STRING *)(*b)->serialNumber));
351} 349}
352 350
353int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) 351int
352X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev)
354{ 353{
355 X509_CRL_INFO *inf; 354 X509_CRL_INFO *inf;
355
356 inf = crl->crl; 356 inf = crl->crl;
357 if(!inf->revoked) 357 if (!inf->revoked)
358 inf->revoked = sk_X509_REVOKED_new(X509_REVOKED_cmp); 358 inf->revoked = sk_X509_REVOKED_new(X509_REVOKED_cmp);
359 if(!inf->revoked || !sk_X509_REVOKED_push(inf->revoked, rev)) { 359 if (!inf->revoked || !sk_X509_REVOKED_push(inf->revoked, rev)) {
360 ASN1err(ASN1_F_X509_CRL_ADD0_REVOKED, ERR_R_MALLOC_FAILURE); 360 ASN1err(ASN1_F_X509_CRL_ADD0_REVOKED, ERR_R_MALLOC_FAILURE);
361 return 0; 361 return 0;
362} 362 }
363 inf->enc.modified = 1; 363 inf->enc.modified = 1;
364 return 1; 364 return 1;
365} 365}
366 366
367int X509_CRL_verify(X509_CRL *crl, EVP_PKEY *r) 367int
368X509_CRL_verify(X509_CRL *crl, EVP_PKEY *r)
368{ 369{
369 if (crl->meth->crl_verify) 370 if (crl->meth->crl_verify)
370 return crl->meth->crl_verify(crl, r); 371 return crl->meth->crl_verify(crl, r);
371 return 0; 372 return 0;
372} 373}
373 374
374int X509_CRL_get0_by_serial(X509_CRL *crl, 375int
375 X509_REVOKED **ret, ASN1_INTEGER *serial) 376X509_CRL_get0_by_serial(X509_CRL *crl, X509_REVOKED **ret,
377 ASN1_INTEGER *serial)
376{ 378{
377 if (crl->meth->crl_lookup) 379 if (crl->meth->crl_lookup)
378 return crl->meth->crl_lookup(crl, ret, serial, NULL); 380 return crl->meth->crl_lookup(crl, ret, serial, NULL);
379 return 0; 381 return 0;
380} 382}
381 383
382int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x) 384int
385X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x)
383{ 386{
384 if (crl->meth->crl_lookup) 387 if (crl->meth->crl_lookup)
385 return crl->meth->crl_lookup(crl, ret, 388 return crl->meth->crl_lookup(crl, ret,
386 X509_get_serialNumber(x), 389 X509_get_serialNumber(x), X509_get_issuer_name(x));
387 X509_get_issuer_name(x));
388 return 0; 390 return 0;
389} 391}
390 392
391static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r) 393static int
394def_crl_verify(X509_CRL *crl, EVP_PKEY *r)
392{ 395{
393 return(ASN1_item_verify(ASN1_ITEM_rptr(X509_CRL_INFO), 396 return(ASN1_item_verify(ASN1_ITEM_rptr(X509_CRL_INFO),
394 crl->sig_alg, crl->signature,crl->crl,r)); 397 crl->sig_alg, crl->signature, crl->crl, r));
395} 398}
396 399
397static int crl_revoked_issuer_match(X509_CRL *crl, X509_NAME *nm, 400static int
398 X509_REVOKED *rev) 401crl_revoked_issuer_match(X509_CRL *crl, X509_NAME *nm, X509_REVOKED *rev)
399{ 402{
400 int i; 403 int i;
401 404
@@ -421,11 +424,13 @@ static int crl_revoked_issuer_match(X509_CRL *crl, X509_NAME *nm,
421 424
422} 425}
423 426
424static int def_crl_lookup(X509_CRL *crl, 427static int
425 X509_REVOKED **ret, ASN1_INTEGER *serial, X509_NAME *issuer) 428def_crl_lookup(X509_CRL *crl, X509_REVOKED **ret, ASN1_INTEGER *serial,
429 X509_NAME *issuer)
426{ 430{
427 X509_REVOKED rtmp, *rev; 431 X509_REVOKED rtmp, *rev;
428 int idx; 432 int idx;
433
429 rtmp.serialNumber = serial; 434 rtmp.serialNumber = serial;
430 /* Sort revoked into serial number order if not already sorted. 435 /* Sort revoked into serial number order if not already sorted.
431 * Do this under a lock to avoid race condition. 436 * Do this under a lock to avoid race condition.
@@ -436,10 +441,10 @@ static int def_crl_lookup(X509_CRL *crl,
436 CRYPTO_w_unlock(CRYPTO_LOCK_X509_CRL); 441 CRYPTO_w_unlock(CRYPTO_LOCK_X509_CRL);
437 } 442 }
438 idx = sk_X509_REVOKED_find(crl->crl->revoked, &rtmp); 443 idx = sk_X509_REVOKED_find(crl->crl->revoked, &rtmp);
439 if(idx < 0) 444 if (idx < 0)
440 return 0; 445 return 0;
441 /* Need to look for matching name */ 446 /* Need to look for matching name */
442 for(;idx < sk_X509_REVOKED_num(crl->crl->revoked); idx++) { 447 for (; idx < sk_X509_REVOKED_num(crl->crl->revoked); idx++) {
443 rev = sk_X509_REVOKED_value(crl->crl->revoked, idx); 448 rev = sk_X509_REVOKED_value(crl->crl->revoked, idx);
444 if (ASN1_INTEGER_cmp(rev->serialNumber, serial)) 449 if (ASN1_INTEGER_cmp(rev->serialNumber, serial))
445 return 0; 450 return 0;
@@ -454,22 +459,24 @@ static int def_crl_lookup(X509_CRL *crl,
454 return 0; 459 return 0;
455} 460}
456 461
457void X509_CRL_set_default_method(const X509_CRL_METHOD *meth) 462void
463X509_CRL_set_default_method(const X509_CRL_METHOD *meth)
458{ 464{
459 if (meth == NULL) 465 if (meth == NULL)
460 default_crl_method = &int_crl_meth; 466 default_crl_method = &int_crl_meth;
461 else 467 else
462 default_crl_method = meth; 468 default_crl_method = meth;
463} 469}
464 470
465X509_CRL_METHOD *X509_CRL_METHOD_new( 471X509_CRL_METHOD *
466 int (*crl_init)(X509_CRL *crl), 472X509_CRL_METHOD_new(int (*crl_init)(X509_CRL *crl),
467 int (*crl_free)(X509_CRL *crl), 473 int (*crl_free)(X509_CRL *crl),
468 int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret, 474 int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,
469 ASN1_INTEGER *ser, X509_NAME *issuer), 475 ASN1_INTEGER *ser, X509_NAME *issuer),
470 int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk)) 476 int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk))
471{ 477{
472 X509_CRL_METHOD *m; 478 X509_CRL_METHOD *m;
479
473 m = malloc(sizeof(X509_CRL_METHOD)); 480 m = malloc(sizeof(X509_CRL_METHOD));
474 if (!m) 481 if (!m)
475 return NULL; 482 return NULL;
@@ -481,19 +488,22 @@ X509_CRL_METHOD *X509_CRL_METHOD_new(
481 return m; 488 return m;
482} 489}
483 490
484void X509_CRL_METHOD_free(X509_CRL_METHOD *m) 491void
492X509_CRL_METHOD_free(X509_CRL_METHOD *m)
485{ 493{
486 if (!(m->flags & X509_CRL_METHOD_DYNAMIC)) 494 if (!(m->flags & X509_CRL_METHOD_DYNAMIC))
487 return; 495 return;
488 free(m); 496 free(m);
489} 497}
490 498
491void X509_CRL_set_meth_data(X509_CRL *crl, void *dat) 499void
500X509_CRL_set_meth_data(X509_CRL *crl, void *dat)
492{ 501{
493 crl->meth_data = dat; 502 crl->meth_data = dat;
494} 503}
495 504
496void *X509_CRL_get_meth_data(X509_CRL *crl) 505void *
506X509_CRL_get_meth_data(X509_CRL *crl)
497{ 507{
498 return crl->meth_data; 508 return crl->meth_data;
499} 509}