Mbed TLS v3.6.0
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 #include "mbedtls/private_access.h"
20 
21 #include "mbedtls/build_info.h"
22 
23 #include <stddef.h>
24 #include <stdint.h>
25 
26 #include "mbedtls/platform_util.h"
27 
28 #define MBEDTLS_ARIA_ENCRYPT 1
29 #define MBEDTLS_ARIA_DECRYPT 0
31 #define MBEDTLS_ARIA_BLOCKSIZE 16
32 #define MBEDTLS_ARIA_MAX_ROUNDS 16
33 #define MBEDTLS_ARIA_MAX_KEYSIZE 32
36 #define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C
37 
39 #define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 #if !defined(MBEDTLS_ARIA_ALT)
46 // Regular implementation
47 //
48 
52 typedef struct mbedtls_aria_context {
53  unsigned char MBEDTLS_PRIVATE(nr);
56 }
58 
59 #else /* MBEDTLS_ARIA_ALT */
60 #include "aria_alt.h"
61 #endif /* MBEDTLS_ARIA_ALT */
62 
72 
81 
98  const unsigned char *key,
99  unsigned int keybits);
100 
101 #if !defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT)
118  const unsigned char *key,
119  unsigned int keybits);
120 #endif /* !MBEDTLS_BLOCK_CIPHER_NO_DECRYPT */
121 
143  const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
144  unsigned char output[MBEDTLS_ARIA_BLOCKSIZE]);
145 
146 #if defined(MBEDTLS_CIPHER_MODE_CBC)
189  int mode,
190  size_t length,
191  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
192  const unsigned char *input,
193  unsigned char *output);
194 #endif /* MBEDTLS_CIPHER_MODE_CBC */
195 
196 #if defined(MBEDTLS_CIPHER_MODE_CFB)
239  int mode,
240  size_t length,
241  size_t *iv_off,
242  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
243  const unsigned char *input,
244  unsigned char *output);
245 #endif /* MBEDTLS_CIPHER_MODE_CFB */
246 
247 #if defined(MBEDTLS_CIPHER_MODE_CTR)
322  size_t length,
323  size_t *nc_off,
324  unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
325  unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
326  const unsigned char *input,
327  unsigned char *output);
328 #endif /* MBEDTLS_CIPHER_MODE_CTR */
329 
330 #if defined(MBEDTLS_SELF_TEST)
336 int mbedtls_aria_self_test(int verbose);
337 #endif /* MBEDTLS_SELF_TEST */
338 
339 #ifdef __cplusplus
340 }
341 #endif
342 
343 #endif /* aria.h */
int mbedtls_aria_self_test(int verbose)
Checkup routine.
struct mbedtls_aria_context mbedtls_aria_context
The ARIA context-type definition.
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.
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.
void mbedtls_aria_init(mbedtls_aria_context *ctx)
This function initializes the specified ARIA context.
int mbedtls_aria_setkey_dec(mbedtls_aria_context *ctx, const unsigned char *key, unsigned int keybits)
This function sets the decryption key.
#define MBEDTLS_ARIA_BLOCKSIZE
Definition: aria.h:31
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.
void mbedtls_aria_free(mbedtls_aria_context *ctx)
This function releases and clears the specified ARIA context.
int mbedtls_aria_setkey_enc(mbedtls_aria_context *ctx, const unsigned char *key, unsigned int keybits)
This function sets the encryption key.
#define MBEDTLS_ARIA_MAX_ROUNDS
Definition: aria.h:32
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.
Build-time configuration info.
Common and shared functions used by multiple modules in the Mbed TLS library.
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
The ARIA context-type definition.
Definition: aria.h:52