diff options
Diffstat (limited to 'src/lib/asn1/alg_id.cpp')
-rw-r--r-- | src/lib/asn1/alg_id.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/lib/asn1/alg_id.cpp b/src/lib/asn1/alg_id.cpp index 8e6651d52..7d476a225 100644 --- a/src/lib/asn1/alg_id.cpp +++ b/src/lib/asn1/alg_id.cpp @@ -63,13 +63,27 @@ AlgorithmIdentifier::AlgorithmIdentifier(const std::string& alg_id, /* * Compare two AlgorithmIdentifiers */ +namespace { + +bool param_null_or_empty(const std::vector<byte>& p) + { + if(p.size() == 2 && (p[0] == 0x05) && (p[1] == 0x00)) + return true; + return p.empty(); + } + +} + bool operator==(const AlgorithmIdentifier& a1, const AlgorithmIdentifier& a2) { if(a1.oid != a2.oid) return false; - if(a1.parameters != a2.parameters) - return false; - return true; + + if(param_null_or_empty(a1.parameters) && + param_null_or_empty(a2.parameters)) + return true; + + return (a1.parameters == a2.parameters); } /* |