diff options
Diffstat (limited to 'src/crypto/zinc')
-rw-r--r-- | src/crypto/zinc/chacha20poly1305.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/crypto/zinc/chacha20poly1305.c b/src/crypto/zinc/chacha20poly1305.c index 571a64e..ff54bc4 100644 --- a/src/crypto/zinc/chacha20poly1305.c +++ b/src/crypto/zinc/chacha20poly1305.c @@ -92,6 +92,8 @@ bool chacha20poly1305_encrypt_sg_inplace(struct scatterlist *src, __le64 lens[2]; } b __aligned(16) = { { 0 } }; + if (WARN_ON(src_len > INT_MAX)) + return false; chacha20_init(&chacha20_state, key, nonce); chacha20(&chacha20_state, b.block0, b.block0, sizeof(b.block0), @@ -253,7 +255,7 @@ bool chacha20poly1305_decrypt_sg_inplace(struct scatterlist *src, } b __aligned(16) = { { 0 } }; bool ret = false; - if (unlikely(src_len < POLY1305_MAC_SIZE)) + if (unlikely(src_len < POLY1305_MAC_SIZE || WARN_ON(src_len > INT_MAX))) return ret; src_len -= POLY1305_MAC_SIZE; |