Lines Matching refs:prng_data

104 static struct prng_data_s *prng_data;  variable
170 cpacf_kmc(CPACF_KMC_PRNG, prng_data->prngws.parm_block, in prng_tdes_add_entropy()
173 memcpy(prng_data->prngws.parm_block, entropy, sizeof(entropy)); in prng_tdes_add_entropy()
189 *((__u64 *)prng_data->prngws.parm_block) ^= *((__u64 *)(buf+i)); in prng_tdes_seed()
195 prng_data->prngws.reseed_counter = 0; in prng_tdes_seed()
209 prng_data = kzalloc(datalen, GFP_KERNEL); in prng_tdes_instantiate()
210 if (!prng_data) { in prng_tdes_instantiate()
214 mutex_init(&prng_data->mutex); in prng_tdes_instantiate()
215 prng_data->buf = ((u8 *)prng_data) + sizeof(struct prng_data_s); in prng_tdes_instantiate()
216 memcpy(prng_data->prngws.parm_block, initial_parm_block, 32); in prng_tdes_instantiate()
229 kzfree(prng_data); in prng_tdes_deinstantiate()
358 prng_data = kzalloc(datalen, GFP_KERNEL); in prng_sha512_instantiate()
359 if (!prng_data) { in prng_sha512_instantiate()
363 mutex_init(&prng_data->mutex); in prng_sha512_instantiate()
364 prng_data->buf = ((u8 *)prng_data) + sizeof(struct prng_data_s); in prng_sha512_instantiate()
380 &prng_data->prnows, NULL, 0, seed, sizeof(seed)); in prng_sha512_instantiate()
385 prng_data->prev = prng_data->buf + prng_chunk_size; in prng_sha512_instantiate()
387 &prng_data->prnows, in prng_sha512_instantiate()
388 prng_data->prev, prng_chunk_size, NULL, 0); in prng_sha512_instantiate()
394 kfree(prng_data); in prng_sha512_instantiate()
402 kzfree(prng_data); in prng_sha512_deinstantiate()
418 &prng_data->prnows, NULL, 0, seed, sizeof(seed)); in prng_sha512_reseed()
429 if (prng_data->prnows.reseed_counter > prng_reseed_limit) { in prng_sha512_generate()
437 &prng_data->prnows, buf, nbytes, NULL, 0); in prng_sha512_generate()
441 if (!memcmp(prng_data->prev, buf, nbytes)) { in prng_sha512_generate()
445 memcpy(prng_data->prev, buf, nbytes); in prng_sha512_generate()
466 if (mutex_lock_interruptible(&prng_data->mutex)) in prng_tdes_read()
477 mutex_unlock(&prng_data->mutex); in prng_tdes_read()
480 if (mutex_lock_interruptible(&prng_data->mutex)) { in prng_tdes_read()
496 if (prng_data->prngws.reseed_counter > prng_reseed_limit) in prng_tdes_read()
500 *((unsigned long long *)prng_data->buf) = get_tod_clock_fast(); in prng_tdes_read()
515 cpacf_kmc(CPACF_KMC_PRNG, prng_data->prngws.parm_block, in prng_tdes_read()
516 prng_data->buf, prng_data->buf, n); in prng_tdes_read()
518 prng_data->prngws.byte_counter += n; in prng_tdes_read()
519 prng_data->prngws.reseed_counter += n; in prng_tdes_read()
521 if (copy_to_user(ubuf, prng_data->buf, chunk)) { in prng_tdes_read()
532 mutex_unlock(&prng_data->mutex); in prng_tdes_read()
549 if (mutex_lock_interruptible(&prng_data->mutex)) in prng_sha512_read()
560 mutex_unlock(&prng_data->mutex); in prng_sha512_read()
563 if (mutex_lock_interruptible(&prng_data->mutex)) { in prng_sha512_read()
569 if (prng_data->rest) { in prng_sha512_read()
571 p = prng_data->buf + prng_chunk_size - prng_data->rest; in prng_sha512_read()
572 n = (nbytes < prng_data->rest) ? in prng_sha512_read()
573 nbytes : prng_data->rest; in prng_sha512_read()
574 prng_data->rest -= n; in prng_sha512_read()
577 p = prng_data->buf; in prng_sha512_read()
585 prng_data->rest = prng_chunk_size - n; in prng_sha512_read()
588 prng_data->rest = 0; in prng_sha512_read()
601 mutex_unlock(&prng_data->mutex); in prng_sha512_read()
654 if (mutex_lock_interruptible(&prng_data->mutex)) in prng_counter_show()
657 counter = prng_data->prnows.stream_bytes; in prng_counter_show()
659 counter = prng_data->prngws.byte_counter; in prng_counter_show()
660 mutex_unlock(&prng_data->mutex); in prng_counter_show()
692 if (mutex_lock_interruptible(&prng_data->mutex)) in prng_reseed_store()
695 mutex_unlock(&prng_data->mutex); in prng_reseed_store()