3 This file is part of the ARM-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
47 /** \typedef arcfour_ctx_t
48 * \brief type for arcfour context
50 * A variable of this type may contain a complete ARCFOUR context.
51 * The context is used to store the state of the cipher and gets
52 * created by the arcfour_init(arcfour_ctx_t *c, uint8_t *key, uint8_t length_B)
53 * function. The context is of the fixed size of 258 bytes
56 /** \struct arcfour_ctx_st
57 * \brief base for ::arcfour_ctx_t
59 * The struct holds the two indices and the S-Box
61 typedef struct arcfour_ctx_st {
67 /** \fn void arcfour_init(const void *key, uint8_t length_B, arcfour_ctx_t *ctx)
68 * \brief setup a context with a key
70 * This function sets up a ::arcfour_ctx_t context using
71 * the supplied key of the given length.
72 * \param ctx pointer to the context
73 * \param key pointer to the key
74 * \param length_b length of the key in bits
77 void arcfour_init(const void *key, uint16_t length_b, arcfour_ctx_t *ctx);
79 /** \fn uint8_t arcfour_gen(arcfour_ctx_t *ctx)
80 * \brief generates a byte of keystream
82 * This function generates the next byte of keystream
83 * from the supplied ::arcfour_ctx_t context which is updated accordingly
85 * \param ctx pointer to the context
86 * \return byte of keystream
89 uint8_t arcfour_gen(arcfour_ctx_t *ctx);