|
RetroArch
|
#include "mbedtls/config.h"#include "mbedtls/ccm.h"#include <string.h>#include "mbedtls/platform.h"#include "arc4_alt.h"Macros | |
| #define | CCM_ENCRYPT 0 |
| #define | CCM_DECRYPT 1 |
| #define | UPDATE_CBC_MAC |
| #define | CTR_CRYPT(dst, src, len) |
| #define | NB_TESTS 3 |
Functions | |
| void | mbedtls_ccm_init (mbedtls_ccm_context *ctx) |
| Initialize CCM context (just makes references valid) Makes the context ready for mbedtls_ccm_setkey() or mbedtls_ccm_free(). More... | |
| int | mbedtls_ccm_setkey (mbedtls_ccm_context *ctx, mbedtls_cipher_id_t cipher, const unsigned char *key, unsigned int keybits) |
| CCM initialization (encryption and decryption) More... | |
| void | mbedtls_ccm_free (mbedtls_ccm_context *ctx) |
| Free a CCM context and underlying cipher sub-context. More... | |
| static int | ccm_auth_crypt (mbedtls_ccm_context *ctx, int mode, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *add, size_t add_len, const unsigned char *input, unsigned char *output, unsigned char *tag, size_t tag_len) |
| int | mbedtls_ccm_encrypt_and_tag (mbedtls_ccm_context *ctx, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *add, size_t add_len, const unsigned char *input, unsigned char *output, unsigned char *tag, size_t tag_len) |
| CCM buffer encryption. More... | |
| int | mbedtls_ccm_auth_decrypt (mbedtls_ccm_context *ctx, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *add, size_t add_len, const unsigned char *input, unsigned char *output, const unsigned char *tag, size_t tag_len) |
| CCM buffer authenticated decryption. More... | |
| int | mbedtls_ccm_self_test (int verbose) |
| Checkup routine. More... | |
Variables | |
| static const unsigned char | ccm_key [] |
| static const unsigned char | iv [] |
| static const unsigned char | ad [] |
| static const unsigned char | msg [] |
| static const size_t | iv_len [NB_TESTS] = { 7, 8, 12 } |
| static const size_t | add_len [NB_TESTS] = { 8, 16, 20 } |
| static const size_t | msg_len [NB_TESTS] = { 4, 16, 24 } |
| static const size_t | tag_len [NB_TESTS] = { 4, 6, 8 } |
| static const unsigned char | res [NB_TESTS][32] |
| #define CCM_DECRYPT 1 |
| #define CCM_ENCRYPT 0 |
| #define NB_TESTS 3 |
| #define UPDATE_CBC_MAC |
|
static |
| int mbedtls_ccm_auth_decrypt | ( | mbedtls_ccm_context * | ctx, |
| size_t | length, | ||
| const unsigned char * | iv, | ||
| size_t | iv_len, | ||
| const unsigned char * | add, | ||
| size_t | add_len, | ||
| const unsigned char * | input, | ||
| unsigned char * | output, | ||
| const unsigned char * | tag, | ||
| size_t | tag_len | ||
| ) |
CCM buffer authenticated decryption.
| ctx | CCM context |
| length | length of the input data |
| iv | initialization vector |
| iv_len | length of IV |
| add | additional data |
| add_len | length of additional data |
| input | buffer holding the input data |
| output | buffer for holding the output data |
| tag | buffer holding the tag |
| tag_len | length of the tag |
| int mbedtls_ccm_encrypt_and_tag | ( | mbedtls_ccm_context * | ctx, |
| size_t | length, | ||
| const unsigned char * | iv, | ||
| size_t | iv_len, | ||
| const unsigned char * | add, | ||
| size_t | add_len, | ||
| const unsigned char * | input, | ||
| unsigned char * | output, | ||
| unsigned char * | tag, | ||
| size_t | tag_len | ||
| ) |
CCM buffer encryption.
| ctx | CCM context |
| length | length of the input data in bytes |
| iv | nonce (initialization vector) |
| iv_len | length of IV in bytes must be 2, 3, 4, 5, 6, 7 or 8 |
| add | additional data |
| add_len | length of additional data in bytes must be less than 2^16 - 2^8 |
| input | buffer holding the input data |
| output | buffer for holding the output data must be at least 'length' bytes wide |
| tag | buffer for holding the tag |
| tag_len | length of the tag to generate in bytes must be 4, 6, 8, 10, 14 or 16 |
| void mbedtls_ccm_free | ( | mbedtls_ccm_context * | ctx | ) |
Free a CCM context and underlying cipher sub-context.
| ctx | CCM context to free |
| void mbedtls_ccm_init | ( | mbedtls_ccm_context * | ctx | ) |
Initialize CCM context (just makes references valid) Makes the context ready for mbedtls_ccm_setkey() or mbedtls_ccm_free().
| ctx | CCM context to initialize |
| int mbedtls_ccm_self_test | ( | int | verbose | ) |
Checkup routine.
| int mbedtls_ccm_setkey | ( | mbedtls_ccm_context * | ctx, |
| mbedtls_cipher_id_t | cipher, | ||
| const unsigned char * | key, | ||
| unsigned int | keybits | ||
| ) |
CCM initialization (encryption and decryption)
| ctx | CCM context to be initialized |
| cipher | cipher to use (a 128-bit block cipher) |
| key | encryption key |
| keybits | key size in bits (must be acceptable by the cipher) |
|
static |
|
static |
|
static |
|
static |
1.8.15