3 This file is part of the AVR-Crypto-Lib.
4 Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * Description: Implementation of the ARCFOUR (RC4 compatible) stream cipher algorithm.
32 * \brief Implementation of the ARCFOUR (RC4 compatible) stream cipher algorithm.
34 * This header file defines the interface of the ARCFOUR cipher implementation.
36 * This implementation aims to be compatible with the ARCFOUR description
38 * http://www.mozilla.org/projects/security/pki/nss/draft-kaukonen-cipher-arcfour-03.txt
46 /** \typedef arcfour_ctx_t
47 * \brief type for arcfour context
49 * A variable of this type may contain a complete ARCFOUR context.
50 * The context is used to store the state of the cipher and gets
51 * created by the arcfour_init(arcfour_ctx_t *c, uint8_t *key, uint8_t length_B)
52 * function. The context is of the fixed size of 258 bytes
55 /** \struct arcfour_ctx_st
56 * \brief base for ::arcfour_ctx_t
58 * The struct holds the two indices and the S-Box
60 typedef struct arcfour_ctx_st {
65 /** \fn void arcfour_init(const void *key, uint8_t length_B, arcfour_ctx_t *ctx)
66 * \brief setup a context with a key
68 * This function sets up a ::arcfour_ctx_t context using
69 * the supplied key of the given length.
70 * \param ctx pointer to the context
71 * \param key pointer to the key
72 * \param length_b length of the key in bits (between 8 and 2048)
75 void arcfour_init(const void *key, uint16_t length_b, arcfour_ctx_t *ctx);
77 /** \fn uint8_t arcfour_gen(arcfour_ctx_t *ctx)
78 * \brief generates a byte of keystream
80 * This function generates the next byte of keystream
81 * from the supplied ::arcfour_ctx_t context which is updated accordingly
83 * \param ctx pointer to the context
84 * \return byte of keystream
87 uint8_t arcfour_gen(arcfour_ctx_t *ctx);