diff options
Diffstat (limited to 'tests/vb2_keyblock_fuzzer.c')
-rw-r--r-- | tests/vb2_keyblock_fuzzer.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/tests/vb2_keyblock_fuzzer.c b/tests/vb2_keyblock_fuzzer.c index 7ac7499c..53f2e7c5 100644 --- a/tests/vb2_keyblock_fuzzer.c +++ b/tests/vb2_keyblock_fuzzer.c @@ -10,7 +10,7 @@ #include "2rsa.h" #include "vboot_test.h" -static struct vb2_context ctx; +static struct vb2_context *ctx; __attribute__((aligned(VB2_WORKBUF_ALIGN))) static uint8_t workbuf[VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE]; static struct { @@ -73,8 +73,6 @@ vb2_error_t vb2_safe_memcmp(const void *s1, const void *s2, size_t size) int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - vb2_error_t rv; - if (size < sizeof(gbb.rootkey)) return 0; @@ -86,13 +84,10 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { mock_keyblock = data + sizeof(gbb.rootkey); mock_keyblock_size = size - sizeof(gbb.rootkey); - memset(&ctx, 0, sizeof(ctx)); - ctx.workbuf = workbuf; - ctx.workbuf_size = sizeof(workbuf); - rv = vb2_init_context(&ctx); - assert(rv == VB2_SUCCESS); + if (vb2api_init(workbuf, sizeof(workbuf), &ctx)) + abort(); - vb2_load_fw_keyblock(&ctx); + vb2_load_fw_keyblock(ctx); return 0; } |