mbed TLS v2.16.6
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: GPL-2.0
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, write to the Free Software Foundation, Inc.,
25  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26  *
27  * This file is part of mbed TLS (https://tls.mbed.org)
28  *
29  */
30 #ifndef MBEDTLS_ARC4_H
31 #define MBEDTLS_ARC4_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 
41 /* MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED is deprecated and should not be used. */
42 #define MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED -0x0019
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 #if !defined(MBEDTLS_ARC4_ALT)
49 // Regular implementation
50 //
51 
59 typedef struct mbedtls_arc4_context
60 {
61  int x;
62  int y;
63  unsigned char m[256];
64 }
66 
67 #else /* MBEDTLS_ARC4_ALT */
68 #include "arc4_alt.h"
69 #endif /* MBEDTLS_ARC4_ALT */
70 
82 
94 
107 void mbedtls_arc4_setup( mbedtls_arc4_context *ctx, const unsigned char *key,
108  unsigned int keylen );
109 
125 int mbedtls_arc4_crypt( mbedtls_arc4_context *ctx, size_t length, const unsigned char *input,
126  unsigned char *output );
127 
128 #if defined(MBEDTLS_SELF_TEST)
129 
140 int mbedtls_arc4_self_test( int verbose );
141 
142 #endif /* MBEDTLS_SELF_TEST */
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #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:63
struct mbedtls_arc4_context mbedtls_arc4_context
ARC4 context structure.
ARC4 context structure.
Definition: arc4.h:59
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.