security/nss/lib/libpkix/include/pkix_results.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rwxr-xr-x

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4 /*
michael@0 5 * This file defines functions associated with the results used
michael@0 6 * by the top-level functions.
michael@0 7 *
michael@0 8 */
michael@0 9
michael@0 10 #ifndef _PKIX_RESULTS_H
michael@0 11 #define _PKIX_RESULTS_H
michael@0 12
michael@0 13 #include "pkixt.h"
michael@0 14
michael@0 15 #ifdef __cplusplus
michael@0 16 extern "C" {
michael@0 17 #endif
michael@0 18
michael@0 19 /* General
michael@0 20 *
michael@0 21 * Please refer to the libpkix Programmer's Guide for detailed information
michael@0 22 * about how to use the libpkix library. Certain key warnings and notices from
michael@0 23 * that document are repeated here for emphasis.
michael@0 24 *
michael@0 25 * All identifiers in this file (and all public identifiers defined in
michael@0 26 * libpkix) begin with "PKIX_". Private identifiers only intended for use
michael@0 27 * within the library begin with "pkix_".
michael@0 28 *
michael@0 29 * A function returns NULL upon success, and a PKIX_Error pointer upon failure.
michael@0 30 *
michael@0 31 * Unless otherwise noted, for all accessor (gettor) functions that return a
michael@0 32 * PKIX_PL_Object pointer, callers should assume that this pointer refers to a
michael@0 33 * shared object. Therefore, the caller should treat this shared object as
michael@0 34 * read-only and should not modify this shared object. When done using the
michael@0 35 * shared object, the caller should release the reference to the object by
michael@0 36 * using the PKIX_PL_Object_DecRef function.
michael@0 37 *
michael@0 38 * While a function is executing, if its arguments (or anything referred to by
michael@0 39 * its arguments) are modified, free'd, or destroyed, the function's behavior
michael@0 40 * is undefined.
michael@0 41 *
michael@0 42 */
michael@0 43 /* PKIX_ValidateResult
michael@0 44 *
michael@0 45 * PKIX_ValidateResult represents the result of a PKIX_ValidateChain call. It
michael@0 46 * consists of the valid policy tree and public key resulting from validation,
michael@0 47 * as well as the trust anchor used for this chain. Once created, a
michael@0 48 * ValidateResult object is immutable.
michael@0 49 */
michael@0 50
michael@0 51 /*
michael@0 52 * FUNCTION: PKIX_ValidateResult_GetPolicyTree
michael@0 53 * DESCRIPTION:
michael@0 54 *
michael@0 55 * Retrieves the PolicyNode component (representing the valid_policy_tree)
michael@0 56 * from the ValidateResult object pointed to by "result" and stores it at
michael@0 57 * "pPolicyTree".
michael@0 58 *
michael@0 59 * PARAMETERS:
michael@0 60 * "result"
michael@0 61 * Address of ValidateResult whose policy tree is to be stored. Must be
michael@0 62 * non-NULL.
michael@0 63 * "pPolicyTree"
michael@0 64 * Address where object pointer will be stored. Must be non-NULL.
michael@0 65 * "plContext"
michael@0 66 * Platform-specific context pointer.
michael@0 67 * THREAD SAFETY:
michael@0 68 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 69 * RETURNS:
michael@0 70 * Returns NULL if the function succeeds.
michael@0 71 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 72 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 73 */
michael@0 74 PKIX_Error *
michael@0 75 PKIX_ValidateResult_GetPolicyTree(
michael@0 76 PKIX_ValidateResult *result,
michael@0 77 PKIX_PolicyNode **pPolicyTree,
michael@0 78 void *plContext);
michael@0 79
michael@0 80 /*
michael@0 81 * FUNCTION: PKIX_ValidateResult_GetPublicKey
michael@0 82 * DESCRIPTION:
michael@0 83 *
michael@0 84 * Retrieves the PublicKey component (representing the valid public_key) of
michael@0 85 * the ValidateResult object pointed to by "result" and stores it at
michael@0 86 * "pPublicKey".
michael@0 87 *
michael@0 88 * PARAMETERS:
michael@0 89 * "result"
michael@0 90 * Address of ValidateResult whose public key is to be stored.
michael@0 91 * Must be non-NULL.
michael@0 92 * "pPublicKey"
michael@0 93 * Address where object pointer will be stored. Must be non-NULL.
michael@0 94 * "plContext"
michael@0 95 * Platform-specific context pointer.
michael@0 96 * THREAD SAFETY:
michael@0 97 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 98 * RETURNS:
michael@0 99 * Returns NULL if the function succeeds.
michael@0 100 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 101 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 102 */
michael@0 103 PKIX_Error *
michael@0 104 PKIX_ValidateResult_GetPublicKey(
michael@0 105 PKIX_ValidateResult *result,
michael@0 106 PKIX_PL_PublicKey **pPublicKey,
michael@0 107 void *plContext);
michael@0 108
michael@0 109 /*
michael@0 110 * FUNCTION: PKIX_ValidateResult_GetTrustAnchor
michael@0 111 * DESCRIPTION:
michael@0 112 *
michael@0 113 * Retrieves the TrustAnchor component (representing the trust anchor used
michael@0 114 * during chain validation) of the ValidateResult object pointed to by
michael@0 115 * "result" and stores it at "pTrustAnchor".
michael@0 116 *
michael@0 117 * PARAMETERS:
michael@0 118 * "result"
michael@0 119 * Address of ValidateResult whose trust anchor is to be stored.
michael@0 120 * Must be non-NULL.
michael@0 121 * "pTrustAnchor"
michael@0 122 * Address where object pointer will be stored. Must be non-NULL.
michael@0 123 * "plContext"
michael@0 124 * Platform-specific context pointer.
michael@0 125 * THREAD SAFETY:
michael@0 126 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 127 * RETURNS:
michael@0 128 * Returns NULL if the function succeeds.
michael@0 129 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 130 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 131 */
michael@0 132 PKIX_Error *
michael@0 133 PKIX_ValidateResult_GetTrustAnchor(
michael@0 134 PKIX_ValidateResult *result,
michael@0 135 PKIX_TrustAnchor **pTrustAnchor,
michael@0 136 void *plContext);
michael@0 137
michael@0 138 /* PKIX_BuildResult
michael@0 139 *
michael@0 140 * PKIX_BuildResult represents the result of a PKIX_BuildChain call. It
michael@0 141 * consists of a ValidateResult object, as well as the built and validated
michael@0 142 * CertChain. Once created, a BuildResult object is immutable.
michael@0 143 */
michael@0 144
michael@0 145 /*
michael@0 146 * FUNCTION: PKIX_BuildResult_GetValidateResult
michael@0 147 * DESCRIPTION:
michael@0 148 *
michael@0 149 * Retrieves the ValidateResult component (representing the build's validate
michael@0 150 * result) of the BuildResult object pointed to by "result" and stores it at
michael@0 151 * "pResult".
michael@0 152 *
michael@0 153 * PARAMETERS:
michael@0 154 * "result"
michael@0 155 * Address of BuildResult whose ValidateResult component is to be stored.
michael@0 156 * Must be non-NULL.
michael@0 157 * "pResult"
michael@0 158 * Address where object pointer will be stored. Must be non-NULL.
michael@0 159 * "plContext"
michael@0 160 * Platform-specific context pointer.
michael@0 161 * THREAD SAFETY:
michael@0 162 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 163 * RETURNS:
michael@0 164 * Returns NULL if the function succeeds.
michael@0 165 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 166 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 167 */
michael@0 168 PKIX_Error *
michael@0 169 PKIX_BuildResult_GetValidateResult(
michael@0 170 PKIX_BuildResult *result,
michael@0 171 PKIX_ValidateResult **pResult,
michael@0 172 void *plContext);
michael@0 173
michael@0 174 /*
michael@0 175 * FUNCTION: PKIX_BuildResult_GetCertChain
michael@0 176 * DESCRIPTION:
michael@0 177 *
michael@0 178 * Retrieves the List of Certs (certChain) component (representing the built
michael@0 179 * and validated CertChain) of the BuildResult object pointed to by "result"
michael@0 180 * and stores it at "pChain".
michael@0 181 *
michael@0 182 * PARAMETERS:
michael@0 183 * "result"
michael@0 184 * Address of BuildResult whose CertChain component is to be stored.
michael@0 185 * Must be non-NULL.
michael@0 186 * "pChain"
michael@0 187 * Address where object pointer will be stored. Must be non-NULL.
michael@0 188 * "plContext"
michael@0 189 * Platform-specific context pointer.
michael@0 190 * THREAD SAFETY:
michael@0 191 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 192 * RETURNS:
michael@0 193 * Returns NULL if the function succeeds.
michael@0 194 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 195 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 196 */
michael@0 197 PKIX_Error *
michael@0 198 PKIX_BuildResult_GetCertChain(
michael@0 199 PKIX_BuildResult *result,
michael@0 200 PKIX_List **pChain,
michael@0 201 void *plContext);
michael@0 202
michael@0 203 /* PKIX_PolicyNode
michael@0 204 *
michael@0 205 * PKIX_PolicyNode represents a node in the policy tree returned in
michael@0 206 * ValidateResult. The policy tree is the same length as the validated
michael@0 207 * certificate chain and the nodes are associated with a particular depth
michael@0 208 * (corresponding to a particular certificate in the chain).
michael@0 209 * PKIX_ValidateResult_GetPolicyTree returns the root node of the valid policy
michael@0 210 * tree. Other nodes can be accessed using the getChildren and getParents
michael@0 211 * functions, and individual elements of a node can be accessed with the
michael@0 212 * appropriate gettors. Once created, a PolicyNode is immutable.
michael@0 213 */
michael@0 214
michael@0 215 /*
michael@0 216 * FUNCTION: PKIX_PolicyNode_GetChildren
michael@0 217 * DESCRIPTION:
michael@0 218 *
michael@0 219 * Retrieves the List of PolicyNodes representing the child nodes of the
michael@0 220 * Policy Node pointed to by "node" and stores it at "pChildren". If "node"
michael@0 221 * has no child nodes, this function stores an empty List at "pChildren".
michael@0 222 *
michael@0 223 * Note that the List returned by this function is immutable.
michael@0 224 *
michael@0 225 * PARAMETERS:
michael@0 226 * "node"
michael@0 227 * Address of PolicyNode whose child nodes are to be stored.
michael@0 228 * Must be non-NULL.
michael@0 229 * "pChildren"
michael@0 230 * Address where object pointer will be stored. Must be non-NULL.
michael@0 231 * "plContext"
michael@0 232 * Platform-specific context pointer.
michael@0 233 * THREAD SAFETY:
michael@0 234 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 235 * RETURNS:
michael@0 236 * Returns NULL if the function succeeds.
michael@0 237 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 238 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 239 */
michael@0 240 PKIX_Error *
michael@0 241 PKIX_PolicyNode_GetChildren(
michael@0 242 PKIX_PolicyNode *node,
michael@0 243 PKIX_List **pChildren, /* list of PKIX_PolicyNode */
michael@0 244 void *plContext);
michael@0 245
michael@0 246 /*
michael@0 247 * FUNCTION: PKIX_PolicyNode_GetParent
michael@0 248 * DESCRIPTION:
michael@0 249 *
michael@0 250 * Retrieves the PolicyNode representing the parent node of the PolicyNode
michael@0 251 * pointed to by "node" and stores it at "pParent". If "node" has no parent
michael@0 252 * node, this function stores NULL at "pParent".
michael@0 253 *
michael@0 254 * PARAMETERS:
michael@0 255 * "node"
michael@0 256 * Address of PolicyNode whose parent node is to be stored.
michael@0 257 * Must be non-NULL.
michael@0 258 * "pParent"
michael@0 259 * Address where object pointer will be stored. Must be non-NULL.
michael@0 260 * "plContext"
michael@0 261 * Platform-specific context pointer.
michael@0 262 * THREAD SAFETY:
michael@0 263 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 264 * RETURNS:
michael@0 265 * Returns NULL if the function succeeds.
michael@0 266 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 267 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 268 */
michael@0 269 PKIX_Error *
michael@0 270 PKIX_PolicyNode_GetParent(
michael@0 271 PKIX_PolicyNode *node,
michael@0 272 PKIX_PolicyNode **pParent,
michael@0 273 void *plContext);
michael@0 274
michael@0 275 /*
michael@0 276 * FUNCTION: PKIX_PolicyNode_GetValidPolicy
michael@0 277 * DESCRIPTION:
michael@0 278 *
michael@0 279 * Retrieves the OID representing the valid policy of the PolicyNode pointed
michael@0 280 * to by "node" and stores it at "pValidPolicy".
michael@0 281 *
michael@0 282 * PARAMETERS:
michael@0 283 * "node"
michael@0 284 * Address of PolicyNode whose valid policy is to be stored.
michael@0 285 * Must be non-NULL.
michael@0 286 * "pValidPolicy"
michael@0 287 * Address where object pointer will be stored. Must be non-NULL.
michael@0 288 * "plContext"
michael@0 289 * Platform-specific context pointer.
michael@0 290 * THREAD SAFETY:
michael@0 291 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 292 * RETURNS:
michael@0 293 * Returns NULL if the function succeeds.
michael@0 294 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 295 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 296 */
michael@0 297 PKIX_Error *
michael@0 298 PKIX_PolicyNode_GetValidPolicy(
michael@0 299 PKIX_PolicyNode *node,
michael@0 300 PKIX_PL_OID **pValidPolicy,
michael@0 301 void *plContext);
michael@0 302
michael@0 303 /*
michael@0 304 * FUNCTION: PKIX_PolicyNode_GetPolicyQualifiers
michael@0 305 * DESCRIPTION:
michael@0 306 *
michael@0 307 * Retrieves the List of CertPolicyQualifiers representing the policy
michael@0 308 * qualifiers associated with the PolicyNode pointed to by "node" and stores
michael@0 309 * it at "pQualifiers". If "node" has no policy qualifiers, this function
michael@0 310 * stores an empty List at "pQualifiers".
michael@0 311 *
michael@0 312 * Note that the List returned by this function is immutable.
michael@0 313 *
michael@0 314 * PARAMETERS:
michael@0 315 * "node"
michael@0 316 * Address of PolicyNode whose policy qualifiers are to be stored.
michael@0 317 * Must be non-NULL.
michael@0 318 * "pQualifiers"
michael@0 319 * Address where object pointer will be stored. Must be non-NULL.
michael@0 320 * "plContext"
michael@0 321 * Platform-specific context pointer.
michael@0 322 * THREAD SAFETY:
michael@0 323 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 324 * RETURNS:
michael@0 325 * Returns NULL if the function succeeds.
michael@0 326 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 327 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 328 */
michael@0 329 PKIX_Error *
michael@0 330 PKIX_PolicyNode_GetPolicyQualifiers(
michael@0 331 PKIX_PolicyNode *node,
michael@0 332 PKIX_List **pQualifiers, /* list of PKIX_PL_CertPolicyQualifier */
michael@0 333 void *plContext);
michael@0 334
michael@0 335 /*
michael@0 336 * FUNCTION: PKIX_PolicyNode_GetExpectedPolicies
michael@0 337 * DESCRIPTION:
michael@0 338 *
michael@0 339 * Retrieves the List of OIDs representing the expected policies associated
michael@0 340 * with the PolicyNode pointed to by "node" and stores it at "pExpPolicies".
michael@0 341 *
michael@0 342 * Note that the List returned by this function is immutable.
michael@0 343 *
michael@0 344 * PARAMETERS:
michael@0 345 * "node"
michael@0 346 * Address of PolicyNode whose expected policies are to be stored.
michael@0 347 * Must be non-NULL.
michael@0 348 * "pExpPolicies"
michael@0 349 * Address where object pointer will be stored. Must be non-NULL.
michael@0 350 * "plContext"
michael@0 351 * Platform-specific context pointer.
michael@0 352 * THREAD SAFETY:
michael@0 353 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 354 * RETURNS:
michael@0 355 * Returns NULL if the function succeeds.
michael@0 356 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 357 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 358 */
michael@0 359 PKIX_Error *
michael@0 360 PKIX_PolicyNode_GetExpectedPolicies(
michael@0 361 PKIX_PolicyNode *node,
michael@0 362 PKIX_List **pExpPolicies, /* list of PKIX_PL_OID */
michael@0 363 void *plContext);
michael@0 364
michael@0 365 /*
michael@0 366 * FUNCTION: PKIX_PolicyNode_IsCritical
michael@0 367 * DESCRIPTION:
michael@0 368 *
michael@0 369 * Checks the criticality field of the PolicyNode pointed to by "node" and
michael@0 370 * stores the Boolean result at "pCritical".
michael@0 371 *
michael@0 372 * PARAMETERS:
michael@0 373 * "node"
michael@0 374 * Address of PolicyNode whose criticality field is examined.
michael@0 375 * Must be non-NULL.
michael@0 376 * "pCritical"
michael@0 377 * Address where Boolean will be stored. Must be non-NULL.
michael@0 378 * "plContext"
michael@0 379 * Platform-specific context pointer.
michael@0 380 * THREAD SAFETY:
michael@0 381 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 382 * RETURNS:
michael@0 383 * Returns NULL if the function succeeds.
michael@0 384 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 385 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 386 */
michael@0 387 PKIX_Error *
michael@0 388 PKIX_PolicyNode_IsCritical(
michael@0 389 PKIX_PolicyNode *node,
michael@0 390 PKIX_Boolean *pCritical,
michael@0 391 void *plContext);
michael@0 392
michael@0 393 /*
michael@0 394 * FUNCTION: PKIX_PolicyNode_GetDepth
michael@0 395 * DESCRIPTION:
michael@0 396 *
michael@0 397 * Retrieves the depth component of the PolicyNode pointed to by "node" and
michael@0 398 * stores it at "pDepth".
michael@0 399 *
michael@0 400 * PARAMETERS:
michael@0 401 * "node"
michael@0 402 * Address of PolicyNode whose depth component is to be stored.
michael@0 403 * Must be non-NULL.
michael@0 404 * "pDepth"
michael@0 405 * Address where PKIX_UInt32 will be stored. Must be non-NULL.
michael@0 406 * "plContext"
michael@0 407 * Platform-specific context pointer.
michael@0 408 * THREAD SAFETY:
michael@0 409 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 410 * RETURNS:
michael@0 411 * Returns NULL if the function succeeds.
michael@0 412 * Returns a Result Error if the function fails in a non-fatal way.
michael@0 413 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 414 */
michael@0 415 PKIX_Error *
michael@0 416 PKIX_PolicyNode_GetDepth(
michael@0 417 PKIX_PolicyNode *node,
michael@0 418 PKIX_UInt32 *pDepth,
michael@0 419 void *plContext);
michael@0 420
michael@0 421 #ifdef __cplusplus
michael@0 422 }
michael@0 423 #endif
michael@0 424
michael@0 425 #endif /* _PKIX_RESULTS_H */

mercurial