ReactOS  0.4.15-dev-3428-g0609db5
camellia.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright The Mbed TLS Contributors
8  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9  *
10  * This file is provided under the Apache License 2.0, or the
11  * GNU General Public License v2.0 or later.
12  *
13  * **********
14  * Apache License 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  * **********
29  *
30  * **********
31  * GNU General Public License v2.0 or later:
32  *
33  * This program is free software; you can redistribute it and/or modify
34  * it under the terms of the GNU General Public License as published by
35  * the Free Software Foundation; either version 2 of the License, or
36  * (at your option) any later version.
37  *
38  * This program is distributed in the hope that it will be useful,
39  * but WITHOUT ANY WARRANTY; without even the implied warranty of
40  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41  * GNU General Public License for more details.
42  *
43  * You should have received a copy of the GNU General Public License along
44  * with this program; if not, write to the Free Software Foundation, Inc.,
45  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
46  *
47  * **********
48  */
49 #ifndef MBEDTLS_CAMELLIA_H
50 #define MBEDTLS_CAMELLIA_H
51 
52 #if !defined(MBEDTLS_CONFIG_FILE)
53 #include "config.h"
54 #else
55 #include MBEDTLS_CONFIG_FILE
56 #endif
57 
58 #include <stddef.h>
59 #include <stdint.h>
60 
61 #include "platform_util.h"
62 
63 #define MBEDTLS_CAMELLIA_ENCRYPT 1
64 #define MBEDTLS_CAMELLIA_DECRYPT 0
65 
66 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
67 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0024 )
68 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
69 #define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024
71 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
73 /* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
74  */
75 #define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80 
81 #if !defined(MBEDTLS_CAMELLIA_ALT)
82 // Regular implementation
83 //
84 
89 {
90  int nr;
91  uint32_t rk[68];
92 }
94 
95 #else /* MBEDTLS_CAMELLIA_ALT */
96 #include "camellia_alt.h"
97 #endif /* MBEDTLS_CAMELLIA_ALT */
98 
106 
115 
129  const unsigned char *key,
130  unsigned int keybits );
131 
145  const unsigned char *key,
146  unsigned int keybits );
147 
164  int mode,
165  const unsigned char input[16],
166  unsigned char output[16] );
167 
168 #if defined(MBEDTLS_CIPHER_MODE_CBC)
169 
198  int mode,
199  size_t length,
200  unsigned char iv[16],
201  const unsigned char *input,
202  unsigned char *output );
203 #endif /* MBEDTLS_CIPHER_MODE_CBC */
204 
205 #if defined(MBEDTLS_CIPHER_MODE_CFB)
206 
244  int mode,
245  size_t length,
246  size_t *iv_off,
247  unsigned char iv[16],
248  const unsigned char *input,
249  unsigned char *output );
250 #endif /* MBEDTLS_CIPHER_MODE_CFB */
251 
252 #if defined(MBEDTLS_CIPHER_MODE_CTR)
253 
328  size_t length,
329  size_t *nc_off,
330  unsigned char nonce_counter[16],
331  unsigned char stream_block[16],
332  const unsigned char *input,
333  unsigned char *output );
334 #endif /* MBEDTLS_CIPHER_MODE_CTR */
335 
336 #if defined(MBEDTLS_SELF_TEST)
337 
343 int mbedtls_camellia_self_test( int verbose );
344 
345 #endif /* MBEDTLS_SELF_TEST */
346 
347 #ifdef __cplusplus
348 }
349 #endif
350 
351 #endif /* camellia.h */
int mbedtls_camellia_crypt_ecb(mbedtls_camellia_context *ctx, int mode, const unsigned char input[16], unsigned char output[16])
Perform a CAMELLIA-ECB block encryption/decryption operation.
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
void mbedtls_camellia_free(mbedtls_camellia_context *ctx)
Clear a CAMELLIA context.
#define verbose
Definition: rosglue.h:36
Common and shared functions used by multiple modules in the Mbed TLS library.
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
int mbedtls_camellia_crypt_cfb128(mbedtls_camellia_context *ctx, int mode, size_t length, size_t *iv_off, unsigned char iv[16], const unsigned char *input, unsigned char *output)
Perform a CAMELLIA-CFB128 buffer encryption/decryption operation.
int mbedtls_camellia_setkey_enc(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
Perform a CAMELLIA key schedule operation for encryption.
int mbedtls_camellia_setkey_dec(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
Perform a CAMELLIA key schedule operation for decryption.
int mbedtls_camellia_crypt_ctr(mbedtls_camellia_context *ctx, size_t length, size_t *nc_off, unsigned char nonce_counter[16], unsigned char stream_block[16], const unsigned char *input, unsigned char *output)
Perform a CAMELLIA-CTR buffer encryption/decryption operation.
void mbedtls_camellia_init(mbedtls_camellia_context *ctx)
Initialize a CAMELLIA context.
GLenum mode
Definition: glext.h:6217
GLenum GLenum GLenum input
Definition: glext.h:9031
int mbedtls_camellia_crypt_cbc(mbedtls_camellia_context *ctx, int mode, size_t length, unsigned char iv[16], const unsigned char *input, unsigned char *output)
Perform a CAMELLIA-CBC buffer encryption/decryption operation.
UINT32 uint32_t
Definition: types.h:75
CAMELLIA context structure.
Definition: camellia.h:88
Definition: path.c:41
struct mbedtls_camellia_context mbedtls_camellia_context
CAMELLIA context structure.