diff --git a/hkdf.h b/hkdf.h
index 79833be8..c19706f5 100644
--- a/hkdf.h
+++ b/hkdf.h
@@ -15,8 +15,10 @@ NAMESPACE_BEGIN(CryptoPP)
/// \brief Extract-and-Expand Key Derivation Function (HKDF)
/// \tparam T HashTransformation class
-/// \sa Cryptographic Extraction and Key Derivation: The HKDF Scheme
-/// and HMAC-based Extract-and-Expand Key Derivation Function (HKDF)
+/// \sa Cryptographic Extraction and Key
+/// Derivation: The HKDF Scheme and
+/// HMAC-based Extract-and-Expand Key
+/// Derivation Function (HKDF)
/// \since Crypto++ 5.6.3
template
class HKDF : public KeyDerivationFunction
@@ -128,6 +130,13 @@ size_t HKDF::DeriveKey(byte *derived, size_t derivedLen, const byte *secret,
ThrowIfInvalidDerivedLength(derivedLen);
+ // HKDF business logic. NULL is different than empty.
+ if (salt == NULLPTR)
+ {
+ salt = GetNullVector();
+ saltLen = T::DIGESTSIZE;
+ }
+
// key is PRK from the RFC, salt is IKM from the RFC
HMAC hmac;
SecByteBlock key(T::DIGESTSIZE), buffer(T::DIGESTSIZE);