Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ596
Page ↗
Q596FWBroadcomASIC interview problem

Validate a compact secure-boot manifest

TechniquesFWValidationDebugValidatemanifest
DifficultyMedium
TopicFirmware & Validation
LanguageC
Requirements4 checkpoints
01

Problem

A boot ROM reads a fixed 16-byte manifest before starting a firmware image. Write C code that parses and validates the manifest before publishing fields.

Starting declarationC
int parse_manifest(const uint8_t raw[16],
uint32_t flash_size,
uint32_t *entry, uint32_t *image_len);
// LE: magic[0:3], entry[4:7], len[8:11], reserved[12:13], sum[14:15]

Example input and output

Use this case to check your interpretation
Input
A 16-byte BCM1 manifest has entry=0x1000, len=0x2000, zero reserved bytes, a correct seven-word checksum, and flash_size=0x10000.
Output
parse_manifest returns 0, entry=0x1000, and image_len=0x2000.
Explanation

Magic, reserved fields, checksum, and the non-wrapping interval [0x1000,0x3000) all validate before either output is written.

02

Requirements (4)

  • Require raw, entry, and image_len; require magic bytes 'B','C','M','1' and reserved bytes zero; return -1 and preserve outputs otherwise.
  • Interpret entry, len, and checksum as little-endian. The 16-bit sum of the first seven little-endian 16-bit words modulo 65536 must equal stored checksum.
  • Require len>0, entry<flash_size, and len<=flash_size-entry without unsigned overflow.
  • Only after every check, write entry and image_len and return 0.