mbed TLS v2.23.0
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
15  *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may
17  * not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19  *
20  * http://www.apache.org/licenses/LICENSE-2.0
21  *
22  * Unless required by applicable law or agreed to in writing, software
23  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  * See the License for the specific language governing permissions and
26  * limitations under the License.
27  *
28  * This file is part of mbed TLS (https://tls.mbed.org)
29  */
30 
31 #ifndef MBEDTLS_ARIA_H
32 #define MBEDTLS_ARIA_H
33 
34 #if !defined(MBEDTLS_CONFIG_FILE)
35 #include "mbedtls/config.h"
36 #else
37 #include MBEDTLS_CONFIG_FILE
38 #endif
39 
40 #include <stddef.h>
41 #include <stdint.h>
42 
43 #include "mbedtls/platform_util.h"
44 
45 #define MBEDTLS_ARIA_ENCRYPT 1
46 #define MBEDTLS_ARIA_DECRYPT 0
48 #define MBEDTLS_ARIA_BLOCKSIZE 16
49 #define MBEDTLS_ARIA_MAX_ROUNDS 16
50 #define MBEDTLS_ARIA_MAX_KEYSIZE 32
52 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
53 #define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x005C )
54 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
55 #define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C
57 #define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E
59 /* MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE is deprecated and should not be used.
60  */
61 #define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A
63 /* MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED is deprecated and should not be used. */
64 #define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED -0x0058
66 #if !defined(MBEDTLS_ARIA_ALT)
67 // Regular implementation
68 //
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
77 typedef struct mbedtls_aria_context
78 {
79  unsigned char nr;
82 }
84 
85 #else /* MBEDTLS_ARIA_ALT */
86 #include "aria_alt.h"
87 #endif /* MBEDTLS_ARIA_ALT */
88 
98 
107 
124  const unsigned char *key,
125  unsigned int keybits );
126 
143  const unsigned char *key,
144  unsigned int keybits );
145 
167  const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
168  unsigned char output[MBEDTLS_ARIA_BLOCKSIZE] );
169 
170 #if defined(MBEDTLS_CIPHER_MODE_CBC)
171 
213  int mode,
214  size_t length,
215  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
216  const unsigned char *input,
217  unsigned char *output );
218 #endif /* MBEDTLS_CIPHER_MODE_CBC */
219 
220 #if defined(MBEDTLS_CIPHER_MODE_CFB)
221 
263  int mode,
264  size_t length,
265  size_t *iv_off,
266  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
267  const unsigned char *input,
268  unsigned char *output );
269 #endif /* MBEDTLS_CIPHER_MODE_CFB */
270 
271 #if defined(MBEDTLS_CIPHER_MODE_CTR)
272 
350  size_t length,
351  size_t *nc_off,
352  unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
353  unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
354  const unsigned char *input,
355  unsigned char *output );
356 #endif /* MBEDTLS_CIPHER_MODE_CTR */
357 
358 #if defined(MBEDTLS_SELF_TEST)
359 
364 int mbedtls_aria_self_test( int verbose );
365 #endif /* MBEDTLS_SELF_TEST */
366 
367 #ifdef __cplusplus
368 }
369 #endif
370 
371 #endif /* aria.h */
mbedtls_aria_context::nr
unsigned char nr
Definition: aria.h:79
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
struct mbedtls_aria_context mbedtls_aria_context
The ARIA context-type definition.
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.
mbedtls_aria_free
void mbedtls_aria_free(mbedtls_aria_context *ctx)
This function releases and clears the specified ARIA context.
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.
mbedtls_aria_context
The ARIA context-type definition.
Definition: aria.h:78
mbedtls_aria_context::rk
uint32_t rk[MBEDTLS_ARIA_MAX_ROUNDS+1][MBEDTLS_ARIA_BLOCKSIZE/4]
Definition: aria.h:81
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_init
void mbedtls_aria_init(mbedtls_aria_context *ctx)
This function initializes the specified ARIA context.
MBEDTLS_ARIA_MAX_ROUNDS
#define MBEDTLS_ARIA_MAX_ROUNDS
Definition: aria.h:49
config.h
Configuration options (set of defines)
platform_util.h
Common and shared functions used by multiple modules in the Mbed TLS library.
MBEDTLS_ARIA_BLOCKSIZE
#define MBEDTLS_ARIA_BLOCKSIZE
Definition: aria.h:48
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_enc
int mbedtls_aria_setkey_enc(mbedtls_aria_context *ctx, const unsigned char *key, unsigned int keybits)
This function sets the encryption key.