diff options
Diffstat (limited to 'futility/futility.h')
-rw-r--r-- | futility/futility.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/futility/futility.h b/futility/futility.h index dfccf6f9..8c2b809b 100644 --- a/futility/futility.h +++ b/futility/futility.h @@ -3,10 +3,15 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include <stdint.h> - #ifndef VBOOT_REFERENCE_FUTILITY_H_ #define VBOOT_REFERENCE_FUTILITY_H_ +#include <stdint.h> + +#include "vboot_common.h" +#include "gbb_header.h" + +/* This program */ +#define MYNAME "futility" /* Here's a structure to define the commands that futility implements. */ struct futil_cmd_t { @@ -46,4 +51,24 @@ extern const struct futil_cmd_t *const futil_cmds[]; #define BUILD_ASSERT(cond) _BA0_(cond, __LINE__) #endif +/* Fatal internal stupidness */ +#ifndef DIE +#define DIE do { \ + fprintf(stderr, MYNAME ": internal error at %s:%d\n", \ + __FILE__, __LINE__); \ + exit(1); \ + } while (0) +#endif + + +/* Returns true if this looks enough like a GBB header to proceed. */ +int futil_looks_like_gbb(GoogleBinaryBlockHeader *gbb, uint32_t len); + +/* + * Returns true if the gbb header is valid (and optionally updates *maxlen). + * This doesn't verify the contents, though. + */ +int futil_valid_gbb_header(GoogleBinaryBlockHeader *gbb, uint32_t len, + uint32_t *maxlen); + #endif /* VBOOT_REFERENCE_FUTILITY_H_ */ |