Merge pull request #10105 from padelsbach/lms-sign-external

Add buffer size and callback checks to external wc_LmsKey_Sign
This commit is contained in:
Daniel Pouzzner
2026-03-30 23:01:00 -05:00
committed by GitHub
+16
View File
@@ -840,6 +840,22 @@ int wc_LmsKey_Sign(LmsKey* key, byte * sig, word32 * sigSz, const byte * msg,
return -1;
}
if ((size_t)*sigSz < len) {
/* Signature buffer too small. */
WOLFSSL_MSG("error: LMS sig buffer too small");
return BUFFER_E;
}
if (key->write_private_key == NULL) {
WOLFSSL_MSG("error: LmsKey write/read callbacks are not set");
return BAD_FUNC_ARG;
}
if (key->context == NULL) {
WOLFSSL_MSG("error: LmsKey context is not set");
return BAD_FUNC_ARG;
}
result = hss_generate_signature(key->working_key, LmsWritePrivKey,
key, (const void *) msg, msgSz,
sig, len, &key->info);