xref: /freebsd/sys/crypto/rc4/rc4.h (revision 018204af68182143703fed637168dbfb18230c48)
1018204afSArchie Cobbs 
2018204afSArchie Cobbs /*
3018204afSArchie Cobbs  * rc4.h
4018204afSArchie Cobbs  *
5018204afSArchie Cobbs  * Copyright (c) 1996-2000 Whistle Communications, Inc.
6018204afSArchie Cobbs  * All rights reserved.
7018204afSArchie Cobbs  *
8018204afSArchie Cobbs  * Subject to the following obligations and disclaimer of warranty, use and
9018204afSArchie Cobbs  * redistribution of this software, in source or object code forms, with or
10018204afSArchie Cobbs  * without modifications are expressly permitted by Whistle Communications;
11018204afSArchie Cobbs  * provided, however, that:
12018204afSArchie Cobbs  * 1. Any and all reproductions of the source or object code must include the
13018204afSArchie Cobbs  *    copyright notice above and the following disclaimer of warranties; and
14018204afSArchie Cobbs  * 2. No rights are granted, in any manner or form, to use Whistle
15018204afSArchie Cobbs  *    Communications, Inc. trademarks, including the mark "WHISTLE
16018204afSArchie Cobbs  *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
17018204afSArchie Cobbs  *    such appears in the above copyright notice or in the software.
18018204afSArchie Cobbs  *
19018204afSArchie Cobbs  * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
20018204afSArchie Cobbs  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
21018204afSArchie Cobbs  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
22018204afSArchie Cobbs  * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
23018204afSArchie Cobbs  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
24018204afSArchie Cobbs  * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
25018204afSArchie Cobbs  * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
26018204afSArchie Cobbs  * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
27018204afSArchie Cobbs  * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
28018204afSArchie Cobbs  * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
29018204afSArchie Cobbs  * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
30018204afSArchie Cobbs  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
31018204afSArchie Cobbs  * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32018204afSArchie Cobbs  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33018204afSArchie Cobbs  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34018204afSArchie Cobbs  * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35018204afSArchie Cobbs  * OF SUCH DAMAGE.
36018204afSArchie Cobbs  *
37018204afSArchie Cobbs  * $FreeBSD$
38018204afSArchie Cobbs  */
39018204afSArchie Cobbs 
40018204afSArchie Cobbs #ifndef _SYS_CRYPTO_RC4_RC4_H_
41018204afSArchie Cobbs #define _SYS_CRYPTO_RC4_RC4_H_
42018204afSArchie Cobbs 
43018204afSArchie Cobbs struct rc4_state {
44018204afSArchie Cobbs 	u_char	perm[256];
45018204afSArchie Cobbs 	u_char	index1;
46018204afSArchie Cobbs 	u_char	index2;
47018204afSArchie Cobbs };
48018204afSArchie Cobbs 
49018204afSArchie Cobbs extern void rc4_init(struct rc4_state *state, const u_char *key, int keylen);
50018204afSArchie Cobbs extern void rc4_crypt(struct rc4_state *state,
51018204afSArchie Cobbs 		const u_char *inbuf, u_char *outbuf, int buflen);
52018204afSArchie Cobbs 
53018204afSArchie Cobbs #endif
54018204afSArchie Cobbs 
55