#ifndef _RANDOM_
#define _RANDOM_

/* R_RANDOM.H - header file for R_RANDOM.C
 */

/* Copyright (C) RSA Laboratories, a division of RSA Data Security,
     Inc., created 1991. All rights reserved.
 */

/*
 * Changes by Philip NIkolov: added more function prototypes
 */

/* Random structure.
 */
typedef struct {
  unsigned int bytesNeeded;
  unsigned char state[16];
  unsigned int outputAvailable;
  unsigned char output[16];
} R_RANDOM_STRUCT;

/* basic structure initialization - to be done first */
int R_RandomInit(R_RANDOM_STRUCT *randomStruct);

/* put in some random seed data - to be done before requesting any output */
int R_RandomUpdate (R_RANDOM_STRUCT *randomStruct, unsigned char *block, 
		    unsigned int blockLen);

/* generate blockLen random bytes and put them in the given buffer */
int R_GenerateBytes (unsigned char *block, unsigned int blockLen, 
		     R_RANDOM_STRUCT *randomStruct);

/* clean up the structure when done */
void R_RandomFinal (R_RANDOM_STRUCT *randomStruct);

#endif

