# riscv lacks jitterentropy support currently if {[get_cmd_switch --autopilot] && [have_board virt_qemu_riscv]} { puts "Autopilot mode is not supported on this platform." exit 0 } set dd [installed_command dd] proc tresor_image_name { } { return "tresor_block.img" } proc lx_local_tresor_image { } { return bin/[tresor_image_name] } proc lx_autopilot_tresor_image { } { return /tmp/[tresor_image_name].[exec id -un] } proc lx_tresor_image_size_mb { } { return 400 } proc benchmark_blk_count { } { if {[have_board linux]} { # benchmarks over 50 mebibyte return 12800 } if {[have_board virt_qemu_arm_v8a]} { # benchmarks over 25 mebibyte return 6400 } # benchmarks turned off return 0 } proc block_io_vfs_ram_mb { } { if {[benchmark_blk_count] > 0} { # when benchmarks turned on set bench_mb [expr (([benchmark_blk_count] * 4096) / 1024 / 1024)] return [expr 8 * $bench_mb] } # when benchmarks turned off return 10 } proc jent_avail { } { if {[have_board pbxa9]} { return 0 } if {[have_board zynq_qemu]} { return 0 } return 1 } append build_components { core init timer server/vfs app/tresor_tester server/log_terminal server/report_rom lib/vfs_tresor_crypto_aes_cbc lib/vfs_tresor_trust_anchor lib/vfs_import } append_if [jent_avail] build_components { lib/vfs_jitterentropy } append_if [have_board linux] build_components { server/lx_fs } append_if [have_board linux] build_components { server/lx_block } build $build_components create_boot_directory append config { } if {[have_board linux]} { append config { } } else { append config { } } append config { } append_if [jent_avail] config { } append_if [expr ![jent_avail]] config { 0123456789abcdefghijklmnopqrstuv } append config { } if {[benchmark_blk_count] > 0} { append config { } } else { append config { } } append config { } install_config $config if {[have_board linux]} { exec rm -rf [lx_local_tresor_image] if { [get_cmd_switch --autopilot] } { exec rm -rf [lx_autopilot_tresor_image] catch { exec $dd if=/dev/urandom of=[lx_autopilot_tresor_image] bs=1M count=[lx_tresor_image_size_mb] } exec ln -sf -T [lx_autopilot_tresor_image] [lx_local_tresor_image] } else { catch { exec $dd if=/dev/urandom of=[lx_local_tresor_image] bs=1M count=[lx_tresor_image_size_mb] } } } append boot_modules { core init timer tresor_tester ld.lib.so log_terminal report_rom vfs libc.lib.so libcrypto.lib.so vfs.lib.so vfs_tresor_trust_anchor.lib.so vfs_tresor_crypto_aes_cbc.lib.so vfs_import.lib.so } append_if [jent_avail] boot_modules { vfs_jitterentropy.lib.so } append_if [have_board linux] boot_modules { lx_fs } append_if [have_board linux] boot_modules [tresor_image_name] build_boot_image $boot_modules append qemu_args " -nographic " set test_timeout 100 if {[benchmark_blk_count] > 0} { set test_timeout 300 } run_genode_until "child \"test\" exited with exit value.*\n" $test_timeout if {[have_board linux]} { if { [get_cmd_switch --autopilot] } { exec rm -rf [lx_local_tresor_image] exec rm -rf [lx_autopilot_tresor_image] } } grep_output {\[init\] child "test" exited with exit value} compare_output_to {[init] child "test" exited with exit value 0}