Skip to content

Commit

Permalink
manifest: use cbor-diag module
Browse files Browse the repository at this point in the history
Use the `cbor-diag` ruby gem instead of CBOR2 to manifest encoding and
decoding. It seems to encode and decode more accurately over the CBOR2
module. Manifests serialized by CBOR2 could not be properly
decoded by `cbor.me`.

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
  • Loading branch information
twilfredo committed Feb 28, 2024
1 parent 72568fb commit 8be6693
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 237 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ certs/slot*/bundle*
certs/slot*/immutable.sha
manifest.cbor
manifest/manifest.out.cbor
manifest/responder_manifest.cbor
manifest/*.pretty

170 changes: 26 additions & 144 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ path = "src/main.rs"

[build-dependencies]
bindgen = "0.63"
which = "6.0.0"

[dependencies]
log = "0.4"
Expand All @@ -34,10 +35,7 @@ memmap2 = { version = "0.5", optional = true}
once_cell = { version = "1.16", optional = true}
sha2 = { version = "0.10", optional = true}
env_logger = { version = "0.10", optional = true}
colored = "2.1.0"
which = "6.0.0"

libmctp = { git = "https://github.com/westerndigitalcorporation/libmctp.git" }

[dependencies.pyo3]
version = "0.20.2"
features = ["auto-initialize", "abi3-py312"]

29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,37 @@ You will also need a few host dependencies
sudo dnf install cmake clang-libs clang-devel pciutils-devel openssl openssl-devel python3-devel
```

## Python
## Ruby

spdm-utils requires the [cbor2](https://pypi.org/project/cbor2/) python module for manifest encoding and decoding. It can be installed with:
`spdm-utils` uses the [cbor-diag](https://github.com/cabo/cbor-diag) ruby gem for
manifest encoding and decoding. Similar to the implementation of this [CBOR parsing](https://cbor.me/)
online tool.

You will first need to have `gem` installed, this is a the package manager for ruby.
For example, for Fedora you can install it with:

```shell
$ sudo dnf install gem
```

After which, you can install `cbor-diag`

```shell
$ gem install cbor-diag
```
$ pip install cbor2

The default binary path *should* be, `$HOME/bin/`, which you may need to add to
your `PATH`. You can test that the scripts are usable with

```shell
$ which cbor2diag.rb
home/<user>/bin/cbor2diag.rb
```

When building `spdm-utils` it will generate a `manifest.out.cbor` which contains
the serialised cbor manifest, and also a `manifest.pretty` which is the *pretty* format
of the manifest (user friendly).

# Building

Initialise all sub-modules
Expand Down
Loading

0 comments on commit 8be6693

Please sign in to comment.