rng->seedCount += bytes;
if (rv == SECSuccess) rng->seedCount += bytes;
prng_RandomUpdate(RNGContext *rng, const void *data, size_t bytes){    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 = B_HASH_BUF(inputhash, data, bytes);    if (rv != SECSuccess) {	/* B_HASH_BUF set error */	return SECFailure;    }    /* --- LOCKED --- */    PZ_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.     * Algorithm 1 of FIPS 186-2 Change Notice 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 bits, so fill it     * with the first b bits sent to RNG_RandomUpdate().     */    if (rng->seedCount == 0) {	/* This is the first call to RandomUpdate().  Use a 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_2_cn_1(rng, NULL);	/* As per FIPS 140-2 continuous RNG test requirement, the first	 * iteration of output is discarded.  So here there is really	 * no output available.  This forces another execution of alg_cn_1()	 * before any bytes can be extracted from the generator.	 */	rng->avail = 0;    } else {	/* Execute the algorithm from FIPS 186-2 Change Notice 1 */	rv = alg_fips186_2_cn_1(rng, inputhash);    }    /* If got this far, have added bytes of seed data. */    rng->seedCount += bytes;    PZ_Unlock(rng->lock);    /* --- UNLOCKED --- */    /* housekeeping */    memset(inputhash, 0, BSIZE);    return rv;}