Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:14

0001 /* arcfour.h
0002 
0003    The arcfour/rc4 stream cipher.
0004 
0005    Copyright (C) 2001, 2014 Niels Möller
0006 
0007    This file is part of GNU Nettle.
0008 
0009    GNU Nettle is free software: you can redistribute it and/or
0010    modify it under the terms of either:
0011 
0012      * the GNU Lesser General Public License as published by the Free
0013        Software Foundation; either version 3 of the License, or (at your
0014        option) any later version.
0015 
0016    or
0017 
0018      * the GNU General Public License as published by the Free
0019        Software Foundation; either version 2 of the License, or (at your
0020        option) any later version.
0021 
0022    or both in parallel, as here.
0023 
0024    GNU Nettle is distributed in the hope that it will be useful,
0025    but WITHOUT ANY WARRANTY; without even the implied warranty of
0026    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0027    General Public License for more details.
0028 
0029    You should have received copies of the GNU General Public License and
0030    the GNU Lesser General Public License along with this program.  If
0031    not, see http://www.gnu.org/licenses/.
0032 */
0033  
0034 #ifndef NETTLE_ARCFOUR_H_INCLUDED
0035 #define NETTLE_ARCFOUR_H_INCLUDED
0036 
0037 #include "nettle-types.h"
0038 
0039 #ifdef __cplusplus
0040 extern "C" {
0041 #endif
0042 
0043 /* Name mangling */
0044 #define arcfour128_set_key nettle_arcfour128_set_key
0045 #define arcfour_set_key nettle_arcfour_set_key
0046 #define arcfour_crypt nettle_arcfour_crypt
0047 
0048 /* Minimum and maximum keysizes, and a reasonable default. In
0049  * octets.*/
0050 #define ARCFOUR_MIN_KEY_SIZE 1
0051 #define ARCFOUR_MAX_KEY_SIZE 256
0052 #define ARCFOUR_KEY_SIZE 16
0053 #define ARCFOUR128_KEY_SIZE 16
0054 
0055 struct arcfour_ctx
0056 {
0057   uint8_t S[256];
0058   uint8_t i;
0059   uint8_t j;
0060 };
0061 
0062 void
0063 arcfour_set_key(struct arcfour_ctx *ctx,
0064         size_t length, const uint8_t *key);
0065 
0066 void
0067 arcfour128_set_key(struct arcfour_ctx *ctx, const uint8_t *key);
0068 
0069 void
0070 arcfour_crypt(struct arcfour_ctx *ctx,
0071           size_t length, uint8_t *dst,
0072           const uint8_t *src);
0073 
0074 #ifdef __cplusplus
0075 }
0076 #endif
0077 
0078 #endif /* NETTLE_ARCFOUR_H_INCLUDED */
0079