rc4.h
1 /* rc4.h
2  *
3  * Copyright (C) 2006-2020 wolfSSL Inc.
4  *
5  * This file is part of wolfSSL.
6  *
7  * wolfSSL is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * wolfSSL is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20  */
21 
22 
23 
24 /* rc4.h defines mini des openssl compatibility layer
25  *
26  */
27 
28 #ifndef WOLFSSL_RC4_COMPAT_H_
29 #define WOLFSSL_RC4_COMPAT_H_
30 
31 #include <wolfssl/wolfcrypt/settings.h>
32 #include <wolfssl/openssl/ssl.h> /* included for size_t */
33 
34 #ifdef __cplusplus
35  extern "C" {
36 #endif
37 
38 /* applications including wolfssl/openssl/rc4.h are expecting to have access to
39  * the size of RC4_KEY structures. */
40 typedef struct WOLFSSL_RC4_KEY {
41  /* big enough for Arc4 from wolfssl/wolfcrypt/arc4.h */
42  void* holder[(272 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
43 } WOLFSSL_RC4_KEY;
44 typedef WOLFSSL_RC4_KEY RC4_KEY;
45 
46 WOLFSSL_API void wolfSSL_RC4_set_key(WOLFSSL_RC4_KEY* key, int len,
47  const unsigned char* data);
48 WOLFSSL_API void wolfSSL_RC4(WOLFSSL_RC4_KEY* key, size_t len,
49  const unsigned char* in, unsigned char* out);
50 
51 #define RC4 wolfSSL_RC4
52 #define RC4_set_key wolfSSL_RC4_set_key
53 
54 #ifdef __cplusplus
55  } /* extern "C" */
56 #endif
57 
58 #endif /* WOLFSSL_RC4_COMPAT_H_ */
59