Bug 946984: Fix a compiler warning and remove redundant argument checks
authorWan-Teh Chang <wtc@google.com>
Fri, 03 Jan 2014 14:24:31 -0800
changeset 10988 6bcfca6b2a9a9f313db3fd364c7c8790a148ee53
parent 10987 4a1849df5e3e9517636e028317cbcb0e6e6db91b
child 10989 4c81bf12335f9c1af8fb5d8f7aef847018fa6189
push id262
push userwtc@google.com
push dateFri, 03 Jan 2014 22:25:09 +0000
bugs946984
Bug 946984: Fix a compiler warning and remove redundant argument checks in pkix_pl_OID_Equals. r=ryan.sleevi.
lib/libpkix/include/pkix_errorstrings.h
lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c
--- a/lib/libpkix/include/pkix_errorstrings.h
+++ b/lib/libpkix/include/pkix_errorstrings.h
@@ -469,17 +469,16 @@ PKIX_ERRORENTRY(FAILUREHASHINGCERT,Failu
 PKIX_ERRORENTRY(FAILUREHASHINGERROR,Failure hashing Error,0),
 PKIX_ERRORENTRY(FAILUREHASHINGLISTEXPECTEDPOLICYSET,Failure hashing PKIX_List expectedPolicySet,0),
 PKIX_ERRORENTRY(FAILUREHASHINGLISTQUALIFIERSET,Failure hashing PKIX_List qualifierSet,0),
 PKIX_ERRORENTRY(FAILUREHASHINGOIDVALIDPOLICY,Failure hashing PKIX_PL_OID validPolicy,0),
 PKIX_ERRORENTRY(FANOUTEXCEEDSRESOURCELIMITS,Fanout exceeds Resource Limits,0),
 PKIX_ERRORENTRY(FETCHINGCACHEDCRLFAILED,Fetching Cached CRLfailed,0),
 PKIX_ERRORENTRY(FILLINPROCESSINGPARAMSFAILED,Fail to fill in parameters,0),
 PKIX_ERRORENTRY(FILLINRETURNRESULTSFAILED,Fail to fill in return results,0),
-PKIX_ERRORENTRY(FIRSTARGUMENTNOTANOID,FirstObject is not an OID,0),
 PKIX_ERRORENTRY(FIRSTARGUMENTNOTBYTEARRAY,FirstObject is not a ByteArray,0),
 PKIX_ERRORENTRY(FIRSTARGUMENTNOTCERTBASICCONSTRAINTSOBJECT,First argument is not a CertBasicConstraints Object,0),
 PKIX_ERRORENTRY(FIRSTDOUBLEHEXMUSTNOTBE00,First DoubleHex MUST NOT be 00,SEC_ERROR_INVALID_ARGS),
 PKIX_ERRORENTRY(FIRSTFIELDMUSTBEBETWEEN02,First field must be between 0-2,SEC_ERROR_INVALID_ARGS),
 PKIX_ERRORENTRY(FIRSTOBJARGUMENTNOTANOCSPRESPONSE,FirstObject is not an OcspResponse,0),
 PKIX_ERRORENTRY(FIRSTOBJARGUMENTNOTLDAPREQUEST,FirstObject is not a LdapRequest,0),
 PKIX_ERRORENTRY(FIRSTOBJARGUMENTNOTLDAPRESPONSE,FirstObject is not a LdapResponse,0),
 PKIX_ERRORENTRY(FIRSTOBJARGUMENTNOTOCSPREQUEST,FirstObject is not a OcspRequest,0),
--- a/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c
+++ b/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c
@@ -102,43 +102,26 @@ cleanup:
  */
 static PKIX_Error *
 pkix_pl_OID_Equals(
         PKIX_PL_Object *first,
         PKIX_PL_Object *second,
         PKIX_Boolean *pResult,
         void *plContext)
 {
-        PKIX_UInt32 secondType;
-        SECComparison cmpResult;
+        PKIX_Int32 cmpResult;
 
         PKIX_ENTER(OID, "pkix_pl_OID_Equals");
         PKIX_NULLCHECK_THREE(first, second, pResult);
 
-        PKIX_CHECK(pkix_CheckType(first, PKIX_OID_TYPE, plContext),
-                    PKIX_FIRSTARGUMENTNOTANOID);
-
-        PKIX_CHECK(PKIX_PL_Object_GetType(second, &secondType, plContext),
-                    PKIX_COULDNOTGETTYPEOFSECONDARGUMENT);
-
-        *pResult = PKIX_FALSE;
-
-        /*
-         * Do a quick check that the second object is an OID.
-         * If so, check that their lengths are equal.
-         */
-        if (secondType != PKIX_OID_TYPE) {
-                goto cleanup;
-        }
-
         PKIX_CHECK(pkix_pl_OID_Comparator
                     (first, second, &cmpResult, plContext),
                     PKIX_OIDCOMPARATORFAILED);
 
-        *pResult = (cmpResult == SECEqual);
+        *pResult = (cmpResult == 0);
 cleanup:
 
         PKIX_RETURN(OID);
 }
 
 /*
  * FUNCTION: pkix_pl_OID_ToString
  * (see comments for PKIX_PL_ToStringCallback in pkix_pl_system.h)