Lines Matching refs:res

99 	TEE_Result res;  in key_from_data()  local
101 res = hash_init(ctx); in key_from_data()
102 if (res) in key_from_data()
103 return res; in key_from_data()
104 res = hash_update(ctx, data, dlen); in key_from_data()
105 if (res) in key_from_data()
106 return res; in key_from_data()
132 TEE_Result res; in crypto_rng_init() local
145 res = crypto_hash_alloc_ctx(&state.pool_ctx[n], HASH_ALGO); in crypto_rng_init()
146 if (res) in crypto_rng_init()
148 res = crypto_hash_init(state.pool_ctx[n]); in crypto_rng_init()
149 if (res) in crypto_rng_init()
153 res = crypto_hash_alloc_ctx(&state.reseed_ctx, HASH_ALGO); in crypto_rng_init()
154 if (res) in crypto_rng_init()
157 res = key_from_data(state.reseed_ctx, data, dlen, key); in crypto_rng_init()
158 if (res) in crypto_rng_init()
159 return res; in crypto_rng_init()
161 res = crypto_cipher_alloc_ctx(&ctx, CIPHER_ALGO); in crypto_rng_init()
162 if (res) in crypto_rng_init()
163 return res; in crypto_rng_init()
164 res = cipher_init(ctx, key); in crypto_rng_init()
165 if (res) in crypto_rng_init()
166 return res; in crypto_rng_init()
172 return res; in crypto_rng_init()
225 TEE_Result res; in add_event() local
232 res = hash_update(state.pool_ctx[pnum], v, sizeof(v)); in add_event()
233 if (res) in add_event()
234 return res; in add_event()
235 res = hash_update(state.pool_ctx[pnum], data, dl); in add_event()
236 if (res) in add_event()
237 return res; in add_event()
251 TEE_Result res; in drain_ring_buffer() local
261 res = add_event(snum, pnum, data, dlen); in drain_ring_buffer()
262 if (res) in drain_ring_buffer()
263 return res; in drain_ring_buffer()
321 TEE_Result res = crypto_cipher_update(state.ctx, in generate_blocks() local
333 if (res) in generate_blocks()
334 return res; in generate_blocks()
343 TEE_Result res; in generate_random_data() local
345 res = generate_blocks(buf, blen / BLOCK_SIZE); in generate_random_data()
346 if (res) in generate_random_data()
347 return res; in generate_random_data()
352 res = generate_blocks(block, 1); in generate_random_data()
353 if (res) in generate_random_data()
354 return res; in generate_random_data()
374 TEE_Result res; in reseed_rate_limiting() local
378 res = tee_time_get_sys_time(&time); in reseed_rate_limiting()
383 if (res) in reseed_rate_limiting()
397 TEE_Result res = hash_final(pool_ctx, pool_digest); in restart_pool() local
399 if (res) in restart_pool()
400 return res; in restart_pool()
402 res = hash_init(pool_ctx); in restart_pool()
403 if (res) in restart_pool()
404 return res; in restart_pool()
434 TEE_Result res; in maybe_reseed() local
446 res = hash_init(state.reseed_ctx); in maybe_reseed()
447 if (res) in maybe_reseed()
448 return res; in maybe_reseed()
452 res = restart_pool(state.pool_ctx[n], pool_digest); in maybe_reseed()
453 if (res) in maybe_reseed()
454 return res; in maybe_reseed()
458 res = hash_update(state.reseed_ctx, pool_digest, KEY_SIZE); in maybe_reseed()
459 if (res) in maybe_reseed()
460 return res; in maybe_reseed()
462 res = hash_final(state.reseed_ctx, pool_digest); in maybe_reseed()
463 if (res) in maybe_reseed()
464 return res; in maybe_reseed()
467 res = crypto_cipher_init(state.ctx, TEE_MODE_ENCRYPT, in maybe_reseed()
469 if (res) in maybe_reseed()
470 return res; in maybe_reseed()
478 TEE_Result res; in fortuna_read() local
485 res = maybe_reseed(); in fortuna_read()
486 if (res) in fortuna_read()
492 res = generate_random_data(buf, blen); in fortuna_read()
493 if (res) in fortuna_read()
496 res = generate_blocks(new_key, KEY_SIZE / BLOCK_SIZE); in fortuna_read()
497 if (res) in fortuna_read()
500 res = cipher_init(state.ctx, new_key); in fortuna_read()
501 if (res) in fortuna_read()
505 res = drain_ring_buffer(); in fortuna_read()
507 if (res) in fortuna_read()
511 return res; in fortuna_read()
519 TEE_Result res; in crypto_rng_read() local
526 res = fortuna_read((uint8_t *)buf + offs, n); in crypto_rng_read()
527 if (res) in crypto_rng_read()
528 return res; in crypto_rng_read()