RawBuffer label, context, fixed;
KbkdfCounterLocation counterLocation;
KdfPrf prf;
- size_t length, rlenBits = 32, llenBits = 0, tmp;
+ size_t length, rlenBits = 32, llenBits = 32, tmp;
bool hasLabel = alg.getParam(ParamName::KBKDF_LABEL, label);
bool hasContext = alg.getParam(ParamName::KBKDF_CONTEXT, context);
bool hasFixed = alg.getParam(ParamName::KBKDF_FIXED_INPUT, fixed);
alg.getParam(ParamName::KDF_PRF, prf);
alg.getParam(ParamName::KDF_LEN, length);
alg.getParam(ParamName::KBKDF_RLEN, rlenBits);
- alg.getParam(ParamName::KBKDF_LLEN, llenBits);
+ bool hasLLen = alg.getParam(ParamName::KBKDF_LLEN, llenBits);
bool useSeparator = !alg.getParam(ParamName::KBKDF_NO_SEPARATOR, tmp);
const EVP_MD* md = nullptr;
RawBuffer key;
if (hasFixed) {
- if (hasLabel || hasContext || !useSeparator || llenBits > 0 ||
+ if (hasLabel || hasContext || !useSeparator || hasLLen ||
counterLocation == KbkdfCounterLocation::MIDDLE_FIXED)
ThrowErr(Exc::Crypto::InputParam, "Unexpected parameters for fixed input mode.");