15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/* crypto/rc4/rc4.h */ 25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * All rights reserved. 45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This package is an SSL implementation written 65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * by Eric Young (eay@cryptsoft.com). 75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * The implementation was written so as to conform with Netscapes SSL. 85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This library is free for commercial and non-commercial use as long as 105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * the following conditions are aheared to. The following conditions 115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * apply to all code found in this distribution, be it the RC4, RSA, 125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * lhash, DES, etc., code; not just the SSL code. The SSL documentation 135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * included with this distribution is covered by the same copyright terms 145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * except that the holder is Tim Hudson (tjh@cryptsoft.com). 155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright remains Eric Young's, and as such any Copyright notices in 175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * the code are not to be removed. 185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * If this package is used in a product, Eric Young should be given attribution 195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * as the author of the parts of the library used. 205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This can be in the form of a textual message at program startup or 215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * in documentation (online or textual) provided with the package. 225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modification, are permitted provided that the following conditions 255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * are met: 265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 1. Redistributions of source code must retain the copyright 275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * notice, this list of conditions and the following disclaimer. 285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 2. Redistributions in binary form must reproduce the above copyright 295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * notice, this list of conditions and the following disclaimer in the 305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * documentation and/or other materials provided with the distribution. 315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 3. All advertising materials mentioning features or use of this software 325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * must display the following acknowledgement: 335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * "This product includes cryptographic software written by 345c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Eric Young (eay@cryptsoft.com)" 355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * The word 'cryptographic' can be left out if the rouines from the library 3606f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) * being used are not cryptographic related :-). 371e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) * 4. If you include any Windows specific code (or a derivative thereof) from 385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * the apps directory (application code) you must include an acknowledgement: 395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 4109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles) * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * SUCH DAMAGE. 52591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * 535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * The licence and distribution terms for any publically available version or 545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * derivative of this code cannot be changed. i.e. this code cannot simply be 555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * copied and put under another distribution licence 5651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) * [including the GNU Public Licence.] 575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */ 585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef HEADER_RC4_H 605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#define HEADER_RC4_H 615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#include <openssl/opensslconf.h> /* OPENSSL_NO_RC4, RC4_INT */ 635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifdef OPENSSL_NO_RC4 6443e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)#error RC4 is disabled. 6543e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)#endif 665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#include <stddef.h> 685c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 695c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifdef __cplusplus 705c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)extern "C" { 715c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif 725c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 73typedef struct rc4_key_st 74 { 75 RC4_INT x,y; 76 RC4_INT data[256]; 77 } RC4_KEY; 78 79 80const char *RC4_options(void); 81void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 82void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 83void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 84 unsigned char *outdata); 85 86#ifdef __cplusplus 87} 88#endif 89 90#endif 91