From 88c0b6538f451e2379b98c83162c05d80b529ad0 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 16 Aug 2017 13:59:56 +0200 Subject: [PATCH] Trigger sodium_misuse() if mlen > secretstream_MESSAGESBYTES_MAX --- .../xchacha20poly1305/secretstream_xchacha20poly1305.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c b/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c index 6abcd5e2..32d01b3b 100644 --- a/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c +++ b/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c @@ -95,7 +95,7 @@ crypto_secretstream_xchacha20poly1305_push *outlen_p = 0U; } if (mlen > crypto_secretstream_xchacha20poly1305_MESSAGESBYTES_MAX) { - return -1; + sodium_misuse(); } crypto_stream_chacha20_ietf(block, sizeof block, state->nonce, state->k); crypto_onetimeauth_poly1305_init(&poly1305_state, block); @@ -171,7 +171,7 @@ crypto_secretstream_xchacha20poly1305_pull } mlen = inlen - crypto_secretstream_xchacha20poly1305_ABYTES; if (mlen > crypto_secretstream_xchacha20poly1305_MESSAGESBYTES_MAX) { - return -1; + sodium_misuse(); } crypto_stream_chacha20_ietf(block, sizeof block, state->nonce, state->k); crypto_onetimeauth_poly1305_init(&poly1305_state, block);