mbed TLS v2.16.1
aria.h
Go to the documentation of this file.
1 
12 /* Copyright (C) 2006-2018, ARM Limited, All Rights Reserved
13  * SPDX-License-Identifier: GPL-2.0
14  *
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 2 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, write to the Free Software Foundation, Inc.,
27  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28  *
29  * This file is part of mbed TLS (https://tls.mbed.org)
30  */
31 
32 #ifndef MBEDTLS_ARIA_H
33 #define MBEDTLS_ARIA_H
34 
35 #if !defined(MBEDTLS_CONFIG_FILE)
36 #include "config.h"
37 #else
38 #include MBEDTLS_CONFIG_FILE
39 #endif
40 
41 #include <stddef.h>
42 #include <stdint.h>
43 
44 #include "platform_util.h"
45 
46 #define MBEDTLS_ARIA_ENCRYPT 1
47 #define MBEDTLS_ARIA_DECRYPT 0
49 #define MBEDTLS_ARIA_BLOCKSIZE 16
50 #define MBEDTLS_ARIA_MAX_ROUNDS 16
51 #define MBEDTLS_ARIA_MAX_KEYSIZE 32
53 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
54 #define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x005C )
55 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
56 #define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C
58 #define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E
60 /* MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE is deprecated and should not be used.
61  */
62 #define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A
64 /* MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED is deprecated and should not be used. */
65 #define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED -0x0058
67 #if !defined(MBEDTLS_ARIA_ALT)
68 // Regular implementation
69 //
70 
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 
78 typedef struct mbedtls_aria_context
79 {
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)
172 
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)
222 
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)
273 
351  size_t length,
352  size_t *nc_off,
353  unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
354  unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
355  const unsigned char *input,
356  unsigned char *output );
357 #endif /* MBEDTLS_CIPHER_MODE_CTR */
358 
359 #if defined(MBEDTLS_SELF_TEST)
360 
365 int mbedtls_aria_self_test( int verbose );
366 #endif /* MBEDTLS_SELF_TEST */
367 
368 #ifdef __cplusplus
369 }
370 #endif
371 
372 #endif /* aria.h */