mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 09:12:08 +02:00
sandbox: Implement fuzzing engine driver
Add a fuzzing engine driver for the sandbox to take inputs from libfuzzer and expose them to the fuzz tests. Signed-off-by: Andrew Scull <ascull@google.com>
This commit is contained in:
35
drivers/fuzz/sandbox_fuzzing_engine.c
Normal file
35
drivers/fuzz/sandbox_fuzzing_engine.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
/*
|
||||
* Copyright (c) 2022 Google, Inc.
|
||||
* Written by Andrew Scull <ascull@google.com>
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <fuzzing_engine.h>
|
||||
#include <asm/fuzzing_engine.h>
|
||||
|
||||
static int get_input(struct udevice *dev,
|
||||
const uint8_t **data,
|
||||
size_t *size)
|
||||
{
|
||||
return sandbox_fuzzing_engine_get_input(data, size);
|
||||
}
|
||||
|
||||
static const struct dm_fuzzing_engine_ops sandbox_fuzzing_engine_ops = {
|
||||
.get_input = get_input,
|
||||
};
|
||||
|
||||
static const struct udevice_id sandbox_fuzzing_engine_match[] = {
|
||||
{
|
||||
.compatible = "sandbox,fuzzing-engine",
|
||||
},
|
||||
{},
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(sandbox_fuzzing_engine) = {
|
||||
.name = "sandbox-fuzzing-engine",
|
||||
.id = UCLASS_FUZZING_ENGINE,
|
||||
.of_match = sandbox_fuzzing_engine_match,
|
||||
.ops = &sandbox_fuzzing_engine_ops,
|
||||
};
|
Reference in New Issue
Block a user