2 * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 * RC4 low level APIs are deprecated for public use, but still ok for internal
14 #include "internal/deprecated.h"
16 #include <openssl/rc4.h>
17 #include "rc4_local.h"
18 #include <openssl/opensslv.h>
20 const char *RC4_options(void)
22 if (sizeof(RC4_INT) == 1)
29 * RC4 as implemented from a posting from
30 * Newsgroups: sci.crypt
31 * Subject: RC4 Algorithm revealed.
32 * Message-ID: <sternCvKL4B.Hyy@netcom.com>
33 * Date: Wed, 14 Sep 1994 06:35:31 GMT
36 void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
39 register int id1, id2;
48 #define SK_LOOP(d,n) { \
50 id2 = (data[id1] + tmp + id2) & 0xff; \
51 if (++id1 == len) id1=0; \
55 for (i = 0; i < 256; i++)
57 for (i = 0; i < 256; i += 4) {