errno = 2 after gcry_cipher_open

Werner Koch wk at
Fri Aug 13 09:37:56 CEST 2010

On Fri, 13 Aug 2010 02:19, jesus.diaz.vico at said:

> I'm new to libgcrypt. I'm trying to cipher some data with ARCFOUR, but, just after calling gcry_cipher_open I get errno = 2. The weird thing is that gcry_cipher_open returns

ERRNO is not part of libgcrypts API.  Instead libgcrypt returns
gpg-error style errocodes directly.  

In general you may only check errno after calling a function which is
specified to set errno.  The value returned by ERRNO in your case may
come for some internal operation of libgcrypt.

To get a description of the error returned by the libgcrypt API you use
for example code like:

  gpg_error_t err;
  err = gcry_cipher_open (...);
  fprintf (stderr, "error code from libgcrypt: %s\n", gpg_strerror (err));



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

More information about the Gcrypt-devel mailing list