Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file arc4.h |
| 3 | */ |
| 4 | #ifndef XYSSL_ARC4_H |
| 5 | #define XYSSL_ARC4_H |
| 6 | |
| 7 | /** |
| 8 | * \brief ARC4 context structure |
| 9 | */ |
| 10 | typedef struct |
| 11 | { |
| 12 | int x; /*!< permutation index */ |
| 13 | int y; /*!< permutation index */ |
| 14 | unsigned char m[256]; /*!< permutation table */ |
| 15 | } |
| 16 | arc4_context; |
| 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
| 22 | /** |
| 23 | * \brief ARC4 key schedule |
| 24 | * |
| 25 | * \param ctx ARC4 context to be initialized |
| 26 | * \param key the secret key |
| 27 | * \param keylen length of the key |
| 28 | */ |
| 29 | void arc4_setup( arc4_context *ctx, unsigned char *key, int keylen ); |
| 30 | |
| 31 | /** |
| 32 | * \brief ARC4 cipher function |
| 33 | * |
| 34 | * \param ctx ARC4 context |
| 35 | * \param buf buffer to be processed |
| 36 | * \param buflen amount of data in buf |
| 37 | */ |
| 38 | void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen ); |
| 39 | |
| 40 | /* |
| 41 | * \brief Checkup routine |
| 42 | * |
| 43 | * \return 0 if successful, or 1 if the test failed |
| 44 | */ |
| 45 | int arc4_self_test( int verbose ); |
| 46 | |
| 47 | #ifdef __cplusplus |
| 48 | } |
| 49 | #endif |
| 50 | |
| 51 | #endif /* arc4.h */ |