mbed TLS v2.16.7
arc4.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
11  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
12  *
13  * This file is provided under the Apache License 2.0, or the
14  * GNU General Public License v2.0 or later.
15  *
16  * **********
17  * Apache License 2.0:
18  *
19  * Licensed under the Apache License, Version 2.0 (the "License"); you may
20  * not use this file except in compliance with the License.
21  * You may obtain a copy of the License at
22  *
23  * http://www.apache.org/licenses/LICENSE-2.0
24  *
25  * Unless required by applicable law or agreed to in writing, software
26  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
27  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28  * See the License for the specific language governing permissions and
29  * limitations under the License.
30  *
31  * **********
32  *
33  * **********
34  * GNU General Public License v2.0 or later:
35  *
36  * This program is free software; you can redistribute it and/or modify
37  * it under the terms of the GNU General Public License as published by
38  * the Free Software Foundation; either version 2 of the License, or
39  * (at your option) any later version.
40  *
41  * This program is distributed in the hope that it will be useful,
42  * but WITHOUT ANY WARRANTY; without even the implied warranty of
43  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44  * GNU General Public License for more details.
45  *
46  * You should have received a copy of the GNU General Public License along
47  * with this program; if not, write to the Free Software Foundation, Inc.,
48  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
49  *
50  * **********
51  *
52  * This file is part of mbed TLS (https://tls.mbed.org)
53  *
54  */
55 #ifndef MBEDTLS_ARC4_H
56 #define MBEDTLS_ARC4_H
57 
58 #if !defined(MBEDTLS_CONFIG_FILE)
59 #include "config.h"
60 #else
61 #include MBEDTLS_CONFIG_FILE
62 #endif
63 
64 #include <stddef.h>
65 
66 /* MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED is deprecated and should not be used. */
67 #define MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED -0x0019
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
73 #if !defined(MBEDTLS_ARC4_ALT)
74 // Regular implementation
75 //
76 
84 typedef struct mbedtls_arc4_context
85 {
86  int x;
87  int y;
88  unsigned char m[256];
89 }
91 
92 #else /* MBEDTLS_ARC4_ALT */
93 #include "arc4_alt.h"
94 #endif /* MBEDTLS_ARC4_ALT */
95 
107 
119 
132 void mbedtls_arc4_setup( mbedtls_arc4_context *ctx, const unsigned char *key,
133  unsigned int keylen );
134 
150 int mbedtls_arc4_crypt( mbedtls_arc4_context *ctx, size_t length, const unsigned char *input,
151  unsigned char *output );
152 
153 #if defined(MBEDTLS_SELF_TEST)
154 
165 int mbedtls_arc4_self_test( int verbose );
166 
167 #endif /* MBEDTLS_SELF_TEST */
168 
169 #ifdef __cplusplus
170 }
171 #endif
172 
173 #endif /* arc4.h */
mbedtls_arc4_self_test
int mbedtls_arc4_self_test(int verbose)
Checkup routine.
mbedtls_arc4_free
void mbedtls_arc4_free(mbedtls_arc4_context *ctx)
Clear ARC4 context.
mbedtls_arc4_context
ARC4 context structure.
Definition: arc4.h:85
mbedtls_arc4_context::m
unsigned char m[256]
Definition: arc4.h:88
mbedtls_arc4_crypt
int mbedtls_arc4_crypt(mbedtls_arc4_context *ctx, size_t length, const unsigned char *input, unsigned char *output)
ARC4 cipher function.
mbedtls_arc4_context
struct mbedtls_arc4_context mbedtls_arc4_context
ARC4 context structure.
mbedtls_arc4_setup
void mbedtls_arc4_setup(mbedtls_arc4_context *ctx, const unsigned char *key, unsigned int keylen)
ARC4 key schedule.
mbedtls_arc4_context::x
int x
Definition: arc4.h:86
config.h
Configuration options (set of defines)
mbedtls_arc4_init
void mbedtls_arc4_init(mbedtls_arc4_context *ctx)
Initialize ARC4 context.
mbedtls_arc4_context::y
int y
Definition: arc4.h:87