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;
75 }
77 
78 #else /* MBEDTLS_ARIA_ALT */
79 #include "aria_alt.h"
80 #endif /* MBEDTLS_ARIA_ALT */
81 
91 
98 
113  const unsigned char *key,
114  unsigned int keybits );
115 
129  const unsigned char *key,
130  unsigned int keybits );
131 
151  const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
152  unsigned char output[MBEDTLS_ARIA_BLOCKSIZE] );
153 
154 #if defined(MBEDTLS_CIPHER_MODE_CBC)
155 
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 
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 
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 */
unsigned char nr
Definition: aria.h:72
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:46
The ARIA context-type definition.
Definition: aria.h:70
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:74
#define MBEDTLS_ARIA_BLOCKSIZE
Definition: aria.h:45
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.