Trigger sodium_misuse() if mlen > secretstream_MESSAGESBYTES_MAX
This commit is contained in:
parent
72d5d506d5
commit
88c0b6538f
@ -95,7 +95,7 @@ crypto_secretstream_xchacha20poly1305_push
|
|||||||
*outlen_p = 0U;
|
*outlen_p = 0U;
|
||||||
}
|
}
|
||||||
if (mlen > crypto_secretstream_xchacha20poly1305_MESSAGESBYTES_MAX) {
|
if (mlen > crypto_secretstream_xchacha20poly1305_MESSAGESBYTES_MAX) {
|
||||||
return -1;
|
sodium_misuse();
|
||||||
}
|
}
|
||||||
crypto_stream_chacha20_ietf(block, sizeof block, state->nonce, state->k);
|
crypto_stream_chacha20_ietf(block, sizeof block, state->nonce, state->k);
|
||||||
crypto_onetimeauth_poly1305_init(&poly1305_state, block);
|
crypto_onetimeauth_poly1305_init(&poly1305_state, block);
|
||||||
@ -171,7 +171,7 @@ crypto_secretstream_xchacha20poly1305_pull
|
|||||||
}
|
}
|
||||||
mlen = inlen - crypto_secretstream_xchacha20poly1305_ABYTES;
|
mlen = inlen - crypto_secretstream_xchacha20poly1305_ABYTES;
|
||||||
if (mlen > crypto_secretstream_xchacha20poly1305_MESSAGESBYTES_MAX) {
|
if (mlen > crypto_secretstream_xchacha20poly1305_MESSAGESBYTES_MAX) {
|
||||||
return -1;
|
sodium_misuse();
|
||||||
}
|
}
|
||||||
crypto_stream_chacha20_ietf(block, sizeof block, state->nonce, state->k);
|
crypto_stream_chacha20_ietf(block, sizeof block, state->nonce, state->k);
|
||||||
crypto_onetimeauth_poly1305_init(&poly1305_state, block);
|
crypto_onetimeauth_poly1305_init(&poly1305_state, block);
|
||||||
|
Loading…
Reference in New Issue
Block a user