Monocypher

Boring crypto that simply works
CRYPTO_LOCK_INIT(3MONOCYPHER) 3MONOCYPHER CRYPTO_LOCK_INIT(3MONOCYPHER)

incremental authenticated encryption with additional data

#include <monocypher.h>

void
crypto_lock_init(crypto_lock_ctx *ctx, const uint8_t key[32], const uint8_t nonce[24]);

void
crypto_lock_auth_ad(crypto_lock_ctx *ctx, const uint8_t *ad, size_t ad_size);

void
crypto_lock_auth_message(crypto_lock_ctx *ctx, const uint8_t *plain_text, size_t text_size);

void
crypto_lock_update(crypto_lock_ctx *ctx, uint8_t *cipher_text, const uint8_t *plain_text, size_t text_size);

void
crypto_lock_final(crypto_lock_ctx *ctx, uint8_t mac[16]);

void
crypto_unlock_init(crypto_unlock_ctx *ctx, const uint8_t key[32], const uint8_t nonce[24]);

void
crypto_unlock_auth_ad(crypto_unlock_ctx *ctx, const uint8_t *ad, size_t ad_size);

void
crypto_unlock_auth_message(crypto_unlock_ctx *ctx, const uint8_t *plain_text, size_t text_size);

void
crypto_unlock_update(crypto_unlock_ctx *ctx, uint8_t *plain_text, const uint8_t *cipher_text, size_t text_size);

int
crypto_unlock_final(crypto_unlock_ctx *ctx, const uint8_t mac[16]);

These functions were variants of crypto_lock(), crypto_unlock(), crypto_lock_aead() and crypto_unlock_aead(). They are deprecated in favor of those simpler functions.

Change your protocol so that it does not rely on the removed functions, namely by splitting the data into chunks that you can individually use crypto_lock() and crypto_unlock() on.

For files in particular, you may alternatively (and suboptimally) attempt to use () (on *NIX) or () (on Windows) and pass the files as mapped memory into crypto_lock() and crypto_unlock() instead.

crypto_lock_init(), crypto_unlock_init(), crypto_lock_auth_ad(), crypto_unlock_auth_ad(), crypto_lock_auth_message(), crypto_unlock_auth_message(), crypto_lock_update(), crypto_unlock_update(), and crypto_lock_final() return nothing.

crypto_unlock_final() returns 0 on success or -1 if the message was corrupted. Corruption can be caused by transmission errors, programmer error, or an attacker's interference. .

crypto_lock(), crypto_lock_aead(), crypto_unlock(), crypto_unlock_aead(), intro()

The crypto_lock_init(), crypto_lock_auth_ad(), crypto_lock_auth_message(), crypto_lock_update(), crypto_lock_final(), crypto_unlock_init(), crypto_unlock_auth_ad(), crypto_unlock_auth_message(), crypto_unlock_update(), and crypto_unlock_final() functions first appeared in Monocypher 1.1.0. crypto_lock_aead_auth() and crypto_unlock_aead_auth() were renamed to crypto_lock_auth_ad() and crypto_unlock_auth_ad() respectively in Monocypher 2.0.0. They were deprecated in Monocypher 3.0.0 and will be removed in Monocypher 4.0.0.

February 14, 2022 Debian