2010-10-05 20:04:42

by Mimi Zohar

[permalink] [raw]
Subject: crypto: return codes

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


2010-10-09 01:29:16

by Herbert Xu

[permalink] [raw]
Subject: Re: crypto: return codes

Mimi Zohar <[email protected]> wrote:
> 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,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2010-10-10 03:34:46

by Mimi Zohar

[permalink] [raw]
Subject: Re: crypto: return codes

On Sat, 2010-10-09 at 09:29 +0800, Herbert Xu wrote:
> Mimi Zohar <[email protected]> wrote:
> > 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,

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

2010-10-10 06:51:55

by Herbert Xu

[permalink] [raw]
Subject: Re: crypto: return codes

On Sat, Oct 09, 2010 at 11:34:43PM -0400, Mimi Zohar wrote:
> On Sat, 2010-10-09 at 09:29 +0800, Herbert Xu wrote:
> > Mimi Zohar <[email protected]> wrote:
> > > 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,
>
> 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,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt