diff --git a/.clang-tidy b/.clang-tidy index ab2a8131..36586010 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -22,6 +22,7 @@ Checks: '*, -llvmlibc-restrict-system-libc-headers, -misc-non-private-member-variables-in-classes, -misc-use-anonymous-namespace, + -misc-no-recursion, -modernize-use-nodiscard, -modernize-use-trailing-return-type, -readability-function-cognitive-complexity, diff --git a/src/credential.cpp b/src/credential.cpp index f9d8016a..bb6ba3ae 100644 --- a/src/credential.cpp +++ b/src/credential.cpp @@ -147,6 +147,10 @@ CredentialBinding::CredentialBinding(CipherSuite cipher_suite_in, , credential(std::move(credential_in)) , credential_key(credential_priv.public_key) { + if (credential.type() == CredentialType::multi_draft_00) { + throw InvalidParameterError("Multi-credentials cannot be nested"); + } + if (!credential.valid_for(credential_key)) { throw InvalidParameterError("Credential key does not match credential"); } diff --git a/src/treekem.cpp b/src/treekem.cpp index 211c2f8a..92254104 100644 --- a/src/treekem.cpp +++ b/src/treekem.cpp @@ -531,7 +531,7 @@ TreeKEMPublicKey::parent_hash_valid() const } std::vector -TreeKEMPublicKey::resolve(NodeIndex index) const // NOLINT(misc-no-recursion) +TreeKEMPublicKey::resolve(NodeIndex index) const { auto at_leaf = (index.level() == 0); if (!node_at(index).blank()) { @@ -797,7 +797,7 @@ struct TreeHashInput }; const bytes& -TreeKEMPublicKey::get_hash(NodeIndex index) // NOLINT(misc-no-recursion) +TreeKEMPublicKey::get_hash(NodeIndex index) { if (hashes.count(index) > 0) { return hashes.at(index); @@ -905,7 +905,6 @@ TreeKEMPublicKey::parent_hashes( } const bytes& -// NOLINTNEXTLINE(misc-no-recursion) TreeKEMPublicKey::original_tree_hash(TreeHashCache& cache, NodeIndex index, std::vector parent_except) const