diff options
author | lloyd <[email protected]> | 2006-06-19 09:52:07 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-06-19 09:52:07 +0000 |
commit | 5b569f736d6af84983eea59279fe10656ff8b99f (patch) | |
tree | c5574622a6f98579f573d62271f3ffd97ac68309 /src | |
parent | 7612c768e68202cfffbfdab2bc973b0f63bd0a03 (diff) |
Turns out that DER_Cmp's comparison is exactly the same as the one
built into MemoryRegion (no real surprise, as they are both simple
byte-wise lexicographical compares), so remove it and just use
the MemoryRegion<>::operator< for sorting sets
Diffstat (limited to 'src')
-rw-r--r-- | src/der_enc.cpp | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/src/der_enc.cpp b/src/der_enc.cpp index b389d5694..ed503e36f 100644 --- a/src/der_enc.cpp +++ b/src/der_enc.cpp @@ -58,34 +58,6 @@ SecureVector<byte> encode_length(u32bit length) return encoded_length; } -/************************************************* -* A comparison functor for sorting SET objects * -*************************************************/ -class DER_Cmp - { - public: - bool operator()(const MemoryRegion<byte>&, - const MemoryRegion<byte>&) const; - }; - -/************************************************* -* Compare two encodings, as specified by X.690 * -*************************************************/ -bool DER_Cmp::operator()(const MemoryRegion<byte>& a, - const MemoryRegion<byte>& b) const - { - // FIXME: use lexicographical_compare - if(a.size() < b.size()) return true; - if(a.size() > b.size()) return false; - - for(u32bit j = 0; j != a.size(); ++j) - { - if(a[j] < b[j]) return true; - if(a[j] > b[j]) return false; - } - return false; - } - } /************************************************* @@ -99,7 +71,7 @@ SecureVector<byte> DER_Encoder::DER_Sequence::get_contents() if(type_tag == SET) { - std::sort(set_contents.begin(), set_contents.end(), DER_Cmp()); + std::sort(set_contents.begin(), set_contents.end()); for(u32bit j = 0; j != set_contents.size(); ++j) contents.append(set_contents[j]); set_contents.clear(); |