lowRISC / lowRISC/manticore

Implement FPM policy validation algorithm

Open
#5 0 comments 0 reactions 1 assignee View on GitHub

@mcy is already working on this.

Since Sep 17, 2020.

Dominant language
Rust
Stars
17
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Pesudocode for the algorithm:
```rust
fn verify_policy(
fpm: Fpm,
flash: &impl Flash,
hash_builder: &impl ha256::Builder
) -> Result {
for fw in fpm.fw_versions {
let version = flash.read(fw.version_addr, fw.version_len);
if version != fw.version {
continue
}
let mut sha = hash_builder.new();
for (ptr, len) in fw.signed_regions {
// Note: this is grossly exaggerated. There is an expectation that
// data will be fed into the hashing engine in small packets (O(1K),
// for example.
sha.write(flash.read(ptr, len));
}
if fw.signed_region_hash != sha.finish() {
return Err("hash mismatch");
}

let unused_regions = regions_except(flash, [fw.signed_regions,
fw.write_regions]);
for (ptr, len) in unused_regions {
for byte in flash.read(ptr, len) {
return Err("bad byte in blank region");
}
}
return fw
}
return Err("failed to find an acceptable version")
}
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.