blob: 0ff751122efc95b6393f1647b59a4dc82c6917f9 [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001/**
2 * \file arc4.h
Paul Bakkere0ccd0a2009-01-04 16:27:10 +00003 *
4 * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine
5 *
Paul Bakker785a9ee2009-01-25 14:15:10 +00006 * Copyright (C) 2009 Paul Bakker <polarssl_maintainer at polarssl dot org>
Paul Bakkere0ccd0a2009-01-04 16:27:10 +00007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Paul Bakker5121ce52009-01-03 21:22:43 +000021 */
Paul Bakker40e46942009-01-03 21:51:57 +000022#ifndef POLARSSL_ARC4_H
23#define POLARSSL_ARC4_H
Paul Bakker5121ce52009-01-03 21:22:43 +000024
25/**
26 * \brief ARC4 context structure
27 */
28typedef struct
29{
30 int x; /*!< permutation index */
31 int y; /*!< permutation index */
32 unsigned char m[256]; /*!< permutation table */
33}
34arc4_context;
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/**
41 * \brief ARC4 key schedule
42 *
43 * \param ctx ARC4 context to be initialized
44 * \param key the secret key
45 * \param keylen length of the key
46 */
47void arc4_setup( arc4_context *ctx, unsigned char *key, int keylen );
48
49/**
50 * \brief ARC4 cipher function
51 *
52 * \param ctx ARC4 context
53 * \param buf buffer to be processed
54 * \param buflen amount of data in buf
55 */
56void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen );
57
58/*
59 * \brief Checkup routine
60 *
61 * \return 0 if successful, or 1 if the test failed
62 */
63int arc4_self_test( int verbose );
64
65#ifdef __cplusplus
66}
67#endif
68
69#endif /* arc4.h */