#include "common.h"
#if defined(MBEDTLS_NIST_KW_C)
#include "mbedtls/nist_kw.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/constant_time.h"
#include "constant_time_internal.h"
#include <stdint.h>
#include <string.h>
#include "mbedtls/platform.h"
#if !defined(MBEDTLS_NIST_KW_ALT)
#define KW_SEMIBLOCK_LENGTH …
#define MIN_SEMIBLOCKS_COUNT …
static const unsigned char NIST_KW_ICV1[] = …;
static const unsigned char NIST_KW_ICV2[] = …;
void mbedtls_nist_kw_init(mbedtls_nist_kw_context *ctx)
{ … }
int mbedtls_nist_kw_setkey(mbedtls_nist_kw_context *ctx,
mbedtls_cipher_id_t cipher,
const unsigned char *key,
unsigned int keybits,
const int is_wrap)
{ … }
void mbedtls_nist_kw_free(mbedtls_nist_kw_context *ctx)
{ … }
static void calc_a_xor_t(unsigned char A[KW_SEMIBLOCK_LENGTH], uint64_t t)
{ … }
int mbedtls_nist_kw_wrap(mbedtls_nist_kw_context *ctx,
mbedtls_nist_kw_mode_t mode,
const unsigned char *input, size_t in_len,
unsigned char *output, size_t *out_len, size_t out_size)
{ … }
static int unwrap(mbedtls_nist_kw_context *ctx,
const unsigned char *input, size_t semiblocks,
unsigned char A[KW_SEMIBLOCK_LENGTH],
unsigned char *output, size_t *out_len)
{ … }
int mbedtls_nist_kw_unwrap(mbedtls_nist_kw_context *ctx,
mbedtls_nist_kw_mode_t mode,
const unsigned char *input, size_t in_len,
unsigned char *output, size_t *out_len, size_t out_size)
{ … }
#endif
#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
static const unsigned int key_len[] = …;
static const unsigned char kw_key[][32] = …;
static const unsigned char kw_msg[][40] = …;
static const size_t kw_msg_len[] = …;
static const size_t kw_out_len[] = …;
static const unsigned char kw_res[][48] = …;
static const unsigned char kwp_key[][32] = …;
static const unsigned char kwp_msg[][31] = …;
static const size_t kwp_msg_len[] = …;
static const unsigned char kwp_res[][48] = …;
static const size_t kwp_out_len[] = …;
int mbedtls_nist_kw_self_test(int verbose)
{ … }
#endif
#endif