Mbed TLS v2.28.8
aria.h
Go to the documentation of this file.
1 
12 /*
13  * Copyright The Mbed TLS Contributors
14  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
15  */
16 
17 #ifndef MBEDTLS_ARIA_H
18 #define MBEDTLS_ARIA_H
19 
20 #if !defined(MBEDTLS_CONFIG_FILE)
21 #include "mbedtls/config.h"
22 #else
23 #include MBEDTLS_CONFIG_FILE
24 #endif
25 
26 #include <stddef.h>
27 #include <stdint.h>
28 
29 #include "mbedtls/platform_util.h"
30 
31 #define MBEDTLS_ARIA_ENCRYPT 1
32 #define MBEDTLS_ARIA_DECRYPT 0
34 #define MBEDTLS_ARIA_BLOCKSIZE 16
35 #define MBEDTLS_ARIA_MAX_ROUNDS 16
36 #define MBEDTLS_ARIA_MAX_KEYSIZE 32
38 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
39 #define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(-0x005C)
40 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
41 
42 #define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C
43 
45 #define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E
46 
47 /* MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE is deprecated and should not be used.
48  */
50 #define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A
51 
52 /* MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED is deprecated and should not be used. */
54 #define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED -0x0058
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 #if !defined(MBEDTLS_ARIA_ALT)
61 // Regular implementation
62 //
63 
67 typedef struct mbedtls_aria_context {
68  unsigned char nr;
71 }
73 
74 #else /* MBEDTLS_ARIA_ALT */
75 #include "aria_alt.h"
76 #endif /* MBEDTLS_ARIA_ALT */
77 
87 
96 
113  const unsigned char *key,
114  unsigned int keybits);
115 
132  const unsigned char *key,
133  unsigned int keybits);
134 
156  const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
157  unsigned char output[MBEDTLS_ARIA_BLOCKSIZE]);
158 
159 #if defined(MBEDTLS_CIPHER_MODE_CBC)
160 
202  int mode,
203  size_t length,
204  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
205  const unsigned char *input,
206  unsigned char *output);
207 #endif /* MBEDTLS_CIPHER_MODE_CBC */
208 
209 #if defined(MBEDTLS_CIPHER_MODE_CFB)
210 
252  int mode,
253  size_t length,
254  size_t *iv_off,
255  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
256  const unsigned char *input,
257  unsigned char *output);
258 #endif /* MBEDTLS_CIPHER_MODE_CFB */
259 
260 #if defined(MBEDTLS_CIPHER_MODE_CTR)
261 
335  size_t length,
336  size_t *nc_off,
337  unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
338  unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
339  const unsigned char *input,
340  unsigned char *output);
341 #endif /* MBEDTLS_CIPHER_MODE_CTR */
342 
343 #if defined(MBEDTLS_SELF_TEST)
344 
349 int mbedtls_aria_self_test(int verbose);
350 #endif /* MBEDTLS_SELF_TEST */
351 
352 #ifdef __cplusplus
353 }
354 #endif
355 
356 #endif /* aria.h */
mbedtls_aria_context::nr
unsigned char nr
Definition: aria.h:68
mbedtls_aria_crypt_ctr
int mbedtls_aria_crypt_ctr(mbedtls_aria_context *ctx, size_t length, size_t *nc_off, unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE], unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE], const unsigned char *input, unsigned char *output)
This function performs an ARIA-CTR encryption or decryption operation.
mbedtls_aria_context
struct mbedtls_aria_context mbedtls_aria_context
The ARIA context-type definition.
mbedtls_aria_crypt_cbc
int mbedtls_aria_crypt_cbc(mbedtls_aria_context *ctx, int mode, size_t length, unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE], const unsigned char *input, unsigned char *output)
This function performs an ARIA-CBC encryption or decryption operation on full blocks.
mbedtls_aria_free
void mbedtls_aria_free(mbedtls_aria_context *ctx)
This function releases and clears the specified ARIA context.
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.
mbedtls_aria_context
The ARIA context-type definition.
Definition: aria.h:67
mbedtls_aria_context::rk
uint32_t rk[MBEDTLS_ARIA_MAX_ROUNDS+1][MBEDTLS_ARIA_BLOCKSIZE/4]
Definition: aria.h:70
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.
mbedtls_aria_self_test
int mbedtls_aria_self_test(int verbose)
Checkup routine.
mbedtls_aria_init
void mbedtls_aria_init(mbedtls_aria_context *ctx)
This function initializes the specified ARIA context.
MBEDTLS_ARIA_MAX_ROUNDS
#define MBEDTLS_ARIA_MAX_ROUNDS
Definition: aria.h:35
config.h
Configuration options (set of defines)
platform_util.h
Common and shared functions used by multiple modules in the Mbed TLS library.
MBEDTLS_ARIA_BLOCKSIZE
#define MBEDTLS_ARIA_BLOCKSIZE
Definition: aria.h:34
mbedtls_aria_crypt_cfb128
int mbedtls_aria_crypt_cfb128(mbedtls_aria_context *ctx, int mode, size_t length, size_t *iv_off, unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE], const unsigned char *input, unsigned char *output)
This function performs an ARIA-CFB128 encryption or decryption operation.
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.