Problem with libcrypt API

Aki Tuomi cmouse at desteem.org
Thu Aug 10 15:18:06 CEST 2006


I am making an application that would depend on gcrypt, but I cannot get
beyond initial testing phase due cryptic error message

 "operation is not possible without initialized secure memory"

There is nothing in the manual page on how one should get rid of this
message. Tested as non-root and as root user. 

Any instructions, links, references, whatever will be greatly
appreciated. 

Magical version numbers:
  gcrypt: 1.2.1
  gpg-error: 0.7
  gcc: 3.4.1
  ld: 2.15.92.0.2 20040927
  libc: GNU libc 2.3.4

Following source code was used:

main.c:
----<snip>----
#include "config.h"
#include <stdio.h>
#include "gcrypt.h"

#define GCRY_CHECK_ERR(func)\
{ \
        gcry_error_t err; \
        err = 0; \
        if (( err = func )) { \
                eics4_gcry_fail(err); \
        } \
}

void
eics4_gcry_fail (gcry_error_t err)
{
  fprintf (stderr, "Error: %s/%s\n", gcry_strsource (err),
           gcry_strerror (err));
  exit (1);
}

int
main (void)
{
  gcry_ac_handle_t handle;
  gcry_ac_key_pair_t keypair;
  gcry_ac_key_spec_rsa_t dsa_spec;
  gcry_mpi_t *misc_data;
  gcry_check_version ("1.2.1");
  misc_data = NULL;
  GCRY_CHECK_ERR (gcry_ac_open (&handle, GCRY_AC_DSA, 0));
  GCRY_CHECK_ERR (gcry_ac_key_pair_generate
                  (handle, 1024, NULL, &keypair, &misc_data));

  return 0;
}
----<snip>----

Following incantation to compile it to binary
 gcc -DHAVE_CONFIG_H -I. -I. -I../include -I../intl -I../include
 -DLOCALEDIR=\"/usr/share/locale\"     -g  -MT main.o -MD -MP
 -MF ".deps/main.Tpo" -c -o main.o main.c

 gcc -g -o eics main.o  /usr/lib/libgcrypt.so -lnsl /usr/lib/libgpg-error.so

If you wonder why there are so many flags... they are caused by 
GNU automake/libtool system.

Aki Tuomi

----- End forwarded message -----



More information about the Gcrypt-devel mailing list