OPTIGA Trust M  1.1.0
C++ library for Optiga Trust M Chip Security Controller
aria.h File Reference

ARIA block cipher. More...

#include "config.h"
#include <stddef.h>
#include <stdint.h>
#include "platform_util.h"
Include dependency graph for aria.h:

Go to the source code of this file.

Classes

struct  mbedtls_aria_context
 The ARIA context-type definition. More...
 

Macros

#define MBEDTLS_ARIA_ENCRYPT   1
 
#define MBEDTLS_ARIA_DECRYPT   0
 
#define MBEDTLS_ARIA_BLOCKSIZE   16
 
#define MBEDTLS_ARIA_MAX_ROUNDS   16
 
#define MBEDTLS_ARIA_MAX_KEYSIZE   32
 
#define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH   MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x005C )
 
#define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA   -0x005C
 
#define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH   -0x005E
 
#define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE   -0x005A
 
#define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED   -0x0058
 

Typedefs

typedef struct mbedtls_aria_context mbedtls_aria_context
 The ARIA context-type definition. More...
 

Functions

void mbedtls_aria_init (mbedtls_aria_context *ctx)
 This function initializes the specified ARIA context. More...
 
void mbedtls_aria_free (mbedtls_aria_context *ctx)
 This function releases and clears the specified ARIA context. More...
 
int mbedtls_aria_setkey_enc (mbedtls_aria_context *ctx, const unsigned char *key, unsigned int keybits)
 This function sets the encryption key. More...
 
int mbedtls_aria_setkey_dec (mbedtls_aria_context *ctx, const unsigned char *key, unsigned int keybits)
 This function sets the decryption key. More...
 
int mbedtls_aria_crypt_ecb (mbedtls_aria_context *ctx, const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE], unsigned char output[MBEDTLS_ARIA_BLOCKSIZE])
 This function performs an ARIA single-block encryption or decryption operation. More...
 

Detailed Description

ARIA block cipher.

   The ARIA algorithm is a symmetric block cipher that can encrypt and
   decrypt information. It is defined by the Korean Agency for
   Technology and Standards (KATS) in <em>KS X 1213:2004</em> (in
   Korean, but see http://210.104.33.10/ARIA/index-e.html in English)
   and also described by the IETF in <em>RFC 5794</em>.

Macro Definition Documentation

◆ MBEDTLS_ARIA_BLOCKSIZE

#define MBEDTLS_ARIA_BLOCKSIZE   16

ARIA block size in bytes.

◆ MBEDTLS_ARIA_DECRYPT

#define MBEDTLS_ARIA_DECRYPT   0

ARIA decryption.

◆ MBEDTLS_ARIA_ENCRYPT

#define MBEDTLS_ARIA_ENCRYPT   1

ARIA encryption.

◆ MBEDTLS_ARIA_MAX_KEYSIZE

#define MBEDTLS_ARIA_MAX_KEYSIZE   32

Maximum size of an ARIA key in bytes.

◆ MBEDTLS_ARIA_MAX_ROUNDS

#define MBEDTLS_ARIA_MAX_ROUNDS   16

Maxiumum number of rounds in ARIA.

◆ MBEDTLS_ERR_ARIA_BAD_INPUT_DATA

#define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA   -0x005C

Bad input data.

◆ MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE

#define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE   -0x005A

Feature not available. For example, an unsupported ARIA key size.

◆ MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED

#define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED   -0x0058

ARIA hardware accelerator failed.

◆ MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH

#define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH   -0x005E

Invalid data input length.

◆ MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH

#define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH   MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x005C )

Typedef Documentation

◆ mbedtls_aria_context

The ARIA context-type definition.

Function Documentation

◆ mbedtls_aria_crypt_ecb()

int mbedtls_aria_crypt_ecb ( mbedtls_aria_context ctx,
const unsigned char  input[MBEDTLS_ARIA_BLOCKSIZE],
unsigned char  output[MBEDTLS_ARIA_BLOCKSIZE] 
)

This function performs an ARIA single-block encryption or decryption operation.

It performs encryption or decryption (depending on whether the key was set for encryption on decryption) on the input data buffer defined in the input parameter.

mbedtls_aria_init(), and either mbedtls_aria_setkey_enc() or mbedtls_aria_setkey_dec() must be called before the first call to this API with the same context.

Parameters
ctxThe ARIA context to use for encryption or decryption. This must be initialized and bound to a key.
inputThe 16-Byte buffer holding the input data.
outputThe 16-Byte buffer holding the output data.
Returns
0 on success.
A negative error code on failure.

◆ mbedtls_aria_free()

void mbedtls_aria_free ( mbedtls_aria_context ctx)

This function releases and clears the specified ARIA context.

Parameters
ctxThe ARIA context to clear. This may be NULL, in which case this function returns immediately. If it is not NULL, it must point to an initialized ARIA context.

◆ mbedtls_aria_init()

void mbedtls_aria_init ( mbedtls_aria_context ctx)

This function initializes the specified ARIA context.

            It must be the first API called before using
            the context.
Parameters
ctxThe ARIA context to initialize. This must not be NULL.

◆ mbedtls_aria_setkey_dec()

int mbedtls_aria_setkey_dec ( mbedtls_aria_context ctx,
const unsigned char *  key,
unsigned int  keybits 
)

This function sets the decryption key.

Parameters
ctxThe ARIA context to which the key should be bound. This must be initialized.
keyThe decryption key. This must be a readable buffer of size keybits Bits.
keybitsThe size of data passed. Valid options are:
  • 128 bits
  • 192 bits
  • 256 bits
Returns
0 on success.
A negative error code on failure.

◆ mbedtls_aria_setkey_enc()

int mbedtls_aria_setkey_enc ( mbedtls_aria_context ctx,
const unsigned char *  key,
unsigned int  keybits 
)

This function sets the encryption key.

Parameters
ctxThe ARIA context to which the key should be bound. This must be initialized.
keyThe encryption key. This must be a readable buffer of size keybits Bits.
keybitsThe size of key in Bits. Valid options are:
  • 128 bits
  • 192 bits
  • 256 bits
Returns
0 on success.
A negative error code on failure.