library intialization error
Werner Koch
wk at gnupg.org
Thu Jun 13 15:30:37 CEST 2019
Hi!
On Wed, 12 Jun 2019 10:08, hassan.mostafa87 at gmail.com said:
> # include <gpg-error.h>
>
> # define AM_PATH_LIBGCRYPT
What purpose has this macro? Did you mized something up with a
configure macro. Anyway, it is not a problem.
> /* intialization success check */
>
> gcry_error_t e1 = gcry_control (GCRYCTL_ANY_INITIALIZATION_P);
> fputs (gcry_strerror(e1), stderr);
> puts ("\n");
Let's check the manual:
'GCRYCTL_ANY_INITIALIZATION_P; Arguments: none'
This command returns true if the library has been basically
initialized. Such a basic initialization happens implicitly
with many commands to get certain internal subsystems running.
The common and suggested way to do this basic initialization
is by calling gcry_check_version.
GPG_ERR_GENERAL is what you see and that is in C considered a True. So
the library is successful initialized. You don't need this check,
though. Only a few very special applications may need it.
Functions which end in "_p" commonly return a boolean value and thus we
don't have an error code here.
Shalom-Salam,
Werner
--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20190613/28076ed5/attachment.sig>
More information about the Gnupg-users
mailing list