|
ASCON Suite
|
#include <ascon/prf.h>#include <ascon/utility.h>#include "core/ascon-util-snp.h"#include "aead/ascon-aead-common.h"Go to the source code of this file.
Macros | |
| #define | ASCON_PRF_RATE_IN 32 |
| Rate of absorption for input blocks. More... | |
| #define | ASCON_PRF_RATE_OUT 16 |
| Rate of squeezing for output blocks. More... | |
Functions | |
| void | ascon_prf (unsigned char *out, size_t outlen, const unsigned char *in, size_t inlen, const unsigned char *key) |
| Processes a key and input data with ASCON-Prf to produce a tag. More... | |
| void | ascon_prf_fixed (unsigned char *out, size_t outlen, const unsigned char *in, size_t inlen, const unsigned char *key) |
| Processes a key and input data with ASCON-Prf to produce a fixed-length output tag. More... | |
| int | ascon_prf_short (unsigned char *out, size_t outlen, const unsigned char *in, size_t inlen, const unsigned char *key) |
| Processes a key and input data with ASCON-PrfShort to produce a tag. More... | |
| void | ascon_mac (unsigned char *tag, const unsigned char *in, size_t inlen, const unsigned char *key) |
| Processes a key and input data with ASCON-Mac to produce a tag. More... | |
| int | ascon_mac_verify (const unsigned char *tag, const unsigned char *in, size_t inlen, const unsigned char *key) |
| Verifies an ASCON-Mac tag value. More... | |
| void | ascon_prf_init (ascon_prf_state_t *state, const unsigned char *key) |
| Initializes the state for an incremental ASCON-Prf operation. More... | |
| void | ascon_prf_fixed_init (ascon_prf_state_t *state, const unsigned char *key, size_t outlen) |
| Initializes the state for an incremental ASCON-Prf operation with fixed-length output. More... | |
| void | ascon_prf_reinit (ascon_prf_state_t *state, const unsigned char *key) |
| Re-initializes the state for an incremental ASCON-Prf operation. More... | |
| void | ascon_prf_fixed_reinit (ascon_prf_state_t *state, const unsigned char *key, size_t outlen) |
| Re-initializes the state for an incremental ASCON-Prf operation with fixed-length output. More... | |
| void | ascon_prf_free (ascon_prf_state_t *state) |
| Frees the ASCON-Prf state and destroys any sensitive material. More... | |
| void | ascon_prf_absorb (ascon_prf_state_t *state, const unsigned char *in, size_t inlen) |
| Absorbs input data into an incremental ASCON-Prf state. More... | |
| void | ascon_prf_squeeze (ascon_prf_state_t *state, unsigned char *out, size_t outlen) |
| Squeezes output from an incremental ASCON-Prf operation. More... | |
| #define ASCON_PRF_RATE_IN 32 |
Rate of absorption for input blocks.
Definition at line 31 of file ascon-prf.c.
| #define ASCON_PRF_RATE_OUT 16 |
Rate of squeezing for output blocks.
Definition at line 36 of file ascon-prf.c.
| void ascon_mac | ( | unsigned char * | tag, |
| const unsigned char * | in, | ||
| size_t | inlen, | ||
| const unsigned char * | key | ||
| ) |
Processes a key and input data with ASCON-Mac to produce a tag.
| tag | Buffer to receive the ASCON_PRF_TAG_SIZE bytes of the tag. |
| in | Points to the input data to be processed. |
| inlen | Length of the input data in bytes. |
| key | Points to the ASCON_PRF_KEY_SIZE bytes of the key. |
This function operates ASCON-Prf in fixed-length output mode with the output length set to ASCON_PRF_TAG_SIZE.
Definition at line 85 of file ascon-prf.c.
| int ascon_mac_verify | ( | const unsigned char * | tag, |
| const unsigned char * | in, | ||
| size_t | inlen, | ||
| const unsigned char * | key | ||
| ) |
Verifies an ASCON-Mac tag value.
| tag | Buffer that contains the ASCON_PRF_TAG_SIZE bytes of the tag. |
| in | Points to the input data to be processed. |
| inlen | Length of the input data in bytes. |
| key | Points to the ASCON_PRF_KEY_SIZE bytes of the key. |
Definition at line 97 of file ascon-prf.c.
| void ascon_prf | ( | unsigned char * | out, |
| size_t | outlen, | ||
| const unsigned char * | in, | ||
| size_t | inlen, | ||
| const unsigned char * | key | ||
| ) |
Processes a key and input data with ASCON-Prf to produce a tag.
| out | Buffer to receive the PRF tag which must be at least outlen bytes in length. |
| outlen | Length of the output buffer in bytes. Recommended to be ASCON_PRF_TAG_SIZE. |
| in | Points to the input data to be processed. |
| inlen | Length of the input data in bytes. |
| key | Points to the ASCON_PRF_KEY_SIZE bytes of the key. |
This function operates ASCON-Prf in unlimited output mode, with the output truncated at outlen bytes.
Definition at line 38 of file ascon-prf.c.
| void ascon_prf_absorb | ( | ascon_prf_state_t * | state, |
| const unsigned char * | in, | ||
| size_t | inlen | ||
| ) |
Absorbs input data into an incremental ASCON-Prf state.
| state | PRF state to be absorb. |
| in | Points to the input data to be absorbed into the state. |
| inlen | Length of the input data to be absorbed into the state. |
Definition at line 156 of file ascon-prf.c.
| void ascon_prf_fixed | ( | unsigned char * | out, |
| size_t | outlen, | ||
| const unsigned char * | in, | ||
| size_t | inlen, | ||
| const unsigned char * | key | ||
| ) |
Processes a key and input data with ASCON-Prf to produce a fixed-length output tag.
| out | Buffer to receive the PRF tag which must be at least outlen bytes in length. |
| outlen | Length of the output buffer in bytes. Recommended to be ASCON_PRF_TAG_SIZE. |
| in | Points to the input data to be processed. |
| inlen | Length of the input data in bytes. |
| key | Points to the ASCON_PRF_KEY_SIZE bytes of the key. |
This function operates ASCON-Prf in fixed-length output mode, with the output length set at exactly outlen bytes.
Definition at line 50 of file ascon-prf.c.
| void ascon_prf_fixed_init | ( | ascon_prf_state_t * | state, |
| const unsigned char * | key, | ||
| size_t | outlen | ||
| ) |
Initializes the state for an incremental ASCON-Prf operation with fixed-length output.
| state | PRF state to be initialized. |
| key | Points to the ASCON_PRF_KEY_SIZE bytes of the key. |
| outlen | Number of bytes of output that is desired, or 0 for unlimited. |
This function will set ASCON-Prf into unlimited output mode.
Definition at line 115 of file ascon-prf.c.
| void ascon_prf_fixed_reinit | ( | ascon_prf_state_t * | state, |
| const unsigned char * | key, | ||
| size_t | outlen | ||
| ) |
Re-initializes the state for an incremental ASCON-Prf operation with fixed-length output.
| state | PRF state to be re-initialized. |
| key | Points to the ASCON_PRF_KEY_SIZE bytes of the key. |
| outlen | Number of bytes of output that is desired, or 0 for unlimited. |
This function is equivalent to calling ascon_prf_free() and then ascon_prf_init() to restart the hashing process.
Definition at line 139 of file ascon-prf.c.
| void ascon_prf_free | ( | ascon_prf_state_t * | state | ) |
Frees the ASCON-Prf state and destroys any sensitive material.
| state | PRF state to be freed. |
Definition at line 146 of file ascon-prf.c.
| void ascon_prf_init | ( | ascon_prf_state_t * | state, |
| const unsigned char * | key | ||
| ) |
Initializes the state for an incremental ASCON-Prf operation.
| state | PRF state to be initialized. |
| key | Points to the ASCON_PRF_KEY_SIZE bytes of the key. |
This function will set ASCON-Prf into unlimited output mode.
Definition at line 110 of file ascon-prf.c.
| void ascon_prf_reinit | ( | ascon_prf_state_t * | state, |
| const unsigned char * | key | ||
| ) |
Re-initializes the state for an incremental ASCON-Prf operation.
| state | PRF state to be re-initialized. |
| key | Points to the ASCON_PRF_KEY_SIZE bytes of the key. |
This function is equivalent to calling ascon_prf_free() and then ascon_prf_init() to restart the hashing process.
Definition at line 133 of file ascon-prf.c.
| int ascon_prf_short | ( | unsigned char * | out, |
| size_t | outlen, | ||
| const unsigned char * | in, | ||
| size_t | inlen, | ||
| const unsigned char * | key | ||
| ) |
Processes a key and input data with ASCON-PrfShort to produce a tag.
| out | Buffer to receive the PRF tag which must be at least outlen bytes in length. |
| outlen | Length of the output buffer in bytes between 0 and ASCON_PRF_SHORT_MAX_OUTPUT_SIZE. |
| in | Points to the input data to be processed. |
| inlen | Length of the input data in bytes between 0 and ASCON_PRF_SHORT_MAX_INPUT_SIZE. |
| key | Points to the ASCON_PRF_KEY_SIZE bytes of the key. |
Definition at line 62 of file ascon-prf.c.
| void ascon_prf_squeeze | ( | ascon_prf_state_t * | state, |
| unsigned char * | out, | ||
| size_t | outlen | ||
| ) |
Squeezes output from an incremental ASCON-Prf operation.
| state | PRF state to squeeze output from. |
| out | Points to the output buffer to receive the output. |
| outlen | Number of bytes of output that are required for this call. |
This function can be called any number of times until all desired output has been retrieved.
Definition at line 207 of file ascon-prf.c.