mbed TLS v2.28.1
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 
41 #include "mbedtls/platform_util.h"
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
69 extern "C" {
70 #endif
71 
72 #if !defined(MBEDTLS_ARIA_ALT)
73 // Regular implementation
74 //
75 
79 typedef struct mbedtls_aria_context
80 {
81  unsigned char nr;
84 }
86 
87 #else /* MBEDTLS_ARIA_ALT */
88 #include "aria_alt.h"
89 #endif /* MBEDTLS_ARIA_ALT */
90 
100 
109 
126  const unsigned char *key,
127  unsigned int keybits );
128 
145  const unsigned char *key,
146  unsigned int keybits );
147 
169  const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
170  unsigned char output[MBEDTLS_ARIA_BLOCKSIZE] );
171 
172 #if defined(MBEDTLS_CIPHER_MODE_CBC)
215  int mode,
216  size_t length,
217  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
218  const unsigned char *input,
219  unsigned char *output );
220 #endif /* MBEDTLS_CIPHER_MODE_CBC */
221 
222 #if defined(MBEDTLS_CIPHER_MODE_CFB)
265  int mode,
266  size_t length,
267  size_t *iv_off,
268  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
269  const unsigned char *input,
270  unsigned char *output );
271 #endif /* MBEDTLS_CIPHER_MODE_CFB */
272 
273 #if defined(MBEDTLS_CIPHER_MODE_CTR)
352  size_t length,
353  size_t *nc_off,
354  unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
355  unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
356  const unsigned char *input,
357  unsigned char *output );
358 #endif /* MBEDTLS_CIPHER_MODE_CTR */
359 
360 #if defined(MBEDTLS_SELF_TEST)
366 int mbedtls_aria_self_test( int verbose );
367 #endif /* MBEDTLS_SELF_TEST */
368 
369 #ifdef __cplusplus
370 }
371 #endif
372 
373 #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: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:80
unsigned char nr
Definition: aria.h:81
uint32_t rk[MBEDTLS_ARIA_MAX_ROUNDS+1][MBEDTLS_ARIA_BLOCKSIZE/4]
Definition: aria.h:83