Mbed TLS v2.28.5
Loading...
Searching...
No Matches
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
32#if !defined(MBEDTLS_CONFIG_FILE)
33#include "mbedtls/config.h"
34#else
35#include MBEDTLS_CONFIG_FILE
36#endif
37
38#include <stddef.h>
39#include <stdint.h>
40
42
43#define MBEDTLS_ARIA_ENCRYPT 1
44#define MBEDTLS_ARIA_DECRYPT 0
46#define MBEDTLS_ARIA_BLOCKSIZE 16
47#define MBEDTLS_ARIA_MAX_ROUNDS 16
48#define MBEDTLS_ARIA_MAX_KEYSIZE 32
50#if !defined(MBEDTLS_DEPRECATED_REMOVED)
51#define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(-0x005C)
52#endif /* !MBEDTLS_DEPRECATED_REMOVED */
54#define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C
55
57#define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E
58
59/* MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE is deprecated and should not be used.
60 */
62#define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A
63
64/* MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED is deprecated and should not be used. */
66#define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED -0x0058
67
68#ifdef __cplusplus
69extern "C" {
70#endif
71
72#if !defined(MBEDTLS_ARIA_ALT)
73// Regular implementation
74//
75
79typedef struct mbedtls_aria_context {
80 unsigned char nr;
83}
85
86#else /* MBEDTLS_ARIA_ALT */
87#include "aria_alt.h"
88#endif /* MBEDTLS_ARIA_ALT */
89
99
108
125 const unsigned char *key,
126 unsigned int keybits);
127
144 const unsigned char *key,
145 unsigned int keybits);
146
168 const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
169 unsigned char output[MBEDTLS_ARIA_BLOCKSIZE]);
170
171#if defined(MBEDTLS_CIPHER_MODE_CBC)
214 int mode,
215 size_t length,
216 unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
217 const unsigned char *input,
218 unsigned char *output);
219#endif /* MBEDTLS_CIPHER_MODE_CBC */
220
221#if defined(MBEDTLS_CIPHER_MODE_CFB)
264 int mode,
265 size_t length,
266 size_t *iv_off,
267 unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
268 const unsigned char *input,
269 unsigned char *output);
270#endif /* MBEDTLS_CIPHER_MODE_CFB */
271
272#if defined(MBEDTLS_CIPHER_MODE_CTR)
347 size_t length,
348 size_t *nc_off,
349 unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
350 unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
351 const unsigned char *input,
352 unsigned char *output);
353#endif /* MBEDTLS_CIPHER_MODE_CTR */
354
355#if defined(MBEDTLS_SELF_TEST)
361int mbedtls_aria_self_test(int verbose);
362#endif /* MBEDTLS_SELF_TEST */
363
364#ifdef __cplusplus
365}
366#endif
367
368#endif /* aria.h */
int mbedtls_aria_self_test(int verbose)
Checkup routine.
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:46
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:47
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.
Configuration options (set of defines)
Common and shared functions used by multiple modules in the Mbed TLS library.
The ARIA context-type definition.
Definition: aria.h:79
unsigned char nr
Definition: aria.h:80
uint32_t rk[MBEDTLS_ARIA_MAX_ROUNDS+1][MBEDTLS_ARIA_BLOCKSIZE/4]
Definition: aria.h:82