Mbed TLS v3.5.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
15  *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may
17  * not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19  *
20  * http://www.apache.org/licenses/LICENSE-2.0
21  *
22  * Unless required by applicable law or agreed to in writing, software
23  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  * See the License for the specific language governing permissions and
26  * limitations under the License.
27  */
28 
29 #ifndef MBEDTLS_ARIA_H
30 #define MBEDTLS_ARIA_H
31 #include "mbedtls/private_access.h"
32 
33 #include "mbedtls/build_info.h"
34 
35 #include <stddef.h>
36 #include <stdint.h>
37 
38 #include "mbedtls/platform_util.h"
39 
40 #define MBEDTLS_ARIA_ENCRYPT 1
41 #define MBEDTLS_ARIA_DECRYPT 0
43 #define MBEDTLS_ARIA_BLOCKSIZE 16
44 #define MBEDTLS_ARIA_MAX_ROUNDS 16
45 #define MBEDTLS_ARIA_MAX_KEYSIZE 32
48 #define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C
49 
51 #define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 #if !defined(MBEDTLS_ARIA_ALT)
58 // Regular implementation
59 //
60 
64 typedef struct mbedtls_aria_context {
65  unsigned char MBEDTLS_PRIVATE(nr);
68 }
70 
71 #else /* MBEDTLS_ARIA_ALT */
72 #include "aria_alt.h"
73 #endif /* MBEDTLS_ARIA_ALT */
74 
84 
93 
110  const unsigned char *key,
111  unsigned int keybits);
112 
129  const unsigned char *key,
130  unsigned int keybits);
131 
153  const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
154  unsigned char output[MBEDTLS_ARIA_BLOCKSIZE]);
155 
156 #if defined(MBEDTLS_CIPHER_MODE_CBC)
199  int mode,
200  size_t length,
201  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
202  const unsigned char *input,
203  unsigned char *output);
204 #endif /* MBEDTLS_CIPHER_MODE_CBC */
205 
206 #if defined(MBEDTLS_CIPHER_MODE_CFB)
249  int mode,
250  size_t length,
251  size_t *iv_off,
252  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
253  const unsigned char *input,
254  unsigned char *output);
255 #endif /* MBEDTLS_CIPHER_MODE_CFB */
256 
257 #if defined(MBEDTLS_CIPHER_MODE_CTR)
332  size_t length,
333  size_t *nc_off,
334  unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
335  unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
336  const unsigned char *input,
337  unsigned char *output);
338 #endif /* MBEDTLS_CIPHER_MODE_CTR */
339 
340 #if defined(MBEDTLS_SELF_TEST)
346 int mbedtls_aria_self_test(int verbose);
347 #endif /* MBEDTLS_SELF_TEST */
348 
349 #ifdef __cplusplus
350 }
351 #endif
352 
353 #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:43
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:44
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:64