Lines Matching refs:state
57 } state; variable
121 crypto_hash_free_ctx(state.pool_ctx[n]); in fortuna_done()
122 state.pool_ctx[n] = NULL; in fortuna_done()
124 crypto_hash_free_ctx(state.reseed_ctx); in fortuna_done()
125 state.reseed_ctx = NULL; in fortuna_done()
126 crypto_cipher_free_ctx(state.ctx); in fortuna_done()
127 state.ctx = NULL; in fortuna_done()
137 COMPILE_TIME_ASSERT(sizeof(state.counter) == BLOCK_SIZE); in crypto_rng_init()
139 if (state.ctx) in crypto_rng_init()
142 memset(&state, 0, sizeof(state)); in crypto_rng_init()
145 res = crypto_hash_alloc_ctx(&state.pool_ctx[n], HASH_ALGO); in crypto_rng_init()
148 res = crypto_hash_init(state.pool_ctx[n]); in crypto_rng_init()
153 res = crypto_hash_alloc_ctx(&state.reseed_ctx, HASH_ALGO); in crypto_rng_init()
157 res = key_from_data(state.reseed_ctx, data, dlen, key); in crypto_rng_init()
167 inc_counter(state.counter); in crypto_rng_init()
168 state.ctx = ctx; in crypto_rng_init()
232 res = hash_update(state.pool_ctx[pnum], v, sizeof(v)); in add_event()
235 res = hash_update(state.pool_ctx[pnum], data, dl); in add_event()
241 if (!ADD_OVERFLOW(state.pool0_length, dl, &l)) in add_event()
242 state.pool0_length = l; in add_event()
321 TEE_Result res = crypto_cipher_update(state.ctx, in generate_blocks()
323 (void *)state.counter, in generate_blocks()
332 inc_counter(state.counter); in generate_blocks()
386 if (TEE_TIME_LT(time, state.next_reseed_time)) in reseed_rate_limiting()
390 TEE_TIME_ADD(time, time_100ms, state.next_reseed_time); in reseed_rate_limiting()
438 if (state.pool0_length < MIN_POOL_SIZE) in maybe_reseed()
444 state.reseed_count++; in maybe_reseed()
446 res = hash_init(state.reseed_ctx); in maybe_reseed()
451 n < NUM_POOLS && reseed_from_pool(state.reseed_count, n); n++) { in maybe_reseed()
452 res = restart_pool(state.pool_ctx[n], pool_digest); in maybe_reseed()
456 state.pool0_length = 0; in maybe_reseed()
458 res = hash_update(state.reseed_ctx, pool_digest, KEY_SIZE); in maybe_reseed()
462 res = hash_final(state.reseed_ctx, pool_digest); in maybe_reseed()
466 crypto_cipher_final(state.ctx); in maybe_reseed()
467 res = crypto_cipher_init(state.ctx, TEE_MODE_ENCRYPT, in maybe_reseed()
471 inc_counter(state.counter); in maybe_reseed()
480 if (!state.ctx) in fortuna_read()
499 crypto_cipher_final(state.ctx); in fortuna_read()
500 res = cipher_init(state.ctx, new_key); in fortuna_read()