mbed TLS v2.14.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: 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
52 /* MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE is deprecated and should not be used.
53 */
54 #define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A
56 /* MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED is deprecated and should not be used. */
57 #define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED -0x0058
59 #if !defined(MBEDTLS_ARIA_ALT)
60 // Regular implementation
61 //
62
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66
70 typedef struct mbedtls_aria_context
71 {
72 unsigned char nr;
74 uint32_t rk[MBEDTLS_ARIA_MAX_ROUNDS + 1][MBEDTLS_ARIA_BLOCKSIZE / 4];
75 }
76 mbedtls_aria_context;
77
78 #else /* MBEDTLS_ARIA_ALT */
79 #include "aria_alt.h"
80 #endif /* MBEDTLS_ARIA_ALT */
81
90 void mbedtls_aria_init( mbedtls_aria_context *ctx );
91
97 void mbedtls_aria_free( mbedtls_aria_context *ctx );
98
112 int mbedtls_aria_setkey_enc( mbedtls_aria_context *ctx,
113 const unsigned char *key,
114 unsigned int keybits );
115
128 int mbedtls_aria_setkey_dec( mbedtls_aria_context *ctx,
129 const unsigned char *key,
130 unsigned int keybits );
131
150 int mbedtls_aria_crypt_ecb( mbedtls_aria_context *ctx,
151 const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
152 unsigned char output[MBEDTLS_ARIA_BLOCKSIZE] );
153
154 #if defined(MBEDTLS_CIPHER_MODE_CBC)
155
191 int mbedtls_aria_crypt_cbc( mbedtls_aria_context *ctx,
192 int mode,
193 size_t length,
194 unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
195 const unsigned char *input,
196 unsigned char *output );
197 #endif /* MBEDTLS_CIPHER_MODE_CBC */
198
199 #if defined(MBEDTLS_CIPHER_MODE_CFB)
200
234 int mbedtls_aria_crypt_cfb128( mbedtls_aria_context *ctx,
235 int mode,
236 size_t length,
237 size_t *iv_off,
238 unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
239 const unsigned char *input,
240 unsigned char *output );
241 #endif /* MBEDTLS_CIPHER_MODE_CFB */
242
243 #if defined(MBEDTLS_CIPHER_MODE_CTR)
244
314 int mbedtls_aria_crypt_ctr( mbedtls_aria_context *ctx,
315 size_t length,
316 size_t *nc_off,
317 unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
318 unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
319 const unsigned char *input,
320 unsigned char *output );
321 #endif /* MBEDTLS_CIPHER_MODE_CTR */
322
323 #if defined(MBEDTLS_SELF_TEST)
324
329 int mbedtls_aria_self_test( int verbose );
330 #endif /* MBEDTLS_SELF_TEST */
331
332 #ifdef __cplusplus
333 }
334 #endif
335
336 #endif /* aria.h */
mbedtls_aria_context::nr
unsigned char nr
Definition: aria.h:72
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:70
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_context::rk
uint32_t rk[MBEDTLS_ARIA_MAX_ROUNDS+1][MBEDTLS_ARIA_BLOCKSIZE/4]
Definition: aria.h:74
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_context
struct mbedtls_aria_context mbedtls_aria_context
The ARIA context-type definition.
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.