Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(775)

Unified Diff: nss/lib/libpkix/pkix/top/pkix_build.c

Issue 1017413002: Uprev NSS to 3.18 RTM (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss.git@nspr_uprev
Patch Set: Rebased Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: nss/lib/libpkix/pkix/top/pkix_build.c
diff --git a/nss/lib/libpkix/pkix/top/pkix_build.c b/nss/lib/libpkix/pkix/top/pkix_build.c
index 0fd4fadca2e8bbd1152a5330e1bc9868aa0b5cbe..9ca307e43fbf63defbcb6f1ece6208c1c0aaa639 100755
--- a/nss/lib/libpkix/pkix/top/pkix_build.c
+++ b/nss/lib/libpkix/pkix/top/pkix_build.c
@@ -660,9 +660,11 @@ pkix_ForwardBuilderState_IsIOPending(
* DESCRIPTION:
*
* This Function takes two Certificates cast in "obj1" and "obj2",
- * compares their validity NotAfter dates and returns the result at
- * "pResult". The comparison key(s) can be expanded by using other
- * data in the Certificate in the future.
+ * compares them to determine which is a more preferable certificate
+ * for chain building. This Function is suitable for use as a
+ * comparator callback for pkix_List_BubbleSort, setting "*pResult" to
+ * > 0 if "obj1" is less desirable than "obj2" and < 0 if "obj1"
+ * is more desirable than "obj2".
*
* PARAMETERS:
* "obj1"
@@ -691,14 +693,14 @@ pkix_Build_SortCertComparator(
{
PKIX_PL_Date *date1 = NULL;
PKIX_PL_Date *date2 = NULL;
- PKIX_Boolean result = PKIX_FALSE;
+ PKIX_Int32 result = 0;
PKIX_ENTER(BUILD, "pkix_Build_SortCertComparator");
PKIX_NULLCHECK_THREE(obj1, obj2, pResult);
/*
* For sorting candidate certificates, we use NotAfter date as the
- * sorted key for now (can be expanded if desired in the future).
+ * comparison key for now (can be expanded if desired in the future).
*
* In PKIX_BuildChain, the List of CertStores was reordered so that
* trusted CertStores are ahead of untrusted CertStores. That sort, or
@@ -727,7 +729,12 @@ pkix_Build_SortCertComparator(
plContext),
PKIX_OBJECTCOMPARATORFAILED);
- *pResult = !result;
+ /*
+ * Invert the result, so that if date1 is greater than date2,
+ * obj1 is sorted before obj2. This is because pkix_List_BubbleSort
+ * sorts in ascending order.
+ */
+ *pResult = -result;
cleanup:
« no previous file with comments | « nss/lib/libpkix/pkix/checker/pkix_revocationmethod.h ('k') | nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crldp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698