Use look-up table for base
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
0ffb68ee3f
commit
de3de773e6
4 changed files with 211 additions and 99 deletions
|
@ -275,8 +275,8 @@ typedef struct mbedtls_cipher_info_t {
|
|||
/** Name of the cipher. */
|
||||
const char *MBEDTLS_PRIVATE(name);
|
||||
|
||||
/** Struct for base cipher information and functions. */
|
||||
const mbedtls_cipher_base_t *MBEDTLS_PRIVATE(base);
|
||||
/** Index to LUT for base cipher information and functions. */
|
||||
uint8_t MBEDTLS_PRIVATE(base_idx) : 5;
|
||||
|
||||
/** Full cipher identifier. For example,
|
||||
* MBEDTLS_CIPHER_AES_256_CBC.
|
||||
|
|
|
@ -67,6 +67,10 @@
|
|||
|
||||
static int supported_init = 0;
|
||||
|
||||
static inline const mbedtls_cipher_base_t* mbedtls_cipher_get_base(const mbedtls_cipher_info_t *info) {
|
||||
return mbedtls_cipher_base_lookup_table[info->base_idx];
|
||||
}
|
||||
|
||||
const int *mbedtls_cipher_list(void)
|
||||
{
|
||||
const mbedtls_cipher_definition_t *def;
|
||||
|
@ -128,7 +132,7 @@ const mbedtls_cipher_info_t *mbedtls_cipher_info_from_values(
|
|||
const mbedtls_cipher_definition_t *def;
|
||||
|
||||
for (def = mbedtls_cipher_definitions; def->info != NULL; def++) {
|
||||
if (def->info->base->cipher == cipher_id &&
|
||||
if (mbedtls_cipher_get_base(def->info)->cipher == cipher_id &&
|
||||
mbedtls_cipher_info_get_key_bitlen(def->info) == (unsigned) key_bitlen &&
|
||||
def->info->mode == mode) {
|
||||
return def->info;
|
||||
|
@ -178,7 +182,7 @@ void mbedtls_cipher_free(mbedtls_cipher_context_t *ctx)
|
|||
#endif
|
||||
|
||||
if (ctx->cipher_ctx) {
|
||||
ctx->cipher_info->base->ctx_free_func(ctx->cipher_ctx);
|
||||
mbedtls_cipher_get_base(ctx->cipher_info)->ctx_free_func(ctx->cipher_ctx);
|
||||
}
|
||||
|
||||
mbedtls_platform_zeroize(ctx, sizeof(mbedtls_cipher_context_t));
|
||||
|
@ -193,7 +197,7 @@ int mbedtls_cipher_setup(mbedtls_cipher_context_t *ctx,
|
|||
|
||||
memset(ctx, 0, sizeof(mbedtls_cipher_context_t));
|
||||
|
||||
if (NULL == (ctx->cipher_ctx = cipher_info->base->ctx_alloc_func())) {
|
||||
if (NULL == (ctx->cipher_ctx = mbedtls_cipher_get_base(cipher_info)->ctx_alloc_func())) {
|
||||
return MBEDTLS_ERR_CIPHER_ALLOC_FAILED;
|
||||
}
|
||||
|
||||
|
@ -337,12 +341,12 @@ int mbedtls_cipher_setkey(mbedtls_cipher_context_t *ctx,
|
|||
MBEDTLS_MODE_CFB == ctx->cipher_info->mode ||
|
||||
MBEDTLS_MODE_OFB == ctx->cipher_info->mode ||
|
||||
MBEDTLS_MODE_CTR == ctx->cipher_info->mode) {
|
||||
return ctx->cipher_info->base->setkey_enc_func(ctx->cipher_ctx, key,
|
||||
return mbedtls_cipher_get_base(ctx->cipher_info)->setkey_enc_func(ctx->cipher_ctx, key,
|
||||
ctx->key_bitlen);
|
||||
}
|
||||
|
||||
if (MBEDTLS_DECRYPT == operation) {
|
||||
return ctx->cipher_info->base->setkey_dec_func(ctx->cipher_ctx, key,
|
||||
return mbedtls_cipher_get_base(ctx->cipher_info)->setkey_dec_func(ctx->cipher_ctx, key,
|
||||
ctx->key_bitlen);
|
||||
}
|
||||
|
||||
|
@ -548,7 +552,7 @@ int mbedtls_cipher_update(mbedtls_cipher_context_t *ctx, const unsigned char *in
|
|||
|
||||
*olen = ilen;
|
||||
|
||||
if (0 != (ret = ctx->cipher_info->base->ecb_func(ctx->cipher_ctx,
|
||||
if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->ecb_func(ctx->cipher_ctx,
|
||||
ctx->operation, input, output))) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -614,7 +618,7 @@ int mbedtls_cipher_update(mbedtls_cipher_context_t *ctx, const unsigned char *in
|
|||
memcpy(&(ctx->unprocessed_data[ctx->unprocessed_len]), input,
|
||||
copy_len);
|
||||
|
||||
if (0 != (ret = ctx->cipher_info->base->cbc_func(ctx->cipher_ctx,
|
||||
if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->cbc_func(ctx->cipher_ctx,
|
||||
ctx->operation, block_size, ctx->iv,
|
||||
ctx->unprocessed_data, output))) {
|
||||
return ret;
|
||||
|
@ -654,7 +658,7 @@ int mbedtls_cipher_update(mbedtls_cipher_context_t *ctx, const unsigned char *in
|
|||
* Process remaining full blocks
|
||||
*/
|
||||
if (ilen) {
|
||||
if (0 != (ret = ctx->cipher_info->base->cbc_func(ctx->cipher_ctx,
|
||||
if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->cbc_func(ctx->cipher_ctx,
|
||||
ctx->operation, ilen, ctx->iv, input,
|
||||
output))) {
|
||||
return ret;
|
||||
|
@ -669,7 +673,7 @@ int mbedtls_cipher_update(mbedtls_cipher_context_t *ctx, const unsigned char *in
|
|||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
||||
if (ctx->cipher_info->mode == MBEDTLS_MODE_CFB) {
|
||||
if (0 != (ret = ctx->cipher_info->base->cfb_func(ctx->cipher_ctx,
|
||||
if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->cfb_func(ctx->cipher_ctx,
|
||||
ctx->operation, ilen,
|
||||
&ctx->unprocessed_len, ctx->iv,
|
||||
input, output))) {
|
||||
|
@ -684,7 +688,7 @@ int mbedtls_cipher_update(mbedtls_cipher_context_t *ctx, const unsigned char *in
|
|||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_OFB)
|
||||
if (ctx->cipher_info->mode == MBEDTLS_MODE_OFB) {
|
||||
if (0 != (ret = ctx->cipher_info->base->ofb_func(ctx->cipher_ctx,
|
||||
if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->ofb_func(ctx->cipher_ctx,
|
||||
ilen, &ctx->unprocessed_len, ctx->iv,
|
||||
input, output))) {
|
||||
return ret;
|
||||
|
@ -698,7 +702,7 @@ int mbedtls_cipher_update(mbedtls_cipher_context_t *ctx, const unsigned char *in
|
|||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
||||
if (ctx->cipher_info->mode == MBEDTLS_MODE_CTR) {
|
||||
if (0 != (ret = ctx->cipher_info->base->ctr_func(ctx->cipher_ctx,
|
||||
if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->ctr_func(ctx->cipher_ctx,
|
||||
ilen, &ctx->unprocessed_len, ctx->iv,
|
||||
ctx->unprocessed_data, input, output))) {
|
||||
return ret;
|
||||
|
@ -717,7 +721,7 @@ int mbedtls_cipher_update(mbedtls_cipher_context_t *ctx, const unsigned char *in
|
|||
return MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
|
||||
}
|
||||
|
||||
ret = ctx->cipher_info->base->xts_func(ctx->cipher_ctx,
|
||||
ret = mbedtls_cipher_get_base(ctx->cipher_info)->xts_func(ctx->cipher_ctx,
|
||||
ctx->operation, ilen, ctx->iv, input, output);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
|
@ -731,7 +735,7 @@ int mbedtls_cipher_update(mbedtls_cipher_context_t *ctx, const unsigned char *in
|
|||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_STREAM)
|
||||
if (ctx->cipher_info->mode == MBEDTLS_MODE_STREAM) {
|
||||
if (0 != (ret = ctx->cipher_info->base->stream_func(ctx->cipher_ctx,
|
||||
if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->stream_func(ctx->cipher_ctx,
|
||||
ilen, input, output))) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -996,7 +1000,7 @@ int mbedtls_cipher_finish(mbedtls_cipher_context_t *ctx,
|
|||
}
|
||||
|
||||
/* cipher block */
|
||||
if (0 != (ret = ctx->cipher_info->base->cbc_func(ctx->cipher_ctx,
|
||||
if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->cbc_func(ctx->cipher_ctx,
|
||||
ctx->operation,
|
||||
mbedtls_cipher_get_block_size(ctx),
|
||||
ctx->iv,
|
||||
|
|
|
@ -70,6 +70,24 @@
|
|||
|
||||
#include "mbedtls/platform.h"
|
||||
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_AES 0
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_ARIA 1
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA 2
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_CCM_AES 3
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_CCM_ARIA 4
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_CCM_CAMELLIA 5
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_CHACHA20_BASE 6
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_CHACHAPOLY_BASE 7
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_DES_EDE3 8
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_DES_EDE 9
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_DES 10
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_GCM_AES 11
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_GCM_ARIA 12
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_GCM_CAMELLIA 13
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_KW_AES 14
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_NULL_BASE 15
|
||||
#define MBEDTLS_CIPHER_BASE_INDEX_XTS_AES 16
|
||||
|
||||
#if defined(MBEDTLS_GCM_C)
|
||||
/* shared by all GCM ciphers */
|
||||
static void *gcm_ctx_alloc(void)
|
||||
|
@ -242,7 +260,7 @@ static const mbedtls_cipher_base_t aes_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_128_ecb_info = {
|
||||
"AES-128-ECB",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_128_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -253,7 +271,7 @@ static const mbedtls_cipher_info_t aes_128_ecb_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_192_ecb_info = {
|
||||
"AES-192-ECB",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_192_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -264,7 +282,7 @@ static const mbedtls_cipher_info_t aes_192_ecb_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_256_ecb_info = {
|
||||
"AES-256-ECB",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_256_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -276,7 +294,7 @@ static const mbedtls_cipher_info_t aes_256_ecb_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||
static const mbedtls_cipher_info_t aes_128_cbc_info = {
|
||||
"AES-128-CBC",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_128_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -287,7 +305,7 @@ static const mbedtls_cipher_info_t aes_128_cbc_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_192_cbc_info = {
|
||||
"AES-192-CBC",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_192_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -298,7 +316,7 @@ static const mbedtls_cipher_info_t aes_192_cbc_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_256_cbc_info = {
|
||||
"AES-256-CBC",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_256_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -311,7 +329,7 @@ static const mbedtls_cipher_info_t aes_256_cbc_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
||||
static const mbedtls_cipher_info_t aes_128_cfb128_info = {
|
||||
"AES-128-CFB128",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_128_CFB128,
|
||||
MBEDTLS_MODE_CFB,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -322,7 +340,7 @@ static const mbedtls_cipher_info_t aes_128_cfb128_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_192_cfb128_info = {
|
||||
"AES-192-CFB128",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_192_CFB128,
|
||||
MBEDTLS_MODE_CFB,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -333,7 +351,7 @@ static const mbedtls_cipher_info_t aes_192_cfb128_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_256_cfb128_info = {
|
||||
"AES-256-CFB128",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_256_CFB128,
|
||||
MBEDTLS_MODE_CFB,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -346,7 +364,7 @@ static const mbedtls_cipher_info_t aes_256_cfb128_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_OFB)
|
||||
static const mbedtls_cipher_info_t aes_128_ofb_info = {
|
||||
"AES-128-OFB",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_128_OFB,
|
||||
MBEDTLS_MODE_OFB,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -357,7 +375,7 @@ static const mbedtls_cipher_info_t aes_128_ofb_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_192_ofb_info = {
|
||||
"AES-192-OFB",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_192_OFB,
|
||||
MBEDTLS_MODE_OFB,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -368,7 +386,7 @@ static const mbedtls_cipher_info_t aes_192_ofb_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_256_ofb_info = {
|
||||
"AES-256-OFB",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_256_OFB,
|
||||
MBEDTLS_MODE_OFB,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -381,7 +399,7 @@ static const mbedtls_cipher_info_t aes_256_ofb_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
||||
static const mbedtls_cipher_info_t aes_128_ctr_info = {
|
||||
"AES-128-CTR",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_128_CTR,
|
||||
MBEDTLS_MODE_CTR,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -392,7 +410,7 @@ static const mbedtls_cipher_info_t aes_128_ctr_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_192_ctr_info = {
|
||||
"AES-192-CTR",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_192_CTR,
|
||||
MBEDTLS_MODE_CTR,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -403,7 +421,7 @@ static const mbedtls_cipher_info_t aes_192_ctr_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_256_ctr_info = {
|
||||
"AES-256-CTR",
|
||||
&aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_AES,
|
||||
MBEDTLS_CIPHER_AES_256_CTR,
|
||||
MBEDTLS_MODE_CTR,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -480,7 +498,7 @@ static const mbedtls_cipher_base_t xts_aes_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_128_xts_info = {
|
||||
"AES-128-XTS",
|
||||
&xts_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_XTS_AES,
|
||||
MBEDTLS_CIPHER_AES_128_XTS,
|
||||
MBEDTLS_MODE_XTS,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -491,7 +509,7 @@ static const mbedtls_cipher_info_t aes_128_xts_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_256_xts_info = {
|
||||
"AES-256-XTS",
|
||||
&xts_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_XTS_AES,
|
||||
MBEDTLS_CIPHER_AES_256_XTS,
|
||||
MBEDTLS_MODE_XTS,
|
||||
512 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -538,7 +556,7 @@ static const mbedtls_cipher_base_t gcm_aes_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_128_gcm_info = {
|
||||
"AES-128-GCM",
|
||||
&gcm_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_GCM_AES,
|
||||
MBEDTLS_CIPHER_AES_128_GCM,
|
||||
MBEDTLS_MODE_GCM,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -549,7 +567,7 @@ static const mbedtls_cipher_info_t aes_128_gcm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_192_gcm_info = {
|
||||
"AES-192-GCM",
|
||||
&gcm_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_GCM_AES,
|
||||
MBEDTLS_CIPHER_AES_192_GCM,
|
||||
MBEDTLS_MODE_GCM,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -560,7 +578,7 @@ static const mbedtls_cipher_info_t aes_192_gcm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_256_gcm_info = {
|
||||
"AES-256-GCM",
|
||||
&gcm_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_GCM_AES,
|
||||
MBEDTLS_CIPHER_AES_256_GCM,
|
||||
MBEDTLS_MODE_GCM,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -607,7 +625,7 @@ static const mbedtls_cipher_base_t ccm_aes_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_128_ccm_info = {
|
||||
"AES-128-CCM",
|
||||
&ccm_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_AES,
|
||||
MBEDTLS_CIPHER_AES_128_CCM,
|
||||
MBEDTLS_MODE_CCM,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -618,7 +636,7 @@ static const mbedtls_cipher_info_t aes_128_ccm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_192_ccm_info = {
|
||||
"AES-192-CCM",
|
||||
&ccm_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_AES,
|
||||
MBEDTLS_CIPHER_AES_192_CCM,
|
||||
MBEDTLS_MODE_CCM,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -629,7 +647,7 @@ static const mbedtls_cipher_info_t aes_192_ccm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_256_ccm_info = {
|
||||
"AES-256-CCM",
|
||||
&ccm_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_AES,
|
||||
MBEDTLS_CIPHER_AES_256_CCM,
|
||||
MBEDTLS_MODE_CCM,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -640,7 +658,7 @@ static const mbedtls_cipher_info_t aes_256_ccm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_128_ccm_star_no_tag_info = {
|
||||
"AES-128-CCM*-NO-TAG",
|
||||
&ccm_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_AES,
|
||||
MBEDTLS_CIPHER_AES_128_CCM_STAR_NO_TAG,
|
||||
MBEDTLS_MODE_CCM_STAR_NO_TAG,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -651,7 +669,7 @@ static const mbedtls_cipher_info_t aes_128_ccm_star_no_tag_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_192_ccm_star_no_tag_info = {
|
||||
"AES-192-CCM*-NO-TAG",
|
||||
&ccm_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_AES,
|
||||
MBEDTLS_CIPHER_AES_192_CCM_STAR_NO_TAG,
|
||||
MBEDTLS_MODE_CCM_STAR_NO_TAG,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -662,7 +680,7 @@ static const mbedtls_cipher_info_t aes_192_ccm_star_no_tag_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_256_ccm_star_no_tag_info = {
|
||||
"AES-256-CCM*-NO-TAG",
|
||||
&ccm_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_AES,
|
||||
MBEDTLS_CIPHER_AES_256_CCM_STAR_NO_TAG,
|
||||
MBEDTLS_MODE_CCM_STAR_NO_TAG,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -774,7 +792,7 @@ static const mbedtls_cipher_base_t camellia_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_128_ecb_info = {
|
||||
"CAMELLIA-128-ECB",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_128_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -785,7 +803,7 @@ static const mbedtls_cipher_info_t camellia_128_ecb_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_192_ecb_info = {
|
||||
"CAMELLIA-192-ECB",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_192_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -796,7 +814,7 @@ static const mbedtls_cipher_info_t camellia_192_ecb_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_256_ecb_info = {
|
||||
"CAMELLIA-256-ECB",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_256_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -808,7 +826,7 @@ static const mbedtls_cipher_info_t camellia_256_ecb_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||
static const mbedtls_cipher_info_t camellia_128_cbc_info = {
|
||||
"CAMELLIA-128-CBC",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_128_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -819,7 +837,7 @@ static const mbedtls_cipher_info_t camellia_128_cbc_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_192_cbc_info = {
|
||||
"CAMELLIA-192-CBC",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_192_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -830,7 +848,7 @@ static const mbedtls_cipher_info_t camellia_192_cbc_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_256_cbc_info = {
|
||||
"CAMELLIA-256-CBC",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_256_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -843,7 +861,7 @@ static const mbedtls_cipher_info_t camellia_256_cbc_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
||||
static const mbedtls_cipher_info_t camellia_128_cfb128_info = {
|
||||
"CAMELLIA-128-CFB128",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_128_CFB128,
|
||||
MBEDTLS_MODE_CFB,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -854,7 +872,7 @@ static const mbedtls_cipher_info_t camellia_128_cfb128_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_192_cfb128_info = {
|
||||
"CAMELLIA-192-CFB128",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_192_CFB128,
|
||||
MBEDTLS_MODE_CFB,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -865,7 +883,7 @@ static const mbedtls_cipher_info_t camellia_192_cfb128_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_256_cfb128_info = {
|
||||
"CAMELLIA-256-CFB128",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_256_CFB128,
|
||||
MBEDTLS_MODE_CFB,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -878,7 +896,7 @@ static const mbedtls_cipher_info_t camellia_256_cfb128_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
||||
static const mbedtls_cipher_info_t camellia_128_ctr_info = {
|
||||
"CAMELLIA-128-CTR",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_128_CTR,
|
||||
MBEDTLS_MODE_CTR,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -889,7 +907,7 @@ static const mbedtls_cipher_info_t camellia_128_ctr_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_192_ctr_info = {
|
||||
"CAMELLIA-192-CTR",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_192_CTR,
|
||||
MBEDTLS_MODE_CTR,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -900,7 +918,7 @@ static const mbedtls_cipher_info_t camellia_192_ctr_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_256_ctr_info = {
|
||||
"CAMELLIA-256-CTR",
|
||||
&camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_256_CTR,
|
||||
MBEDTLS_MODE_CTR,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -947,7 +965,7 @@ static const mbedtls_cipher_base_t gcm_camellia_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_128_gcm_info = {
|
||||
"CAMELLIA-128-GCM",
|
||||
&gcm_camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_GCM_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_128_GCM,
|
||||
MBEDTLS_MODE_GCM,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -958,7 +976,7 @@ static const mbedtls_cipher_info_t camellia_128_gcm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_192_gcm_info = {
|
||||
"CAMELLIA-192-GCM",
|
||||
&gcm_camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_GCM_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_192_GCM,
|
||||
MBEDTLS_MODE_GCM,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -969,7 +987,7 @@ static const mbedtls_cipher_info_t camellia_192_gcm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_256_gcm_info = {
|
||||
"CAMELLIA-256-GCM",
|
||||
&gcm_camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_GCM_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_256_GCM,
|
||||
MBEDTLS_MODE_GCM,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1016,7 +1034,7 @@ static const mbedtls_cipher_base_t ccm_camellia_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_128_ccm_info = {
|
||||
"CAMELLIA-128-CCM",
|
||||
&ccm_camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_128_CCM,
|
||||
MBEDTLS_MODE_CCM,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1027,7 +1045,7 @@ static const mbedtls_cipher_info_t camellia_128_ccm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_192_ccm_info = {
|
||||
"CAMELLIA-192-CCM",
|
||||
&ccm_camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_192_CCM,
|
||||
MBEDTLS_MODE_CCM,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1038,7 +1056,7 @@ static const mbedtls_cipher_info_t camellia_192_ccm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_256_ccm_info = {
|
||||
"CAMELLIA-256-CCM",
|
||||
&ccm_camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_256_CCM,
|
||||
MBEDTLS_MODE_CCM,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1049,7 +1067,7 @@ static const mbedtls_cipher_info_t camellia_256_ccm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_128_ccm_star_no_tag_info = {
|
||||
"CAMELLIA-128-CCM*-NO-TAG",
|
||||
&ccm_camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_128_CCM_STAR_NO_TAG,
|
||||
MBEDTLS_MODE_CCM_STAR_NO_TAG,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1060,7 +1078,7 @@ static const mbedtls_cipher_info_t camellia_128_ccm_star_no_tag_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_192_ccm_star_no_tag_info = {
|
||||
"CAMELLIA-192-CCM*-NO-TAG",
|
||||
&ccm_camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_192_CCM_STAR_NO_TAG,
|
||||
MBEDTLS_MODE_CCM_STAR_NO_TAG,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1071,7 +1089,7 @@ static const mbedtls_cipher_info_t camellia_192_ccm_star_no_tag_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t camellia_256_ccm_star_no_tag_info = {
|
||||
"CAMELLIA-256-CCM*-NO-TAG",
|
||||
&ccm_camellia_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_CAMELLIA,
|
||||
MBEDTLS_CIPHER_CAMELLIA_256_CCM_STAR_NO_TAG,
|
||||
MBEDTLS_MODE_CCM_STAR_NO_TAG,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1184,7 +1202,7 @@ static const mbedtls_cipher_base_t aria_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_128_ecb_info = {
|
||||
"ARIA-128-ECB",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_128_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1195,7 +1213,7 @@ static const mbedtls_cipher_info_t aria_128_ecb_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_192_ecb_info = {
|
||||
"ARIA-192-ECB",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_192_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1206,7 +1224,7 @@ static const mbedtls_cipher_info_t aria_192_ecb_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_256_ecb_info = {
|
||||
"ARIA-256-ECB",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_256_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1218,7 +1236,7 @@ static const mbedtls_cipher_info_t aria_256_ecb_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||
static const mbedtls_cipher_info_t aria_128_cbc_info = {
|
||||
"ARIA-128-CBC",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_128_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1229,7 +1247,7 @@ static const mbedtls_cipher_info_t aria_128_cbc_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_192_cbc_info = {
|
||||
"ARIA-192-CBC",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_192_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1240,7 +1258,7 @@ static const mbedtls_cipher_info_t aria_192_cbc_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_256_cbc_info = {
|
||||
"ARIA-256-CBC",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_256_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1253,7 +1271,7 @@ static const mbedtls_cipher_info_t aria_256_cbc_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
||||
static const mbedtls_cipher_info_t aria_128_cfb128_info = {
|
||||
"ARIA-128-CFB128",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_128_CFB128,
|
||||
MBEDTLS_MODE_CFB,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1264,7 +1282,7 @@ static const mbedtls_cipher_info_t aria_128_cfb128_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_192_cfb128_info = {
|
||||
"ARIA-192-CFB128",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_192_CFB128,
|
||||
MBEDTLS_MODE_CFB,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1275,7 +1293,7 @@ static const mbedtls_cipher_info_t aria_192_cfb128_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_256_cfb128_info = {
|
||||
"ARIA-256-CFB128",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_256_CFB128,
|
||||
MBEDTLS_MODE_CFB,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1288,7 +1306,7 @@ static const mbedtls_cipher_info_t aria_256_cfb128_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
||||
static const mbedtls_cipher_info_t aria_128_ctr_info = {
|
||||
"ARIA-128-CTR",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_128_CTR,
|
||||
MBEDTLS_MODE_CTR,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1299,7 +1317,7 @@ static const mbedtls_cipher_info_t aria_128_ctr_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_192_ctr_info = {
|
||||
"ARIA-192-CTR",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_192_CTR,
|
||||
MBEDTLS_MODE_CTR,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1310,7 +1328,7 @@ static const mbedtls_cipher_info_t aria_192_ctr_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_256_ctr_info = {
|
||||
"ARIA-256-CTR",
|
||||
&aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_256_CTR,
|
||||
MBEDTLS_MODE_CTR,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1357,7 +1375,7 @@ static const mbedtls_cipher_base_t gcm_aria_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_128_gcm_info = {
|
||||
"ARIA-128-GCM",
|
||||
&gcm_aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_GCM_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_128_GCM,
|
||||
MBEDTLS_MODE_GCM,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1368,7 +1386,7 @@ static const mbedtls_cipher_info_t aria_128_gcm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_192_gcm_info = {
|
||||
"ARIA-192-GCM",
|
||||
&gcm_aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_GCM_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_192_GCM,
|
||||
MBEDTLS_MODE_GCM,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1379,7 +1397,7 @@ static const mbedtls_cipher_info_t aria_192_gcm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_256_gcm_info = {
|
||||
"ARIA-256-GCM",
|
||||
&gcm_aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_GCM_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_256_GCM,
|
||||
MBEDTLS_MODE_GCM,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1426,7 +1444,7 @@ static const mbedtls_cipher_base_t ccm_aria_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_128_ccm_info = {
|
||||
"ARIA-128-CCM",
|
||||
&ccm_aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_128_CCM,
|
||||
MBEDTLS_MODE_CCM,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1437,7 +1455,7 @@ static const mbedtls_cipher_info_t aria_128_ccm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_192_ccm_info = {
|
||||
"ARIA-192-CCM",
|
||||
&ccm_aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_192_CCM,
|
||||
MBEDTLS_MODE_CCM,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1448,7 +1466,7 @@ static const mbedtls_cipher_info_t aria_192_ccm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_256_ccm_info = {
|
||||
"ARIA-256-CCM",
|
||||
&ccm_aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_256_CCM,
|
||||
MBEDTLS_MODE_CCM,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1459,7 +1477,7 @@ static const mbedtls_cipher_info_t aria_256_ccm_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_128_ccm_star_no_tag_info = {
|
||||
"ARIA-128-CCM*-NO-TAG",
|
||||
&ccm_aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_128_CCM_STAR_NO_TAG,
|
||||
MBEDTLS_MODE_CCM_STAR_NO_TAG,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1470,7 +1488,7 @@ static const mbedtls_cipher_info_t aria_128_ccm_star_no_tag_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_192_ccm_star_no_tag_info = {
|
||||
"ARIA-192-CCM*-NO-TAG",
|
||||
&ccm_aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_192_CCM_STAR_NO_TAG,
|
||||
MBEDTLS_MODE_CCM_STAR_NO_TAG,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1481,7 +1499,7 @@ static const mbedtls_cipher_info_t aria_192_ccm_star_no_tag_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aria_256_ccm_star_no_tag_info = {
|
||||
"ARIA-256-CCM*-NO-TAG",
|
||||
&ccm_aria_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CCM_ARIA,
|
||||
MBEDTLS_CIPHER_ARIA_256_CCM_STAR_NO_TAG,
|
||||
MBEDTLS_MODE_CCM_STAR_NO_TAG,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1643,7 +1661,7 @@ static const mbedtls_cipher_base_t des_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t des_ecb_info = {
|
||||
"DES-ECB",
|
||||
&des_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_DES,
|
||||
MBEDTLS_CIPHER_DES_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
MBEDTLS_KEY_LENGTH_DES >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1655,7 +1673,7 @@ static const mbedtls_cipher_info_t des_ecb_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||
static const mbedtls_cipher_info_t des_cbc_info = {
|
||||
"DES-CBC",
|
||||
&des_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_DES,
|
||||
MBEDTLS_CIPHER_DES_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
MBEDTLS_KEY_LENGTH_DES >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1694,7 +1712,7 @@ static const mbedtls_cipher_base_t des_ede_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t des_ede_ecb_info = {
|
||||
"DES-EDE-ECB",
|
||||
&des_ede_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_DES_EDE,
|
||||
MBEDTLS_CIPHER_DES_EDE_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
MBEDTLS_KEY_LENGTH_DES_EDE >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1706,7 +1724,7 @@ static const mbedtls_cipher_info_t des_ede_ecb_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||
static const mbedtls_cipher_info_t des_ede_cbc_info = {
|
||||
"DES-EDE-CBC",
|
||||
&des_ede_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_DES_EDE,
|
||||
MBEDTLS_CIPHER_DES_EDE_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
MBEDTLS_KEY_LENGTH_DES_EDE >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1745,7 +1763,7 @@ static const mbedtls_cipher_base_t des_ede3_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t des_ede3_ecb_info = {
|
||||
"DES-EDE3-ECB",
|
||||
&des_ede3_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_DES_EDE3,
|
||||
MBEDTLS_CIPHER_DES_EDE3_ECB,
|
||||
MBEDTLS_MODE_ECB,
|
||||
MBEDTLS_KEY_LENGTH_DES_EDE3 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1756,7 +1774,7 @@ static const mbedtls_cipher_info_t des_ede3_ecb_info = {
|
|||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||
static const mbedtls_cipher_info_t des_ede3_cbc_info = {
|
||||
"DES-EDE3-CBC",
|
||||
&des_ede3_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_DES_EDE3,
|
||||
MBEDTLS_CIPHER_DES_EDE3_CBC,
|
||||
MBEDTLS_MODE_CBC,
|
||||
MBEDTLS_KEY_LENGTH_DES_EDE3 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1845,7 +1863,7 @@ static const mbedtls_cipher_base_t chacha20_base_info = {
|
|||
};
|
||||
static const mbedtls_cipher_info_t chacha20_info = {
|
||||
"CHACHA20",
|
||||
&chacha20_base_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CHACHA20_BASE,
|
||||
MBEDTLS_CIPHER_CHACHA20,
|
||||
MBEDTLS_MODE_STREAM,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1920,7 +1938,7 @@ static const mbedtls_cipher_base_t chachapoly_base_info = {
|
|||
};
|
||||
static const mbedtls_cipher_info_t chachapoly_info = {
|
||||
"CHACHA20-POLY1305",
|
||||
&chachapoly_base_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_CHACHAPOLY_BASE,
|
||||
MBEDTLS_CIPHER_CHACHA20_POLY1305,
|
||||
MBEDTLS_MODE_CHACHAPOLY,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -1989,7 +2007,7 @@ static const mbedtls_cipher_base_t null_base_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t null_cipher_info = {
|
||||
"NULL",
|
||||
&null_base_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_NULL_BASE,
|
||||
MBEDTLS_CIPHER_NULL,
|
||||
MBEDTLS_MODE_STREAM,
|
||||
0 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -2060,7 +2078,7 @@ static const mbedtls_cipher_base_t kw_aes_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_128_nist_kw_info = {
|
||||
"AES-128-KW",
|
||||
&kw_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_KW_AES,
|
||||
MBEDTLS_CIPHER_AES_128_KW,
|
||||
MBEDTLS_MODE_KW,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -2071,7 +2089,7 @@ static const mbedtls_cipher_info_t aes_128_nist_kw_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_192_nist_kw_info = {
|
||||
"AES-192-KW",
|
||||
&kw_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_KW_AES,
|
||||
MBEDTLS_CIPHER_AES_192_KW,
|
||||
MBEDTLS_MODE_KW,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -2082,7 +2100,7 @@ static const mbedtls_cipher_info_t aes_192_nist_kw_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_256_nist_kw_info = {
|
||||
"AES-256-KW",
|
||||
&kw_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_KW_AES,
|
||||
MBEDTLS_CIPHER_AES_256_KW,
|
||||
MBEDTLS_MODE_KW,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -2093,7 +2111,7 @@ static const mbedtls_cipher_info_t aes_256_nist_kw_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_128_nist_kwp_info = {
|
||||
"AES-128-KWP",
|
||||
&kw_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_KW_AES,
|
||||
MBEDTLS_CIPHER_AES_128_KWP,
|
||||
MBEDTLS_MODE_KWP,
|
||||
128 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -2104,7 +2122,7 @@ static const mbedtls_cipher_info_t aes_128_nist_kwp_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_192_nist_kwp_info = {
|
||||
"AES-192-KWP",
|
||||
&kw_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_KW_AES,
|
||||
MBEDTLS_CIPHER_AES_192_KWP,
|
||||
MBEDTLS_MODE_KWP,
|
||||
192 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -2115,7 +2133,7 @@ static const mbedtls_cipher_info_t aes_192_nist_kwp_info = {
|
|||
|
||||
static const mbedtls_cipher_info_t aes_256_nist_kwp_info = {
|
||||
"AES-256-KWP",
|
||||
&kw_aes_info,
|
||||
MBEDTLS_CIPHER_BASE_INDEX_KW_AES,
|
||||
MBEDTLS_CIPHER_AES_256_KWP,
|
||||
MBEDTLS_MODE_KWP,
|
||||
256 >> MBEDTLS_KEY_BITLEN_SHIFT,
|
||||
|
@ -2277,4 +2295,92 @@ const mbedtls_cipher_definition_t mbedtls_cipher_definitions[] =
|
|||
sizeof(mbedtls_cipher_definitions[0]))
|
||||
int mbedtls_cipher_supported[NUM_CIPHERS];
|
||||
|
||||
const mbedtls_cipher_base_t* mbedtls_cipher_base_lookup_table[] = {
|
||||
#if defined(MBEDTLS_AES_C)
|
||||
&aes_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_ARIA_C)
|
||||
&aria_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_CAMELLIA_C)
|
||||
&camellia_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_CCM_C)
|
||||
&ccm_aes_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_CCM_C)
|
||||
&ccm_aria_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_CCM_C)
|
||||
&ccm_camellia_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_CHACHA20_C)
|
||||
&chacha20_base_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_CHACHAPOLY_C)
|
||||
&chachapoly_base_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_DES_C)
|
||||
&des_ede3_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_DES_C)
|
||||
&des_ede_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_DES_C)
|
||||
&des_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_GCM_C)
|
||||
&gcm_aes_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_GCM_C)
|
||||
&gcm_aria_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_GCM_C)
|
||||
&gcm_camellia_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_NIST_KW_C)
|
||||
&kw_aes_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_CIPHER_NULL_CIPHER)
|
||||
&null_base_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
||||
&xts_aes_info,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* MBEDTLS_CIPHER_C */
|
||||
|
|
|
@ -135,6 +135,8 @@ extern const mbedtls_cipher_definition_t mbedtls_cipher_definitions[];
|
|||
|
||||
extern int mbedtls_cipher_supported[];
|
||||
|
||||
extern const mbedtls_cipher_base_t * mbedtls_cipher_base_lookup_table[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue