2002-09-01 22:23:56 +00:00
|
|
|
|
/* 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)
|
2007-07-17 Marcus Brinkmann <marcus@g10code.de>
* debug.c:;5B Include <errno.h> and "debug.h".
(_gpgme_debug): Save and restore ERRNO.
(TOHEX): New macro.
(_gpgme_debug_buffer): New function.
* conversion.c, data-compat.c, data-mem.c, data.c, engine-gpgsm.c,
gpgme.c, keylist.c, posix-io.c, rungpg.c, sign.c, version.c,
w32-io.c, wait.c: Replace DEBUG macros by TRACE_* variants. In
most of these files, add many more tracepoints.
2007-07-17 12:36:04 +00:00
|
|
|
|
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. */
|
2002-09-01 22:23:56 +00:00
|
|
|
|
|
|
|
|
|
#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>
|
doc/
2003-04-30 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Encrypting a Plaintext): Remove reference to
gpgme_get_op_info.
(Detailed Results): Subsection removed.
gpgme/
2003-04-30 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_get_op_info): Remove prototype.
* ops.h (_gpgme_set_op_info,
_gpgme_data_release_and_return_string, _gpgme_data_get_as_string,
_gpgme_data_append, _gpgme_data_append_string,
_gpgme_data_append_string_for_xml, _gpgme_data_append_for_xml,
_gpgme_data_append_percentstring_for_xml): Likewise.
(_gpgme_progress_status_handler): Change first arg to void *.
* progress.c (_gpgme_progress_status_handler): Likewise.
* conversion.c: Do not include <string.h>, <errno.h>, <ctype.h>,
and <sys/types.h>, but <string.h>.
(_gpgme_data_append): Remove function.
(_gpgme_data_append_string): Likewise.
(_gpgme_data_append_for_xml): Likewise.
(_gpgme_data_append_string_for_xml): Likewise.
(_gpgme_data_append_percentstring_for_xml): Likewise.
* data-mem.c (_gpgme_data_get_as_string): Likewise.
(_gpgme_data_release_and_return_string): Likewise.
* gpgme.c (gpgme_get_op_info): Likewise.
(_gpgme_set_op_info): Likewise.
tests/
2003-04-30 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-eventloop.c (main): Do not call print_op_info.
(print_op_info): Function removed.
2003-04-30 03:34:30 +00:00
|
|
|
|
#include <string.h>
|
2010-11-03 09:56:27 +00:00
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
|
/* Solaris 8 needs sys/types.h before time.h. */
|
|
|
|
|
# include <sys/types.h>
|
|
|
|
|
#endif
|
2003-11-19 15:15:21 +00:00
|
|
|
|
#include <time.h>
|
2003-06-05 23:20:29 +00:00
|
|
|
|
#include <errno.h>
|
2016-09-22 10:41:55 +00:00
|
|
|
|
#include <stdarg.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
|
|
|
|
|
2002-09-01 22:23:56 +00:00
|
|
|
|
#include "gpgme.h"
|
|
|
|
|
#include "util.h"
|
2007-07-17 Marcus Brinkmann <marcus@g10code.de>
* debug.c:;5B Include <errno.h> and "debug.h".
(_gpgme_debug): Save and restore ERRNO.
(TOHEX): New macro.
(_gpgme_debug_buffer): New function.
* conversion.c, data-compat.c, data-mem.c, data.c, engine-gpgsm.c,
gpgme.c, keylist.c, posix-io.c, rungpg.c, sign.c, version.c,
w32-io.c, wait.c: Replace DEBUG macros by TRACE_* variants. In
most of these files, add many more tracepoints.
2007-07-17 12:36:04 +00:00
|
|
|
|
#include "debug.h"
|
2003-11-19 15:15:21 +00:00
|
|
|
|
|
|
|
|
|
#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))
|
|
|
|
|
|
|
|
|
|
|
2016-09-22 10:41:55 +00:00
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
do_strconcat (const char *s1, va_list arg_ptr)
|
|
|
|
|
{
|
|
|
|
|
const char *argv[16];
|
|
|
|
|
size_t argc;
|
|
|
|
|
size_t needed;
|
|
|
|
|
char *buffer, *p;
|
|
|
|
|
|
|
|
|
|
argc = 0;
|
|
|
|
|
argv[argc++] = s1;
|
|
|
|
|
needed = strlen (s1);
|
|
|
|
|
while (((argv[argc] = va_arg (arg_ptr, const char *))))
|
|
|
|
|
{
|
|
|
|
|
needed += strlen (argv[argc]);
|
|
|
|
|
if (argc >= DIM (argv)-1)
|
|
|
|
|
{
|
|
|
|
|
gpg_err_set_errno (EINVAL);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
argc++;
|
|
|
|
|
}
|
|
|
|
|
needed++;
|
|
|
|
|
buffer = malloc (needed);
|
|
|
|
|
if (buffer)
|
|
|
|
|
{
|
|
|
|
|
for (p = buffer, argc=0; argv[argc]; argc++)
|
|
|
|
|
p = stpcpy (p, argv[argc]);
|
|
|
|
|
}
|
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Concatenate the string S1 with all the following strings up to a
|
|
|
|
|
* NULL. Returns a malloced buffer with the new string or NULL on a
|
|
|
|
|
malloc error or if too many arguments are given. */
|
|
|
|
|
char *
|
|
|
|
|
_gpgme_strconcat (const char *s1, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list arg_ptr;
|
|
|
|
|
char *result;
|
|
|
|
|
|
|
|
|
|
if (!s1)
|
|
|
|
|
result = strdup ("");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
va_start (arg_ptr, s1);
|
|
|
|
|
result = do_strconcat (s1, arg_ptr);
|
|
|
|
|
va_end (arg_ptr);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-01-29 19:50:43 +00:00
|
|
|
|
|
|
|
|
|
/* Convert two hexadecimal digits from STR to the value they
|
|
|
|
|
represent. Returns -1 if one of the characters is not a
|
|
|
|
|
hexadecimal digit. */
|
2002-09-01 22:23:56 +00:00
|
|
|
|
int
|
2003-10-06 13:24:13 +00:00
|
|
|
|
_gpgme_hextobyte (const char *str)
|
2002-09-01 22:23:56 +00:00
|
|
|
|
{
|
|
|
|
|
int val = 0;
|
|
|
|
|
int i;
|
|
|
|
|
|
2002-09-28 20:08:01 +00:00
|
|
|
|
#define NROFHEXDIGITS 2
|
|
|
|
|
for (i = 0; i < NROFHEXDIGITS; i++)
|
2002-09-01 22:23:56 +00:00
|
|
|
|
{
|
|
|
|
|
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;
|
2002-09-28 20:08:01 +00:00
|
|
|
|
if (i < NROFHEXDIGITS - 1)
|
|
|
|
|
val *= 16;
|
2002-09-01 22:23:56 +00:00
|
|
|
|
str++;
|
|
|
|
|
}
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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 20:45:24 +00:00
|
|
|
|
gpgme_error_t
|
2003-07-31 15:44:02 +00:00
|
|
|
|
_gpgme_decode_c_string (const char *src, char **destp, size_t len)
|
2002-09-01 22:23:56 +00:00
|
|
|
|
{
|
|
|
|
|
char *dest;
|
|
|
|
|
|
2003-01-29 19:50:43 +00:00
|
|
|
|
/* Set up the destination buffer. */
|
2002-12-04 16:28:34 +00:00
|
|
|
|
if (len)
|
2003-01-29 19:50:43 +00:00
|
|
|
|
{
|
|
|
|
|
if (len < strlen (src) + 1)
|
2003-06-05 23:20:29 +00:00
|
|
|
|
return gpg_error (GPG_ERR_INTERNAL);
|
2003-01-29 19:50:43 +00:00
|
|
|
|
|
|
|
|
|
dest = *destp;
|
|
|
|
|
}
|
2002-12-04 16:28:34 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2003-01-29 19:50:43 +00:00
|
|
|
|
/* The converted string will never be larger than the original
|
|
|
|
|
string. */
|
2002-12-04 16:28:34 +00:00
|
|
|
|
dest = malloc (strlen (src) + 1);
|
|
|
|
|
if (!dest)
|
2010-05-06 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Require libgpg-error 1.8.
src/
2010-05-06 Marcus Brinkmann <marcus@g10code.de>
* sign.c, data-user.c, conversion.c, debug.c, verify.c, data.c,
decrypt.c, delete.c, assuan-support.c, import.c, engine-gpgsm.c,
data-mem.c, op-support.c, w32-io.c, w32-util.c, data-compat.c: Use
gpg_error_from_syserror instead gpg_error_from_errno, and use
gpg_err_set_errno to set error number.
* setenv.c: Include <gpg-error.h> and define __set_errno to use
gpg_err_set_errno.
* gpgme-tool.c (ARGP_ERR_UNKNOWN): Define to EDEADLOCK (which is
mapped in Windows CE) instead of E2BIG (which is not).
(gt_import_keys): Initialize err.
2010-05-06 13:39:55 +00:00
|
|
|
|
return gpg_error_from_syserror ();
|
2002-09-01 22:23:56 +00:00
|
|
|
|
|
2002-12-04 16:28:34 +00:00
|
|
|
|
*destp = dest;
|
|
|
|
|
}
|
2002-09-01 23:29:55 +00:00
|
|
|
|
|
2003-01-29 19:50:43 +00:00
|
|
|
|
/* Convert the string. */
|
2002-09-01 22:23:56 +00:00
|
|
|
|
while (*src)
|
|
|
|
|
{
|
|
|
|
|
if (*src != '\\')
|
|
|
|
|
{
|
|
|
|
|
*(dest++) = *(src++);
|
2003-01-29 19:50:43 +00:00
|
|
|
|
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';
|
2003-01-29 19:50:43 +00:00
|
|
|
|
}
|
2012-04-30 15:42:53 +00:00
|
|
|
|
else
|
2003-01-29 19:50:43 +00:00
|
|
|
|
*((unsigned char *) dest++) = val;
|
|
|
|
|
src += 4;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-05-26 19:43:40 +00:00
|
|
|
|
break;
|
2003-01-29 19:50:43 +00:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
/* Should not happen. */
|
|
|
|
|
*(dest++) = *(src++);
|
|
|
|
|
*(dest++) = *(src++);
|
|
|
|
|
}
|
2012-04-30 15:42:53 +00:00
|
|
|
|
}
|
2002-09-01 22:23:56 +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
|
|
|
|
|
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
|
2005-10-02 14:39:31 +00:00
|
|
|
|
is large enough if LEN is not zero. If BINARY is 1, then '\0'
|
|
|
|
|
characters are allowed in the output. */
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_error_t
|
2005-10-02 14:39:31 +00:00
|
|
|
|
_gpgme_decode_percent_string (const char *src, char **destp, size_t len,
|
|
|
|
|
int binary)
|
2003-04-28 23:59:03 +00:00
|
|
|
|
{
|
|
|
|
|
char *dest;
|
|
|
|
|
|
|
|
|
|
/* Set up the destination buffer. */
|
|
|
|
|
if (len)
|
|
|
|
|
{
|
|
|
|
|
if (len < strlen (src) + 1)
|
2003-06-05 23:20:29 +00:00
|
|
|
|
return gpg_error (GPG_ERR_INTERNAL);
|
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)
|
2010-05-06 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Require libgpg-error 1.8.
src/
2010-05-06 Marcus Brinkmann <marcus@g10code.de>
* sign.c, data-user.c, conversion.c, debug.c, verify.c, data.c,
decrypt.c, delete.c, assuan-support.c, import.c, engine-gpgsm.c,
data-mem.c, op-support.c, w32-io.c, w32-util.c, data-compat.c: Use
gpg_error_from_syserror instead gpg_error_from_errno, and use
gpg_err_set_errno to set error number.
* setenv.c: Include <gpg-error.h> and define __set_errno to use
gpg_err_set_errno.
* gpgme-tool.c (ARGP_ERR_UNKNOWN): Define to EDEADLOCK (which is
mapped in Windows CE) instead of E2BIG (which is not).
(gt_import_keys): Initialize err.
2010-05-06 13:39:55 +00:00
|
|
|
|
return gpg_error_from_syserror ();
|
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
|
|
|
|
|
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
|
|
|
|
|
{
|
2005-10-02 14:39:31 +00:00
|
|
|
|
if (!val && !binary)
|
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';
|
2003-04-28 23:59:03 +00:00
|
|
|
|
}
|
2012-04-30 15:42:53 +00:00
|
|
|
|
else
|
2003-04-28 23:59:03 +00:00
|
|
|
|
*((unsigned char *) dest++) = val;
|
|
|
|
|
src += 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*(dest++) = 0;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-19 15:15:21 +00:00
|
|
|
|
|
2009-10-22 16:44:07 +00:00
|
|
|
|
/* 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 == '%'
|
2009-10-22 16:44:07 +00:00
|
|
|
|
|| *(const unsigned char *)str <= 0x20)
|
|
|
|
|
destlen += 3;
|
|
|
|
|
else
|
|
|
|
|
destlen++;
|
2009-10-30 14:21:08 +00:00
|
|
|
|
str++;
|
2009-10-22 16:44:07 +00:00
|
|
|
|
}
|
|
|
|
|
/* Terminating nul byte. */
|
|
|
|
|
destlen++;
|
|
|
|
|
|
|
|
|
|
/* Set up the destination buffer. */
|
|
|
|
|
if (len)
|
|
|
|
|
{
|
2012-11-15 10:14:58 +00:00
|
|
|
|
if (len < destlen)
|
2009-10-22 16:44:07 +00:00
|
|
|
|
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)
|
2010-05-06 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Require libgpg-error 1.8.
src/
2010-05-06 Marcus Brinkmann <marcus@g10code.de>
* sign.c, data-user.c, conversion.c, debug.c, verify.c, data.c,
decrypt.c, delete.c, assuan-support.c, import.c, engine-gpgsm.c,
data-mem.c, op-support.c, w32-io.c, w32-util.c, data-compat.c: Use
gpg_error_from_syserror instead gpg_error_from_errno, and use
gpg_err_set_errno to set error number.
* setenv.c: Include <gpg-error.h> and define __set_errno to use
gpg_err_set_errno.
* gpgme-tool.c (ARGP_ERR_UNKNOWN): Define to EDEADLOCK (which is
mapped in Windows CE) instead of E2BIG (which is not).
(gt_import_keys): Initialize err.
2010-05-06 13:39:55 +00:00
|
|
|
|
return gpg_error_from_syserror ();
|
2009-10-22 16:44:07 +00:00
|
|
|
|
|
|
|
|
|
*destp = dest;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Convert the string. */
|
|
|
|
|
while (*src)
|
|
|
|
|
{
|
2012-04-30 15:42:53 +00:00
|
|
|
|
if (*src == '+' || *src == '\"' || *src == '%'
|
2009-10-22 16:44:07 +00:00
|
|
|
|
|| *(const unsigned char *)src <= 0x20)
|
|
|
|
|
{
|
|
|
|
|
snprintf (dest, 4, "%%%02X", *(unsigned char *)src);
|
|
|
|
|
dest += 3;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
*(dest++) = *src;
|
|
|
|
|
src++;
|
|
|
|
|
}
|
|
|
|
|
*(dest++) = 0;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-05-21 08:21:06 +00:00
|
|
|
|
/* Split a string into space delimited fields and remove leading and
|
2017-07-12 13:59:12 +00:00
|
|
|
|
* trailing spaces from each field. A pointer to each field is
|
2016-05-21 08:21:06 +00:00
|
|
|
|
* stored in ARRAY. Stop splitting at ARRAYSIZE fields. The function
|
|
|
|
|
* modifies STRING. The number of parsed fields is returned.
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
_gpgme_split_fields (char *string, char **array, int arraysize)
|
|
|
|
|
{
|
|
|
|
|
int n = 0;
|
|
|
|
|
char *p, *pend;
|
|
|
|
|
|
|
|
|
|
for (p = string; *p == ' '; p++)
|
|
|
|
|
;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (n == arraysize)
|
|
|
|
|
break;
|
|
|
|
|
array[n++] = p;
|
|
|
|
|
pend = strchr (p, ' ');
|
|
|
|
|
if (!pend)
|
|
|
|
|
break;
|
|
|
|
|
*pend++ = 0;
|
|
|
|
|
for (p = pend; *p == ' '; p++)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
while (*p);
|
|
|
|
|
|
|
|
|
|
return n;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Convert the field STRING into an unsigned long value. Check for
|
|
|
|
|
* trailing garbage. */
|
|
|
|
|
gpgme_error_t
|
|
|
|
|
_gpgme_strtoul_field (const char *string, unsigned long *result)
|
|
|
|
|
{
|
|
|
|
|
char *endp;
|
|
|
|
|
|
|
|
|
|
gpg_err_set_errno (0);
|
|
|
|
|
*result = strtoul (string, &endp, 0);
|
|
|
|
|
if (errno)
|
|
|
|
|
return gpg_error_from_syserror ();
|
|
|
|
|
if (endp == string || *endp)
|
|
|
|
|
return gpg_error (GPG_ERR_INV_VALUE);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-08-12 13:21:16 +00:00
|
|
|
|
/* Convert STRING into an offset value. Note that this functions only
|
|
|
|
|
* allows for a base-10 length. This function is similar to atoi()
|
|
|
|
|
* and thus there is no error checking. */
|
|
|
|
|
gpgme_off_t
|
|
|
|
|
_gpgme_string_to_off (const char *string)
|
|
|
|
|
{
|
|
|
|
|
gpgme_off_t value = 0;
|
|
|
|
|
|
|
|
|
|
while (*string == ' ' || *string == '\t')
|
|
|
|
|
string++;
|
|
|
|
|
for (; *string >= '0' && *string <= '9'; string++)
|
|
|
|
|
{
|
|
|
|
|
value *= 10;
|
|
|
|
|
value += atoi_1 (string);
|
|
|
|
|
}
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2010-05-12 18:20:36 +00:00
|
|
|
|
#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
|
|
|
|
|
2010-05-12 18:20:36 +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
|
|
|
|
|
2010-05-12 18:20:36 +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
|
|
|
|
|
|
|
|
|
|
|
2003-11-19 15:15:21 +00:00
|
|
|
|
/* 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);
|
|
|
|
|
|
2012-04-30 15:46:15 +00:00
|
|
|
|
if (endp)
|
|
|
|
|
*endp = (char*)(timestamp + 15);
|
|
|
|
|
|
2003-11-19 15:15:21 +00:00
|
|
|
|
/* 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;
|
2003-11-19 15:15:21 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2010-05-12 18:20:36 +00:00
|
|
|
|
#ifdef HAVE_W32_SYSTEM
|
|
|
|
|
return _gpgme_timegm (&buf);
|
|
|
|
|
#else
|
2003-11-19 15:15:21 +00:00
|
|
|
|
#ifdef HAVE_TIMEGM
|
|
|
|
|
return timegm (&buf);
|
|
|
|
|
#else
|
|
|
|
|
{
|
|
|
|
|
time_t tim;
|
2012-04-30 15:42:53 +00:00
|
|
|
|
|
2003-11-19 15:15:21 +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 */
|
2010-05-12 18:20:36 +00:00
|
|
|
|
#endif /* !HAVE_W32_SYSTEM */
|
2003-11-19 15:15:21 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return (time_t)strtoul (timestamp, endp, 10);
|
|
|
|
|
}
|
2014-05-08 12:03:14 +00:00
|
|
|
|
|
|
|
|
|
|
2017-03-28 09:40:44 +00:00
|
|
|
|
/* This function is similar to _gpgme_parse_timestamp but returns an
|
|
|
|
|
* unsigned long and 0 on error. */
|
|
|
|
|
unsigned long
|
|
|
|
|
_gpgme_parse_timestamp_ul (const char *timestamp)
|
|
|
|
|
{
|
|
|
|
|
time_t tim;
|
|
|
|
|
char *tail;
|
|
|
|
|
|
|
|
|
|
if (!*timestamp)
|
|
|
|
|
return 0; /* Shortcut empty strings. */
|
|
|
|
|
|
|
|
|
|
tim = _gpgme_parse_timestamp (timestamp, &tail);
|
|
|
|
|
if (tim == -1 || timestamp == tail || (*tail && *tail != ' '))
|
|
|
|
|
tim = 0; /* No time given or invalid engine. */
|
|
|
|
|
|
|
|
|
|
return (unsigned long)tim;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-05-08 12:03:14 +00:00
|
|
|
|
/* 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;
|
2015-08-30 17:04:44 +00:00
|
|
|
|
case 22: algo = GPGME_PK_EDDSA; break;
|
2014-05-08 12:03:14 +00:00
|
|
|
|
default: algo = 0; break; /* Unknown. */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return algo;
|
|
|
|
|
}
|