Check LMS offsets are sane at runtime
Signed-off-by: Raef Coles <raef.coles@arm.com>
This commit is contained in:
parent
e34e3c0e59
commit
1fb2f32ef5
1 changed files with 6 additions and 0 deletions
|
@ -733,6 +733,12 @@ int mbedtls_lms_sign( mbedtls_lms_private_t *ctx,
|
||||||
*/
|
*/
|
||||||
ctx->q_next_usable_key += 1;
|
ctx->q_next_usable_key += 1;
|
||||||
|
|
||||||
|
if ( MBEDTLS_LMS_SIG_LEN(ctx->params.type, ctx->params.otstype)
|
||||||
|
< SIG_OTS_SIG_OFFSET )
|
||||||
|
{
|
||||||
|
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
ret = mbedtls_lmots_sign( &ctx->ots_private_keys[q_leaf_identifier],
|
ret = mbedtls_lmots_sign( &ctx->ots_private_keys[q_leaf_identifier],
|
||||||
f_rng, p_rng, msg, msg_size,
|
f_rng, p_rng, msg, msg_size,
|
||||||
sig + SIG_OTS_SIG_OFFSET,
|
sig + SIG_OTS_SIG_OFFSET,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue