In a current project the NaCl-library
crypto_box function has been used to encode and
crypto_box_open to authenticate and decode data.
However the library does not seem to support de- / encoding of large amounts of data, since the message and the buffer for the cipher text (plus nonce) as well have to be allocated in memory (The application has to run on smartphones and therefore must not consume too much memory).
Reading the documentation I came across the
crypto_stream_xor function which may allow to encrypt custom-sized portions of data, for example delivered through a stream. However a MAC still needs to be generated to detect message tampering.
Is there any built in way to generate and verify the MAC on a large message
m or has this to be dealt with on an upper level of communication by splitting large amounts of data in several authenticated, encrypted packages?