The attached simple program tries to initialize gcrypt with pthread
support. On my debian system (testing/unstable, libgcrypt11 1.4.4-4)
this triggers a segfault during the call to
gcry_control(GCRYCTL_SET_THREAD_CBS).
What am i doing wrong? What have i missed?
--dkg
#include <gcrypt.h>
#include <pthread.h>
#include <errno.h>
#include <stdio.h>
GCRY_THREAD_OPTION_PTHREAD_IMPL;
int main() {
int val, ix;
const char* ciphers[] = { "aes", "arcfour", "twofish", "des" };
gcry_error_t ret;
ret = gcry_control(GCRYCTL_SET_THREAD_CBS, gcry_threads_pthread);
printf("%d: %s/%s\n",
gcry_err_code(ret),
gcry_strsource(ret),
gcry_strerror(ret));
if (!gcry_check_version (GCRYPT_VERSION))
return 12;
for (ix = 0; ix < sizeof(ciphers)/sizeof(ciphers[0]) ; ix++) {
val = gcry_cipher_map_name (ciphers[ix]);
printf("%s: %d\n", ciphers[ix], val);
}
return 0;
}
#!/usr/bin/make -f
main: main.c
gcc -o main -g --pedantic -Wall `libgcrypt-config --cflags --libs` -lpthread main.c
_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@...
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel