CRYPTO_LOCK_INIT(3MONOCYPHER) | 3MONOCYPHER | CRYPTO_LOCK_INIT(3MONOCYPHER) |
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
,
crypto_unlock_final
—
#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]);
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(3monocypher) and crypto_unlock(3monocypher) on.
For files in particular, you may alternatively (and suboptimally)
attempt to use mmap
() (on *NIX) or
MapViewOfFile
() (on Windows) and pass the files as
mapped memory into
crypto_lock(3monocypher) and
crypto_unlock(3monocypher)
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.
Always check the return value.
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 |