X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/d03ab969116fe715d569304c1c474749b2f64529..2685767a6125c1620719c7de6234aedf41857b7e:/rc4.h diff --git a/rc4.h b/rc4.h index adaf731..856846e 100644 --- a/rc4.h +++ b/rc4.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: rc4.h,v 1.1 1999/09/03 08:41:12 mdw Exp $ + * $Id: rc4.h,v 1.3 2000/06/17 11:55:13 mdw Exp $ * * The alleged RC4 stream cipher * @@ -30,6 +30,13 @@ /*----- Revision history --------------------------------------------------* * * $Log: rc4.h,v $ + * Revision 1.3 2000/06/17 11:55:13 mdw + * New key size interface. Allow key material to be combined with an + * existing initialized context. + * + * Revision 1.2 1999/12/10 23:27:46 mdw + * Generic cipher and RNG interfaces. + * * Revision 1.1 1999/09/03 08:41:12 mdw * Initial import. * @@ -43,8 +50,8 @@ * list. */ -#ifndef RC4_H -#define RC4_H +#ifndef CATACOMB_RC4_H +#define CATACOMB_RC4_H #ifdef __cplusplus extern "C" { @@ -56,6 +63,14 @@ #include +#ifndef CATACOMB_GCIPHER_H +# include "gcipher.h" +#endif + +#ifndef CATACOMB_GRAND_H +# include "grand.h" +#endif + /*----- Data structures ---------------------------------------------------*/ typedef struct rc4_ctx { @@ -117,6 +132,21 @@ typedef struct rc4_ctx { /*----- Functions provided ------------------------------------------------*/ +/* --- @rc4_addkey@ --- * + * + * Arguments: @rc4_ctx *ctx@ = pointer to context to key + * @const void *k@ = pointer to key data to use + * @size_t sz@ = size of the key data + * + * Returns: --- + * + * Use: Mixes key data with an RC4 context. The RC4 context is not + * reset before mixing. This may be used to mix new key + * material with an existing RC4 context. + */ + +extern void rc4_addkey(rc4_ctx */*ctx*/, const void */*k*/, size_t /*sz*/); + /* --- @rc4_init@ --- * * * Arguments: @rc4_ctx *ctx@ = pointer to context to initialize @@ -151,6 +181,28 @@ extern void rc4_encrypt(rc4_ctx */*ctx*/, const void */*src*/, void */*dest*/, size_t /*sz*/); +/*----- Generic cipher interface ------------------------------------------*/ + +#define RC4_KEYSZ 16 +extern const octet rc4_keysz[]; + +extern const gccipher rc4; + +/*----- Generic random number generator interface -------------------------*/ + +/* --- @rc4_rand@ --- * + * + * Arguments: @const void *k@ = pointer to key material + * @size_t sz@ = size of key material + * + * Returns: Pointer to generic random number generator interface. + * + * Use: Creates a random number interface wrapper around an + * OFB-mode block cipher. + */ + +extern grand *rc4_rand(const void */*k*/, size_t /*sz*/); + /*----- That's all, folks -------------------------------------------------*/ #ifdef __cplusplus