blob: f4942cd4a4f2a70650be116b2be49c592cef59ee [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*
2 * RC4 stream cipher
3 * Copyright (c) 2002-2005, Jouni Malinen <j@w1.fi>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * License
13 * -------
14 *
15 * GPL v2:
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 *
30 * (this copy of the license is in COPYING file)
31 *
32 *
33 * Alternatively, this software may be distributed, used, and modified
34 * under the terms of BSD license:
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions are
38 * met:
39 *
40 * 1. Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 *
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 *
47 * 3. Neither the name(s) of the above-listed copyright holder(s) nor the
48 * names of its contributors may be used to endorse or promote products
49 * derived from this software without specific prior written permission.
50 *
51 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
52 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
53 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
54 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
55 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
56 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 */
63
64/*****************************************************************************
65 *
66 * Filename:
67 * ---------
68 * rc4.h
69 *
70 * Project:
71 * --------
72 * Maui_Software
73 *
74 * Description:
75 * ------------
76 * RC4 Engine
77 *
78 * Author:
79 * -------
80 * -------
81 *============================================================================
82 * HISTORY
83 * Below this line, this part is controlled by ClearCase. DO NOT MODIFY!!
84 *------------------------------------------------------------------------------
85 * $Log$
86 *
87 * 12 14 2010 leona.chou
88 * removed!
89 * .
90 *
91 * removed!
92 * removed!
93 *
94 *
95 * removed!
96 * removed!
97 * add the speical case of RC4_SKIP to satisfy the WIFI 802.11i spec by skip the first 256 iteration of RC4.
98 *
99 * removed!
100 * removed!
101 * use a variable to record key schedule
102 *
103 * removed!
104 * removed!
105 *
106 *
107 * removed!
108 * removed!
109 *
110 *
111 * removed!
112 * removed!
113 *
114 *
115 * removed!
116 * removed!
117 * Code revise.
118 *
119 * removed!
120 * removed!
121 * code review. add log placeholder.
122 *------------------------------------------------------------------------------
123 * Upper this line, this part is controlled by ClearCase. DO NOT MODIFY!!
124 *============================================================================
125 ****************************************************************************/
126
127#ifndef __RC4_H__
128#define __RC4_H__
129
130#include "che_api.h"
131
132#include "kal_general_types.h"
133
134#define S_SWAP(sa,sb) do { kal_uint8 t = sa; sa = sb; sb = t; } while(0)
135
136void che_rc4(RC4_CNXT *keySet,kal_uint8 *input, kal_uint32 len, kal_uint8 *key, kal_uint32 key_len, CHE_OPERATION_MODE mode, kal_uint8 *output);
137
138void che_rc4_set_key(RC4_CNXT *keySet, kal_uint32 len, kal_uint8 *data);
139
140#endif