source: trunk/include/polarssl/arc4.h @ 1014

Revision 1014, 2.1 KB checked in by paul, 13 months ago (diff)
  • Major type rewrite of int to size_t for most variables and arguments used for buffer lengths and loops
Line 
1/**
2 * \file arc4.h
3 *
4 * \brief The ARCFOUR stream cipher
5 *
6 *  Copyright (C) 2006-2010, Brainspark B.V.
7 *
8 *  This file is part of PolarSSL (http://www.polarssl.org)
9 *  Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
10 *
11 *  All rights reserved.
12 *
13 *  This program is free software; you can redistribute it and/or modify
14 *  it under the terms of the GNU General Public License as published by
15 *  the Free Software Foundation; either version 2 of the License, or
16 *  (at your option) any later version.
17 *
18 *  This program is distributed in the hope that it will be useful,
19 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 *  GNU General Public License for more details.
22 *
23 *  You should have received a copy of the GNU General Public License along
24 *  with this program; if not, write to the Free Software Foundation, Inc.,
25 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 */
27#ifndef POLARSSL_ARC4_H
28#define POLARSSL_ARC4_H
29
30#include <string.h>
31
32/**
33 * \brief          ARC4 context structure
34 */
35typedef struct
36{
37    int x;                      /*!< permutation index */
38    int y;                      /*!< permutation index */
39    unsigned char m[256];       /*!< permutation table */
40}
41arc4_context;
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47/**
48 * \brief          ARC4 key schedule
49 *
50 * \param ctx      ARC4 context to be initialized
51 * \param key      the secret key
52 * \param keylen   length of the key
53 */
54void arc4_setup( arc4_context *ctx, const unsigned char *key, unsigned int keylen );
55
56/**
57 * \brief          ARC4 cipher function
58 *
59 * \param ctx      ARC4 context
60 * \param length   length of the input data
61 * \param input    buffer holding the input data
62 * \param output   buffer for the output data
63 *
64 * \return         0 if successful
65 */
66int arc4_crypt( arc4_context *ctx, size_t length, const unsigned char *input,
67                unsigned char *output );
68
69/*
70 * \brief          Checkup routine
71 *
72 * \return         0 if successful, or 1 if the test failed
73 */
74int arc4_self_test( int verbose );
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif /* arc4.h */
Note: See TracBrowser for help on using the repository browser.

What are you looking for?