Lines Matching refs:ret

147     int idx, ret = 0;  in mbedtls_entropy_add_source()  local
150 if( ( ret = mbedtls_mutex_lock( &ctx->mutex ) ) != 0 ) in mbedtls_entropy_add_source()
151 return( ret ); in mbedtls_entropy_add_source()
157 ret = MBEDTLS_ERR_ENTROPY_MAX_SOURCES; in mbedtls_entropy_add_source()
174 return( ret ); in mbedtls_entropy_add_source()
187 int ret = 0; in entropy_update() local
192 if( ( ret = mbedtls_sha512_ret( data, len, tmp, 0 ) ) != 0 ) in entropy_update()
195 if( ( ret = mbedtls_sha256_ret( data, len, tmp, 0 ) ) != 0 ) in entropy_update()
212 ( ret = mbedtls_sha512_starts_ret( &ctx->accumulator, 0 ) ) != 0 ) in entropy_update()
216 if( ( ret = mbedtls_sha512_update_ret( &ctx->accumulator, header, 2 ) ) != 0 ) in entropy_update()
218 ret = mbedtls_sha512_update_ret( &ctx->accumulator, p, use_len ); in entropy_update()
221 ( ret = mbedtls_sha256_starts_ret( &ctx->accumulator, 0 ) ) != 0 ) in entropy_update()
225 if( ( ret = mbedtls_sha256_update_ret( &ctx->accumulator, header, 2 ) ) != 0 ) in entropy_update()
227 ret = mbedtls_sha256_update_ret( &ctx->accumulator, p, use_len ); in entropy_update()
233 return( ret ); in entropy_update()
239 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_entropy_update_manual() local
242 if( ( ret = mbedtls_mutex_lock( &ctx->mutex ) ) != 0 ) in mbedtls_entropy_update_manual()
243 return( ret ); in mbedtls_entropy_update_manual()
246 ret = entropy_update( ctx, MBEDTLS_ENTROPY_SOURCE_MANUAL, data, len ); in mbedtls_entropy_update_manual()
253 return( ret ); in mbedtls_entropy_update_manual()
261 int ret = MBEDTLS_ERR_ENTROPY_SOURCE_FAILED; in entropy_gather_internal() local
279 if( ( ret = ctx->source[i].f_source( ctx->source[i].p_source, in entropy_gather_internal()
290 if( ( ret = entropy_update( ctx, (unsigned char) i, in entropy_gather_internal()
292 return( ret ); in entropy_gather_internal()
298 ret = MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE; in entropy_gather_internal()
303 return( ret ); in entropy_gather_internal()
311 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_entropy_gather() local
314 if( ( ret = mbedtls_mutex_lock( &ctx->mutex ) ) != 0 ) in mbedtls_entropy_gather()
315 return( ret ); in mbedtls_entropy_gather()
318 ret = entropy_gather_internal( ctx ); in mbedtls_entropy_gather()
325 return( ret ); in mbedtls_entropy_gather()
330 int ret, count = 0, i, thresholds_reached; in mbedtls_entropy_func() local
345 if( ( ret = mbedtls_entropy_update_nv_seed( ctx ) ) != 0 ) in mbedtls_entropy_func()
346 return( ret ); in mbedtls_entropy_func()
351 if( ( ret = mbedtls_mutex_lock( &ctx->mutex ) ) != 0 ) in mbedtls_entropy_func()
352 return( ret ); in mbedtls_entropy_func()
362 ret = MBEDTLS_ERR_ENTROPY_SOURCE_FAILED; in mbedtls_entropy_func()
366 if( ( ret = entropy_gather_internal( ctx ) ) != 0 ) in mbedtls_entropy_func()
389 if( ( ret = mbedtls_sha512_finish_ret( &ctx->accumulator, buf ) ) != 0 ) in mbedtls_entropy_func()
397 if( ( ret = mbedtls_sha512_starts_ret( &ctx->accumulator, 0 ) ) != 0 ) in mbedtls_entropy_func()
399 if( ( ret = mbedtls_sha512_update_ret( &ctx->accumulator, buf, in mbedtls_entropy_func()
406 if( ( ret = mbedtls_sha512_ret( buf, MBEDTLS_ENTROPY_BLOCK_SIZE, in mbedtls_entropy_func()
410 if( ( ret = mbedtls_sha256_finish_ret( &ctx->accumulator, buf ) ) != 0 ) in mbedtls_entropy_func()
418 if( ( ret = mbedtls_sha256_starts_ret( &ctx->accumulator, 0 ) ) != 0 ) in mbedtls_entropy_func()
420 if( ( ret = mbedtls_sha256_update_ret( &ctx->accumulator, buf, in mbedtls_entropy_func()
427 if( ( ret = mbedtls_sha256_ret( buf, MBEDTLS_ENTROPY_BLOCK_SIZE, in mbedtls_entropy_func()
437 ret = 0; in mbedtls_entropy_func()
447 return( ret ); in mbedtls_entropy_func()
453 int ret = MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR; in mbedtls_entropy_update_nv_seed() local
457 if( ( ret = mbedtls_entropy_func( ctx, buf, MBEDTLS_ENTROPY_BLOCK_SIZE ) ) != 0 ) in mbedtls_entropy_update_nv_seed()
458 return( ret ); in mbedtls_entropy_update_nv_seed()
465 ret = mbedtls_entropy_update_manual( ctx, buf, MBEDTLS_ENTROPY_BLOCK_SIZE ); in mbedtls_entropy_update_nv_seed()
467 return( ret ); in mbedtls_entropy_update_nv_seed()
474 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_entropy_write_seed_file() local
478 if( ( ret = mbedtls_entropy_func( ctx, buf, MBEDTLS_ENTROPY_BLOCK_SIZE ) ) != 0 ) in mbedtls_entropy_write_seed_file()
480 ret = MBEDTLS_ERR_ENTROPY_SOURCE_FAILED; in mbedtls_entropy_write_seed_file()
486 ret = MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR; in mbedtls_entropy_write_seed_file()
492 ret = MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR; in mbedtls_entropy_write_seed_file()
496 ret = 0; in mbedtls_entropy_write_seed_file()
504 return( ret ); in mbedtls_entropy_write_seed_file()
509 int ret = 0; in mbedtls_entropy_update_seed_file() local
525 ret = MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR; in mbedtls_entropy_update_seed_file()
527 ret = mbedtls_entropy_update_manual( ctx, buf, n ); in mbedtls_entropy_update_seed_file()
533 if( ret != 0 ) in mbedtls_entropy_update_seed_file()
534 return( ret ); in mbedtls_entropy_update_seed_file()
561 int ret = 0; in mbedtls_entropy_source_self_test_gather() local
568 if( ( ret = mbedtls_hardware_poll( NULL, buf + entropy_len, in mbedtls_entropy_source_self_test_gather()
570 return( ret ); in mbedtls_entropy_source_self_test_gather()
578 ret = 1; in mbedtls_entropy_source_self_test_gather()
581 return( ret ); in mbedtls_entropy_source_self_test_gather()
614 int ret = 0; in mbedtls_entropy_source_self_test() local
624 if( ( ret = mbedtls_entropy_source_self_test_gather( buf0, sizeof( buf0 ) ) ) != 0 ) in mbedtls_entropy_source_self_test()
626 if( ( ret = mbedtls_entropy_source_self_test_gather( buf1, sizeof( buf1 ) ) ) != 0 ) in mbedtls_entropy_source_self_test()
630 if( ( ret = mbedtls_entropy_source_self_test_check_bits( buf0, sizeof( buf0 ) ) ) != 0 ) in mbedtls_entropy_source_self_test()
632 if( ( ret = mbedtls_entropy_source_self_test_check_bits( buf1, sizeof( buf1 ) ) ) != 0 ) in mbedtls_entropy_source_self_test()
637 ret = memcmp( buf0, buf1, sizeof( buf0 ) ) == 0; in mbedtls_entropy_source_self_test()
642 if( ret != 0 ) in mbedtls_entropy_source_self_test()
650 return( ret != 0 ); in mbedtls_entropy_source_self_test()
662 int ret = 1; in mbedtls_entropy_self_test() local
677 if( ( ret = mbedtls_entropy_gather( &ctx ) ) != 0 ) in mbedtls_entropy_self_test()
680 ret = mbedtls_entropy_add_source( &ctx, entropy_dummy_source, NULL, 16, in mbedtls_entropy_self_test()
682 if( ret != 0 ) in mbedtls_entropy_self_test()
685 if( ( ret = mbedtls_entropy_update_manual( &ctx, buf, sizeof buf ) ) != 0 ) in mbedtls_entropy_self_test()
698 if( ( ret = mbedtls_entropy_func( &ctx, buf, sizeof( buf ) ) ) != 0 ) in mbedtls_entropy_self_test()
709 ret = 1; in mbedtls_entropy_self_test()
715 if( ( ret = mbedtls_entropy_source_self_test( 0 ) ) != 0 ) in mbedtls_entropy_self_test()
725 if( ret != 0 ) in mbedtls_entropy_self_test()
733 return( ret != 0 ); in mbedtls_entropy_self_test()