Repository navigation
Commit e7cb4ea
authored
der: order
`ValueOrd for FlagSet<T>` compared `bits()` as an integer. The DER
encoding (a NamedBitList BIT STRING) puts flag 0 in the most significant
bit of the first octet and drops trailing zero bits, so the integer order
and the encoding order disagree, e.g. for a 9-flag set:
{A} bits 0x001 -> 03 02 07 80
{B} bits 0x002 -> 03 02 06 40 (sorts first in DER)
X.690 11.6 orders `SET OF` components by their encodings, so `SetOfVec`
of a type containing a `FlagSet` (e.g. x509-cert's `DistributionPoint`
with `reasons: Option<ReasonFlags>`) can encode out of DER order.
Compare the encoded values instead (on a stack buffer).FlagSet by its BIT STRING encoding (#2451)1 parent 16a33d3 commit e7cb4ea
1 file changed
Lines changed: 43 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
626 | 626 | | |
627 | 627 | | |
628 | 628 | | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
629 | 633 | | |
630 | 634 | | |
631 | 635 | | |
632 | 636 | | |
633 | | - | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
634 | 640 | | |
635 | 641 | | |
636 | | - | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
637 | 647 | | |
638 | 648 | | |
639 | 649 | | |
| |||
766 | 776 | | |
767 | 777 | | |
768 | 778 | | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
769 | 810 | | |
0 commit comments