Implemented descriptor-aware program binding checks so program interpretation now consults the descriptor’s program_type_tag and program_enc_profile before decoding or tagging artifacts.
This commit is contained in:
parent
db3eb98b83
commit
6dfcb2bfc6
|
|
@ -174,7 +174,7 @@ target_include_directories(amduat_pel_seed
|
||||||
PRIVATE ${AMDUAT_INCLUDE_DIR}
|
PRIVATE ${AMDUAT_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
target_link_libraries(amduat_pel_seed
|
target_link_libraries(amduat_pel_seed
|
||||||
PRIVATE amduat_format amduat_asl_store_fs amduat_asl amduat_enc
|
PRIVATE amduat_pel amduat_format amduat_asl_store_fs amduat_asl amduat_enc
|
||||||
amduat_hash_asl1 amduat_util
|
amduat_hash_asl1 amduat_util
|
||||||
)
|
)
|
||||||
set_target_properties(amduat_pel_seed PROPERTIES OUTPUT_NAME amduat-pel-seed)
|
set_target_properties(amduat_pel_seed PROPERTIES OUTPUT_NAME amduat-pel-seed)
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ bool amduat_pel_program_dag_desc_is_canonical(
|
||||||
bool amduat_pel_program_dag_desc_is_canonical_artifact(
|
bool amduat_pel_program_dag_desc_is_canonical_artifact(
|
||||||
const amduat_artifact_t *artifact);
|
const amduat_artifact_t *artifact);
|
||||||
|
|
||||||
|
bool amduat_pel_program_dag_desc_get_program_binding(
|
||||||
|
amduat_type_tag_t *out_type_tag,
|
||||||
|
amduat_asl_encoding_profile_id_t *out_profile);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,21 @@
|
||||||
|
|
||||||
bool amduat_pel_program_decode_artifact(const amduat_artifact_t *artifact,
|
bool amduat_pel_program_decode_artifact(const amduat_artifact_t *artifact,
|
||||||
amduat_pel_program_t *out_program) {
|
amduat_pel_program_t *out_program) {
|
||||||
|
amduat_type_tag_t expected_type_tag;
|
||||||
|
amduat_asl_encoding_profile_id_t expected_profile;
|
||||||
|
|
||||||
if (artifact == NULL || out_program == NULL) {
|
if (artifact == NULL || out_program == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!amduat_pel_program_dag_desc_get_program_binding(&expected_type_tag,
|
||||||
|
&expected_profile)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (expected_profile != AMDUAT_PEL_ENC_PROGRAM_DAG_V1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (artifact->has_type_tag &&
|
if (artifact->has_type_tag &&
|
||||||
artifact->type_tag.tag_id != AMDUAT_PEL_TYPE_TAG_PROGRAM_DAG_1) {
|
artifact->type_tag.tag_id != expected_type_tag.tag_id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memset(out_program, 0, sizeof(*out_program));
|
memset(out_program, 0, sizeof(*out_program));
|
||||||
|
|
|
||||||
|
|
@ -95,3 +95,14 @@ bool amduat_pel_program_dag_desc_is_canonical_artifact(
|
||||||
amduat_enc_pel_program_dag_desc_free(&desc);
|
amduat_enc_pel_program_dag_desc_free(&desc);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool amduat_pel_program_dag_desc_get_program_binding(
|
||||||
|
amduat_type_tag_t *out_type_tag,
|
||||||
|
amduat_asl_encoding_profile_id_t *out_profile) {
|
||||||
|
if (out_type_tag == NULL || out_profile == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*out_type_tag = amduat_type_tag(AMDUAT_PEL_TYPE_TAG_PROGRAM_DAG_1);
|
||||||
|
*out_profile = AMDUAT_PEL_ENC_PROGRAM_DAG_V1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -233,13 +233,24 @@ bool amduat_pel_exec_program_artifact(amduat_artifact_t program_artifact,
|
||||||
amduat_artifact_t **out_outputs,
|
amduat_artifact_t **out_outputs,
|
||||||
size_t *out_outputs_len,
|
size_t *out_outputs_len,
|
||||||
amduat_pel_execution_result_value_t *out_result) {
|
amduat_pel_execution_result_value_t *out_result) {
|
||||||
|
amduat_type_tag_t expected_type_tag;
|
||||||
|
amduat_asl_encoding_profile_id_t expected_profile;
|
||||||
|
|
||||||
if (out_outputs == NULL || out_outputs_len == NULL || out_result == NULL) {
|
if (out_outputs == NULL || out_outputs_len == NULL || out_result == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memset(out_result, 0, sizeof(*out_result));
|
memset(out_result, 0, sizeof(*out_result));
|
||||||
|
|
||||||
|
if (!amduat_pel_program_dag_desc_get_program_binding(&expected_type_tag,
|
||||||
|
&expected_profile)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (expected_profile != AMDUAT_PEL_ENC_PROGRAM_DAG_V1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!program_artifact.has_type_tag ||
|
if (!program_artifact.has_type_tag ||
|
||||||
program_artifact.type_tag.tag_id != AMDUAT_PEL_TYPE_TAG_PROGRAM_DAG_1) {
|
program_artifact.type_tag.tag_id != expected_type_tag.tag_id) {
|
||||||
out_result->pel1_version = 1;
|
out_result->pel1_version = 1;
|
||||||
out_result->status = AMDUAT_PEL_EXEC_STATUS_INVALID_PROGRAM;
|
out_result->status = AMDUAT_PEL_EXEC_STATUS_INVALID_PROGRAM;
|
||||||
out_result->scheme_ref = amduat_pel_program_dag_scheme_ref();
|
out_result->scheme_ref = amduat_pel_program_dag_scheme_ref();
|
||||||
|
|
|
||||||
|
|
@ -457,20 +457,12 @@ bool amduat_pel_surf_run(amduat_asl_store_t *store,
|
||||||
outputs = NULL;
|
outputs = NULL;
|
||||||
outputs_len = 0;
|
outputs_len = 0;
|
||||||
memset(&trace_eval, 0, sizeof(trace_eval));
|
memset(&trace_eval, 0, sizeof(trace_eval));
|
||||||
if (!program_artifact.has_type_tag ||
|
{
|
||||||
program_artifact.type_tag.tag_id !=
|
amduat_type_tag_t expected_type_tag;
|
||||||
AMDUAT_PEL_TYPE_TAG_PROGRAM_DAG_1) {
|
amduat_asl_encoding_profile_id_t expected_profile;
|
||||||
amduat_init_core_result(&core_result, scheme_ref,
|
|
||||||
AMDUAT_PEL_EXEC_STATUS_INVALID_PROGRAM,
|
if (!amduat_pel_program_dag_desc_get_program_binding(&expected_type_tag,
|
||||||
AMDUAT_PEL_EXEC_ERROR_PROGRAM, 2);
|
&expected_profile)) {
|
||||||
amduat_surf_diag_setf(&core_result,
|
|
||||||
AMDUAT_PEL_DAG_DIAG_WRONG_TYPE_TAG,
|
|
||||||
"invalid program: wrong type tag");
|
|
||||||
} else {
|
|
||||||
amduat_pel_program_dag_decode_status_t decode_status =
|
|
||||||
amduat_enc_pel_program_dag_decode_v1_ex(program_artifact.bytes,
|
|
||||||
&program);
|
|
||||||
if (decode_status == AMDUAT_PEL_PROGRAM_DAG_DECODE_OOM) {
|
|
||||||
amduat_artifact_free(&program_artifact);
|
amduat_artifact_free(&program_artifact);
|
||||||
for (i = 0; i < input_refs_len; ++i) {
|
for (i = 0; i < input_refs_len; ++i) {
|
||||||
amduat_artifact_free(&input_artifacts[i]);
|
amduat_artifact_free(&input_artifacts[i]);
|
||||||
|
|
@ -481,22 +473,31 @@ bool amduat_pel_surf_run(amduat_asl_store_t *store,
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (decode_status != AMDUAT_PEL_PROGRAM_DAG_DECODE_OK) {
|
if (expected_profile != AMDUAT_PEL_ENC_PROGRAM_DAG_V1) {
|
||||||
|
amduat_artifact_free(&program_artifact);
|
||||||
|
for (i = 0; i < input_refs_len; ++i) {
|
||||||
|
amduat_artifact_free(&input_artifacts[i]);
|
||||||
|
}
|
||||||
|
free(input_artifacts);
|
||||||
|
if (has_params_artifact) {
|
||||||
|
amduat_artifact_free(¶ms_artifact);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!program_artifact.has_type_tag ||
|
||||||
|
program_artifact.type_tag.tag_id != expected_type_tag.tag_id) {
|
||||||
amduat_init_core_result(&core_result, scheme_ref,
|
amduat_init_core_result(&core_result, scheme_ref,
|
||||||
AMDUAT_PEL_EXEC_STATUS_INVALID_PROGRAM,
|
AMDUAT_PEL_EXEC_STATUS_INVALID_PROGRAM,
|
||||||
AMDUAT_PEL_EXEC_ERROR_PROGRAM, 2);
|
AMDUAT_PEL_EXEC_ERROR_PROGRAM, 2);
|
||||||
amduat_surf_diag_setf(&core_result,
|
amduat_surf_diag_setf(&core_result,
|
||||||
AMDUAT_PEL_DAG_DIAG_DECODE_FAILED,
|
AMDUAT_PEL_DAG_DIAG_WRONG_TYPE_TAG,
|
||||||
"invalid program: decode failed");
|
"invalid program: wrong type tag");
|
||||||
} else {
|
} else {
|
||||||
program_decoded = true;
|
amduat_pel_program_dag_decode_status_t decode_status =
|
||||||
const amduat_artifact_t *params_arg =
|
amduat_enc_pel_program_dag_decode_v1_ex(program_artifact.bytes,
|
||||||
has_params_artifact ? ¶ms_artifact : NULL;
|
&program);
|
||||||
if (!amduat_pel_program_dag_exec_trace(
|
if (decode_status == AMDUAT_PEL_PROGRAM_DAG_DECODE_OOM) {
|
||||||
&program, input_artifacts, input_refs_len, params_arg, &outputs,
|
|
||||||
&outputs_len, &core_result, &trace_eval)) {
|
|
||||||
amduat_artifact_free(&program_artifact);
|
amduat_artifact_free(&program_artifact);
|
||||||
amduat_enc_pel_program_dag_free(&program);
|
|
||||||
for (i = 0; i < input_refs_len; ++i) {
|
for (i = 0; i < input_refs_len; ++i) {
|
||||||
amduat_artifact_free(&input_artifacts[i]);
|
amduat_artifact_free(&input_artifacts[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -504,9 +505,35 @@ bool amduat_pel_surf_run(amduat_asl_store_t *store,
|
||||||
if (has_params_artifact) {
|
if (has_params_artifact) {
|
||||||
amduat_artifact_free(¶ms_artifact);
|
amduat_artifact_free(¶ms_artifact);
|
||||||
}
|
}
|
||||||
amduat_pel_program_dag_free_outputs(outputs, outputs_len);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (decode_status != AMDUAT_PEL_PROGRAM_DAG_DECODE_OK) {
|
||||||
|
amduat_init_core_result(&core_result, scheme_ref,
|
||||||
|
AMDUAT_PEL_EXEC_STATUS_INVALID_PROGRAM,
|
||||||
|
AMDUAT_PEL_EXEC_ERROR_PROGRAM, 2);
|
||||||
|
amduat_surf_diag_setf(&core_result,
|
||||||
|
AMDUAT_PEL_DAG_DIAG_DECODE_FAILED,
|
||||||
|
"invalid program: decode failed");
|
||||||
|
} else {
|
||||||
|
program_decoded = true;
|
||||||
|
const amduat_artifact_t *params_arg =
|
||||||
|
has_params_artifact ? ¶ms_artifact : NULL;
|
||||||
|
if (!amduat_pel_program_dag_exec_trace(
|
||||||
|
&program, input_artifacts, input_refs_len, params_arg, &outputs,
|
||||||
|
&outputs_len, &core_result, &trace_eval)) {
|
||||||
|
amduat_artifact_free(&program_artifact);
|
||||||
|
amduat_enc_pel_program_dag_free(&program);
|
||||||
|
for (i = 0; i < input_refs_len; ++i) {
|
||||||
|
amduat_artifact_free(&input_artifacts[i]);
|
||||||
|
}
|
||||||
|
free(input_artifacts);
|
||||||
|
if (has_params_artifact) {
|
||||||
|
amduat_artifact_free(¶ms_artifact);
|
||||||
|
}
|
||||||
|
amduat_pel_program_dag_free_outputs(outputs, outputs_len);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,16 @@ static void amduat_pel_cli_free_refs(amduat_reference_t *refs, size_t refs_len)
|
||||||
free(refs);
|
free(refs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool amduat_pel_cli_program_binding(
|
||||||
|
amduat_type_tag_t *out_type_tag,
|
||||||
|
amduat_asl_encoding_profile_id_t *out_profile) {
|
||||||
|
if (!amduat_pel_program_dag_desc_get_program_binding(out_type_tag,
|
||||||
|
out_profile)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool amduat_pel_cli_read_path_once(const char *path,
|
static bool amduat_pel_cli_read_path_once(const char *path,
|
||||||
bool *stdin_used,
|
bool *stdin_used,
|
||||||
uint8_t **out_bytes,
|
uint8_t **out_bytes,
|
||||||
|
|
@ -1174,8 +1184,21 @@ static int amduat_pel_cli_cmd_validate(
|
||||||
valid = amduat_pel_program_dag_desc_is_canonical(&desc);
|
valid = amduat_pel_program_dag_desc_is_canonical(&desc);
|
||||||
amduat_enc_pel_program_dag_desc_free(&desc);
|
amduat_enc_pel_program_dag_desc_free(&desc);
|
||||||
} else {
|
} else {
|
||||||
|
amduat_type_tag_t expected_type_tag;
|
||||||
|
amduat_asl_encoding_profile_id_t expected_profile;
|
||||||
|
if (!amduat_pel_cli_program_binding(&expected_type_tag,
|
||||||
|
&expected_profile)) {
|
||||||
|
fprintf(stderr, "error: failed to load program binding\n");
|
||||||
|
amduat_asl_artifact_free(&artifact);
|
||||||
|
return AMDUAT_PEL_CLI_EXIT_CODEC;
|
||||||
|
}
|
||||||
|
if (expected_profile != AMDUAT_PEL_ENC_PROGRAM_DAG_V1) {
|
||||||
|
fprintf(stderr, "error: unsupported program profile\n");
|
||||||
|
amduat_asl_artifact_free(&artifact);
|
||||||
|
return AMDUAT_PEL_CLI_EXIT_UNSUPPORTED;
|
||||||
|
}
|
||||||
if (artifact.has_type_tag &&
|
if (artifact.has_type_tag &&
|
||||||
artifact.type_tag.tag_id != AMDUAT_PEL_TYPE_TAG_PROGRAM_DAG_1) {
|
artifact.type_tag.tag_id != expected_type_tag.tag_id) {
|
||||||
fprintf(stderr, "error: type-tag mismatch\n");
|
fprintf(stderr, "error: type-tag mismatch\n");
|
||||||
amduat_asl_artifact_free(&artifact);
|
amduat_asl_artifact_free(&artifact);
|
||||||
return AMDUAT_PEL_CLI_EXIT_UNSUPPORTED;
|
return AMDUAT_PEL_CLI_EXIT_UNSUPPORTED;
|
||||||
|
|
@ -1366,11 +1389,26 @@ static int amduat_pel_cli_cmd_program_decode(
|
||||||
return AMDUAT_PEL_CLI_EXIT_UNSUPPORTED;
|
return AMDUAT_PEL_CLI_EXIT_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (artifact.has_type_tag &&
|
{
|
||||||
artifact.type_tag.tag_id != AMDUAT_PEL_TYPE_TAG_PROGRAM_DAG_1) {
|
amduat_type_tag_t expected_type_tag;
|
||||||
fprintf(stderr, "error: type-tag mismatch\n");
|
amduat_asl_encoding_profile_id_t expected_profile;
|
||||||
amduat_asl_artifact_free(&artifact);
|
if (!amduat_pel_cli_program_binding(&expected_type_tag,
|
||||||
return AMDUAT_PEL_CLI_EXIT_UNSUPPORTED;
|
&expected_profile)) {
|
||||||
|
fprintf(stderr, "error: failed to load program binding\n");
|
||||||
|
amduat_asl_artifact_free(&artifact);
|
||||||
|
return AMDUAT_PEL_CLI_EXIT_CODEC;
|
||||||
|
}
|
||||||
|
if (expected_profile != AMDUAT_PEL_ENC_PROGRAM_DAG_V1) {
|
||||||
|
fprintf(stderr, "error: unsupported program profile\n");
|
||||||
|
amduat_asl_artifact_free(&artifact);
|
||||||
|
return AMDUAT_PEL_CLI_EXIT_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
if (artifact.has_type_tag &&
|
||||||
|
artifact.type_tag.tag_id != expected_type_tag.tag_id) {
|
||||||
|
fprintf(stderr, "error: type-tag mismatch\n");
|
||||||
|
amduat_asl_artifact_free(&artifact);
|
||||||
|
return AMDUAT_PEL_CLI_EXIT_UNSUPPORTED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&program, 0, sizeof(program));
|
memset(&program, 0, sizeof(program));
|
||||||
|
|
@ -1405,6 +1443,8 @@ static int amduat_pel_cli_cmd_program_normalize(
|
||||||
amduat_artifact_t artifact;
|
amduat_artifact_t artifact;
|
||||||
amduat_pel_program_t program;
|
amduat_pel_program_t program;
|
||||||
amduat_octets_t normalized;
|
amduat_octets_t normalized;
|
||||||
|
amduat_type_tag_t expected_type_tag;
|
||||||
|
amduat_asl_encoding_profile_id_t expected_profile;
|
||||||
bool stdin_used = false;
|
bool stdin_used = false;
|
||||||
int exit_code = AMDUAT_PEL_CLI_EXIT_OK;
|
int exit_code = AMDUAT_PEL_CLI_EXIT_OK;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -1486,9 +1526,19 @@ static int amduat_pel_cli_cmd_program_normalize(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!amduat_pel_cli_program_binding(&expected_type_tag, &expected_profile)) {
|
||||||
|
fprintf(stderr, "error: failed to load program binding\n");
|
||||||
|
amduat_asl_artifact_free(&artifact);
|
||||||
|
return AMDUAT_PEL_CLI_EXIT_CODEC;
|
||||||
|
}
|
||||||
|
if (expected_profile != AMDUAT_PEL_ENC_PROGRAM_DAG_V1) {
|
||||||
|
fprintf(stderr, "error: unsupported program profile\n");
|
||||||
|
amduat_asl_artifact_free(&artifact);
|
||||||
|
return AMDUAT_PEL_CLI_EXIT_UNSUPPORTED;
|
||||||
|
}
|
||||||
memset(&program, 0, sizeof(program));
|
memset(&program, 0, sizeof(program));
|
||||||
if (artifact.has_type_tag &&
|
if (artifact.has_type_tag &&
|
||||||
artifact.type_tag.tag_id != AMDUAT_PEL_TYPE_TAG_PROGRAM_DAG_1) {
|
artifact.type_tag.tag_id != expected_type_tag.tag_id) {
|
||||||
fprintf(stderr, "error: type-tag mismatch\n");
|
fprintf(stderr, "error: type-tag mismatch\n");
|
||||||
amduat_asl_artifact_free(&artifact);
|
amduat_asl_artifact_free(&artifact);
|
||||||
return AMDUAT_PEL_CLI_EXIT_UNSUPPORTED;
|
return AMDUAT_PEL_CLI_EXIT_UNSUPPORTED;
|
||||||
|
|
@ -1517,9 +1567,8 @@ static int amduat_pel_cli_cmd_program_normalize(
|
||||||
} else {
|
} else {
|
||||||
amduat_type_tag_t tag =
|
amduat_type_tag_t tag =
|
||||||
has_type_tag ? type_tag
|
has_type_tag ? type_tag
|
||||||
: (artifact.has_type_tag
|
: (artifact.has_type_tag ? artifact.type_tag
|
||||||
? artifact.type_tag
|
: expected_type_tag);
|
||||||
: amduat_type_tag(AMDUAT_PEL_TYPE_TAG_PROGRAM_DAG_1));
|
|
||||||
amduat_artifact_t out_artifact =
|
amduat_artifact_t out_artifact =
|
||||||
amduat_artifact_with_type(normalized, tag);
|
amduat_artifact_with_type(normalized, tag);
|
||||||
amduat_octets_t encoded;
|
amduat_octets_t encoded;
|
||||||
|
|
@ -2420,43 +2469,52 @@ static int amduat_pel_cli_cmd_scheme_show(
|
||||||
|
|
||||||
scheme_ref = amduat_pel_program_dag_scheme_ref();
|
scheme_ref = amduat_pel_program_dag_scheme_ref();
|
||||||
|
|
||||||
if (format == AMDUAT_FORMAT_OUTPUT_TEXT) {
|
{
|
||||||
fprintf(stdout, "scheme_ref=");
|
amduat_type_tag_t expected_type_tag;
|
||||||
if (!amduat_format_ref_write_text(stdout, scheme_ref, ref_format)) {
|
amduat_asl_encoding_profile_id_t expected_profile;
|
||||||
fprintf(stderr, "error: failed to encode scheme ref\n");
|
if (!amduat_pel_cli_program_binding(&expected_type_tag,
|
||||||
|
&expected_profile)) {
|
||||||
|
fprintf(stderr, "error: failed to load program binding\n");
|
||||||
return AMDUAT_PEL_CLI_EXIT_CODEC;
|
return AMDUAT_PEL_CLI_EXIT_CODEC;
|
||||||
}
|
}
|
||||||
fputc('\n', stdout);
|
if (format == AMDUAT_FORMAT_OUTPUT_TEXT) {
|
||||||
fprintf(stdout, "program_type_tag=0x%08x\n",
|
fprintf(stdout, "scheme_ref=");
|
||||||
AMDUAT_PEL_TYPE_TAG_PROGRAM_DAG_1);
|
if (!amduat_format_ref_write_text(stdout, scheme_ref, ref_format)) {
|
||||||
fprintf(stdout, "trace_type_tag=0x%08x\n",
|
fprintf(stderr, "error: failed to encode scheme ref\n");
|
||||||
|
return AMDUAT_PEL_CLI_EXIT_CODEC;
|
||||||
|
}
|
||||||
|
fputc('\n', stdout);
|
||||||
|
fprintf(stdout, "program_type_tag=0x%08x\n",
|
||||||
|
expected_type_tag.tag_id);
|
||||||
|
fprintf(stdout, "trace_type_tag=0x%08x\n",
|
||||||
AMDUAT_TYPE_TAG_PEL_TRACE_DAG_1);
|
AMDUAT_TYPE_TAG_PEL_TRACE_DAG_1);
|
||||||
fprintf(stdout, "result_type_tag=0x%08x\n",
|
fprintf(stdout, "result_type_tag=0x%08x\n",
|
||||||
AMDUAT_TYPE_TAG_PEL1_RESULT_1);
|
AMDUAT_TYPE_TAG_PEL1_RESULT_1);
|
||||||
fprintf(stdout, "program_profile_id=0x%04x\n",
|
fprintf(stdout, "program_profile_id=0x%04x\n",
|
||||||
AMDUAT_PEL_ENC_PROGRAM_DAG_V1);
|
expected_profile);
|
||||||
fprintf(stdout, "trace_profile_id=0x%04x\n",
|
fprintf(stdout, "trace_profile_id=0x%04x\n",
|
||||||
AMDUAT_PEL_ENC_TRACE_DAG_V1);
|
AMDUAT_PEL_ENC_TRACE_DAG_V1);
|
||||||
fprintf(stdout, "result_profile_id=0x%04x\n",
|
fprintf(stdout, "result_profile_id=0x%04x\n",
|
||||||
AMDUAT_PEL_ENC_EXECUTION_RESULT_V1);
|
AMDUAT_PEL_ENC_EXECUTION_RESULT_V1);
|
||||||
} else {
|
} else {
|
||||||
fputs("{\"scheme_ref\":", stdout);
|
fputs("{\"scheme_ref\":", stdout);
|
||||||
if (!amduat_format_ref_write_json(stdout, scheme_ref, ref_format)) {
|
if (!amduat_format_ref_write_json(stdout, scheme_ref, ref_format)) {
|
||||||
fprintf(stderr, "error: failed to encode scheme ref\n");
|
fprintf(stderr, "error: failed to encode scheme ref\n");
|
||||||
return AMDUAT_PEL_CLI_EXIT_CODEC;
|
return AMDUAT_PEL_CLI_EXIT_CODEC;
|
||||||
|
}
|
||||||
|
fprintf(stdout, ",\"program_type_tag\":%u",
|
||||||
|
expected_type_tag.tag_id);
|
||||||
|
fprintf(stdout, ",\"trace_type_tag\":%u",
|
||||||
|
AMDUAT_TYPE_TAG_PEL_TRACE_DAG_1);
|
||||||
|
fprintf(stdout, ",\"result_type_tag\":%u",
|
||||||
|
AMDUAT_TYPE_TAG_PEL1_RESULT_1);
|
||||||
|
fprintf(stdout, ",\"program_profile_id\":%u",
|
||||||
|
expected_profile);
|
||||||
|
fprintf(stdout, ",\"trace_profile_id\":%u",
|
||||||
|
AMDUAT_PEL_ENC_TRACE_DAG_V1);
|
||||||
|
fprintf(stdout, ",\"result_profile_id\":%u}\n",
|
||||||
|
AMDUAT_PEL_ENC_EXECUTION_RESULT_V1);
|
||||||
}
|
}
|
||||||
fprintf(stdout, ",\"program_type_tag\":%u",
|
|
||||||
AMDUAT_PEL_TYPE_TAG_PROGRAM_DAG_1);
|
|
||||||
fprintf(stdout, ",\"trace_type_tag\":%u",
|
|
||||||
AMDUAT_TYPE_TAG_PEL_TRACE_DAG_1);
|
|
||||||
fprintf(stdout, ",\"result_type_tag\":%u",
|
|
||||||
AMDUAT_TYPE_TAG_PEL1_RESULT_1);
|
|
||||||
fprintf(stdout, ",\"program_profile_id\":%u",
|
|
||||||
AMDUAT_PEL_ENC_PROGRAM_DAG_V1);
|
|
||||||
fprintf(stdout, ",\"trace_profile_id\":%u",
|
|
||||||
AMDUAT_PEL_ENC_TRACE_DAG_V1);
|
|
||||||
fprintf(stdout, ",\"result_profile_id\":%u}\n",
|
|
||||||
AMDUAT_PEL_ENC_EXECUTION_RESULT_V1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return AMDUAT_PEL_CLI_EXIT_OK;
|
return AMDUAT_PEL_CLI_EXIT_OK;
|
||||||
|
|
|
||||||
|
|
@ -513,6 +513,8 @@ int main(int argc, char **argv) {
|
||||||
amduat_octets_t encoded;
|
amduat_octets_t encoded;
|
||||||
amduat_artifact_t artifact;
|
amduat_artifact_t artifact;
|
||||||
amduat_reference_t ref;
|
amduat_reference_t ref;
|
||||||
|
amduat_type_tag_t expected_type_tag;
|
||||||
|
amduat_asl_encoding_profile_id_t expected_profile;
|
||||||
amduat_octets_t encoded_ref;
|
amduat_octets_t encoded_ref;
|
||||||
int exit_code = AMDUAT_PEL_SEED_EXIT_OK;
|
int exit_code = AMDUAT_PEL_SEED_EXIT_OK;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -596,8 +598,22 @@ int main(int argc, char **argv) {
|
||||||
return AMDUAT_PEL_SEED_EXIT_CODEC;
|
return AMDUAT_PEL_SEED_EXIT_CODEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!amduat_pel_program_dag_desc_get_program_binding(&expected_type_tag,
|
||||||
|
&expected_profile)) {
|
||||||
|
amduat_pel_seed_program_free(&seed_program);
|
||||||
|
free((void *)encoded.data);
|
||||||
|
fprintf(stderr, "error: failed to load program binding\n");
|
||||||
|
return AMDUAT_PEL_SEED_EXIT_CODEC;
|
||||||
|
}
|
||||||
|
if (expected_profile != AMDUAT_PEL_ENC_PROGRAM_DAG_V1) {
|
||||||
|
amduat_pel_seed_program_free(&seed_program);
|
||||||
|
free((void *)encoded.data);
|
||||||
|
fprintf(stderr, "error: unsupported program profile\n");
|
||||||
|
return AMDUAT_PEL_SEED_EXIT_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
artifact = amduat_artifact_with_type(
|
artifact = amduat_artifact_with_type(
|
||||||
encoded, amduat_type_tag(AMDUAT_PEL_TYPE_TAG_PROGRAM_DAG_1));
|
encoded, expected_type_tag);
|
||||||
memset(&ref, 0, sizeof(ref));
|
memset(&ref, 0, sizeof(ref));
|
||||||
{
|
{
|
||||||
amduat_asl_store_error_t err =
|
amduat_asl_store_error_t err =
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue