| OLD | NEW |
| 1 /* pcy_data.c */ | 1 /* pcy_data.c */ |
| 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 2004. | 3 * project 2004. |
| 4 */ | 4 */ |
| 5 /* ==================================================================== | 5 /* ==================================================================== |
| 6 * Copyright (c) 2004 The OpenSSL Project. All rights reserved. | 6 * Copyright (c) 2004 The OpenSSL Project. All rights reserved. |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 OPENSSL_free(data); | 75 OPENSSL_free(data); |
| 76 } | 76 } |
| 77 | 77 |
| 78 /* Create a data based on an existing policy. If 'id' is NULL use the | 78 /* Create a data based on an existing policy. If 'id' is NULL use the |
| 79 * oid in the policy, otherwise use 'id'. This behaviour covers the two | 79 * oid in the policy, otherwise use 'id'. This behaviour covers the two |
| 80 * types of data in RFC3280: data with from a CertificatePolcies extension | 80 * types of data in RFC3280: data with from a CertificatePolcies extension |
| 81 * and additional data with just the qualifiers of anyPolicy and ID from | 81 * and additional data with just the qualifiers of anyPolicy and ID from |
| 82 * another source. | 82 * another source. |
| 83 */ | 83 */ |
| 84 | 84 |
| 85 X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, ASN1_OBJECT *id, int crit) | 85 X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, |
| 86 » » » » » const ASN1_OBJECT *cid, int crit) |
| 86 { | 87 { |
| 87 X509_POLICY_DATA *ret; | 88 X509_POLICY_DATA *ret; |
| 88 » if (!policy && !id) | 89 » ASN1_OBJECT *id; |
| 90 » if (!policy && !cid) |
| 89 return NULL; | 91 return NULL; |
| 90 » if (id) | 92 » if (cid) |
| 91 { | 93 { |
| 92 » » id = OBJ_dup(id); | 94 » » id = OBJ_dup(cid); |
| 93 if (!id) | 95 if (!id) |
| 94 return NULL; | 96 return NULL; |
| 95 } | 97 } |
| 98 else |
| 99 id = NULL; |
| 96 ret = OPENSSL_malloc(sizeof(X509_POLICY_DATA)); | 100 ret = OPENSSL_malloc(sizeof(X509_POLICY_DATA)); |
| 97 if (!ret) | 101 if (!ret) |
| 98 return NULL; | 102 return NULL; |
| 99 ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); | 103 ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); |
| 100 if (!ret->expected_policy_set) | 104 if (!ret->expected_policy_set) |
| 101 { | 105 { |
| 102 OPENSSL_free(ret); | 106 OPENSSL_free(ret); |
| 103 if (id) | 107 if (id) |
| 104 ASN1_OBJECT_free(id); | 108 ASN1_OBJECT_free(id); |
| 105 return NULL; | 109 return NULL; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 122 { | 126 { |
| 123 ret->qualifier_set = policy->qualifiers; | 127 ret->qualifier_set = policy->qualifiers; |
| 124 policy->qualifiers = NULL; | 128 policy->qualifiers = NULL; |
| 125 } | 129 } |
| 126 else | 130 else |
| 127 ret->qualifier_set = NULL; | 131 ret->qualifier_set = NULL; |
| 128 | 132 |
| 129 return ret; | 133 return ret; |
| 130 } | 134 } |
| 131 | 135 |
| OLD | NEW |