Skip to contentSkip to conversation

crypto: return codes

DISCUSSION Mimi Zohar 2 participants 4 messages Oct 5, 2010 – Oct 10, 2010 Crypto API

lore
Share & tools
lore

Mimi Zohar

author
#0 lore raw

Hi,

Looking at different examples of the same crypto call, it's unclear whether it only returns negative error values. Some examples only test for negative values, while others test for not 0. tcrypt.c does "if (ret)". Would appreciate some clarification.

thanks,

Mimi

maintainer
#1 lore raw
Quoted 6 lines · Mimi Zohar

Hi,

Looking at different examples of the same crypto call, it's unclear whether it only returns negative error values. Some examples only test for negative values, while others test for not 0. tcrypt.c does "if (ret)". Would appreciate some clarification.

Unless the call can return positive values then it makes no difference. Which particular call are you talking about?

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
author
#2 lore raw
Quoted 8 lines · Herbert Xu
Quoted 6 lines · Mimi Zohar

Hi,

Looking at different examples of the same crypto call, it's unclear whether it only returns negative error values. Some examples only test for negative values, while others test for not 0. tcrypt.c does "if (ret)". Would appreciate some clarification.

Quoted 4 lines

Unless the call can return positive values then it makes no difference. Which particular call are you talking about?

Cheers,

Just to name a few: crypto_hash_init(), crypto_hash_update(), crypto_hash_final(). Also crypto_blkcipher_decrypt/encrypt(). Would be nice to know definitively that they return < 0 on error and 0 for success.

thanks!

Mimi

maintainer
#3 lore raw
Quoted 12 lines · Mimi Zohar
Quoted 11 lines · Herbert Xu
Quoted 6 lines · Mimi Zohar

Hi,

Looking at different examples of the same crypto call, it's unclear whether it only returns negative error values. Some examples only test for negative values, while others test for not 0. tcrypt.c does "if (ret)". Would appreciate some clarification.

Unless the call can return positive values then it makes no difference. Which particular call are you talking about?

Quoted 6 lines
Quoted 1 line

Cheers,

Just to name a few: crypto_hash_init(), crypto_hash_update(), crypto_hash_final(). Also crypto_blkcipher_decrypt/encrypt(). Would be nice to know definitively that they return < 0 on error and 0 for success.

Yes it's zero or negative.

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