Skip to content

Modify AsyncSigner/Signer::reserve_size to reflect only size of expected signature #484

@vancejc-mt

Description

@vancejc-mt

Hello,

Currently the reserve_size() calls in the AsyncSigner / Signer traits have the following comment:

/// Returns the size in bytes of the largest possible expected signature.
/// Signing will fail if the result of the `sign` function is larger
/// than this value.

Which seems to suggest that this should be the largest size which the sign() call would return.

Looking at the implementation, though, reserve_size() looks to need to be the largest Cose_Sign1 structure which would ever be created; which I think contradicts the documentation. This is also somewhat awkward for any object which implements Signer/AsyncSigner which returns false for direct_cose_handling(), as they're asked to calculate a maximum size for a Cose_Sign1 structure which they aren't actually building themselves.

Are there any plans going forward on changing the behavior of reserve_size() for Signer / AsyncSigner? And if not, we may want to change the documentation?

Thanks

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions