+2013-05-28 Werner Koch <wk@gnupg.org>
+
+ Release 1.4.2.
+ * configure.ac: Set LT version to C21/A10/R0.
+
+ Add convenience macro GPGME_PROTOCOL_OPENPGP.
+ * src/gpgme.h.in (GPGME_PROTOCOL_OPENPGP): New.
+
+2013-05-23 Werner Koch <wk@gnupg.org>
+
+ w32: Fix installing of .def file.
+ * src/Makefile.am (install-def-file): Create libdir first.
+
+ Fix libtool 2.4.2 to correctly detect .def files.
+ * build-aux/ltmain.sh (sed_uncomment_deffile): New.
+ (orig_export_symbols): Uncomment def file before testing for EXPORTS.
+ * m4/libtool.m4: Do the same for the generated code.
+
+2013-05-22 Werner Koch <wk@gnupg.org>
+
+ Support --no-encrypt-to also with gpgme_op_encrypt_sign.
+ * src/engine-gpg.c (gpg_encrypt_sign): Support the
+ GPGME_ENCRYPT_NO_ENCRYPT_TO flag.
+
+2013-05-22 Werner Koch <wk@gnupg.org>
+ Kyle L. Huff <g10bts@curetheitch.com>
+
+ Allow symmetric encryption with gpgme_op_encrypt_sign.
+ * src/encrypt-sign.c (encrypt_sym_status_handler): New.
+ (encrypt_sign_start): Handle recp == NULL case.
+ * src/engine-gpg.c (gpg_encrypt_sign): Implement symmetric encryption.
+ * tests/gpg/t-encrypt-sign.c (main): Add a test case for this.
+
+2013-05-22 Werner Koch <wk@gnupg.org>
+
+ gpgme-tool: Allow for symmetric encryption.
+ * src/gpgme-tool.c (gt_sign_encrypt): Pass NULL for recp if no
+ recipients are given.
+
+ tests: Print auditlog in plain text format.
+ * tests/gpgsm/t-verify.c (show_auditlog): Use plain text format.
+
+2013-05-18 Werner Koch <wk@gnupg.org>
+
+ Improve C++ compatibility of previous patch.
+ * src/gpgme.h.in: Move gpgme_sssize_t and gpgme_off_t typedefs into
+ the extern "C" scope.
+
+2013-05-16 Werner Koch <wk@gnupg.org>
+
+ Make definition of off_t robust against misbehaving w32 toolchains.
+ * configure.ac (NEED__FILE_OFFSET_BITS): Change to define gpgme_off_t
+ and gpgme_ssize_t.
+ (API__OFF_T, API__SSIZE_T): New ac_subst.
+ * src/gpgme.h.in: Replace all ssize_t and off_t by ac_subst macros.
+ * src/assuan-support.c, src/ath-pthread.c, src/ath.c, src/ath.h
+ * src/data-compat.c, src/data-fd.c, src/data-mem.c, src/data-stream.c
+ * src/data-user.c, src/data.c, src/data.h, src/engine-gpgsm.c
+ * src/engine-uiserver.c, src/gpgme-tool.c, src/gpgme.c: Replace off_t
+ by gpgme_off_t and sszie_t by gpgme_ssize_t.
+ * src/ath-pthread.c, src/ath.h: Include gpgme.h.
+
+2013-05-11 Werner Koch <wk@gnupg.org>
+
+ w32: Change the way the I/O threads are cleaned up.
+ * src/w32-io.c (reader_context_s, create_reader)
+ (writer_context_s, create_writer): Rename STOPPED to CLOSE_EV.
+ (reader, writer): Remove setting of STOPPED. Wait for CLOSE_EV and
+ then release the context.
+ (destroy_reader, destroy_writer): Do not wait but set the CLOSE_EV.
+ (kill_reader, kill_writer): Remove.
+ (_gpgme_io_close): Add code from kill_reader and kill_writer.
+
+2013-05-08 Werner Koch <wk@gnupg.org>
+
+ Fix hang in socket closing.
+ * src/w32-io.c (destroy_reader): Call shutdown.
+ (reader): Do not print an error in the shutdown case.
+
+ Improve debug output of the I/O reader and writer.
+ * src/w32-io.c (reader, writer): Also print file_sock.
+
+2013-05-06 Werner Koch <wk@gnupg.org>
+
+ Simplify a debug code function.
+ * src/debug.c (_gpgme_debug): Remove static space string.
+
2013-05-01 Werner Koch <wk@gnupg.org>
Release 1.4.1.
+Noteworthy changes in version 1.4.2 (2013-05-28)
+------------------------------------------------
+
+ * Allow symmetric encryption with gpgme_op_encrypt_sign.
+
+ * Fixed mismatching off_t definitions on Windows.
+
+ * Interface changes relative to the 1.4.1 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ gpgme_off_t NEW.
+ gpgme_size_t NEW.
+ GPGME_PROTOCOL_OPENPGP NEW alias.
+
+
Noteworthy changes in version 1.4.1 (2013-05-01)
------------------------------------------------
gpgme_trust_item_get_string_attr DEPRECATED
gpgme_trust_item_get_ulong_attr DEPRECATED
gpgme_get_key CHANGED: Removed force_update argument.
-gpgme_sub_key_t NEW
+gpgme_subkey_t NEW
gpgme_key_sig_t NEW
gpgme_user_id_t NEW
gpgme_key_t CHANGED: Now has user accessible data members.
specify the location with the --with-gpgsm=/path/to/gpgsm argument to
configure.
+On some platforms GPGME based applications might hang at certain
+operations when using GPGME_PROTOCOL_CMS. A workaround for this
+problem is to build with the configure option --disable-fd-passing.
+
For building the GIT version of GPGME please see the file README.GIT
for more information.
# (escaped) backslashes. A very naive implementation.
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+# Sed substitution to remove simple comments and empty
+# lines from a Windows .def file.
+sed_uncomment_deffile='/^;/d; /^[ ]*$/d'
+
# Re-`\' parameter expansions in output of double_quote_subst that were
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
# in input to double_quote_subst, that '$' was protected from expansion.
cygwin* | mingw* | cegcc*)
if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
# exporting using user supplied symfile
- if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+ if test "x`$SED "$sed_uncomment_deffile" $export_symbols | $SED 1q`" != xEXPORTS; then
# and it's NOT already a .def file. Must figure out
# which of the given symbols are data symbols and tag
# them as such. So, trigger use of export_symbols_cmds.
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gpgme 1.4.1.
+# Generated by GNU Autoconf 2.69 for gpgme 1.4.2.
#
# Report bugs to <http://bugs.gnupg.org>.
#
# Identity of this package.
PACKAGE_NAME='gpgme'
PACKAGE_TARNAME='gpgme'
-PACKAGE_VERSION='1.4.1'
-PACKAGE_STRING='gpgme 1.4.1'
+PACKAGE_VERSION='1.4.2'
+PACKAGE_STRING='gpgme 1.4.2'
PACKAGE_BUGREPORT='http://bugs.gnupg.org'
PACKAGE_URL=''
GPG_ERROR_CONFIG
GLIBC21
LIBOBJS
+API__SSIZE_T
+API__OFF_T
INSERT__TYPEDEFS_FOR_GPGME_H
NEED__FILE_OFFSET_BITS
BUILD_TIMESTAMP
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gpgme 1.4.1 to adapt to many kinds of systems.
+\`configure' configures gpgme 1.4.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gpgme 1.4.1:";;
+ short | recursive ) echo "Configuration of gpgme 1.4.2:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gpgme configure 1.4.1
+gpgme configure 1.4.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gpgme $as_me 1.4.1, which was
+It was created by gpgme $as_me 1.4.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBGPGME_LT_CURRENT=20
+LIBGPGME_LT_CURRENT=21
# Subtract 2 from this value if you want to make the LFS transition an
# ABI break. [Note to self: Remove this comment with the next regular break.]
-LIBGPGME_LT_AGE=9
-LIBGPGME_LT_REVISION=1
+LIBGPGME_LT_AGE=10
+LIBGPGME_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
GPGME_CONFIG_API_VERSION=1
# Define the identity of the package.
PACKAGE='gpgme'
- VERSION='1.4.1'
+ VERSION='1.4.2'
cat >>confdefs.h <<_ACEOF
#define VERSION "$VERSION"
_ACEOF
-VERSION_NUMBER=0x010401
+VERSION_NUMBER=0x010402
# Don't default to build static libs.
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is; otherwise, prepend...
- archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ archive_expsym_cmds='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
shrext_cmds=".dll"
# FIXME: Setting linknames here is a bad hack.
archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
- archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ archive_expsym_cmds='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
else
sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
shrext_cmds=".dll"
# FIXME: Setting linknames here is a bad hack.
archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
- archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ archive_expsym_cmds_CXX='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
$SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
else
$SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is; otherwise, prepend...
- archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ archive_expsym_cmds_CXX='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
#
# Provide information about the build.
#
-BUILD_REVISION="5075c0d"
+BUILD_REVISION="009e26a"
cat >>confdefs.h <<_ACEOF
BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
-BUILD_FILEVERSION="${BUILD_FILEVERSION}20597"
+BUILD_FILEVERSION="${BUILD_FILEVERSION}158"
BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
# Figure out platform dependent typedefs for gpgme.h
if test "$have_w32_system" = yes; then
- if test "$have_w64_system" = yes; then
- INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 64 bit W32 API. */
-#include <basetsd.h>
-typedef long off_t;
-typedef __int64 ssize_t;"
- else
- INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 32 bit W32 API. */
-#ifndef _OFF_T_DEFINED /* Defined by newer mingw32 toolkits. */
-typedef long off_t;
-#endif
-#ifndef _SSIZE_T_DEFINED /* Defined by newer mingw32 toolkits. */
-typedef long ssize_t;
-#endif"
- fi
-else
- INSERT__TYPEDEFS_FOR_GPGME_H="#include <sys/types.h>"
+ INSERT__TYPEDEFS_FOR_GPGME_H="
+#ifdef _WIN64
+# include <stdint.h>
+ typedef int64_t gpgme_off_t;
+ typedef int64_t gpgme_ssize_t;
+#else /* _WIN32 */
+ typedef long gpgme_off_t;
+ typedef long gpgme_ssize_t;
+#endif /* _WIN32 */"
+ API__OFF_T="gpgme_off_t"
+ API__SSIZE_T="gpgme_ssize_t"
+else
+ INSERT__TYPEDEFS_FOR_GPGME_H="
+#include <sys/types.h>
+typedef off_t gpgme_off_t;
+typedef ssize_t gpgme_ssize_t;"
+ API__OFF_T="off_t"
+ API__SSIZE_T="ssize_t"
fi
+
+
+
+
# Checks for compiler features.
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by gpgme $as_me 1.4.1, which was
+This file was extended by gpgme $as_me 1.4.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-gpgme config.status 1.4.1
+gpgme config.status 1.4.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
echo "
GPGME v${VERSION} has been configured as follows:
- Revision: 5075c0d (20597)
+ Revision: 009e26a (158)
Platform: $host
GnuPG path: $GPG
# for the LT versions.
m4_define(mym4_version_major, [1])
m4_define(mym4_version_minor, [4])
-m4_define(mym4_version_micro, [1])
+m4_define(mym4_version_micro, [2])
# Below is m4 magic to extract and compute the revision number, the
# decimalized short revision number, a beta version string, and a flag
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBGPGME_LT_CURRENT=20
+LIBGPGME_LT_CURRENT=21
# Subtract 2 from this value if you want to make the LFS transition an
# ABI break. [Note to self: Remove this comment with the next regular break.]
-LIBGPGME_LT_AGE=9
-LIBGPGME_LT_REVISION=1
+LIBGPGME_LT_AGE=10
+LIBGPGME_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
GPGME_CONFIG_API_VERSION=1
# Figure out platform dependent typedefs for gpgme.h
if test "$have_w32_system" = yes; then
- if test "$have_w64_system" = yes; then
- INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 64 bit W32 API. */
-#include <basetsd.h>
-typedef long off_t;
-typedef __int64 ssize_t;"
- else
- INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 32 bit W32 API. */
-#ifndef _OFF_T_DEFINED /* Defined by newer mingw32 toolkits. */
-typedef long off_t;
-#endif
-#ifndef _SSIZE_T_DEFINED /* Defined by newer mingw32 toolkits. */
-typedef long ssize_t;
-#endif"
- fi
+ INSERT__TYPEDEFS_FOR_GPGME_H="
+#ifdef _WIN64
+# include <stdint.h>
+ typedef int64_t gpgme_off_t;
+ typedef int64_t gpgme_ssize_t;
+#else /* _WIN32 */
+ typedef long gpgme_off_t;
+ typedef long gpgme_ssize_t;
+#endif /* _WIN32 */"
+ API__OFF_T="gpgme_off_t"
+ API__SSIZE_T="gpgme_ssize_t"
else
- INSERT__TYPEDEFS_FOR_GPGME_H="#include <sys/types.h>"
+ INSERT__TYPEDEFS_FOR_GPGME_H="
+#include <sys/types.h>
+typedef off_t gpgme_off_t;
+typedef ssize_t gpgme_ssize_t;"
+ API__OFF_T="off_t"
+ API__SSIZE_T="ssize_t"
fi
AC_SUBST(INSERT__TYPEDEFS_FOR_GPGME_H)
AM_SUBST_NOTMAKE(INSERT__TYPEDEFS_FOR_GPGME_H)
+AC_SUBST(API__OFF_T)
+AM_SUBST_NOTMAKE(API__OFF_T)
+AC_SUBST(API__SSIZE_T)
+AM_SUBST_NOTMAKE(API__SSIZE_T)
# Checks for compiler features.
if test "$GCC" = yes; then
This file documents the GPGME library.
- This is Edition 1.4.1, last updated 30 April 2013, of `The `GnuPG
-Made Easy' Reference Manual', for Version 1.4.1.
+ This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
+Easy' Reference Manual', for Version 1.4.2.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
2013 g10 Code GmbH.
\1f
Indirect:
-gpgme.info-1: 1758
-gpgme.info-2: 279278
+gpgme.info-1: 1756
+gpgme.info-2: 281093
\1f
Tag Table:
(Indirect)
-Node: Top\7f1758
-Node: Introduction\7f8599
-Node: Getting Started\7f9386
-Node: Features\7f10511
-Node: Overview\7f11661
-Node: Preparation\7f12770
-Node: Header\7f13767
-Node: Building the Source\7f14466
-Node: Largefile Support (LFS)\7f16575
-Node: Using Automake\7f20579
-Node: Using Libtool\7f22215
-Node: Library Version Check\7f22565
-Node: Signal Handling\7f26520
-Node: Multi Threading\7f27736
-Ref: Multi Threading-Footnote-1\7f29918
-Node: Protocols and Engines\7f30332
-Node: Engine Version Check\7f32681
-Node: Engine Information\7f33258
-Node: Engine Configuration\7f36958
-Node: OpenPGP\7f38220
-Node: Cryptographic Message Syntax\7f38556
-Node: Algorithms\7f38850
-Ref: Algorithms-Footnote-1\7f39329
-Node: Public Key Algorithms\7f39457
-Node: Hash Algorithms\7f41388
-Node: Error Handling\7f42486
-Node: Error Values\7f44348
-Node: Error Sources\7f49426
-Node: Error Codes\7f51753
-Node: Error Strings\7f56392
-Node: Exchanging Data\7f58171
-Node: Creating Data Buffers\7f59485
-Node: Memory Based Data Buffers\7f60001
-Node: File Based Data Buffers\7f63355
-Node: Callback Based Data Buffers\7f65526
-Node: Destroying Data Buffers\7f71082
-Node: Manipulating Data Buffers\7f72441
-Node: Data Buffer I/O Operations\7f72860
-Node: Data Buffer Meta-Data\7f75563
-Node: Contexts\7f78913
-Node: Creating Contexts\7f80036
-Node: Destroying Contexts\7f80847
-Node: Result Management\7f81182
-Node: Context Attributes\7f82588
-Node: Protocol Selection\7f83366
-Node: Crypto Engine\7f84378
-Node: ASCII Armor\7f86199
-Node: Text Mode\7f86811
-Node: Included Certificates\7f87742
-Node: Key Listing Mode\7f89117
-Node: Passphrase Callback\7f92474
-Node: Progress Meter Callback\7f95612
-Node: Locale\7f97536
-Node: Key Management\7f99075
-Node: Listing Keys\7f109003
-Node: Information About Keys\7f116265
-Node: Key Signatures\7f124263
-Node: Manipulating Keys\7f128275
-Node: Generating Keys\7f129117
-Node: Exporting Keys\7f133724
-Node: Importing Keys\7f139623
-Ref: Importing Keys-Footnote-1\7f146786
-Node: Deleting Keys\7f146914
-Node: Changing Passphrases\7f148311
-Node: Advanced Key Editing\7f149572
-Node: Trust Item Management\7f152676
-Node: Listing Trust Items\7f153746
-Node: Information About Trust Items\7f156044
-Node: Manipulating Trust Items\7f157926
-Node: Crypto Operations\7f158887
-Node: Decrypt\7f160131
-Node: Verify\7f163989
-Node: Decrypt and Verify\7f181845
-Node: Sign\7f183849
-Node: Selecting Signers\7f184413
-Node: Creating a Signature\7f185394
-Node: Signature Notation Data\7f189983
-Node: Encrypt\7f192167
-Node: Encrypting a Plaintext\7f192523
-Node: Run Control\7f198368
-Node: Waiting For Completion\7f199115
-Node: Using External Event Loops\7f201161
-Node: I/O Callback Interface\7f203128
-Node: Registering I/O Callbacks\7f208222
-Node: I/O Callback Example\7f210213
-Node: I/O Callback Example GTK+\7f216432
-Node: I/O Callback Example GDK\7f218221
-Node: I/O Callback Example Qt\7f219863
-Node: Cancellation\7f222151
-Node: UI Server Protocol\7f224404
-Ref: UI Server Protocol-Footnote-1\7f225835
-Node: UI Server Encrypt\7f225954
-Node: UI Server Sign\7f231135
-Node: UI Server Decrypt\7f233364
-Node: UI Server Verify\7f234802
-Node: UI Server Set Input Files\7f238304
-Node: UI Server Sign/Encrypt Files\7f239104
-Node: UI Server Verify/Decrypt Files\7f240873
-Node: UI Server Import/Export Keys\7f242719
-Node: UI Server Checksum Files\7f243752
-Node: Miscellaneous UI Server Commands\7f245918
-Ref: command SENDER\7f247830
-Node: Debugging\7f249506
-Node: Library Copying\7f251161
-Node: Copying\7f279278
-Node: Function and Data Index\7f316909
-Node: Concept Index\7f342025
+Node: Top\7f1756
+Node: Introduction\7f8595
+Node: Getting Started\7f9382
+Node: Features\7f10507
+Node: Overview\7f11657
+Node: Preparation\7f12766
+Node: Header\7f13763
+Node: Building the Source\7f14462
+Node: Largefile Support (LFS)\7f16571
+Node: Using Automake\7f21882
+Node: Using Libtool\7f23518
+Node: Library Version Check\7f23868
+Node: Signal Handling\7f27823
+Node: Multi Threading\7f29039
+Ref: Multi Threading-Footnote-1\7f31221
+Node: Protocols and Engines\7f31635
+Node: Engine Version Check\7f33984
+Node: Engine Information\7f34561
+Node: Engine Configuration\7f38261
+Node: OpenPGP\7f39523
+Node: Cryptographic Message Syntax\7f39859
+Node: Algorithms\7f40153
+Ref: Algorithms-Footnote-1\7f40632
+Node: Public Key Algorithms\7f40760
+Node: Hash Algorithms\7f42691
+Node: Error Handling\7f43789
+Node: Error Values\7f45651
+Node: Error Sources\7f50729
+Node: Error Codes\7f53056
+Node: Error Strings\7f57695
+Node: Exchanging Data\7f59474
+Node: Creating Data Buffers\7f61303
+Node: Memory Based Data Buffers\7f61819
+Node: File Based Data Buffers\7f65173
+Node: Callback Based Data Buffers\7f67344
+Node: Destroying Data Buffers\7f72900
+Node: Manipulating Data Buffers\7f74259
+Node: Data Buffer I/O Operations\7f74678
+Node: Data Buffer Meta-Data\7f77381
+Node: Contexts\7f80731
+Node: Creating Contexts\7f81854
+Node: Destroying Contexts\7f82665
+Node: Result Management\7f83000
+Node: Context Attributes\7f84406
+Node: Protocol Selection\7f85184
+Node: Crypto Engine\7f86196
+Node: ASCII Armor\7f88017
+Node: Text Mode\7f88629
+Node: Included Certificates\7f89560
+Node: Key Listing Mode\7f90935
+Node: Passphrase Callback\7f94292
+Node: Progress Meter Callback\7f97430
+Node: Locale\7f99354
+Node: Key Management\7f100893
+Node: Listing Keys\7f110818
+Node: Information About Keys\7f118080
+Node: Key Signatures\7f126078
+Node: Manipulating Keys\7f130090
+Node: Generating Keys\7f130932
+Node: Exporting Keys\7f135539
+Node: Importing Keys\7f141438
+Ref: Importing Keys-Footnote-1\7f148601
+Node: Deleting Keys\7f148729
+Node: Changing Passphrases\7f150126
+Node: Advanced Key Editing\7f151387
+Node: Trust Item Management\7f154491
+Node: Listing Trust Items\7f155561
+Node: Information About Trust Items\7f157859
+Node: Manipulating Trust Items\7f159741
+Node: Crypto Operations\7f160702
+Node: Decrypt\7f161946
+Node: Verify\7f165804
+Node: Decrypt and Verify\7f183660
+Node: Sign\7f185664
+Node: Selecting Signers\7f186228
+Node: Creating a Signature\7f187209
+Node: Signature Notation Data\7f191798
+Node: Encrypt\7f193982
+Node: Encrypting a Plaintext\7f194338
+Node: Run Control\7f200183
+Node: Waiting For Completion\7f200930
+Node: Using External Event Loops\7f202976
+Node: I/O Callback Interface\7f204943
+Node: Registering I/O Callbacks\7f210037
+Node: I/O Callback Example\7f212028
+Node: I/O Callback Example GTK+\7f218247
+Node: I/O Callback Example GDK\7f220036
+Node: I/O Callback Example Qt\7f221678
+Node: Cancellation\7f223966
+Node: UI Server Protocol\7f226219
+Ref: UI Server Protocol-Footnote-1\7f227650
+Node: UI Server Encrypt\7f227769
+Node: UI Server Sign\7f232950
+Node: UI Server Decrypt\7f235179
+Node: UI Server Verify\7f236617
+Node: UI Server Set Input Files\7f240119
+Node: UI Server Sign/Encrypt Files\7f240919
+Node: UI Server Verify/Decrypt Files\7f242688
+Node: UI Server Import/Export Keys\7f244534
+Node: UI Server Checksum Files\7f245567
+Node: Miscellaneous UI Server Commands\7f247733
+Ref: command SENDER\7f249645
+Node: Debugging\7f251321
+Node: Library Copying\7f252976
+Node: Copying\7f281093
+Node: Function and Data Index\7f318724
+Node: Concept Index\7f343986
\1f
End Tag Table
This file documents the GPGME library.
- This is Edition 1.4.1, last updated 30 April 2013, of `The `GnuPG
-Made Easy' Reference Manual', for Version 1.4.1.
+ This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
+Easy' Reference Manual', for Version 1.4.2.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
2013 g10 Code GmbH.
Main Menu
*********
-This is Edition 1.4.1, last updated 30 April 2013, of `The `GnuPG Made
-Easy' Reference Manual', for Version 1.4.1 of the GPGME library.
+This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
+Easy' Reference Manual', for Version 1.4.2 of the GPGME library.
* Menu:
file sizes or dual mode) can be considered an historic artefact, only
useful to allow for a transitional period.
- GPGME is compiled using largefile support by default. This means
-that your application must do the same, at least as far as it is
-relevant for using the `gpgme.h' header file. All types in this header
-files refer to their largefile counterparts, if they are different from
-any default types on the system.
-
- You can enable largefile support, if it is different from the default
-on the system the application is compiled on, by using the Autoconf
-macro `AC_SYS_LARGEFILE'. If you do this, then you don't need to worry
-about anything else: It will just work. In this case you might also
-want to use `AC_FUNC_FSEEKO' to take advantage of some new interfaces,
-and `AC_TYPE_OFF_T' (just in case).
+ On POSIX platforms GPGME is compiled using largefile support by
+default. This means that your application must do the same, at least
+as far as it is relevant for using the `gpgme.h' header file. All
+types in this header files refer to their largefile counterparts, if
+they are different from any default types on the system.
+
+ On 32 and 64 bit Windows platforms `off_t' is declared as 32 bit
+signed integer. There is no specific support for LFS in the C library.
+The recommendation from Microsoft is to use the native interface
+(`CreateFile' et al.) for large files. Released binary versions of
+GPGME (libgpgme-11.dll) have always been build with a 32 bit `off_t'.
+To avoid an ABI break we stick to this convention for 32 bit Windows by
+using `long' there. GPGME versions for 64 bit Windows have never been
+released and thus we are able to use `int64_t' instead of `off_t'
+there. For easier migration the typedef `gpgme_off_t' has been
+defined. The reason we cannot use `off_t' directly is that some
+toolchains (e.g. mingw64) introduce a POSIX compatible hack for
+`off_t'. Some widely used toolkits make use of this hack and in turn
+GPGME would need to use it also. However, this would introduce an ABI
+break and existing software making use of libgpgme might suffer from a
+severe break. Thus with version 1.4.2 we redefined all functions using
+`off_t' to use `gpgme_off_t' which is defined as explained above. This
+way we keep the ABI well defined and independent of any toolchain
+hacks. The bottom line is that LFS support in GPGME is only available
+on 64 bit versions of Windows.
+
+ On POSIX platforms you can enable largefile support, if it is
+different from the default on the system the application is compiled
+on, by using the Autoconf macro `AC_SYS_LARGEFILE'. If you do this,
+then you don't need to worry about anything else: It will just work.
+In this case you might also want to use `AC_FUNC_FSEEKO' to take
+advantage of some new interfaces, and `AC_TYPE_OFF_T' (just in case).
If you do not use Autoconf, you can define the preprocessor symbol
`_FILE_OFFSET_BITS' to 64 _before_ including any header files, for
using memory buffers or files rather than pipes or sockets. This might
be relevant, for example, if the external event loop mechanism is used.
+ -- Data type: gpgme_off_t
+ On POSIX platforms the `gpgme_off_t' type is an alias for `off_t';
+ it may be used interchangeable. On Windows platforms
+ `gpgme_off_t' is defined as a long (i.e. 32 bit) for 32 bit
+ Windows and as a 64 bit signed integer for 64 bit Windows.
+
+ -- Data type: gpgme_ssize_t
+ The `gpgme_ssize_t' type is an alias for `ssize_t'. It has only
+ been introduced to overcome portability problems pertaining to the
+ declaration of `ssize_t' by different toolchains.
+
* Menu:
* Creating Data Buffers:: Creating new data buffers.
that should be used for the operation. The following section describes
how such keys can be selected and manipulated.
- -- Data type: gpgme_sub_key_t
- The `gpgme_sub_key_t' type is a pointer to a subkey structure.
- Sub keys are one component of a `gpgme_key_t' object. In fact,
+ -- Data type: gpgme_subkey_t
+ The `gpgme_subkey_t' type is a pointer to a subkey structure. Sub
+ keys are one component of a `gpgme_key_t' object. In fact,
subkeys are those parts that contains the real information about
the individual cryptographic keys that belong to the same key
object. One `gpgme_key_t' can contain several subkeys. The first
The subkey structure has the following members:
- `gpgme_sub_key_t next'
+ `gpgme_subkey_t next'
This is a pointer to the next subkey structure in the linked
list, or `NULL' if this is the last element.
If `protocol' is `GPGME_PROTOCOL_OpenPGP', then this is the
owner trust.
- `gpgme_sub_key_t subkeys'
+ `gpgme_subkey_t subkeys'
This is a linked list with the subkeys of the key. The first
subkey in the list is the primary key and usually available.
This file documents the GPGME library.
- This is Edition 1.4.1, last updated 30 April 2013, of `The `GnuPG
-Made Easy' Reference Manual', for Version 1.4.1.
+ This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
+Easy' Reference Manual', for Version 1.4.2.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
2013 g10 Code GmbH.
* gpgme_new: Creating Contexts. (line 7)
* gpgme_new_signature_t: Creating a Signature.
(line 58)
+* gpgme_off_t: Exchanging Data. (line 25)
* gpgme_op_card_edit: Advanced Key Editing.
(line 50)
* gpgme_op_card_edit_start: Advanced Key Editing.
* gpgme_signers_add: Selecting Signers. (line 15)
* gpgme_signers_clear: Selecting Signers. (line 7)
* gpgme_signers_enum: Selecting Signers. (line 22)
+* gpgme_ssize_t: Exchanging Data. (line 31)
* gpgme_strerror: Error Strings. (line 7)
* gpgme_strerror_r: Error Strings. (line 17)
* gpgme_strsource: Error Strings. (line 27)
-* gpgme_sub_key_t: Key Management. (line 12)
+* gpgme_subkey_t: Key Management. (line 12)
* gpgme_trust_item_get_int_attr: Information About Trust Items.
(line 31)
* gpgme_trust_item_get_string_attr: Information About Trust Items.
file sizes or dual mode) can be considered an historic artefact, only
useful to allow for a transitional period.
-@acronym{GPGME} is compiled using largefile support by default. This
-means that your application must do the same, at least as far as it is
-relevant for using the @file{gpgme.h} header file. All types in this
-header files refer to their largefile counterparts, if they are
-different from any default types on the system.
-
-You can enable largefile support, if it is different from the default
-on the system the application is compiled on, by using the Autoconf
-macro @code{AC_SYS_LARGEFILE}. If you do this, then you don't need to
-worry about anything else: It will just work. In this case you might
-also want to use @code{AC_FUNC_FSEEKO} to take advantage of some new
-interfaces, and @code{AC_TYPE_OFF_T} (just in case).
+On POSIX platforms @acronym{GPGME} is compiled using largefile support
+by default. This means that your application must do the same, at
+least as far as it is relevant for using the @file{gpgme.h} header
+file. All types in this header files refer to their largefile
+counterparts, if they are different from any default types on the
+system.
+
+On 32 and 64 bit Windows platforms @code{off_t} is declared as 32 bit
+signed integer. There is no specific support for LFS in the C
+library. The recommendation from Microsoft is to use the native
+interface (@code{CreateFile} et al.) for large files. Released binary
+versions of @acronym{GPGME} (libgpgme-11.dll) have always been build
+with a 32 bit @code{off_t}. To avoid an ABI break we stick to this
+convention for 32 bit Windows by using @code{long} there.
+@acronym{GPGME} versions for 64 bit Windows have never been released
+and thus we are able to use @code{int64_t} instead of @code{off_t}
+there. For easier migration the typedef @code{gpgme_off_t} has been
+defined. The reason we cannot use @code{off_t} directly is that some
+toolchains (e.g. mingw64) introduce a POSIX compatible hack for
+@code{off_t}. Some widely used toolkits make use of this hack and in
+turn @acronym{GPGME} would need to use it also. However, this would
+introduce an ABI break and existing software making use of libgpgme
+might suffer from a severe break. Thus with version 1.4.2 we
+redefined all functions using @code{off_t} to use @code{gpgme_off_t}
+which is defined as explained above. This way we keep the ABI well
+defined and independent of any toolchain hacks. The bottom line is
+that LFS support in @acronym{GPGME} is only available on 64 bit
+versions of Windows.
+
+On POSIX platforms you can enable largefile support, if it is
+different from the default on the system the application is compiled
+on, by using the Autoconf macro @code{AC_SYS_LARGEFILE}. If you do
+this, then you don't need to worry about anything else: It will just
+work. In this case you might also want to use @code{AC_FUNC_FSEEKO}
+to take advantage of some new interfaces, and @code{AC_TYPE_OFF_T}
+(just in case).
If you do not use Autoconf, you can define the preprocessor symbol
@code{_FILE_OFFSET_BITS} to 64 @emph{before} including any header
might be relevant, for example, if the external event loop mechanism
is used.
+@deftp {Data type} {gpgme_off_t}
+On POSIX platforms the @code{gpgme_off_t} type is an alias for
+@code{off_t}; it may be used interchangeable. On Windows platforms
+@code{gpgme_off_t} is defined as a long (i.e. 32 bit) for 32 bit
+Windows and as a 64 bit signed integer for 64 bit Windows.
+@end deftp
+
+@deftp {Data type} {gpgme_ssize_t}
+The @code{gpgme_ssize_t} type is an alias for @code{ssize_t}. It has
+only been introduced to overcome portability problems pertaining to
+the declaration of @code{ssize_t} by different toolchains.
+@end deftp
+
+
@menu
* Creating Data Buffers:: Creating new data buffers.
* Destroying Data Buffers:: Releasing data buffers.
respective keys that should be used for the operation. The following
section describes how such keys can be selected and manipulated.
-@deftp {Data type} gpgme_sub_key_t
-The @code{gpgme_sub_key_t} type is a pointer to a subkey structure.
+@deftp {Data type} gpgme_subkey_t
+The @code{gpgme_subkey_t} type is a pointer to a subkey structure.
Sub keys are one component of a @code{gpgme_key_t} object. In fact,
subkeys are those parts that contains the real information about the
individual cryptographic keys that belong to the same key object. One
The subkey structure has the following members:
@table @code
-@item gpgme_sub_key_t next
+@item gpgme_subkey_t next
This is a pointer to the next subkey structure in the linked list, or
@code{NULL} if this is the last element.
If @code{protocol} is @code{GPGME_PROTOCOL_OpenPGP}, then this is the
owner trust.
-@item gpgme_sub_key_t subkeys
+@item gpgme_subkey_t subkeys
This is a linked list with the subkeys of the key. The first subkey
in the list is the primary key and usually available.
-@set UPDATED 30 April 2013
-@set UPDATED-MONTH April 2013
-@set EDITION 1.4.1
-@set VERSION 1.4.1
+@set UPDATED 28 May 2013
+@set UPDATED-MONTH May 2013
+@set EDITION 1.4.2
+@set VERSION 1.4.2
-@set UPDATED 30 April 2013
-@set UPDATED-MONTH April 2013
-@set EDITION 1.4.1
-@set VERSION 1.4.1
+@set UPDATED 28 May 2013
+@set UPDATED-MONTH May 2013
+@set EDITION 1.4.2
+@set VERSION 1.4.2
# This is a template. The dist target uses it to create the real file.
Summary: GPGME - GnuPG Made Easy
Name: gpgme
-Version: 1.4.1
+Version: 1.4.2
Release: 1
URL: http://www.gnupg.org/gpgme.html
Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz
(defsystem gpgme
:description "GnuPG Made Easy."
:author "g10 Code GmbH"
- :version "1.4.1"
+ :version "1.4.2"
:licence "GPL"
:depends-on ("cffi" "gpg-error")
:components ((:file "gpgme-package")
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is; otherwise, prepend...
- _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
shrext_cmds=".dll"
# FIXME: Setting linknames here is a bad hack.
_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
- _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
else
sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
shrext_cmds=".dll"
# FIXME: Setting linknames here is a bad hack.
_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
- _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
$SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
else
$SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is; otherwise, prepend...
- _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
export_symbols = -export-symbols $(srcdir)/gpgme.def
install-def-file:
+ -$(INSTALL) -d $(DESTDIR)$(libdir)
$(INSTALL) $(srcdir)/gpgme.def $(DESTDIR)$(libdir)/gpgme.def
uninstall-def-file:
@HAVE_W32_SYSTEM_TRUE@ $(LTRCCOMPILE) -i "$<" -o "$@"
@HAVE_W32_SYSTEM_TRUE@install-def-file:
+@HAVE_W32_SYSTEM_TRUE@ -$(INSTALL) -d $(DESTDIR)$(libdir)
@HAVE_W32_SYSTEM_TRUE@ $(INSTALL) $(srcdir)/gpgme.def $(DESTDIR)$(libdir)/gpgme.def
@HAVE_W32_SYSTEM_TRUE@uninstall-def-file:
}
-static ssize_t
+static gpgme_ssize_t
my_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size)
{
return _gpgme_io_read ((int) fd, buffer, size);
}
-static ssize_t
+static gpgme_ssize_t
my_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer, size_t size)
{
return _gpgme_io_write ((int) fd, buffer, size);
#include <pthread.h>
+#include "gpgme.h"
+
#include "ath.h"
}
-ssize_t
+gpgme_ssize_t
ath_read (int fd, void *buf, size_t nbytes)
{
return read (fd, buf, nbytes);
}
-ssize_t
+gpgme_ssize_t
ath_write (int fd, const void *buf, size_t nbytes)
{
return write (fd, buf, nbytes);
}
-ssize_t
+gpgme_ssize_t
ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
struct timeval *timeout)
{
}
-ssize_t
+gpgme_ssize_t
ath_waitpid (pid_t pid, int *status, int options)
{
return waitpid (pid, status, options);
#include <sys/wait.h>
#endif
+#include "gpgme.h"
+
#ifdef _MSC_VER
- typedef long ssize_t;
typedef int pid_t;
#endif
}
-ssize_t
+gpgme_ssize_t
ath_read (int fd, void *buf, size_t nbytes)
{
#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER)
}
-ssize_t
+gpgme_ssize_t
ath_write (int fd, const void *buf, size_t nbytes)
{
#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER)
}
-ssize_t
+gpgme_ssize_t
ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
struct timeval *timeout)
{
}
-ssize_t
+gpgme_ssize_t
ath_waitpid (pid_t pid, int *status, int options)
{
#ifdef HAVE_W32_SYSTEM
/* Replacement for the POSIX functions, which can be used to allow
other (user-level) threads to run. */
-ssize_t ath_read (int fd, void *buf, size_t nbytes);
-ssize_t ath_write (int fd, const void *buf, size_t nbytes);
-ssize_t ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
- struct timeval *timeout);
-ssize_t ath_waitpid (pid_t pid, int *status, int options);
+gpgme_ssize_t ath_read (int fd, void *buf, size_t nbytes);
+gpgme_ssize_t ath_write (int fd, const void *buf, size_t nbytes);
+gpgme_ssize_t ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
+ struct timeval *timeout);
+gpgme_ssize_t ath_waitpid (pid_t pid, int *status, int options);
int ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr);
int ath_connect (int s, const struct sockaddr *addr, socklen_t length);
int ath_sendmsg (int s, const struct msghdr *msg, int flags);
non-zero). */
gpgme_error_t
gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname,
- FILE *stream, off_t offset, size_t length)
+ FILE *stream, gpgme_off_t offset, size_t length)
{
#if defined (HAVE_W32CE_SYSTEM) && defined (_MSC_VER)
return gpgme_error (GPG_ERR_NOT_IMPLEMENTED);
}
-static ssize_t
+static gpgme_ssize_t
old_user_read (gpgme_data_t dh, void *buffer, size_t size)
{
gpgme_error_t err;
}
-static off_t
-old_user_seek (gpgme_data_t dh, off_t offset, int whence)
+static gpgme_off_t
+old_user_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
gpgme_error_t err;
TRACE_BEG2 (DEBUG_DATA, "gpgme:old_user_seek", dh,
\f
-static ssize_t
+static gpgme_ssize_t
fd_read (gpgme_data_t dh, void *buffer, size_t size)
{
return read (dh->data.fd, buffer, size);
}
-static ssize_t
+static gpgme_ssize_t
fd_write (gpgme_data_t dh, const void *buffer, size_t size)
{
return write (dh->data.fd, buffer, size);
}
-static off_t
-fd_seek (gpgme_data_t dh, off_t offset, int whence)
+static gpgme_off_t
+fd_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
return lseek (dh->data.fd, offset, whence);
}
#include "debug.h"
\f
-static ssize_t
+static gpgme_ssize_t
mem_read (gpgme_data_t dh, void *buffer, size_t size)
{
size_t amt = dh->data.mem.length - dh->data.mem.offset;
}
-static ssize_t
+static gpgme_ssize_t
mem_write (gpgme_data_t dh, const void *buffer, size_t size)
{
size_t unused;
}
-static off_t
-mem_seek (gpgme_data_t dh, off_t offset, int whence)
+static gpgme_off_t
+mem_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
switch (whence)
{
#include "data.h"
\f
-static ssize_t
+static gpgme_ssize_t
stream_read (gpgme_data_t dh, void *buffer, size_t size)
{
size_t amt = fread (buffer, 1, size, dh->data.stream);
}
-static ssize_t
+static gpgme_ssize_t
stream_write (gpgme_data_t dh, const void *buffer, size_t size)
{
size_t amt = fwrite (buffer, 1, size, dh->data.stream);
}
-static off_t
-stream_seek (gpgme_data_t dh, off_t offset, int whence)
+static gpgme_off_t
+stream_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
int err;
#include "data.h"
\f
-static ssize_t
+static gpgme_ssize_t
user_read (gpgme_data_t dh, void *buffer, size_t size)
{
if (!dh->data.user.cbs->read)
}
-static ssize_t
+static gpgme_ssize_t
user_write (gpgme_data_t dh, const void *buffer, size_t size)
{
if (!dh->data.user.cbs->write)
}
-static off_t
-user_seek (gpgme_data_t dh, off_t offset, int whence)
+static gpgme_off_t
+user_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
if (!dh->data.user.cbs->seek)
{
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle DH. Return the number of characters read, 0 on EOF and
-1 on error. If an error occurs, errno is set. */
-ssize_t
+gpgme_ssize_t
gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size)
{
- ssize_t res;
+ gpgme_ssize_t res;
TRACE_BEG2 (DEBUG_DATA, "gpgme_data_read", dh,
"buffer=%p, size=%u", buffer, size);
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle DH. Return the number of characters written, or -1 on
error. If an error occurs, errno is set. */
-ssize_t
+gpgme_ssize_t
gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size)
{
- ssize_t res;
+ gpgme_ssize_t res;
TRACE_BEG2 (DEBUG_DATA, "gpgme_data_write", dh,
"buffer=%p, size=%u", buffer, size);
/* Set the current position from where the next read or write starts
in the data object with the handle DH to OFFSET, relativ to
WHENCE. */
-off_t
-gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence)
+gpgme_off_t
+gpgme_data_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
TRACE_BEG2 (DEBUG_DATA, "gpgme_data_seek", dh,
"offset=%lli, whence=%i", offset, whence);
gpgme_data_t dh = (gpgme_data_t) data->handler_value;
char buffer[BUFFER_SIZE];
char *bufp = buffer;
- ssize_t buflen;
+ gpgme_ssize_t buflen;
TRACE_BEG1 (DEBUG_CTX, "_gpgme_data_inbound_handler", dh,
"fd=0x%x", fd);
do
{
- ssize_t amt = gpgme_data_write (dh, bufp, buflen);
+ gpgme_ssize_t amt = gpgme_data_write (dh, bufp, buflen);
if (amt == 0 || (amt < 0 && errno != EINTR))
return TRACE_ERR (gpg_error_from_syserror ());
bufp += amt;
{
struct io_cb_data *data = (struct io_cb_data *) opaque;
gpgme_data_t dh = (gpgme_data_t) data->handler_value;
- ssize_t nwritten;
+ gpgme_ssize_t nwritten;
TRACE_BEG1 (DEBUG_CTX, "_gpgme_data_outbound_handler", dh,
"fd=0x%x", fd);
if (!dh->pending_len)
{
- ssize_t amt = gpgme_data_read (dh, dh->pending, BUFFER_SIZE);
+ gpgme_ssize_t amt = gpgme_data_read (dh, dh->pending, BUFFER_SIZE);
if (amt < 0)
return TRACE_ERR (gpg_error_from_syserror ());
if (amt == 0)
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle DH. Return the number of characters read, 0 on EOF and
-1 on error. If an error occurs, errno is set. */
-typedef ssize_t (*gpgme_data_read_cb) (gpgme_data_t dh, void *buffer,
- size_t size);
+typedef gpgme_ssize_t (*gpgme_data_read_cb) (gpgme_data_t dh,
+ void *buffer,
+ size_t size);
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle DH. Return the number of characters written, or -1 on
error. If an error occurs, errno is set. */
-typedef ssize_t (*gpgme_data_write_cb) (gpgme_data_t dh, const void *buffer,
- size_t size);
+typedef gpgme_ssize_t (*gpgme_data_write_cb) (gpgme_data_t dh,
+ const void *buffer,
+ size_t size);
/* Set the current position from where the next read or write starts
in the data object with the handle DH to OFFSET, relativ to
WHENCE. */
-typedef off_t (*gpgme_data_seek_cb) (gpgme_data_t dh, off_t offset,
- int whence);
+typedef gpgme_off_t (*gpgme_data_seek_cb) (gpgme_data_t dh,
+ gpgme_off_t offset,
+ int whence);
/* Release the data object with the handle DH. */
typedef void (*gpgme_data_release_cb) (gpgme_data_t dh);
/* Allocated size of BUFFER. */
size_t size;
size_t length;
- off_t offset;
+ gpgme_off_t offset;
} mem;
/* For gpgme_data_new_from_read_cb. */
}
#ifdef FRAME_NR
{
- char spaces[] = " ";
- int nr_spaces = sizeof (spaces) - 1;
- int nr_columns;
-
- nr_columns = 2 * (frame_nr - 1);
- if (nr_columns > nr_spaces)
- nr_columns = nr_spaces;
- if (nr_columns < 0)
- nr_columns = 0;
- spaces[nr_columns] = '\0';
- fprintf (errfp, "%s", spaces);
+ int indent;
+
+ indent = frame_nr > 0? (2 * (frame_nr - 1)):0;
+ fprintf (errfp, "%*s", indent < 40? indent : 40, "");
}
#endif
static gpgme_error_t
+encrypt_sym_status_handler (void *priv, gpgme_status_code_t code, char *args)
+{
+ gpgme_error_t err;
+
+ err = _gpgme_progress_status_handler (priv, code, args);
+ if (!err)
+ err = _gpgme_sign_status_handler (priv, code, args);
+ if (!err)
+ err = _gpgme_passphrase_status_handler (priv, code, args);
+ return err;
+}
+
+
+static gpgme_error_t
encrypt_sign_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t recp[],
gpgme_encrypt_flags_t flags,
gpgme_data_t plain, gpgme_data_t cipher)
{
gpgme_error_t err;
+ int symmetric;
err = _gpgme_op_reset (ctx, synchronous);
if (err)
return err;
+ symmetric = !recp;
+
if (!plain)
return gpg_error (GPG_ERR_NO_DATA);
- if (!cipher || !recp)
+ if (!cipher)
+ return gpg_error (GPG_ERR_INV_VALUE);
+ if (recp && !*recp)
return gpg_error (GPG_ERR_INV_VALUE);
err = _gpgme_op_encrypt_init_result (ctx);
}
_gpgme_engine_set_status_handler (ctx->engine,
- encrypt_sign_status_handler, ctx);
+ symmetric
+ ? encrypt_sym_status_handler
+ : encrypt_sign_status_handler,
+ ctx);
return _gpgme_engine_op_encrypt_sign (ctx->engine, recp, flags, plain,
cipher, ctx->use_armor,
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
+ int symmetric = !recp;
+
+ err = add_arg (gpg, symmetric ? "--symmetric" : "--encrypt");
- err = add_arg (gpg, "--encrypt");
if (!err)
err = add_arg (gpg, "--sign");
if (!err && use_armor)
err = add_arg (gpg, "--armor");
- /* If we know that all recipients are valid (full or ultimate trust)
- we can suppress further checks. */
- if (!err && (flags & GPGME_ENCRYPT_ALWAYS_TRUST))
- err = add_arg (gpg, "--always-trust");
+ if (!symmetric)
+ {
+ /* If we know that all recipients are valid (full or ultimate trust)
+ we can suppress further checks. */
+ if (!err && (flags & GPGME_ENCRYPT_ALWAYS_TRUST))
+ err = add_arg (gpg, "--always-trust");
- if (!err)
- err = append_args_from_recipients (gpg, recp);
+ if (!err && (flags & GPGME_ENCRYPT_NO_ENCRYPT_TO))
+ err = add_arg (gpg, "--no-encrypt-to");
+
+ if (!err)
+ err = append_args_from_recipients (gpg, recp);
+ }
if (!err)
err = append_args_from_signers (gpg, ctx);
+
if (!err)
err = append_args_from_sig_notations (gpg, ctx);
char *src = line + 2;
char *end = line + linelen;
char *dst = src;
- ssize_t nwritten;
+ gpgme_ssize_t nwritten;
linelen = 0;
while (src < end)
char *src = line + 2;
char *end = line + linelen;
char *dst = src;
- ssize_t nwritten;
+ gpgme_ssize_t nwritten;
linelen = 0;
while (src < end)
gpgme_data_t plain, gpgme_data_t cipher, int sign)
{
gpg_error_t err;
+ gpgme_key_t *recp;
+
+ recp = gt->recipients_nr? gt->recipients : NULL;
if (sign)
- err = gpgme_op_encrypt_sign (gt->ctx, gt->recipients, flags, plain, cipher);
+ err = gpgme_op_encrypt_sign (gt->ctx, recp, flags, plain, cipher);
else
- err = gpgme_op_encrypt (gt->ctx, gt->recipients, flags, plain, cipher);
+ err = gpgme_op_encrypt (gt->ctx, recp, flags, plain, cipher);
gt_recipients_clear (gt);
{
while (size > 0)
{
- ssize_t writen = gpgme_data_write (data, buf, size);
+ gpgme_ssize_t writen = gpgme_data_write (data, buf, size);
if (writen < 0 && errno != EAGAIN)
return gpg_error_from_syserror ();
else if (writen > 0)
do
{
char buf[512];
- ssize_t readn = gpgme_data_read (inp_data, buf, sizeof (buf));
+ gpgme_ssize_t readn = gpgme_data_read (inp_data, buf, sizeof (buf));
if (readn < 0)
{
err = gpg_error_from_syserror ();
/* This function provides access to the internal read function; it is
normally not used. */
-ssize_t
+gpgme_ssize_t
gpgme_io_read (int fd, void *buffer, size_t count)
{
int ret;
/* This function provides access to the internal write function. It
is to be used by user callbacks to return data to gpgme. See
gpgme_passphrase_cb_t and gpgme_edit_cb_t. */
-ssize_t
+gpgme_ssize_t
gpgme_io_write (int fd, const void *buffer, size_t count)
{
int ret;
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, see <http://www.gnu.org/licenses/>.
- File: @configure_input@ */
+ Generated from gpgme.h.in for @GPGME_CONFIG_HOST@. */
#ifndef GPGME_H
#define GPGME_H
/* Include stdio.h for the FILE type definition. */
#include <stdio.h>
-
-@INSERT__TYPEDEFS_FOR_GPGME_H@
-
#include <time.h>
-
#include <gpg-error.h>
#ifdef __cplusplus
#endif
#endif /* __cplusplus */
+@INSERT__TYPEDEFS_FOR_GPGME_H@
\f
/* Check for compiler features. */
GPGME_PROTOCOL_UNKNOWN = 255
}
gpgme_protocol_t;
+/* Convenience macro for the surprisingly mixed spelling. */
+#define GPGME_PROTOCOL_OPENPGP GPGME_PROTOCOL_OpenPGP
\f
/* The available keylist mode flags. */
/* Wrappers around the internal I/O functions for use with
gpgme_passphrase_cb_t and gpgme_edit_cb_t. */
-ssize_t gpgme_io_read (int fd, void *buffer, size_t count);
-ssize_t gpgme_io_write (int fd, const void *buffer, size_t count);
+@API__SSIZE_T@ gpgme_io_read (int fd, void *buffer, size_t count);
+@API__SSIZE_T@ gpgme_io_write (int fd, const void *buffer, size_t count);
int gpgme_io_writen (int fd, const void *buffer, size_t count);
/* Process the pending operation and, if HANG is non-zero, wait for
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle HANDLE. Return the number of characters read, 0 on EOF
and -1 on error. If an error occurs, errno is set. */
-typedef ssize_t (*gpgme_data_read_cb_t) (void *handle, void *buffer,
+typedef @API__SSIZE_T@ (*gpgme_data_read_cb_t) (void *handle, void *buffer,
size_t size);
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle HANDLE. Return the number of characters written, or -1
on error. If an error occurs, errno is set. */
-typedef ssize_t (*gpgme_data_write_cb_t) (void *handle, const void *buffer,
+typedef @API__SSIZE_T@ (*gpgme_data_write_cb_t) (void *handle, const void *buffer,
size_t size);
/* Set the current position from where the next read or write starts
in the data object with the handle HANDLE to OFFSET, relativ to
WHENCE. */
-typedef off_t (*gpgme_data_seek_cb_t) (void *handle, off_t offset, int whence);
+typedef @API__OFF_T@ (*gpgme_data_seek_cb_t) (void *handle,
+ @API__OFF_T@ offset, int whence);
/* Close the data object with the handle DL. */
typedef void (*gpgme_data_release_cb_t) (void *handle);
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle DH. Return the number of characters read, 0 on EOF and
-1 on error. If an error occurs, errno is set. */
-ssize_t gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size);
+@API__SSIZE_T@ gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size);
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle DH. Return the number of characters written, or -1 on
error. If an error occurs, errno is set. */
-ssize_t gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size);
+@API__SSIZE_T@ gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size);
/* Set the current position from where the next read or write starts
in the data object with the handle DH to OFFSET, relativ to
WHENCE. */
-off_t gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence);
+@API__OFF_T@ gpgme_data_seek (gpgme_data_t dh, @API__OFF_T@ offset, int whence);
/* Create a new data buffer and return it in R_DH. */
gpgme_error_t gpgme_data_new (gpgme_data_t *r_dh);
non-zero). */
gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh,
const char *fname, FILE *fp,
- off_t offset, size_t length);
+ @API__OFF_T@ offset, size_t length);
/* Reset the read pointer in DH. Deprecated, please use
gpgme_data_seek instead. */
HANDLE have_data_ev;
/* This is automatically reset. */
HANDLE have_space_ev;
- HANDLE stopped;
+ /* This is manually reset but actually only triggered once. */
+ HANDLE close_ev;
+
size_t readpos, writepos;
char buffer[READBUF_SIZE];
};
/* This is manually reset. */
HANDLE have_data;
HANDLE is_empty;
- HANDLE stopped;
+ HANDLE close_ev;
size_t nbytes;
char buffer[WRITEBUF_SIZE];
};
int nbytes;
DWORD nread;
int sock;
- TRACE_BEG1 (DEBUG_SYSIO, "gpgme:reader", ctx->file_hd,
- "thread=%p", ctx->thread_hd);
+ TRACE_BEG2 (DEBUG_SYSIO, "gpgme:reader", ctx->file_hd,
+ "file_sock=%d, thread=%p", ctx->file_sock, ctx->thread_hd);
if (ctx->file_hd != INVALID_HANDLE_VALUE)
sock = 0;
}
else
{
+ /* Check whether the shutdown triggered the error -
+ no need to to print a warning in this case. */
+ if ( ctx->error_code == WSAECONNABORTED
+ || ctx->error_code == WSAECONNRESET)
+ {
+ LOCK (ctx->mutex);
+ if (ctx->stop_me)
+ {
+ UNLOCK (ctx->mutex);
+ TRACE_LOG ("got shutdown");
+ break;
+ }
+ UNLOCK (ctx->mutex);
+ }
+
ctx->error = 1;
TRACE_LOG1 ("recv error: ec=%d", ctx->error_code);
}
UNLOCK (ctx->mutex);
break;
}
+
TRACE_LOG1 ("got %u bytes", nread);
ctx->writepos = (ctx->writepos + nread) % READBUF_SIZE;
}
/* Indicate that we have an error or EOF. */
if (!SetEvent (ctx->have_data_ev))
- TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev,
- (int) GetLastError ());
- SetEvent (ctx->stopped);
+ TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev,
+ (int) GetLastError ());
+
+ TRACE_LOG ("waiting for close");
+ WaitForSingleObject (ctx->close_ev, INFINITE);
+
+ CloseHandle (ctx->close_ev);
+ CloseHandle (ctx->have_data_ev);
+ CloseHandle (ctx->have_space_ev);
+ CloseHandle (ctx->thread_hd);
+ DESTROY_LOCK (ctx->mutex);
+ free (ctx);
return TRACE_SUC ();
}
TRACE_SYSERR (EIO);
return NULL;
}
+ TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d",
+ fd, fd_table[fd].handle, fd_table[fd].socket,
+ fd_table[fd].dup_from);
ctx->file_hd = fd_table[fd].handle;
ctx->file_sock = fd_table[fd].socket;
if (ctx->have_data_ev)
ctx->have_space_ev = CreateEvent (&sec_attr, FALSE, TRUE, NULL);
if (ctx->have_space_ev)
- ctx->stopped = CreateEvent (&sec_attr, TRUE, FALSE, NULL);
- if (!ctx->have_data_ev || !ctx->have_space_ev || !ctx->stopped)
+ ctx->close_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL);
+ if (!ctx->have_data_ev || !ctx->have_space_ev || !ctx->close_ev)
{
TRACE_LOG1 ("CreateEvent failed: ec=%d", (int) GetLastError ());
if (ctx->have_data_ev)
CloseHandle (ctx->have_data_ev);
if (ctx->have_space_ev)
CloseHandle (ctx->have_space_ev);
- if (ctx->stopped)
- CloseHandle (ctx->stopped);
+ if (ctx->close_ev)
+ CloseHandle (ctx->close_ev);
free (ctx);
/* FIXME: Translate the error code. */
TRACE_SYSERR (EIO);
CloseHandle (ctx->have_data_ev);
if (ctx->have_space_ev)
CloseHandle (ctx->have_space_ev);
- if (ctx->stopped)
- CloseHandle (ctx->stopped);
+ if (ctx->close_ev)
+ CloseHandle (ctx->close_ev);
free (ctx);
TRACE_SYSERR (EIO);
return NULL;
}
+/* Prepare destruction of the reader thread for CTX. Returns 0 if a
+ call to this function is sufficient and destroy_reader_finish shall
+ not be called. */
static void
destroy_reader (struct reader_context_s *ctx)
{
}
#endif
- TRACE1 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx->file_hd,
- "waiting for termination of thread %p", ctx->thread_hd);
- WaitForSingleObject (ctx->stopped, INFINITE);
- TRACE1 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx->file_hd,
- "thread %p has terminated", ctx->thread_hd);
+ /* The reader thread is usually blocking in recv or ReadFile. If
+ the peer does not send an EOF or breaks the pipe the WFSO might
+ get stuck waiting for the termination of the reader thread. This
+ happens quite often with sockets, thus we definitely need to get
+ out of the recv. A shutdown does this nicely. For handles
+ (i.e. pipes) it would also be nice to cancel the operation, but
+ such a feature is only available since Vista. Thus we need to
+ dlopen that syscall. */
+ if (ctx->file_hd != INVALID_HANDLE_VALUE)
+ {
+ /* Fixme: Call CancelSynchronousIo (handle_of_thread). */
+ }
+ else if (ctx->file_sock != INVALID_SOCKET)
+ {
+ if (shutdown (ctx->file_sock, 2))
+ TRACE2 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx->file_hd,
+ "shutdown socket %d failed: %s",
+ ctx->file_sock, (int) WSAGetLastError ());
+ }
- if (ctx->stopped)
- CloseHandle (ctx->stopped);
- if (ctx->have_data_ev)
- CloseHandle (ctx->have_data_ev);
- if (ctx->have_space_ev)
- CloseHandle (ctx->have_space_ev);
- CloseHandle (ctx->thread_hd);
- DESTROY_LOCK (ctx->mutex);
- free (ctx);
+ /* After setting this event CTX is void. */
+ SetEvent (ctx->close_ev);
}
+
/* Find a reader context or create a new one. Note that the reader
context will last until a _gpgme_io_close. */
static struct reader_context_s *
}
-static void
-kill_reader (int fd)
-{
- int i;
-
- LOCK (reader_table_lock);
- for (i = 0; i < reader_table_size; i++)
- {
- if (reader_table[i].used && reader_table[i].fd == fd)
- {
- destroy_reader (reader_table[i].context);
- reader_table[i].context = NULL;
- reader_table[i].used = 0;
- break;
- }
- }
- UNLOCK (reader_table_lock);
-}
-
-
int
_gpgme_io_read (int fd, void *buffer, size_t count)
{
struct writer_context_s *ctx = arg;
DWORD nwritten;
int sock;
- TRACE_BEG1 (DEBUG_SYSIO, "gpgme:writer", ctx->file_hd,
- "thread=%p", ctx->thread_hd);
+ TRACE_BEG2 (DEBUG_SYSIO, "gpgme:writer", ctx->file_hd,
+ "file_sock=%d, thread=%p", ctx->file_sock, ctx->thread_hd);
if (ctx->file_hd != INVALID_HANDLE_VALUE)
sock = 0;
/* Indicate that we have an error. */
if (!SetEvent (ctx->is_empty))
TRACE_LOG1 ("SetEvent failed: ec=%d", (int) GetLastError ());
- SetEvent (ctx->stopped);
+
+ TRACE_LOG ("waiting for close");
+ WaitForSingleObject (ctx->close_ev, INFINITE);
+
+ CloseHandle (ctx->close_ev);
+ CloseHandle (ctx->have_data);
+ CloseHandle (ctx->is_empty);
+ CloseHandle (ctx->thread_hd);
+ DESTROY_LOCK (ctx->mutex);
+ free (ctx);
return TRACE_SUC ();
}
TRACE_SYSERR (EIO);
return NULL;
}
+ TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d",
+ fd, fd_table[fd].handle, fd_table[fd].socket,
+ fd_table[fd].dup_from);
ctx->file_hd = fd_table[fd].handle;
ctx->file_sock = fd_table[fd].socket;
if (ctx->have_data)
ctx->is_empty = CreateEvent (&sec_attr, TRUE, TRUE, NULL);
if (ctx->is_empty)
- ctx->stopped = CreateEvent (&sec_attr, TRUE, FALSE, NULL);
- if (!ctx->have_data || !ctx->is_empty || !ctx->stopped)
+ ctx->close_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL);
+ if (!ctx->have_data || !ctx->is_empty || !ctx->close_ev)
{
TRACE_LOG1 ("CreateEvent failed: ec=%d", (int) GetLastError ());
if (ctx->have_data)
CloseHandle (ctx->have_data);
if (ctx->is_empty)
CloseHandle (ctx->is_empty);
- if (ctx->stopped)
- CloseHandle (ctx->stopped);
+ if (ctx->close_ev)
+ CloseHandle (ctx->close_ev);
free (ctx);
/* FIXME: Translate the error code. */
TRACE_SYSERR (EIO);
CloseHandle (ctx->have_data);
if (ctx->is_empty)
CloseHandle (ctx->is_empty);
- if (ctx->stopped)
- CloseHandle (ctx->stopped);
+ if (ctx->close_ev)
+ CloseHandle (ctx->close_ev);
free (ctx);
TRACE_SYSERR (EIO);
return NULL;
return ctx;
}
+
static void
destroy_writer (struct writer_context_s *ctx)
{
}
#endif
- TRACE1 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx->file_hd,
- "waiting for termination of thread %p", ctx->thread_hd);
- WaitForSingleObject (ctx->stopped, INFINITE);
- TRACE1 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx->file_hd,
- "thread %p has terminated", ctx->thread_hd);
-
- if (ctx->stopped)
- CloseHandle (ctx->stopped);
- if (ctx->have_data)
- CloseHandle (ctx->have_data);
- if (ctx->is_empty)
- CloseHandle (ctx->is_empty);
- CloseHandle (ctx->thread_hd);
- DESTROY_LOCK (ctx->mutex);
- free (ctx);
+ /* After setting this event CTX is void. */
+ SetEvent (ctx->close_ev);
}
}
-static void
-kill_writer (int fd)
-{
- int i;
-
- LOCK (writer_table_lock);
- for (i = 0; i < writer_table_size; i++)
- {
- if (writer_table[i].used && writer_table[i].fd == fd)
- {
- destroy_writer (writer_table[i].context);
- writer_table[i].context = NULL;
- writer_table[i].used = 0;
- break;
- }
- }
- UNLOCK (writer_table_lock);
-}
-
-
int
_gpgme_io_write (int fd, const void *buffer, size_t count)
{
return TRACE_SYSRES (-1);
}
- kill_reader (fd);
- kill_writer (fd);
+ TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d",
+ fd, fd_table[fd].handle, fd_table[fd].socket,
+ fd_table[fd].dup_from);
+
+ LOCK (reader_table_lock);
+ for (i = 0; i < reader_table_size; i++)
+ {
+ if (reader_table[i].used && reader_table[i].fd == fd)
+ {
+ destroy_reader (reader_table[i].context);
+ reader_table[i].context = NULL;
+ reader_table[i].used = 0;
+ break;
+ }
+ }
+ UNLOCK (reader_table_lock);
+
+ LOCK (writer_table_lock);
+ for (i = 0; i < writer_table_size; i++)
+ {
+ if (writer_table[i].used && writer_table[i].fd == fd)
+ {
+ destroy_writer (writer_table[i].context);
+ writer_table[i].context = NULL;
+ writer_table[i].used = 0;
+ break;
+ }
+ }
+ UNLOCK (writer_table_lock);
+
LOCK (notify_table_lock);
for (i = 0; i < DIM (notify_table); i++)
{
args = calloc (2 + i + 1, sizeof (*args));
args[0] = (char *) _gpgme_get_w32spawn_path ();
args[1] = tmp_name;
- args[2] = path;
+ args[2] = (char *)path;
memcpy (&args[3], &argv[1], i * sizeof (*args));
memset (&sec_attr, 0, sizeof sec_attr);
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_select", fds,
"nfds=%u, nonblock=%u", nfds, nonblock);
+#if 0
restart:
+#endif
TRACE_SEQ (dbg_help, "select on [ ");
any = 0;
nwait = 0;
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
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.
-
+
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
Lesser General Public License for more details.
-
+
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
}
-int
+int
main (int argc, char **argv)
{
gpgme_ctx_t ctx;
char *agent_info;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
-
+
err = gpgme_new (&ctx);
fail_if_err (err);
gpgme_set_textmode (ctx, 1);
gpgme_key_unref (key[1]);
gpgme_data_release (in);
gpgme_data_release (out);
+
+ /* Now a second time using symmetric encryption. */
+ err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0);
+ fail_if_err (err);
+
+ err = gpgme_data_new (&out);
+ fail_if_err (err);
+
+ err = gpgme_op_encrypt_sign (ctx, NULL, GPGME_ENCRYPT_ALWAYS_TRUST, in, out);
+ fail_if_err (err);
+ sign_result = gpgme_op_sign_result (ctx);
+ check_result (sign_result, GPGME_SIG_MODE_NORMAL);
+ print_data (out);
+
+ gpgme_data_release (in);
+ gpgme_data_release (out);
+
+
gpgme_release (ctx);
return 0;
}
err = gpgme_data_new (&data);
fail_if_err (err);
- err = gpgme_op_getauditlog (ctx, data, GPGME_AUDITLOG_HTML);
+ err = gpgme_op_getauditlog (ctx, data, 0);
if (err)
{
fprintf (stderr, "%s:%i: Can't get audit log: %s\n",