Skip to content

Commit 2e7a2c5

Browse files
tomchyrlubos
authored andcommitted
suit: Allow to skip suit-validate sequence
Allow to skip suit-validate sequence in parent manifests. Ref: NCSDK-30155 Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 4658512 commit 2e7a2c5

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

subsys/suit/orchestrator/src/suit_orchestrator_sdfw.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ static int boot_envelope(const suit_manifest_class_id_t *class_id)
279279
}
280280
LOG_DBG("Found installed envelope");
281281

282+
#ifdef CONFIG_LOG
282283
unsigned int seq_num;
283284
suit_semver_raw_t version;
284285

@@ -293,12 +294,18 @@ static int boot_envelope(const suit_manifest_class_id_t *class_id)
293294
}
294295
LOG_INF("Booting from manifest version: %d.%d.%d-%d.%d, sequence: 0x%x", version.raw[0],
295296
version.raw[1], version.raw[2], -version.raw[3], version.raw[4], seq_num);
297+
#endif /* CONFIG_LOG */
296298

297299
err = suit_process_sequence(installed_envelope_address, installed_envelope_size,
298300
SUIT_SEQ_VALIDATE);
299301
if (err != SUIT_SUCCESS) {
300-
LOG_ERR("Failed to execute suit-validate: %d", err);
301-
return -EILSEQ;
302+
if (err == SUIT_ERR_UNAVAILABLE_COMMAND_SEQ) {
303+
LOG_DBG("Command sequence suit-validate not available - skip it");
304+
err = 0;
305+
} else {
306+
LOG_ERR("Failed to execute suit-validate: %d", err);
307+
return -EILSEQ;
308+
}
302309
}
303310

304311
LOG_INF("Processed suit-validate");

tests/subsys/suit/orchestrator/orchestrator_sdfw/src/test_boot_mode.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ ZTEST(orchestrator_boot_tests, test_valid_root_app_envelope)
298298
int err = suit_orchestrator_entry();
299299

300300
/* THEN orchestrator succeeds... */
301-
zassert_equal(0, err, "Orchestrator not initialized");
301+
zassert_equal(0, err, "Valid envelopes not accepted (err: %d)", err);
302302
/* ... and the emergency flag is not set... */
303303
zassert_equal(SUIT_PLAT_ERR_NOT_FOUND, suit_storage_report_read(0, &buf, &len),
304304
"Emergency flag set");
@@ -332,13 +332,14 @@ ZTEST(orchestrator_boot_tests, test_seq_no_validate)
332332
/* WHEN orchestrator is executed */
333333
int err = suit_orchestrator_entry();
334334

335-
/* THEN orchestrator fails (no support for reboots)... */
336-
zassert_equal(-ENOTSUP, err, "Orchestrator did not fail");
337-
/* ... and the emergency flag is set... */
338-
zassert_equal(SUIT_PLAT_SUCCESS, suit_storage_report_read(0, &buf, &len),
339-
"Emergency flag not set");
340-
/* ... and the execution mode remains unchanged */
341-
zassert_equal(EXECUTION_MODE_INVOKE, suit_execution_mode_get(), "Execution mode modified");
335+
/* THEN orchestrator succeeds... */
336+
zassert_equal(0, err, "Envelope without validate sequence not accepted (err: %d)", err);
337+
/* ... and the emergency flag is not set... */
338+
zassert_equal(SUIT_PLAT_ERR_NOT_FOUND, suit_storage_report_read(0, &buf, &len),
339+
"Emergency flag set");
340+
/* ... and the execution mode is set to the POST INVOKE */
341+
zassert_equal(EXECUTION_MODE_POST_INVOKE, suit_execution_mode_get(),
342+
"Execution mode modified");
342343
}
343344

344345
ZTEST(orchestrator_boot_tests, test_seq_validate_fail)
@@ -502,11 +503,11 @@ ZTEST(orchestrator_boot_tests, test_seq_validate_load_invoke)
502503
/* WHEN orchestrator is executed */
503504
int err = suit_orchestrator_entry();
504505

505-
/* THEN orchestrator fails (no support for reboots)... */
506-
zassert_equal(0, err, "Orchestrator not initialized");
506+
/* THEN orchestrator succeeds... */
507+
zassert_equal(0, err, "Envelope with three sequences not accepted (err: %d)", err);
507508
/* ... and the emergency flag is not set... */
508509
zassert_equal(SUIT_PLAT_ERR_NOT_FOUND, suit_storage_report_read(0, &buf, &len),
509-
"Emergency flag not set");
510+
"Emergency flag set");
510511
/* ... and the execution mode is set to the POST INVOKE */
511512
zassert_equal(EXECUTION_MODE_POST_INVOKE, suit_execution_mode_get(),
512513
"Execution mode modified");

tests/subsys/suit/orchestrator/orchestrator_sdfw/src/test_recovery_boot_mode.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,14 @@ ZTEST(orchestrator_recovery_boot_tests, test_rec_seq_no_validate)
267267
/* WHEN orchestrator is executed */
268268
int err = suit_orchestrator_entry();
269269

270-
/* THEN orchestrator fails (hard)... */
271-
zassert_equal(-EILSEQ, err, "Orchestrator did not fail");
270+
/* THEN orchestrator succeeds... */
271+
zassert_equal(0, err, "Envelope without validate sequence not accepted (err: %d)", err);
272272
/* ... and the emergency flag is set... */
273273
zassert_equal(SUIT_PLAT_SUCCESS, suit_storage_report_read(0, &buf, &len),
274274
"Emergency flag not set");
275-
/* ... and the execution mode is set to the FAIL INVOKE RECOVERY */
276-
zassert_equal(EXECUTION_MODE_FAIL_INVOKE_RECOVERY, suit_execution_mode_get(),
277-
"Execution mode not changed to the FAIL INVOKE RECOVERY");
275+
/* ... and the execution mode is set to the POST INVOKE RECOVERY */
276+
zassert_equal(EXECUTION_MODE_POST_INVOKE_RECOVERY, suit_execution_mode_get(),
277+
"Execution mode not changed to the POST INVOKE RECOVERY");
278278
}
279279

280280
ZTEST(orchestrator_recovery_boot_tests, test_rec_seq_validate_fail)

0 commit comments

Comments
 (0)