• Home
  • Raw
  • Download

Lines Matching refs:cc

20 static struct vb2_context cc;  variable
35 memset(&cc, 0, sizeof(cc)); in reset_common_data()
36 cc.workbuf = workbuf; in reset_common_data()
37 cc.workbuf_size = sizeof(workbuf); in reset_common_data()
39 vb2_init_context(&cc); in reset_common_data()
40 sd = vb2_get_sd(&cc); in reset_common_data()
42 vb2_nv_init(&cc); in reset_common_data()
44 vb2_secdata_create(&cc); in reset_common_data()
45 vb2_secdata_init(&cc); in reset_common_data()
115 cc.workbuf_used = 16; in misc_tests()
117 vb2_workbuf_from_ctx(&cc, &wb); in misc_tests()
120 TEST_EQ(wb.size, cc.workbuf_size - 16, "vb_workbuf_from_ctx() size"); in misc_tests()
147 TEST_SUCC(vb2_read_gbb_header(&cc, &gbbdest), "read gbb header good"); in gbb_tests()
151 TEST_EQ(vb2_read_gbb_header(&cc, &gbbdest), in gbb_tests()
156 TEST_EQ(vb2_read_gbb_header(&cc, &gbbdest), in gbb_tests()
161 TEST_EQ(vb2_read_gbb_header(&cc, &gbbdest), in gbb_tests()
166 TEST_SUCC(vb2_read_gbb_header(&cc, &gbbdest), in gbb_tests()
169 TEST_SUCC(vb2_read_gbb_header(&cc, &gbbdest), in gbb_tests()
172 TEST_EQ(vb2_read_gbb_header(&cc, &gbbdest), in gbb_tests()
177 TEST_EQ(vb2_read_gbb_header(&cc, &gbbdest), in gbb_tests()
179 TEST_EQ(vb2_fw_parse_gbb(&cc), in gbb_tests()
184 TEST_SUCC(vb2_fw_parse_gbb(&cc), "parse gbb"); in gbb_tests()
191 cc.workbuf_used = cc.workbuf_size - 4; in gbb_tests()
192 TEST_EQ(vb2_fw_parse_gbb(&cc), in gbb_tests()
201 vb2_fail(&cc, 1, 2); in fail_tests()
203 TEST_EQ(vb2_nv_get(&cc, VB2_NV_RECOVERY_REQUEST), in fail_tests()
205 TEST_EQ(vb2_nv_get(&cc, VB2_NV_RECOVERY_SUBCODE), in fail_tests()
209 vb2_fail(&cc, 3, 4); in fail_tests()
210 TEST_EQ(vb2_nv_get(&cc, VB2_NV_RECOVERY_REQUEST), in fail_tests()
212 TEST_EQ(vb2_nv_get(&cc, VB2_NV_RECOVERY_SUBCODE), in fail_tests()
217 vb2_nv_set(&cc, VB2_NV_TRY_COUNT, 3); in fail_tests()
218 vb2_nv_set(&cc, VB2_NV_FW_RESULT, VB2_FW_RESULT_UNKNOWN); in fail_tests()
223 vb2_fail(&cc, 5, 6); in fail_tests()
224 TEST_EQ(vb2_nv_get(&cc, VB2_NV_RECOVERY_REQUEST), 0, "vb2_failover"); in fail_tests()
225 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_RESULT), in fail_tests()
227 TEST_EQ(vb2_nv_get(&cc, VB2_NV_TRY_COUNT), 0, "vb2_fail use up tries"); in fail_tests()
228 TEST_EQ(vb2_nv_get(&cc, VB2_NV_TRY_NEXT), 1, "vb2_fail try other slot"); in fail_tests()
236 vb2_fail(&cc, 7, 8); in fail_tests()
237 TEST_EQ(vb2_nv_get(&cc, VB2_NV_RECOVERY_REQUEST), 7, in fail_tests()
239 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_RESULT), in fail_tests()
241 TEST_EQ(vb2_nv_get(&cc, VB2_NV_TRY_NEXT), 0, "vb2_fail try other slot"); in fail_tests()
248 vb2_check_recovery(&cc); in recovery_tests()
252 TEST_EQ(cc.flags & VB2_CONTEXT_RECOVERY_MODE, in recovery_tests()
257 vb2_nv_set(&cc, VB2_NV_RECOVERY_REQUEST, 3); in recovery_tests()
258 vb2_check_recovery(&cc); in recovery_tests()
260 TEST_EQ(vb2_nv_get(&cc, VB2_NV_RECOVERY_REQUEST), 0, "NV cleared"); in recovery_tests()
263 TEST_NEQ(cc.flags & VB2_CONTEXT_RECOVERY_MODE, in recovery_tests()
268 vb2_nv_set(&cc, VB2_NV_RECOVERY_REQUEST, 4); in recovery_tests()
270 vb2_check_recovery(&cc); in recovery_tests()
272 TEST_EQ(vb2_nv_get(&cc, VB2_NV_RECOVERY_REQUEST), in recovery_tests()
278 cc.flags |= VB2_CONTEXT_FORCE_RECOVERY_MODE; in recovery_tests()
279 vb2_check_recovery(&cc); in recovery_tests()
292 TEST_SUCC(vb2_check_dev_switch(&cc), "dev mode off"); in dev_switch_tests()
294 TEST_EQ(cc.flags & VB2_CONTEXT_DEVELOPER_MODE, 0, "ctx not in dev"); in dev_switch_tests()
299 vb2_secdata_set(&cc, VB2_SECDATA_FLAGS, in dev_switch_tests()
302 TEST_SUCC(vb2_check_dev_switch(&cc), "dev mode on"); in dev_switch_tests()
304 TEST_NEQ(cc.flags & VB2_CONTEXT_DEVELOPER_MODE, 0, "ctx in dev"); in dev_switch_tests()
309 vb2_nv_set(&cc, VB2_NV_DEV_BOOT_USB, 1); in dev_switch_tests()
310 vb2_nv_set(&cc, VB2_NV_DEV_BOOT_LEGACY, 1); in dev_switch_tests()
311 vb2_nv_set(&cc, VB2_NV_DEV_BOOT_SIGNED_ONLY, 1); in dev_switch_tests()
312 TEST_SUCC(vb2_check_dev_switch(&cc), "dev mode off"); in dev_switch_tests()
313 TEST_EQ(vb2_nv_get(&cc, VB2_NV_DEV_BOOT_USB), in dev_switch_tests()
315 TEST_EQ(vb2_nv_get(&cc, VB2_NV_DEV_BOOT_LEGACY), in dev_switch_tests()
317 TEST_EQ(vb2_nv_get(&cc, VB2_NV_DEV_BOOT_SIGNED_ONLY), in dev_switch_tests()
322 vb2_secdata_set(&cc, VB2_SECDATA_FLAGS, VB2_SECDATA_FLAG_DEV_MODE); in dev_switch_tests()
323 TEST_SUCC(vb2_check_dev_switch(&cc), "to dev mode"); in dev_switch_tests()
325 vb2_secdata_get(&cc, VB2_SECDATA_FLAGS, &v); in dev_switch_tests()
332 vb2_secdata_set(&cc, VB2_SECDATA_FLAGS, in dev_switch_tests()
334 TEST_SUCC(vb2_check_dev_switch(&cc), "from dev mode"); in dev_switch_tests()
336 vb2_secdata_get(&cc, VB2_SECDATA_FLAGS, &v); in dev_switch_tests()
341 vb2_secdata_set(&cc, VB2_SECDATA_FLAGS, in dev_switch_tests()
344 vb2_nv_set(&cc, VB2_NV_DISABLE_DEV_REQUEST, 1); in dev_switch_tests()
345 TEST_SUCC(vb2_check_dev_switch(&cc), "disable dev request"); in dev_switch_tests()
347 TEST_EQ(vb2_nv_get(&cc, VB2_NV_DISABLE_DEV_REQUEST), in dev_switch_tests()
353 TEST_SUCC(vb2_check_dev_switch(&cc), "dev on via gbb"); in dev_switch_tests()
355 vb2_secdata_get(&cc, VB2_SECDATA_FLAGS, &v); in dev_switch_tests()
362 cc.flags |= VB2_CONTEXT_FORCE_DEVELOPER_MODE; in dev_switch_tests()
363 TEST_SUCC(vb2_check_dev_switch(&cc), "dev on via ctx flag"); in dev_switch_tests()
365 vb2_secdata_get(&cc, VB2_SECDATA_FLAGS, &v); in dev_switch_tests()
372 vb2_secdata_set(&cc, VB2_SECDATA_FLAGS, in dev_switch_tests()
375 TEST_EQ(vb2_check_dev_switch(&cc), in dev_switch_tests()
378 vb2_secdata_get(&cc, VB2_SECDATA_FLAGS, &v); in dev_switch_tests()
381 TEST_EQ(vb2_nv_get(&cc, VB2_NV_RECOVERY_REQUEST), in dev_switch_tests()
383 TEST_EQ(vb2_nv_get(&cc, VB2_NV_RECOVERY_SUBCODE), in dev_switch_tests()
391 TEST_SUCC(vb2_check_tpm_clear(&cc), "no clear request"); in tpm_clear_tests()
396 vb2_nv_set(&cc, VB2_NV_CLEAR_TPM_OWNER_REQUEST, 1); in tpm_clear_tests()
397 TEST_SUCC(vb2_check_tpm_clear(&cc), "clear request"); in tpm_clear_tests()
398 TEST_EQ(vb2_nv_get(&cc, VB2_NV_CLEAR_TPM_OWNER_REQUEST), in tpm_clear_tests()
400 TEST_EQ(vb2_nv_get(&cc, VB2_NV_CLEAR_TPM_OWNER_DONE), in tpm_clear_tests()
407 vb2_nv_set(&cc, VB2_NV_CLEAR_TPM_OWNER_REQUEST, 1); in tpm_clear_tests()
408 TEST_EQ(vb2_check_tpm_clear(&cc), in tpm_clear_tests()
410 TEST_EQ(vb2_nv_get(&cc, VB2_NV_CLEAR_TPM_OWNER_REQUEST), in tpm_clear_tests()
412 TEST_EQ(vb2_nv_get(&cc, VB2_NV_CLEAR_TPM_OWNER_DONE), in tpm_clear_tests()
420 TEST_SUCC(vb2_select_fw_slot(&cc), "select slot A"); in select_slot_tests()
421 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_RESULT), in select_slot_tests()
424 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_TRIED), 0, "tried A"); in select_slot_tests()
426 TEST_EQ(cc.flags & VB2_CONTEXT_FW_SLOT_B, 0, "didn't choose B"); in select_slot_tests()
430 vb2_nv_set(&cc, VB2_NV_TRY_NEXT, 1); in select_slot_tests()
431 TEST_SUCC(vb2_select_fw_slot(&cc), "select slot B"); in select_slot_tests()
432 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_RESULT), in select_slot_tests()
435 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_TRIED), 1, "tried B"); in select_slot_tests()
437 TEST_NEQ(cc.flags & VB2_CONTEXT_FW_SLOT_B, 0, "ctx says choose B"); in select_slot_tests()
441 vb2_nv_set(&cc, VB2_NV_FW_RESULT, VB2_FW_RESULT_TRYING); in select_slot_tests()
442 TEST_SUCC(vb2_select_fw_slot(&cc), "select slot A out of tries"); in select_slot_tests()
443 TEST_EQ(vb2_nv_get(&cc, VB2_NV_TRY_NEXT), 1, "try B next"); in select_slot_tests()
445 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_TRIED), 1, "tried B"); in select_slot_tests()
447 TEST_NEQ(cc.flags & VB2_CONTEXT_FW_SLOT_B, 0, "ctx says choose B"); in select_slot_tests()
451 vb2_nv_set(&cc, VB2_NV_TRY_COUNT, 3); in select_slot_tests()
452 TEST_SUCC(vb2_select_fw_slot(&cc), "try slot A"); in select_slot_tests()
453 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_RESULT), in select_slot_tests()
456 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_TRIED), 0, "tried A"); in select_slot_tests()
458 TEST_EQ(cc.flags & VB2_CONTEXT_FW_SLOT_B, 0, "didn't choose B"); in select_slot_tests()
459 TEST_EQ(vb2_nv_get(&cc, VB2_NV_TRY_COUNT), 2, "tries decremented"); in select_slot_tests()
463 vb2_nv_set(&cc, VB2_NV_FW_TRIED, 0); in select_slot_tests()
464 vb2_nv_set(&cc, VB2_NV_FW_RESULT, VB2_FW_RESULT_SUCCESS); in select_slot_tests()
465 vb2_select_fw_slot(&cc); in select_slot_tests()
466 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_PREV_TRIED), 0, "prev A"); in select_slot_tests()
467 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_PREV_RESULT), VB2_FW_RESULT_SUCCESS, in select_slot_tests()
471 vb2_nv_set(&cc, VB2_NV_FW_TRIED, 1); in select_slot_tests()
472 vb2_nv_set(&cc, VB2_NV_FW_RESULT, VB2_FW_RESULT_FAILURE); in select_slot_tests()
473 vb2_select_fw_slot(&cc); in select_slot_tests()
474 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_PREV_TRIED), 1, "prev B"); in select_slot_tests()
475 TEST_EQ(vb2_nv_get(&cc, VB2_NV_FW_PREV_RESULT), VB2_FW_RESULT_FAILURE, in select_slot_tests()