2021-06-24 19:31:26 +00:00
|
|
|
#ifndef COSMOPOLITAN_THIRD_PARTY_MBEDTLS_CCM_H_
|
|
|
|
#define COSMOPOLITAN_THIRD_PARTY_MBEDTLS_CCM_H_
|
2021-06-16 03:18:59 +00:00
|
|
|
#include "third_party/mbedtls/cipher.h"
|
2021-06-24 19:31:26 +00:00
|
|
|
COSMOPOLITAN_C_START_
|
2021-06-15 18:39:36 +00:00
|
|
|
|
2021-06-24 19:31:26 +00:00
|
|
|
#define MBEDTLS_ERR_CCM_BAD_INPUT \
|
2022-04-22 22:03:32 +00:00
|
|
|
-0x000D /*< Bad input parameters to the function. */
|
2021-06-24 19:31:26 +00:00
|
|
|
#define MBEDTLS_ERR_CCM_AUTH_FAILED \
|
2022-04-22 22:03:32 +00:00
|
|
|
-0x000F /*< Authenticated decryption failed. */
|
2021-06-15 18:39:36 +00:00
|
|
|
|
|
|
|
/* MBEDTLS_ERR_CCM_HW_ACCEL_FAILED is deprecated and should not be used. */
|
2021-06-24 19:31:26 +00:00
|
|
|
#define MBEDTLS_ERR_CCM_HW_ACCEL_FAILED \
|
2022-04-22 22:03:32 +00:00
|
|
|
-0x0011 /*< CCM hardware accelerator failed. */
|
2021-06-15 18:39:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief The CCM context-type definition. The CCM context is passed
|
|
|
|
* to the APIs called.
|
|
|
|
*/
|
2021-06-24 19:31:26 +00:00
|
|
|
typedef struct mbedtls_ccm_context {
|
|
|
|
mbedtls_cipher_context_t cipher_ctx; /*!< The cipher context used. */
|
|
|
|
} mbedtls_ccm_context;
|
|
|
|
|
|
|
|
void mbedtls_ccm_init(mbedtls_ccm_context *);
|
|
|
|
int mbedtls_ccm_setkey(mbedtls_ccm_context *, mbedtls_cipher_id_t,
|
|
|
|
const unsigned char *, unsigned int);
|
|
|
|
void mbedtls_ccm_free(mbedtls_ccm_context *);
|
|
|
|
int mbedtls_ccm_encrypt_and_tag(mbedtls_ccm_context *, size_t,
|
|
|
|
const unsigned char *, size_t,
|
|
|
|
const unsigned char *, size_t,
|
|
|
|
const unsigned char *, unsigned char *,
|
|
|
|
unsigned char *, size_t);
|
|
|
|
int mbedtls_ccm_star_encrypt_and_tag(mbedtls_ccm_context *, size_t,
|
|
|
|
const unsigned char *, size_t,
|
|
|
|
const unsigned char *, size_t,
|
|
|
|
const unsigned char *, unsigned char *,
|
|
|
|
unsigned char *, size_t);
|
|
|
|
int mbedtls_ccm_auth_decrypt(mbedtls_ccm_context *, size_t,
|
|
|
|
const unsigned char *, size_t,
|
|
|
|
const unsigned char *, size_t,
|
|
|
|
const unsigned char *, unsigned char *,
|
|
|
|
const unsigned char *, size_t);
|
|
|
|
int mbedtls_ccm_star_auth_decrypt(mbedtls_ccm_context *, size_t,
|
|
|
|
const unsigned char *, size_t,
|
|
|
|
const unsigned char *, size_t,
|
|
|
|
const unsigned char *, unsigned char *,
|
|
|
|
const unsigned char *, size_t);
|
|
|
|
|
|
|
|
int mbedtls_ccm_self_test(int);
|
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* COSMOPOLITAN_THIRD_PARTY_MBEDTLS_CCM_H_ */
|