security/nss/lib/libpkix/include/pkix_revchecker.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 PKIX_RevocationChecker
michael@0 6 * type.
michael@0 7 *
michael@0 8 */
michael@0 9
michael@0 10 #ifndef _PKIX_REVCHECKER_H
michael@0 11 #define _PKIX_REVCHECKER_H
michael@0 12
michael@0 13 #include "pkixt.h"
michael@0 14 #include "pkix_pl_pki.h"
michael@0 15
michael@0 16 #ifdef __cplusplus
michael@0 17 extern "C" {
michael@0 18 #endif
michael@0 19
michael@0 20 /* General
michael@0 21 *
michael@0 22 * Please refer to the libpkix Programmer's Guide for detailed information
michael@0 23 * about how to use the libpkix library. Certain key warnings and notices from
michael@0 24 * that document are repeated here for emphasis.
michael@0 25 *
michael@0 26 * All identifiers in this file (and all public identifiers defined in
michael@0 27 * libpkix) begin with "PKIX_". Private identifiers only intended for use
michael@0 28 * within the library begin with "pkix_".
michael@0 29 *
michael@0 30 * A function returns NULL upon success, and a PKIX_Error pointer upon failure.
michael@0 31 *
michael@0 32 * Unless otherwise noted, for all accessor (gettor) functions that return a
michael@0 33 * PKIX_PL_Object pointer, callers should assume that this pointer refers to a
michael@0 34 * shared object. Therefore, the caller should treat this shared object as
michael@0 35 * read-only and should not modify this shared object. When done using the
michael@0 36 * shared object, the caller should release the reference to the object by
michael@0 37 * using the PKIX_PL_Object_DecRef function.
michael@0 38 *
michael@0 39 * While a function is executing, if its arguments (or anything referred to by
michael@0 40 * its arguments) are modified, free'd, or destroyed, the function's behavior
michael@0 41 * is undefined.
michael@0 42 *
michael@0 43 */
michael@0 44
michael@0 45 /* PKIX_RevocationChecker
michael@0 46 *
michael@0 47 * PKIX_RevocationChecker provides a standard way of revocation checking.
michael@0 48 * Caller should configure two set of tests(represented at lists of
michael@0 49 * RevocationMethod objects) to be performed on the leaf and on the rest of
michael@0 50 * the chain certificates.
michael@0 51 *
michael@0 52 * PKIX_RevocationMethods provide a standard way for the caller to insert
michael@0 53 * their own custom revocation checks to verify the revocation status of
michael@0 54 * certificates. This may be useful in many scenarios, including when the
michael@0 55 * caller wishes to use their own revocation checking mechanism instead of (or
michael@0 56 * in addition to) the default revocation checking mechanism provided by
michael@0 57 * libpkix, which uses CRLs and OCSP.
michael@0 58 *
michael@0 59 * Once the caller has created the RevocationMethod object(s), the caller
michael@0 60 * then specifies the RevocationMethod object(s) in a RevocationCheck object
michael@0 61 * and sets it into a ProcessingParams.
michael@0 62 */
michael@0 63
michael@0 64 /*
michael@0 65 * FUNCTION: PKIX_RevocationChecker_Create
michael@0 66 * DESCRIPTION:
michael@0 67 *
michael@0 68 * Creates revocation checker object with a given flags.
michael@0 69 *
michael@0 70 * PARAMETERS:
michael@0 71 * "revDate"
michael@0 72 * Revocation will be checked at this date. Current date is taken if the
michael@0 73 * parameter is not specified.
michael@0 74 * "leafMethodListFlags"
michael@0 75 * Defines a set of method independent flags that will be used to check
michael@0 76 * revocation of the leaf cert in the chain.
michael@0 77 * "chainMethodListFlags"
michael@0 78 * Defines a set of method independent flags that will be used to check
michael@0 79 * revocation of the remaining certs in the chain.
michael@0 80 * "pChecker"
michael@0 81 * The return address of created checker.
michael@0 82 * "plContext"
michael@0 83 * Platform-specific context pointer.
michael@0 84 * THREAD SAFETY:
michael@0 85 * Thread Safe
michael@0 86 *
michael@0 87 * Multiple threads must be able to safely call this function without
michael@0 88 * worrying about conflicts, even if they're operating on the same objects.
michael@0 89 * RETURNS:
michael@0 90 * Returns NULL if the function succeeds.
michael@0 91 * Returns a RevocationChecker Error if the function fails in a non-fatal way.
michael@0 92 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 93 */
michael@0 94 PKIX_Error *
michael@0 95 PKIX_RevocationChecker_Create(
michael@0 96 PKIX_UInt32 leafMethodListFlags,
michael@0 97 PKIX_UInt32 chainMethodListFlags,
michael@0 98 PKIX_RevocationChecker **pChecker,
michael@0 99 void *plContext);
michael@0 100
michael@0 101 /*
michael@0 102 * FUNCTION: PKIX_RevocationChecker_CreateAndAddMethod
michael@0 103 * DESCRIPTION:
michael@0 104 *
michael@0 105 * Creates revocation method object with given parameters and adds it
michael@0 106 * to revocation checker method list.
michael@0 107 *
michael@0 108 * PARAMETERS:
michael@0 109 * "revChecker"
michael@0 110 * Address of revocation checker structure.
michael@0 111 * "procParams"
michael@0 112 * Address of ProcessingParams used to initialize the checker.
michael@0 113 * Must be non-NULL.
michael@0 114 * "methodType"
michael@0 115 * Type of the method. Currently only two types are
michael@0 116 * supported: crl and ocsp. (See PKIX_RevocationMethodType enum).
michael@0 117 * "methodFlags"
michael@0 118 * Set of flags for the method.
michael@0 119 * "methodPriority"
michael@0 120 * Method priority. (0 corresponds to a highest priority)
michael@0 121 * "verificationFn"
michael@0 122 * User call back function that will perform validation of fetched
michael@0 123 * revocation information(new crl or ocsp response)
michael@0 124 * "isLeafMethod"
michael@0 125 * Boolean flag that if set to true indicates that the method should
michael@0 126 * should be used for leaf cert revocation test(false for chain set
michael@0 127 * methods).
michael@0 128 * "plContext"
michael@0 129 * Platform-specific context pointer.
michael@0 130 * THREAD SAFETY:
michael@0 131 * Thread Safe
michael@0 132 *
michael@0 133 * Multiple threads must be able to safely call this function without
michael@0 134 * worrying about conflicts, even if they're operating on the same objects.
michael@0 135 * RETURNS:
michael@0 136 * Returns NULL if the function succeeds.
michael@0 137 * Returns a RevocationChecker Error if the function fails in a non-fatal way.
michael@0 138 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 139 */
michael@0 140 PKIX_Error *
michael@0 141 PKIX_RevocationChecker_CreateAndAddMethod(
michael@0 142 PKIX_RevocationChecker *revChecker,
michael@0 143 PKIX_ProcessingParams *params,
michael@0 144 PKIX_RevocationMethodType methodType,
michael@0 145 PKIX_UInt32 methodFlags,
michael@0 146 PKIX_UInt32 mathodPriority,
michael@0 147 PKIX_PL_VerifyCallback verificationFn,
michael@0 148 PKIX_Boolean isLeafMethod,
michael@0 149 void *plContext);
michael@0 150
michael@0 151 /*
michael@0 152 * FUNCTION: PKIX_RevocationChecker_Check
michael@0 153 * DESCRIPTION:
michael@0 154 *
michael@0 155 * Verifies revocation status of the certificate. Issuer cert is given to
michael@0 156 * be used in verification of revocation information. Performed verification
michael@0 157 * check depends on configured revocation methods(ocsp, crl. See
michael@0 158 * PKIX_RevocationChecker_CreateAndAddMethod function) and a point of chain
michael@0 159 * building process at which PKIX_RevocationChecker_Check was invoked.
michael@0 160 * For security reasons, the cert status is checked only against cached
michael@0 161 * revocation information during chain building stage(no trust anchor yes has
michael@0 162 * been found). The fresh revocation information fetching is done only at chain
michael@0 163 * verification stage after trust anchor was identified.
michael@0 164 *
michael@0 165 * PARAMETERS:
michael@0 166 * "cert"
michael@0 167 * Address of Cert whose revocation status is to be determined.
michael@0 168 * Must be non-NULL.
michael@0 169 * "issuer"
michael@0 170 * Issuer cert that potentially holds public key that will be used
michael@0 171 * to verify revocation info.
michael@0 172 * "revChecker"
michael@0 173 * Address of revocation checker structure.
michael@0 174 * "procParams"
michael@0 175 * Address of ProcessingParams used to initialize the checker.
michael@0 176 * Must be non-NULL.
michael@0 177 * "chainVerificationState"
michael@0 178 * Need to be set to true, if the check was called during chain verification
michael@0 179 * as an opposite to chain building.
michael@0 180 * "testingLeafCert"
michael@0 181 * Set to true if verifying revocation status of a leaf cert.
michael@0 182 * "revStatus"
michael@0 183 * Address of the returned revocation status of the cert.
michael@0 184 * "pResultCode"
michael@0 185 * Address where revocation status will be stored. Must be non-NULL.
michael@0 186 * "pNBIOContext"
michael@0 187 * Address at which platform-dependent non-blocking I/O context is stored.
michael@0 188 * Must be non-NULL.
michael@0 189 * "plContext"
michael@0 190 * Platform-specific context pointer.
michael@0 191 * THREAD SAFETY:
michael@0 192 * Thread Safe
michael@0 193 *
michael@0 194 * Multiple threads must be able to safely call this function without
michael@0 195 * worrying about conflicts, even if they're operating on the same objects.
michael@0 196 * RETURNS:
michael@0 197 * Returns NULL if the function succeeds.
michael@0 198 * Returns a RevocationChecker Error if the function fails in a non-fatal way.
michael@0 199 * Returns a Fatal Error if the function fails in an unrecoverable way.
michael@0 200 */
michael@0 201 PKIX_Error *
michael@0 202 PKIX_RevocationChecker_Check(PKIX_PL_Cert *cert,
michael@0 203 PKIX_PL_Cert *issuer,
michael@0 204 PKIX_RevocationChecker *revChecker,
michael@0 205 PKIX_ProcessingParams *procParams,
michael@0 206 PKIX_Boolean chainVerificationState,
michael@0 207 PKIX_Boolean testingLeafCert,
michael@0 208 PKIX_RevocationStatus *revStatus,
michael@0 209 PKIX_UInt32 *pReasonCode,
michael@0 210 void **pNbioContext,
michael@0 211 void *plContext);
michael@0 212
michael@0 213 #ifdef __cplusplus
michael@0 214 }
michael@0 215 #endif
michael@0 216
michael@0 217 #endif /* _PKIX_REVCHECKER_H */

mercurial