memset(data, 0, bytes);
prng_RandomUpdate(RNGContext *rng, void *data, size_t bytes, unsigned char *q){    SECStatus rv = SECSuccess;    unsigned char inputhash[BSIZE];    /* check for a valid global RNG context */    PORT_Assert(rng != NULL);    if (rng == NULL) {	PORT_SetError(SEC_ERROR_INVALID_ARGS);	return SECFailure;    }    /* RNG_SystemInfoForRNG() sometimes does this, not really an error */    if (bytes == 0)	return SECSuccess;    /* If received 20 bytes of input, use it, else hash the input before      * locking.     */    if (bytes == BSIZE)	memcpy(inputhash, data, BSIZE);    else	rv = SHA1_HashBuf(inputhash, data, bytes);    if (rv != SECSuccess) {	PORT_SetError(SEC_ERROR_INVALID_ARGS);	return SECFailure;    }    /* --- LOCKED --- */    PR_Lock(rng->lock);    /*     * Random information is initially supplied by a call to     * RNG_SystemInfoForRNG().  That function collects entropy from     * the system and calls RNG_RandomUpdate() to seed the generator.     * FIPS 186-1 3.1 step 1 specifies that a secret value for the     * seed-key must be chosen before the generator can begin.  The     * size of XKEY is b-bytes, so fill it with the first b-bytes     * sent to RNG_RandomUpdate().     */    if (rng->seedCount == 0) {	/* This is the first call to RandomUpdate().  Use a SHA1 hash	 * of the input to set the seed, XKEY.	 *	 * <Step 1> copy seed bytes into context's XKEY	 */	memcpy(rng->XKEY, inputhash, BSIZE);	/* 	 * Now continue with algorithm.  Since the input was used to	 * initialize XKEY, the "optional user input" at this stage	 * will be a pad of zeros, XSEEDj = 0.	 */	rv = alg_fips186_1_x3_1(rng, NULL, q);	/* As per FIPS 140-1 continuous RNG requirement, the first	 * iteration of output is discarded.  So here there is really	 * no output available.  This forces another execution of alg3_1()	 * before any bytes can be extracted from the generator.	 */	rng->avail = 0;    } else {	/* Execute the algorithm from FIPS 186-1 appendix 3.1 */	rv = alg_fips186_1_x3_1(rng, inputhash, q);    }    /* If got this far, have added bytes of seed data. */    rng->seedCount += bytes;    PR_Unlock(rng->lock);    /* --- UNLOCKED --- */    /* housekeeping */    memset(inputhash, 0, BSIZE);    memset(data, 0, bytes);  /* let the caller free */    return rv;}