update hosts for cored target

WIP: currently the hosts are not generic and don't support different
targets
This commit is contained in:
2026-04-07 20:22:12 +02:00
parent 39d2e1c51f
commit 28a3c37d41
8 changed files with 350 additions and 80 deletions

View File

@ -1,4 +1,5 @@
#include "../lib.h"
#include "../lib_cored.h"
void fail_start_trace(void) {}
void fail_stop_trace(void) {}
@ -6,18 +7,47 @@ void fail_marker_positive(void) {}
void fail_marker_negative(void) {}
void fail_marker_detected(void) {}
void init_outputs(plain_t x_c, plain_t y_c, plain_t z_c);
int wasm_module(void);
enc_t get_cored_res(void);
MAIN() {
int result;
void os_main(void) {
init_outputs(100, 142, 100);
fail_start_trace();
result = wasm_module();
sign_t static_sig = wasm_module();
fail_stop_trace();
if (result == 100) {
sign_t vote_result_sig;
switch (static_sig) {
case SIG_s_XYZ:
case SIG_s_XY:
case SIG_s_XZ:
vote_result_sig = SIG_X;
break;
case SIG_s_YZ:
vote_result_sig = SIG_Y;
break;
default:
break;
}
// Inversely apply constant program flow signature.
enc_t cored_res = get_cored_res();
cored_res -= static_sig;
/* Validate Vote result */
if (!check(cored_res, THE_A, vote_result_sig)) {
fail_marker_detected();
return;
}
plain_t res = decode(cored_res, THE_A, vote_result_sig);
if (res == 100) {
fail_marker_positive();
return;
} else {
fail_marker_negative();
return;
}
}