PolarSSL is now part of ARM Official announcement and rebranded as mbed TLS.

API Documentation (Doxygen generated)

These pages are generated with doxygen directly from the source code!

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 #include "platform_util.h"
43 
44 #define MBEDTLS_ARIA_ENCRYPT 1
45 #define MBEDTLS_ARIA_DECRYPT 0
47 #define MBEDTLS_ARIA_BLOCKSIZE 16
48 #define MBEDTLS_ARIA_MAX_ROUNDS 16
49 #define MBEDTLS_ARIA_MAX_KEYSIZE 32
51 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
52 #define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x005C )
53 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
54 #define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C
56 #define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E
58 /* MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE is deprecated and should not be used.
59  */
60 #define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A
62 /* MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED is deprecated and should not be used. */
63 #define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED -0x0058
65 #if !defined(MBEDTLS_ARIA_ALT)
66 // Regular implementation
67 //
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
76 typedef struct mbedtls_aria_context
77 {
78  unsigned char nr;
81 }
83 
84 #else /* MBEDTLS_ARIA_ALT */
85 #include "aria_alt.h"
86 #endif /* MBEDTLS_ARIA_ALT */
87 
97 
106 
123  const unsigned char *key,
124  unsigned int keybits );
125 
142  const unsigned char *key,
143  unsigned int keybits );
144 
166  const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
167  unsigned char output[MBEDTLS_ARIA_BLOCKSIZE] );
168 
169 #if defined(MBEDTLS_CIPHER_MODE_CBC)
170 
212  int mode,
213  size_t length,
214  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
215  const unsigned char *input,
216  unsigned char *output );
217 #endif /* MBEDTLS_CIPHER_MODE_CBC */
218 
219 #if defined(MBEDTLS_CIPHER_MODE_CFB)
220 
262  int mode,
263  size_t length,
264  size_t *iv_off,
265  unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
266  const unsigned char *input,
267  unsigned char *output );
268 #endif /* MBEDTLS_CIPHER_MODE_CFB */
269 
270 #if defined(MBEDTLS_CIPHER_MODE_CTR)
271 
349  size_t length,
350  size_t *nc_off,
351  unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
352  unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
353  const unsigned char *input,
354  unsigned char *output );
355 #endif /* MBEDTLS_CIPHER_MODE_CTR */
356 
357 #if defined(MBEDTLS_SELF_TEST)
358 
363 int mbedtls_aria_self_test( int verbose );
364 #endif /* MBEDTLS_SELF_TEST */
365 
366 #ifdef __cplusplus
367 }
368 #endif
369 
370 #endif /* aria.h */
unsigned char nr
Definition: aria.h:78
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
Maxiumum number of rounds in ARIA.
Definition: aria.h:48
Common and shared functions used by multiple modules in the Mbed TLS library.
The ARIA context-type definition.
Definition: aria.h:76
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:80
#define MBEDTLS_ARIA_BLOCKSIZE
ARIA block size in bytes.
Definition: aria.h:47
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.