David Benjamin 97d48dbeb8 Sort various X.509 global lists sooner
These functions need a lot more work, documentation, warnings
that using them isn't a good idea, and really we should just remove them
entirely.

But, for now, this is a minimal fix to the most egregious of issues: not
only are the functions themselves not thread-safe (i.e. you must call it
in some program-global initialization), but using them puts you in a
state where future uses of the X.509 library are not thread-safe! Fix
the latter by sorting the list at the point we're already mutating
things.

Re-sorting a list after every addition is not a particularly sensible
implementation, but we can assume these lists will only ever contain
O(1) entries.

(The sort calls date to
https://boringssl-review.googlesource.com/c/boringssl/+/27304, but the
issue was there before. Prior to that CL, sk_FOO_find implicitly sorted
the list. That CL made sk_FOO_find itself a const operation, necessary
for this, and just added explicit sk_FOO_sort calls to preserve the
existing behavior, initially.)

Change-Id: I063b8e708eaf17dfe66c5a3e8d33733adb3297e9
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/58385
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
2023-03-28 22:02:15 +00:00
..
2023-03-22 18:37:42 +00:00
2023-03-16 23:46:11 +00:00
2019-04-17 20:57:57 +00:00
2023-02-08 21:48:53 +00:00
2022-06-14 17:57:23 +00:00
2023-02-28 23:12:58 +00:00
2023-03-06 20:05:26 +00:00
2018-09-05 23:41:25 +00:00
2022-06-08 18:05:50 +00:00
2023-02-06 21:33:21 +00:00
2023-01-27 14:19:27 +00:00
2023-01-27 14:19:27 +00:00
2020-05-14 18:17:12 +00:00