ASCON Suite
|
Go to the source code of this file.
Functions | |
void | ascon128a_aead_start (ascon128a_state_t *state, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k) |
Starts encrypting or decrypting a packet with ASCON-128a in incremental mode. More... | |
void | ascon128a_aead_abort (ascon128a_state_t *state) |
Aborts use of ASCON-128a in incremental mode. More... | |
void | ascon128a_aead_encrypt_block (ascon128a_state_t *state, const unsigned char *in, unsigned char *out, size_t len) |
Encrypts a block of data with ASCON-128a in incremental mode. More... | |
void | ascon128a_aead_encrypt_finalize (ascon128a_state_t *state, unsigned char *tag) |
Finalizes an incremental ASCON-128a encryption operation and generates the authentication tag. More... | |
void | ascon128a_aead_decrypt_block (ascon128a_state_t *state, const unsigned char *in, unsigned char *out, size_t len) |
Decrypts a block of data with ASCON-128a in incremental mode. More... | |
int | ascon128a_aead_decrypt_finalize (ascon128a_state_t *state, const unsigned char *tag) |
Finalizes an incremental ASCON-128a decryption operation and checks the authentication tag. More... | |
void ascon128a_aead_abort | ( | ascon128a_state_t * | state | ) |
Aborts use of ASCON-128a in incremental mode.
state | State to abort. |
This function may be used any time after ascon128a_aead_start() and before the encryption or decryption process is finalized to abort the process entirely and free the state.
Definition at line 56 of file ascon-aead-inc-128a.c.
void ascon128a_aead_decrypt_block | ( | ascon128a_state_t * | state, |
const unsigned char * | in, | ||
unsigned char * | out, | ||
size_t | len | ||
) |
Decrypts a block of data with ASCON-128a in incremental mode.
state | State to use for ASCON-128a encryption operations. |
in | Buffer that contains the ciphertext to decrypt. |
out | Buffer to receive the plaintext output. Can be the same buffer as in. |
len | Length of the plaintext and ciphertext in bytes. |
Definition at line 93 of file ascon-aead-inc-128a.c.
int ascon128a_aead_decrypt_finalize | ( | ascon128a_state_t * | state, |
const unsigned char * | tag | ||
) |
Finalizes an incremental ASCON-128a decryption operation and checks the authentication tag.
state | State to use for ASCON-128a encryption operations. |
tag | Points to the buffer containing the ciphertext's authentication tag. Must be at least ASCON128_TAG_SIZE bytes in length. |
The contents of state will be freed by this function, destroying any sensitive material that may be present.
Definition at line 103 of file ascon-aead-inc-128a.c.
void ascon128a_aead_encrypt_block | ( | ascon128a_state_t * | state, |
const unsigned char * | in, | ||
unsigned char * | out, | ||
size_t | len | ||
) |
Encrypts a block of data with ASCON-128a in incremental mode.
state | State to use for ASCON-128a encryption operations. |
in | Buffer that contains the plaintext to encrypt. |
out | Buffer to receive the ciphertext output. Can be the same buffer as in. |
len | Length of the plaintext and ciphertext in bytes. |
Definition at line 65 of file ascon-aead-inc-128a.c.
void ascon128a_aead_encrypt_finalize | ( | ascon128a_state_t * | state, |
unsigned char * | tag | ||
) |
Finalizes an incremental ASCON-128a encryption operation and generates the authentication tag.
state | State to use for ASCON-128a encryption operations. |
tag | Points to the buffer to receive the authentication tag. Must be at least ASCON128_TAG_SIZE bytes in length. |
The contents of state will be freed by this function, destroying any sensitive material that may be present.
Definition at line 75 of file ascon-aead-inc-128a.c.
void ascon128a_aead_start | ( | ascon128a_state_t * | state, |
const unsigned char * | ad, | ||
size_t | adlen, | ||
const unsigned char * | npub, | ||
const unsigned char * | k | ||
) |
Starts encrypting or decrypting a packet with ASCON-128a in incremental mode.
state | State to initialize for ASCON-128a operations. |
ad | Buffer that contains associated data to authenticate along with the packet but which does not need to be encrypted. |
adlen | Length of the associated data in bytes. |
npub | Points to the public nonce for the packet which must be 16 bytes in length. |
k | Points to the 16 bytes of the key to use to encrypt the packet. |
The following sequence can be used to encrypt a list of i plaintext message blocks (m) to produce i ciphertext message blocks (c) and an authentication tag (t).
Decryption uses a similar sequence:
It is very important that the plaintext output from decryption be discarded if the authentication tag fails to verify. Applications should not use any of the data before verifying the tag.
Definition at line 31 of file ascon-aead-inc-128a.c.