mbed TLS v2.12.0

aria.h
Go to the documentation of this file.
1
12 /* Copyright (C) 2006-2018, ARM Limited, All Rights Reserved
13 * SPDX-License-Identifier: Apache-2.0
14 *
15 * Licensed under the Apache License, Version 2.0 (the "License"); you may
16 * not use this file except in compliance with the License.
17 * You may obtain a copy of the License at
18 *
19 * http://www.apache.org/licenses/LICENSE-2.0
20 *
21 * Unless required by applicable law or agreed to in writing, software
22 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
23 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 * See the License for the specific language governing permissions and
25 * limitations under the License.
26 *
27 * This file is part of mbed TLS (https://tls.mbed.org)
28 */
29
30 #ifndef MBEDTLS_ARIA_H
31 #define MBEDTLS_ARIA_H
32
33 #if !defined(MBEDTLS_CONFIG_FILE)
34 #include "config.h"
35 #else
36 #include MBEDTLS_CONFIG_FILE
37 #endif
38
39 #include <stddef.h>
40 #include <stdint.h>
41
42 #define MBEDTLS_ARIA_ENCRYPT 1
43 #define MBEDTLS_ARIA_DECRYPT 0
45 #define MBEDTLS_ARIA_BLOCKSIZE 16
46 #define MBEDTLS_ARIA_MAX_ROUNDS 16
47 #define MBEDTLS_ARIA_MAX_KEYSIZE 32
49 #define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH -0x005C
50 #define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E
51 #define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A
52 #define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED -0x0058
54 #if !defined(MBEDTLS_ARIA_ALT)
55 // Regular implementation
56 //
57
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61
65 typedef struct
66 {
67 unsigned char nr;
69 uint32_t rk[MBEDTLS_ARIA_MAX_ROUNDS + 1][MBEDTLS_ARIA_BLOCKSIZE / 4];
70 }
71 mbedtls_aria_context;
72
73 #else /* MBEDTLS_ARIA_ALT */
74 #include "aria_alt.h"
75 #endif /* MBEDTLS_ARIA_ALT */
76
85 void mbedtls_aria_init( mbedtls_aria_context *ctx );
86
92 void mbedtls_aria_free( mbedtls_aria_context *ctx );
93
107 int mbedtls_aria_setkey_enc( mbedtls_aria_context *ctx,
108 const unsigned char *key,
109 unsigned int keybits );
110
123 int mbedtls_aria_setkey_dec( mbedtls_aria_context *ctx,
124 const unsigned char *key,
125 unsigned int keybits );
126
145 int mbedtls_aria_crypt_ecb( mbedtls_aria_context *ctx,
146 const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
147 unsigned char output[MBEDTLS_ARIA_BLOCKSIZE] );
148
149 #if defined(MBEDTLS_CIPHER_MODE_CBC)
150
186 int mbedtls_aria_crypt_cbc( mbedtls_aria_context *ctx,
187 int mode,
188 size_t length,
189 unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
190 const unsigned char *input,
191 unsigned char *output );
192 #endif /* MBEDTLS_CIPHER_MODE_CBC */
193
194 #if defined(MBEDTLS_CIPHER_MODE_CFB)
195
229 int mbedtls_aria_crypt_cfb128( mbedtls_aria_context *ctx,
230 int mode,
231 size_t length,
232 size_t *iv_off,
233 unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
234 const unsigned char *input,
235 unsigned char *output );
236 #endif /* MBEDTLS_CIPHER_MODE_CFB */
237
238 #if defined(MBEDTLS_CIPHER_MODE_CTR)
239
309 int mbedtls_aria_crypt_ctr( mbedtls_aria_context *ctx,
310 size_t length,
311 size_t *nc_off,
312 unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
313 unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
314 const unsigned char *input,
315 unsigned char *output );
316 #endif /* MBEDTLS_CIPHER_MODE_CTR */
317
318 #if defined(MBEDTLS_SELF_TEST)
319
324 int mbedtls_aria_self_test( int verbose );
325 #endif /* MBEDTLS_SELF_TEST */
326
327 #ifdef __cplusplus
328 }
329 #endif
330
331 #endif /* aria.h */
mbedtls_aria_context::nr
unsigned char nr
Definition: aria.h:67
mbedtls_aria_crypt_cfb128
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.
mbedtls_aria_setkey_dec
int mbedtls_aria_setkey_dec(mbedtls_aria_context *ctx, const unsigned char *key, unsigned int keybits)
This function sets the decryption key.
config.h
Configuration options (set of defines)
MBEDTLS_ARIA_MAX_ROUNDS
#define MBEDTLS_ARIA_MAX_ROUNDS
Definition: aria.h:46
mbedtls_aria_context
The ARIA context-type definition.
Definition: aria.h:65
mbedtls_aria_crypt_ctr
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.
MBEDTLS_ARIA_BLOCKSIZE
#define MBEDTLS_ARIA_BLOCKSIZE
Definition: aria.h:45
mbedtls_aria_free
void mbedtls_aria_free(mbedtls_aria_context *ctx)
This function releases and clears the specified ARIA context.
mbedtls_aria_crypt_ecb
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.
mbedtls_aria_self_test
int mbedtls_aria_self_test(int verbose)
Checkup routine.
mbedtls_aria_setkey_enc
int mbedtls_aria_setkey_enc(mbedtls_aria_context *ctx, const unsigned char *key, unsigned int keybits)
This function sets the encryption key.
mbedtls_aria_init
void mbedtls_aria_init(mbedtls_aria_context *ctx)
This function initializes the specified ARIA context.
mbedtls_aria_crypt_cbc
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.