OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 /* | 4 /* |
5 * pkix_build.c | 5 * pkix_build.c |
6 * | 6 * |
7 * Top level buildChain function | 7 * Top level buildChain function |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
(...skipping 2973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2984 PKIX_ForwardBuilderState *state, | 2984 PKIX_ForwardBuilderState *state, |
2985 PKIX_BuildResult **pBuildResult, | 2985 PKIX_BuildResult **pBuildResult, |
2986 void **pNBIOContext, | 2986 void **pNBIOContext, |
2987 void *plContext) | 2987 void *plContext) |
2988 { | 2988 { |
2989 PKIX_PL_Cert *targetCert = NULL; | 2989 PKIX_PL_Cert *targetCert = NULL; |
2990 PKIX_List *anchors = NULL; | 2990 PKIX_List *anchors = NULL; |
2991 PKIX_PL_Date *testDate = NULL; | 2991 PKIX_PL_Date *testDate = NULL; |
2992 PKIX_BuildResult *buildResult = NULL; | 2992 PKIX_BuildResult *buildResult = NULL; |
2993 PKIX_ValidateResult *valResult = NULL; | 2993 PKIX_ValidateResult *valResult = NULL; |
| 2994 PKIX_Error *buildError = NULL; |
2994 PKIX_TrustAnchor *matchingAnchor = NULL; | 2995 PKIX_TrustAnchor *matchingAnchor = NULL; |
2995 PKIX_PL_Cert *trustedCert = NULL; | 2996 PKIX_PL_Cert *trustedCert = NULL; |
2996 PKIX_List *certList = NULL; | 2997 PKIX_List *certList = NULL; |
2997 PKIX_Boolean cacheHit = PKIX_FALSE; | 2998 PKIX_Boolean cacheHit = PKIX_FALSE; |
2998 PKIX_Boolean trusted = PKIX_FALSE; | 2999 PKIX_Boolean trusted = PKIX_FALSE; |
2999 PKIX_Boolean stillValid = PKIX_FALSE; | 3000 PKIX_Boolean stillValid = PKIX_FALSE; |
3000 void *nbioContext = NULL; | 3001 void *nbioContext = NULL; |
3001 | 3002 |
3002 PKIX_ENTER(BUILD, "pkix_Build_CheckInCache"); | 3003 PKIX_ENTER(BUILD, "pkix_Build_CheckInCache"); |
3003 | 3004 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3092 buildResult = NULL; | 3093 buildResult = NULL; |
3093 stillValid = PKIX_TRUE; | 3094 stillValid = PKIX_TRUE; |
3094 } | 3095 } |
3095 | 3096 |
3096 cleanup: | 3097 cleanup: |
3097 | 3098 |
3098 if (!nbioContext && cacheHit && !(trusted && stillValid)) { | 3099 if (!nbioContext && cacheHit && !(trusted && stillValid)) { |
3099 /* The anchor of this chain is no longer trusted or | 3100 /* The anchor of this chain is no longer trusted or |
3100 * chain cert(s) has been revoked. | 3101 * chain cert(s) has been revoked. |
3101 * Invalidate this result in the cache */ | 3102 * Invalidate this result in the cache */ |
| 3103 buildError = pkixErrorResult; |
3102 PKIX_CHECK_FATAL(pkix_CacheCertChain_Remove | 3104 PKIX_CHECK_FATAL(pkix_CacheCertChain_Remove |
3103 (targetCert, | 3105 (targetCert, |
3104 anchors, | 3106 anchors, |
3105 plContext), | 3107 plContext), |
3106 PKIX_CACHECERTCHAINREMOVEFAILED); | 3108 PKIX_CACHECERTCHAINREMOVEFAILED); |
| 3109 pkixErrorResult = buildError; |
| 3110 buildError = NULL; |
3107 } | 3111 } |
3108 | 3112 |
3109 fatal: | 3113 fatal: |
3110 PKIX_DECREF(buildResult); | 3114 PKIX_DECREF(buildResult); |
3111 PKIX_DECREF(valResult); | 3115 PKIX_DECREF(valResult); |
| 3116 PKIX_DECREF(buildError); |
3112 PKIX_DECREF(certList); | 3117 PKIX_DECREF(certList); |
3113 PKIX_DECREF(matchingAnchor); | 3118 PKIX_DECREF(matchingAnchor); |
3114 PKIX_DECREF(trustedCert); | 3119 PKIX_DECREF(trustedCert); |
3115 | 3120 |
3116 | 3121 |
3117 PKIX_RETURN(BUILD); | 3122 PKIX_RETURN(BUILD); |
3118 } | 3123 } |
3119 | 3124 |
3120 /* | 3125 /* |
3121 * FUNCTION: pkix_Build_InitiateBuildChain | 3126 * FUNCTION: pkix_Build_InitiateBuildChain |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3803 *pBuildResult = buildResult; | 3808 *pBuildResult = buildResult; |
3804 buildResult = NULL; | 3809 buildResult = NULL; |
3805 } | 3810 } |
3806 | 3811 |
3807 cleanup: | 3812 cleanup: |
3808 PKIX_DECREF(buildResult); | 3813 PKIX_DECREF(buildResult); |
3809 PKIX_DECREF(state); | 3814 PKIX_DECREF(state); |
3810 | 3815 |
3811 PKIX_RETURN(BUILD); | 3816 PKIX_RETURN(BUILD); |
3812 } | 3817 } |
OLD | NEW |