-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add error support when RustCrypto doesn't #176
Comments
Hi, Could you assign this issue to me? Thanks. |
Could you give an example on when a hash API should return an error? Thanks. For example, when should this call of |
Actually, all those functions should return an error for both hash and hmac: initialization, update, finalization. One solution I see is to make the Actually if use wasefire_error::Error;
trait LastError {
fn last_error(&self) -> Result<(), Error>;
} |
Thanks for the explanation! Still wanted to get more contexts:
|
This will come from the board implementation (so it won't be implemented as part of this issue). Platforms where crypto may fail at any time would have to handle an error state on their side. When an error happens during some call (e.g. initialize, update, finalize), they would need to return a dummy result (for unit-returning function it's easy) and store the error somewhere. There is a guarantee that after each function, Actually, this guarantee does not exactly hold when using a software HMAC on top of a hardware hash, because multiple operations may be called before
The The reason we don't create our own API instead of using RustCrypto, is precisely to be able to have a software implementation of HMAC done by RustCrypto. The only crypto implementation at the moment is HKDF because we can't use RustCrypto, see RustCrypto/KDFs#80. |
Fixes #176 Co-authored-by: Zhou Fang <[email protected]> Co-authored-by: Julien Cretin <[email protected]>
Fixes google#176 Co-authored-by: Zhou Fang <[email protected]> Co-authored-by: Julien Cretin <[email protected]>
After #174 the hash API doesn't support returning errors because the RustCrypto API for digest (e.g.
Update
,FixedOutput
) don't return aResult
. We should somehow add the possibility to report errors in those operations, for example using a side channel that may be checked. This could be aLastError
trait that would be used after each operation to check for error.The text was updated successfully, but these errors were encountered: