summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinWang An <jinwang.an@samsung.com>2021-12-01 16:54:34 +0900
committerJinWang An <jinwang.an@samsung.com>2021-12-01 16:54:34 +0900
commit4db435874bc286631d5dc726f68ba5bb86a1bb89 (patch)
tree272c0eda6487854588390073f08ce293a82560f0
parent670d9afb902f264b6410d307c429f02ed8685fd3 (diff)
downloadgpgme-4db435874bc286631d5dc726f68ba5bb86a1bb89.tar.gz
gpgme-4db435874bc286631d5dc726f68ba5bb86a1bb89.tar.bz2
gpgme-4db435874bc286631d5dc726f68ba5bb86a1bb89.zip
Imported Upstream version 1.4.3upstream/1.4.3
-rw-r--r--ChangeLog92
-rw-r--r--NEWS18
-rw-r--r--VERSION2
-rw-r--r--config.h.in6
-rwxr-xr-xconfigure458
-rw-r--r--configure.ac266
-rw-r--r--doc/gpgme.info223
-rw-r--r--doc/gpgme.info-190
-rw-r--r--doc/gpgme.info-229
-rw-r--r--doc/gpgme.texi58
-rw-r--r--doc/stamp-vti8
-rw-r--r--doc/uiserver.texi38
-rw-r--r--doc/version.texi8
-rw-r--r--gpgme.spec2
-rw-r--r--lang/cl/gpgme.asd2
-rw-r--r--src/Makefile.am5
-rw-r--r--src/Makefile.in133
-rw-r--r--src/data-identify.c247
-rw-r--r--src/dirinfo.c166
-rw-r--r--src/engine-g13.c8
-rw-r--r--src/engine-gpg.c8
-rw-r--r--src/engine-gpgconf.c6
-rw-r--r--src/engine-gpgsm.c10
-rw-r--r--src/engine-uiserver.c4
-rw-r--r--src/gpgme-tool.c73
-rw-r--r--src/gpgme.def4
-rw-r--r--src/gpgme.h.in22
-rw-r--r--src/libgpgme.vers2
-rw-r--r--src/parsetlv.c103
-rw-r--r--src/parsetlv.h48
-rw-r--r--src/posix-util.c24
-rw-r--r--src/signers.c8
-rw-r--r--src/sys-util.h29
-rw-r--r--src/util.h11
-rw-r--r--src/w32-util.c253
-rw-r--r--tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87Fbin0 -> 682 bytes
-rw-r--r--tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FDbin0 -> 828 bytes
-rw-r--r--tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66bin0 -> 493 bytes
-rw-r--r--tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5Cbin0 -> 636 bytes
-rw-r--r--tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BDbin0 -> 636 bytes
-rw-r--r--tests/gpg/Makefile.am47
-rw-r--r--tests/gpg/Makefile.in54
-rwxr-xr-xtests/gpg/final.test4
-rwxr-xr-xtests/gpg/initial.test4
-rwxr-xr-xtests/gpg/start-stop-agent45
45 files changed, 1866 insertions, 752 deletions
diff --git a/ChangeLog b/ChangeLog
index d360a18..fffdf4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,95 @@
+2013-08-12 Werner Koch <wk@gnupg.org>
+
+ Release 1.4.3.
+ * configure.ac: Change LT version to C22/A11/R0.
+
+ Make test suite workable with GnuPG 2.1.
+ * tests/gpg/start-stop-agent: New.
+ * tests/gpg/initial.test: New.
+ * tests/gpg/final.test: New.
+ * tests/gpg/Makefile.am (c_tests): New.
+ (TESTS): Move all to c_tests. Add initial.test, final.test, and
+ c_tests.
+ (TESTS_ENVIRONMENT): Add C_ALL=C
+ (private_keys): New.
+ (EXTRA_DIST): Add new files.
+ (./private-keys-v1.d/gpg-sample.stamp): Copy private keys.
+ (all-local): Depend on gpg-sample.stamp.
+ * tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F: New.
+ * tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD: New.
+ * tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66: New.
+ * tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C: New.
+ * tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD: New.
+
+ Improve detection of default gpg by configure.
+ * configure.ac: Move test for gpgconf before test for gpg.
+ (GPG, GPGSM, G13): Use gpgconf instead of AC_PATH_PROG if possible.
+
+2013-08-09 Werner Koch <wk@gnupg.org>
+
+ Add function gpgme_data_identify.
+ * src/gpgme.h.in (gpgme_data_type_t): New.
+ (gpgme_data_identify): New prototype.
+ * src/data-identify.c: New.
+ * src/parsetlv.c, src/parsetlv.h: New. Take from gpa.
+ * src/libgpgme.vers, src/gpgme.def: Add gpgme_data_identify.
+ * src/gpgme-tool.c (status): Add STATUS_IDENTIFY_RESULT.
+ (gt_identify): New.
+ (cmd_identify): New.
+
+ (hlp_passwd): Move close to cmd_passwd.
+
+2013-08-02 Werner Koch <wk@gnupg.org>
+
+ Prefer GnuPG-2 engines over GnuPG-1.
+ * src/util.h: Move some prototypes to ...
+ * src/sys-util.h: New.
+ * src/Makefile.am (main_sources): Add sys-util.h.
+ * configure.ac (AH_VERBATIM): Add DIRSEP_C and DIRSEP_S.
+ * src/dirinfo.c: Include sys-util.h.
+ (WANT_GPG_NAME, WANT_GPGSM_NAME, WANT_G13_NAME)
+ (WANT_UISRV_SOCKET): New.
+ (dirinfo): Add corresponding fields.
+ (parse_output): Add arg COMPONENTS and set new fields.
+ (read_gpgconf_dirs): Add arg components and act upon it.
+ (get_gpgconf_item): Call read_gpgconf_dirs two times. Add debug
+ output.
+ (_gpgme_get_default_gpg_name): New.
+ (_gpgme_get_default_gpgsm_name): New.
+ (_gpgme_get_default_g13_name): New.
+ (_gpgme_get_default_gpgconf_name): New.
+ (_gpgme_get_default_uisrv_socket): New.
+ * src/engine-gpg.c, src/engine-g13.c, src/engine-gpgconf.c
+ * src/engine-gpgsm.c, src/engine-uiserver.c: Change to use
+ _gpgme_get_default_ instead of those from sys-util.h.
+ * src/posix-util.c (_gpgme_get_gpg_path): Include sys-util.h.
+ (_gpgme_get_uiserver_socket_path): Remove.
+ * src/w32-util.c (_gpgme_get_gpg_path): Include sys-util.h.
+ (_gpgme_get_uiserver_socket_path): Remove.
+
+ w32: Try to locate gpg in the gpgme installation dir.
+ * src/w32-util.c (my_hmodule): New.
+ (wchar_to_utf8): New.
+ (DllMain): New.
+ (_gpgme_get_inst_dir): New.
+ (find_program_in_dir): New.
+ (find_program_in_inst_dir): Add arg INST_DIR.
+ (_gpgme_get_gpg_path): Get inst_dir before acquiring the lock.
+ (_gpgme_get_gpgconf_path): Ditto.
+ (_gpgme_get_g13_path): Ditto.
+ (_gpgme_get_w32spawn_path): Ditto.
+
+2013-07-31 Werner Koch <wk@gnupg.org>
+
+ doc: Add --binary option for the OUTPUT command of an uiserver.
+
+2013-06-18 Werner Koch <wk@gnupg.org>
+
+ Add function gpgme_signers_count.
+ * src/signers.c (gpgme_signers_count): New.
+ * src/libgpgme.vers, src/gpgme.def: Add as external symbol.
+ * src/gpgme.h.in: Add prototype.
+
2013-05-28 Werner Koch <wk@gnupg.org>
Release 1.4.2.
diff --git a/NEWS b/NEWS
index 7df3cd2..f68035d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,21 @@
+Noteworthy changes in version 1.4.3 (2013-08-12)
+------------------------------------------------
+
+ * The default engine names are now taken from the output of gpgconf.
+ If gpgconf is not found the use of gpg 1 is assumed.
+
+ * Under Windows the default engines names are first searched in the
+ installation directory of the gpgme DLL.
+
+ * New function gpgme_data_identify to detect the type of a message.
+
+ * Interface changes relative to the 1.4.2 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ gpgme_signers_count NEW.
+ gpgme_data_type_t NEW.
+ gpgme_data_identify NEW.
+
+
Noteworthy changes in version 1.4.2 (2013-05-28)
------------------------------------------------
diff --git a/VERSION b/VERSION
index 9df886c..428b770 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.4.2
+1.4.3
diff --git a/config.h.in b/config.h.in
index 883cede..18a78f9 100644
--- a/config.h.in
+++ b/config.h.in
@@ -205,11 +205,15 @@
#undef REPLACE_TTYNAME_R
-/* Separators as used in $PATH. */
+/* Separators as used in $PATH and file name. */
#ifdef HAVE_DOSISH_SYSTEM
#define PATHSEP_C ';'
+#define DIRSEP_C '\\'
+#define DIRSEP_S "\\"
#else
#define PATHSEP_C ':'
+#define DIRSEP_C '/'
+#define DIRSEP_S "/"
#endif
diff --git a/configure b/configure
index bc46a58..0e8da7a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gpgme 1.4.2.
+# Generated by GNU Autoconf 2.69 for gpgme 1.4.3.
#
# Report bugs to <http://bugs.gnupg.org>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='gpgme'
PACKAGE_TARNAME='gpgme'
-PACKAGE_VERSION='1.4.2'
-PACKAGE_STRING='gpgme 1.4.2'
+PACKAGE_VERSION='1.4.3'
+PACKAGE_STRING='gpgme 1.4.3'
PACKAGE_BUGREPORT='http://bugs.gnupg.org'
PACKAGE_URL=''
@@ -652,11 +652,6 @@ RUN_G13_TESTS_TRUE
HAVE_G13_FALSE
HAVE_G13_TRUE
G13
-RUN_GPGCONF_TESTS_FALSE
-RUN_GPGCONF_TESTS_TRUE
-HAVE_GPGCONF_FALSE
-HAVE_GPGCONF_TRUE
-GPGCONF
RUN_GPGSM_TESTS_FALSE
RUN_GPGSM_TESTS_TRUE
HAVE_GPGSM_FALSE
@@ -666,6 +661,11 @@ GPG_PATH
RUN_GPG_TESTS_FALSE
RUN_GPG_TESTS_TRUE
GPG
+RUN_GPGCONF_TESTS_FALSE
+RUN_GPGCONF_TESTS_TRUE
+HAVE_GPGCONF_FALSE
+HAVE_GPGCONF_TRUE
+GPGCONF
HAVE_ASSUAN_FALSE
HAVE_ASSUAN_TRUE
LIBASSUAN_LIBS
@@ -857,12 +857,12 @@ with_gpg_version
with_gpgsm_version
with_gpgconf_version
with_g13_version
+with_gpgconf
+enable_gpgconf_test
with_gpg
enable_gpg_test
with_gpgsm
enable_gpgsm_test
-with_gpgconf
-enable_gpgconf_test
with_g13
enable_g13_test
enable_fd_passing
@@ -1420,7 +1420,7 @@ if test "$ac_init_help" = "long"; then
# 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.2 to adapt to many kinds of systems.
+\`configure' configures gpgme 1.4.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1490,7 +1490,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gpgme 1.4.2:";;
+ short | recursive ) echo "Configuration of gpgme 1.4.3:";;
esac
cat <<\_ACEOF
@@ -1511,9 +1511,9 @@ Optional Features:
--enable-w32-glib build GPGME Glib for W32
--enable-w32-qt build GPGME Qt for W32
--disable-largefile omit support for large files
+ --disable-gpgconf-test disable GPGCONF run test
--disable-gpg-test disable GPG run test
--disable-gpgsm-test disable GPGSM run test
- --disable-gpgconf-test disable GPGCONF run test
--disable-g13-test disable G13 run test
--disable-fd-passing do not use FD passing
@@ -1536,9 +1536,9 @@ Optional Packages:
--with-gpgconf-version=VER
require GPGCONF version VER
--with-g13-version=VER require G13 version VER
+ --with-gpgconf=PATH use gpgconf binary at PATH
--with-gpg=PATH use GnuPG binary at PATH
--with-gpgsm=PATH use GpgSM binary at PATH
- --with-gpgconf=PATH use gpgconf binary at PATH
--with-g13=PATH use g13 binary at PATH
Some influential environment variables:
@@ -1620,7 +1620,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gpgme configure 1.4.2
+gpgme configure 1.4.3
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2450,7 +2450,7 @@ cat >config.log <<_ACEOF
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.2, which was
+It was created by gpgme $as_me 1.4.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2813,10 +2813,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBGPGME_LT_CURRENT=21
+LIBGPGME_LT_CURRENT=22
# 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=10
+LIBGPGME_LT_AGE=11
LIBGPGME_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
@@ -2864,6 +2864,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
ac_config_headers="$ac_config_headers config.h"
+# Note: For automake 1.13 add the option
+# serial-tests
am__api_version='1.11'
# Find a good install program. We prefer a C program (faster),
@@ -3302,7 +3304,7 @@ fi
# Define the identity of the package.
PACKAGE='gpgme'
- VERSION='1.4.2'
+ VERSION='1.4.3'
cat >>confdefs.h <<_ACEOF
@@ -5995,7 +5997,7 @@ cat >>confdefs.h <<_ACEOF
#define VERSION "$VERSION"
_ACEOF
-VERSION_NUMBER=0x010402
+VERSION_NUMBER=0x010403
# Don't default to build static libs.
@@ -17323,7 +17325,7 @@ fi
#
# Provide information about the build.
#
-BUILD_REVISION="009e26a"
+BUILD_REVISION="d788c35"
cat >>confdefs.h <<_ACEOF
@@ -17332,7 +17334,7 @@ _ACEOF
BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
-BUILD_FILEVERSION="${BUILD_FILEVERSION}158"
+BUILD_FILEVERSION="${BUILD_FILEVERSION}55176"
BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
@@ -18737,17 +18739,17 @@ fi
cat >>confdefs.h <<_ACEOF
-#define NEED_GPG_VERSION "$NEED_GPG_VERSION"
+#define NEED_GPGCONF_VERSION "$NEED_GPGCONF_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
-#define NEED_GPGSM_VERSION "$NEED_GPGSM_VERSION"
+#define NEED_GPG_VERSION "$NEED_GPG_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
-#define NEED_GPGCONF_VERSION "$NEED_GPGCONF_VERSION"
+#define NEED_GPGSM_VERSION "$NEED_GPGSM_VERSION"
_ACEOF
@@ -18756,30 +18758,33 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
-
+#
+# Check for GPGCONF
+#
+gpgconf_usable_for_test=no
NO_OVERRIDE=no
-# Check whether --with-gpg was given.
-if test "${with_gpg+set}" = set; then :
- withval=$with_gpg; GPG=$withval
+# Check whether --with-gpgconf was given.
+if test "${with_gpgconf+set}" = set; then :
+ withval=$with_gpgconf; GPGCONF=$withval
else
NO_OVERRIDE=yes
fi
-if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
- GPG=
+if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
+ GPGCONF=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- # Extract the first word of "gpg", so it can be a program name with args.
-set dummy gpg; ac_word=$2
+ # Extract the first word of "gpgconf", so it can be a program name with args.
+set dummy gpgconf; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GPG+:} false; then :
+if ${ac_cv_path_GPGCONF+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $GPG in
+ case $GPGCONF in
[\\/]* | ?:[\\/]*)
- ac_cv_path_GPG="$GPG" # Let the user override the test with a path.
+ ac_cv_path_GPGCONF="$GPGCONF" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -18789,7 +18794,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_GPG="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_GPGCONF="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -18800,10 +18805,10 @@ IFS=$as_save_IFS
;;
esac
fi
-GPG=$ac_cv_path_GPG
-if test -n "$GPG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPG" >&5
-$as_echo "$GPG" >&6; }
+GPGCONF=$ac_cv_path_GPGCONF
+if test -n "$GPGCONF"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPGCONF" >&5
+$as_echo "$GPGCONF" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
@@ -18811,68 +18816,79 @@ fi
fi
- if test -z "$GPG"; then
- GPG="$GPG_DEFAULT"
+ if test -z "$GPGCONF"; then
+ GPGCONF="$GPGCONF_DEFAULT"
fi
fi
-if test "$GPG" = no; then
+if test "$GPGCONF" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
***
-*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
+*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
***" >&5
$as_echo "$as_me: WARNING:
***
-*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
+*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
***" >&2;}
else
as_fn_error $? "
***
-*** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
+*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
***" "$LINENO" 5
fi
fi
else
cat >>confdefs.h <<_ACEOF
-#define GPG_PATH "$GPG"
+#define GPGCONF_PATH "$GPGCONF"
_ACEOF
+$as_echo "#define ENABLE_GPGCONF 1" >>confdefs.h
+
fi
-GPG_VERSION=unknown
+ if test "$GPGCONF" != "no"; then
+ HAVE_GPGCONF_TRUE=
+ HAVE_GPGCONF_FALSE='#'
+else
+ HAVE_GPGCONF_TRUE='#'
+ HAVE_GPGCONF_FALSE=
+fi
+
+
+GPGCONF_VERSION=unknown
ok=maybe
-if test -z "$GPG" -o "x$GPG" = "xno"; then
+if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GnuPG version can not be checked when cross compiling" >&5
-$as_echo "$as_me: WARNING: GnuPG version can not be checked when cross compiling" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF version can not be checked when cross compiling" >&5
+$as_echo "$as_me: WARNING: GPGCONF version can not be checked when cross compiling" >&2;}
ok=no
else
- if test ! -x "$GPG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GnuPG not executable, version check disabled" >&5
-$as_echo "$as_me: WARNING: GnuPG not executable, version check disabled" >&2;}
+ if test ! -x "$GPGCONF"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF not executable, version check disabled" >&5
+$as_echo "$as_me: WARNING: GPGCONF not executable, version check disabled" >&2;}
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPG >= $NEED_GPG_VERSION" >&5
-$as_echo_n "checking for GPG >= $NEED_GPG_VERSION... " >&6; }
- req_major=`echo $NEED_GPG_VERSION | \
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGCONF >= $NEED_GPGCONF_VERSION" >&5
+$as_echo_n "checking for GPGCONF >= $NEED_GPGCONF_VERSION... " >&6; }
+ req_major=`echo $NEED_GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
- req_minor=`echo $NEED_GPG_VERSION | \
+ req_minor=`echo $NEED_GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
- req_micro=`echo $NEED_GPG_VERSION | \
+ req_micro=`echo $NEED_GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
- GPG_VERSION=`$GPG --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
- major=`echo $GPG_VERSION | \
+ GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
+ major=`echo $GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
- minor=`echo $GPG_VERSION | \
+ minor=`echo $GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
- micro=`echo $GPG_VERSION | \
+ micro=`echo $GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
@@ -18893,52 +18909,61 @@ $as_echo_n "checking for GPG >= $NEED_GPG_VERSION... " >&6; }
if test "$ok" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
+ if test "$cross_compiling" != "yes"; then
+ gpgconf_usable_for_test=yes
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPG must be at least version $NEED_GPG_VERSION" >&5
-$as_echo "$as_me: WARNING: GPG must be at least version $NEED_GPG_VERSION" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&5
+$as_echo "$as_me: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&2;}
fi
fi
-run_gpg_test="$ok"
-# Check whether --enable-gpg-test was given.
-if test "${enable_gpg_test+set}" = set; then :
- enableval=$enable_gpg_test; run_gpg_test=$enableval
+run_gpgconf_test="$ok"
+# Check whether --enable-gpgconf-test was given.
+if test "${enable_gpgconf_test+set}" = set; then :
+ enableval=$enable_gpgconf_test; run_gpgconf_test=$enableval
fi
- if test "$run_gpg_test" = "yes"; then
- RUN_GPG_TESTS_TRUE=
- RUN_GPG_TESTS_FALSE='#'
+ if test "$run_gpgconf_test" = "yes"; then
+ RUN_GPGCONF_TESTS_TRUE=
+ RUN_GPGCONF_TESTS_FALSE='#'
else
- RUN_GPG_TESTS_TRUE='#'
- RUN_GPG_TESTS_FALSE=
+ RUN_GPGCONF_TESTS_TRUE='#'
+ RUN_GPGCONF_TESTS_FALSE=
fi
+#
+# Check for GPG
+#
NO_OVERRIDE=no
-# Check whether --with-gpgsm was given.
-if test "${with_gpgsm+set}" = set; then :
- withval=$with_gpgsm; GPGSM=$withval
+# Check whether --with-gpg was given.
+if test "${with_gpg+set}" = set; then :
+ withval=$with_gpg; GPG=$withval
else
NO_OVERRIDE=yes
fi
-if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
- GPGSM=
+if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
+ GPG=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- # Extract the first word of "gpgsm", so it can be a program name with args.
-set dummy gpgsm; ac_word=$2
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ GPG="`$GPGCONF --list-components | grep ^gpg: | cut -d: -f 3`"
+ else
+ # Extract the first word of "gpg", so it can be a program name with args.
+set dummy gpg; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GPGSM+:} false; then :
+if ${ac_cv_path_GPG+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $GPGSM in
+ case $GPG in
[\\/]* | ?:[\\/]*)
- ac_cv_path_GPGSM="$GPGSM" # Let the user override the test with a path.
+ ac_cv_path_GPG="$GPG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -18948,7 +18973,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_GPGSM="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_GPG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -18959,91 +18984,80 @@ IFS=$as_save_IFS
;;
esac
fi
-GPGSM=$ac_cv_path_GPGSM
-if test -n "$GPGSM"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPGSM" >&5
-$as_echo "$GPGSM" >&6; }
+GPG=$ac_cv_path_GPG
+if test -n "$GPG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPG" >&5
+$as_echo "$GPG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
+ fi
fi
- if test -z "$GPGSM"; then
- GPGSM="$GPGSM_DEFAULT"
+ if test -z "$GPG"; then
+ GPG="$GPG_DEFAULT"
fi
fi
-if test "$GPGSM" = no; then
+if test "$GPG" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
***
-*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
+*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
***" >&5
$as_echo "$as_me: WARNING:
***
-*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
+*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
***" >&2;}
else
as_fn_error $? "
***
-*** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
+*** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
***" "$LINENO" 5
fi
fi
else
cat >>confdefs.h <<_ACEOF
-#define GPGSM_PATH "$GPGSM"
+#define GPG_PATH "$GPG"
_ACEOF
-$as_echo "#define ENABLE_GPGSM 1" >>confdefs.h
-
-fi
- if test "$GPGSM" != "no"; then
- HAVE_GPGSM_TRUE=
- HAVE_GPGSM_FALSE='#'
-else
- HAVE_GPGSM_TRUE='#'
- HAVE_GPGSM_FALSE=
fi
-
-
-
-GPGSM_VERSION=unknown
+GPG_VERSION=unknown
ok=maybe
-if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
+if test -z "$GPG" -o "x$GPG" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM version can not be checked when cross compiling" >&5
-$as_echo "$as_me: WARNING: GPGSM version can not be checked when cross compiling" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GnuPG version can not be checked when cross compiling" >&5
+$as_echo "$as_me: WARNING: GnuPG version can not be checked when cross compiling" >&2;}
ok=no
else
- if test ! -x "$GPGSM"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM not executable, version check disabled" >&5
-$as_echo "$as_me: WARNING: GPGSM not executable, version check disabled" >&2;}
+ if test ! -x "$GPG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GnuPG not executable, version check disabled" >&5
+$as_echo "$as_me: WARNING: GnuPG not executable, version check disabled" >&2;}
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGSM >= $NEED_GPGSM_VERSION" >&5
-$as_echo_n "checking for GPGSM >= $NEED_GPGSM_VERSION... " >&6; }
- req_major=`echo $NEED_GPGSM_VERSION | \
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPG >= $NEED_GPG_VERSION" >&5
+$as_echo_n "checking for GPG >= $NEED_GPG_VERSION... " >&6; }
+ req_major=`echo $NEED_GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
- req_minor=`echo $NEED_GPGSM_VERSION | \
+ req_minor=`echo $NEED_GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
- req_micro=`echo $NEED_GPGSM_VERSION | \
+ req_micro=`echo $NEED_GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
- GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
- major=`echo $GPGSM_VERSION | \
+ GPG_VERSION=`$GPG --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
+ major=`echo $GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
- minor=`echo $GPGSM_VERSION | \
+ minor=`echo $GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
- micro=`echo $GPGSM_VERSION | \
+ micro=`echo $GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
@@ -19067,49 +19081,56 @@ $as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM must be at least version $NEED_GPGSM_VERSION" >&5
-$as_echo "$as_me: WARNING: GPGSM must be at least version $NEED_GPGSM_VERSION" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPG must be at least version $NEED_GPG_VERSION" >&5
+$as_echo "$as_me: WARNING: GPG must be at least version $NEED_GPG_VERSION" >&2;}
fi
fi
-run_gpgsm_test="$ok"
-# Check whether --enable-gpgsm-test was given.
-if test "${enable_gpgsm_test+set}" = set; then :
- enableval=$enable_gpgsm_test; run_gpgsm_test=$enableval
+run_gpg_test="$ok"
+# Check whether --enable-gpg-test was given.
+if test "${enable_gpg_test+set}" = set; then :
+ enableval=$enable_gpg_test; run_gpg_test=$enableval
fi
- if test "$run_gpgsm_test" = "yes"; then
- RUN_GPGSM_TESTS_TRUE=
- RUN_GPGSM_TESTS_FALSE='#'
+ if test "$run_gpg_test" = "yes"; then
+ RUN_GPG_TESTS_TRUE=
+ RUN_GPG_TESTS_FALSE='#'
else
- RUN_GPGSM_TESTS_TRUE='#'
- RUN_GPGSM_TESTS_FALSE=
+ RUN_GPG_TESTS_TRUE='#'
+ RUN_GPG_TESTS_FALSE=
fi
+
+#
+# Check for GPGSM
+#
NO_OVERRIDE=no
-# Check whether --with-gpgconf was given.
-if test "${with_gpgconf+set}" = set; then :
- withval=$with_gpgconf; GPGCONF=$withval
+# Check whether --with-gpgsm was given.
+if test "${with_gpgsm+set}" = set; then :
+ withval=$with_gpgsm; GPGSM=$withval
else
NO_OVERRIDE=yes
fi
-if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
- GPGCONF=
+if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
+ GPGSM=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- # Extract the first word of "gpgconf", so it can be a program name with args.
-set dummy gpgconf; ac_word=$2
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ GPGSM="`$GPGCONF --list-components | grep ^gpgsm: | cut -d: -f 3`"
+ else
+ # Extract the first word of "gpgsm", so it can be a program name with args.
+set dummy gpgsm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GPGCONF+:} false; then :
+if ${ac_cv_path_GPGSM+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $GPGCONF in
+ case $GPGSM in
[\\/]* | ?:[\\/]*)
- ac_cv_path_GPGCONF="$GPGCONF" # Let the user override the test with a path.
+ ac_cv_path_GPGSM="$GPGSM" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -19119,7 +19140,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_GPGCONF="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_GPGSM="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -19130,90 +19151,92 @@ IFS=$as_save_IFS
;;
esac
fi
-GPGCONF=$ac_cv_path_GPGCONF
-if test -n "$GPGCONF"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPGCONF" >&5
-$as_echo "$GPGCONF" >&6; }
+GPGSM=$ac_cv_path_GPGSM
+if test -n "$GPGSM"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPGSM" >&5
+$as_echo "$GPGSM" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
+ fi
fi
- if test -z "$GPGCONF"; then
- GPGCONF="$GPGCONF_DEFAULT"
+ if test -z "$GPGSM"; then
+ GPGSM="$GPGSM_DEFAULT"
fi
fi
-if test "$GPGCONF" = no; then
+if test "$GPGSM" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
***
-*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
+*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
***" >&5
$as_echo "$as_me: WARNING:
***
-*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
+*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
***" >&2;}
else
as_fn_error $? "
***
-*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
+*** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
***" "$LINENO" 5
fi
fi
else
cat >>confdefs.h <<_ACEOF
-#define GPGCONF_PATH "$GPGCONF"
+#define GPGSM_PATH "$GPGSM"
_ACEOF
-$as_echo "#define ENABLE_GPGCONF 1" >>confdefs.h
+$as_echo "#define ENABLE_GPGSM 1" >>confdefs.h
fi
- if test "$GPGCONF" != "no"; then
- HAVE_GPGCONF_TRUE=
- HAVE_GPGCONF_FALSE='#'
+ if test "$GPGSM" != "no"; then
+ HAVE_GPGSM_TRUE=
+ HAVE_GPGSM_FALSE='#'
else
- HAVE_GPGCONF_TRUE='#'
- HAVE_GPGCONF_FALSE=
+ HAVE_GPGSM_TRUE='#'
+ HAVE_GPGSM_FALSE=
fi
-GPGCONF_VERSION=unknown
+
+GPGSM_VERSION=unknown
ok=maybe
-if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
+if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF version can not be checked when cross compiling" >&5
-$as_echo "$as_me: WARNING: GPGCONF version can not be checked when cross compiling" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM version can not be checked when cross compiling" >&5
+$as_echo "$as_me: WARNING: GPGSM version can not be checked when cross compiling" >&2;}
ok=no
else
- if test ! -x "$GPGCONF"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF not executable, version check disabled" >&5
-$as_echo "$as_me: WARNING: GPGCONF not executable, version check disabled" >&2;}
+ if test ! -x "$GPGSM"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM not executable, version check disabled" >&5
+$as_echo "$as_me: WARNING: GPGSM not executable, version check disabled" >&2;}
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGCONF >= $NEED_GPGCONF_VERSION" >&5
-$as_echo_n "checking for GPGCONF >= $NEED_GPGCONF_VERSION... " >&6; }
- req_major=`echo $NEED_GPGCONF_VERSION | \
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGSM >= $NEED_GPGSM_VERSION" >&5
+$as_echo_n "checking for GPGSM >= $NEED_GPGSM_VERSION... " >&6; }
+ req_major=`echo $NEED_GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
- req_minor=`echo $NEED_GPGCONF_VERSION | \
+ req_minor=`echo $NEED_GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
- req_micro=`echo $NEED_GPGCONF_VERSION | \
+ req_micro=`echo $NEED_GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
- GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
- major=`echo $GPGCONF_VERSION | \
+ GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
+ major=`echo $GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
- minor=`echo $GPGCONF_VERSION | \
+ minor=`echo $GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
- micro=`echo $GPGCONF_VERSION | \
+ micro=`echo $GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
@@ -19237,26 +19260,29 @@ $as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&5
-$as_echo "$as_me: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM must be at least version $NEED_GPGSM_VERSION" >&5
+$as_echo "$as_me: WARNING: GPGSM must be at least version $NEED_GPGSM_VERSION" >&2;}
fi
fi
-run_gpgconf_test="$ok"
-# Check whether --enable-gpgconf-test was given.
-if test "${enable_gpgconf_test+set}" = set; then :
- enableval=$enable_gpgconf_test; run_gpgconf_test=$enableval
+run_gpgsm_test="$ok"
+# Check whether --enable-gpgsm-test was given.
+if test "${enable_gpgsm_test+set}" = set; then :
+ enableval=$enable_gpgsm_test; run_gpgsm_test=$enableval
fi
- if test "$run_gpgconf_test" = "yes"; then
- RUN_GPGCONF_TESTS_TRUE=
- RUN_GPGCONF_TESTS_FALSE='#'
+ if test "$run_gpgsm_test" = "yes"; then
+ RUN_GPGSM_TESTS_TRUE=
+ RUN_GPGSM_TESTS_FALSE='#'
else
- RUN_GPGCONF_TESTS_TRUE='#'
- RUN_GPGCONF_TESTS_FALSE=
+ RUN_GPGSM_TESTS_TRUE='#'
+ RUN_GPGSM_TESTS_FALSE=
fi
+#
+# Check for G13
+#
NO_OVERRIDE=no
# Check whether --with-g13 was given.
@@ -19270,7 +19296,14 @@ if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
G13=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- # Extract the first word of "g13", so it can be a program name with args.
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ G13="`$GPGCONF --list-components | grep ^g13: | cut -d: -f 3`"
+ if test -z "$G13"; then
+ # Use a hack if gpgconf has no support for g13.
+ G13="`$GPGCONF --list-dirs | grep ^bindir: | cut -d: -f 2`/g13"
+ fi
+ else
+ # Extract the first word of "g13", so it can be a program name with args.
set dummy g13; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
@@ -19310,6 +19343,7 @@ $as_echo "no" >&6; }
fi
+ fi
fi
if test -z "$G13"; then
G13="$G13_DEFAULT"
@@ -19427,6 +19461,10 @@ fi
+#
+# Other checks
+#
+
# Check for funopen
for ac_func in funopen
do :
@@ -19889,6 +19927,14 @@ if test -z "${HAVE_ASSUAN_TRUE}" && test -z "${HAVE_ASSUAN_FALSE}"; then
as_fn_error $? "conditional \"HAVE_ASSUAN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${HAVE_GPGCONF_TRUE}" && test -z "${HAVE_GPGCONF_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_GPGCONF\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${RUN_GPGCONF_TESTS_TRUE}" && test -z "${RUN_GPGCONF_TESTS_FALSE}"; then
+ as_fn_error $? "conditional \"RUN_GPGCONF_TESTS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${RUN_GPG_TESTS_TRUE}" && test -z "${RUN_GPG_TESTS_FALSE}"; then
as_fn_error $? "conditional \"RUN_GPG_TESTS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -19901,14 +19947,6 @@ if test -z "${RUN_GPGSM_TESTS_TRUE}" && test -z "${RUN_GPGSM_TESTS_FALSE}"; then
as_fn_error $? "conditional \"RUN_GPGSM_TESTS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${HAVE_GPGCONF_TRUE}" && test -z "${HAVE_GPGCONF_FALSE}"; then
- as_fn_error $? "conditional \"HAVE_GPGCONF\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${RUN_GPGCONF_TESTS_TRUE}" && test -z "${RUN_GPGCONF_TESTS_FALSE}"; then
- as_fn_error $? "conditional \"RUN_GPGCONF_TESTS\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
if test -z "${HAVE_G13_TRUE}" && test -z "${HAVE_G13_FALSE}"; then
as_fn_error $? "conditional \"HAVE_G13\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -20322,7 +20360,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# 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.2, which was
+This file was extended by gpgme $as_me 1.4.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -20388,7 +20426,7 @@ _ACEOF
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.2
+gpgme config.status 1.4.3
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -22682,16 +22720,16 @@ fi
echo "
GPGME v${VERSION} has been configured as follows:
- Revision: 009e26a (158)
+ Revision: d788c35 (55176)
Platform: $host
- GnuPG path: $GPG
- GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
- GpgSM path: $GPGSM
- GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
- GpgConf path: $GPGCONF
- GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
- G13 path: $G13
+ Gpgconf at: $GPGCONF
+ Gpgconf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
+ GPG at: $GPG
+ GPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
+ Gpgsm at: $GPGSM
+ Gpgsm version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
+ G13 at: $G13
G13 version: $G13_VERSION, min. $NEED_G13_VERSION
Assuan version: $libassuan_config_version, min. $NEED_LIBASSUAN_VERSION
diff --git a/configure.ac b/configure.ac
index 30392b8..92375e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,7 @@ min_automake_version="1.11"
# for the LT versions.
m4_define(mym4_version_major, [1])
m4_define(mym4_version_minor, [4])
-m4_define(mym4_version_micro, [2])
+m4_define(mym4_version_micro, [3])
# Below is m4 magic to extract and compute the revision number, the
# decimalized short revision number, a beta version string, and a flag
@@ -55,10 +55,10 @@ AC_INIT([gpgme],[mym4_full_version],[http://bugs.gnupg.org])
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBGPGME_LT_CURRENT=21
+LIBGPGME_LT_CURRENT=22
# 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=10
+LIBGPGME_LT_AGE=11
LIBGPGME_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
@@ -77,6 +77,8 @@ AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR(src/gpgme.h.in)
AC_CONFIG_HEADER(config.h)
+# Note: For automake 1.13 add the option
+# serial-tests
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
@@ -443,16 +445,121 @@ if test "$NEED_G13_VERSION" = "no"; then
NEED_G13_VERSION=0.0.0
fi
+AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
+ [Min. needed GPGCONF version.])
AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
[Min. needed GnuPG version.])
AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
[Min. needed GPGSM version.])
-AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
- [Min. needed GPGCONF version.])
AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
[Min. needed G13 version.])
+#
+# Check for GPGCONF
+#
+gpgconf_usable_for_test=no
+NO_OVERRIDE=no
+AC_ARG_WITH(gpgconf,
+ AC_HELP_STRING([--with-gpgconf=PATH],
+ [use gpgconf binary at PATH]),
+ GPGCONF=$withval, NO_OVERRIDE=yes)
+if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
+ GPGCONF=
+ NO_OVERRIDE=yes
+ if test "$cross_compiling" != "yes"; then
+ AC_PATH_PROG(GPGCONF, gpgconf)
+ fi
+ if test -z "$GPGCONF"; then
+ GPGCONF="$GPGCONF_DEFAULT"
+ fi
+fi
+if test "$GPGCONF" = no; then
+ if test "$NO_OVERRIDE" = "yes"; then
+ if test "$cross_compiling" != "yes"; then
+ AC_MSG_WARN([
+***
+*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
+***])
+ else
+ AC_MSG_ERROR([
+***
+*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
+***])
+ fi
+ fi
+else
+ AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
+ AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
+fi
+AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
+
+dnl Check for GPGCONF version requirement.
+GPGCONF_VERSION=unknown
+ok=maybe
+if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
+ ok=no
+else
+ if test "$cross_compiling" = "yes"; then
+ AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
+ ok=no
+ else
+ if test ! -x "$GPGCONF"; then
+ AC_MSG_WARN([GPGCONF not executable, version check disabled])
+ ok=no
+ fi
+ fi
+fi
+if test "$ok" = "maybe"; then
+ AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
+ req_major=`echo $NEED_GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+ req_minor=`echo $NEED_GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+ req_micro=`echo $NEED_GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+ GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
+ major=`echo $GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+ minor=`echo $GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+ micro=`echo $GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+
+ if test "$major" -gt "$req_major"; then
+ ok=yes
+ else
+ if test "$major" -eq "$req_major"; then
+ if test "$minor" -gt "$req_minor"; then
+ ok=yes
+ else
+ if test "$minor" -eq "$req_minor"; then
+ if test "$micro" -ge "$req_micro"; then
+ ok=yes
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test "$ok" = "yes"; then
+ AC_MSG_RESULT(yes)
+ if test "$cross_compiling" != "yes"; then
+ gpgconf_usable_for_test=yes
+ fi
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
+ fi
+fi
+run_gpgconf_test="$ok"
+AC_ARG_ENABLE(gpgconf-test,
+ AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
+ run_gpgconf_test=$enableval)
+AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
+
+#
+# Check for GPG
+#
NO_OVERRIDE=no
AC_ARG_WITH(gpg,
AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
@@ -461,7 +568,11 @@ if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
GPG=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- AC_PATH_PROG(GPG, gpg)
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ GPG="`$GPGCONF --list-components | grep ^gpg: | cut -d: -f 3`"
+ else
+ AC_PATH_PROG(GPG, gpg)
+ fi
fi
if test -z "$GPG"; then
GPG="$GPG_DEFAULT"
@@ -546,6 +657,10 @@ AC_ARG_ENABLE(gpg-test,
AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
AC_SUBST(GPG_PATH)
+
+#
+# Check for GPGSM
+#
NO_OVERRIDE=no
AC_ARG_WITH(gpgsm,
AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
@@ -554,7 +669,11 @@ if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
GPGSM=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- AC_PATH_PROG(GPGSM, gpgsm)
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ GPGSM="`$GPGCONF --list-components | grep ^gpgsm: | cut -d: -f 3`"
+ else
+ AC_PATH_PROG(GPGSM, gpgsm)
+ fi
fi
if test -z "$GPGSM"; then
GPGSM="$GPGSM_DEFAULT"
@@ -642,102 +761,9 @@ AC_ARG_ENABLE(gpgsm-test,
AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
-NO_OVERRIDE=no
-AC_ARG_WITH(gpgconf,
- AC_HELP_STRING([--with-gpgconf=PATH],
- [use gpgconf binary at PATH]),
- GPGCONF=$withval, NO_OVERRIDE=yes)
-if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
- GPGCONF=
- NO_OVERRIDE=yes
- if test "$cross_compiling" != "yes"; then
- AC_PATH_PROG(GPGCONF, gpgconf)
- fi
- if test -z "$GPGCONF"; then
- GPGCONF="$GPGCONF_DEFAULT"
- fi
-fi
-if test "$GPGCONF" = no; then
- if test "$NO_OVERRIDE" = "yes"; then
- if test "$cross_compiling" != "yes"; then
- AC_MSG_WARN([
-***
-*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
-***])
- else
- AC_MSG_ERROR([
-***
-*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
-***])
- fi
- fi
-else
- AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
- AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
-fi
-AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
-
-dnl Check for GPGCONF version requirement.
-GPGCONF_VERSION=unknown
-ok=maybe
-if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
- ok=no
-else
- if test "$cross_compiling" = "yes"; then
- AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
- ok=no
- else
- if test ! -x "$GPGCONF"; then
- AC_MSG_WARN([GPGCONF not executable, version check disabled])
- ok=no
- fi
- fi
-fi
-if test "$ok" = "maybe"; then
- AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
- req_major=`echo $NEED_GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
- req_minor=`echo $NEED_GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
- req_micro=`echo $NEED_GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
- GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
- major=`echo $GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
- minor=`echo $GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
- micro=`echo $GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
-
- if test "$major" -gt "$req_major"; then
- ok=yes
- else
- if test "$major" -eq "$req_major"; then
- if test "$minor" -gt "$req_minor"; then
- ok=yes
- else
- if test "$minor" -eq "$req_minor"; then
- if test "$micro" -ge "$req_micro"; then
- ok=yes
- fi
- fi
- fi
- fi
- fi
- if test "$ok" = "yes"; then
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
- fi
-fi
-run_gpgconf_test="$ok"
-AC_ARG_ENABLE(gpgconf-test,
- AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
- run_gpgconf_test=$enableval)
-AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
-
-
+#
+# Check for G13
+#
NO_OVERRIDE=no
AC_ARG_WITH(g13,
AC_HELP_STRING([--with-g13=PATH],
@@ -747,7 +773,15 @@ if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
G13=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- AC_PATH_PROG(G13, g13)
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ G13="`$GPGCONF --list-components | grep ^g13: | cut -d: -f 3`"
+ if test -z "$G13"; then
+ # Use a hack if gpgconf has no support for g13.
+ G13="`$GPGCONF --list-dirs | grep ^bindir: | cut -d: -f 2`/g13"
+ fi
+ else
+ AC_PATH_PROG(G13, g13)
+ fi
fi
if test -z "$G13"; then
G13="$G13_DEFAULT"
@@ -834,6 +868,10 @@ AC_ARG_ENABLE(g13-test,
AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
+#
+# Other checks
+#
+
# Check for funopen
AC_CHECK_FUNCS(funopen)
if test $ac_cv_func_funopen != yes; then
@@ -920,11 +958,15 @@ AM_CONDITIONAL(HAVE_UISERVER, test "$uiserver" != "no")
# Add a few constants to help porting to W32
AH_VERBATIM([SEPCONSTANTS],
[
-/* Separators as used in $PATH. */
+/* Separators as used in $PATH and file name. */
#ifdef HAVE_DOSISH_SYSTEM
#define PATHSEP_C ';'
+#define DIRSEP_C '\\'
+#define DIRSEP_S "\\"
#else
#define PATHSEP_C ':'
+#define DIRSEP_C '/'
+#define DIRSEP_S "/"
#endif
])
@@ -1025,13 +1067,13 @@ echo "
Revision: mym4_revision (mym4_revision_dec)
Platform: $host
- GnuPG path: $GPG
- GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
- GpgSM path: $GPGSM
- GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
- GpgConf path: $GPGCONF
- GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
- G13 path: $G13
+ Gpgconf at: $GPGCONF
+ Gpgconf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
+ GPG at: $GPG
+ GPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
+ Gpgsm at: $GPGSM
+ Gpgsm version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
+ G13 at: $G13
G13 version: $G13_VERSION, min. $NEED_G13_VERSION
Assuan version: $libassuan_config_version, min. $NEED_LIBASSUAN_VERSION
diff --git a/doc/gpgme.info b/doc/gpgme.info
index 5ac6f47..59dd85c 100644
--- a/doc/gpgme.info
+++ b/doc/gpgme.info
@@ -22,8 +22,8 @@ General Public License for more details.
This file documents 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.
+ This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG
+Made Easy' Reference Manual', for Version 1.4.3.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
2013 g10 Code GmbH.
@@ -41,117 +41,118 @@ General Public License for more details.

Indirect:
-gpgme.info-1: 1756
-gpgme.info-2: 281093
+gpgme.info-1: 1758
+gpgme.info-2: 283468

Tag Table:
(Indirect)
-Node: Top1756
-Node: Introduction8595
-Node: Getting Started9382
-Node: Features10507
-Node: Overview11657
-Node: Preparation12766
-Node: Header13763
-Node: Building the Source14462
-Node: Largefile Support (LFS)16571
-Node: Using Automake21882
-Node: Using Libtool23518
-Node: Library Version Check23868
-Node: Signal Handling27823
-Node: Multi Threading29039
-Ref: Multi Threading-Footnote-131221
-Node: Protocols and Engines31635
-Node: Engine Version Check33984
-Node: Engine Information34561
-Node: Engine Configuration38261
-Node: OpenPGP39523
-Node: Cryptographic Message Syntax39859
-Node: Algorithms40153
-Ref: Algorithms-Footnote-140632
-Node: Public Key Algorithms40760
-Node: Hash Algorithms42691
-Node: Error Handling43789
-Node: Error Values45651
-Node: Error Sources50729
-Node: Error Codes53056
-Node: Error Strings57695
-Node: Exchanging Data59474
-Node: Creating Data Buffers61303
-Node: Memory Based Data Buffers61819
-Node: File Based Data Buffers65173
-Node: Callback Based Data Buffers67344
-Node: Destroying Data Buffers72900
-Node: Manipulating Data Buffers74259
-Node: Data Buffer I/O Operations74678
-Node: Data Buffer Meta-Data77381
-Node: Contexts80731
-Node: Creating Contexts81854
-Node: Destroying Contexts82665
-Node: Result Management83000
-Node: Context Attributes84406
-Node: Protocol Selection85184
-Node: Crypto Engine86196
-Node: ASCII Armor88017
-Node: Text Mode88629
-Node: Included Certificates89560
-Node: Key Listing Mode90935
-Node: Passphrase Callback94292
-Node: Progress Meter Callback97430
-Node: Locale99354
-Node: Key Management100893
-Node: Listing Keys110818
-Node: Information About Keys118080
-Node: Key Signatures126078
-Node: Manipulating Keys130090
-Node: Generating Keys130932
-Node: Exporting Keys135539
-Node: Importing Keys141438
-Ref: Importing Keys-Footnote-1148601
-Node: Deleting Keys148729
-Node: Changing Passphrases150126
-Node: Advanced Key Editing151387
-Node: Trust Item Management154491
-Node: Listing Trust Items155561
-Node: Information About Trust Items157859
-Node: Manipulating Trust Items159741
-Node: Crypto Operations160702
-Node: Decrypt161946
-Node: Verify165804
-Node: Decrypt and Verify183660
-Node: Sign185664
-Node: Selecting Signers186228
-Node: Creating a Signature187209
-Node: Signature Notation Data191798
-Node: Encrypt193982
-Node: Encrypting a Plaintext194338
-Node: Run Control200183
-Node: Waiting For Completion200930
-Node: Using External Event Loops202976
-Node: I/O Callback Interface204943
-Node: Registering I/O Callbacks210037
-Node: I/O Callback Example212028
-Node: I/O Callback Example GTK+218247
-Node: I/O Callback Example GDK220036
-Node: I/O Callback Example Qt221678
-Node: Cancellation223966
-Node: UI Server Protocol226219
-Ref: UI Server Protocol-Footnote-1227650
-Node: UI Server Encrypt227769
-Node: UI Server Sign232950
-Node: UI Server Decrypt235179
-Node: UI Server Verify236617
-Node: UI Server Set Input Files240119
-Node: UI Server Sign/Encrypt Files240919
-Node: UI Server Verify/Decrypt Files242688
-Node: UI Server Import/Export Keys244534
-Node: UI Server Checksum Files245567
-Node: Miscellaneous UI Server Commands247733
-Ref: command SENDER249645
-Node: Debugging251321
-Node: Library Copying252976
-Node: Copying281093
-Node: Function and Data Index318724
-Node: Concept Index343986
+Node: Top1758
+Node: Introduction8599
+Node: Getting Started9386
+Node: Features10511
+Node: Overview11661
+Node: Preparation12770
+Node: Header13767
+Node: Building the Source14466
+Node: Largefile Support (LFS)16575
+Node: Using Automake21886
+Node: Using Libtool23522
+Node: Library Version Check23872
+Node: Signal Handling27827
+Node: Multi Threading29043
+Ref: Multi Threading-Footnote-131225
+Node: Protocols and Engines31639
+Node: Engine Version Check33988
+Node: Engine Information34565
+Node: Engine Configuration38265
+Node: OpenPGP39527
+Node: Cryptographic Message Syntax39863
+Node: Algorithms40157
+Ref: Algorithms-Footnote-140636
+Node: Public Key Algorithms40764
+Node: Hash Algorithms42695
+Node: Error Handling43793
+Node: Error Values45655
+Node: Error Sources50733
+Node: Error Codes53060
+Node: Error Strings57699
+Node: Exchanging Data59478
+Node: Creating Data Buffers61307
+Node: Memory Based Data Buffers61823
+Node: File Based Data Buffers65177
+Node: Callback Based Data Buffers67348
+Node: Destroying Data Buffers72904
+Node: Manipulating Data Buffers74263
+Node: Data Buffer I/O Operations74755
+Node: Data Buffer Meta-Data77458
+Node: Data Buffer Convenience80840
+Node: Contexts82776
+Node: Creating Contexts83899
+Node: Destroying Contexts84710
+Node: Result Management85045
+Node: Context Attributes86451
+Node: Protocol Selection87229
+Node: Crypto Engine88241
+Node: ASCII Armor90062
+Node: Text Mode90674
+Node: Included Certificates91605
+Node: Key Listing Mode92980
+Node: Passphrase Callback96337
+Node: Progress Meter Callback99475
+Node: Locale101399
+Node: Key Management102938
+Node: Listing Keys112863
+Node: Information About Keys120125
+Node: Key Signatures128123
+Node: Manipulating Keys132135
+Node: Generating Keys132977
+Node: Exporting Keys137584
+Node: Importing Keys143483
+Ref: Importing Keys-Footnote-1150646
+Node: Deleting Keys150774
+Node: Changing Passphrases152171
+Node: Advanced Key Editing153432
+Node: Trust Item Management156536
+Node: Listing Trust Items157606
+Node: Information About Trust Items159904
+Node: Manipulating Trust Items161786
+Node: Crypto Operations162747
+Node: Decrypt163991
+Node: Verify167849
+Node: Decrypt and Verify185705
+Node: Sign187709
+Node: Selecting Signers188273
+Node: Creating a Signature189425
+Node: Signature Notation Data194014
+Node: Encrypt196198
+Node: Encrypting a Plaintext196554
+Node: Run Control202400
+Node: Waiting For Completion203147
+Node: Using External Event Loops205193
+Node: I/O Callback Interface207160
+Node: Registering I/O Callbacks212254
+Node: I/O Callback Example214245
+Node: I/O Callback Example GTK+220464
+Node: I/O Callback Example GDK222253
+Node: I/O Callback Example Qt223895
+Node: Cancellation226183
+Node: UI Server Protocol228436
+Ref: UI Server Protocol-Footnote-1229867
+Node: UI Server Encrypt229986
+Node: UI Server Sign235246
+Node: UI Server Decrypt237554
+Node: UI Server Verify238992
+Node: UI Server Set Input Files242494
+Node: UI Server Sign/Encrypt Files243294
+Node: UI Server Verify/Decrypt Files245063
+Node: UI Server Import/Export Keys246909
+Node: UI Server Checksum Files247942
+Node: Miscellaneous UI Server Commands250108
+Ref: command SENDER252020
+Node: Debugging253696
+Node: Library Copying255351
+Node: Copying283468
+Node: Function and Data Index321099
+Node: Concept Index346851

End Tag Table
diff --git a/doc/gpgme.info-1 b/doc/gpgme.info-1
index 2066b90..83cc269 100644
--- a/doc/gpgme.info-1
+++ b/doc/gpgme.info-1
@@ -22,8 +22,8 @@ General Public License for more details.
This file documents 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.
+ This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG
+Made Easy' Reference Manual', for Version 1.4.3.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
2013 g10 Code GmbH.
@@ -45,8 +45,8 @@ File: gpgme.info, Node: Top, Next: Introduction, Up: (dir)
Main Menu
*********
-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.
+This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG Made
+Easy' Reference Manual', for Version 1.4.3 of the GPGME library.
* Menu:
@@ -1783,6 +1783,7 @@ be used to manipulate both.
* Data Buffer I/O Operations:: I/O operations on data buffers.
* Data Buffer Meta-Data:: Meta-data manipulation of data buffers.
+* Data Buffer Convenience:: Convenience fucntion for data buffers.

File: gpgme.info, Node: Data Buffer I/O Operations, Next: Data Buffer Meta-Data, Up: Manipulating Data Buffers
@@ -1852,7 +1853,7 @@ be removed in a future version of GPGME.
? gpgme_error_from_errno (errno) : 0;

-File: gpgme.info, Node: Data Buffer Meta-Data, Prev: Data Buffer I/O Operations, Up: Manipulating Data Buffers
+File: gpgme.info, Node: Data Buffer Meta-Data, Next: Data Buffer Convenience, Prev: Data Buffer I/O Operations, Up: Manipulating Data Buffers
6.3.2 Data Buffer Meta-Data
---------------------------
@@ -1930,6 +1931,61 @@ File: gpgme.info, Node: Data Buffer Meta-Data, Prev: Data Buffer I/O Operation
data object with the handle DH to ENC.

+File: gpgme.info, Node: Data Buffer Convenience, Prev: Data Buffer Meta-Data, Up: Manipulating Data Buffers
+
+6.3.3 Data Buffer Convenience Functions
+---------------------------------------
+
+ -- Data type: enum gpgme_data_type_t
+ The `gpgme_data_type_t' type is used to return the detected type
+ of the content of a data buffer.
+
+`GPGME_DATA_TYPE_INVALID'
+ This is returned by `gpgme_data_identify' if it was not possible
+ to identify the data. Reasons for this might be a non-seekable
+ stream or a memory problem. The value is 0.
+
+`GPGME_DATA_TYPE_UNKNOWN'
+ The type of the data is not known.
+
+`GPGME_DATA_TYPE_PGP_SIGNED'
+ The data is an OpenPGP signed message. This may be a binary
+ signature, a detached one or a cleartext signature.
+
+`GPGME_DATA_TYPE_PGP_OTHER'
+ This is a generic OpenPGP message. In most cases this will be
+ encrypted data.
+
+`GPGME_DATA_TYPE_PGP_KEY'
+ This is an OpenPGP key (private or public).
+
+`GPGME_DATA_TYPE_CMS_SIGNED'
+ This is a CMS signed message.
+
+`GPGME_DATA_TYPE_CMS_ENCRYPTED'
+ This is a CMS encrypted (enveloped data) message.
+
+`GPGME_DATA_TYPE_CMS_OTHER'
+ This is used for other CMS message types.
+
+`GPGME_DATA_TYPE_X509_CERT'
+ The data is a X.509 certificate
+
+`GPGME_DATA_TYPE_PKCS12'
+ The data is a PKCS#12 message. This is commonly used to exchange
+ private keys for X.509.
+
+ -- Function: gpgme_data_type_t gpgme_data_identify (gpgme_data_t DH)
+ The function `gpgme_data_identify' returns the type of the data
+ with the handle DH. If it is not possible to perform the
+ identification, the function returns zero
+ (`GPGME_DATA_TYPE_INVALID'). Note that depending on how the data
+ object has been created the identification may not be possible or
+ the data object may change its internal state (file pointer
+ moved). For file or memory based data object, the state should
+ not change.
+
+
File: gpgme.info, Node: Contexts, Next: UI Server Protocol, Prev: Exchanging Data, Up: Top
7 Contexts
@@ -4570,6 +4626,10 @@ File: gpgme.info, Node: Selecting Signers, Next: Creating a Signature, Up: Si
Calling this function acquires an additional reference for the key.
+ -- Function: unsigned int gpgme_signers_count (const gpgme_ctx_t CTX)
+ The function `gpgme_signers_count' returns the number of signer
+ keys in the context CTX.
+
-- Function: gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t CTX,
int SEQ)
The function `gpgme_signers_enum' returns the SEQth key in the
@@ -4767,9 +4827,9 @@ File: gpgme.info, Node: Encrypting a Plaintext, Up: Encrypt
encoding specified for CIPHER) and the text mode attributes set
for the context CTX.
- KEY must be a `NULL'-terminated array of keys. The user must keep
- references for all keys during the whole duration of the call (but
- see `gpgme_op_encrypt_start' for the requirements with the
+ RECP must be a `NULL'-terminated array of keys. The user must
+ keep references for all keys during the whole duration of the call
+ (but see `gpgme_op_encrypt_start' for the requirements with the
asynchronous variant).
The value in FLAGS is a bitwise-or combination of one or multiple
@@ -5644,10 +5704,11 @@ commands are to be used:
implement the `GETINFO pid' command. Sending this command a second
time replaces the file descriptor set by the last one.
- -- Command: OUTPUT FD=N
+ -- Command: OUTPUT FD=N [-binary]
Set the file descriptor to be used for the output (i.e. the
- encrypted message) to N. For OpenPGP, the output needs to be
- ASCII armored; for CMS, the output needs to be Base-64 encoded.
+ encrypted message) to N. If the option `--binary' is given the
+ output shall be in binary format; if not given, the output for
+ OpenPGP needs to be ASCII armored and for CMS Base-64 encoded.
For details on the file descriptor, see the `INPUT' command.
The setting of the recipients, the data source and destination may
@@ -5748,11 +5809,12 @@ output file descriptors:
file descriptor, see the description of `INPUT' in the `ENCRYPT'
section.
- -- Command: OUTPUT FD=N
+ -- Command: OUTPUT FD=N [-binary]
Set the file descriptor to be used for the output. The output is
either the complete signed message or in case of a detached
- signature just that detached signature. For OpenPGP, the output
- needs to be ASCII armored; for CMS, the output needs to be Base-64
+ signature just that detached signature. If the option `--binary'
+ is given the output shall be in binary format; if not given, the
+ output for OpenPGP needs to be ASCII armored and for CMS Base-64
encoded. For details on the file descriptor, see the `INPUT'
command.
diff --git a/doc/gpgme.info-2 b/doc/gpgme.info-2
index 287304f..984300d 100644
--- a/doc/gpgme.info-2
+++ b/doc/gpgme.info-2
@@ -22,8 +22,8 @@ General Public License for more details.
This file documents 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.
+ This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG
+Made Easy' Reference Manual', for Version 1.4.3.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
2013 g10 Code GmbH.
@@ -778,13 +778,15 @@ Function and Data Index
(line 10)
* DECRYPT_VERIFY_FILES: UI Server Verify/Decrypt Files.
(line 12)
-* ENCRYPT: UI Server Encrypt. (line 46)
+* ENCRYPT: UI Server Encrypt. (line 47)
* ENCRYPT_FILES: UI Server Sign/Encrypt Files.
(line 10)
* ENCRYPT_SIGN_FILES: UI Server Sign/Encrypt Files.
(line 12)
* enum gpgme_data_encoding_t: Data Buffer Meta-Data.
(line 28)
+* enum gpgme_data_type_t: Data Buffer Convenience.
+ (line 7)
* enum gpgme_event_io_t: I/O Callback Interface.
(line 57)
* enum gpgme_hash_algo_t: Hash Algorithms. (line 10)
@@ -815,6 +817,8 @@ Function and Data Index
(line 69)
* gpgme_data_get_file_name: Data Buffer Meta-Data.
(line 7)
+* gpgme_data_identify: Data Buffer Convenience.
+ (line 46)
* gpgme_data_new: Memory Based Data Buffers.
(line 13)
* gpgme_data_new_from_cbs: Callback Based Data Buffers.
@@ -852,6 +856,8 @@ Function and Data Index
* gpgme_data_set_file_name: Data Buffer Meta-Data.
(line 18)
* gpgme_data_t: Exchanging Data. (line 14)
+* gpgme_data_type_t: Data Buffer Convenience.
+ (line 7)
* gpgme_data_write: Data Buffer I/O Operations.
(line 18)
* gpgme_data_write_cb_t: Callback Based Data Buffers.
@@ -1039,7 +1045,8 @@ Function and Data Index
* gpgme_signature_t: Verify. (line 92)
* gpgme_signers_add: Selecting Signers. (line 15)
* gpgme_signers_clear: Selecting Signers. (line 7)
-* gpgme_signers_enum: Selecting Signers. (line 22)
+* gpgme_signers_count: Selecting Signers. (line 21)
+* gpgme_signers_enum: Selecting Signers. (line 26)
* gpgme_ssize_t: Exchanging Data. (line 31)
* gpgme_strerror: Error Strings. (line 7)
* gpgme_strerror_r: Error Strings. (line 17)
@@ -1070,21 +1077,21 @@ Function and Data Index
* INPUT <3>: UI Server Sign. (line 13)
* INPUT: UI Server Encrypt. (line 23)
* MESSAGE: UI Server Verify. (line 11)
-* MICALG: UI Server Sign. (line 43)
+* MICALG: UI Server Sign. (line 44)
* off_t (*gpgme_data_seek_cb_t) (void *HANDLE, off_t OFFSET, int WHENCE): Callback Based Data Buffers.
(line 44)
* OUTPUT <1>: UI Server Verify. (line 24)
* OUTPUT <2>: UI Server Decrypt. (line 20)
* OUTPUT <3>: UI Server Sign. (line 19)
* OUTPUT: UI Server Encrypt. (line 36)
-* PREP_ENCRYPT: UI Server Encrypt. (line 72)
-* PROTOCOL: UI Server Encrypt. (line 97)
+* PREP_ENCRYPT: UI Server Encrypt. (line 73)
+* PROTOCOL: UI Server Encrypt. (line 98)
* RECIPIENT: UI Server Encrypt. (line 10)
* SENDER: Miscellaneous UI Server Commands.
(line 51)
* SESSION: Miscellaneous UI Server Commands.
(line 70)
-* SIGN: UI Server Sign. (line 33)
+* SIGN: UI Server Sign. (line 34)
* SIGN_FILES: UI Server Sign/Encrypt Files.
(line 11)
* SIGSTATUS: UI Server Verify. (line 59)
@@ -1174,6 +1181,8 @@ Concept Index
* cryptographic operation, verification: Verify. (line 6)
* cryptographic operation, wait for: Waiting For Completion.
(line 6)
+* data buffer, convenience: Data Buffer Convenience.
+ (line 6)
* data buffer, creation: Creating Data Buffers. (line 6)
* data buffer, destruction: Destroying Data Buffers.
(line 6)
@@ -1224,6 +1233,8 @@ Concept Index
(line 6)
* hash algorithms: Hash Algorithms. (line 6)
* header file: Header. (line 6)
+* identify: Data Buffer Convenience.
+ (line 6)
* include file: Header. (line 6)
* key listing: Listing Keys. (line 6)
* key listing mode: Key Listing Mode. (line 6)
@@ -1303,6 +1314,8 @@ Concept Index
(line 6)
* trust item, manipulation: Manipulating Trust Items.
(line 6)
+* type of data: Data Buffer Convenience.
+ (line 6)
* UI server: UI Server Protocol. (line 6)
* user interface server: UI Server Protocol. (line 6)
* verification: Verify. (line 6)
diff --git a/doc/gpgme.texi b/doc/gpgme.texi
index 217dc13..4ec0bfe 100644
--- a/doc/gpgme.texi
+++ b/doc/gpgme.texi
@@ -1885,6 +1885,7 @@ be used to manipulate both.
@menu
* Data Buffer I/O Operations:: I/O operations on data buffers.
* Data Buffer Meta-Data:: Meta-data manipulation of data buffers.
+* Data Buffer Convenience:: Convenience fucntion for data buffers.
@end menu
@@ -2047,6 +2048,56 @@ The function @code{gpgme_data_set_encoding} changes the encoding of
the data object with the handle @var{dh} to @var{enc}.
@end deftypefun
+@node Data Buffer Convenience
+@subsection Data Buffer Convenience Functions
+@cindex data buffer, convenience
+@cindex type of data
+@cindex identify
+
+@deftp {Data type} {enum gpgme_data_type_t}
+@tindex gpgme_data_type_t
+The @code{gpgme_data_type_t} type is used to return the detected type
+of the content of a data buffer.
+@end deftp
+
+@table @code
+@item GPGME_DATA_TYPE_INVALID
+This is returned by @code{gpgme_data_identify} if it was not possible
+to identify the data. Reasons for this might be a non-seekable stream
+or a memory problem. The value is 0.
+@item GPGME_DATA_TYPE_UNKNOWN
+The type of the data is not known.
+@item GPGME_DATA_TYPE_PGP_SIGNED
+The data is an OpenPGP signed message. This may be a binary
+signature, a detached one or a cleartext signature.
+@item GPGME_DATA_TYPE_PGP_OTHER
+This is a generic OpenPGP message. In most cases this will be
+encrypted data.
+@item GPGME_DATA_TYPE_PGP_KEY
+This is an OpenPGP key (private or public).
+@item GPGME_DATA_TYPE_CMS_SIGNED
+This is a CMS signed message.
+@item GPGME_DATA_TYPE_CMS_ENCRYPTED
+This is a CMS encrypted (enveloped data) message.
+@item GPGME_DATA_TYPE_CMS_OTHER
+This is used for other CMS message types.
+@item GPGME_DATA_TYPE_X509_CERT
+The data is a X.509 certificate
+@item GPGME_DATA_TYPE_PKCS12
+The data is a PKCS#12 message. This is commonly used to exchange
+private keys for X.509.
+@end table
+
+@deftypefun gpgme_data_type_t gpgme_data_identify (@w{gpgme_data_t @var{dh}})
+The function @code{gpgme_data_identify} returns the type of the data
+with the handle @var{dh}. If it is not possible to perform the
+identification, the function returns zero
+(@code{GPGME_DATA_TYPE_INVALID}). Note that depending on how the data
+object has been created the identification may not be possible or the
+data object may change its internal state (file pointer moved). For
+file or memory based data object, the state should not change.
+@end deftypefun
+
@c
@c Chapter Contexts
@@ -4785,6 +4836,11 @@ list of signers in the context @var{ctx}.
Calling this function acquires an additional reference for the key.
@end deftypefun
+@deftypefun @w{unsigned int} gpgme_signers_count (@w{const gpgme_ctx_t @var{ctx}})
+The function @code{gpgme_signers_count} returns the number of signer keys in
+the context @var{ctx}.
+@end deftypefun
+
@deftypefun gpgme_key_t gpgme_signers_enum (@w{const gpgme_ctx_t @var{ctx}}, @w{int @var{seq}})
The function @code{gpgme_signers_enum} returns the @var{seq}th key in
the list of signers in the context @var{ctx}. An additional reference
@@ -4988,7 +5044,7 @@ ciphertext created is determined by the @acronym{ASCII} armor (or, if
that is not set, by the encoding specified for @var{cipher}) and the
text mode attributes set for the context @var{ctx}.
-@var{key} must be a @code{NULL}-terminated array of keys. The user
+@var{recp} must be a @code{NULL}-terminated array of keys. The user
must keep references for all keys during the whole duration of the
call (but see @code{gpgme_op_encrypt_start} for the requirements with
the asynchronous variant).
diff --git a/doc/stamp-vti b/doc/stamp-vti
index 42d8cc5..639222e 100644
--- a/doc/stamp-vti
+++ b/doc/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 28 May 2013
-@set UPDATED-MONTH May 2013
-@set EDITION 1.4.2
-@set VERSION 1.4.2
+@set UPDATED 9 August 2013
+@set UPDATED-MONTH August 2013
+@set EDITION 1.4.3
+@set VERSION 1.4.3
diff --git a/doc/uiserver.texi b/doc/uiserver.texi
index f3cd8ad..859ae02 100644
--- a/doc/uiserver.texi
+++ b/doc/uiserver.texi
@@ -61,7 +61,7 @@ commands are to be used:
@deffn Command INPUT FD=@var{n}
Set the file descriptor for the message to be encrypted to @var{n}. The
-message send to the server is binary encoded.
+message send to the server is binary encoded.
GpgOL is a Windows only program, thus @var{n} is not a libc file
descriptor but a regular system handle. Given that the Assuan
@@ -77,14 +77,15 @@ time replaces the file descriptor set by the last one.
@c %Libassuan manual}, on how to do descriptor passing.
@end deffn
-@deffn Command OUTPUT FD=@var{n}
+@deffn Command OUTPUT FD=@var{n} [--binary]
Set the file descriptor to be used for the output (i.e. the encrypted
-message) to @var{n}. For OpenPGP, the output needs to be ASCII armored;
-for CMS, the output needs to be Base-64 encoded. For details on the
-file descriptor, see the @code{INPUT} command.
+message) to @var{n}. If the option @code{--binary} is given the
+output shall be in binary format; if not given, the output for OpenPGP
+needs to be ASCII armored and for CMS Base-64 encoded. For details on
+the file descriptor, see the @code{INPUT} command.
@end deffn
-@noindent
+@noindent
The setting of the recipients, the data source and destination may
happen in any order, even intermixed. If this has been done the actual
encryption operation is called using:
@@ -193,12 +194,13 @@ descriptor, see the description of @code{INPUT} in the @code{ENCRYPT}
section.
@end deffn
-@deffn Command OUTPUT FD=@var{n}
-Set the file descriptor to be used for the output. The output is either
-the complete signed message or in case of a detached signature just that
-detached signature. For OpenPGP, the output needs to be ASCII armored;
-for CMS, the output needs to be Base-64 encoded. For details on the
-file descriptor, see the @code{INPUT} command.
+@deffn Command OUTPUT FD=@var{n} [--binary]
+Set the file descriptor to be used for the output. The output is
+either the complete signed message or in case of a detached signature
+just that detached signature. If the option @code{--binary} is given
+the output shall be in binary format; if not given, the output for
+OpenPGP needs to be ASCII armored and for CMS Base-64 encoded. For
+details on the file descriptor, see the @code{INPUT} command.
@end deffn
@noindent
@@ -209,7 +211,7 @@ SENDER}.
@noindent
The signing operation is then initiated by:
-@deffn Command SIGN -@w{}-protocol=@var{name} [-@w{}-detached]
+@deffn Command SIGN -@w{}-protocol=@var{name} [-@w{}-detached]
Sign the data set with the @code{INPUT} command and write it to the sink
set by OUTPUT. @var{name} is the signing protocol used for the
message. For a description of the allowed protocols see the
@@ -272,7 +274,7 @@ is an OpenPGP combined message.
The server needs to support the verification of opaque signatures as
well as detached signatures. The kind of input sources controls what
-kind message is to be verified.
+kind message is to be verified.
@deffn Command MESSAGE FD=@var{n}
This command is used with detached signatures to set the file descriptor
@@ -309,7 +311,7 @@ to select the appropriate verification mode:
@table @asis
@item MESSAGE and INPUT
This indicates a detached signature. Output data is not applicable.
-@item INPUT
+@item INPUT
This indicates an opaque signature. As no output command has been given,
the server is only required to check the signature.
@item INPUT and OUTPUT
@@ -338,7 +340,7 @@ The signature is fully valid.
The signature is valid but additional information was shown regarding the
validity of the key.
@item red
-The signature is not valid.
+The signature is not valid.
@end table
@var{displaystring} is a percent-and-plus-encoded string with a short
@@ -539,7 +541,7 @@ data line.
To allow the server to pop up the windows in the correct relation to the
client, the client is advised to tell the server by sending the option:
-@deffn {Command option} window-id @var{number}
+@deffn {Command option} window-id @var{number}
The @var{number} represents the native window ID of the clients current
window. On Windows systems this is a windows handle (@code{HWND}) and
on X11 systems it is the @code{X Window ID}. The number needs to be
@@ -592,7 +594,7 @@ The option @option{--protocol} may be used to give the server a hint on
which signing protocol should be preferred.
@end deffn
-@noindent
+@noindent
To allow the UI-server to visually identify a running operation or to
associate operations the server MAY support the command:
diff --git a/doc/version.texi b/doc/version.texi
index 42d8cc5..639222e 100644
--- a/doc/version.texi
+++ b/doc/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED 28 May 2013
-@set UPDATED-MONTH May 2013
-@set EDITION 1.4.2
-@set VERSION 1.4.2
+@set UPDATED 9 August 2013
+@set UPDATED-MONTH August 2013
+@set EDITION 1.4.3
+@set VERSION 1.4.3
diff --git a/gpgme.spec b/gpgme.spec
index 35f23a4..6878a98 100644
--- a/gpgme.spec
+++ b/gpgme.spec
@@ -1,7 +1,7 @@
# This is a template. The dist target uses it to create the real file.
Summary: GPGME - GnuPG Made Easy
Name: gpgme
-Version: 1.4.2
+Version: 1.4.3
Release: 1
URL: http://www.gnupg.org/gpgme.html
Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz
diff --git a/lang/cl/gpgme.asd b/lang/cl/gpgme.asd
index d55cd92..615014d 100644
--- a/lang/cl/gpgme.asd
+++ b/lang/cl/gpgme.asd
@@ -27,7 +27,7 @@
(defsystem gpgme
:description "GnuPG Made Easy."
:author "g10 Code GmbH"
- :version "1.4.2"
+ :version "1.4.3"
:licence "GPL"
:depends-on ("cffi" "gpg-error")
:components ((:file "gpgme-package")
diff --git a/src/Makefile.am b/src/Makefile.am
index fa3b077..1f95103 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -103,8 +103,9 @@ endif
# unresolved symbols to the thread module.
main_sources = \
util.h conversion.c get-env.c context.h ops.h \
+ parsetlv.c parsetlv.h \
data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \
- data-compat.c \
+ data-compat.c data-identify.c \
signers.c sig-notation.c \
wait.c wait-global.c wait-private.c wait-user.c wait.h \
op-support.c \
@@ -118,7 +119,7 @@ main_sources = \
$(uiserver_components) \
$(g13_components) vfs-mount.c vfs-create.c \
gpgconf.c \
- sema.h priv-io.h $(system_components) dirinfo.c \
+ sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \
debug.c debug.h gpgme.c version.c error.c
libgpgme_la_SOURCES = $(main_sources) \
diff --git a/src/Makefile.in b/src/Makefile.in
index 49c7c28..145e234 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -128,20 +128,21 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libexecdir)" \
LTLIBRARIES = $(lib_LTLIBRARIES)
@HAVE_W32_SYSTEM_TRUE@am__DEPENDENCIES_1 = versioninfo.lo
am__libgpgme_glib_la_SOURCES_DIST = util.h conversion.c get-env.c \
- context.h ops.h data.h data.c data-fd.c data-stream.c \
- data-mem.c data-user.c data-compat.c signers.c sig-notation.c \
- wait.c wait-global.c wait-private.c wait-user.c wait.h \
- op-support.c encrypt.c encrypt-sign.c decrypt.c \
- decrypt-verify.c verify.c sign.c passphrase.c progress.c key.c \
- keylist.c trust-item.c trustlist.c import.c export.c genkey.c \
- delete.c edit.c getauditlog.c opassuan.c passwd.c engine.h \
- engine-backend.h engine.c engine-gpg.c status-table.c \
- engine-gpgsm.c assuan-support.c engine-assuan.c \
- engine-gpgconf.c engine-uiserver.c engine-g13.c vfs-mount.c \
- vfs-create.c gpgconf.c sema.h priv-io.h ath.h posix-util.c \
- posix-sema.c posix-io.c w32-ce.h w32-ce.c w32-util.c \
- w32-sema.c dirinfo.c debug.c debug.h gpgme.c version.c error.c \
- ath.c w32-glib-io.c
+ context.h ops.h parsetlv.c parsetlv.h data.h data.c data-fd.c \
+ data-stream.c data-mem.c data-user.c data-compat.c \
+ data-identify.c signers.c sig-notation.c wait.c wait-global.c \
+ wait-private.c wait-user.c wait.h op-support.c encrypt.c \
+ encrypt-sign.c decrypt.c decrypt-verify.c verify.c sign.c \
+ passphrase.c progress.c key.c keylist.c trust-item.c \
+ trustlist.c import.c export.c genkey.c delete.c edit.c \
+ getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
+ engine.c engine-gpg.c status-table.c engine-gpgsm.c \
+ assuan-support.c engine-assuan.c engine-gpgconf.c \
+ engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \
+ gpgconf.c sema.h priv-io.h ath.h posix-util.c posix-sema.c \
+ posix-io.c w32-ce.h w32-ce.c w32-util.c w32-sema.c sys-util.h \
+ dirinfo.c debug.c debug.h gpgme.c version.c error.c ath.c \
+ w32-glib-io.c
@HAVE_GPGSM_TRUE@am__objects_1 = engine-gpgsm.lo
@HAVE_ASSUAN_TRUE@am__objects_2 = assuan-support.lo engine-assuan.lo
@HAVE_GPGCONF_TRUE@am__objects_3 = engine-gpgconf.lo
@@ -152,18 +153,19 @@ am__libgpgme_glib_la_SOURCES_DIST = util.h conversion.c get-env.c \
@HAVE_DOSISH_SYSTEM_FALSE@ posix-io.lo $(am__objects_6)
@HAVE_DOSISH_SYSTEM_TRUE@am__objects_7 = w32-util.lo w32-sema.lo \
@HAVE_DOSISH_SYSTEM_TRUE@ $(am__objects_6)
-am__objects_8 = conversion.lo get-env.lo data.lo data-fd.lo \
- data-stream.lo data-mem.lo data-user.lo data-compat.lo \
- signers.lo sig-notation.lo wait.lo wait-global.lo \
- wait-private.lo wait-user.lo op-support.lo encrypt.lo \
- encrypt-sign.lo decrypt.lo decrypt-verify.lo verify.lo sign.lo \
- passphrase.lo progress.lo key.lo keylist.lo trust-item.lo \
- trustlist.lo import.lo export.lo genkey.lo delete.lo edit.lo \
- getauditlog.lo opassuan.lo passwd.lo engine.lo engine-gpg.lo \
- status-table.lo $(am__objects_1) $(am__objects_2) \
- $(am__objects_3) $(am__objects_4) $(am__objects_5) \
- vfs-mount.lo vfs-create.lo gpgconf.lo $(am__objects_7) \
- dirinfo.lo debug.lo gpgme.lo version.lo error.lo
+am__objects_8 = conversion.lo get-env.lo parsetlv.lo data.lo \
+ data-fd.lo data-stream.lo data-mem.lo data-user.lo \
+ data-compat.lo data-identify.lo signers.lo sig-notation.lo \
+ wait.lo wait-global.lo wait-private.lo wait-user.lo \
+ op-support.lo encrypt.lo encrypt-sign.lo decrypt.lo \
+ decrypt-verify.lo verify.lo sign.lo passphrase.lo progress.lo \
+ key.lo keylist.lo trust-item.lo trustlist.lo import.lo \
+ export.lo genkey.lo delete.lo edit.lo getauditlog.lo \
+ opassuan.lo passwd.lo engine.lo engine-gpg.lo status-table.lo \
+ $(am__objects_1) $(am__objects_2) $(am__objects_3) \
+ $(am__objects_4) $(am__objects_5) vfs-mount.lo vfs-create.lo \
+ gpgconf.lo $(am__objects_7) dirinfo.lo debug.lo gpgme.lo \
+ version.lo error.lo
@BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_OBJECTS = $(am__objects_8) \
@BUILD_W32_GLIB_TRUE@ ath.lo w32-glib-io.lo
libgpgme_glib_la_OBJECTS = $(am_libgpgme_glib_la_OBJECTS)
@@ -172,19 +174,20 @@ libgpgme_glib_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(libgpgme_glib_la_LDFLAGS) $(LDFLAGS) -o $@
@BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_rpath = -rpath $(libdir)
am__libgpgme_pthread_la_SOURCES_DIST = util.h conversion.c get-env.c \
- context.h ops.h data.h data.c data-fd.c data-stream.c \
- data-mem.c data-user.c data-compat.c signers.c sig-notation.c \
- wait.c wait-global.c wait-private.c wait-user.c wait.h \
- op-support.c encrypt.c encrypt-sign.c decrypt.c \
- decrypt-verify.c verify.c sign.c passphrase.c progress.c key.c \
- keylist.c trust-item.c trustlist.c import.c export.c genkey.c \
- delete.c edit.c getauditlog.c opassuan.c passwd.c engine.h \
- engine-backend.h engine.c engine-gpg.c status-table.c \
- engine-gpgsm.c assuan-support.c engine-assuan.c \
- engine-gpgconf.c engine-uiserver.c engine-g13.c vfs-mount.c \
- vfs-create.c gpgconf.c sema.h priv-io.h ath.h posix-util.c \
- posix-sema.c posix-io.c w32-ce.h w32-ce.c w32-util.c \
- w32-sema.c dirinfo.c debug.c debug.h gpgme.c version.c error.c \
+ context.h ops.h parsetlv.c parsetlv.h data.h data.c data-fd.c \
+ data-stream.c data-mem.c data-user.c data-compat.c \
+ data-identify.c signers.c sig-notation.c wait.c wait-global.c \
+ wait-private.c wait-user.c wait.h op-support.c encrypt.c \
+ encrypt-sign.c decrypt.c decrypt-verify.c verify.c sign.c \
+ passphrase.c progress.c key.c keylist.c trust-item.c \
+ trustlist.c import.c export.c genkey.c delete.c edit.c \
+ getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
+ engine.c engine-gpg.c status-table.c engine-gpgsm.c \
+ assuan-support.c engine-assuan.c engine-gpgconf.c \
+ engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \
+ gpgconf.c sema.h priv-io.h ath.h posix-util.c posix-sema.c \
+ posix-io.c w32-ce.h w32-ce.c w32-util.c w32-sema.c sys-util.h \
+ dirinfo.c debug.c debug.h gpgme.c version.c error.c \
ath-pthread.c w32-io.c
@HAVE_DOSISH_SYSTEM_TRUE@am__objects_9 = w32-io.lo
am_libgpgme_pthread_la_OBJECTS = $(am__objects_8) ath-pthread.lo \
@@ -195,20 +198,21 @@ libgpgme_pthread_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(libgpgme_pthread_la_LDFLAGS) $(LDFLAGS) -o $@
@HAVE_PTHREAD_TRUE@am_libgpgme_pthread_la_rpath = -rpath $(libdir)
am__libgpgme_qt_la_SOURCES_DIST = util.h conversion.c get-env.c \
- context.h ops.h data.h data.c data-fd.c data-stream.c \
- data-mem.c data-user.c data-compat.c signers.c sig-notation.c \
- wait.c wait-global.c wait-private.c wait-user.c wait.h \
- op-support.c encrypt.c encrypt-sign.c decrypt.c \
- decrypt-verify.c verify.c sign.c passphrase.c progress.c key.c \
- keylist.c trust-item.c trustlist.c import.c export.c genkey.c \
- delete.c edit.c getauditlog.c opassuan.c passwd.c engine.h \
- engine-backend.h engine.c engine-gpg.c status-table.c \
- engine-gpgsm.c assuan-support.c engine-assuan.c \
- engine-gpgconf.c engine-uiserver.c engine-g13.c vfs-mount.c \
- vfs-create.c gpgconf.c sema.h priv-io.h ath.h posix-util.c \
- posix-sema.c posix-io.c w32-ce.h w32-ce.c w32-util.c \
- w32-sema.c dirinfo.c debug.c debug.h gpgme.c version.c error.c \
- ath.c w32-qt-io.cpp kdpipeiodevice.h kdpipeiodevice.cpp \
+ context.h ops.h parsetlv.c parsetlv.h data.h data.c data-fd.c \
+ data-stream.c data-mem.c data-user.c data-compat.c \
+ data-identify.c signers.c sig-notation.c wait.c wait-global.c \
+ wait-private.c wait-user.c wait.h op-support.c encrypt.c \
+ encrypt-sign.c decrypt.c decrypt-verify.c verify.c sign.c \
+ passphrase.c progress.c key.c keylist.c trust-item.c \
+ trustlist.c import.c export.c genkey.c delete.c edit.c \
+ getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
+ engine.c engine-gpg.c status-table.c engine-gpgsm.c \
+ assuan-support.c engine-assuan.c engine-gpgconf.c \
+ engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \
+ gpgconf.c sema.h priv-io.h ath.h posix-util.c posix-sema.c \
+ posix-io.c w32-ce.h w32-ce.c w32-util.c w32-sema.c sys-util.h \
+ dirinfo.c debug.c debug.h gpgme.c version.c error.c ath.c \
+ w32-qt-io.cpp kdpipeiodevice.h kdpipeiodevice.cpp \
kdpipeiodevice.moc
@BUILD_W32_QT_TRUE@am_libgpgme_qt_la_OBJECTS = $(am__objects_8) ath.lo \
@BUILD_W32_QT_TRUE@ w32-qt-io.lo kdpipeiodevice.lo
@@ -218,19 +222,21 @@ libgpgme_qt_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(CXXFLAGS) $(libgpgme_qt_la_LDFLAGS) $(LDFLAGS) -o $@
@BUILD_W32_QT_TRUE@am_libgpgme_qt_la_rpath = -rpath $(libdir)
am__libgpgme_la_SOURCES_DIST = util.h conversion.c get-env.c context.h \
- ops.h data.h data.c data-fd.c data-stream.c data-mem.c \
- data-user.c data-compat.c signers.c sig-notation.c wait.c \
- wait-global.c wait-private.c wait-user.c wait.h op-support.c \
- encrypt.c encrypt-sign.c decrypt.c decrypt-verify.c verify.c \
- sign.c passphrase.c progress.c key.c keylist.c trust-item.c \
+ ops.h parsetlv.c parsetlv.h data.h data.c data-fd.c \
+ data-stream.c data-mem.c data-user.c data-compat.c \
+ data-identify.c signers.c sig-notation.c wait.c wait-global.c \
+ wait-private.c wait-user.c wait.h op-support.c encrypt.c \
+ encrypt-sign.c decrypt.c decrypt-verify.c verify.c sign.c \
+ passphrase.c progress.c key.c keylist.c trust-item.c \
trustlist.c import.c export.c genkey.c delete.c edit.c \
getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
engine.c engine-gpg.c status-table.c engine-gpgsm.c \
assuan-support.c engine-assuan.c engine-gpgconf.c \
engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \
gpgconf.c sema.h priv-io.h ath.h posix-util.c posix-sema.c \
- posix-io.c w32-ce.h w32-ce.c w32-util.c w32-sema.c dirinfo.c \
- debug.c debug.h gpgme.c version.c error.c ath.c w32-io.c
+ posix-io.c w32-ce.h w32-ce.c w32-util.c w32-sema.c sys-util.h \
+ dirinfo.c debug.c debug.h gpgme.c version.c error.c ath.c \
+ w32-io.c
am_libgpgme_la_OBJECTS = $(am__objects_8) ath.lo $(am__objects_9)
libgpgme_la_OBJECTS = $(am_libgpgme_la_OBJECTS)
libgpgme_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -485,8 +491,9 @@ lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib) $(ltlib_gpgme_qt) \
# unresolved symbols to the thread module.
main_sources = \
util.h conversion.c get-env.c context.h ops.h \
+ parsetlv.c parsetlv.h \
data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \
- data-compat.c \
+ data-compat.c data-identify.c \
signers.c sig-notation.c \
wait.c wait-global.c wait-private.c wait-user.c wait.h \
op-support.c \
@@ -500,7 +507,7 @@ main_sources = \
$(uiserver_components) \
$(g13_components) vfs-mount.c vfs-create.c \
gpgconf.c \
- sema.h priv-io.h $(system_components) dirinfo.c \
+ sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \
debug.c debug.h gpgme.c version.c error.c
libgpgme_la_SOURCES = $(main_sources) \
@@ -766,6 +773,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conversion.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-compat.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-fd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-identify.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-mem.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-stream.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-user.Plo@am__quote@
@@ -800,6 +808,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keylist.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/op-support.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opassuan.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsetlv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passphrase.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passwd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix-io.Plo@am__quote@
diff --git a/src/data-identify.c b/src/data-identify.c
new file mode 100644
index 0000000..9600633
--- /dev/null
+++ b/src/data-identify.c
@@ -0,0 +1,247 @@
+/* data-identify.c - Try to identify the data
+ Copyright (C) 2013 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "gpgme.h"
+#include "data.h"
+#include "util.h"
+#include "parsetlv.h"
+
+/* The size of the sample data we take for detection. */
+#define SAMPLE_SIZE 2048
+
+
+
+/* Note that DATA may be binary but a final nul is required so that
+ string operations will find a terminator.
+
+ Returns: GPGME_DATA_TYPE_xxxx */
+static gpgme_data_type_t
+basic_detection (const char *data, size_t datalen)
+{
+ tlvinfo_t ti;
+ const char *s;
+ size_t n;
+ int maybe_p12 = 0;
+
+ if (datalen < 24) /* Object is probably too short for detection. */
+ return GPGME_DATA_TYPE_UNKNOWN;
+
+ /* This is a common example of a CMS object - it is obvious that we
+ only need to read a few bytes to get to the OID:
+ 30 82 0B 59 06 09 2A 86 48 86 F7 0D 01 07 02 A0 82 0B 4A 30 82 0B 46 02
+ ----------- ++++++++++++++++++++++++++++++++
+ SEQUENCE OID (signedData)
+ (2 byte len)
+
+ A PKCS#12 message is:
+
+ 30 82 08 59 02 01 03 30 82 08 1F 06 09 2A 86 48 86 F7 0D 01 07 01 A0 82
+ ----------- ++++++++ ----------- ++++++++++++++++++++++++++++++++
+ SEQUENCE INTEGER SEQUENCE OID (data)
+
+ A X.509 certificate is:
+
+ 30 82 05 B8 30 82 04 A0 A0 03 02 01 02 02 07 15 46 A0 BF 30 07 39 30 0D
+ ----------- +++++++++++ ----- ++++++++ --------------------------
+ SEQUENCE SEQUENCE [0] INTEGER INTEGER SEQU
+ (tbs) (version) (s/n) (Algo)
+
+ Thus we need to read at least 22 bytes, we add 2 bytes to cope with
+ length headers stored with 4 bytes.
+ */
+
+
+ s = data;
+ n = datalen;
+
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp; /* Not properly BER encoded. */
+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_SEQUENCE
+ && ti.is_cons))
+ goto try_pgp; /* A CMS object always starts with a sequence. */
+
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp; /* Not properly BER encoded. */
+ if (ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_SEQUENCE
+ && ti.is_cons && n >= ti.length)
+ {
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp;
+ if (!(ti.cls == ASN1_CLASS_CONTEXT && ti.tag == 0
+ && ti.is_cons && ti.length == 3 && n >= ti.length))
+ goto try_pgp;
+
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp;
+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_INTEGER
+ && !ti.is_cons && ti.length == 1 && n && (*s == 1 || *s == 2)))
+ goto try_pgp;
+ s++;
+ n--;
+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_INTEGER
+ && !ti.is_cons))
+ goto try_pgp;
+ /* Because the now following S/N may be larger than the sample
+ data we have, we stop parsing here and don't check for the
+ algorithm ID. */
+ return GPGME_DATA_TYPE_X509_CERT;
+ }
+ if (ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_INTEGER
+ && !ti.is_cons && ti.length == 1 && n && *s == 3)
+ {
+ maybe_p12 = 1;
+ s++;
+ n--;
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp;
+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_SEQUENCE
+ && ti.is_cons))
+ goto try_pgp;
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp;
+ }
+ if (ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_OBJECT_ID
+ && !ti.is_cons && ti.length && n >= ti.length)
+ {
+ if (ti.length == 9)
+ {
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x01", 9))
+ {
+ /* Data. */
+ return (maybe_p12 ? GPGME_DATA_TYPE_PKCS12
+ /* */ : GPGME_DATA_TYPE_CMS_OTHER);
+ }
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x02", 9))
+ {
+ /* Signed Data. */
+ return (maybe_p12 ? GPGME_DATA_TYPE_PKCS12
+ /* */ : GPGME_DATA_TYPE_CMS_SIGNED);
+ }
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x03", 9))
+ return GPGME_DATA_TYPE_CMS_ENCRYPTED; /* Enveloped Data. */
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x05", 9))
+ return GPGME_DATA_TYPE_CMS_OTHER; /* Digested Data. */
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x06", 9))
+ return GPGME_DATA_TYPE_CMS_OTHER; /* Encrypted Data. */
+ }
+ else if (ti.length == 11)
+ {
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x09\x10\x01\x02", 11))
+ return GPGME_DATA_TYPE_CMS_OTHER; /* Auth Data. */
+ }
+ }
+
+
+ try_pgp:
+ /* Check whether this might be a non-armored PGP message. We need
+ to do this before checking for armor lines, so that we don't get
+ fooled by armored messages inside a signed binary PGP message. */
+ if ((data[0] & 0x80))
+ {
+ /* That might be a binary PGP message. At least it is not plain
+ ASCII. Of course this might be certain lead-in text of
+ armored CMS messages. However, I am not sure whether this is
+ at all defined and in any case it is uncommon. Thus we don't
+ do any further plausibility checks but stupidly assume no CMS
+ armored data will follow. */
+ return GPGME_DATA_TYPE_UNKNOWN;
+ }
+
+ /* Now check whether there are armor lines. */
+ for (s = data; s && *s; s = (*s=='\n')?(s+1):((s=strchr (s,'\n'))?(s+1):s))
+ {
+ if (!strncmp (s, "-----BEGIN ", 11))
+ {
+ if (!strncmp (s+11, "SIGNED ", 7))
+ return GPGME_DATA_TYPE_CMS_SIGNED;
+ if (!strncmp (s+11, "ENCRYPTED ", 10))
+ return GPGME_DATA_TYPE_CMS_ENCRYPTED;
+ if (!strncmp (s+11, "PGP ", 4))
+ {
+ if (!strncmp (s+15, "SIGNATURE", 9))
+ return GPGME_DATA_TYPE_PGP_SIGNED;
+ if (!strncmp (s+15, "SIGNED MESSAGE", 14))
+ return GPGME_DATA_TYPE_PGP_SIGNED;
+ if (!strncmp (s+15, "PUBLIC KEY BLOCK", 16))
+ return GPGME_DATA_TYPE_PGP_KEY;
+ if (!strncmp (s+15, "PRIVATE KEY BLOCK", 17))
+ return GPGME_DATA_TYPE_PGP_KEY;
+ if (!strncmp (s+15, "SECRET KEY BLOCK", 16))
+ return GPGME_DATA_TYPE_PGP_KEY;
+ if (!strncmp (s+15, "ARMORED FILE", 12))
+ return GPGME_DATA_TYPE_UNKNOWN;
+ return GPGME_DATA_TYPE_PGP_OTHER; /* PGP MESSAGE */
+ }
+ if (!strncmp (s+11, "CERTIFICATE", 11))
+ return GPGME_DATA_TYPE_X509_CERT;
+ if (!strncmp (s+11, "PKCS12", 6))
+ return GPGME_DATA_TYPE_PKCS12;
+ return GPGME_DATA_TYPE_CMS_OTHER; /* Not PGP, thus we assume CMS. */
+ }
+ }
+
+ return GPGME_DATA_TYPE_UNKNOWN;
+}
+
+
+/* Try to detect the type of the data. Note that this function works
+ only on seekable data objects. The function tries to reset the
+ file pointer but there is no guarantee that it will work.
+
+ FIXME: We may want to add internal buffering so that this function
+ can be implemented for allmost all kind of data objects.
+ */
+gpgme_data_type_t
+gpgme_data_identify (gpgme_data_t dh, int reserved)
+{
+ gpgme_data_type_t result;
+ char *sample;
+ int n;
+ gpgme_off_t off;
+
+ /* Check whether we can seek the data object. */
+ off = gpgme_data_seek (dh, 0, SEEK_CUR);
+ if (off == (gpgme_off_t)(-1))
+ return GPGME_DATA_TYPE_INVALID;
+
+ /* Allocate a buffer and read the data. */
+ sample = malloc (SAMPLE_SIZE);
+ if (!sample)
+ return GPGME_DATA_TYPE_INVALID; /* Ooops. */
+ n = gpgme_data_read (dh, sample, SAMPLE_SIZE - 1);
+ if (n < 0)
+ {
+ free (sample);
+ return GPGME_DATA_TYPE_INVALID; /* Ooops. */
+ }
+ sample[n] = 0; /* (Required for our string functions.) */
+
+ result = basic_detection (sample, n);
+ free (sample);
+ gpgme_data_seek (dh, off, SEEK_SET);
+
+ return result;
+}
diff --git a/src/dirinfo.c b/src/dirinfo.c
index 267e988..27c0dd7 100644
--- a/src/dirinfo.c
+++ b/src/dirinfo.c
@@ -1,5 +1,5 @@
/* dirinfo.c - Get directory information
- * Copyright (C) 2009 g10 Code GmbH
+ * Copyright (C) 2009, 2013 g10 Code GmbH
*
* This file is part of GPGME.
*
@@ -29,6 +29,7 @@
#include "priv-io.h"
#include "debug.h"
#include "sema.h"
+#include "sys-util.h"
DEFINE_STATIC_LOCK (dirinfo_lock);
@@ -36,7 +37,11 @@ DEFINE_STATIC_LOCK (dirinfo_lock);
enum
{
WANT_HOMEDIR,
- WANT_AGENT_SOCKET
+ WANT_AGENT_SOCKET,
+ WANT_GPG_NAME,
+ WANT_GPGSM_NAME,
+ WANT_G13_NAME,
+ WANT_UISRV_SOCKET
};
/* Values retrieved via gpgconf and cached here. */
@@ -44,13 +49,18 @@ static struct {
int valid; /* Cached information is valid. */
char *homedir;
char *agent_socket;
+ char *gpg_name;
+ char *gpgsm_name;
+ char *g13_name;
+ char *uisrv_socket;
} dirinfo;
/* Parse the output of "gpgconf --list-dirs". This function expects
- that DIRINFO_LOCK is held by the caller. */
+ that DIRINFO_LOCK is held by the caller. If COMPONENTS is set, the
+ output of --list-components is expected. */
static void
-parse_output (char *line)
+parse_output (char *line, int components)
{
char *value, *p;
@@ -58,6 +68,14 @@ parse_output (char *line)
if (!value)
return;
*value++ = 0;
+ if (components)
+ {
+ /* Skip the second field. */
+ value = strchr (value, ':');
+ if (!value)
+ return;
+ *value++ = 0;
+ }
p = strchr (value, ':');
if (p)
*p = 0;
@@ -66,19 +84,45 @@ parse_output (char *line)
if (!*value)
return;
- if (!strcmp (line, "homedir") && !dirinfo.homedir)
- dirinfo.homedir = strdup (value);
- else if (!strcmp (line, "agent-socket") && !dirinfo.agent_socket)
- dirinfo.agent_socket = strdup (value);
+ if (components)
+ {
+ if (!strcmp (line, "gpg") && !dirinfo.gpg_name)
+ dirinfo.gpg_name = strdup (value);
+ else if (!strcmp (line, "gpgsm") && !dirinfo.gpgsm_name)
+ dirinfo.gpgsm_name = strdup (value);
+ else if (!strcmp (line, "g13") && !dirinfo.g13_name)
+ dirinfo.g13_name = strdup (value);
+ }
+ else
+ {
+ if (!strcmp (line, "homedir") && !dirinfo.homedir)
+ {
+ const char name[] = "S.uiserver";
+
+ dirinfo.homedir = strdup (value);
+ if (dirinfo.homedir)
+ {
+ dirinfo.uisrv_socket = malloc (strlen (dirinfo
+ .homedir)
+ + 1 + strlen (name) + 1);
+ if (dirinfo.uisrv_socket)
+ strcpy (stpcpy (stpcpy (dirinfo.uisrv_socket, dirinfo.homedir),
+ DIRSEP_S), name);
+ }
+ }
+ else if (!strcmp (line, "agent-socket") && !dirinfo.agent_socket)
+ dirinfo.agent_socket = strdup (value);
+ }
}
/* Read the directory information from gpgconf. This function expects
- that DIRINFO_LOCK is held by the caller. */
+ that DIRINFO_LOCK is held by the caller. PGNAME is the name of the
+ gpgconf binary. If COMPONENTS is set, not the directories bit the
+ name of the componeNts are read. */
static void
-read_gpgconf_dirs (void)
+read_gpgconf_dirs (const char *pgmname, int components)
{
- const char *pgmname;
char linebuf[1024] = {0};
int linelen = 0;
char * argv[3];
@@ -89,12 +133,8 @@ read_gpgconf_dirs (void)
int nread;
char *mark = NULL;
- pgmname = _gpgme_get_gpgconf_path ();
- if (!pgmname)
- return; /* No way. */
-
argv[0] = (char *)pgmname;
- argv[1] = "--list-dirs";
+ argv[1] = components? "--list-components" : "--list-dirs";
argv[2] = NULL;
if (_gpgme_io_pipe (rp, 1) < 0)
@@ -132,7 +172,7 @@ read_gpgconf_dirs (void)
else
mark[0] = '\0';
- parse_output (line);
+ parse_output (line, components);
}
nused = lastmark? (lastmark + 1 - linebuf) : 0;
@@ -147,14 +187,38 @@ read_gpgconf_dirs (void)
static const char *
-get_gpgconf_dir (int what)
+get_gpgconf_item (int what)
{
const char *result = NULL;
LOCK (dirinfo_lock);
if (!dirinfo.valid)
{
- read_gpgconf_dirs ();
+ const char *pgmname;
+
+ pgmname = _gpgme_get_gpgconf_path ();
+ if (pgmname && access (pgmname, F_OK))
+ {
+ _gpgme_debug (DEBUG_INIT,
+ "gpgme_dinfo: gpgconf='%s' [not installed]\n", pgmname);
+ pgmname = NULL; /* Not available. */
+ }
+ else
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpgconf='%s'\n",
+ pgmname? pgmname : "[null]");
+ if (!pgmname)
+ {
+ /* Probably gpgconf is not installed. Assume we are using
+ GnuPG-1. */
+ pgmname = _gpgme_get_gpg_path ();
+ if (pgmname)
+ dirinfo.gpg_name = strdup (pgmname);
+ }
+ else
+ {
+ read_gpgconf_dirs (pgmname, 0);
+ read_gpgconf_dirs (pgmname, 1);
+ }
/* Even if the reading of the directories failed (e.g. due to an
too old version gpgconf or no gpgconf at all), we need to
mark the entries as valid so that we won't try over and over
@@ -162,11 +226,33 @@ get_gpgconf_dir (int what)
the read values later because they are practically statically
allocated. */
dirinfo.valid = 1;
+ if (dirinfo.gpg_name)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpg='%s'\n",
+ dirinfo.gpg_name);
+ if (dirinfo.g13_name)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: g13='%s'\n",
+ dirinfo.g13_name);
+ if (dirinfo.gpgsm_name)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpgsm='%s'\n",
+ dirinfo.gpgsm_name);
+ if (dirinfo.homedir)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: homedir='%s'\n",
+ dirinfo.homedir);
+ if (dirinfo.agent_socket)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: agent='%s'\n",
+ dirinfo.agent_socket);
+ if (dirinfo.uisrv_socket)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: uisrv='%s'\n",
+ dirinfo.uisrv_socket);
}
switch (what)
{
case WANT_HOMEDIR: result = dirinfo.homedir; break;
case WANT_AGENT_SOCKET: result = dirinfo.agent_socket; break;
+ case WANT_GPG_NAME: result = dirinfo.gpg_name; break;
+ case WANT_GPGSM_NAME: result = dirinfo.gpgsm_name; break;
+ case WANT_G13_NAME: result = dirinfo.g13_name; break;
+ case WANT_UISRV_SOCKET: result = dirinfo.uisrv_socket; break;
}
UNLOCK (dirinfo_lock);
return result;
@@ -177,13 +263,51 @@ get_gpgconf_dir (int what)
const char *
_gpgme_get_default_homedir (void)
{
- return get_gpgconf_dir (WANT_HOMEDIR);
+ return get_gpgconf_item (WANT_HOMEDIR);
}
/* Return the default gpg-agent socket name. Returns NULL if not known. */
const char *
_gpgme_get_default_agent_socket (void)
{
- return get_gpgconf_dir (WANT_AGENT_SOCKET);
+ return get_gpgconf_item (WANT_AGENT_SOCKET);
+}
+
+/* Return the default gpg file name. Returns NULL if not known. */
+const char *
+_gpgme_get_default_gpg_name (void)
+{
+ return get_gpgconf_item (WANT_GPG_NAME);
+}
+
+/* Return the default gpgsm file name. Returns NULL if not known. */
+const char *
+_gpgme_get_default_gpgsm_name (void)
+{
+ return get_gpgconf_item (WANT_GPGSM_NAME);
+}
+
+/* Return the default g13 file name. Returns NULL if not known. */
+const char *
+_gpgme_get_default_g13_name (void)
+{
+ return get_gpgconf_item (WANT_G13_NAME);
}
+/* Return the default gpgconf file name. Returns NULL if not known.
+ Because gpgconf is the binary used to retrieved all these default
+ names, this function is merely a simple wrapper around the function
+ used to locate this binary. */
+const char *
+_gpgme_get_default_gpgconf_name (void)
+{
+ return _gpgme_get_gpgconf_path ();
+}
+
+/* Return the default UI-server socket name. Returns NULL if not
+ known. */
+const char *
+_gpgme_get_default_uisrv_socket (void)
+{
+ return get_gpgconf_item (WANT_UISRV_SOCKET);
+}
diff --git a/src/engine-g13.c b/src/engine-g13.c
index de0aac8..b97e0b4 100644
--- a/src/engine-g13.c
+++ b/src/engine-g13.c
@@ -100,7 +100,7 @@ static char *
g13_get_version (const char *file_name)
{
return _gpgme_get_program_version (file_name ? file_name
- : _gpgme_get_g13_path ());
+ : _gpgme_get_default_g13_name ());
}
@@ -251,11 +251,11 @@ g13_new (void **engine, const char *file_name, const char *home_dir)
#if USE_DESCRIPTOR_PASSING
err = assuan_pipe_connect
- (g13->assuan_ctx, file_name ? file_name : _gpgme_get_g13_path (),
+ (g13->assuan_ctx, file_name ? file_name : _gpgme_get_default_g13_name (),
argv, NULL, NULL, NULL, ASSUAN_PIPE_CONNECT_FDPASSING);
#else
err = assuan_pipe_connect
- (g13->assuan_ctx, file_name ? file_name : _gpgme_get_g13_path (),
+ (g13->assuan_ctx, file_name ? file_name : _gpgme_get_default_g13_name (),
argv, NULL, NULL, NULL, 0);
#endif
if (err)
@@ -757,7 +757,7 @@ g13_io_event (void *engine, gpgme_event_io_t type, void *type_data)
struct engine_ops _gpgme_engine_ops_g13 =
{
/* Static functions. */
- _gpgme_get_g13_path,
+ _gpgme_get_default_g13_name,
NULL,
g13_get_version,
g13_get_req_version,
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 72d3ad1..3bc9f66 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -296,7 +296,7 @@ static char *
gpg_get_version (const char *file_name)
{
return _gpgme_get_program_version (file_name ? file_name
- : _gpgme_get_gpg_path ());
+ : _gpgme_get_default_gpg_name ());
}
@@ -1296,7 +1296,7 @@ start (engine_gpg_t gpg)
if (!gpg)
return gpg_error (GPG_ERR_INV_VALUE);
- if (!gpg->file_name && !_gpgme_get_gpg_path ())
+ if (!gpg->file_name && !_gpgme_get_default_gpg_name ())
return trace_gpg_error (GPG_ERR_INV_ENGINE);
if (gpg->lc_ctype)
@@ -1352,7 +1352,7 @@ start (engine_gpg_t gpg)
fd_list[n].dup_to = -1;
status = _gpgme_io_spawn (gpg->file_name ? gpg->file_name :
- _gpgme_get_gpg_path (), gpg->argv,
+ _gpgme_get_default_gpg_name (), gpg->argv,
IOSPAWN_FLAG_ALLOW_SET_FG,
fd_list, NULL, NULL, &pid);
{
@@ -2401,7 +2401,7 @@ gpg_set_pinentry_mode (void *engine, gpgme_pinentry_mode_t mode)
struct engine_ops _gpgme_engine_ops_gpg =
{
/* Static functions. */
- _gpgme_get_gpg_path,
+ _gpgme_get_default_gpg_name,
NULL,
gpg_get_version,
gpg_get_req_version,
diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c
index 3a1c1c1..1d457bb 100644
--- a/src/engine-gpgconf.c
+++ b/src/engine-gpgconf.c
@@ -61,7 +61,7 @@ static char *
gpgconf_get_version (const char *file_name)
{
return _gpgme_get_program_version (file_name ? file_name
- : _gpgme_get_gpgconf_path ());
+ : _gpgme_get_default_gpgconf_name ());
}
@@ -100,7 +100,7 @@ gpgconf_new (void **engine, const char *file_name, const char *home_dir)
return gpg_error_from_syserror ();
gpgconf->file_name = strdup (file_name ? file_name
- : _gpgme_get_gpgconf_path ());
+ : _gpgme_get_default_gpgconf_name ());
if (!gpgconf->file_name)
err = gpg_error_from_syserror ();
@@ -923,7 +923,7 @@ _gpgme_conf_release (gpgme_conf_comp_t conf)
struct engine_ops _gpgme_engine_ops_gpgconf =
{
/* Static functions. */
- _gpgme_get_gpgconf_path,
+ _gpgme_get_default_gpgconf_name,
NULL,
gpgconf_get_version,
gpgconf_get_req_version,
diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c
index 391b632..cee20e3 100644
--- a/src/engine-gpgsm.c
+++ b/src/engine-gpgsm.c
@@ -120,7 +120,7 @@ static char *
gpgsm_get_version (const char *file_name)
{
return _gpgme_get_program_version (file_name ? file_name
- : _gpgme_get_gpgsm_path ());
+ : _gpgme_get_default_gpgsm_name ());
}
@@ -340,7 +340,8 @@ gpgsm_new (void **engine, const char *file_name, const char *home_dir)
#if USE_DESCRIPTOR_PASSING
err = assuan_pipe_connect
- (gpgsm->assuan_ctx, file_name ? file_name : _gpgme_get_gpgsm_path (),
+ (gpgsm->assuan_ctx,
+ file_name ? file_name : _gpgme_get_default_gpgsm_name (),
argv, NULL, NULL, NULL, ASSUAN_PIPE_CONNECT_FDPASSING);
#else
{
@@ -352,7 +353,8 @@ gpgsm_new (void **engine, const char *file_name, const char *home_dir)
achild_fds[i] = (assuan_fd_t) child_fds[i];
err = assuan_pipe_connect
- (gpgsm->assuan_ctx, file_name ? file_name : _gpgme_get_gpgsm_path (),
+ (gpgsm->assuan_ctx,
+ file_name ? file_name : _gpgme_get_default_gpgsm_name (),
argv, achild_fds, NULL, NULL, 0);
/* For now... */
@@ -1945,7 +1947,7 @@ gpgsm_passwd (void *engine, gpgme_key_t key, unsigned int flags)
struct engine_ops _gpgme_engine_ops_gpgsm =
{
/* Static functions. */
- _gpgme_get_gpgsm_path,
+ _gpgme_get_default_gpgsm_name,
NULL,
gpgsm_get_version,
gpgsm_get_req_version,
diff --git a/src/engine-uiserver.c b/src/engine-uiserver.c
index a0008e4..bd140f9 100644
--- a/src/engine-uiserver.c
+++ b/src/engine-uiserver.c
@@ -296,7 +296,7 @@ uiserver_new (void **engine, const char *file_name, const char *home_dir)
err = assuan_socket_connect (uiserver->assuan_ctx,
file_name ?
- file_name : _gpgme_get_uiserver_socket_path (),
+ file_name : _gpgme_get_default_uisrv_socket (),
0, ASSUAN_SOCKET_SERVER_FDPASSING);
if (err)
goto leave;
@@ -1302,7 +1302,7 @@ uiserver_io_event (void *engine, gpgme_event_io_t type, void *type_data)
struct engine_ops _gpgme_engine_ops_uiserver =
{
/* Static functions. */
- _gpgme_get_uiserver_socket_path,
+ _gpgme_get_default_uisrv_socket,
NULL,
uiserver_get_version,
uiserver_get_req_version,
diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c
index 0ebabab..2bf7654 100644
--- a/src/gpgme-tool.c
+++ b/src/gpgme-tool.c
@@ -1435,7 +1435,8 @@ typedef enum status
STATUS_INCLUDE_CERTS,
STATUS_KEYLIST_MODE,
STATUS_RECIPIENT,
- STATUS_ENCRYPT_RESULT
+ STATUS_ENCRYPT_RESULT,
+ STATUS_IDENTIFY_RESULT
} status_t;
const char *status_string[] =
@@ -1448,7 +1449,8 @@ const char *status_string[] =
"INCLUDE_CERTS",
"KEYLIST_MODE",
"RECIPIENT",
- "ENCRYPT_RESULT"
+ "ENCRYPT_RESULT",
+ "IDENTIFY_RESULT"
};
struct gpgme_tool
@@ -2065,11 +2067,6 @@ gt_vfs_create (gpgme_tool_t gt, const char *container_file, int flags)
}
-static const char hlp_passwd[] =
- "PASSWD <user-id>\n"
- "\n"
- "Ask the backend to change the passphrase for the key\n"
- "specified by USER-ID.";
gpg_error_t
gt_passwd (gpgme_tool_t gt, char *fpr)
{
@@ -2086,6 +2083,29 @@ gt_passwd (gpgme_tool_t gt, char *fpr)
}
+gpg_error_t
+gt_identify (gpgme_tool_t gt, gpgme_data_t data)
+{
+ const char *s = "?";
+
+ switch (gpgme_data_identify (data, 0))
+ {
+ case GPGME_DATA_TYPE_INVALID: return gpg_error (GPG_ERR_GENERAL);
+ case GPGME_DATA_TYPE_UNKNOWN : s = "unknown"; break;
+ case GPGME_DATA_TYPE_PGP_SIGNED : s = "PGP-signed"; break;
+ case GPGME_DATA_TYPE_PGP_OTHER : s = "PGP"; break;
+ case GPGME_DATA_TYPE_PGP_KEY : s = "PGP-key"; break;
+ case GPGME_DATA_TYPE_CMS_SIGNED : s = "CMS-signed"; break;
+ case GPGME_DATA_TYPE_CMS_ENCRYPTED: s = "CMS-encrypted"; break;
+ case GPGME_DATA_TYPE_CMS_OTHER : s = "CMS"; break;
+ case GPGME_DATA_TYPE_X509_CERT : s = "X.509"; break;
+ case GPGME_DATA_TYPE_PKCS12 : s = "PKCS12"; break;
+ }
+ gt_write_status (gt, STATUS_IDENTIFY_RESULT, s, NULL);
+ return 0;
+}
+
+
#define GT_RESULT_ENCRYPT 0x1
#define GT_RESULT_DECRYPT 0x2
#define GT_RESULT_SIGN 0x4
@@ -3374,6 +3394,11 @@ cmd_vfs_create (assuan_context_t ctx, char *line)
}
+static const char hlp_passwd[] =
+ "PASSWD <user-id>\n"
+ "\n"
+ "Ask the backend to change the passphrase for the key\n"
+ "specified by USER-ID.";
static gpg_error_t
cmd_passwd (assuan_context_t ctx, char *line)
{
@@ -3430,6 +3455,39 @@ cmd_hash_algo_name (assuan_context_t ctx, char *line)
}
+static const char hlp_identify[] =
+ "IDENTIY\n"
+ "\n"
+ "Identify the type of data set with the INPUT command.";
+static gpg_error_t
+cmd_identify (assuan_context_t ctx, char *line)
+{
+ struct server *server = assuan_get_pointer (ctx);
+ gpg_error_t err;
+ assuan_fd_t inp_fd;
+ char *inp_fn;
+ gpgme_data_t inp_data;
+
+ inp_fd = server->input_fd;
+ inp_fn = server->input_filename;
+ if (inp_fd == ASSUAN_INVALID_FD && !inp_fn)
+ return GPG_ERR_ASS_NO_INPUT;
+
+ err = server_data_obj (inp_fd, inp_fn, 0, server->input_enc, &inp_data,
+ &server->input_stream);
+ if (err)
+ return err;
+
+ err = gt_identify (server->gt, inp_data);
+
+ gpgme_data_release (inp_data);
+ server_reset_fds (server);
+
+ return err;
+}
+
+
+
/* Tell the assuan library about our commands. */
static gpg_error_t
register_commands (assuan_context_t ctx)
@@ -3488,6 +3546,7 @@ register_commands (assuan_context_t ctx)
{ "PUBKEY_ALGO_NAME", cmd_pubkey_algo_name },
{ "HASH_ALGO_NAME", cmd_hash_algo_name },
{ "PASSWD", cmd_passwd, hlp_passwd },
+ { "IDENTIFY", cmd_identify, hlp_identify },
{ NULL }
};
int idx;
diff --git a/src/gpgme.def b/src/gpgme.def
index 3a6e0e3..0478cb6 100644
--- a/src/gpgme.def
+++ b/src/gpgme.def
@@ -209,5 +209,9 @@ EXPORTS
gpgme_set_pinentry_mode @158
gpgme_get_pinentry_mode @159
+ gpgme_signers_count @160
+
+ gpgme_data_identify @161
+
; END
diff --git a/src/gpgme.h.in b/src/gpgme.h.in
index 11780d1..5c4de6b 100644
--- a/src/gpgme.h.in
+++ b/src/gpgme.h.in
@@ -210,6 +210,22 @@ typedef enum
}
gpgme_data_encoding_t;
+/* Known data types. */
+typedef enum
+ {
+ GPGME_DATA_TYPE_INVALID = 0, /* Not detected. */
+ GPGME_DATA_TYPE_UNKNOWN = 1,
+ GPGME_DATA_TYPE_PGP_SIGNED = 0x10,
+ GPGME_DATA_TYPE_PGP_OTHER = 0x12,
+ GPGME_DATA_TYPE_PGP_KEY = 0x13,
+ GPGME_DATA_TYPE_CMS_SIGNED = 0x20,
+ GPGME_DATA_TYPE_CMS_ENCRYPTED= 0x21,
+ GPGME_DATA_TYPE_CMS_OTHER = 0x22,
+ GPGME_DATA_TYPE_X509_CERT = 0x23,
+ GPGME_DATA_TYPE_PKCS12 = 0x24,
+ }
+gpgme_data_type_t;
+
/* Public key algorithms from libgcrypt. */
typedef enum
@@ -934,6 +950,9 @@ void gpgme_signers_clear (gpgme_ctx_t ctx);
/* Add KEY to list of signers in CTX. */
gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key);
+/* Return the number of signers in CTX. */
+unsigned int gpgme_signers_count (const gpgme_ctx_t ctx);
+
/* Return the SEQth signer's key in CTX. */
gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq);
@@ -1146,6 +1165,9 @@ char *gpgme_data_get_file_name (gpgme_data_t dh);
gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh,
const char *file_name);
+/* Try to identify the type of the data in DH. */
+gpgme_data_type_t gpgme_data_identify (gpgme_data_t dh, int reserved);
+
/* Create a new data buffer which retrieves the data from the callback
function READ_CB. Deprecated, please use gpgme_data_new_from_cbs
diff --git a/src/libgpgme.vers b/src/libgpgme.vers
index 358b63c..fe18e6a 100644
--- a/src/libgpgme.vers
+++ b/src/libgpgme.vers
@@ -29,6 +29,7 @@ GPGME_1.1 {
gpgme_data_set_file_name;
gpgme_data_get_file_name;
+ gpgme_data_identify;
gpgme_sig_notation_clear;
gpgme_sig_notation_add;
@@ -143,6 +144,7 @@ GPGME_1.0 {
gpgme_set_textmode;
gpgme_signers_add;
gpgme_signers_clear;
+ gpgme_signers_count;
gpgme_signers_enum;
gpgme_key_ref;
diff --git a/src/parsetlv.c b/src/parsetlv.c
new file mode 100644
index 0000000..70c9518
--- /dev/null
+++ b/src/parsetlv.c
@@ -0,0 +1,103 @@
+/* parsetlv.c - ASN.1 TLV functions
+ * Copyright (C) 2005, 2007, 2008, 2012 g10 Code GmbH
+ *
+ * This file 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.
+ *
+ * This file 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "parsetlv.h"
+
+
+/* Simple but pretty complete ASN.1 BER parser. Parse the data at the
+ address of BUFFER with a length given at the address of SIZE. On
+ success return 0 and update BUFFER and SIZE to point to the value.
+ Do not update them on error. The information about the object are
+ stored in the caller allocated TI structure. */
+int
+_gpgme_parse_tlv (char const **buffer, size_t *size, tlvinfo_t *ti)
+{
+ int c;
+ unsigned long tag;
+ const unsigned char *buf = (const unsigned char *)(*buffer);
+ size_t length = *size;
+
+ ti->cls = 0;
+ ti->tag = 0;
+ ti->is_cons = 0;
+ ti->is_ndef = 0;
+ ti->length = 0;
+ ti->nhdr = 0;
+
+ if (!length)
+ return -1;
+ c = *buf++; length--; ++ti->nhdr;
+
+ ti->cls = (c & 0xc0) >> 6;
+ ti->is_cons = !!(c & 0x20);
+ tag = c & 0x1f;
+
+ if (tag == 0x1f)
+ {
+ tag = 0;
+ do
+ {
+ tag <<= 7;
+ if (!length)
+ return -1;
+ c = *buf++; length--; ++ti->nhdr;
+ tag |= c & 0x7f;
+ }
+ while (c & 0x80);
+ }
+ ti->tag = tag;
+
+ if (!length)
+ return -1;
+ c = *buf++; length--; ++ti->nhdr;
+
+ if ( !(c & 0x80) )
+ ti->length = c;
+ else if (c == 0x80)
+ ti->is_ndef = 1;
+ else if (c == 0xff)
+ return -1;
+ else
+ {
+ unsigned long len = 0;
+ int count = (c & 0x7f);
+
+ if (count > sizeof (len) || count > sizeof (size_t))
+ return -1;
+
+ for (; count; count--)
+ {
+ len <<= 8;
+ if (!length)
+ return -1;
+ c = *buf++; length--; ++ti->nhdr;
+ len |= c & 0xff;
+ }
+ ti->length = len;
+ }
+
+ *buffer = (void*)buf;
+ *size = length;
+ return 0;
+}
diff --git a/src/parsetlv.h b/src/parsetlv.h
new file mode 100644
index 0000000..153073c
--- /dev/null
+++ b/src/parsetlv.h
@@ -0,0 +1,48 @@
+/* parsetlv.h - TLV functions defintions
+ * Copyright (C) 2012 g10 Code GmbH
+ *
+ * This file 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.
+ *
+ * This file 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PARSETLV_H
+#define PARSETLV_H
+
+/* ASN.1 constants. */
+#define ASN1_CLASS_UNIVERSAL 0
+#define ASN1_CLASS_APPLICATION 1
+#define ASN1_CLASS_CONTEXT 2
+#define ASN1_CLASS_PRIVATE 3
+#define ASN1_TAG_INTEGER 2
+#define ASN1_TAG_OBJECT_ID 6
+#define ASN1_TAG_SEQUENCE 16
+
+
+/* Object used with parse_tlv. */
+struct tlvinfo_s
+{
+ int cls; /* The class of the tag. */
+ int tag; /* The tag. */
+ int is_cons; /* True if it is a constructed object. */
+ int is_ndef; /* True if the object has an indefinite length. */
+ size_t length; /* The length of the value. */
+ size_t nhdr; /* The number of octets in the header (tag,length). */
+};
+typedef struct tlvinfo_s tlvinfo_t;
+
+/*-- parsetlv.c --*/
+int _gpgme_parse_tlv (char const **buffer, size_t *size, tlvinfo_t *ti);
+#define parse_tlv(a,b,c) _gpgme_parse_tlv ((a), (b), (c))
+
+
+#endif /*PARSETLV_H*/
diff --git a/src/posix-util.c b/src/posix-util.c
index 478055a..fd44507 100644
--- a/src/posix-util.c
+++ b/src/posix-util.c
@@ -28,6 +28,7 @@
#include <assert.h>
#include "util.h"
+#include "sys-util.h"
const char *
_gpgme_get_gpg_path (void)
@@ -70,29 +71,6 @@ _gpgme_get_g13_path (void)
}
-const char *
-_gpgme_get_uiserver_socket_path (void)
-{
- static char *socket_path;
- const char *homedir;
- const char name[] = "S.uiserver";
-
- if (socket_path)
- return socket_path;
-
- homedir = _gpgme_get_default_homedir ();
- if (! homedir)
- return NULL;
-
- socket_path = malloc (strlen (homedir) + 1 + strlen (name) + 1);
- if (! socket_path)
- return NULL;
-
- strcpy (stpcpy (stpcpy (socket_path, homedir), "/"), name);
- return socket_path;
-}
-
-
/* See w32-util.c */
int
_gpgme_get_conf_int (const char *key, int *value)
diff --git a/src/signers.c b/src/signers.c
index 88f923c..f43fafc 100644
--- a/src/signers.c
+++ b/src/signers.c
@@ -93,6 +93,14 @@ gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key)
}
+/* Return the number of signers in CTX. */
+unsigned int
+gpgme_signers_count (const gpgme_ctx_t ctx)
+{
+ return ctx? ctx->signers_len : 0;
+}
+
+
/* Return the SEQth signer's key in CTX with one reference. */
gpgme_key_t
gpgme_signers_enum (const gpgme_ctx_t ctx, int seq)
diff --git a/src/sys-util.h b/src/sys-util.h
new file mode 100644
index 0000000..f6506d3
--- /dev/null
+++ b/src/sys-util.h
@@ -0,0 +1,29 @@
+/* sys-util.h - System utilities not generally used.
+ * Copyright (C) 2013 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SYS_UTIL_H
+#define SYS_UTIL_H
+
+/*-- {posix,w32}-util.c --*/
+const char *_gpgme_get_gpg_path (void);
+const char *_gpgme_get_gpgsm_path (void);
+const char *_gpgme_get_gpgconf_path (void);
+const char *_gpgme_get_g13_path (void);
+
+#endif /* SYS_UTIL_H */
diff --git a/src/util.h b/src/util.h
index db8dc39..c432980 100644
--- a/src/util.h
+++ b/src/util.h
@@ -47,18 +47,17 @@
/*-- {posix,w32}-util.c --*/
-const char *_gpgme_get_gpg_path (void);
-const char *_gpgme_get_gpgsm_path (void);
-const char *_gpgme_get_gpgconf_path (void);
-const char *_gpgme_get_g13_path (void);
-const char *_gpgme_get_uiserver_socket_path (void);
-
int _gpgme_get_conf_int (const char *key, int *value);
void _gpgme_allow_set_foreground_window (pid_t pid);
/*-- dirinfo.c --*/
const char *_gpgme_get_default_homedir (void);
const char *_gpgme_get_default_agent_socket (void);
+const char *_gpgme_get_default_gpg_name (void);
+const char *_gpgme_get_default_gpgsm_name (void);
+const char *_gpgme_get_default_g13_name (void);
+const char *_gpgme_get_default_gpgconf_name (void);
+const char *_gpgme_get_default_uisrv_socket (void);
diff --git a/src/w32-util.c b/src/w32-util.c
index a90f405..4cee1cb 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -1,24 +1,23 @@
/* w32-util.c - Utility functions for the W32 API
- Copyright (C) 1999 Free Software Foundation, Inc
- Copyright (C) 2001 Werner Koch (dd9jn)
- Copyright (C) 2001, 2002, 2003, 2004, 2007 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
- 02111-1307, USA. */
+ * Copyright (C) 1999 Free Software Foundation, Inc
+ * Copyright (C) 2001 Werner Koch (dd9jn)
+ * Copyright (C) 2001, 2002, 2003, 2004, 2007, 2013 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, see <http://www.gnu.org/licenses/>.
+ **/
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -63,6 +62,7 @@
#include "ath.h"
#include "sema.h"
#include "debug.h"
+#include "sys-util.h"
#ifndef HAVE_W32CE_SYSTEM
@@ -75,6 +75,12 @@
DEFINE_STATIC_LOCK (get_path_lock);
+/* The module handle of this DLL. If we are linked statically,
+ dllmain does not exists and thus the value of my_hmodule will be
+ NULL. The effect is that a GetModuleFileName always returns the
+ file name of the DLL or executable which contains the gpgme code. */
+static HMODULE my_hmodule;
+
#ifdef HAVE_ALLOW_SET_FOREGROUND_WINDOW
@@ -112,6 +118,39 @@ dlclose (void * hd)
}
#endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */
+
+/* Return a malloced string encoded in UTF-8 from the wide char input
+ string STRING. Caller must free this value. Returns NULL and sets
+ ERRNO on failure. Calling this function with STRING set to NULL is
+ not defined. */
+static char *
+wchar_to_utf8 (const wchar_t *string)
+{
+ int n;
+ char *result;
+
+ n = WideCharToMultiByte (CP_UTF8, 0, string, -1, NULL, 0, NULL, NULL);
+ if (n < 0)
+ {
+ gpg_err_set_errno (EINVAL);
+ return NULL;
+ }
+
+ result = malloc (n+1);
+ if (!result)
+ return NULL;
+
+ n = WideCharToMultiByte (CP_UTF8, 0, string, -1, result, n, NULL, NULL);
+ if (n < 0)
+ {
+ free (result);
+ gpg_err_set_errno (EINVAL);
+ result = NULL;
+ }
+ return result;
+}
+
+
void
_gpgme_allow_set_foreground_window (pid_t pid)
{
@@ -270,51 +309,53 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
}
-#if 0
-static char *
-find_program_in_registry (const char *name)
+/* Return the name of the directory with the gpgme DLL or the EXE (if
+ statically linked). May return NULL on severe errors. */
+const char *
+_gpgme_get_inst_dir (void)
{
- char *program = NULL;
+ static char *inst_dir;
- program = read_w32_registry_string (NULL, "Software\\GNU\\GnuPG", name);
- if (program)
+ LOCK (get_path_lock);
+ if (!inst_dir)
{
- int i;
+ wchar_t *moddir;
- TRACE2 (DEBUG_CTX, "gpgme:find_program_in_registry", 0,
- "found %s in registry: `%s'", name, program);
- for (i = 0; program[i]; i++)
- {
- if (program[i] == '/')
- program[i] = '\\';
- }
+ moddir = malloc ((MAX_PATH+5) * sizeof *moddir);
+ if (moddir)
+ {
+ if (!GetModuleFileNameW (my_hmodule, moddir, MAX_PATH))
+ *moddir = 0;
+ if (!*moddir)
+ gpg_err_set_errno (ENOENT);
+ else
+ {
+ inst_dir = wchar_to_utf8 (moddir);
+ if (inst_dir)
+ {
+ char *p = strrchr (inst_dir, '\\');
+ if (p)
+ *p = 0;
+ }
+ }
+ free (moddir);
+ }
}
- return program;
+ UNLOCK (get_path_lock);
+ return inst_dir;
}
-#endif
static char *
-find_program_in_inst_dir (const char *name)
+find_program_in_dir (const char *dir, const char *name)
{
- char *result = NULL;
- char *tmp;
-
- tmp = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
- "Software\\GNU\\GnuPG",
- "Install Directory");
- if (!tmp)
- return NULL;
+ char *result;
- result = malloc (strlen (tmp) + 1 + strlen (name) + 1);
+ result = malloc (strlen (dir) + 1 + strlen (name) + 1);
if (!result)
- {
- free (tmp);
- return NULL;
- }
+ return NULL;
- strcpy (stpcpy (stpcpy (result, tmp), "\\"), name);
- free (tmp);
+ strcpy (stpcpy (stpcpy (result, dir), "\\"), name);
if (access (result, F_OK))
{
free (result);
@@ -326,6 +367,40 @@ find_program_in_inst_dir (const char *name)
static char *
+find_program_in_inst_dir (const char *inst_dir, const char *name)
+{
+ char *result;
+ char *dir;
+
+ /* If an installation directory has been passed, this overrides a
+ location given bu the registry. The idea here is that we prefer
+ a a program installed alongside with gpgme. We don't want the
+ registry to override this to have a better isolation of an gpgme
+ aware applications for other effects. Note that the "Install
+ Directory" registry item has been used for ages in Gpg4win and
+ earlier GnuPG windows installers. It is technically not anymore
+ required. */
+ if (inst_dir)
+ {
+ result = find_program_in_dir (inst_dir, name);
+ if (result)
+ return result;
+ }
+
+ dir = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
+ "Software\\GNU\\GnuPG",
+ "Install Directory");
+ if (dir)
+ {
+ result = find_program_in_dir (dir, name);
+ free (dir);
+ return result;
+ }
+ return NULL;
+}
+
+
+static char *
find_program_at_standard_place (const char *name)
{
char path[MAX_PATH];
@@ -353,14 +428,12 @@ const char *
_gpgme_get_gpg_path (void)
{
static char *gpg_program;
+ const char *inst_dir;
+ inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock);
-#if 0
if (!gpg_program)
- gpg_program = find_program_in_registry ("gpgProgram");
-#endif
- if (!gpg_program)
- gpg_program = find_program_in_inst_dir ("gpg.exe");
+ gpg_program = find_program_in_inst_dir (inst_dir, "gpg.exe");
if (!gpg_program)
gpg_program = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
UNLOCK (get_path_lock);
@@ -372,14 +445,12 @@ const char *
_gpgme_get_gpgsm_path (void)
{
static char *gpgsm_program;
+ const char *inst_dir;
+ inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock);
-#if 0
if (!gpgsm_program)
- gpgsm_program = find_program_in_registry ("gpgsmProgram");
-#endif
- if (!gpgsm_program)
- gpgsm_program = find_program_in_inst_dir ("gpgsm.exe");
+ gpgsm_program = find_program_in_inst_dir (inst_dir, "gpgsm.exe");
if (!gpgsm_program)
gpgsm_program = find_program_at_standard_place ("GNU\\GnuPG\\gpgsm.exe");
UNLOCK (get_path_lock);
@@ -391,14 +462,12 @@ const char *
_gpgme_get_gpgconf_path (void)
{
static char *gpgconf_program;
+ const char *inst_dir;
+ inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock);
-#if 0
- if (!gpgconf_program)
- gpgconf_program = find_program_in_registry ("gpgconfProgram");
-#endif
if (!gpgconf_program)
- gpgconf_program = find_program_in_inst_dir ("gpgconf.exe");
+ gpgconf_program = find_program_in_inst_dir (inst_dir, "gpgconf.exe");
if (!gpgconf_program)
gpgconf_program
= find_program_at_standard_place ("GNU\\GnuPG\\gpgconf.exe");
@@ -411,14 +480,12 @@ const char *
_gpgme_get_g13_path (void)
{
static char *g13_program;
+ const char *inst_dir;
+ inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock);
-#if 0
if (!g13_program)
- g13_program = find_program_in_registry ("g13Program");
-#endif
- if (!g13_program)
- g13_program = find_program_in_inst_dir ("g13.exe");
+ g13_program = find_program_in_inst_dir (inst_dir, "g13.exe");
if (!g13_program)
g13_program = find_program_at_standard_place ("GNU\\GnuPG\\g13.exe");
UNLOCK (get_path_lock);
@@ -427,36 +494,15 @@ _gpgme_get_g13_path (void)
const char *
-_gpgme_get_uiserver_socket_path (void)
-{
- static char *socket_path;
- const char *homedir;
- const char name[] = "S.uiserver";
-
- if (socket_path)
- return socket_path;
-
- homedir = _gpgme_get_default_homedir ();
- if (! homedir)
- return NULL;
-
- socket_path = malloc (strlen (homedir) + 1 + strlen (name) + 1);
- if (! socket_path)
- return NULL;
-
- strcpy (stpcpy (stpcpy (socket_path, homedir), "\\"), name);
- return socket_path;
-}
-
-
-const char *
_gpgme_get_w32spawn_path (void)
{
static char *w32spawn_program;
+ const char *inst_dir;
+ inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock);
if (!w32spawn_program)
- w32spawn_program = find_program_in_inst_dir ("gpgme-w32spawn.exe");
+ w32spawn_program = find_program_in_inst_dir (inst_dir,"gpgme-w32spawn.exe");
if (!w32spawn_program)
w32spawn_program
= find_program_at_standard_place ("GNU\\GnuPG\\gpgme-w32spawn.exe");
@@ -641,3 +687,18 @@ _gpgme_w32ce_get_debug_envvar (void)
return tmp;
}
#endif /*HAVE_W32CE_SYSTEM*/
+
+
+/* Entry point called by the DLL loader. */
+#ifdef DLL_EXPORT
+int WINAPI
+DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
+{
+ (void)reserved;
+
+ if (reason == DLL_PROCESS_ATTACH)
+ my_hmodule = hinst;
+
+ return TRUE;
+}
+#endif /*DLL_EXPORT*/
diff --git a/tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F b/tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F
new file mode 100644
index 0000000..4ec6d13
--- /dev/null
+++ b/tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F
Binary files differ
diff --git a/tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD b/tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD
new file mode 100644
index 0000000..16138cf
--- /dev/null
+++ b/tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD
Binary files differ
diff --git a/tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66 b/tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66
new file mode 100644
index 0000000..079cc7b
--- /dev/null
+++ b/tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66
Binary files differ
diff --git a/tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C b/tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C
new file mode 100644
index 0000000..ad505ab
--- /dev/null
+++ b/tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C
Binary files differ
diff --git a/tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD b/tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD
new file mode 100644
index 0000000..f30792e
--- /dev/null
+++ b/tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD
Binary files differ
diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am
index dd28d5e..c9000c9 100644
--- a/tests/gpg/Makefile.am
+++ b/tests/gpg/Makefile.am
@@ -1,18 +1,18 @@
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001, 2004, 2005, 2009 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 02111-1307, USA
@@ -20,8 +20,9 @@
## Process this file with automake to produce Makefile.in
GPG = @GPG@
+GPG_AGENT = @GPG_AGENT@
-TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO=
+TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO=
# The keylist tests must come after the import and the edit test.
noinst_HEADERS = t-support.h
@@ -32,17 +33,29 @@ else
tests_unix = t-eventloop t-thread1
endif
-TESTS = t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
+c_tests = \
+ t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \
t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \
t-encrypt-large t-file-name t-gpgconf $(tests_unix)
+TESTS = initial.test $(c_tests) final.test
+
CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
- random_seed
+ random_seed S.gpg-agent
+
+private_keys = \
+ 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \
+ 76F7E2B35832976B50A27A282D9B87E44577EB66 \
+ A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD \
+ 13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F \
+ 7A030357C0F253A5BBCD282FFC4E521B37558F5C
-EXTRA_DIST = pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
- geheim.txt pubkey-1.asc seckey-1.asc pinentry
+
+EXTRA_DIST = start-stop-agent initial.test final.test \
+ pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
+ geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys)
INCLUDES = -I$(top_builddir)/src
@@ -51,17 +64,25 @@ LDADD = ../../src/libgpgme.la
t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread
# We don't run t-genkey in the test suite, because it takes too long
-noinst_PROGRAMS = $(TESTS) t-genkey
+noinst_PROGRAMS = $(c_tests) t-genkey
clean-local:
- -gpg-connect-agent KILLAGENT /bye
+ -$(srcdir)/start-stop-agent --stop
-rm -fR private-keys-v1.d
-all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg
+all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg \
+ ./private-keys-v1.d/gpg-sample.stamp
export GNUPGHOME := $(abs_builddir)
-export GPG_AGENT_INFO :=
+export GPG_AGENT_INFO :=
+
+./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys)
+ test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ for k in $(private_keys); do \
+ cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
+ done
+ echo x > ./private-keys-v1.d/gpg-sample.stamp
./pubring.gpg: $(srcdir)/pubdemo.asc
-$(GPG) --no-permission-warning \
diff --git a/tests/gpg/Makefile.in b/tests/gpg/Makefile.in
index 676ef12..d15503b 100644
--- a/tests/gpg/Makefile.in
+++ b/tests/gpg/Makefile.in
@@ -17,19 +17,19 @@
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001, 2004, 2005, 2009 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 02111-1307, USA
@@ -71,14 +71,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-TESTS = t-encrypt$(EXEEXT) t-encrypt-sym$(EXEEXT) \
- t-encrypt-sign$(EXEEXT) t-sign$(EXEEXT) t-signers$(EXEEXT) \
- t-decrypt$(EXEEXT) t-verify$(EXEEXT) t-decrypt-verify$(EXEEXT) \
- t-sig-notation$(EXEEXT) t-export$(EXEEXT) t-import$(EXEEXT) \
- t-trustlist$(EXEEXT) t-edit$(EXEEXT) t-keylist$(EXEEXT) \
- t-keylist-sig$(EXEEXT) t-wait$(EXEEXT) \
- t-encrypt-large$(EXEEXT) t-file-name$(EXEEXT) \
- t-gpgconf$(EXEEXT) $(am__EXEEXT_1)
+TESTS = initial.test $(am__EXEEXT_2) final.test
noinst_PROGRAMS = $(am__EXEEXT_2) t-genkey$(EXEEXT)
subdir = tests/gpg
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
@@ -388,18 +381,33 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO=
+GPG_AGENT = @GPG_AGENT@
+TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO=
# The keylist tests must come after the import and the edit test.
noinst_HEADERS = t-support.h
@HAVE_W32_SYSTEM_FALSE@tests_unix = t-eventloop t-thread1
@HAVE_W32_SYSTEM_TRUE@tests_unix =
+c_tests = \
+ t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
+ t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \
+ t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \
+ t-encrypt-large t-file-name t-gpgconf $(tests_unix)
+
CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
- random_seed
+ random_seed S.gpg-agent
-EXTRA_DIST = pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
- geheim.txt pubkey-1.asc seckey-1.asc pinentry
+private_keys = \
+ 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \
+ 76F7E2B35832976B50A27A282D9B87E44577EB66 \
+ A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD \
+ 13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F \
+ 7A030357C0F253A5BBCD282FFC4E521B37558F5C
+
+EXTRA_DIST = start-stop-agent initial.test final.test \
+ pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
+ geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys)
INCLUDES = -I$(top_builddir)/src
AM_CPPFLAGS = @GPG_ERROR_CFLAGS@
@@ -871,14 +879,22 @@ uninstall-am:
clean-local:
- -gpg-connect-agent KILLAGENT /bye
+ -$(srcdir)/start-stop-agent --stop
-rm -fR private-keys-v1.d
-all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg
+all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg \
+ ./private-keys-v1.d/gpg-sample.stamp
export GNUPGHOME := $(abs_builddir)
-export GPG_AGENT_INFO :=
+export GPG_AGENT_INFO :=
+
+./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys)
+ test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ for k in $(private_keys); do \
+ cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
+ done
+ echo x > ./private-keys-v1.d/gpg-sample.stamp
./pubring.gpg: $(srcdir)/pubdemo.asc
-$(GPG) --no-permission-warning \
diff --git a/tests/gpg/final.test b/tests/gpg/final.test
new file mode 100755
index 0000000..5148a34
--- /dev/null
+++ b/tests/gpg/final.test
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+${srcdir}/start-stop-agent --stop
+exit 0
diff --git a/tests/gpg/initial.test b/tests/gpg/initial.test
new file mode 100755
index 0000000..1981c99
--- /dev/null
+++ b/tests/gpg/initial.test
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+${srcdir}/start-stop-agent --start
+exit 0
diff --git a/tests/gpg/start-stop-agent b/tests/gpg/start-stop-agent
new file mode 100755
index 0000000..ab47d8d
--- /dev/null
+++ b/tests/gpg/start-stop-agent
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Copyright (C) 2013 g10 Code GmbH
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved. This file is
+# distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY, to the extent permitted by law; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+if [ -z "$(command -v gpg-connect-agent)" ]; then
+ echo "gpg-agent not installed and thus not started" >&2
+ exit 0;
+fi
+
+GPG_AGENT_INFO=
+export GPG_AGENT_INFO
+
+token=$(echo "gpgme-$(pwd)" | tr ' ' '_')
+
+if [ "$1" = "--stop" ]; then
+ if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \
+ != "D set" ]; then
+ echo "gpg-agent not running" >&2
+ exit 0
+ fi
+ echo "stopping gpg-agent " >&2
+ gpg-connect-agent KILLAGENT /bye >/dev/null 2>&1
+ exit 0
+fi
+
+if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \
+ = "D set" ]; then
+ echo "gpg-agent already running" >&2
+ exit 0
+fi
+
+echo "starting gpg-agent " >&2
+gpg-connect-agent putval\ $token\ set /bye >/dev/null 2>&1
+if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \
+ != "D set" ]; then
+ echo "error starting gpg-agent" >&2
+ exit 1
+fi
+exit 0