ReactOS  0.4.15-dev-4570-g4f8bbd1
chacha20.h
Go to the documentation of this file.
1 
15 /*
16  * Copyright The Mbed TLS Contributors
17  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
18  *
19  * This file is provided under the Apache License 2.0, or the
20  * GNU General Public License v2.0 or later.
21  *
22  * **********
23  * Apache License 2.0:
24  *
25  * Licensed under the Apache License, Version 2.0 (the "License"); you may
26  * not use this file except in compliance with the License.
27  * You may obtain a copy of the License at
28  *
29  * http://www.apache.org/licenses/LICENSE-2.0
30  *
31  * Unless required by applicable law or agreed to in writing, software
32  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
33  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34  * See the License for the specific language governing permissions and
35  * limitations under the License.
36  *
37  * **********
38  *
39  * **********
40  * GNU General Public License v2.0 or later:
41  *
42  * This program is free software; you can redistribute it and/or modify
43  * it under the terms of the GNU General Public License as published by
44  * the Free Software Foundation; either version 2 of the License, or
45  * (at your option) any later version.
46  *
47  * This program is distributed in the hope that it will be useful,
48  * but WITHOUT ANY WARRANTY; without even the implied warranty of
49  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50  * GNU General Public License for more details.
51  *
52  * You should have received a copy of the GNU General Public License along
53  * with this program; if not, write to the Free Software Foundation, Inc.,
54  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
55  *
56  * **********
57  */
58 
59 #ifndef MBEDTLS_CHACHA20_H
60 #define MBEDTLS_CHACHA20_H
61 
62 #if !defined(MBEDTLS_CONFIG_FILE)
63 #include "config.h"
64 #else
65 #include MBEDTLS_CONFIG_FILE
66 #endif
67 
68 #include <stdint.h>
69 #include <stddef.h>
70 
71 #define MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA -0x0051
73 /* MBEDTLS_ERR_CHACHA20_FEATURE_UNAVAILABLE is deprecated and should not be
74  * used. */
75 #define MBEDTLS_ERR_CHACHA20_FEATURE_UNAVAILABLE -0x0053
77 /* MBEDTLS_ERR_CHACHA20_HW_ACCEL_FAILED is deprecated and should not be used.
78  */
79 #define MBEDTLS_ERR_CHACHA20_HW_ACCEL_FAILED -0x0055
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
84 
85 #if !defined(MBEDTLS_CHACHA20_ALT)
86 
88 {
92 }
94 
95 #else /* MBEDTLS_CHACHA20_ALT */
96 #include "chacha20_alt.h"
97 #endif /* MBEDTLS_CHACHA20_ALT */
98 
115 
126 
144  const unsigned char key[32] );
145 
166  const unsigned char nonce[12],
167  uint32_t counter );
168 
199  size_t size,
200  const unsigned char *input,
201  unsigned char *output );
202 
231 int mbedtls_chacha20_crypt( const unsigned char key[32],
232  const unsigned char nonce[12],
234  size_t size,
235  const unsigned char* input,
236  unsigned char* output );
237 
238 #if defined(MBEDTLS_SELF_TEST)
239 
245 int mbedtls_chacha20_self_test( int verbose );
246 #endif /* MBEDTLS_SELF_TEST */
247 
248 #ifdef __cplusplus
249 }
250 #endif
251 
252 #endif /* MBEDTLS_CHACHA20_H */
struct mbedtls_chacha20_context mbedtls_chacha20_context
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
int mbedtls_chacha20_crypt(const unsigned char key[32], const unsigned char nonce[12], uint32_t counter, size_t size, const unsigned char *input, unsigned char *output)
This function encrypts or decrypts data with ChaCha20 and the given key and nonce.
#define verbose
Definition: rosglue.h:36
GLsizeiptr size
Definition: glext.h:5919
uint8_t keystream8[64]
Definition: chacha20.h:90
int mbedtls_chacha20_setkey(mbedtls_chacha20_context *ctx, const unsigned char key[32])
This function sets the encryption/decryption key.
BYTE uint8_t
Definition: msvideo1.c:66
int mbedtls_chacha20_starts(mbedtls_chacha20_context *ctx, const unsigned char nonce[12], uint32_t counter)
This function sets the nonce and initial counter value.
void mbedtls_chacha20_free(mbedtls_chacha20_context *ctx)
This function releases and clears the specified ChaCha20 context.
int mbedtls_chacha20_update(mbedtls_chacha20_context *ctx, size_t size, const unsigned char *input, unsigned char *output)
This function encrypts or decrypts data.
GLenum GLenum GLenum input
Definition: glext.h:9031
void mbedtls_chacha20_init(mbedtls_chacha20_context *ctx)
This function initializes the specified ChaCha20 context.
uint32_t state[16]
Definition: chacha20.h:89
UINT32 uint32_t
Definition: types.h:75
Definition: path.c:41