mbed TLS v2.16.7
aria.h
Go to the documentation of this file.
1 
12 /*
13  * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved
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  * This file is part of mbed TLS (https://tls.mbed.org)
56  */
57 
58 #ifndef MBEDTLS_ARIA_H
59 #define MBEDTLS_ARIA_H
60 
61 #if !defined(MBEDTLS_CONFIG_FILE)
62 #include "config.h"
63 #else
64 #include MBEDTLS_CONFIG_FILE
65 #endif
66 
67 #include <stddef.h>
68 #include <stdint.h>
69 
70 #include "platform_util.h"
71 
72 #define MBEDTLS_ARIA_ENCRYPT 1
73 #define MBEDTLS_ARIA_DECRYPT 0
75 #define MBEDTLS_ARIA_BLOCKSIZE 16
76 #define MBEDTLS_ARIA_MAX_ROUNDS 16
77 #define MBEDTLS_ARIA_MAX_KEYSIZE 32
79 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
80 #define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x005C )
81 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
82 #define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C
84 #define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E
86 /* MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE is deprecated and should not be used.
87  */
88 #define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A
90 /* MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED is deprecated and should not be used. */
91 #define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED -0x0058
93 #if !defined(MBEDTLS_ARIA_ALT)
94 // Regular implementation
95 //
96 
97 #ifdef __cplusplus
98 extern "C" {
99 #endif
100 
104 typedef struct mbedtls_aria_context
105 {
106  unsigned char nr;
109 }
111 
112 #else /* MBEDTLS_ARIA_ALT */
113 #include "aria_alt.h"
114 #endif /* MBEDTLS_ARIA_ALT */
115 
125 
134 
151  const unsigned char *key,
152  unsigned int keybits );
153 
170  const unsigned char *key,
171  unsigned int keybits );
172 
194  const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
195  unsigned char output[MBEDTLS_ARIA_BLOCKSIZE] );
196 
197 #if defined(MBEDTLS_CIPHER_MODE_CBC)
198 
240  int mode,
241  size_t length,
242  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
243  const unsigned char *input,
244  unsigned char *output );
245 #endif /* MBEDTLS_CIPHER_MODE_CBC */
246 
247 #if defined(MBEDTLS_CIPHER_MODE_CFB)
248 
290  int mode,
291  size_t length,
292  size_t *iv_off,
293  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
294  const unsigned char *input,
295  unsigned char *output );
296 #endif /* MBEDTLS_CIPHER_MODE_CFB */
297 
298 #if defined(MBEDTLS_CIPHER_MODE_CTR)
299 
377  size_t length,
378  size_t *nc_off,
379  unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
380  unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
381  const unsigned char *input,
382  unsigned char *output );
383 #endif /* MBEDTLS_CIPHER_MODE_CTR */
384 
385 #if defined(MBEDTLS_SELF_TEST)
386 
391 int mbedtls_aria_self_test( int verbose );
392 #endif /* MBEDTLS_SELF_TEST */
393 
394 #ifdef __cplusplus
395 }
396 #endif
397 
398 #endif /* aria.h */
unsigned char nr
Definition: aria.h:106
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.
int mbedtls_aria_setkey_dec(mbedtls_aria_context *ctx, const unsigned char *key, unsigned int keybits)
This function sets the decryption key.
Configuration options (set of defines)
#define MBEDTLS_ARIA_MAX_ROUNDS
Definition: aria.h:76
Common and shared functions used by multiple modules in the Mbed TLS library.
The ARIA context-type definition.
Definition: aria.h:104
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.
uint32_t rk[MBEDTLS_ARIA_MAX_ROUNDS+1][MBEDTLS_ARIA_BLOCKSIZE/4]
Definition: aria.h:108
#define MBEDTLS_ARIA_BLOCKSIZE
Definition: aria.h:75
void mbedtls_aria_free(mbedtls_aria_context *ctx)
This function releases and clears the specified ARIA context.
struct mbedtls_aria_context mbedtls_aria_context
The ARIA context-type definition.
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.
int mbedtls_aria_self_test(int verbose)
Checkup routine.
int mbedtls_aria_setkey_enc(mbedtls_aria_context *ctx, const unsigned char *key, unsigned int keybits)
This function sets the encryption key.
void mbedtls_aria_init(mbedtls_aria_context *ctx)
This function initializes the specified ARIA context.
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.