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_revocationchecker.c | 5 * pkix_revocationchecker.c |
6 * | 6 * |
7 * RevocationChecker Object Functions | 7 * RevocationChecker Object Functions |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 entry.hashcodeFunction = NULL; | 130 entry.hashcodeFunction = NULL; |
131 entry.toStringFunction = NULL; | 131 entry.toStringFunction = NULL; |
132 entry.comparator = NULL; | 132 entry.comparator = NULL; |
133 entry.duplicateFunction = pkix_RevocationChecker_Duplicate; | 133 entry.duplicateFunction = pkix_RevocationChecker_Duplicate; |
134 | 134 |
135 systemClasses[PKIX_REVOCATIONCHECKER_TYPE] = entry; | 135 systemClasses[PKIX_REVOCATIONCHECKER_TYPE] = entry; |
136 | 136 |
137 PKIX_RETURN(REVOCATIONCHECKER); | 137 PKIX_RETURN(REVOCATIONCHECKER); |
138 } | 138 } |
139 | 139 |
140 /* Sort methods by theirs priorities */ | 140 /* Sort methods by their priorities (lower priority = higher preference) */ |
141 static PKIX_Error * | 141 static PKIX_Error * |
142 pkix_RevocationChecker_SortComparator( | 142 pkix_RevocationChecker_SortComparator( |
143 PKIX_PL_Object *obj1, | 143 PKIX_PL_Object *obj1, |
144 PKIX_PL_Object *obj2, | 144 PKIX_PL_Object *obj2, |
145 PKIX_Int32 *pResult, | 145 PKIX_Int32 *pResult, |
146 void *plContext) | 146 void *plContext) |
147 { | 147 { |
148 pkix_RevocationMethod *method1 = NULL, *method2 = NULL; | 148 pkix_RevocationMethod *method1 = NULL, *method2 = NULL; |
149 | 149 |
150 PKIX_ENTER(BUILD, "pkix_RevocationChecker_SortComparator"); | 150 PKIX_ENTER(BUILD, "pkix_RevocationChecker_SortComparator"); |
151 | 151 |
152 method1 = (pkix_RevocationMethod *)obj1; | 152 method1 = (pkix_RevocationMethod *)obj1; |
153 method2 = (pkix_RevocationMethod *)obj2; | 153 method2 = (pkix_RevocationMethod *)obj2; |
154 | 154 |
155 *pResult = (method1->priority > method2->priority); | 155 if (method1->priority < method2->priority) { |
| 156 *pResult = -1; |
| 157 } else if (method1->priority > method2->priority) { |
| 158 *pResult = 1; |
| 159 } else { |
| 160 *pResult = 0; |
| 161 } |
156 | 162 |
157 PKIX_RETURN(BUILD); | 163 PKIX_RETURN(BUILD); |
158 } | 164 } |
159 | 165 |
160 | 166 |
161 /* --Public-Functions--------------------------------------------- */ | 167 /* --Public-Functions--------------------------------------------- */ |
162 | 168 |
163 | 169 |
164 /* | 170 /* |
165 * FUNCTION: PKIX_RevocationChecker_Create (see comments in pkix_revchecker.h) | 171 * FUNCTION: PKIX_RevocationChecker_Create (see comments in pkix_revchecker.h) |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 } | 464 } |
459 } | 465 } |
460 | 466 |
461 cleanup: | 467 cleanup: |
462 *pRevStatus = overallStatus; | 468 *pRevStatus = overallStatus; |
463 PKIX_DECREF(method); | 469 PKIX_DECREF(method); |
464 | 470 |
465 PKIX_RETURN(REVOCATIONCHECKER); | 471 PKIX_RETURN(REVOCATIONCHECKER); |
466 } | 472 } |
467 | 473 |
OLD | NEW |