gpgme/src/conversion.c

436 lines
10 KiB
C
Raw Normal View History

/* conversion.c - String conversion helper functions.
2002-10-10 Marcus Brinkmann <marcus@g10code.de> * rungpg.h, engine-gpgsm.h: File removed. * engine-backend.h: New file. * Makefile.am (gpgsm_components): New variable, set depending on automake conditional HAVE_GPGSM. (libgpgme_la_SOURCES): Add engine-backend.h, remove rungpg.h and engine-gpgsm.h. Replace engine-gpgsm.c with ${gpgsm_components}. (status-table.h): Depend on gpgme.h, not rungpg.h. * conversion.c: Include <stdlib.h>. * engine-gpgsm.c: Do not set ENABLE_GPGSM here. Include "engine-backend.h" instead "engine-gpgsm.h". Reorder some functions and remove all function prototypes. (_gpgme_gpgsm_get_version): Make static and rename to ... (gpgsm_get_version): ... this. (_gpgme_gpgsm_check_version): Make static and rename to ... (gpgsm_check_version): ... this. (_gpgme_gpgsm_new): Make static. Change argument type from GpgsmObject * to void **. Call gpgsm_release instead _gpgme_gpgsm_release. (_gpgme_gpgsm_op_decrypt): Make static and rename to ... (gpgsm_check_decrypt): ... this. (_gpgme_gpgsm_op_delete): Make static and rename to ... (gpgsm_check_delete): ... this. (_gpgme_gpgsm_set_recipients): Make static and rename to ... (gpgsm_check_set_recipients): ... this. (_gpgme_gpgsm_op_encrypt): Make static and rename to ... (gpgsm_encrypt): ... this. (_gpgme_gpgsm_op_export): Make static and rename to ... (gpgsm_export): ... this. (_gpgme_gpgsm_op_genkey): Make static and rename to ... (gpgsm_genkey): ... this. (_gpgme_gpgsm_op_import): Make static and rename to ... (gpgsm_import): ... this. (_gpgme_gpgsm_op_keylist): Make static and rename to ... (gpgsm_keylist): ... this. (_gpgme_gpgsm_op_keylist_ext): Make static and rename to ... (gpgsm_keylist_ext): ... this. (_gpgme_gpgsm_op_sign): Make static and rename to ... (gpgsm_sign): ... this. (_gpgme_gpgsm_op_trustlist): Make static and rename to ... (gpgsm_trustlist): ... this. (_gpgme_gpgsm_op_verify): Make static and rename to ... (gpgsm_verify): ... this. (gpgsm_status_handler): Rename to ... (status_handler): ... this. (_gpgme_gpgsm_set_status_handler): Make static and rename to ... (gpgsm_set_status_handler): ... this. (_gpgme_gpgsm_set_colon_line_handler): Make static and rename to ... (gpgsm_set_colon_line_handler): ... this. (_gpgme_gpgsm_add_io_cb): Rename to ... (add_io_cb): ... this. (_gpgme_gpgsm_start): Make static and rename to ... (gpgsm_start): ... this. (_gpgme_gpgsm_set_io_cb): Make static and rename to ... (gpgsm_set_io_cb): ... this. (_gpgme_gpgsm_io_event): Make static and rename to ... (gpgsm_io_event): ... this. (struct _gpgme_engine_ops_gpgsm): New variable. [!ENABLE_GPGSM]: Removed. * engine.c: Do not include <time.h>, <sys/types.h>, <string.h>, <assert.h>, "io.h", "rungpg.h" and "engine-gpgsm.h". Include <stdlib.h> and "engine-backend.h". (struct engine_object_s): Rewritten. (engine_ops): New variable. * engine.c (_gpgme_engine_get_path, _gpgme_engine_get_version, _gpgme_engine_check_version, _gpgme_engine_new, _gpgme_engine_release, _gpgme_engine_set_verbosity, _gpgme_engine_set_status_handler, _gpgme_engine_set_command_handler, _gpgme_engine_set_colon_line_handler, _gpgme_engine_op_decrypt, _gpgme_engine_op_delete, _gpgme_engine_op_edit, _gpgme_engine_op_encrypt, _gpgme_engine_op_encrypt_sign, _gpgme_engine_op_export, _gpgme_engine_op_genkey, _gpgme_engine_op_import, _gpgme_engine_op_keylist, _gpgme_engine_op_keylist_ext, _gpgme_engine_op_sign, _gpgme_engine_op_trustlist, _gpgme_engine_op_verify, _gpgme_engine_start, _gpgme_engine_set_io_cbs, _gpgme_engine_io_event): Reimplement. * engine.h: Fix a few comments and a variable name in a prototype. * ops.h: Do not include "rungpg.h". * passphrase.c: Include config.h only if [HAVE_CONFIG_H]. Do not include "rungpg.h". * recipient.c: Likewise. * signers.c: Likewise. * version.c: Likewise. * rungpg.c: Likewise. Include "engine-backend.h". Reorder functions and remove prototypes. (_gpgme_gpg_get_version): Make static and rename to ... (gpg_get_version): ... this. (_gpgme_gpg_check_version): Make static and rename to ... (gpg_check_version): ... this. (_gpgme_gpg_new): Make static. Change argument type from GpgObject * to void **. Call gpg_release instead _gpgme_gpg_release. (_gpgme_gpg_op_decrypt): Make static and rename to ... (gpg_check_decrypt): ... this. (_gpgme_gpg_op_delete): Make static and rename to ... (gpg_check_delete): ... this. (_gpgme_gpg_set_recipients): Make static and rename to ... (gpg_check_set_recipients): ... this. (_gpgme_gpg_op_encrypt): Make static and rename to ... (gpg_encrypt): ... this. (_gpgme_gpg_op_export): Make static and rename to ... (gpg_export): ... this. (_gpgme_gpg_op_genkey): Make static and rename to ... (gpg_genkey): ... this. (_gpgme_gpg_op_import): Make static and rename to ... (gpg_import): ... this. (_gpgme_gpg_op_keylist): Make static and rename to ... (gpg_keylist): ... this. (_gpgme_gpg_op_keylist_ext): Make static and rename to ... (gpg_keylist_ext): ... this. (_gpgme_gpg_op_sign): Make static and rename to ... (gpg_sign): ... this. (_gpgme_gpg_op_trustlist): Make static and rename to ... (gpg_trustlist): ... this. (_gpgme_gpg_op_verify): Make static and rename to ... (gpg_verify): ... this. (gpg_status_handler): Rename to ... (status_handler): ... this. (_gpgme_gpg_set_status_handler): Make static and rename to ... (gpg_set_status_handler): ... this. (_gpgme_gpg_set_colon_line_handler): Make static and rename to ... (gpg_set_colon_line_handler): ... this. (gpgme_gpg_add_io_cb): Rename to ... (add_io_cb): ... this. (_gpgme_gpg_start): Make static and rename to ... (gpg_start): ... this. (_gpgme_gpg_set_io_cb): Make static and rename to ... (gpg_set_io_cb): ... this. (_gpgme_gpg_io_event): Make static and rename to ... (gpg_io_event): ... this. (struct _gpgme_engine_ops_gpg): New variable.
2002-10-12 00:33:05 +00:00
Copyright (C) 2000 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003, 2004, 2007 g10 Code GmbH
2012-04-30 15:42:53 +00:00
2002-10-10 Marcus Brinkmann <marcus@g10code.de> * rungpg.h, engine-gpgsm.h: File removed. * engine-backend.h: New file. * Makefile.am (gpgsm_components): New variable, set depending on automake conditional HAVE_GPGSM. (libgpgme_la_SOURCES): Add engine-backend.h, remove rungpg.h and engine-gpgsm.h. Replace engine-gpgsm.c with ${gpgsm_components}. (status-table.h): Depend on gpgme.h, not rungpg.h. * conversion.c: Include <stdlib.h>. * engine-gpgsm.c: Do not set ENABLE_GPGSM here. Include "engine-backend.h" instead "engine-gpgsm.h". Reorder some functions and remove all function prototypes. (_gpgme_gpgsm_get_version): Make static and rename to ... (gpgsm_get_version): ... this. (_gpgme_gpgsm_check_version): Make static and rename to ... (gpgsm_check_version): ... this. (_gpgme_gpgsm_new): Make static. Change argument type from GpgsmObject * to void **. Call gpgsm_release instead _gpgme_gpgsm_release. (_gpgme_gpgsm_op_decrypt): Make static and rename to ... (gpgsm_check_decrypt): ... this. (_gpgme_gpgsm_op_delete): Make static and rename to ... (gpgsm_check_delete): ... this. (_gpgme_gpgsm_set_recipients): Make static and rename to ... (gpgsm_check_set_recipients): ... this. (_gpgme_gpgsm_op_encrypt): Make static and rename to ... (gpgsm_encrypt): ... this. (_gpgme_gpgsm_op_export): Make static and rename to ... (gpgsm_export): ... this. (_gpgme_gpgsm_op_genkey): Make static and rename to ... (gpgsm_genkey): ... this. (_gpgme_gpgsm_op_import): Make static and rename to ... (gpgsm_import): ... this. (_gpgme_gpgsm_op_keylist): Make static and rename to ... (gpgsm_keylist): ... this. (_gpgme_gpgsm_op_keylist_ext): Make static and rename to ... (gpgsm_keylist_ext): ... this. (_gpgme_gpgsm_op_sign): Make static and rename to ... (gpgsm_sign): ... this. (_gpgme_gpgsm_op_trustlist): Make static and rename to ... (gpgsm_trustlist): ... this. (_gpgme_gpgsm_op_verify): Make static and rename to ... (gpgsm_verify): ... this. (gpgsm_status_handler): Rename to ... (status_handler): ... this. (_gpgme_gpgsm_set_status_handler): Make static and rename to ... (gpgsm_set_status_handler): ... this. (_gpgme_gpgsm_set_colon_line_handler): Make static and rename to ... (gpgsm_set_colon_line_handler): ... this. (_gpgme_gpgsm_add_io_cb): Rename to ... (add_io_cb): ... this. (_gpgme_gpgsm_start): Make static and rename to ... (gpgsm_start): ... this. (_gpgme_gpgsm_set_io_cb): Make static and rename to ... (gpgsm_set_io_cb): ... this. (_gpgme_gpgsm_io_event): Make static and rename to ... (gpgsm_io_event): ... this. (struct _gpgme_engine_ops_gpgsm): New variable. [!ENABLE_GPGSM]: Removed. * engine.c: Do not include <time.h>, <sys/types.h>, <string.h>, <assert.h>, "io.h", "rungpg.h" and "engine-gpgsm.h". Include <stdlib.h> and "engine-backend.h". (struct engine_object_s): Rewritten. (engine_ops): New variable. * engine.c (_gpgme_engine_get_path, _gpgme_engine_get_version, _gpgme_engine_check_version, _gpgme_engine_new, _gpgme_engine_release, _gpgme_engine_set_verbosity, _gpgme_engine_set_status_handler, _gpgme_engine_set_command_handler, _gpgme_engine_set_colon_line_handler, _gpgme_engine_op_decrypt, _gpgme_engine_op_delete, _gpgme_engine_op_edit, _gpgme_engine_op_encrypt, _gpgme_engine_op_encrypt_sign, _gpgme_engine_op_export, _gpgme_engine_op_genkey, _gpgme_engine_op_import, _gpgme_engine_op_keylist, _gpgme_engine_op_keylist_ext, _gpgme_engine_op_sign, _gpgme_engine_op_trustlist, _gpgme_engine_op_verify, _gpgme_engine_start, _gpgme_engine_set_io_cbs, _gpgme_engine_io_event): Reimplement. * engine.h: Fix a few comments and a variable name in a prototype. * ops.h: Do not include "rungpg.h". * passphrase.c: Include config.h only if [HAVE_CONFIG_H]. Do not include "rungpg.h". * recipient.c: Likewise. * signers.c: Likewise. * version.c: Likewise. * rungpg.c: Likewise. Include "engine-backend.h". Reorder functions and remove prototypes. (_gpgme_gpg_get_version): Make static and rename to ... (gpg_get_version): ... this. (_gpgme_gpg_check_version): Make static and rename to ... (gpg_check_version): ... this. (_gpgme_gpg_new): Make static. Change argument type from GpgObject * to void **. Call gpg_release instead _gpgme_gpg_release. (_gpgme_gpg_op_decrypt): Make static and rename to ... (gpg_check_decrypt): ... this. (_gpgme_gpg_op_delete): Make static and rename to ... (gpg_check_delete): ... this. (_gpgme_gpg_set_recipients): Make static and rename to ... (gpg_check_set_recipients): ... this. (_gpgme_gpg_op_encrypt): Make static and rename to ... (gpg_encrypt): ... this. (_gpgme_gpg_op_export): Make static and rename to ... (gpg_export): ... this. (_gpgme_gpg_op_genkey): Make static and rename to ... (gpg_genkey): ... this. (_gpgme_gpg_op_import): Make static and rename to ... (gpg_import): ... this. (_gpgme_gpg_op_keylist): Make static and rename to ... (gpg_keylist): ... this. (_gpgme_gpg_op_keylist_ext): Make static and rename to ... (gpg_keylist_ext): ... this. (_gpgme_gpg_op_sign): Make static and rename to ... (gpg_sign): ... this. (_gpgme_gpg_op_trustlist): Make static and rename to ... (gpg_trustlist): ... this. (_gpgme_gpg_op_verify): Make static and rename to ... (gpg_verify): ... this. (gpg_status_handler): Rename to ... (status_handler): ... this. (_gpgme_gpg_set_status_handler): Make static and rename to ... (gpg_set_status_handler): ... this. (_gpgme_gpg_set_colon_line_handler): Make static and rename to ... (gpg_set_colon_line_handler): ... this. (gpgme_gpg_add_io_cb): Rename to ... (add_io_cb): ... this. (_gpgme_gpg_start): Make static and rename to ... (gpg_start): ... this. (_gpgme_gpg_set_io_cb): Make static and rename to ... (gpg_set_io_cb): ... this. (_gpgme_gpg_io_event): Make static and rename to ... (gpg_io_event): ... this. (struct _gpgme_engine_ops_gpg): New variable.
2002-10-12 00:33:05 +00:00
This file is part of GPGME.
GPGME is free software; you can redistribute it and/or modify it
2004-12-07 Marcus Brinkmann <marcus@g10code.de> * README: Refer to COPYING.LESSER and "each file" instead of COPYING. * COPYING.LESSER: New file. * gpgme.spec.in (%doc): Add COPYING.LESSER. * acinclude.m4, configure.ac, Makefile.am: Change license to LGPL 2.1 or later. * TODO: Add copyright notice. * README.CVS: Likewise. assuan/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * README.1st: Add copyright notice. doc/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * Makefile.am: Change license to LGPL. (gpgme_TEXINFOS): Replace gpl.texi with lesser.texi. * gpgme.texi: Change license to LGPL (also for documentation of GPGME's license). * lesser.texi: New file. * gpl.texi: File removed. gpgme/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * putc_unlocked.c, funopen.c: I just claim copyright on these files and change their license to LGPL, because they are totally trivial wrapper functions. * isascii.c: Change copyright notice to the one from ctype/ctype.h in the GNU C Library (CVS Head 2004-10-10), where isascii is defined as a macro doing exactly the same as the function in this file. * memrchr.c: Update from the GNU C Library (CVS Head 2001-07-06). * stpcpy.c: Update from the GNU C Library (CVS Head 2004-10-10). * ath.c, ath-compat.c, ath.h, ath-pth.c, ath-pth-compat.c, ath-pthread.c, ath-pthread-compat.c, context.h, conversion.c, data.c, data-compat.c, data-fd.c, data.h, data-mem.c, data-stream.c, data-user.c, debug.c, debug.h, decrypt.c, decrypt-verify.c, delete.c, edit.c, encrypt.c, encrypt-sign.c, engine-backend.h, engine.c, engine-gpgsm.c, engine.h, error.c, export.c, genkey.c, get-env.c, gpgme.c, gpgme.h, import.c, io.h, key.c, keylist.c, mkstatus, Makefile.am, ops.h, op-support.c, passphrase.c, posix-io.c, posix-sema.c, posix-util.c, progress.c, rungpg.c, sema.h, sign.c, signers.c, trust-item.c, trustlist.c, util.h, verify.c, version.c, w32-io.c, w32-sema.c, w32-util.c, wait.c, wait-global.c, wait.h, wait-private.c, wait-user.c: Change license to LGPL. tests/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * gpg/mkdemodirs: Add copyright notice. * gpgsm/Makefile.am, gpgsm/t-support.h, gpgsm/t-decrypt.c, gpgsm/t-encrypt.c, gpgsm/t-export.c, gpgsm/t-genkey.c, gpgsm/t-import.c, gpgsm/t-keylist.c, gpgsm/t-sign.c, gpgsm/t-verify.c, gpg/Makefile.am, gpg/t-decrypt.c, gpg/t-decrypt-verify.c, gpg/t-edit.c, gpg/t-encrypt.c, gpg/t-encrypt-sign.c, gpg/t-encrypt-sym.c, gpg/t-eventloop.c, gpg/t-export.c, gpg/t-genkey.c, gpg/t-import.c, gpg/t-keylist.c, gpg/t-keylist-sig.c, gpg/t-sign.c, gpg/t-signers.c, gpg/t-support.h, gpg/t-thread1.c, gpg/t-trustlist.c, gpg/t-verify.c, Makefile.am, t-data.c, t-engine-info.c, t-version.c: Change license to LGPL.
2004-12-07 21:13:39 +00:00
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
2012-04-30 15:42:53 +00:00
2002-10-10 Marcus Brinkmann <marcus@g10code.de> * rungpg.h, engine-gpgsm.h: File removed. * engine-backend.h: New file. * Makefile.am (gpgsm_components): New variable, set depending on automake conditional HAVE_GPGSM. (libgpgme_la_SOURCES): Add engine-backend.h, remove rungpg.h and engine-gpgsm.h. Replace engine-gpgsm.c with ${gpgsm_components}. (status-table.h): Depend on gpgme.h, not rungpg.h. * conversion.c: Include <stdlib.h>. * engine-gpgsm.c: Do not set ENABLE_GPGSM here. Include "engine-backend.h" instead "engine-gpgsm.h". Reorder some functions and remove all function prototypes. (_gpgme_gpgsm_get_version): Make static and rename to ... (gpgsm_get_version): ... this. (_gpgme_gpgsm_check_version): Make static and rename to ... (gpgsm_check_version): ... this. (_gpgme_gpgsm_new): Make static. Change argument type from GpgsmObject * to void **. Call gpgsm_release instead _gpgme_gpgsm_release. (_gpgme_gpgsm_op_decrypt): Make static and rename to ... (gpgsm_check_decrypt): ... this. (_gpgme_gpgsm_op_delete): Make static and rename to ... (gpgsm_check_delete): ... this. (_gpgme_gpgsm_set_recipients): Make static and rename to ... (gpgsm_check_set_recipients): ... this. (_gpgme_gpgsm_op_encrypt): Make static and rename to ... (gpgsm_encrypt): ... this. (_gpgme_gpgsm_op_export): Make static and rename to ... (gpgsm_export): ... this. (_gpgme_gpgsm_op_genkey): Make static and rename to ... (gpgsm_genkey): ... this. (_gpgme_gpgsm_op_import): Make static and rename to ... (gpgsm_import): ... this. (_gpgme_gpgsm_op_keylist): Make static and rename to ... (gpgsm_keylist): ... this. (_gpgme_gpgsm_op_keylist_ext): Make static and rename to ... (gpgsm_keylist_ext): ... this. (_gpgme_gpgsm_op_sign): Make static and rename to ... (gpgsm_sign): ... this. (_gpgme_gpgsm_op_trustlist): Make static and rename to ... (gpgsm_trustlist): ... this. (_gpgme_gpgsm_op_verify): Make static and rename to ... (gpgsm_verify): ... this. (gpgsm_status_handler): Rename to ... (status_handler): ... this. (_gpgme_gpgsm_set_status_handler): Make static and rename to ... (gpgsm_set_status_handler): ... this. (_gpgme_gpgsm_set_colon_line_handler): Make static and rename to ... (gpgsm_set_colon_line_handler): ... this. (_gpgme_gpgsm_add_io_cb): Rename to ... (add_io_cb): ... this. (_gpgme_gpgsm_start): Make static and rename to ... (gpgsm_start): ... this. (_gpgme_gpgsm_set_io_cb): Make static and rename to ... (gpgsm_set_io_cb): ... this. (_gpgme_gpgsm_io_event): Make static and rename to ... (gpgsm_io_event): ... this. (struct _gpgme_engine_ops_gpgsm): New variable. [!ENABLE_GPGSM]: Removed. * engine.c: Do not include <time.h>, <sys/types.h>, <string.h>, <assert.h>, "io.h", "rungpg.h" and "engine-gpgsm.h". Include <stdlib.h> and "engine-backend.h". (struct engine_object_s): Rewritten. (engine_ops): New variable. * engine.c (_gpgme_engine_get_path, _gpgme_engine_get_version, _gpgme_engine_check_version, _gpgme_engine_new, _gpgme_engine_release, _gpgme_engine_set_verbosity, _gpgme_engine_set_status_handler, _gpgme_engine_set_command_handler, _gpgme_engine_set_colon_line_handler, _gpgme_engine_op_decrypt, _gpgme_engine_op_delete, _gpgme_engine_op_edit, _gpgme_engine_op_encrypt, _gpgme_engine_op_encrypt_sign, _gpgme_engine_op_export, _gpgme_engine_op_genkey, _gpgme_engine_op_import, _gpgme_engine_op_keylist, _gpgme_engine_op_keylist_ext, _gpgme_engine_op_sign, _gpgme_engine_op_trustlist, _gpgme_engine_op_verify, _gpgme_engine_start, _gpgme_engine_set_io_cbs, _gpgme_engine_io_event): Reimplement. * engine.h: Fix a few comments and a variable name in a prototype. * ops.h: Do not include "rungpg.h". * passphrase.c: Include config.h only if [HAVE_CONFIG_H]. Do not include "rungpg.h". * recipient.c: Likewise. * signers.c: Likewise. * version.c: Likewise. * rungpg.c: Likewise. Include "engine-backend.h". Reorder functions and remove prototypes. (_gpgme_gpg_get_version): Make static and rename to ... (gpg_get_version): ... this. (_gpgme_gpg_check_version): Make static and rename to ... (gpg_check_version): ... this. (_gpgme_gpg_new): Make static. Change argument type from GpgObject * to void **. Call gpg_release instead _gpgme_gpg_release. (_gpgme_gpg_op_decrypt): Make static and rename to ... (gpg_check_decrypt): ... this. (_gpgme_gpg_op_delete): Make static and rename to ... (gpg_check_delete): ... this. (_gpgme_gpg_set_recipients): Make static and rename to ... (gpg_check_set_recipients): ... this. (_gpgme_gpg_op_encrypt): Make static and rename to ... (gpg_encrypt): ... this. (_gpgme_gpg_op_export): Make static and rename to ... (gpg_export): ... this. (_gpgme_gpg_op_genkey): Make static and rename to ... (gpg_genkey): ... this. (_gpgme_gpg_op_import): Make static and rename to ... (gpg_import): ... this. (_gpgme_gpg_op_keylist): Make static and rename to ... (gpg_keylist): ... this. (_gpgme_gpg_op_keylist_ext): Make static and rename to ... (gpg_keylist_ext): ... this. (_gpgme_gpg_op_sign): Make static and rename to ... (gpg_sign): ... this. (_gpgme_gpg_op_trustlist): Make static and rename to ... (gpg_trustlist): ... this. (_gpgme_gpg_op_verify): Make static and rename to ... (gpg_verify): ... this. (gpg_status_handler): Rename to ... (status_handler): ... this. (_gpgme_gpg_set_status_handler): Make static and rename to ... (gpg_set_status_handler): ... this. (_gpgme_gpg_set_colon_line_handler): Make static and rename to ... (gpg_set_colon_line_handler): ... this. (gpgme_gpg_add_io_cb): Rename to ... (add_io_cb): ... this. (_gpgme_gpg_start): Make static and rename to ... (gpg_start): ... this. (_gpgme_gpg_set_io_cb): Make static and rename to ... (gpg_set_io_cb): ... this. (_gpgme_gpg_io_event): Make static and rename to ... (gpg_io_event): ... this. (struct _gpgme_engine_ops_gpg): New variable.
2002-10-12 00:33:05 +00:00
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2004-12-07 Marcus Brinkmann <marcus@g10code.de> * README: Refer to COPYING.LESSER and "each file" instead of COPYING. * COPYING.LESSER: New file. * gpgme.spec.in (%doc): Add COPYING.LESSER. * acinclude.m4, configure.ac, Makefile.am: Change license to LGPL 2.1 or later. * TODO: Add copyright notice. * README.CVS: Likewise. assuan/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * README.1st: Add copyright notice. doc/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * Makefile.am: Change license to LGPL. (gpgme_TEXINFOS): Replace gpl.texi with lesser.texi. * gpgme.texi: Change license to LGPL (also for documentation of GPGME's license). * lesser.texi: New file. * gpl.texi: File removed. gpgme/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * putc_unlocked.c, funopen.c: I just claim copyright on these files and change their license to LGPL, because they are totally trivial wrapper functions. * isascii.c: Change copyright notice to the one from ctype/ctype.h in the GNU C Library (CVS Head 2004-10-10), where isascii is defined as a macro doing exactly the same as the function in this file. * memrchr.c: Update from the GNU C Library (CVS Head 2001-07-06). * stpcpy.c: Update from the GNU C Library (CVS Head 2004-10-10). * ath.c, ath-compat.c, ath.h, ath-pth.c, ath-pth-compat.c, ath-pthread.c, ath-pthread-compat.c, context.h, conversion.c, data.c, data-compat.c, data-fd.c, data.h, data-mem.c, data-stream.c, data-user.c, debug.c, debug.h, decrypt.c, decrypt-verify.c, delete.c, edit.c, encrypt.c, encrypt-sign.c, engine-backend.h, engine.c, engine-gpgsm.c, engine.h, error.c, export.c, genkey.c, get-env.c, gpgme.c, gpgme.h, import.c, io.h, key.c, keylist.c, mkstatus, Makefile.am, ops.h, op-support.c, passphrase.c, posix-io.c, posix-sema.c, posix-util.c, progress.c, rungpg.c, sema.h, sign.c, signers.c, trust-item.c, trustlist.c, util.h, verify.c, version.c, w32-io.c, w32-sema.c, w32-util.c, wait.c, wait-global.c, wait.h, wait-private.c, wait-user.c: Change license to LGPL. tests/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * gpg/mkdemodirs: Add copyright notice. * gpgsm/Makefile.am, gpgsm/t-support.h, gpgsm/t-decrypt.c, gpgsm/t-encrypt.c, gpgsm/t-export.c, gpgsm/t-genkey.c, gpgsm/t-import.c, gpgsm/t-keylist.c, gpgsm/t-sign.c, gpgsm/t-verify.c, gpg/Makefile.am, gpg/t-decrypt.c, gpg/t-decrypt-verify.c, gpg/t-edit.c, gpg/t-encrypt.c, gpg/t-encrypt-sign.c, gpg/t-encrypt-sym.c, gpg/t-eventloop.c, gpg/t-export.c, gpg/t-genkey.c, gpg/t-import.c, gpg/t-keylist.c, gpg/t-keylist-sig.c, gpg/t-sign.c, gpg/t-signers.c, gpg/t-support.h, gpg/t-thread1.c, gpg/t-trustlist.c, gpg/t-verify.c, Makefile.am, t-data.c, t-engine-info.c, t-version.c: Change license to LGPL.
2004-12-07 21:13:39 +00:00
Lesser General Public License for more details.
2012-04-30 15:42:53 +00:00
2004-12-07 Marcus Brinkmann <marcus@g10code.de> * README: Refer to COPYING.LESSER and "each file" instead of COPYING. * COPYING.LESSER: New file. * gpgme.spec.in (%doc): Add COPYING.LESSER. * acinclude.m4, configure.ac, Makefile.am: Change license to LGPL 2.1 or later. * TODO: Add copyright notice. * README.CVS: Likewise. assuan/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * README.1st: Add copyright notice. doc/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * Makefile.am: Change license to LGPL. (gpgme_TEXINFOS): Replace gpl.texi with lesser.texi. * gpgme.texi: Change license to LGPL (also for documentation of GPGME's license). * lesser.texi: New file. * gpl.texi: File removed. gpgme/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * putc_unlocked.c, funopen.c: I just claim copyright on these files and change their license to LGPL, because they are totally trivial wrapper functions. * isascii.c: Change copyright notice to the one from ctype/ctype.h in the GNU C Library (CVS Head 2004-10-10), where isascii is defined as a macro doing exactly the same as the function in this file. * memrchr.c: Update from the GNU C Library (CVS Head 2001-07-06). * stpcpy.c: Update from the GNU C Library (CVS Head 2004-10-10). * ath.c, ath-compat.c, ath.h, ath-pth.c, ath-pth-compat.c, ath-pthread.c, ath-pthread-compat.c, context.h, conversion.c, data.c, data-compat.c, data-fd.c, data.h, data-mem.c, data-stream.c, data-user.c, debug.c, debug.h, decrypt.c, decrypt-verify.c, delete.c, edit.c, encrypt.c, encrypt-sign.c, engine-backend.h, engine.c, engine-gpgsm.c, engine.h, error.c, export.c, genkey.c, get-env.c, gpgme.c, gpgme.h, import.c, io.h, key.c, keylist.c, mkstatus, Makefile.am, ops.h, op-support.c, passphrase.c, posix-io.c, posix-sema.c, posix-util.c, progress.c, rungpg.c, sema.h, sign.c, signers.c, trust-item.c, trustlist.c, util.h, verify.c, version.c, w32-io.c, w32-sema.c, w32-util.c, wait.c, wait-global.c, wait.h, wait-private.c, wait-user.c: Change license to LGPL. tests/ 2004-12-07 Marcus Brinkmann <marcus@g10code.de> * gpg/mkdemodirs: Add copyright notice. * gpgsm/Makefile.am, gpgsm/t-support.h, gpgsm/t-decrypt.c, gpgsm/t-encrypt.c, gpgsm/t-export.c, gpgsm/t-genkey.c, gpgsm/t-import.c, gpgsm/t-keylist.c, gpgsm/t-sign.c, gpgsm/t-verify.c, gpg/Makefile.am, gpg/t-decrypt.c, gpg/t-decrypt-verify.c, gpg/t-edit.c, gpg/t-encrypt.c, gpg/t-encrypt-sign.c, gpg/t-encrypt-sym.c, gpg/t-eventloop.c, gpg/t-export.c, gpg/t-genkey.c, gpg/t-import.c, gpg/t-keylist.c, gpg/t-keylist-sig.c, gpg/t-sign.c, gpg/t-signers.c, gpg/t-support.h, gpg/t-thread1.c, gpg/t-trustlist.c, gpg/t-verify.c, Makefile.am, t-data.c, t-engine-info.c, t-version.c: Change license to LGPL.
2004-12-07 21:13:39 +00:00
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#if HAVE_CONFIG_H
#include <config.h>
#endif
2002-10-10 Marcus Brinkmann <marcus@g10code.de> * rungpg.h, engine-gpgsm.h: File removed. * engine-backend.h: New file. * Makefile.am (gpgsm_components): New variable, set depending on automake conditional HAVE_GPGSM. (libgpgme_la_SOURCES): Add engine-backend.h, remove rungpg.h and engine-gpgsm.h. Replace engine-gpgsm.c with ${gpgsm_components}. (status-table.h): Depend on gpgme.h, not rungpg.h. * conversion.c: Include <stdlib.h>. * engine-gpgsm.c: Do not set ENABLE_GPGSM here. Include "engine-backend.h" instead "engine-gpgsm.h". Reorder some functions and remove all function prototypes. (_gpgme_gpgsm_get_version): Make static and rename to ... (gpgsm_get_version): ... this. (_gpgme_gpgsm_check_version): Make static and rename to ... (gpgsm_check_version): ... this. (_gpgme_gpgsm_new): Make static. Change argument type from GpgsmObject * to void **. Call gpgsm_release instead _gpgme_gpgsm_release. (_gpgme_gpgsm_op_decrypt): Make static and rename to ... (gpgsm_check_decrypt): ... this. (_gpgme_gpgsm_op_delete): Make static and rename to ... (gpgsm_check_delete): ... this. (_gpgme_gpgsm_set_recipients): Make static and rename to ... (gpgsm_check_set_recipients): ... this. (_gpgme_gpgsm_op_encrypt): Make static and rename to ... (gpgsm_encrypt): ... this. (_gpgme_gpgsm_op_export): Make static and rename to ... (gpgsm_export): ... this. (_gpgme_gpgsm_op_genkey): Make static and rename to ... (gpgsm_genkey): ... this. (_gpgme_gpgsm_op_import): Make static and rename to ... (gpgsm_import): ... this. (_gpgme_gpgsm_op_keylist): Make static and rename to ... (gpgsm_keylist): ... this. (_gpgme_gpgsm_op_keylist_ext): Make static and rename to ... (gpgsm_keylist_ext): ... this. (_gpgme_gpgsm_op_sign): Make static and rename to ... (gpgsm_sign): ... this. (_gpgme_gpgsm_op_trustlist): Make static and rename to ... (gpgsm_trustlist): ... this. (_gpgme_gpgsm_op_verify): Make static and rename to ... (gpgsm_verify): ... this. (gpgsm_status_handler): Rename to ... (status_handler): ... this. (_gpgme_gpgsm_set_status_handler): Make static and rename to ... (gpgsm_set_status_handler): ... this. (_gpgme_gpgsm_set_colon_line_handler): Make static and rename to ... (gpgsm_set_colon_line_handler): ... this. (_gpgme_gpgsm_add_io_cb): Rename to ... (add_io_cb): ... this. (_gpgme_gpgsm_start): Make static and rename to ... (gpgsm_start): ... this. (_gpgme_gpgsm_set_io_cb): Make static and rename to ... (gpgsm_set_io_cb): ... this. (_gpgme_gpgsm_io_event): Make static and rename to ... (gpgsm_io_event): ... this. (struct _gpgme_engine_ops_gpgsm): New variable. [!ENABLE_GPGSM]: Removed. * engine.c: Do not include <time.h>, <sys/types.h>, <string.h>, <assert.h>, "io.h", "rungpg.h" and "engine-gpgsm.h". Include <stdlib.h> and "engine-backend.h". (struct engine_object_s): Rewritten. (engine_ops): New variable. * engine.c (_gpgme_engine_get_path, _gpgme_engine_get_version, _gpgme_engine_check_version, _gpgme_engine_new, _gpgme_engine_release, _gpgme_engine_set_verbosity, _gpgme_engine_set_status_handler, _gpgme_engine_set_command_handler, _gpgme_engine_set_colon_line_handler, _gpgme_engine_op_decrypt, _gpgme_engine_op_delete, _gpgme_engine_op_edit, _gpgme_engine_op_encrypt, _gpgme_engine_op_encrypt_sign, _gpgme_engine_op_export, _gpgme_engine_op_genkey, _gpgme_engine_op_import, _gpgme_engine_op_keylist, _gpgme_engine_op_keylist_ext, _gpgme_engine_op_sign, _gpgme_engine_op_trustlist, _gpgme_engine_op_verify, _gpgme_engine_start, _gpgme_engine_set_io_cbs, _gpgme_engine_io_event): Reimplement. * engine.h: Fix a few comments and a variable name in a prototype. * ops.h: Do not include "rungpg.h". * passphrase.c: Include config.h only if [HAVE_CONFIG_H]. Do not include "rungpg.h". * recipient.c: Likewise. * signers.c: Likewise. * version.c: Likewise. * rungpg.c: Likewise. Include "engine-backend.h". Reorder functions and remove prototypes. (_gpgme_gpg_get_version): Make static and rename to ... (gpg_get_version): ... this. (_gpgme_gpg_check_version): Make static and rename to ... (gpg_check_version): ... this. (_gpgme_gpg_new): Make static. Change argument type from GpgObject * to void **. Call gpg_release instead _gpgme_gpg_release. (_gpgme_gpg_op_decrypt): Make static and rename to ... (gpg_check_decrypt): ... this. (_gpgme_gpg_op_delete): Make static and rename to ... (gpg_check_delete): ... this. (_gpgme_gpg_set_recipients): Make static and rename to ... (gpg_check_set_recipients): ... this. (_gpgme_gpg_op_encrypt): Make static and rename to ... (gpg_encrypt): ... this. (_gpgme_gpg_op_export): Make static and rename to ... (gpg_export): ... this. (_gpgme_gpg_op_genkey): Make static and rename to ... (gpg_genkey): ... this. (_gpgme_gpg_op_import): Make static and rename to ... (gpg_import): ... this. (_gpgme_gpg_op_keylist): Make static and rename to ... (gpg_keylist): ... this. (_gpgme_gpg_op_keylist_ext): Make static and rename to ... (gpg_keylist_ext): ... this. (_gpgme_gpg_op_sign): Make static and rename to ... (gpg_sign): ... this. (_gpgme_gpg_op_trustlist): Make static and rename to ... (gpg_trustlist): ... this. (_gpgme_gpg_op_verify): Make static and rename to ... (gpg_verify): ... this. (gpg_status_handler): Rename to ... (status_handler): ... this. (_gpgme_gpg_set_status_handler): Make static and rename to ... (gpg_set_status_handler): ... this. (_gpgme_gpg_set_colon_line_handler): Make static and rename to ... (gpg_set_colon_line_handler): ... this. (gpgme_gpg_add_io_cb): Rename to ... (add_io_cb): ... this. (_gpgme_gpg_start): Make static and rename to ... (gpg_start): ... this. (_gpgme_gpg_set_io_cb): Make static and rename to ... (gpg_set_io_cb): ... this. (_gpgme_gpg_io_event): Make static and rename to ... (gpg_io_event): ... this. (struct _gpgme_engine_ops_gpg): New variable.
2002-10-12 00:33:05 +00:00
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SYS_TYPES_H
/* Solaris 8 needs sys/types.h before time.h. */
# include <sys/types.h>
#endif
#include <time.h>
#include <errno.h>
gpgme/ 2002-10-08 Marcus Brinkmann <marcus@g10code.de> New data object component: * gpgme.h (GpgmeDataReadCb, GpgmeDataWriteCb, GpgmeDataSeekCb, GpgmeDataReleaseCb): New types. (struct GpgmeDataCbs): New structure. (gpgme_data_read): Changed prototype to match that of read() closely. (gpgme_data_write): Similar for write(). (gpgme_data_seek, gpgme_data_new_from_cbs, gpgme_data_new_from_fd, gpgme_data_new_from_stream): New prototypes. (gpgme_data_get_type, gpgme_check_engine): Prototype removed. * Makefile.am (libgpgme_la_SOURCES): Add data.h, data-fd.c, data-stream.c, data-mem.c, data-user.c and data-compat.c. * data.c: Reimplemented from scratch. * (data-compat.c, data-fd.c, data.h, data-mem.c, data-stream.c, data-user.c): New file. * context.h (struct gpgme_data_s): Removed. * conversion.c: Include <errno.h> and <sys/types.h>. (_gpgme_data_append): New function. * data.c (_gpgme_data_append_string): Move to ... * conversion.c (_gpgme_data_append_string): ... here. * data.c (_gpgme_data_append_for_xml): Move to ... * conversion.c (_gpgme_data_append_for_xml): ... here. * data.c (_gpgme_data_append_string_for_xml): Move to ... * conversion.c (_gpgme_data_append_string_for_xml): ... here. * data.c (_gpgme_data_append_percentstring_for_xml): Move to ... * conversion.c (_gpgme_data_append_percentstring_for_xml): ... here. * ops.h (_gpgme_data_get_mode, _gpgme_data_set_mode): Prototype removed. * types.h (GpgmeDataMode): Type removed. * decrypt.c (_gpgme_decrypt_start): Don't check data type or mode. * edit.c (_gpgme_op_edit_start): Likewise. * encrypt.c (_gpgme_op_encrypt_start): Likewise. * encrypt-sign.c (_gpgme_op_encrypt_sign_start): Likewise. * encrypt-sign.c (_gpgme_op_encrypt_sign_start): Likewise. * export.c (_gpgme_op_export_start): Likewise. * genkey.c (_gpgme_op_genkey_start): Likewise. * import.c (_gpgme_op_import_start): Likewise. * sign.c (_gpgme_op_sign_start): Likewise. * verify.c (_gpgme_op_verify_start): Likewise. * encrypt.c (gpgme_op_encrypt): Remove hack that returns invalid no recipient if no data was returned. * encrypt-sign.c (gpgme_op_encrypt_sign): Remove hack that returns no recipient if no data was returned. * encrypt-sign.c (gpgme_op_encrypt_sign): Remove hack that returns no recipient if no data was returned. * engine.c (_gpgme_engine_op_verify): Add new argument to differentiate detached from normal signatures. * engine.h (_gpgme_engine_op_verify): Likewise for prototype. * engine-gpgsm.c (_gpgme_gpgsm_op_verify): Likewise. Don't check mode of data argument. * engine-gpgsm.h (_gpgme_gpgsm_op_verify): Likewise for prototype. * gpgme.h (gpgme_op_verify_start): Likewise for prototype. (gpgme_op_verify): Likewise for prototype. * rungpg.c (_gpgme_gpg_op_verify): Likewise. * rungpg.h (_gpgme_gpg_op_verify): Likewise for prototype. * verify.c (_gpgme_op_verify_start): Likewise. (gpgme_op_verify_start): Likewise. (gpgme_op_verify): Likewise. * rungpg.c (struct arg_and_data_s): New member INBOUND to hold direction of data object. (_gpgme_gpg_add_data): Add new argument INBOUND. Use it to determine direction of data object. (_gpgme_gpg_add_pm_data, _gpgme_gpg_set_command_handler, _gpgme_gpg_op_decrypt, _gpgme_gpg_op_edit, _gpgme_gpg_op_encrypt, _gpgme_gpg_op_encrypt_sign, _gpgme_gpg_op_export, _gpgme_gpg_op_genkey, _gpgme_gpg_op_import, _gpgme_gpg_op_sign, _gpgme_gpg_op_verify): Add new argument to _gpgme_gpg_add_data invocation. (build_argv): Use new member INBOUND to determine direction of file descriptor. Don't check the data type. * rungpg.h (_gpgme_gpg_add_data): Add new argument to prototype. * gpgme.c (gpgme_get_op_info): Don't call _gpgme_data_get_as_string if CTX->op_info is NULL. * version.c (gpgme_check_engine): Function removed. tests/ 2002-10-09 Marcus Brinkmann <marcus@g10code.de> * gpg/t-decrypt.c (print_data): Update to new gpgme_data_read interface, and use gpgme_engine_check_version instead gpgme_check_version. * gpg/t-decrypt-verify.c (print_data): Likewise. * gpg/t-edit.c (main): Likewise. * gpg/t-encrypt.c (print_data): Likewise. * gpg/t-encrypt-sign.c (print_data): Likewise. * gpg/t-encrypt-sym.c (print_data): Likewise. * gpg/t-eventloop.c (print_data): Likewise. * gpg/t-export.c (print_data): Likewise. * gpg/t-sign.c (print_data): Likewise. * gpg/t-signers.c (print_data): Likewise. * gpgsm/t-decrypt.c (print_data): Likewise. * gpgsm/t-encrypt.c (print_data): Likewise. * gpgsm/t-export.c (print_data): Likewise. * gpgsm/t-sign.c (print_data): Likewise. * gpg/t-verify.c (main): Likewise for gpgme_op_verify. * gpgsm/t-verify.c (main): Likewise for gpgme_op_verify. * t-data.c (read_once_test): Likewise. (write_test): Update for new behaviour of data objects. (main): Remove type test.
2002-10-09 00:16:38 +00:00
#include "gpgme.h"
#include "util.h"
#include "debug.h"
#define atoi_1(p) (*(p) - '0' )
#define atoi_2(p) ((atoi_1(p) * 10) + atoi_1((p)+1))
#define atoi_4(p) ((atoi_2(p) * 100) + atoi_2((p)+2))
/* Convert two hexadecimal digits from STR to the value they
represent. Returns -1 if one of the characters is not a
hexadecimal digit. */
int
_gpgme_hextobyte (const char *str)
{
int val = 0;
int i;
#define NROFHEXDIGITS 2
for (i = 0; i < NROFHEXDIGITS; i++)
{
if (*str >= '0' && *str <= '9')
val += *str - '0';
else if (*str >= 'A' && *str <= 'F')
val += 10 + *str - 'A';
else if (*str >= 'a' && *str <= 'f')
val += 10 + *str - 'a';
else
return -1;
if (i < NROFHEXDIGITS - 1)
val *= 16;
str++;
}
return val;
}
2002-12-04 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: Add prototype for gpgme_get_key. * key.c (gpgme_get_key): New function. * verify.c (gpgme_get_sig_key): Rewrite using gpgme_get_key. * gpgme.h: Add prototypes for new interfaces gpgme_key_sig_get_string_attr and gpgme_key_get_ulong_attr. (enum GpgmeAttr): New attribute GPGME_ATTR_SIG_CLASS. * gpgme.c (gpgme_set_keylist_mode): Allow GPGME_KEYLIST_MODE_SIGS. * key.h (struct certsig_s): New members ALGO, NAME_PART, EMAIL_PART, COMMENT_PART, NAME, SIG_STAT and SIG_CLASS. * conversion.c (_gpgme_decode_c_string): Add new parameter LEN. Use that to determine if allocation is desired or not. * util.h: Adjust prototype of _gpgme_decode_c_string. * keylist.c (keylist_colon_handler): Adjust caller of _gpgme_decode_c_string. * key.h (struct gpgme_key_s): New member last_uid. * key.c (_gpgme_key_append_name): Rewritten using _gpgme_decode_c_string and the last_uid pointer. (my_isdigit): Macro removed. (ALLOC_CHUNK): Likewise. * keylist.c (set_userid_flags): Use last_uid member of KEY. * context.h (struct user_id_s): New member last_certsig. * key.h: Add prototype for _gpgme_key_add_certsig. * key.c (_gpgme_key_add_certsig): New function. (set_user_id_part): Move function before _gpgme_key_add_certsig. (parse_user_id): Change first argument to SRC, add new arguments NAME, EMAIL and COMMENT. Change code to use these arguments instead going through UID. Move function before _gpgme_add_certsig. (parse_x509_user_id): Likewise. (_gpgme_key_append_name): Adjust arguments to parse_x509_user_id and parse_user_id invocation. (one_certsig_as_xml): New function. (one_uid_as_xml): Print signatures. * context.h (struct gpgme_context_s): New member TMP_UID. * keylist.c (keylist_colon_handler): Rewritten, implement "sig" record entries. * key.c (get_certsig): New function. (gpgme_key_sig_get_string_attr): Likewise. (gpgme_key_sig_get_ulong_attr): Likewise. * keylist.c: Include <ctype.h>. (my_isdigit): Macro removed. (set_mainkey_trust_info): Use isdigit, not my_isdigit. (set_userid_flags): Likewise. (set_subkey_trust_info): Likewise. (set_ownertrust): Likewise. (finish_key): Move function up a bit and remove prototype. * rungpg.c (gpg_keylist_ext): Correct precedence of signature listing mode. (gpg_keylist_ext): Implement signature listing mode.
2002-12-04 16:28:34 +00:00
/* Decode the C formatted string SRC and store the result in the
buffer *DESTP which is LEN bytes long. If LEN is zero, then a
large enough buffer is allocated with malloc and *DESTP is set to
the result. Currently, LEN is only used to specify if allocation
is desired or not, the caller is expected to make sure that *DESTP
is large enough if LEN is not zero. */
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
gpgme_error_t
_gpgme_decode_c_string (const char *src, char **destp, size_t len)
{
char *dest;
/* Set up the destination buffer. */
2002-12-04 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: Add prototype for gpgme_get_key. * key.c (gpgme_get_key): New function. * verify.c (gpgme_get_sig_key): Rewrite using gpgme_get_key. * gpgme.h: Add prototypes for new interfaces gpgme_key_sig_get_string_attr and gpgme_key_get_ulong_attr. (enum GpgmeAttr): New attribute GPGME_ATTR_SIG_CLASS. * gpgme.c (gpgme_set_keylist_mode): Allow GPGME_KEYLIST_MODE_SIGS. * key.h (struct certsig_s): New members ALGO, NAME_PART, EMAIL_PART, COMMENT_PART, NAME, SIG_STAT and SIG_CLASS. * conversion.c (_gpgme_decode_c_string): Add new parameter LEN. Use that to determine if allocation is desired or not. * util.h: Adjust prototype of _gpgme_decode_c_string. * keylist.c (keylist_colon_handler): Adjust caller of _gpgme_decode_c_string. * key.h (struct gpgme_key_s): New member last_uid. * key.c (_gpgme_key_append_name): Rewritten using _gpgme_decode_c_string and the last_uid pointer. (my_isdigit): Macro removed. (ALLOC_CHUNK): Likewise. * keylist.c (set_userid_flags): Use last_uid member of KEY. * context.h (struct user_id_s): New member last_certsig. * key.h: Add prototype for _gpgme_key_add_certsig. * key.c (_gpgme_key_add_certsig): New function. (set_user_id_part): Move function before _gpgme_key_add_certsig. (parse_user_id): Change first argument to SRC, add new arguments NAME, EMAIL and COMMENT. Change code to use these arguments instead going through UID. Move function before _gpgme_add_certsig. (parse_x509_user_id): Likewise. (_gpgme_key_append_name): Adjust arguments to parse_x509_user_id and parse_user_id invocation. (one_certsig_as_xml): New function. (one_uid_as_xml): Print signatures. * context.h (struct gpgme_context_s): New member TMP_UID. * keylist.c (keylist_colon_handler): Rewritten, implement "sig" record entries. * key.c (get_certsig): New function. (gpgme_key_sig_get_string_attr): Likewise. (gpgme_key_sig_get_ulong_attr): Likewise. * keylist.c: Include <ctype.h>. (my_isdigit): Macro removed. (set_mainkey_trust_info): Use isdigit, not my_isdigit. (set_userid_flags): Likewise. (set_subkey_trust_info): Likewise. (set_ownertrust): Likewise. (finish_key): Move function up a bit and remove prototype. * rungpg.c (gpg_keylist_ext): Correct precedence of signature listing mode. (gpg_keylist_ext): Implement signature listing mode.
2002-12-04 16:28:34 +00:00
if (len)
{
if (len < strlen (src) + 1)
return gpg_error (GPG_ERR_INTERNAL);
dest = *destp;
}
2002-12-04 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: Add prototype for gpgme_get_key. * key.c (gpgme_get_key): New function. * verify.c (gpgme_get_sig_key): Rewrite using gpgme_get_key. * gpgme.h: Add prototypes for new interfaces gpgme_key_sig_get_string_attr and gpgme_key_get_ulong_attr. (enum GpgmeAttr): New attribute GPGME_ATTR_SIG_CLASS. * gpgme.c (gpgme_set_keylist_mode): Allow GPGME_KEYLIST_MODE_SIGS. * key.h (struct certsig_s): New members ALGO, NAME_PART, EMAIL_PART, COMMENT_PART, NAME, SIG_STAT and SIG_CLASS. * conversion.c (_gpgme_decode_c_string): Add new parameter LEN. Use that to determine if allocation is desired or not. * util.h: Adjust prototype of _gpgme_decode_c_string. * keylist.c (keylist_colon_handler): Adjust caller of _gpgme_decode_c_string. * key.h (struct gpgme_key_s): New member last_uid. * key.c (_gpgme_key_append_name): Rewritten using _gpgme_decode_c_string and the last_uid pointer. (my_isdigit): Macro removed. (ALLOC_CHUNK): Likewise. * keylist.c (set_userid_flags): Use last_uid member of KEY. * context.h (struct user_id_s): New member last_certsig. * key.h: Add prototype for _gpgme_key_add_certsig. * key.c (_gpgme_key_add_certsig): New function. (set_user_id_part): Move function before _gpgme_key_add_certsig. (parse_user_id): Change first argument to SRC, add new arguments NAME, EMAIL and COMMENT. Change code to use these arguments instead going through UID. Move function before _gpgme_add_certsig. (parse_x509_user_id): Likewise. (_gpgme_key_append_name): Adjust arguments to parse_x509_user_id and parse_user_id invocation. (one_certsig_as_xml): New function. (one_uid_as_xml): Print signatures. * context.h (struct gpgme_context_s): New member TMP_UID. * keylist.c (keylist_colon_handler): Rewritten, implement "sig" record entries. * key.c (get_certsig): New function. (gpgme_key_sig_get_string_attr): Likewise. (gpgme_key_sig_get_ulong_attr): Likewise. * keylist.c: Include <ctype.h>. (my_isdigit): Macro removed. (set_mainkey_trust_info): Use isdigit, not my_isdigit. (set_userid_flags): Likewise. (set_subkey_trust_info): Likewise. (set_ownertrust): Likewise. (finish_key): Move function up a bit and remove prototype. * rungpg.c (gpg_keylist_ext): Correct precedence of signature listing mode. (gpg_keylist_ext): Implement signature listing mode.
2002-12-04 16:28:34 +00:00
else
{
/* The converted string will never be larger than the original
string. */
2002-12-04 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: Add prototype for gpgme_get_key. * key.c (gpgme_get_key): New function. * verify.c (gpgme_get_sig_key): Rewrite using gpgme_get_key. * gpgme.h: Add prototypes for new interfaces gpgme_key_sig_get_string_attr and gpgme_key_get_ulong_attr. (enum GpgmeAttr): New attribute GPGME_ATTR_SIG_CLASS. * gpgme.c (gpgme_set_keylist_mode): Allow GPGME_KEYLIST_MODE_SIGS. * key.h (struct certsig_s): New members ALGO, NAME_PART, EMAIL_PART, COMMENT_PART, NAME, SIG_STAT and SIG_CLASS. * conversion.c (_gpgme_decode_c_string): Add new parameter LEN. Use that to determine if allocation is desired or not. * util.h: Adjust prototype of _gpgme_decode_c_string. * keylist.c (keylist_colon_handler): Adjust caller of _gpgme_decode_c_string. * key.h (struct gpgme_key_s): New member last_uid. * key.c (_gpgme_key_append_name): Rewritten using _gpgme_decode_c_string and the last_uid pointer. (my_isdigit): Macro removed. (ALLOC_CHUNK): Likewise. * keylist.c (set_userid_flags): Use last_uid member of KEY. * context.h (struct user_id_s): New member last_certsig. * key.h: Add prototype for _gpgme_key_add_certsig. * key.c (_gpgme_key_add_certsig): New function. (set_user_id_part): Move function before _gpgme_key_add_certsig. (parse_user_id): Change first argument to SRC, add new arguments NAME, EMAIL and COMMENT. Change code to use these arguments instead going through UID. Move function before _gpgme_add_certsig. (parse_x509_user_id): Likewise. (_gpgme_key_append_name): Adjust arguments to parse_x509_user_id and parse_user_id invocation. (one_certsig_as_xml): New function. (one_uid_as_xml): Print signatures. * context.h (struct gpgme_context_s): New member TMP_UID. * keylist.c (keylist_colon_handler): Rewritten, implement "sig" record entries. * key.c (get_certsig): New function. (gpgme_key_sig_get_string_attr): Likewise. (gpgme_key_sig_get_ulong_attr): Likewise. * keylist.c: Include <ctype.h>. (my_isdigit): Macro removed. (set_mainkey_trust_info): Use isdigit, not my_isdigit. (set_userid_flags): Likewise. (set_subkey_trust_info): Likewise. (set_ownertrust): Likewise. (finish_key): Move function up a bit and remove prototype. * rungpg.c (gpg_keylist_ext): Correct precedence of signature listing mode. (gpg_keylist_ext): Implement signature listing mode.
2002-12-04 16:28:34 +00:00
dest = malloc (strlen (src) + 1);
if (!dest)
return gpg_error_from_syserror ();
2002-12-04 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: Add prototype for gpgme_get_key. * key.c (gpgme_get_key): New function. * verify.c (gpgme_get_sig_key): Rewrite using gpgme_get_key. * gpgme.h: Add prototypes for new interfaces gpgme_key_sig_get_string_attr and gpgme_key_get_ulong_attr. (enum GpgmeAttr): New attribute GPGME_ATTR_SIG_CLASS. * gpgme.c (gpgme_set_keylist_mode): Allow GPGME_KEYLIST_MODE_SIGS. * key.h (struct certsig_s): New members ALGO, NAME_PART, EMAIL_PART, COMMENT_PART, NAME, SIG_STAT and SIG_CLASS. * conversion.c (_gpgme_decode_c_string): Add new parameter LEN. Use that to determine if allocation is desired or not. * util.h: Adjust prototype of _gpgme_decode_c_string. * keylist.c (keylist_colon_handler): Adjust caller of _gpgme_decode_c_string. * key.h (struct gpgme_key_s): New member last_uid. * key.c (_gpgme_key_append_name): Rewritten using _gpgme_decode_c_string and the last_uid pointer. (my_isdigit): Macro removed. (ALLOC_CHUNK): Likewise. * keylist.c (set_userid_flags): Use last_uid member of KEY. * context.h (struct user_id_s): New member last_certsig. * key.h: Add prototype for _gpgme_key_add_certsig. * key.c (_gpgme_key_add_certsig): New function. (set_user_id_part): Move function before _gpgme_key_add_certsig. (parse_user_id): Change first argument to SRC, add new arguments NAME, EMAIL and COMMENT. Change code to use these arguments instead going through UID. Move function before _gpgme_add_certsig. (parse_x509_user_id): Likewise. (_gpgme_key_append_name): Adjust arguments to parse_x509_user_id and parse_user_id invocation. (one_certsig_as_xml): New function. (one_uid_as_xml): Print signatures. * context.h (struct gpgme_context_s): New member TMP_UID. * keylist.c (keylist_colon_handler): Rewritten, implement "sig" record entries. * key.c (get_certsig): New function. (gpgme_key_sig_get_string_attr): Likewise. (gpgme_key_sig_get_ulong_attr): Likewise. * keylist.c: Include <ctype.h>. (my_isdigit): Macro removed. (set_mainkey_trust_info): Use isdigit, not my_isdigit. (set_userid_flags): Likewise. (set_subkey_trust_info): Likewise. (set_ownertrust): Likewise. (finish_key): Move function up a bit and remove prototype. * rungpg.c (gpg_keylist_ext): Correct precedence of signature listing mode. (gpg_keylist_ext): Implement signature listing mode.
2002-12-04 16:28:34 +00:00
*destp = dest;
}
/* Convert the string. */
while (*src)
{
if (*src != '\\')
{
*(dest++) = *(src++);
continue;
}
switch (src[1])
{
#define DECODE_ONE(match,result) \
case match: \
src += 2; \
*(dest++) = result; \
break;
DECODE_ONE ('\'', '\'');
DECODE_ONE ('\"', '\"');
DECODE_ONE ('\?', '\?');
DECODE_ONE ('\\', '\\');
DECODE_ONE ('a', '\a');
DECODE_ONE ('b', '\b');
DECODE_ONE ('f', '\f');
DECODE_ONE ('n', '\n');
DECODE_ONE ('r', '\r');
DECODE_ONE ('t', '\t');
DECODE_ONE ('v', '\v');
case 'x':
{
int val = _gpgme_hextobyte (&src[2]);
if (val == -1)
{
/* Should not happen. */
*(dest++) = *(src++);
*(dest++) = *(src++);
if (*src)
*(dest++) = *(src++);
if (*src)
*(dest++) = *(src++);
}
else
{
if (!val)
{
/* A binary zero is not representable in a C
string. */
*(dest++) = '\\';
2012-04-30 15:42:53 +00:00
*(dest++) = '0';
}
2012-04-30 15:42:53 +00:00
else
*((unsigned char *) dest++) = val;
src += 4;
}
}
break;
default:
{
/* Should not happen. */
*(dest++) = *(src++);
*(dest++) = *(src++);
}
2012-04-30 15:42:53 +00:00
}
}
*(dest++) = 0;
return 0;
}
gpgme/ 2002-10-08 Marcus Brinkmann <marcus@g10code.de> New data object component: * gpgme.h (GpgmeDataReadCb, GpgmeDataWriteCb, GpgmeDataSeekCb, GpgmeDataReleaseCb): New types. (struct GpgmeDataCbs): New structure. (gpgme_data_read): Changed prototype to match that of read() closely. (gpgme_data_write): Similar for write(). (gpgme_data_seek, gpgme_data_new_from_cbs, gpgme_data_new_from_fd, gpgme_data_new_from_stream): New prototypes. (gpgme_data_get_type, gpgme_check_engine): Prototype removed. * Makefile.am (libgpgme_la_SOURCES): Add data.h, data-fd.c, data-stream.c, data-mem.c, data-user.c and data-compat.c. * data.c: Reimplemented from scratch. * (data-compat.c, data-fd.c, data.h, data-mem.c, data-stream.c, data-user.c): New file. * context.h (struct gpgme_data_s): Removed. * conversion.c: Include <errno.h> and <sys/types.h>. (_gpgme_data_append): New function. * data.c (_gpgme_data_append_string): Move to ... * conversion.c (_gpgme_data_append_string): ... here. * data.c (_gpgme_data_append_for_xml): Move to ... * conversion.c (_gpgme_data_append_for_xml): ... here. * data.c (_gpgme_data_append_string_for_xml): Move to ... * conversion.c (_gpgme_data_append_string_for_xml): ... here. * data.c (_gpgme_data_append_percentstring_for_xml): Move to ... * conversion.c (_gpgme_data_append_percentstring_for_xml): ... here. * ops.h (_gpgme_data_get_mode, _gpgme_data_set_mode): Prototype removed. * types.h (GpgmeDataMode): Type removed. * decrypt.c (_gpgme_decrypt_start): Don't check data type or mode. * edit.c (_gpgme_op_edit_start): Likewise. * encrypt.c (_gpgme_op_encrypt_start): Likewise. * encrypt-sign.c (_gpgme_op_encrypt_sign_start): Likewise. * encrypt-sign.c (_gpgme_op_encrypt_sign_start): Likewise. * export.c (_gpgme_op_export_start): Likewise. * genkey.c (_gpgme_op_genkey_start): Likewise. * import.c (_gpgme_op_import_start): Likewise. * sign.c (_gpgme_op_sign_start): Likewise. * verify.c (_gpgme_op_verify_start): Likewise. * encrypt.c (gpgme_op_encrypt): Remove hack that returns invalid no recipient if no data was returned. * encrypt-sign.c (gpgme_op_encrypt_sign): Remove hack that returns no recipient if no data was returned. * encrypt-sign.c (gpgme_op_encrypt_sign): Remove hack that returns no recipient if no data was returned. * engine.c (_gpgme_engine_op_verify): Add new argument to differentiate detached from normal signatures. * engine.h (_gpgme_engine_op_verify): Likewise for prototype. * engine-gpgsm.c (_gpgme_gpgsm_op_verify): Likewise. Don't check mode of data argument. * engine-gpgsm.h (_gpgme_gpgsm_op_verify): Likewise for prototype. * gpgme.h (gpgme_op_verify_start): Likewise for prototype. (gpgme_op_verify): Likewise for prototype. * rungpg.c (_gpgme_gpg_op_verify): Likewise. * rungpg.h (_gpgme_gpg_op_verify): Likewise for prototype. * verify.c (_gpgme_op_verify_start): Likewise. (gpgme_op_verify_start): Likewise. (gpgme_op_verify): Likewise. * rungpg.c (struct arg_and_data_s): New member INBOUND to hold direction of data object. (_gpgme_gpg_add_data): Add new argument INBOUND. Use it to determine direction of data object. (_gpgme_gpg_add_pm_data, _gpgme_gpg_set_command_handler, _gpgme_gpg_op_decrypt, _gpgme_gpg_op_edit, _gpgme_gpg_op_encrypt, _gpgme_gpg_op_encrypt_sign, _gpgme_gpg_op_export, _gpgme_gpg_op_genkey, _gpgme_gpg_op_import, _gpgme_gpg_op_sign, _gpgme_gpg_op_verify): Add new argument to _gpgme_gpg_add_data invocation. (build_argv): Use new member INBOUND to determine direction of file descriptor. Don't check the data type. * rungpg.h (_gpgme_gpg_add_data): Add new argument to prototype. * gpgme.c (gpgme_get_op_info): Don't call _gpgme_data_get_as_string if CTX->op_info is NULL. * version.c (gpgme_check_engine): Function removed. tests/ 2002-10-09 Marcus Brinkmann <marcus@g10code.de> * gpg/t-decrypt.c (print_data): Update to new gpgme_data_read interface, and use gpgme_engine_check_version instead gpgme_check_version. * gpg/t-decrypt-verify.c (print_data): Likewise. * gpg/t-edit.c (main): Likewise. * gpg/t-encrypt.c (print_data): Likewise. * gpg/t-encrypt-sign.c (print_data): Likewise. * gpg/t-encrypt-sym.c (print_data): Likewise. * gpg/t-eventloop.c (print_data): Likewise. * gpg/t-export.c (print_data): Likewise. * gpg/t-sign.c (print_data): Likewise. * gpg/t-signers.c (print_data): Likewise. * gpgsm/t-decrypt.c (print_data): Likewise. * gpgsm/t-encrypt.c (print_data): Likewise. * gpgsm/t-export.c (print_data): Likewise. * gpgsm/t-sign.c (print_data): Likewise. * gpg/t-verify.c (main): Likewise for gpgme_op_verify. * gpgsm/t-verify.c (main): Likewise for gpgme_op_verify. * t-data.c (read_once_test): Likewise. (write_test): Update for new behaviour of data objects. (main): Remove type test.
2002-10-09 00:16:38 +00:00
doc/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Verify): Rewritten to take into account new and deprecated functions and data types. gpgme/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (struct _gpgme_sig_notation): New structure. (GpgmeSigNotation): New type. (struct _gpgme_signature): New structure. (GpgmeSignature): New type. (struct _gpgme_op_verify_result): New structure. (GpgmeVerifyResult): New type. (gpgme_op_verify_result): New prototype. (gpgme_get_notation): Remove prototype. * ops.h (_gpgme_op_verify_init_result): New prototype. (_gpgme_verify_status_handler): Change first argument to void *. * util.h (_gpgme_decode_percent_string, _gpgme_map_gnupg_error): New prototypes. * conversion.c (_gpgme_decode_percent_string): New function. (gnupg_errors): New static global. (_gpgme_map_gnupg_error): New function. * gpgme.c (gpgme_release): Don't release CTX->notation. (gpgme_get_notation): Remove function. * decrypt-verify.c (_gpgme_op_decrypt_verify_start): Call _gpgme_op_verify_init_result. * verify.c: Do not include <stdio.h>, <assert.h> and "key.h", but do include "gpgme.h". (struct verify_result): Replace with ... (op_data_t): ... this type. (release_verify_result): Remove function. (release_op_data): New function. (is_token): Remove function. (skip_token): Remove function. (copy_token): Remove function. (gpgme_op_verify_result): New function. (calc_sig_summary): Rewritten. (finish_sig): Remove function. (parse_new_sig): New function. (parse_valid_sig): New function. (parse_notation): New function. (parse_trust): New function. (parse_error): New function. (_gpgme_verify_status_handler): Rewritten. Change first argument to void *. (_gpgme_op_verify_start): Rework error handling. Call _gpgme_op_verify_init_result. (gpgme_op_verify): Do not release or clear CTX->notation. (gpgme_get_sig_status): Rewritten. (gpgme_get_sig_string_attr): Likewise. (gpgme_get_sig_ulong_attr): Likewise. (gpgme_get_sig_key): Likewise.
2003-04-28 23:59:03 +00:00
/* Decode the percent escaped string SRC and store the result in the
buffer *DESTP which is LEN bytes long. If LEN is zero, then a
large enough buffer is allocated with malloc and *DESTP is set to
the result. Currently, LEN is only used to specify if allocation
is desired or not, the caller is expected to make sure that *DESTP
is large enough if LEN is not zero. If BINARY is 1, then '\0'
characters are allowed in the output. */
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
gpgme_error_t
_gpgme_decode_percent_string (const char *src, char **destp, size_t len,
int binary)
doc/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Verify): Rewritten to take into account new and deprecated functions and data types. gpgme/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (struct _gpgme_sig_notation): New structure. (GpgmeSigNotation): New type. (struct _gpgme_signature): New structure. (GpgmeSignature): New type. (struct _gpgme_op_verify_result): New structure. (GpgmeVerifyResult): New type. (gpgme_op_verify_result): New prototype. (gpgme_get_notation): Remove prototype. * ops.h (_gpgme_op_verify_init_result): New prototype. (_gpgme_verify_status_handler): Change first argument to void *. * util.h (_gpgme_decode_percent_string, _gpgme_map_gnupg_error): New prototypes. * conversion.c (_gpgme_decode_percent_string): New function. (gnupg_errors): New static global. (_gpgme_map_gnupg_error): New function. * gpgme.c (gpgme_release): Don't release CTX->notation. (gpgme_get_notation): Remove function. * decrypt-verify.c (_gpgme_op_decrypt_verify_start): Call _gpgme_op_verify_init_result. * verify.c: Do not include <stdio.h>, <assert.h> and "key.h", but do include "gpgme.h". (struct verify_result): Replace with ... (op_data_t): ... this type. (release_verify_result): Remove function. (release_op_data): New function. (is_token): Remove function. (skip_token): Remove function. (copy_token): Remove function. (gpgme_op_verify_result): New function. (calc_sig_summary): Rewritten. (finish_sig): Remove function. (parse_new_sig): New function. (parse_valid_sig): New function. (parse_notation): New function. (parse_trust): New function. (parse_error): New function. (_gpgme_verify_status_handler): Rewritten. Change first argument to void *. (_gpgme_op_verify_start): Rework error handling. Call _gpgme_op_verify_init_result. (gpgme_op_verify): Do not release or clear CTX->notation. (gpgme_get_sig_status): Rewritten. (gpgme_get_sig_string_attr): Likewise. (gpgme_get_sig_ulong_attr): Likewise. (gpgme_get_sig_key): Likewise.
2003-04-28 23:59:03 +00:00
{
char *dest;
/* Set up the destination buffer. */
if (len)
{
if (len < strlen (src) + 1)
return gpg_error (GPG_ERR_INTERNAL);
doc/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Verify): Rewritten to take into account new and deprecated functions and data types. gpgme/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (struct _gpgme_sig_notation): New structure. (GpgmeSigNotation): New type. (struct _gpgme_signature): New structure. (GpgmeSignature): New type. (struct _gpgme_op_verify_result): New structure. (GpgmeVerifyResult): New type. (gpgme_op_verify_result): New prototype. (gpgme_get_notation): Remove prototype. * ops.h (_gpgme_op_verify_init_result): New prototype. (_gpgme_verify_status_handler): Change first argument to void *. * util.h (_gpgme_decode_percent_string, _gpgme_map_gnupg_error): New prototypes. * conversion.c (_gpgme_decode_percent_string): New function. (gnupg_errors): New static global. (_gpgme_map_gnupg_error): New function. * gpgme.c (gpgme_release): Don't release CTX->notation. (gpgme_get_notation): Remove function. * decrypt-verify.c (_gpgme_op_decrypt_verify_start): Call _gpgme_op_verify_init_result. * verify.c: Do not include <stdio.h>, <assert.h> and "key.h", but do include "gpgme.h". (struct verify_result): Replace with ... (op_data_t): ... this type. (release_verify_result): Remove function. (release_op_data): New function. (is_token): Remove function. (skip_token): Remove function. (copy_token): Remove function. (gpgme_op_verify_result): New function. (calc_sig_summary): Rewritten. (finish_sig): Remove function. (parse_new_sig): New function. (parse_valid_sig): New function. (parse_notation): New function. (parse_trust): New function. (parse_error): New function. (_gpgme_verify_status_handler): Rewritten. Change first argument to void *. (_gpgme_op_verify_start): Rework error handling. Call _gpgme_op_verify_init_result. (gpgme_op_verify): Do not release or clear CTX->notation. (gpgme_get_sig_status): Rewritten. (gpgme_get_sig_string_attr): Likewise. (gpgme_get_sig_ulong_attr): Likewise. (gpgme_get_sig_key): Likewise.
2003-04-28 23:59:03 +00:00
dest = *destp;
}
else
{
/* The converted string will never be larger than the original
string. */
dest = malloc (strlen (src) + 1);
if (!dest)
return gpg_error_from_syserror ();
doc/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Verify): Rewritten to take into account new and deprecated functions and data types. gpgme/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (struct _gpgme_sig_notation): New structure. (GpgmeSigNotation): New type. (struct _gpgme_signature): New structure. (GpgmeSignature): New type. (struct _gpgme_op_verify_result): New structure. (GpgmeVerifyResult): New type. (gpgme_op_verify_result): New prototype. (gpgme_get_notation): Remove prototype. * ops.h (_gpgme_op_verify_init_result): New prototype. (_gpgme_verify_status_handler): Change first argument to void *. * util.h (_gpgme_decode_percent_string, _gpgme_map_gnupg_error): New prototypes. * conversion.c (_gpgme_decode_percent_string): New function. (gnupg_errors): New static global. (_gpgme_map_gnupg_error): New function. * gpgme.c (gpgme_release): Don't release CTX->notation. (gpgme_get_notation): Remove function. * decrypt-verify.c (_gpgme_op_decrypt_verify_start): Call _gpgme_op_verify_init_result. * verify.c: Do not include <stdio.h>, <assert.h> and "key.h", but do include "gpgme.h". (struct verify_result): Replace with ... (op_data_t): ... this type. (release_verify_result): Remove function. (release_op_data): New function. (is_token): Remove function. (skip_token): Remove function. (copy_token): Remove function. (gpgme_op_verify_result): New function. (calc_sig_summary): Rewritten. (finish_sig): Remove function. (parse_new_sig): New function. (parse_valid_sig): New function. (parse_notation): New function. (parse_trust): New function. (parse_error): New function. (_gpgme_verify_status_handler): Rewritten. Change first argument to void *. (_gpgme_op_verify_start): Rework error handling. Call _gpgme_op_verify_init_result. (gpgme_op_verify): Do not release or clear CTX->notation. (gpgme_get_sig_status): Rewritten. (gpgme_get_sig_string_attr): Likewise. (gpgme_get_sig_ulong_attr): Likewise. (gpgme_get_sig_key): Likewise.
2003-04-28 23:59:03 +00:00
*destp = dest;
}
/* Convert the string. */
while (*src)
{
if (*src != '%')
{
*(dest++) = *(src++);
continue;
}
else
{
int val = _gpgme_hextobyte (&src[1]);
2012-04-30 15:42:53 +00:00
doc/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Verify): Rewritten to take into account new and deprecated functions and data types. gpgme/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (struct _gpgme_sig_notation): New structure. (GpgmeSigNotation): New type. (struct _gpgme_signature): New structure. (GpgmeSignature): New type. (struct _gpgme_op_verify_result): New structure. (GpgmeVerifyResult): New type. (gpgme_op_verify_result): New prototype. (gpgme_get_notation): Remove prototype. * ops.h (_gpgme_op_verify_init_result): New prototype. (_gpgme_verify_status_handler): Change first argument to void *. * util.h (_gpgme_decode_percent_string, _gpgme_map_gnupg_error): New prototypes. * conversion.c (_gpgme_decode_percent_string): New function. (gnupg_errors): New static global. (_gpgme_map_gnupg_error): New function. * gpgme.c (gpgme_release): Don't release CTX->notation. (gpgme_get_notation): Remove function. * decrypt-verify.c (_gpgme_op_decrypt_verify_start): Call _gpgme_op_verify_init_result. * verify.c: Do not include <stdio.h>, <assert.h> and "key.h", but do include "gpgme.h". (struct verify_result): Replace with ... (op_data_t): ... this type. (release_verify_result): Remove function. (release_op_data): New function. (is_token): Remove function. (skip_token): Remove function. (copy_token): Remove function. (gpgme_op_verify_result): New function. (calc_sig_summary): Rewritten. (finish_sig): Remove function. (parse_new_sig): New function. (parse_valid_sig): New function. (parse_notation): New function. (parse_trust): New function. (parse_error): New function. (_gpgme_verify_status_handler): Rewritten. Change first argument to void *. (_gpgme_op_verify_start): Rework error handling. Call _gpgme_op_verify_init_result. (gpgme_op_verify): Do not release or clear CTX->notation. (gpgme_get_sig_status): Rewritten. (gpgme_get_sig_string_attr): Likewise. (gpgme_get_sig_ulong_attr): Likewise. (gpgme_get_sig_key): Likewise.
2003-04-28 23:59:03 +00:00
if (val == -1)
{
/* Should not happen. */
*(dest++) = *(src++);
if (*src)
*(dest++) = *(src++);
if (*src)
*(dest++) = *(src++);
}
else
{
if (!val && !binary)
doc/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Verify): Rewritten to take into account new and deprecated functions and data types. gpgme/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (struct _gpgme_sig_notation): New structure. (GpgmeSigNotation): New type. (struct _gpgme_signature): New structure. (GpgmeSignature): New type. (struct _gpgme_op_verify_result): New structure. (GpgmeVerifyResult): New type. (gpgme_op_verify_result): New prototype. (gpgme_get_notation): Remove prototype. * ops.h (_gpgme_op_verify_init_result): New prototype. (_gpgme_verify_status_handler): Change first argument to void *. * util.h (_gpgme_decode_percent_string, _gpgme_map_gnupg_error): New prototypes. * conversion.c (_gpgme_decode_percent_string): New function. (gnupg_errors): New static global. (_gpgme_map_gnupg_error): New function. * gpgme.c (gpgme_release): Don't release CTX->notation. (gpgme_get_notation): Remove function. * decrypt-verify.c (_gpgme_op_decrypt_verify_start): Call _gpgme_op_verify_init_result. * verify.c: Do not include <stdio.h>, <assert.h> and "key.h", but do include "gpgme.h". (struct verify_result): Replace with ... (op_data_t): ... this type. (release_verify_result): Remove function. (release_op_data): New function. (is_token): Remove function. (skip_token): Remove function. (copy_token): Remove function. (gpgme_op_verify_result): New function. (calc_sig_summary): Rewritten. (finish_sig): Remove function. (parse_new_sig): New function. (parse_valid_sig): New function. (parse_notation): New function. (parse_trust): New function. (parse_error): New function. (_gpgme_verify_status_handler): Rewritten. Change first argument to void *. (_gpgme_op_verify_start): Rework error handling. Call _gpgme_op_verify_init_result. (gpgme_op_verify): Do not release or clear CTX->notation. (gpgme_get_sig_status): Rewritten. (gpgme_get_sig_string_attr): Likewise. (gpgme_get_sig_ulong_attr): Likewise. (gpgme_get_sig_key): Likewise.
2003-04-28 23:59:03 +00:00
{
/* A binary zero is not representable in a C
string. */
*(dest++) = '\\';
2012-04-30 15:42:53 +00:00
*(dest++) = '0';
doc/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Verify): Rewritten to take into account new and deprecated functions and data types. gpgme/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (struct _gpgme_sig_notation): New structure. (GpgmeSigNotation): New type. (struct _gpgme_signature): New structure. (GpgmeSignature): New type. (struct _gpgme_op_verify_result): New structure. (GpgmeVerifyResult): New type. (gpgme_op_verify_result): New prototype. (gpgme_get_notation): Remove prototype. * ops.h (_gpgme_op_verify_init_result): New prototype. (_gpgme_verify_status_handler): Change first argument to void *. * util.h (_gpgme_decode_percent_string, _gpgme_map_gnupg_error): New prototypes. * conversion.c (_gpgme_decode_percent_string): New function. (gnupg_errors): New static global. (_gpgme_map_gnupg_error): New function. * gpgme.c (gpgme_release): Don't release CTX->notation. (gpgme_get_notation): Remove function. * decrypt-verify.c (_gpgme_op_decrypt_verify_start): Call _gpgme_op_verify_init_result. * verify.c: Do not include <stdio.h>, <assert.h> and "key.h", but do include "gpgme.h". (struct verify_result): Replace with ... (op_data_t): ... this type. (release_verify_result): Remove function. (release_op_data): New function. (is_token): Remove function. (skip_token): Remove function. (copy_token): Remove function. (gpgme_op_verify_result): New function. (calc_sig_summary): Rewritten. (finish_sig): Remove function. (parse_new_sig): New function. (parse_valid_sig): New function. (parse_notation): New function. (parse_trust): New function. (parse_error): New function. (_gpgme_verify_status_handler): Rewritten. Change first argument to void *. (_gpgme_op_verify_start): Rework error handling. Call _gpgme_op_verify_init_result. (gpgme_op_verify): Do not release or clear CTX->notation. (gpgme_get_sig_status): Rewritten. (gpgme_get_sig_string_attr): Likewise. (gpgme_get_sig_ulong_attr): Likewise. (gpgme_get_sig_key): Likewise.
2003-04-28 23:59:03 +00:00
}
2012-04-30 15:42:53 +00:00
else
doc/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Verify): Rewritten to take into account new and deprecated functions and data types. gpgme/ 2003-04-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (struct _gpgme_sig_notation): New structure. (GpgmeSigNotation): New type. (struct _gpgme_signature): New structure. (GpgmeSignature): New type. (struct _gpgme_op_verify_result): New structure. (GpgmeVerifyResult): New type. (gpgme_op_verify_result): New prototype. (gpgme_get_notation): Remove prototype. * ops.h (_gpgme_op_verify_init_result): New prototype. (_gpgme_verify_status_handler): Change first argument to void *. * util.h (_gpgme_decode_percent_string, _gpgme_map_gnupg_error): New prototypes. * conversion.c (_gpgme_decode_percent_string): New function. (gnupg_errors): New static global. (_gpgme_map_gnupg_error): New function. * gpgme.c (gpgme_release): Don't release CTX->notation. (gpgme_get_notation): Remove function. * decrypt-verify.c (_gpgme_op_decrypt_verify_start): Call _gpgme_op_verify_init_result. * verify.c: Do not include <stdio.h>, <assert.h> and "key.h", but do include "gpgme.h". (struct verify_result): Replace with ... (op_data_t): ... this type. (release_verify_result): Remove function. (release_op_data): New function. (is_token): Remove function. (skip_token): Remove function. (copy_token): Remove function. (gpgme_op_verify_result): New function. (calc_sig_summary): Rewritten. (finish_sig): Remove function. (parse_new_sig): New function. (parse_valid_sig): New function. (parse_notation): New function. (parse_trust): New function. (parse_error): New function. (_gpgme_verify_status_handler): Rewritten. Change first argument to void *. (_gpgme_op_verify_start): Rework error handling. Call _gpgme_op_verify_init_result. (gpgme_op_verify): Do not release or clear CTX->notation. (gpgme_get_sig_status): Rewritten. (gpgme_get_sig_string_attr): Likewise. (gpgme_get_sig_ulong_attr): Likewise. (gpgme_get_sig_key): Likewise.
2003-04-28 23:59:03 +00:00
*((unsigned char *) dest++) = val;
src += 3;
}
}
}
*(dest++) = 0;
return 0;
}
/* Encode the string SRC with percent escaping and store the result in
the buffer *DESTP which is LEN bytes long. If LEN is zero, then a
large enough buffer is allocated with malloc and *DESTP is set to
the result. Currently, LEN is only used to specify if allocation
is desired or not, the caller is expected to make sure that *DESTP
is large enough if LEN is not zero. If BINARY is 1, then '\0'
characters are allowed in the output. */
gpgme_error_t
_gpgme_encode_percent_string (const char *src, char **destp, size_t len)
{
size_t destlen;
char *dest;
const char *str;
destlen = 0;
str = src;
/* We percent-escape the + character because the user might need a
"percent plus" escaped string (special gpg format). But we
percent-escape the space character, which works with and without
the special plus format. */
while (*str)
{
2012-04-30 15:42:53 +00:00
if (*str == '+' || *str == '\"' || *str == '%'
|| *(const unsigned char *)str <= 0x20)
destlen += 3;
else
destlen++;
str++;
}
/* Terminating nul byte. */
destlen++;
/* Set up the destination buffer. */
if (len)
{
if (len < destlen)
return gpg_error (GPG_ERR_INTERNAL);
dest = *destp;
}
else
{
/* The converted string will never be larger than the original
string. */
dest = malloc (destlen);
if (!dest)
return gpg_error_from_syserror ();
*destp = dest;
}
/* Convert the string. */
while (*src)
{
2012-04-30 15:42:53 +00:00
if (*src == '+' || *src == '\"' || *src == '%'
|| *(const unsigned char *)src <= 0x20)
{
snprintf (dest, 4, "%%%02X", *(unsigned char *)src);
dest += 3;
}
else
*(dest++) = *src;
src++;
}
*(dest++) = 0;
return 0;
}
#ifdef HAVE_W32_SYSTEM
static time_t
_gpgme_timegm (struct tm *tm)
{
/* This one is thread safe. */
SYSTEMTIME st;
FILETIME ft;
unsigned long long cnsecs;
2012-04-30 15:42:53 +00:00
st.wYear = tm->tm_year + 1900;
st.wMonth = tm->tm_mon + 1;
st.wDay = tm->tm_mday;
st.wHour = tm->tm_hour;
st.wMinute = tm->tm_min;
st.wSecond = tm->tm_sec;
st.wMilliseconds = 0; /* Not available. */
st.wDayOfWeek = 0; /* Ignored. */
/* System time is UTC thus the conversion is pretty easy. */
if (!SystemTimeToFileTime (&st, &ft))
{
gpg_err_set_errno (EINVAL);
return (time_t)(-1);
}
2012-04-30 15:42:53 +00:00
cnsecs = (((unsigned long long)ft.dwHighDateTime << 32)
| ft.dwLowDateTime);
cnsecs -= 116444736000000000ULL; /* The filetime epoch is 1601-01-01. */
return (time_t)(cnsecs / 10000000ULL);
}
#endif
/* Parse the string TIMESTAMP into a time_t. The string may either be
seconds since Epoch or in the ISO 8601 format like
"20390815T143012". Returns 0 for an empty string or seconds since
Epoch. Leading spaces are skipped. If ENDP is not NULL, it will
point to the next non-parsed character in TIMESTRING. */
time_t
_gpgme_parse_timestamp (const char *timestamp, char **endp)
{
/* Need to skip leading spaces, because that is what strtoul does
but not our ISO 8601 checking code. */
while (*timestamp && *timestamp== ' ')
timestamp++;
if (!*timestamp)
return 0;
if (strlen (timestamp) >= 15 && timestamp[8] == 'T')
{
struct tm buf;
int year;
year = atoi_4 (timestamp);
if (year < 1900)
return (time_t)(-1);
if (endp)
*endp = (char*)(timestamp + 15);
/* Fixme: We would better use a configure test to see whether
mktime can handle dates beyond 2038. */
if (sizeof (time_t) <= 4 && year >= 2038)
return (time_t)2145914603; /* 2037-12-31 23:23:23 */
memset (&buf, 0, sizeof buf);
buf.tm_year = year - 1900;
2012-04-30 15:42:53 +00:00
buf.tm_mon = atoi_2 (timestamp+4) - 1;
buf.tm_mday = atoi_2 (timestamp+6);
buf.tm_hour = atoi_2 (timestamp+9);
buf.tm_min = atoi_2 (timestamp+11);
buf.tm_sec = atoi_2 (timestamp+13);
#ifdef HAVE_W32_SYSTEM
return _gpgme_timegm (&buf);
#else
#ifdef HAVE_TIMEGM
return timegm (&buf);
#else
{
time_t tim;
2012-04-30 15:42:53 +00:00
putenv ("TZ=UTC");
tim = mktime (&buf);
#ifdef __GNUC__
#warning fixme: we must somehow reset TZ here. It is not threadsafe anyway.
#endif
return tim;
}
#endif /* !HAVE_TIMEGM */
#endif /* !HAVE_W32_SYSTEM */
}
else
return (time_t)strtoul (timestamp, endp, 10);
}
/* The GPG backend uses OpenPGP algorithm numbers which we need to map
to our algorithm numbers. This function MUST not change ERRNO. */
int
_gpgme_map_pk_algo (int algo, gpgme_protocol_t protocol)
{
if (protocol == GPGME_PROTOCOL_OPENPGP)
{
switch (algo)
{
case 1: case 2: case 3: case 16: case 17: break;
case 18: algo = GPGME_PK_ECDH; break;
case 19: algo = GPGME_PK_ECDSA; break;
case 20: break;
default: algo = 0; break; /* Unknown. */
}
}
return algo;
}