Lines Matching refs:bs
128 struct boot_status *bs) in boot_read_image_headers() argument
138 rc = boot_read_image_header(state, i, boot_img_hdr(state, i), bs); in boot_read_image_headers()
676 boot_status_reset(struct boot_status *bs) in boot_status_reset() argument
679 memset(&bs->enckey, 0xff, BOOT_NUM_SLOTS * BOOT_ENC_KEY_ALIGN_SIZE); in boot_status_reset()
681 memset(&bs->enctlv, 0xff, BOOT_NUM_SLOTS * BOOT_ENC_TLV_ALIGN_SIZE); in boot_status_reset()
685 bs->use_scratch = 0; in boot_status_reset()
686 bs->swap_size = 0; in boot_status_reset()
687 bs->source = 0; in boot_status_reset()
690 bs->op = BOOT_STATUS_OP_SWAP; in boot_status_reset()
692 bs->op = BOOT_STATUS_OP_MOVE; in boot_status_reset()
694 bs->idx = BOOT_STATUS_IDX_0; in boot_status_reset()
695 bs->state = BOOT_STATUS_STATE_0; in boot_status_reset()
696 bs->swap_type = BOOT_SWAP_TYPE_NONE; in boot_status_reset()
700 boot_status_is_reset(const struct boot_status *bs) in boot_status_is_reset() argument
704 bs->op == BOOT_STATUS_OP_SWAP && in boot_status_is_reset()
706 bs->op == BOOT_STATUS_OP_MOVE && in boot_status_is_reset()
708 bs->idx == BOOT_STATUS_IDX_0 && in boot_status_is_reset()
709 bs->state == BOOT_STATUS_STATE_0); in boot_status_is_reset()
721 boot_write_status(const struct boot_loader_state *state, struct boot_status *bs) in boot_write_status() argument
738 if (bs->use_scratch) { in boot_write_status()
755 boot_status_internal_off(bs, BOOT_WRITE_SZ(state)); in boot_write_status()
759 buf[0] = bs->state; in boot_write_status()
782 const struct flash_area *fap, struct boot_status *bs) in boot_image_check() argument
792 (void)bs; in boot_image_check()
801 rc = boot_enc_load(state, 1, hdr, fap, bs, 0); in boot_image_check()
803 rc = boot_enc_load(state, 1, hdr, fap, bs); in boot_image_check()
808 if (rc == 0 && boot_enc_set_key(BOOT_CURR_ENC(state), 1, bs)) { in boot_image_check()
1021 struct boot_status *bs, int expected_swap_type) argument
1057 if (bs->swap_type == BOOT_SWAP_TYPE_REVERT ||
1085 if (slot != BOOT_PRIMARY_SLOT && boot_status_is_reset(bs) &&
1127 FIH_CALL(boot_image_check, fih_rc, state, hdr, fap, bs);
1245 struct boot_status *bs) argument
1255 FIH_CALL(boot_validate_slot, fih_rc, state, BOOT_SECONDARY_SLOT, bs, swap_type);
1471 boot_copy_image(struct boot_loader_state *state, struct boot_status *bs) argument
1490 (void)bs;
1547 fap_secondary_slot, bs, 0);
1551 fap_secondary_slot, bs);
1557 if (rc == 0 && boot_enc_set_key(BOOT_CURR_ENC(state), 1, bs)) {
1646 boot_swap_image(struct boot_loader_state *state, struct boot_status *bs) argument
1664 if (boot_status_is_reset(bs)) {
1679 rc = boot_enc_load(state, 0, hdr, fap, bs, 0);
1681 rc = boot_enc_load(state, 0, hdr, fap, bs);
1686 rc = boot_enc_set_key(BOOT_CURR_ENC(state), 0, bs);
1692 memset(bs->enckey[0], 0xff, BOOT_ENC_KEY_ALIGN_SIZE);
1707 rc = boot_enc_load(state, 1, hdr, fap, bs, 0);
1709 rc = boot_enc_load(state, 1, hdr, fap, bs);
1714 rc = boot_enc_set_key(BOOT_CURR_ENC(state), 1, bs);
1720 memset(bs->enckey[1], 0xff, BOOT_ENC_KEY_ALIGN_SIZE);
1728 bs->swap_size = copy_size;
1737 rc = boot_read_swap_size(fap, &bs->swap_size);
1740 copy_size = bs->swap_size;
1744 rc = boot_read_enc_key(fap, slot, bs);
1748 if (bs->enckey[slot][i] != 0xff) {
1756 boot_enc_set_key(BOOT_CURR_ENC(state), slot, bs);
1763 swap_run(state, bs, copy_size);
1788 boot_perform_update(struct boot_loader_state *state, struct boot_status *bs) argument
1797 rc = boot_copy_image(state, bs);
1805 FIH_CALL(boot_validate_slot, fih_rc, state, BOOT_PRIMARY_SLOT, bs, 0);
1807 rc = boot_copy_image(state, bs);
1809 rc = boot_swap_image(state, bs);
1812 rc = boot_swap_image(state, bs);
1870 struct boot_status *bs) argument
1877 rc = boot_swap_image(state, bs);
1880 BOOT_SWAP_TYPE(state) = bs->swap_type;
1885 if (bs->swap_type == BOOT_SWAP_TYPE_REVERT ||
1886 bs->swap_type == BOOT_SWAP_TYPE_PERM) {
1893 if (BOOT_IS_UPGRADE(bs->swap_type)) {
1982 struct boot_status *bs) argument
2031 boot_status_reset(bs);
2034 rc = swap_read_status(state, bs);
2049 rc = boot_read_image_headers(state, !boot_status_is_reset(bs), bs);
2068 if (!boot_status_is_reset(bs)) {
2083 rc = boot_complete_partial_swap(state, bs);
2107 if (bs->swap_type == BOOT_SWAP_TYPE_NONE) {
2108 BOOT_SWAP_TYPE(state) = boot_validated_swap_type(state, bs);
2111 state, BOOT_SECONDARY_SLOT, bs, 0);
2115 BOOT_SWAP_TYPE(state) = bs->swap_type;
2133 state, BOOT_PRIMARY_SLOT, bs, 0);
2139 state, BOOT_SECONDARY_SLOT, bs, 0);
2258 struct boot_status bs; local
2349 boot_prepare_image_for_update(state, &bs);
2398 boot_status_reset(&bs);
2402 bs.swap_type = BOOT_SWAP_TYPE(state);
2423 rc = boot_perform_update(state, &bs);
2551 like_mbedtls_zeroize(&bs, sizeof(bs));
2553 memset(&bs, 0, sizeof(struct boot_status));