Mailing List Archive

Problem with libcrypt API
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 -----

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: Problem with libcrypt API [ In reply to ]
On Thu, 10 Aug 2006 15:18, Aki Tuomi said:

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

Seems we need to answer this in the manual.

The following code should do the trick.

if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
die ("libgcrypt is too old (need %s, have %s)\n",
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);



Salam-Shalom,

Werner


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel