crypto ahash error handling
Hello,
When using crypto ahash API, is it necessary/mandatory to call crypto_ahash_final() if crypto_ahash_update() returns error...
Basically it might happen after several calls while calculating hash if HW error happens.
It is not possible to continue hash calculation. it is necessary to reset HW and start whole hash again..
Any comments?
Thanks,
Dmitry
Herbert Xu
maintainerQuoted 5 lines · Dmitry Kasatkin
Hello,
When using crypto ahash API, is it necessary/mandatory to call
crypto_ahash_final()ifcrypto_ahash_update()returns error...
Quoted 8 lines
Basically it might happen after several calls while calculating hash if HW error happens.
It is not possible to continue hash calculation. it is necessary to reset HW and start whole hash again..Any comments?
From the driver's perspective you cannot expect that the user
will call crypto_ahash_final in this case, or for that matter in any other case as the user is always free to leave a hash in an unfinalised state.
Cheers,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
This is not good.
Driver might allocate some resources, which needs to be released. crypto_ahash_final() should do some kind of "cleanup" task.
- Dmitry
Quoted 21 lines · ext Herbert Xu
Quoted 5 lines · Dmitry Kasatkin
Hello,
When using crypto ahash API, is it necessary/mandatory to call
crypto_ahash_final()ifcrypto_ahash_update()returns error...Quoted 7 lines
Basically it might happen after several calls while calculating hash if HW error happens.
It is not possible to continue hash calculation. it is necessary to reset HW and start whole hash again..Any comments?
From the driver's perspective you cannot expect that the user will call
crypto_ahash_finalin this case, or for that matter in any other case as the user is always free to leave a hash in an unfinalised state.Cheers,
Herbert Xu
maintainerQuoted 4 lines · Dmitry Kasatkin
This is not good.
Driver might allocate some resources, which needs to be released.
crypto_ahash_final()should do some kind of "cleanup" task.
Then your driver is broken. The whole hash API is designed around the fact that each update operation completely stores all output state in the memory provided, leaving no state behind in the hardware.
Is your hardware capable of producing unfinalised hashes? If not then you shouldn't even be implementing an update operation in hardware. You should instead use a software fallback.
Cheers,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Hi,
Yes. Our HW is capable of producing unfinalised hashes. Everything is fine.
No. It is not broken.. It cleans up if error...
- Dmitry
Quoted 18 lines · ext Herbert Xu
Quoted 5 lines · Dmitry Kasatkin
This is not good.
Driver might allocate some resources, which needs to be released.
crypto_ahash_final()should do some kind of "cleanup" task.Then your driver is broken. The whole hash API is designed around the fact that each update operation completely stores all output state in the memory provided, leaving no state behind in the hardware.
Is your hardware capable of producing unfinalised hashes? If not then you shouldn't even be implementing an update operation in hardware. You should instead use a software fallback.
Cheers,
Herbert Xu
maintainerQuoted 4 lines · Dmitry Kasatkin
Hi,
Yes. Our HW is capable of producing unfinalised hashes. Everything is fine.
OK then you should be fine even if the user never makes the "final" call, right?
Cheers,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Well.. That was not the case before.
I made a new patch set.
I will send updates for SHA and AES soon after some more testing.
- Dmitry
Quoted 12 lines · ext Herbert Xu
Quoted 5 lines · Dmitry Kasatkin
Hi,
Yes. Our HW is capable of producing unfinalised hashes. Everything is fine.
OK then you should be fine even if the user never makes the "final" call, right?
Cheers,