signature: disallow encoding invalid SignatureInfo
Also, check integer range when decoding SignatureInfo.
refs #3200
Change-Id: I1af4833211c9468ac7ecab48f7d0e88e9423b378
diff --git a/src/signature.hpp b/src/signature.hpp
index 315d061..1af7885 100644
--- a/src/signature.hpp
+++ b/src/signature.hpp
@@ -109,12 +109,10 @@
public: // SignatureInfo fields
/** @brief Get SignatureType
+ * @throw Error signature is invalid
*/
- uint32_t
- getType() const
- {
- return m_info.getSignatureType();
- }
+ tlv::SignatureTypeValue
+ getType() const;
/** @brief Check if KeyLocator exists in SignatureInfo
*/
@@ -157,11 +155,8 @@
mutable Block m_value;
};
-inline bool
-operator==(const Signature& lhs, const Signature& rhs)
-{
- return lhs.getInfo() == rhs.getInfo() && lhs.getValue() == rhs.getValue();
-}
+bool
+operator==(const Signature& lhs, const Signature& rhs);
inline bool
operator!=(const Signature& lhs, const Signature& rhs)