security: Change SHA256_DIGEST_LENGTH to SHA256_DIGEST_SIZE;
Change-Id: Ib490cfec5e9331575567b346810d1bc56bc97ea1
diff --git a/src/security/validator.cpp b/src/security/validator.cpp
index 1e5aedc..82de103 100644
--- a/src/security/validator.cpp
+++ b/src/security/validator.cpp
@@ -243,13 +243,13 @@
if(static_cast<bool>(buffer)
&& buffer->size() == sigValue.value_size()
- && buffer->size() == crypto::SHA256_DIGEST_LENGTH)
+ && buffer->size() == crypto::SHA256_DIGEST_SIZE)
{
const uint8_t* p1 = buffer->buf();
const uint8_t* p2 = sigValue.value();
- for(int i = 0; i < crypto::SHA256_DIGEST_LENGTH; i++)
+ for(int i = 0; i < crypto::SHA256_DIGEST_SIZE; i++)
if(p1[i] != p2[i])
return false;
return true;
diff --git a/src/util/crypto.cpp b/src/util/crypto.cpp
index b0767fa..3aa114a 100644
--- a/src/util/crypto.cpp
+++ b/src/util/crypto.cpp
@@ -20,7 +20,7 @@
CryptoPP::SHA256 hash;
OBufferStream os;
- StringSource(data, dataLength, true, new HashFilter(hash, new ArraySink(digest, crypto::SHA256_DIGEST_LENGTH)));
+ StringSource(data, dataLength, true, new HashFilter(hash, new ArraySink(digest, crypto::SHA256_DIGEST_SIZE)));
}
catch(CryptoPP::Exception& e)
{
diff --git a/src/util/crypto.hpp b/src/util/crypto.hpp
index 21e1e71..58555a2 100644
--- a/src/util/crypto.hpp
+++ b/src/util/crypto.hpp
@@ -12,19 +12,22 @@
namespace ndn {
/**
- * Compute the sha-256 digest of data.
+ * @brief Compute the sha-256 digest of data.
+ *
* @param data Pointer to the input byte array.
* @param dataLength The length of data.
- * @param digest A pointer to a buffer of size SHA256_DIGEST_LENGTH to receive the data.
+ * @param digest A pointer to a buffer of size crypto::SHA256_DIGEST_SIZE to receive the data.
*/
void ndn_digestSha256(const uint8_t *data, size_t dataLength, uint8_t *digest);
namespace crypto {
-static size_t SHA256_DIGEST_LENGTH = 32;
+/// @brief number of octets in a SHA256 digest
+static const size_t SHA256_DIGEST_SIZE = 32;
/**
- * Compute the sha-256 digest of data.
+ * @brief Compute the sha-256 digest of data.
+ *
* @param data Pointer to the input byte array.
* @param dataLength The length of data.
* @return A pointer to a buffer of SHA256_DIGEST.