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

Camellia block cipher. More...

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

Go to the source code of this file.

Classes

struct  mbedtls_camellia_context
 CAMELLIA context structure. More...
 

Macros

#define MBEDTLS_CAMELLIA_ENCRYPT   1
 
#define MBEDTLS_CAMELLIA_DECRYPT   0
 
#define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH   MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0024 )
 
#define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA   -0x0024
 
#define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH   -0x0026
 
#define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED   -0x0027
 

Typedefs

typedef struct mbedtls_camellia_context mbedtls_camellia_context
 CAMELLIA context structure. More...
 

Functions

void mbedtls_camellia_init (mbedtls_camellia_context *ctx)
 Initialize a CAMELLIA context. More...
 
void mbedtls_camellia_free (mbedtls_camellia_context *ctx)
 Clear a CAMELLIA context. More...
 
int mbedtls_camellia_setkey_enc (mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
 Perform a CAMELLIA key schedule operation for encryption. More...
 
int mbedtls_camellia_setkey_dec (mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
 Perform a CAMELLIA key schedule operation for decryption. More...
 
int mbedtls_camellia_crypt_ecb (mbedtls_camellia_context *ctx, int mode, const unsigned char input[16], unsigned char output[16])
 Perform a CAMELLIA-ECB block encryption/decryption operation. More...
 
int mbedtls_camellia_self_test (int verbose)
 Checkup routine. More...
 

Detailed Description

Camellia block cipher.

Macro Definition Documentation

◆ MBEDTLS_CAMELLIA_DECRYPT

#define MBEDTLS_CAMELLIA_DECRYPT   0

◆ MBEDTLS_CAMELLIA_ENCRYPT

#define MBEDTLS_CAMELLIA_ENCRYPT   1

◆ MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA

#define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA   -0x0024

Bad input data.

◆ MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED

#define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED   -0x0027

Camellia hardware accelerator failed.

◆ MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH

#define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH   -0x0026

Invalid data input length.

◆ MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH

#define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH   MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0024 )

Typedef Documentation

◆ mbedtls_camellia_context

CAMELLIA context structure.

Function Documentation

◆ mbedtls_camellia_crypt_ecb()

int mbedtls_camellia_crypt_ecb ( mbedtls_camellia_context ctx,
int  mode,
const unsigned char  input[16],
unsigned char  output[16] 
)

Perform a CAMELLIA-ECB block encryption/decryption operation.

Parameters
ctxThe CAMELLIA context to use. This must be initialized and bound to a key.
modeThe mode of operation. This must be either MBEDTLS_CAMELLIA_ENCRYPT or MBEDTLS_CAMELLIA_DECRYPT.
inputThe input block. This must be a readable buffer of size 16 Bytes.
outputThe output block. This must be a writable buffer of size 16 Bytes.
Returns
0 if successful.
A negative error code on failure.

◆ mbedtls_camellia_free()

void mbedtls_camellia_free ( mbedtls_camellia_context ctx)

Clear a CAMELLIA context.

Parameters
ctxThe CAMELLIA context to be cleared. This may be NULL, in which case this function returns immediately. If it is not NULL, it must be initialized.

◆ mbedtls_camellia_init()

void mbedtls_camellia_init ( mbedtls_camellia_context ctx)

Initialize a CAMELLIA context.

Parameters
ctxThe CAMELLIA context to be initialized. This must not be NULL.

◆ mbedtls_camellia_self_test()

int mbedtls_camellia_self_test ( int  verbose)

Checkup routine.

Returns
0 if successful, or 1 if the test failed

◆ mbedtls_camellia_setkey_dec()

int mbedtls_camellia_setkey_dec ( mbedtls_camellia_context ctx,
const unsigned char *  key,
unsigned int  keybits 
)

Perform a CAMELLIA key schedule operation for decryption.

Parameters
ctxThe CAMELLIA context to use. This must be initialized.
keyThe decryption key. This must be a readable buffer of size keybits Bits.
keybitsThe length of key in Bits. This must be either 128, 192 or 256.
Returns
0 if successful.
A negative error code on failure.

◆ mbedtls_camellia_setkey_enc()

int mbedtls_camellia_setkey_enc ( mbedtls_camellia_context ctx,
const unsigned char *  key,
unsigned int  keybits 
)

Perform a CAMELLIA key schedule operation for encryption.

Parameters
ctxThe CAMELLIA context to use. This must be initialized.
keyThe encryption key to use. This must be a readable buffer of size keybits Bits.
keybitsThe length of key in Bits. This must be either 128, 192 or 256.
Returns
0 if successful.
A negative error code on failure.