Eneboo - Documentación para desarrolladores
src/libdigidoc/openssl/crypto/x509v3/pcy_int.h
Ir a la documentación de este archivo.
00001 /* pcy_int.h */
00002 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
00003  * project 2004.
00004  */
00005 /* ====================================================================
00006  * Copyright (c) 2004 The OpenSSL Project.  All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer. 
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in
00017  *    the documentation and/or other materials provided with the
00018  *    distribution.
00019  *
00020  * 3. All advertising materials mentioning features or use of this
00021  *    software must display the following acknowledgment:
00022  *    "This product includes software developed by the OpenSSL Project
00023  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
00024  *
00025  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
00026  *    endorse or promote products derived from this software without
00027  *    prior written permission. For written permission, please contact
00028  *    licensing@OpenSSL.org.
00029  *
00030  * 5. Products derived from this software may not be called "OpenSSL"
00031  *    nor may "OpenSSL" appear in their names without prior written
00032  *    permission of the OpenSSL Project.
00033  *
00034  * 6. Redistributions of any form whatsoever must retain the following
00035  *    acknowledgment:
00036  *    "This product includes software developed by the OpenSSL Project
00037  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
00038  *
00039  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
00040  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00041  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00042  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
00043  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00044  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00045  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00046  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00047  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00048  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00049  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00050  * OF THE POSSIBILITY OF SUCH DAMAGE.
00051  * ====================================================================
00052  *
00053  * This product includes cryptographic software written by Eric Young
00054  * (eay@cryptsoft.com).  This product includes software written by Tim
00055  * Hudson (tjh@cryptsoft.com).
00056  *
00057  */
00058 
00059 DECLARE_STACK_OF(X509_POLICY_DATA)
00060 DECLARE_STACK_OF(X509_POLICY_REF)
00061 DECLARE_STACK_OF(X509_POLICY_NODE)
00062 
00063 typedef struct X509_POLICY_DATA_st X509_POLICY_DATA;
00064 typedef struct X509_POLICY_REF_st X509_POLICY_REF;
00065 
00066 /* Internal structures */
00067 
00068 /* This structure and the field names correspond to the Policy 'node' of
00069  * RFC3280. NB this structure contains no pointers to parent or child
00070  * data: X509_POLICY_NODE contains that. This means that the main policy data
00071  * can be kept static and cached with the certificate.
00072  */
00073 
00074 struct X509_POLICY_DATA_st
00075         {
00076         unsigned int flags;
00077         /* Policy OID and qualifiers for this data */
00078         ASN1_OBJECT *valid_policy;
00079         STACK_OF(POLICYQUALINFO) *qualifier_set;
00080         STACK_OF(ASN1_OBJECT) *expected_policy_set;
00081         };
00082 
00083 /* X509_POLICY_DATA flags values */
00084 
00085 /* This flag indicates the structure has been mapped using a policy mapping
00086  * extension. If policy mapping is not active its references get deleted. 
00087  */
00088 
00089 #define POLICY_DATA_FLAG_MAPPED                 0x1
00090 
00091 /* This flag indicates the data doesn't correspond to a policy in Certificate
00092  * Policies: it has been mapped to any policy.
00093  */
00094 
00095 #define POLICY_DATA_FLAG_MAPPED_ANY             0x2
00096 
00097 /* AND with flags to see if any mapping has occurred */
00098 
00099 #define POLICY_DATA_FLAG_MAP_MASK               0x3
00100 
00101 /* qualifiers are shared and shouldn't be freed */
00102 
00103 #define POLICY_DATA_FLAG_SHARED_QUALIFIERS      0x4
00104 
00105 /* Parent node is an extra node and should be freed */
00106 
00107 #define POLICY_DATA_FLAG_EXTRA_NODE             0x8
00108 
00109 /* Corresponding CertificatePolicies is critical */
00110 
00111 #define POLICY_DATA_FLAG_CRITICAL               0x10
00112 
00113 /* This structure is an entry from a table of mapped policies which
00114  * cross reference the policy it refers to.
00115  */
00116 
00117 struct X509_POLICY_REF_st
00118         {
00119         ASN1_OBJECT *subjectDomainPolicy;
00120         const X509_POLICY_DATA *data;
00121         };
00122 
00123 /* This structure is cached with a certificate */
00124 
00125 struct X509_POLICY_CACHE_st {
00126         /* anyPolicy data or NULL if no anyPolicy */
00127         X509_POLICY_DATA *anyPolicy;
00128         /* other policy data */
00129         STACK_OF(X509_POLICY_DATA) *data;
00130         /* If policyMappings extension present a table of mapped policies */
00131         STACK_OF(X509_POLICY_REF) *maps;
00132         /* If InhibitAnyPolicy present this is its value or -1 if absent. */
00133         long any_skip;
00134         /* If policyConstraints and requireExplicitPolicy present this is its
00135          * value or -1 if absent.
00136          */
00137         long explicit_skip;
00138         /* If policyConstraints and policyMapping present this is its
00139          * value or -1 if absent.
00140          */
00141         long map_skip;
00142         };
00143 
00144 /*#define POLICY_CACHE_FLAG_CRITICAL            POLICY_DATA_FLAG_CRITICAL*/
00145 
00146 /* This structure represents the relationship between nodes */
00147 
00148 struct X509_POLICY_NODE_st
00149         {
00150         /* node data this refers to */
00151         const X509_POLICY_DATA *data;
00152         /* Parent node */
00153         X509_POLICY_NODE *parent;
00154         /* Number of child nodes */
00155         int nchild;
00156         };
00157 
00158 struct X509_POLICY_LEVEL_st
00159         {
00160         /* Cert for this level */
00161         X509 *cert;
00162         /* nodes at this level */
00163         STACK_OF(X509_POLICY_NODE) *nodes;
00164         /* anyPolicy node */
00165         X509_POLICY_NODE *anyPolicy;
00166         /* Extra data */
00167         /*STACK_OF(X509_POLICY_DATA) *extra_data;*/
00168         unsigned int flags;
00169         };
00170 
00171 struct X509_POLICY_TREE_st
00172         {
00173         /* This is the tree 'level' data */
00174         X509_POLICY_LEVEL *levels;
00175         int nlevel;
00176         /* Extra policy data when additional nodes (not from the certificate)
00177          * are required.
00178          */
00179         STACK_OF(X509_POLICY_DATA) *extra_data;
00180         /* This is the authority constained policy set */
00181         STACK_OF(X509_POLICY_NODE) *auth_policies;
00182         STACK_OF(X509_POLICY_NODE) *user_policies;
00183         unsigned int flags;
00184         };
00185 
00186 /* Set if anyPolicy present in user policies */
00187 #define POLICY_FLAG_ANY_POLICY          0x2
00188 
00189 /* Useful macros */
00190 
00191 #define node_data_critical(data) (data->flags & POLICY_DATA_FLAG_CRITICAL)
00192 #define node_critical(node) node_data_critical(node->data)
00193 
00194 /* Internal functions */
00195 
00196 X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, ASN1_OBJECT *id,
00197                                                                 int crit);
00198 void policy_data_free(X509_POLICY_DATA *data);
00199 
00200 X509_POLICY_DATA *policy_cache_find_data(const X509_POLICY_CACHE *cache,
00201                                                         const ASN1_OBJECT *id);
00202 int policy_cache_set_mapping(X509 *x, POLICY_MAPPINGS *maps);
00203 
00204 
00205 STACK_OF(X509_POLICY_NODE) *policy_node_cmp_new(void);
00206 
00207 void policy_cache_init(void);
00208 
00209 void policy_cache_free(X509_POLICY_CACHE *cache);
00210 
00211 X509_POLICY_NODE *level_find_node(const X509_POLICY_LEVEL *level,
00212                                         const ASN1_OBJECT *id);
00213 
00214 X509_POLICY_NODE *tree_find_sk(STACK_OF(X509_POLICY_NODE) *sk,
00215                                                 const ASN1_OBJECT *id);
00216 
00217 X509_POLICY_NODE *level_add_node(X509_POLICY_LEVEL *level,
00218                         X509_POLICY_DATA *data,
00219                         X509_POLICY_NODE *parent,
00220                         X509_POLICY_TREE *tree);
00221 void policy_node_free(X509_POLICY_NODE *node);
00222 
00223 const X509_POLICY_CACHE *policy_cache_set(X509 *x);
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'