aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/xmss
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-01-18 11:37:01 -0500
committerJack Lloyd <[email protected]>2019-01-18 11:37:01 -0500
commitb835fdf8fd3910a79ab408660757d9736f82d14d (patch)
treefbbd8e89d9cf910bc3a9e9ecbfce5ce290b7c8d9 /src/lib/pubkey/xmss
parent9ca22335edcb9800158f4691de20fa5d0f9cc849 (diff)
Rename Integrity_Failure to Invalid_Authentication_Tag
This makes the meaning and usage more clear. Add a specific error type so invalid tags can be distinguished without having to catch that specific type. See also #1813
Diffstat (limited to 'src/lib/pubkey/xmss')
-rw-r--r--src/lib/pubkey/xmss/xmss_privatekey.cpp5
-rw-r--r--src/lib/pubkey/xmss/xmss_privatekey.h6
-rw-r--r--src/lib/pubkey/xmss/xmss_publickey.cpp4
-rw-r--r--src/lib/pubkey/xmss/xmss_signature.cpp4
-rw-r--r--src/lib/pubkey/xmss/xmss_verification_operation.cpp2
5 files changed, 9 insertions, 12 deletions
diff --git a/src/lib/pubkey/xmss/xmss_privatekey.cpp b/src/lib/pubkey/xmss/xmss_privatekey.cpp
index 05d61981e..9ef2b5c9c 100644
--- a/src/lib/pubkey/xmss/xmss_privatekey.cpp
+++ b/src/lib/pubkey/xmss/xmss_privatekey.cpp
@@ -37,7 +37,7 @@ XMSS_PrivateKey::XMSS_PrivateKey(const secure_vector<uint8_t>& raw_key)
if(raw_key.size() != size())
{
- throw Integrity_Failure("Invalid XMSS private key size detected.");
+ throw Decoding_Error("Invalid XMSS private key size detected.");
}
// extract & copy unused leaf index from raw_key.
@@ -52,8 +52,7 @@ XMSS_PrivateKey::XMSS_PrivateKey(const secure_vector<uint8_t>& raw_key)
if(unused_leaf >= (1ull << XMSS_PublicKey::m_xmss_params.tree_height()))
{
- throw Integrity_Failure("XMSS private key leaf index out of "
- "bounds.");
+ throw Decoding_Error("XMSS private key leaf index out of bounds");
}
begin = end;
diff --git a/src/lib/pubkey/xmss/xmss_privatekey.h b/src/lib/pubkey/xmss/xmss_privatekey.h
index d66933724..e3b41617c 100644
--- a/src/lib/pubkey/xmss/xmss_privatekey.h
+++ b/src/lib/pubkey/xmss/xmss_privatekey.h
@@ -115,8 +115,7 @@ class BOTAN_PUBLIC_API(2,0) XMSS_PrivateKey final : public virtual XMSS_PublicKe
{
if(idx >= (1ull << XMSS_PublicKey::m_xmss_params.tree_height()))
{
- throw Integrity_Failure("XMSS private key leaf index out of "
- "bounds.");
+ throw Decoding_Error("XMSS private key leaf index out of bounds");
}
else
{
@@ -140,8 +139,7 @@ class BOTAN_PUBLIC_API(2,0) XMSS_PrivateKey final : public virtual XMSS_PublicKe
*recover_global_leaf_index())).fetch_add(1);
if(idx >= (1ull << XMSS_PublicKey::m_xmss_params.tree_height()))
{
- throw Integrity_Failure("XMSS private key, one time signatures "
- "exhausted.");
+ throw Decoding_Error("XMSS private key, one time signatures exhaused");
}
return idx;
}
diff --git a/src/lib/pubkey/xmss/xmss_publickey.cpp b/src/lib/pubkey/xmss/xmss_publickey.cpp
index 425c657ca..42fbdb851 100644
--- a/src/lib/pubkey/xmss/xmss_publickey.cpp
+++ b/src/lib/pubkey/xmss/xmss_publickey.cpp
@@ -26,7 +26,7 @@ XMSS_PublicKey::XMSS_PublicKey(const std::vector<uint8_t>& raw_key)
{
if(raw_key.size() < size())
{
- throw Integrity_Failure("Invalid XMSS public key size detected.");
+ throw Decoding_Error("Invalid XMSS public key size detected.");
}
// extract & copy root from raw key.
@@ -49,7 +49,7 @@ XMSS_PublicKey::deserialize_xmss_oid(const std::vector<uint8_t>& raw_key)
{
if(raw_key.size() < 4)
{
- throw Integrity_Failure("XMSS signature OID missing.");
+ throw Decoding_Error("XMSS signature OID missing.");
}
// extract and convert algorithm id to enum type
diff --git a/src/lib/pubkey/xmss/xmss_signature.cpp b/src/lib/pubkey/xmss/xmss_signature.cpp
index f2d1ba4f1..2ba8a1965 100644
--- a/src/lib/pubkey/xmss/xmss_signature.cpp
+++ b/src/lib/pubkey/xmss/xmss_signature.cpp
@@ -19,7 +19,7 @@ XMSS_Signature::XMSS_Signature(XMSS_Parameters::xmss_algorithm_t oid,
if(raw_sig.size() != (xmss_params.len() + xmss_params.tree_height() + 1)
* xmss_params.element_size() + sizeof(m_leaf_idx))
{
- throw Integrity_Failure("XMSS signature size invalid.");
+ throw Decoding_Error("XMSS signature size invalid.");
}
for(size_t i = 0; i < 8; i++)
@@ -27,7 +27,7 @@ XMSS_Signature::XMSS_Signature(XMSS_Parameters::xmss_algorithm_t oid,
if(m_leaf_idx >= (1ull << xmss_params.tree_height()))
{
- throw Integrity_Failure("XMSS signature leaf index out of bounds.");
+ throw Decoding_Error("XMSS signature leaf index out of bounds.");
}
auto begin = raw_sig.begin() + sizeof(m_leaf_idx);
diff --git a/src/lib/pubkey/xmss/xmss_verification_operation.cpp b/src/lib/pubkey/xmss/xmss_verification_operation.cpp
index 6a757633e..2eacc19fd 100644
--- a/src/lib/pubkey/xmss/xmss_verification_operation.cpp
+++ b/src/lib/pubkey/xmss/xmss_verification_operation.cpp
@@ -117,7 +117,7 @@ bool XMSS_Verification_Operation::is_valid_signature(const uint8_t sig[],
m_msg_buf.clear();
return result;
}
- catch(Integrity_Failure&)
+ catch(...)
{
m_msg_buf.clear();
return false;