| 1 | /* $NetBSD: arc4.h,v 1.5 2014/08/10 16:44:35 tls Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * ARC4 implementation |
| 5 | * A Stream Cipher Encryption Algorithm "Arcfour" |
| 6 | * <draft-kaukonen-cipher-arcfour-03.txt> |
| 7 | */ |
| 8 | |
| 9 | /* This code illustrates a sample implementation |
| 10 | * of the Arcfour algorithm |
| 11 | * Copyright (c) April 29, 1997 Kalle Kaukonen. |
| 12 | * All Rights Reserved. |
| 13 | * |
| 14 | * Redistribution and use in source and binary forms, with or |
| 15 | * without modification, are permitted provided that this copyright |
| 16 | * notice and disclaimer are retained. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY KALLE KAUKONEN AND CONTRIBUTORS ``AS |
| 19 | * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KALLE |
| 22 | * KAUKONEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 27 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef _CRYPTO_ARC4_H_ |
| 33 | #define _CRYPTO_ARC4_H_ |
| 34 | |
| 35 | typedef struct arc4_ctx { |
| 36 | unsigned int x; |
| 37 | unsigned int y; |
| 38 | unsigned int state[256]; |
| 39 | /* was unsigned char, changed to int for performance -- onoe */ |
| 40 | } arc4_ctx_t; |
| 41 | |
| 42 | int arc4_ctxlen(void); |
| 43 | void arc4_setkey(void *, const u_char *, unsigned int); |
| 44 | void arc4_encrypt(void *, u_char *, const u_char *, int); |
| 45 | void arc4_decrypt(void *, u_char *, const u_char *, int); |
| 46 | |
| 47 | void arc4_stream(void *, u_char *, int); |
| 48 | |
| 49 | #endif /* _CRYPTO_ARC4_H_ */ |
| 50 | |