Re: [PATCH] fix(message): return `BuildCapacity` from build traits

Jarkko Sakkinen <[email protected]> Mon, 1 Sep 2025 19:29:44 +0300
Newsgroups dev.linux.lists.tpm-protocol,dev.linux.lists.tpm2
Message-ID <[email protected]>
On Mon, Sep 01, 2025 at 07:16:51PM +0300, Jarkko Sakkinen wrote:
> Build traits incorrectly return `ParseCapacity` when they should return
> `BuildCapacity`. Fixup the error code.
> 
> Capacity means the value of an architectural limit in this context. E.g.,
> the builder and parser detect if a `TPML_*` has more values than the TCG
> specifications allows, and return capacity error if the limit is surpassed.
> 
> Additionally, updated documentation of these error values to better
> clarify their use and their purpose.
> 
> `BuildOverflow` is probably the most confusing of the pre-existing error
> code. It pre-dates to the time when the implementation had internal
> buffers. Right now, the only function returning that error is
> `TpmWriter::write_bytes`, and when this happens, it is a clear sign of a
> regression in the crate implementation i.e., not part of the legit behavior
> anymore.
> 
> In the main branch `BufferOverflow` will be eventually removed but it is
> out of scope for the bug fix.
> 
> Signed-off-by: Jarkko Sakkinen <[email protected]>
> ---

Since the traffic is low this more like announcing a merge than actual
request-for-review. Any further updates can be provided by sending
patches to the list.

I'll apply this to both main and 0.10.x branches.

BR, Jarkko