MCCI TweetNaCl
TweetNaCl library adapted for embedded use
Authenticated encryptions
+ Collaboration diagram for Authenticated encryptions:

Data Structures

struct  mcci_tweetnacl_secretbox_cipherzero_t
 Reference structure for bytes required to be zero at front of cihper text. More...
 
struct  mcci_tweetnacl_secretbox_key_t
 Reference structure for key bytes for secretbox. More...
 
struct  mcci_tweetnacl_secretbox_messagezero_t
 Reference structure for bytes requried to be zero at front of plaintext. More...
 
struct  mcci_tweetnacl_secretbox_nonce_t
 Reference structure for nonce bytes for secretbox. More...
 

Functions

static mcci_tweetnacl_result_t mcci_tweetnacl_secretbox (unsigned char *pCipherText, const unsigned char *pPlainText, size_t sizeText, const mcci_tweetnacl_secretbox_nonce_t *pNonce, const mcci_tweetnacl_secretbox_key_t *pKey)
 Secret-key authenticated encryption (using xsalsa20) More...
 
static mcci_tweetnacl_result_t mcci_tweetnacl_secretbox_open (unsigned char *pPlainText, const unsigned char *pCipherText, size_t sizeText, const mcci_tweetnacl_secretbox_nonce_t *pNonce, const mcci_tweetnacl_secretbox_key_t *pKey)
 Secret-key authenticated decryption (using xsalsa20) More...
 

Detailed Description

Function Documentation

◆ mcci_tweetnacl_secretbox()

static mcci_tweetnacl_result_t mcci_tweetnacl_secretbox ( unsigned char *  pCipherText,
const unsigned char *  pPlainText,
size_t  sizeText,
const mcci_tweetnacl_secretbox_nonce_t pNonce,
const mcci_tweetnacl_secretbox_key_t pKey 
)
inlinestatic

Secret-key authenticated encryption (using xsalsa20)

Parameters
[out]pCipherTextpointer to buffer of size sizeText bytes.
[in]pPlainTextpointer to buffer of size sizeText bytes.
[in]sizeTextsize of the output text buffer
[in]pNoncepointer to 24-byte nonce
[in]pKeypointer to 32-byte key buffer.
Returns
zero for successful encryption, non-zero for parameter validation failure.
Note
pPlainText must start with a string of sizeof(mcci_tweetnacl_secretbox_messagezero_t::bytes) bytes of zero. The first sizeof(mcci_tweetnacl_secretbox_cipherzero_t::bytes) bytes of pCipherText will be zero. Thus, the real ciphertext data is from pCipherText + sizeof(mcci_tweetnacl_secretbox_cipherzero_t::bytes) to pCihperText + sizeText - 1.
See also
https://nacl.cr.yp.to/secretbox.html

Definition at line 100 of file mcci_tweetnacl_secretbox.h.

References mcci_tweetnacl_secretbox_nonce_t::bytes, and mcci_tweetnacl_secretbox_key_t::bytes.

◆ mcci_tweetnacl_secretbox_open()

static mcci_tweetnacl_result_t mcci_tweetnacl_secretbox_open ( unsigned char *  pPlainText,
const unsigned char *  pCipherText,
size_t  sizeText,
const mcci_tweetnacl_secretbox_nonce_t pNonce,
const mcci_tweetnacl_secretbox_key_t pKey 
)
inlinestatic

Secret-key authenticated decryption (using xsalsa20)

Parameters
[out]pPlainTextpointer to buffer of size sizeText bytes.
[in]pCipherTextpointer to buffer of size sizeText bytes.
[in]sizeTextsize of the output text buffer
[in]pNoncepointer to 24-byte nonce
[in]pKeypointer to 32-byte key buffer.
Returns
zero for successful decryption and authenticaion, non-zero otherwise.
Note
pCipherText must start with a string of sizeof(mcci_tweetnacl_secretbox_cipherzero_t::bytes) bytes of zero. The first sizeof(mcci_tweetnacl_secretbox_messagezero_t::bytes) bytes of pPlainText will be zero. Thus, the real plaintext data is from pPlainText + sizeof(mcci_tweetnacl_secretbox_messagezero_t::bytes) to pPlainText + sizeText - 1.
See also
https://nacl.cr.yp.to/secretbox.html

Definition at line 140 of file mcci_tweetnacl_secretbox.h.

References mcci_tweetnacl_secretbox_nonce_t::bytes, and mcci_tweetnacl_secretbox_key_t::bytes.