12c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org/* crypto/rc4/rc4_utl.c -*- mode:C; c-file-style: "eay" -*- */ 22c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org/* ==================================================================== 32c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * Copyright (c) 2011 The OpenSSL Project. All rights reserved. 42c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 52c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * Redistribution and use in source and binary forms, with or without 62c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * modification, are permitted provided that the following conditions 72c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * are met: 82c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 92c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 1. Redistributions of source code must retain the above copyright 102c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * notice, this list of conditions and the following disclaimer. 112c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 122c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 2. Redistributions in binary form must reproduce the above copyright 132c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * notice, this list of conditions and the following disclaimer in 142c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * the documentation and/or other materials provided with the 152c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * distribution. 162c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 172c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 3. All advertising materials mentioning features or use of this 182c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * software must display the following acknowledgment: 192c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * "This product includes software developed by the OpenSSL Project 202c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 212c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 222c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 232c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * endorse or promote products derived from this software without 242c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * prior written permission. For written permission, please contact 252c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * openssl-core@openssl.org. 262c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 272c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 5. Products derived from this software may not be called "OpenSSL" 282c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * nor may "OpenSSL" appear in their names without prior written 292c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * permission of the OpenSSL Project. 302c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 312c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 6. Redistributions of any form whatsoever must retain the following 322c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * acknowledgment: 332c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * "This product includes software developed by the OpenSSL Project 342c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 352c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 362c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 372c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 382c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 392c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 402c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 412c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 422c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 432c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 442c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 452c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 462c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 472c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * OF THE POSSIBILITY OF SUCH DAMAGE. 482c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * ==================================================================== 492c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org * 502c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org */ 512c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org 522c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org#include <openssl/opensslv.h> 532c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org#include <openssl/crypto.h> 542c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org#include <openssl/rc4.h> 552c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org 562c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.orgvoid RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) 572c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org { 582c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org#ifdef OPENSSL_FIPS 592c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org fips_cipher_abort(RC4); 602c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org#endif 612c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org private_RC4_set_key(key, len, data); 622c4508dfe2bc5b6296c01114ed11ddc64b7718c6digit@chromium.org } 63