Skip to content

Conversation

@cschramm
Copy link

The parser strictly checks reserved areas to be zero (even though the specification does not even require that for all of them). This is an issue when parsing future (i.e., not known to the current codebase) versions of attestation reports, where those areas may no longer be reserved.

The lax-parser feature disables that check, currently with some tradeoffs:

  • No WriteExt::skip_bytes
  • No Encoder impl for AttestationReport, Signature, and WrappedVlekHashstick
  • No compatibility with openssl and crypto_nossl

Closes #343

The parser strictly checks reserved areas to be zero (even though the specification does not even require that for all of them). This is an issue when parsing newer versions of attestation reports where those areas might not be reserved anymore. The `lax-parser` feature disables that check, currently with some tradeoffs:

* No `WriteExt::skip_bytes`
* No `Encoder` impl for `AttestationReport`, `Signature`, and `WrappedVlekHashstick`
* No compatibility with `openssl` and `crypto_nossl`

Closes virtee#343

Signed-off-by: Christopher Schramm <git@cschramm.eu>
@DGonzalezVillal
Copy link
Member

So in this solution, you would only be able to parse the attestation report, but you would not be able to write it anywhere correct? Is that still useful to you?

@DGonzalezVillal
Copy link
Member

Because the Write stuff can be modified to write the raw contents. Create something like a raw write

@cschramm
Copy link
Author

Is that still useful to you?

Absolutely, yes. I only use the parser, but not the Write stuff.

As I wrote in #343, writing could be achieved by actually reading reserved areas and carrying their contents to write them back instead of zeroes. I was under the impression, though, that you wanted to keep this a limited parse-only case.

Copy link
Member

@DGonzalezVillal DGonzalezVillal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @cschramm,

Apologies for the delay—I was out on break.

After taking a closer look at your PR, I’m thinking a better approach might be to shift from the current lax-parsing idea to something more like a raw read/write (or unsafe read/write) mode. With that approach, this feature would simply read and write the raw binary contents as-is.

In our earlier discussions, I may have implied that I wanted this scoped strictly to parsing, but after reviewing the PR and realizing that lax parsing would require disabling or weakening other APIs, I’m less comfortable with that direction. I’d prefer not to reduce existing functionality to support a single feature. This alternative also results in fewer changes overall, since it would mainly involve updating the read and write paths to operate on raw bytes without safety checks.

This keeps the library behavior unchanged for most users, while clearly shifting responsibility for validation and safety checks to users who opt into this mode.

Please let me know what you think, and apologies again for the back and forth.

Thanks!

Ok(())
}

#[cfg(not(feature = "lax-parser"))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have to disable this API for lax-parser?

Comment on lines +93 to +96
#[cfg(all(
any(feature = "openssl", feature = "crypto_nossl"),
feature = "lax-parser"
))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would lax-parser be part of this check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forward compatibility

4 participants