| 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_pl_oid.c | 5 * pkix_pl_oid.c |
| 6 * | 6 * |
| 7 * OID Object Functions | 7 * OID Object Functions |
| 8 * | 8 * |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 * FUNCTION: pkix_pl_OID_Equals | 100 * FUNCTION: pkix_pl_OID_Equals |
| 101 * (see comments for PKIX_PL_EqualsCallback in pkix_pl_system.h) | 101 * (see comments for PKIX_PL_EqualsCallback in pkix_pl_system.h) |
| 102 */ | 102 */ |
| 103 static PKIX_Error * | 103 static PKIX_Error * |
| 104 pkix_pl_OID_Equals( | 104 pkix_pl_OID_Equals( |
| 105 PKIX_PL_Object *first, | 105 PKIX_PL_Object *first, |
| 106 PKIX_PL_Object *second, | 106 PKIX_PL_Object *second, |
| 107 PKIX_Boolean *pResult, | 107 PKIX_Boolean *pResult, |
| 108 void *plContext) | 108 void *plContext) |
| 109 { | 109 { |
| 110 PKIX_UInt32 secondType; | 110 PKIX_Int32 cmpResult; |
| 111 SECComparison cmpResult; | |
| 112 | 111 |
| 113 PKIX_ENTER(OID, "pkix_pl_OID_Equals"); | 112 PKIX_ENTER(OID, "pkix_pl_OID_Equals"); |
| 114 PKIX_NULLCHECK_THREE(first, second, pResult); | 113 PKIX_NULLCHECK_THREE(first, second, pResult); |
| 115 | 114 |
| 116 PKIX_CHECK(pkix_CheckType(first, PKIX_OID_TYPE, plContext), | |
| 117 PKIX_FIRSTARGUMENTNOTANOID); | |
| 118 | |
| 119 PKIX_CHECK(PKIX_PL_Object_GetType(second, &secondType, plContext), | |
| 120 PKIX_COULDNOTGETTYPEOFSECONDARGUMENT); | |
| 121 | |
| 122 *pResult = PKIX_FALSE; | |
| 123 | |
| 124 /* | |
| 125 * Do a quick check that the second object is an OID. | |
| 126 * If so, check that their lengths are equal. | |
| 127 */ | |
| 128 if (secondType != PKIX_OID_TYPE) { | |
| 129 goto cleanup; | |
| 130 } | |
| 131 | |
| 132 PKIX_CHECK(pkix_pl_OID_Comparator | 115 PKIX_CHECK(pkix_pl_OID_Comparator |
| 133 (first, second, &cmpResult, plContext), | 116 (first, second, &cmpResult, plContext), |
| 134 PKIX_OIDCOMPARATORFAILED); | 117 PKIX_OIDCOMPARATORFAILED); |
| 135 | 118 |
| 136 *pResult = (cmpResult == SECEqual); | 119 *pResult = (cmpResult == 0); |
| 137 cleanup: | 120 cleanup: |
| 138 | 121 |
| 139 PKIX_RETURN(OID); | 122 PKIX_RETURN(OID); |
| 140 } | 123 } |
| 141 | 124 |
| 142 /* | 125 /* |
| 143 * FUNCTION: pkix_pl_OID_ToString | 126 * FUNCTION: pkix_pl_OID_ToString |
| 144 * (see comments for PKIX_PL_ToStringCallback in pkix_pl_system.h) | 127 * (see comments for PKIX_PL_ToStringCallback in pkix_pl_system.h) |
| 145 * Use this function only for printing OIDs and not to make any | 128 * Use this function only for printing OIDs and not to make any |
| 146 * critical security decision. | 129 * critical security decision. |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 oidData = SECOID_FindOIDByTag((SECOidTag)idtag); | 307 oidData = SECOID_FindOIDByTag((SECOidTag)idtag); |
| 325 if (!oidData) { | 308 if (!oidData) { |
| 326 PKIX_ERROR(PKIX_SECOIDFINDOIDTAGDESCRIPTIONFAILED); | 309 PKIX_ERROR(PKIX_SECOIDFINDOIDTAGDESCRIPTIONFAILED); |
| 327 } | 310 } |
| 328 | 311 |
| 329 pkixErrorResult = | 312 pkixErrorResult = |
| 330 PKIX_PL_OID_CreateBySECItem(&oidData->oid, pOID, plContext); | 313 PKIX_PL_OID_CreateBySECItem(&oidData->oid, pOID, plContext); |
| 331 cleanup: | 314 cleanup: |
| 332 PKIX_RETURN(OID); | 315 PKIX_RETURN(OID); |
| 333 } | 316 } |
| OLD | NEW |