mbed TLS v2.16.12
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  * This file is provided under the Apache License 2.0, or the
17  * GNU General Public License v2.0 or later.
18  *
19  * **********
20  * Apache License 2.0:
21  *
22  * Licensed under the Apache License, Version 2.0 (the "License"); you may
23  * not use this file except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  * http://www.apache.org/licenses/LICENSE-2.0
27  *
28  * Unless required by applicable law or agreed to in writing, software
29  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
30  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * **********
35  *
36  * **********
37  * GNU General Public License v2.0 or later:
38  *
39  * This program is free software; you can redistribute it and/or modify
40  * it under the terms of the GNU General Public License as published by
41  * the Free Software Foundation; either version 2 of the License, or
42  * (at your option) any later version.
43  *
44  * This program is distributed in the hope that it will be useful,
45  * but WITHOUT ANY WARRANTY; without even the implied warranty of
46  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47  * GNU General Public License for more details.
48  *
49  * You should have received a copy of the GNU General Public License along
50  * with this program; if not, write to the Free Software Foundation, Inc.,
51  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
52  *
53  * **********
54  */
55 
56 #ifndef MBEDTLS_ARIA_H
57 #define MBEDTLS_ARIA_H
58 
59 #if !defined(MBEDTLS_CONFIG_FILE)
60 #include "config.h"
61 #else
62 #include MBEDTLS_CONFIG_FILE
63 #endif
64 
65 #include <stddef.h>
66 #include <stdint.h>
67 
68 #include "platform_util.h"
69 
70 #define MBEDTLS_ARIA_ENCRYPT 1
71 #define MBEDTLS_ARIA_DECRYPT 0
73 #define MBEDTLS_ARIA_BLOCKSIZE 16
74 #define MBEDTLS_ARIA_MAX_ROUNDS 16
75 #define MBEDTLS_ARIA_MAX_KEYSIZE 32
77 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
78 #define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x005C )
79 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
81 #define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C
82 
84 #define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E
85 
86 /* MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE is deprecated and should not be used.
87  */
89 #define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A
90 
91 /* MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED is deprecated and should not be used. */
93 #define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED -0x0058
94 
95 #ifdef __cplusplus
96 extern "C" {
97 #endif
98 
99 #if !defined(MBEDTLS_ARIA_ALT)
100 // Regular implementation
101 //
102 
106 typedef struct mbedtls_aria_context
107 {
108  unsigned char nr;
111 }
113 
114 #else /* MBEDTLS_ARIA_ALT */
115 #include "aria_alt.h"
116 #endif /* MBEDTLS_ARIA_ALT */
117 
127 
136 
153  const unsigned char *key,
154  unsigned int keybits );
155 
172  const unsigned char *key,
173  unsigned int keybits );
174 
196  const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
197  unsigned char output[MBEDTLS_ARIA_BLOCKSIZE] );
198 
199 #if defined(MBEDTLS_CIPHER_MODE_CBC)
242  int mode,
243  size_t length,
244  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
245  const unsigned char *input,
246  unsigned char *output );
247 #endif /* MBEDTLS_CIPHER_MODE_CBC */
248 
249 #if defined(MBEDTLS_CIPHER_MODE_CFB)
292  int mode,
293  size_t length,
294  size_t *iv_off,
295  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
296  const unsigned char *input,
297  unsigned char *output );
298 #endif /* MBEDTLS_CIPHER_MODE_CFB */
299 
300 #if defined(MBEDTLS_CIPHER_MODE_CTR)
379  size_t length,
380  size_t *nc_off,
381  unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
382  unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
383  const unsigned char *input,
384  unsigned char *output );
385 #endif /* MBEDTLS_CIPHER_MODE_CTR */
386 
387 #if defined(MBEDTLS_SELF_TEST)
393 int mbedtls_aria_self_test( int verbose );
394 #endif /* MBEDTLS_SELF_TEST */
395 
396 #ifdef __cplusplus
397 }
398 #endif
399 
400 #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:73
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:74
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:107
unsigned char nr
Definition: aria.h:108
uint32_t rk[MBEDTLS_ARIA_MAX_ROUNDS+1][MBEDTLS_ARIA_BLOCKSIZE/4]
Definition: aria.h:110