All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about error codes
@ 2009-06-16 16:47 Erik Lotspeich
  2009-06-16 20:34 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 4+ messages in thread
From: Erik Lotspeich @ 2009-06-16 16:47 UTC (permalink / raw)
  To: linux-crypto; +Cc: Herbert Xu, David S. Miller

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have a question about the meaning of the error codes returned by the
Linux kernel crypto API.  In particular, I am interested in the codes
returned by crypto_ablkcipher_encrypt() & crypto_ablkcipher_decrypt().
I am receiving a return value of 22 from crypto_ablkcipher_encrypt.  I
would like to find what this means.  I don't get this error code
consistently, so I'm trying to find out if I am using the API
incorrectly; I'm using the test code, tcrypt.c, as a guide.

I looked through the source, but it was not obvious in the code where
these error codes were coming from; I did not see them enumerated in a
header file either.

Any help would be greatly appreciated.

Regards,

Erik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAko3zJMACgkQY21D/n6bGwc6QACgoXNEKl1xWtADpXzBexeJfokT
N4cAoJdEElT7Ko1sjEoPfxkh5DCg14YD
=2kfv
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about error codes
  2009-06-16 16:47 Question about error codes Erik Lotspeich
@ 2009-06-16 20:34 ` Sebastian Andrzej Siewior
  2009-06-17  1:52   ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2009-06-16 20:34 UTC (permalink / raw)
  To: Erik Lotspeich; +Cc: linux-crypto, Herbert Xu, David S. Miller

* Erik Lotspeich | 2009-06-16 11:47:15 [-0500]:

>Hi,
Hi,

>
>I have a question about the meaning of the error codes returned by the
>Linux kernel crypto API.  In particular, I am interested in the codes
>returned by crypto_ablkcipher_encrypt() & crypto_ablkcipher_decrypt().
>I am receiving a return value of 22 from crypto_ablkcipher_encrypt.  I
I thing you mean -22 and that one means 
| #define EINVAL          22      /* Invalid argument */ 

You can look them up in include/asm-generic/errno-base.h _or_ strerror()
in userland.

>would like to find what this means.  I don't get this error code
>consistently, so I'm trying to find out if I am using the API
>incorrectly; I'm using the test code, tcrypt.c, as a guide.
So you are using an older kernel. Starting with v2.6.28 that part of
tcrypt moved to test_skcipher() in crypto/testmgr.c. Hoewever, the logic
as it did not change.

>I looked through the source, but it was not obvious in the code where
>these error codes were coming from; I did not see them enumerated in a
>header file either.
It besically depends on the algorithm you are using. So in case of
cbc(aes) you go through
 crypto_ablkcipher_encrypt -> crypto_cbc_encrypt -> aes_encrypt
plus a little API in between tof those calls.


>Any help would be greatly appreciated.
I guess the number of bytes to decrypt/encrypt ist not always a modulos
of the blockmode.

>Regards,
>
>Erik

Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about error codes
  2009-06-16 20:34 ` Sebastian Andrzej Siewior
@ 2009-06-17  1:52   ` Herbert Xu
  2009-06-17  5:56     ` Erik Lotspeich
  0 siblings, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2009-06-17  1:52 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: Erik Lotspeich, linux-crypto, David S. Miller

On Tue, Jun 16, 2009 at 10:34:06PM +0200, Sebastian Andrzej Siewior wrote:
>
> >Any help would be greatly appreciated.
> I guess the number of bytes to decrypt/encrypt ist not always a modulos
> of the blockmode.

Yes that's probably what it is.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about error codes
  2009-06-17  1:52   ` Herbert Xu
@ 2009-06-17  5:56     ` Erik Lotspeich
  0 siblings, 0 replies; 4+ messages in thread
From: Erik Lotspeich @ 2009-06-17  5:56 UTC (permalink / raw)
  To: Herbert Xu, Sebastian Andrzej Siewior; +Cc: linux-crypto, David S. Miller

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Herbert, Sebastian:

Thanks so much for your response; your answers were very helpful!

Regards,

Erik.

Herbert Xu wrote:
> On Tue, Jun 16, 2009 at 10:34:06PM +0200, Sebastian Andrzej Siewior wrote:
>>> Any help would be greatly appreciated.
>> I guess the number of bytes to decrypt/encrypt ist not always a modulos
>> of the blockmode.
> 
> Yes that's probably what it is.
> 
> Thanks,
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAko4hYcACgkQY21D/n6bGwc6SACgu9Su2ba1BXJ/xh/+DpwzTpRi
5jYAoKvs9INfBmAaY8ZQDn85j8eu7W3F
=vNQ9
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-17  5:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-16 16:47 Question about error codes Erik Lotspeich
2009-06-16 20:34 ` Sebastian Andrzej Siewior
2009-06-17  1:52   ` Herbert Xu
2009-06-17  5:56     ` Erik Lotspeich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.