mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-07 18:10:53 +02:00
Add buffer size and callback checks to external wc_LmsKey_Sign
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user