Mbed TLS v2.28.5
arc4.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright The Mbed TLS Contributors
11  * SPDX-License-Identifier: Apache-2.0
12  *
13  * Licensed under the Apache License, Version 2.0 (the "License"); you may
14  * not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
21  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  *
25  */
26 #ifndef MBEDTLS_ARC4_H
27 #define MBEDTLS_ARC4_H
28 
29 #if !defined(MBEDTLS_CONFIG_FILE)
30 #include "mbedtls/config.h"
31 #else
32 #include MBEDTLS_CONFIG_FILE
33 #endif
34 
35 #include <stddef.h>
36 
37 /* MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED is deprecated and should not be used. */
39 #define MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED -0x0019
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 #if !defined(MBEDTLS_ARC4_ALT)
46 // Regular implementation
47 //
48 
56 typedef struct mbedtls_arc4_context {
57  int x;
58  int y;
59  unsigned char m[256];
60 }
62 
63 #else /* MBEDTLS_ARC4_ALT */
64 #include "arc4_alt.h"
65 #endif /* MBEDTLS_ARC4_ALT */
66 
78 
90 
103 void mbedtls_arc4_setup(mbedtls_arc4_context *ctx, const unsigned char *key,
104  unsigned int keylen);
105 
121 int mbedtls_arc4_crypt(mbedtls_arc4_context *ctx, size_t length, const unsigned char *input,
122  unsigned char *output);
123 
124 #if defined(MBEDTLS_SELF_TEST)
125 
136 int mbedtls_arc4_self_test(int verbose);
137 
138 #endif /* MBEDTLS_SELF_TEST */
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #endif /* arc4.h */
int mbedtls_arc4_crypt(mbedtls_arc4_context *ctx, size_t length, const unsigned char *input, unsigned char *output)
ARC4 cipher function.
Configuration options (set of defines)
void mbedtls_arc4_init(mbedtls_arc4_context *ctx)
Initialize ARC4 context.
unsigned char m[256]
Definition: arc4.h:59
struct mbedtls_arc4_context mbedtls_arc4_context
ARC4 context structure.
ARC4 context structure.
Definition: arc4.h:56
void mbedtls_arc4_free(mbedtls_arc4_context *ctx)
Clear ARC4 context.
void mbedtls_arc4_setup(mbedtls_arc4_context *ctx, const unsigned char *key, unsigned int keylen)
ARC4 key schedule.
int mbedtls_arc4_self_test(int verbose)
Checkup routine.