gpgme fails encrypting on 64bit debian
Werner Koch
wk at gnupg.org
Wed Apr 10 21:32:01 CEST 2013
On Wed, 10 Apr 2013 10:54, simone.pagangriso at gmail.com said:
> gcc -m64 -D_FILE_OFFSET_BITS=64 -g test2.c -lgpgme
> -L/usr/lib/x86_64-linux-gnu -lgpg-error -o test2
Why do you want to tweak gcc options if you are anyway on a 64 bit
system? Also they seem to be harmelss, hast gpgme been build with the
same options? What does
gpgme-config --cflags --libs
tell you?
> //---- test program
> #include <stdio.h> /* printf */
> #include <unistd.h> /* write */
> #include <errno.h> /* errno */
> #include <locale.h> /* locale support */
> #include <string.h> /* string support */
> #include <stdlib.h> /* memory management */
gpgme.h ist missing but below you are using constants defined by
gpgme.h.
> char *pDest = malloc(65536);
(please always check for malloc error!)
> p = (char *) gpgme_check_version(NULL);
> printf("version=%s\n",p);
Don't cast without a good reason.
> p = (char *) gpgme_get_protocol_name(GPGME_PROTOCOL_OpenPGP);
> printf("Protocol name: %s\n",p);
Ditto.
> err = gpgme_ctx_set_engine_info (ceofcontext, GPGME_PROTOCOL_OpenPGP,
> enginfo->file_name,enginfo->home_dir);
> if(err != GPG_ERR_NO_ERROR) return 5;
Try first without setting a non default engine info.
To debug your problem, I suggest to run the program like this:
GPGME_DEBUG=9:/tmp/gpgme.log:
and check the log file.
Shalom-Salam,
Werner
--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
More information about the Gnupg-users
mailing list