summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/Makefile.in128
-rw-r--r--tests/gpg/Makefile.am8
-rw-r--r--tests/gpg/Makefile.in89
-rw-r--r--tests/gpg/t-decrypt-verify.c49
-rw-r--r--tests/gpg/t-decrypt.c18
-rw-r--r--tests/gpg/t-edit.c29
-rw-r--r--tests/gpg/t-encrypt-large.c21
-rw-r--r--tests/gpg/t-encrypt-mixed.c129
-rw-r--r--tests/gpg/t-encrypt-sign.c3
-rw-r--r--tests/gpg/t-encrypt-sym.c12
-rw-r--r--tests/gpg/t-encrypt.c13
-rw-r--r--tests/gpg/t-eventloop.c12
-rw-r--r--tests/gpg/t-export.c17
-rw-r--r--tests/gpg/t-file-name.c14
-rw-r--r--tests/gpg/t-genkey.c15
-rw-r--r--tests/gpg/t-gpgconf.c18
-rw-r--r--tests/gpg/t-import.c19
-rw-r--r--tests/gpg/t-keylist-sig.c20
-rw-r--r--tests/gpg/t-keylist.c27
-rw-r--r--tests/gpg/t-sig-notation.c53
-rw-r--r--tests/gpg/t-sign.c17
-rw-r--r--tests/gpg/t-signers.c19
-rw-r--r--tests/gpg/t-support.h26
-rw-r--r--tests/gpg/t-thread1.c25
-rw-r--r--tests/gpg/t-trustlist.c11
-rw-r--r--tests/gpg/t-verify.c18
-rw-r--r--tests/gpg/t-wait.c10
-rw-r--r--tests/gpgsm/Makefile.in50
-rw-r--r--tests/gpgsm/t-decrypt.c12
-rw-r--r--tests/gpgsm/t-encrypt.c12
-rw-r--r--tests/gpgsm/t-export.c12
-rw-r--r--tests/gpgsm/t-genkey.c14
-rw-r--r--tests/gpgsm/t-import.c26
-rw-r--r--tests/gpgsm/t-keylist.c25
-rw-r--r--tests/gpgsm/t-sign.c14
-rw-r--r--tests/gpgsm/t-support.h19
-rw-r--r--tests/gpgsm/t-verify.c16
-rw-r--r--tests/opassuan/Makefile.in50
-rw-r--r--tests/opassuan/t-command.c23
-rw-r--r--tests/run-decrypt.c189
-rw-r--r--tests/run-encrypt.c293
-rw-r--r--tests/run-genkey.c439
-rw-r--r--tests/run-identify.c129
-rw-r--r--tests/run-keylist.c108
-rw-r--r--tests/run-keysign.c261
-rw-r--r--tests/run-sign.c2
-rw-r--r--tests/run-support.h16
-rw-r--r--tests/run-tofu.c178
-rw-r--r--tests/run-verify.c115
-rw-r--r--tests/t-data.c16
-rw-r--r--tests/t-engine-info.c16
52 files changed, 2517 insertions, 341 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 89e52e8..c71914f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,7 +32,8 @@ LDADD = ../src/libgpgme.la @GPG_ERROR_LIBS@
noinst_HEADERS = run-support.h
noinst_PROGRAMS = $(TESTS) run-keylist run-export run-import run-sign \
- run-verify
+ run-verify run-encrypt run-identify run-decrypt run-genkey \
+ run-keysign run-tofu
if RUN_GPG_TESTS
diff --git a/tests/Makefile.in b/tests/Makefile.in
index ab2418a..7af2558 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -101,18 +101,24 @@ host_triplet = @host@
TESTS = t-version$(EXEEXT) t-data$(EXEEXT) t-engine-info$(EXEEXT)
noinst_PROGRAMS = $(am__EXEEXT_1) run-keylist$(EXEEXT) \
run-export$(EXEEXT) run-import$(EXEEXT) run-sign$(EXEEXT) \
- run-verify$(EXEEXT)
+ run-verify$(EXEEXT) run-encrypt$(EXEEXT) run-identify$(EXEEXT) \
+ run-decrypt$(EXEEXT) run-genkey$(EXEEXT) run-keysign$(EXEEXT) \
+ run-tofu$(EXEEXT)
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
$(top_srcdir)/build-aux/depcomp $(noinst_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/glib-2.0.m4 \
- $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnupg-ttyname.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_pkg_swig.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
+ $(top_srcdir)/m4/gnupg-ttyname.m4 \
$(top_srcdir)/m4/gpg-error.m4 $(top_srcdir)/m4/libassuan.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/qt.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@@ -123,14 +129,30 @@ CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 = t-version$(EXEEXT) t-data$(EXEEXT) \
t-engine-info$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
-run_export_SOURCES = run-export.c
-run_export_OBJECTS = run-export.$(OBJEXT)
-run_export_LDADD = $(LDADD)
-run_export_DEPENDENCIES = ../src/libgpgme.la
+run_decrypt_SOURCES = run-decrypt.c
+run_decrypt_OBJECTS = run-decrypt.$(OBJEXT)
+run_decrypt_LDADD = $(LDADD)
+run_decrypt_DEPENDENCIES = ../src/libgpgme.la
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
+run_encrypt_SOURCES = run-encrypt.c
+run_encrypt_OBJECTS = run-encrypt.$(OBJEXT)
+run_encrypt_LDADD = $(LDADD)
+run_encrypt_DEPENDENCIES = ../src/libgpgme.la
+run_export_SOURCES = run-export.c
+run_export_OBJECTS = run-export.$(OBJEXT)
+run_export_LDADD = $(LDADD)
+run_export_DEPENDENCIES = ../src/libgpgme.la
+run_genkey_SOURCES = run-genkey.c
+run_genkey_OBJECTS = run-genkey.$(OBJEXT)
+run_genkey_LDADD = $(LDADD)
+run_genkey_DEPENDENCIES = ../src/libgpgme.la
+run_identify_SOURCES = run-identify.c
+run_identify_OBJECTS = run-identify.$(OBJEXT)
+run_identify_LDADD = $(LDADD)
+run_identify_DEPENDENCIES = ../src/libgpgme.la
run_import_SOURCES = run-import.c
run_import_OBJECTS = run-import.$(OBJEXT)
run_import_LDADD = $(LDADD)
@@ -139,10 +161,18 @@ run_keylist_SOURCES = run-keylist.c
run_keylist_OBJECTS = run-keylist.$(OBJEXT)
run_keylist_LDADD = $(LDADD)
run_keylist_DEPENDENCIES = ../src/libgpgme.la
+run_keysign_SOURCES = run-keysign.c
+run_keysign_OBJECTS = run-keysign.$(OBJEXT)
+run_keysign_LDADD = $(LDADD)
+run_keysign_DEPENDENCIES = ../src/libgpgme.la
run_sign_SOURCES = run-sign.c
run_sign_OBJECTS = run-sign.$(OBJEXT)
run_sign_LDADD = $(LDADD)
run_sign_DEPENDENCIES = ../src/libgpgme.la
+run_tofu_SOURCES = run-tofu.c
+run_tofu_OBJECTS = run-tofu.$(OBJEXT)
+run_tofu_LDADD = $(LDADD)
+run_tofu_DEPENDENCIES = ../src/libgpgme.la
run_verify_SOURCES = run-verify.c
run_verify_OBJECTS = run-verify.$(OBJEXT)
run_verify_LDADD = $(LDADD)
@@ -193,10 +223,14 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = run-export.c run-import.c run-keylist.c run-sign.c \
- run-verify.c t-data.c t-engine-info.c t-version.c
-DIST_SOURCES = run-export.c run-import.c run-keylist.c run-sign.c \
- run-verify.c t-data.c t-engine-info.c t-version.c
+SOURCES = run-decrypt.c run-encrypt.c run-export.c run-genkey.c \
+ run-identify.c run-import.c run-keylist.c run-keysign.c \
+ run-sign.c run-tofu.c run-verify.c t-data.c t-engine-info.c \
+ t-version.c
+DIST_SOURCES = run-decrypt.c run-encrypt.c run-export.c run-genkey.c \
+ run-identify.c run-import.c run-keylist.c run-keysign.c \
+ run-sign.c run-tofu.c run-verify.c t-data.c t-engine-info.c \
+ t-version.c
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
@@ -301,6 +335,7 @@ BUILD_REVISION = @BUILD_REVISION@
BUILD_TIMESTAMP = @BUILD_TIMESTAMP@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
@@ -312,12 +347,14 @@ CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLED_LANGUAGES = @ENABLED_LANGUAGES@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GITLOG_TO_CHANGELOG = @GITLOG_TO_CHANGELOG@
@@ -328,15 +365,23 @@ GLIB_LIBS = @GLIB_LIBS@
GLIB_MKENUMS = @GLIB_MKENUMS@
GOBJECT_QUERY = @GOBJECT_QUERY@
GPGME_CONFIG_API_VERSION = @GPGME_CONFIG_API_VERSION@
+GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
+GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
+GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
+GPGME_QT_LIBS = @GPGME_QT_LIBS@
GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@
GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@
GPG_ERROR_LIBS = @GPG_ERROR_LIBS@
GPG_ERROR_MT_CFLAGS = @GPG_ERROR_MT_CFLAGS@
GPG_ERROR_MT_LIBS = @GPG_ERROR_MT_LIBS@
+GRAPHVIZ = @GRAPHVIZ@
GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_DOT = @HAVE_DOT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -347,10 +392,16 @@ LDFLAGS = @LDFLAGS@
LIBASSUAN_CFLAGS = @LIBASSUAN_CFLAGS@
LIBASSUAN_CONFIG = @LIBASSUAN_CONFIG@
LIBASSUAN_LIBS = @LIBASSUAN_LIBS@
+LIBGPGMEPP_LT_AGE = @LIBGPGMEPP_LT_AGE@
+LIBGPGMEPP_LT_CURRENT = @LIBGPGMEPP_LT_CURRENT@
+LIBGPGMEPP_LT_REVISION = @LIBGPGMEPP_LT_REVISION@
LIBGPGME_LT_AGE = @LIBGPGME_LT_AGE@
LIBGPGME_LT_CURRENT = @LIBGPGME_LT_CURRENT@
LIBGPGME_LT_REVISION = @LIBGPGME_LT_REVISION@
LIBOBJS = @LIBOBJS@
+LIBQGPGME_LT_AGE = @LIBQGPGME_LT_AGE@
+LIBQGPGME_LT_CURRENT = @LIBQGPGME_LT_CURRENT@
+LIBQGPGME_LT_REVISION = @LIBQGPGME_LT_REVISION@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
@@ -360,6 +411,8 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
+MOC = @MOC@
+MOC2 = @MOC2@
NEED__FILE_OFFSET_BITS = @NEED__FILE_OFFSET_BITS@
NM = @NM@
NMEDIT = @NMEDIT@
@@ -376,14 +429,27 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
-QT4_CORE_CFLAGS = @QT4_CORE_CFLAGS@
-QT4_CORE_LIBS = @QT4_CORE_LIBS@
+PYTHON = @PYTHON@
+PYTHONS = @PYTHONS@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
+PYTHON_VERSION = @PYTHON_VERSION@
+PYTHON_VERSIONS = @PYTHON_VERSIONS@
+QTCHOOSER = @QTCHOOSER@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+SWIG = @SWIG@
+SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
VERSION_NUMBER = @VERSION_NUMBER@
@@ -432,9 +498,13 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -498,10 +568,26 @@ clean-noinstPROGRAMS:
echo " rm -f" $$list; \
rm -f $$list
+run-decrypt$(EXEEXT): $(run_decrypt_OBJECTS) $(run_decrypt_DEPENDENCIES) $(EXTRA_run_decrypt_DEPENDENCIES)
+ @rm -f run-decrypt$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(run_decrypt_OBJECTS) $(run_decrypt_LDADD) $(LIBS)
+
+run-encrypt$(EXEEXT): $(run_encrypt_OBJECTS) $(run_encrypt_DEPENDENCIES) $(EXTRA_run_encrypt_DEPENDENCIES)
+ @rm -f run-encrypt$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(run_encrypt_OBJECTS) $(run_encrypt_LDADD) $(LIBS)
+
run-export$(EXEEXT): $(run_export_OBJECTS) $(run_export_DEPENDENCIES) $(EXTRA_run_export_DEPENDENCIES)
@rm -f run-export$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(run_export_OBJECTS) $(run_export_LDADD) $(LIBS)
+run-genkey$(EXEEXT): $(run_genkey_OBJECTS) $(run_genkey_DEPENDENCIES) $(EXTRA_run_genkey_DEPENDENCIES)
+ @rm -f run-genkey$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(run_genkey_OBJECTS) $(run_genkey_LDADD) $(LIBS)
+
+run-identify$(EXEEXT): $(run_identify_OBJECTS) $(run_identify_DEPENDENCIES) $(EXTRA_run_identify_DEPENDENCIES)
+ @rm -f run-identify$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(run_identify_OBJECTS) $(run_identify_LDADD) $(LIBS)
+
run-import$(EXEEXT): $(run_import_OBJECTS) $(run_import_DEPENDENCIES) $(EXTRA_run_import_DEPENDENCIES)
@rm -f run-import$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(run_import_OBJECTS) $(run_import_LDADD) $(LIBS)
@@ -510,10 +596,18 @@ run-keylist$(EXEEXT): $(run_keylist_OBJECTS) $(run_keylist_DEPENDENCIES) $(EXTRA
@rm -f run-keylist$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(run_keylist_OBJECTS) $(run_keylist_LDADD) $(LIBS)
+run-keysign$(EXEEXT): $(run_keysign_OBJECTS) $(run_keysign_DEPENDENCIES) $(EXTRA_run_keysign_DEPENDENCIES)
+ @rm -f run-keysign$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(run_keysign_OBJECTS) $(run_keysign_LDADD) $(LIBS)
+
run-sign$(EXEEXT): $(run_sign_OBJECTS) $(run_sign_DEPENDENCIES) $(EXTRA_run_sign_DEPENDENCIES)
@rm -f run-sign$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(run_sign_OBJECTS) $(run_sign_LDADD) $(LIBS)
+run-tofu$(EXEEXT): $(run_tofu_OBJECTS) $(run_tofu_DEPENDENCIES) $(EXTRA_run_tofu_DEPENDENCIES)
+ @rm -f run-tofu$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(run_tofu_OBJECTS) $(run_tofu_LDADD) $(LIBS)
+
run-verify$(EXEEXT): $(run_verify_OBJECTS) $(run_verify_DEPENDENCIES) $(EXTRA_run_verify_DEPENDENCIES)
@rm -f run-verify$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(run_verify_OBJECTS) $(run_verify_LDADD) $(LIBS)
@@ -536,10 +630,16 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-decrypt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-encrypt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-export.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-genkey.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-identify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-import.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-keylist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-keysign.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-sign.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-tofu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-verify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-data.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-engine-info.Po@am__quote@
diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am
index 107397b..9877843 100644
--- a/tests/gpg/Makefile.am
+++ b/tests/gpg/Makefile.am
@@ -38,7 +38,7 @@ 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)
+ t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix)
TESTS = initial.test $(c_tests) final.test
@@ -89,11 +89,11 @@ export GPG_AGENT_INFO :=
echo x > ./private-keys-v1.d/gpg-sample.stamp
./pubring-stamp: $(srcdir)/pubdemo.asc
- $(GPG) --no-permission-warning \
+ $(GPG) --batch --no-permission-warning \
--import $(srcdir)/pubdemo.asc
- -$(GPG) --no-permission-warning \
+ -$(GPG) --batch --no-permission-warning \
--import $(srcdir)/secdemo.asc
- touch ./pubring-stamp
+ echo x > ./pubring-stamp
./gpg.conf:
# This is required for t-sig-notations.
diff --git a/tests/gpg/Makefile.in b/tests/gpg/Makefile.in
index 3fbec6d..7886769 100644
--- a/tests/gpg/Makefile.in
+++ b/tests/gpg/Makefile.in
@@ -105,12 +105,16 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
$(top_srcdir)/build-aux/depcomp $(noinst_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/glib-2.0.m4 \
- $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnupg-ttyname.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_pkg_swig.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
+ $(top_srcdir)/m4/gnupg-ttyname.m4 \
$(top_srcdir)/m4/gpg-error.m4 $(top_srcdir)/m4/libassuan.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/qt.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@@ -127,7 +131,7 @@ am__EXEEXT_2 = t-encrypt$(EXEEXT) t-encrypt-sym$(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)
+ t-gpgconf$(EXEEXT) t-encrypt-mixed$(EXEEXT) $(am__EXEEXT_1)
PROGRAMS = $(noinst_PROGRAMS)
t_decrypt_SOURCES = t-decrypt.c
t_decrypt_OBJECTS = t-decrypt.$(OBJEXT)
@@ -153,6 +157,10 @@ t_encrypt_large_SOURCES = t-encrypt-large.c
t_encrypt_large_OBJECTS = t-encrypt-large.$(OBJEXT)
t_encrypt_large_LDADD = $(LDADD)
t_encrypt_large_DEPENDENCIES = ../../src/libgpgme.la
+t_encrypt_mixed_SOURCES = t-encrypt-mixed.c
+t_encrypt_mixed_OBJECTS = t-encrypt-mixed.$(OBJEXT)
+t_encrypt_mixed_LDADD = $(LDADD)
+t_encrypt_mixed_DEPENDENCIES = ../../src/libgpgme.la
t_encrypt_sign_SOURCES = t-encrypt-sign.c
t_encrypt_sign_OBJECTS = t-encrypt-sign.$(OBJEXT)
t_encrypt_sign_LDADD = $(LDADD)
@@ -255,17 +263,17 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = t-decrypt.c t-decrypt-verify.c t-edit.c t-encrypt.c \
- t-encrypt-large.c t-encrypt-sign.c t-encrypt-sym.c \
- t-eventloop.c t-export.c t-file-name.c t-genkey.c t-gpgconf.c \
- t-import.c t-keylist.c t-keylist-sig.c t-sig-notation.c \
- t-sign.c t-signers.c t-thread1.c t-trustlist.c t-verify.c \
- t-wait.c
+ t-encrypt-large.c t-encrypt-mixed.c t-encrypt-sign.c \
+ t-encrypt-sym.c t-eventloop.c t-export.c t-file-name.c \
+ t-genkey.c t-gpgconf.c t-import.c t-keylist.c t-keylist-sig.c \
+ t-sig-notation.c t-sign.c t-signers.c t-thread1.c \
+ t-trustlist.c t-verify.c t-wait.c
DIST_SOURCES = t-decrypt.c t-decrypt-verify.c t-edit.c t-encrypt.c \
- t-encrypt-large.c t-encrypt-sign.c t-encrypt-sym.c \
- t-eventloop.c t-export.c t-file-name.c t-genkey.c t-gpgconf.c \
- t-import.c t-keylist.c t-keylist-sig.c t-sig-notation.c \
- t-sign.c t-signers.c t-thread1.c t-trustlist.c t-verify.c \
- t-wait.c
+ t-encrypt-large.c t-encrypt-mixed.c t-encrypt-sign.c \
+ t-encrypt-sym.c t-eventloop.c t-export.c t-file-name.c \
+ t-genkey.c t-gpgconf.c t-import.c t-keylist.c t-keylist-sig.c \
+ t-sig-notation.c t-sign.c t-signers.c t-thread1.c \
+ t-trustlist.c t-verify.c t-wait.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -328,6 +336,7 @@ BUILD_REVISION = @BUILD_REVISION@
BUILD_TIMESTAMP = @BUILD_TIMESTAMP@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
@@ -339,12 +348,14 @@ CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLED_LANGUAGES = @ENABLED_LANGUAGES@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GITLOG_TO_CHANGELOG = @GITLOG_TO_CHANGELOG@
@@ -355,15 +366,23 @@ GLIB_LIBS = @GLIB_LIBS@
GLIB_MKENUMS = @GLIB_MKENUMS@
GOBJECT_QUERY = @GOBJECT_QUERY@
GPGME_CONFIG_API_VERSION = @GPGME_CONFIG_API_VERSION@
+GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
+GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
+GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
+GPGME_QT_LIBS = @GPGME_QT_LIBS@
GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@
GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@
GPG_ERROR_LIBS = @GPG_ERROR_LIBS@
GPG_ERROR_MT_CFLAGS = @GPG_ERROR_MT_CFLAGS@
GPG_ERROR_MT_LIBS = @GPG_ERROR_MT_LIBS@
+GRAPHVIZ = @GRAPHVIZ@
GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_DOT = @HAVE_DOT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -374,10 +393,16 @@ LDFLAGS = @LDFLAGS@
LIBASSUAN_CFLAGS = @LIBASSUAN_CFLAGS@
LIBASSUAN_CONFIG = @LIBASSUAN_CONFIG@
LIBASSUAN_LIBS = @LIBASSUAN_LIBS@
+LIBGPGMEPP_LT_AGE = @LIBGPGMEPP_LT_AGE@
+LIBGPGMEPP_LT_CURRENT = @LIBGPGMEPP_LT_CURRENT@
+LIBGPGMEPP_LT_REVISION = @LIBGPGMEPP_LT_REVISION@
LIBGPGME_LT_AGE = @LIBGPGME_LT_AGE@
LIBGPGME_LT_CURRENT = @LIBGPGME_LT_CURRENT@
LIBGPGME_LT_REVISION = @LIBGPGME_LT_REVISION@
LIBOBJS = @LIBOBJS@
+LIBQGPGME_LT_AGE = @LIBQGPGME_LT_AGE@
+LIBQGPGME_LT_CURRENT = @LIBQGPGME_LT_CURRENT@
+LIBQGPGME_LT_REVISION = @LIBQGPGME_LT_REVISION@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
@@ -387,6 +412,8 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
+MOC = @MOC@
+MOC2 = @MOC2@
NEED__FILE_OFFSET_BITS = @NEED__FILE_OFFSET_BITS@
NM = @NM@
NMEDIT = @NMEDIT@
@@ -403,14 +430,27 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
-QT4_CORE_CFLAGS = @QT4_CORE_CFLAGS@
-QT4_CORE_LIBS = @QT4_CORE_LIBS@
+PYTHON = @PYTHON@
+PYTHONS = @PYTHONS@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
+PYTHON_VERSION = @PYTHON_VERSION@
+PYTHON_VERSIONS = @PYTHON_VERSIONS@
+QTCHOOSER = @QTCHOOSER@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+SWIG = @SWIG@
+SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
VERSION_NUMBER = @VERSION_NUMBER@
@@ -459,9 +499,13 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -484,7 +528,7 @@ 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)
+ t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(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~ \
@@ -569,6 +613,10 @@ t-encrypt-large$(EXEEXT): $(t_encrypt_large_OBJECTS) $(t_encrypt_large_DEPENDENC
@rm -f t-encrypt-large$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(t_encrypt_large_OBJECTS) $(t_encrypt_large_LDADD) $(LIBS)
+t-encrypt-mixed$(EXEEXT): $(t_encrypt_mixed_OBJECTS) $(t_encrypt_mixed_DEPENDENCIES) $(EXTRA_t_encrypt_mixed_DEPENDENCIES)
+ @rm -f t-encrypt-mixed$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_encrypt_mixed_OBJECTS) $(t_encrypt_mixed_LDADD) $(LIBS)
+
t-encrypt-sign$(EXEEXT): $(t_encrypt_sign_OBJECTS) $(t_encrypt_sign_DEPENDENCIES) $(EXTRA_t_encrypt_sign_DEPENDENCIES)
@rm -f t-encrypt-sign$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(t_encrypt_sign_OBJECTS) $(t_encrypt_sign_LDADD) $(LIBS)
@@ -647,6 +695,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-decrypt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-edit.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-encrypt-large.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-encrypt-mixed.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-encrypt-sign.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-encrypt-sym.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-encrypt.Po@am__quote@
@@ -1015,11 +1064,11 @@ export GPG_AGENT_INFO :=
echo x > ./private-keys-v1.d/gpg-sample.stamp
./pubring-stamp: $(srcdir)/pubdemo.asc
- $(GPG) --no-permission-warning \
+ $(GPG) --batch --no-permission-warning \
--import $(srcdir)/pubdemo.asc
- -$(GPG) --no-permission-warning \
+ -$(GPG) --batch --no-permission-warning \
--import $(srcdir)/secdemo.asc
- touch ./pubring-stamp
+ echo x > ./pubring-stamp
./gpg.conf:
# This is required for t-sig-notations.
diff --git a/tests/gpg/t-decrypt-verify.c b/tests/gpg/t-decrypt-verify.c
index 113aec1..b774cfd 100644
--- a/tests/gpg/t-decrypt-verify.c
+++ b/tests/gpg/t-decrypt-verify.c
@@ -1,23 +1,22 @@
/* t-decrypt-verify.c - Regression test.
- Copyright (C) 2000 Werner Koch (dd9jn)
- Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
-
- This file is part of GPGME.
-
- GPGME is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- GPGME is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
+ * Copyright (C) 2000 Werner Koch (dd9jn)
+ * Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
+ *
+ * This file is part of GPGME.
+ *
+ * GPGME is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * GPGME is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
/* We need to include config.h so that we know whether we are building
with large file system (LFS) support. */
@@ -38,7 +37,7 @@
static void
check_verify_result (gpgme_verify_result_t result, unsigned int summary,
- char *fpr, gpgme_error_t status)
+ const char *fpr, gpgme_error_t status)
{
gpgme_signature_t sig;
@@ -94,7 +93,7 @@ check_verify_result (gpgme_verify_result_t result, unsigned int summary,
}
-int
+int
main (int argc, char *argv[])
{
gpgme_ctx_t ctx;
@@ -102,9 +101,12 @@ main (int argc, char *argv[])
gpgme_data_t in, out;
gpgme_decrypt_result_t decrypt_result;
gpgme_verify_result_t verify_result;
- const char *cipher_2_asc = make_filename ("cipher-2.asc");
+ char *cipher_2_asc = make_filename ("cipher-2.asc");
char *agent_info;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
@@ -115,6 +117,7 @@ main (int argc, char *argv[])
gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
err = gpgme_data_new_from_file (&in, cipher_2_asc, 1);
+ free (cipher_2_asc);
fail_if_err (err);
err = gpgme_data_new (&out);
fail_if_err (err);
@@ -127,7 +130,7 @@ main (int argc, char *argv[])
fprintf (stderr, "%s:%i: unsupported algorithm: %s\n",
__FILE__, __LINE__, decrypt_result->unsupported_algorithm);
exit (1);
- }
+ }
print_data (out);
verify_result = gpgme_op_verify_result (ctx);
check_verify_result (verify_result, 0,
diff --git a/tests/gpg/t-decrypt.c b/tests/gpg/t-decrypt.c
index 2a2f4d7..92fadd6 100644
--- a/tests/gpg/t-decrypt.c
+++ b/tests/gpg/t-decrypt.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -36,16 +36,19 @@
#include "t-support.h"
-int
+int
main (int argc, char *argv[])
{
gpgme_ctx_t ctx;
gpgme_error_t err;
gpgme_data_t in, out;
gpgme_decrypt_result_t result;
- const char *cipher_1_asc = make_filename ("cipher-1.asc");
+ char *cipher_1_asc = make_filename ("cipher-1.asc");
char *agent_info;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
@@ -56,11 +59,12 @@ main (int argc, char *argv[])
gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
err = gpgme_data_new_from_file (&in, cipher_1_asc, 1);
+ free (cipher_1_asc);
fail_if_err (err);
err = gpgme_data_new (&out);
fail_if_err (err);
-
+
err = gpgme_op_decrypt (ctx, in, out);
fail_if_err (err);
result = gpgme_op_decrypt_result (ctx);
@@ -71,7 +75,7 @@ main (int argc, char *argv[])
exit (1);
}
print_data (out);
-
+
gpgme_data_release (in);
gpgme_data_release (out);
gpgme_release (ctx);
diff --git a/tests/gpg/t-edit.c b/tests/gpg/t-edit.c
index 545db73..7b444fa 100644
--- a/tests/gpg/t-edit.c
+++ b/tests/gpg/t-edit.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -43,7 +43,7 @@ flush_data (gpgme_data_t dh)
{
char buf[100];
int ret;
-
+
ret = gpgme_data_seek (dh, 0, SEEK_SET);
if (ret)
fail_if_err (gpgme_error_from_errno (errno));
@@ -55,22 +55,22 @@ flush_data (gpgme_data_t dh)
gpgme_error_t
-edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd)
+interact_fnc (void *opaque, const char *status, const char *args, int fd)
{
- char *result = NULL;
+ const char *result = NULL;
gpgme_data_t out = (gpgme_data_t) opaque;
fputs ("[-- Response --]\n", stdout);
- flush_data (out);
+ flush_data (out);
- fprintf (stdout, "[-- Code: %i, %s --]\n", status, args);
+ fprintf (stdout, "[-- Code: %s, %s --]\n", status, args);
if (fd >= 0)
{
if (!strcmp (args, "keyedit.prompt"))
{
static int step = 0;
-
+
switch (step)
{
case 0:
@@ -103,14 +103,14 @@ edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd)
if (result)
{
- gpgme_io_write (fd, result, strlen (result));
- gpgme_io_write (fd, "\n", 1);
+ gpgme_io_writen (fd, result, strlen (result));
+ gpgme_io_writen (fd, "\n", 1);
}
return 0;
}
-int
+int
main (int argc, char **argv)
{
gpgme_ctx_t ctx;
@@ -120,6 +120,9 @@ main (int argc, char **argv)
const char *pattern = "Alpha";
char *agent_info;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
@@ -138,7 +141,7 @@ main (int argc, char **argv)
err = gpgme_op_keylist_end (ctx);
fail_if_err (err);
- err = gpgme_op_edit (ctx, key, edit_fnc, out, out);
+ err = gpgme_op_interact (ctx, key, 0, interact_fnc, out, out);
fail_if_err (err);
fputs ("[-- Last response --]\n", stdout);
diff --git a/tests/gpg/t-encrypt-large.c b/tests/gpg/t-encrypt-large.c
index 6cc6138..8d78a04 100644
--- a/tests/gpg/t-encrypt-large.c
+++ b/tests/gpg/t-encrypt-large.c
@@ -2,17 +2,17 @@
Copyright (C) 2005 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
@@ -50,7 +50,7 @@ read_cb (void *handle, void *buffer, size_t size)
for (; size && parms->bytes_to_send; size--, parms->bytes_to_send--)
*p++ = rand ();
-
+
return (p - (char*)buffer);
}
@@ -60,6 +60,8 @@ write_cb (void *handle, const void *buffer, size_t size)
{
struct cb_parms *parms = handle;
+ (void)buffer;
+
parms->bytes_received += size;
return size;
@@ -70,13 +72,18 @@ static void
progress_cb (void *opaque, const char *what, int type, int current, int total)
{
/* This is just a dummy. */
+ (void)opaque;
+ (void)what;
+ (void)type;
+ (void)current;
+ (void)total;
}
-int
+int
main (int argc, char *argv[])
{
gpgme_ctx_t ctx;
@@ -94,7 +101,7 @@ main (int argc, char *argv[])
nbytes = 100000;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
-
+
memset (&cbs, 0, sizeof cbs);
cbs.read = read_cb;
cbs.write = write_cb;
@@ -131,7 +138,7 @@ main (int argc, char *argv[])
result->invalid_recipients->fpr);
exit (1);
}
- printf ("plaintext=%u bytes, ciphertext=%u bytes\n",
+ printf ("plaintext=%u bytes, ciphertext=%u bytes\n",
(unsigned int)nbytes, (unsigned int)parms.bytes_received);
gpgme_key_unref (key[0]);
diff --git a/tests/gpg/t-encrypt-mixed.c b/tests/gpg/t-encrypt-mixed.c
new file mode 100644
index 0000000..afe5ba2
--- /dev/null
+++ b/tests/gpg/t-encrypt-mixed.c
@@ -0,0 +1,129 @@
+/* t-encrypt-mixed.c - Regression test.
+ Copyright (C) 2016 Intevation 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. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <gpgme.h>
+
+#include "t-support.h"
+
+/* Tests mixed symmetric and asymetric decryption. Verifies
+ that an encrypted message can be decrypted without the
+ secret key but that the recipient is also set correctly. */
+int
+main (void)
+{
+ gpgme_ctx_t ctx;
+ gpgme_error_t err;
+ gpgme_data_t in, out;
+ gpgme_key_t key[2] = { NULL, NULL };
+ gpgme_encrypt_result_t result;
+ gpgme_decrypt_result_t dec_result;
+ gpgme_recipient_t recipient;
+ const char *text = "Hallo Leute\n";
+ char *text2;
+ size_t len;
+
+ init_gpgme (GPGME_PROTOCOL_OpenPGP);
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+ gpgme_set_armor (ctx, 1);
+
+ err = gpgme_data_new_from_mem (&in, text, strlen (text), 0);
+ fail_if_err (err);
+
+ err = gpgme_data_new (&out);
+ fail_if_err (err);
+
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+
+ /* A recipient for which we don't have a secret key */
+ err = gpgme_get_key (ctx, "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2",
+ &key[0], 0);
+ fail_if_err (err);
+
+ err = gpgme_op_encrypt (ctx, key,
+ GPGME_ENCRYPT_ALWAYS_TRUST | GPGME_ENCRYPT_SYMMETRIC,
+ in, out);
+ fail_if_err (err);
+ result = gpgme_op_encrypt_result (ctx);
+ if (result->invalid_recipients)
+ {
+ fprintf (stderr, "Invalid recipient encountered: %s\n",
+ result->invalid_recipients->fpr);
+ exit (1);
+ }
+
+ print_data (out);
+
+ /* Now try to decrypt */
+ gpgme_data_seek (out, 0, SEEK_SET);
+
+ gpgme_data_release (in);
+ err = gpgme_data_new (&in);
+ fail_if_err (err);
+
+ err = gpgme_op_decrypt (ctx, out, in);
+ fail_if_err (err);
+
+ fputs ("Begin Result Decryption:\n", stdout);
+ print_data (in);
+ fputs ("End Result.\n", stdout);
+
+ dec_result = gpgme_op_decrypt_result (ctx);
+ if (dec_result->unsupported_algorithm || dec_result->wrong_key_usage)
+ {
+ fprintf (stderr, "%s:%d: Decryption failed\n", __FILE__, __LINE__);
+ exit (1);
+ }
+
+ text2 = gpgme_data_release_and_get_mem (in, &len);
+ if (strncmp (text, text2, len))
+ {
+ fprintf (stderr, "%s:%d: Wrong plaintext\n", __FILE__, __LINE__);
+ exit (1);
+ }
+
+ recipient = dec_result->recipients;
+ if (!recipient || recipient->next)
+ {
+ fprintf (stderr, "%s:%d: Invalid recipients \n", __FILE__, __LINE__);
+ exit (1);
+ }
+
+ if (strncmp (recipient->keyid, "5381EA4EE29BA37F", 16))
+ {
+ fprintf (stderr, "%s:%d: Not encrypted to recipient's subkey \n", __FILE__, __LINE__);
+ exit (1);
+ }
+
+ gpgme_key_unref (key[0]);
+ free (text2);
+ gpgme_data_release (out);
+ gpgme_release (ctx);
+ return 0;
+}
diff --git a/tests/gpg/t-encrypt-sign.c b/tests/gpg/t-encrypt-sign.c
index 1e1262f..41d16a0 100644
--- a/tests/gpg/t-encrypt-sign.c
+++ b/tests/gpg/t-encrypt-sign.c
@@ -94,6 +94,9 @@ main (int argc, char **argv)
gpgme_sign_result_t sign_result;
char *agent_info;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
diff --git a/tests/gpg/t-encrypt-sym.c b/tests/gpg/t-encrypt-sym.c
index 51a3fc1..8e5e7ff 100644
--- a/tests/gpg/t-encrypt-sym.c
+++ b/tests/gpg/t-encrypt-sym.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -36,7 +36,7 @@
#include "t-support.h"
-int
+int
main (int argc, char *argv[])
{
gpgme_ctx_t ctx;
@@ -47,6 +47,9 @@ main (int argc, char *argv[])
char *p;
size_t len;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
@@ -92,6 +95,7 @@ main (int argc, char *argv[])
}
gpgme_data_release (cipher);
+ free (text2);
gpgme_release (ctx);
return 0;
diff --git a/tests/gpg/t-encrypt.c b/tests/gpg/t-encrypt.c
index 264f31a..6eafc00 100644
--- a/tests/gpg/t-encrypt.c
+++ b/tests/gpg/t-encrypt.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -34,7 +34,7 @@
#include "t-support.h"
-int
+int
main (int argc, char *argv[])
{
gpgme_ctx_t ctx;
@@ -43,8 +43,11 @@ main (int argc, char *argv[])
gpgme_key_t key[3] = { NULL, NULL, NULL };
gpgme_encrypt_result_t result;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
-
+
err = gpgme_new (&ctx);
fail_if_err (err);
gpgme_set_armor (ctx, 1);
diff --git a/tests/gpg/t-eventloop.c b/tests/gpg/t-eventloop.c
index cb1e57c..74af35f 100644
--- a/tests/gpg/t-eventloop.c
+++ b/tests/gpg/t-eventloop.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -167,8 +167,8 @@ struct gpgme_io_cbs io_cbs =
};
-int
-main (int argc, char *argv[])
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -214,7 +214,7 @@ main (int argc, char *argv[])
fputs ("Begin Result:\n", stdout);
print_data (out);
fputs ("End Result.\n", stdout);
-
+
gpgme_key_unref (key[0]);
gpgme_key_unref (key[1]);
gpgme_data_release (in);
diff --git a/tests/gpg/t-export.c b/tests/gpg/t-export.c
index 85cff23..eaed829 100644
--- a/tests/gpg/t-export.c
+++ b/tests/gpg/t-export.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -35,7 +35,7 @@
#include "t-support.h"
-int
+int
main (int argc, char **argv)
{
gpgme_ctx_t ctx;
@@ -44,6 +44,9 @@ main (int argc, char **argv)
const char *pattern[] = { "Alpha", "Bob", NULL };
gpgme_key_t keyarray[3];
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
@@ -60,7 +63,7 @@ main (int argc, char **argv)
fputs ("Begin Result:\n", stdout);
print_data (out);
fputs ("End Result.\n", stdout);
-
+
gpgme_data_release (out);
/* Again. Now using a key array. */
@@ -84,11 +87,11 @@ main (int argc, char **argv)
fputs ("Begin Result:\n", stdout);
print_data (out);
fputs ("End Result.\n", stdout);
-
+
gpgme_data_release (out);
gpgme_release (ctx);
-
+
return 0;
}
diff --git a/tests/gpg/t-file-name.c b/tests/gpg/t-file-name.c
index eb20fc0..3c2a796 100644
--- a/tests/gpg/t-file-name.c
+++ b/tests/gpg/t-file-name.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -36,8 +36,8 @@
#define TESTNAME "abcde12345"
-int
-main (int argc, char *argv[])
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -47,7 +47,7 @@ main (int argc, char *argv[])
char *agent_info;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
-
+
err = gpgme_new (&ctx);
fail_if_err (err);
gpgme_set_armor (ctx, 1);
@@ -87,7 +87,7 @@ main (int argc, char *argv[])
{
fprintf (stderr, "%s:%i: Unexpected result file name: %s\n",
__FILE__, __LINE__,
- result->file_name ? "(null)" : result->file_name);
+ result->file_name ? result->file_name : "(null)");
exit (1);
}
diff --git a/tests/gpg/t-genkey.c b/tests/gpg/t-genkey.c
index 407824f..f0127f7 100644
--- a/tests/gpg/t-genkey.c
+++ b/tests/gpg/t-genkey.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -40,6 +40,8 @@ static int progress_called;
static void
progress (void *self, const char *what, int type, int current, int total)
{
+ (void)self;
+
if (!strcmp (what, "primegen") && !current && !total
&& (type == '.' || type == '+' || type == '!'
|| type == '^' || type == '<' || type == '>'))
@@ -57,7 +59,7 @@ progress (void *self, const char *what, int type, int current, int total)
}
-int
+int
main (int argc, char **argv)
{
gpgme_ctx_t ctx;
@@ -75,13 +77,16 @@ main (int argc, char **argv)
"</GnupgKeyParms>\n";
gpgme_genkey_result_t result;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
fail_if_err (err);
gpgme_set_progress_cb (ctx, progress, NULL);
-
+
err = gpgme_op_genkey (ctx, parms, NULL, NULL);
fail_if_err (err);
diff --git a/tests/gpg/t-gpgconf.c b/tests/gpg/t-gpgconf.c
index 8e487b7..55033bf 100644
--- a/tests/gpg/t-gpgconf.c
+++ b/tests/gpg/t-gpgconf.c
@@ -7,12 +7,12 @@
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
@@ -172,8 +172,8 @@ dump_opt (gpgme_conf_opt_t opt)
{
if (opt->argname)
{
- char *more = (opt->flags & GPGME_CONF_LIST) ? "..." : "";
-
+ const char *more = (opt->flags & GPGME_CONF_LIST) ? "..." : "";
+
if (opt->flags & GPGME_CONF_OPTIONAL)
{
printf ("%c%c --%s [%s%s] %s", level, runtime, opt->name, opt->argname, more,
@@ -187,7 +187,7 @@ dump_opt (gpgme_conf_opt_t opt)
}
else
printf ("%c%c --%s%s", level, runtime, opt->name, spaces (opt->name, 5));
-
+
if (opt->description)
printf ("%s", opt->description);
printf ("\n");
@@ -250,8 +250,8 @@ dump_comp (gpgme_conf_comp_t comp)
}
-int
-main (int argc, char **argv)
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -302,13 +302,13 @@ main (int argc, char **argv)
opt = comp->options;
while (opt && strcmp (opt->name, "verbose"))
opt = opt->next;
-
+
/* Allow for the verbose option not to be there. */
if (opt)
{
err = gpgme_conf_opt_change (opt, 0, arg);
fail_if_err (err);
-
+
err = gpgme_op_conf_save (ctx, comp);
fail_if_err (err);
}
diff --git a/tests/gpg/t-import.c b/tests/gpg/t-import.c
index d673f87..89a5815 100644
--- a/tests/gpg/t-import.c
+++ b/tests/gpg/t-import.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -36,7 +36,7 @@
void
-check_result (gpgme_import_result_t result, char *fpr, int secret)
+check_result (gpgme_import_result_t result, const char *fpr, int secret)
{
if (result->considered != 1 && (secret && result->considered != 3))
{
@@ -207,15 +207,18 @@ check_result (gpgme_import_result_t result, char *fpr, int secret)
}
-int
+int
main (int argc, char *argv[])
{
gpgme_ctx_t ctx;
gpgme_error_t err;
gpgme_data_t in;
gpgme_import_result_t result;
- const char *pubkey_1_asc = make_filename ("pubkey-1.asc");
- const char *seckey_1_asc = make_filename ("seckey-1.asc");
+ char *pubkey_1_asc = make_filename ("pubkey-1.asc");
+ char *seckey_1_asc = make_filename ("seckey-1.asc");
+
+ (void)argc;
+ (void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
@@ -223,6 +226,7 @@ main (int argc, char *argv[])
fail_if_err (err);
err = gpgme_data_new_from_file (&in, pubkey_1_asc, 1);
+ free (pubkey_1_asc);
fail_if_err (err);
err = gpgme_op_import (ctx, in);
@@ -232,6 +236,7 @@ main (int argc, char *argv[])
gpgme_data_release (in);
err = gpgme_data_new_from_file (&in, seckey_1_asc, 1);
+ free (seckey_1_asc);
fail_if_err (err);
err = gpgme_op_import (ctx, in);
diff --git a/tests/gpg/t-keylist-sig.c b/tests/gpg/t-keylist-sig.c
index ec30624..fdec7ca 100644
--- a/tests/gpg/t-keylist-sig.c
+++ b/tests/gpg/t-keylist-sig.c
@@ -36,20 +36,20 @@
struct
{
- char *fpr;
- char *sec_keyid;
+ const char *fpr;
+ const char *sec_keyid;
struct
{
- char *name;
- char *comment;
- char *email;
+ const char *name;
+ const char *comment;
+ const char *email;
struct
{
gpgme_pubkey_algo_t algo;
- char *keyid;
- char *name;
- char *comment;
- char *email;
+ const char *keyid;
+ const char *name;
+ const char *comment;
+ const char *email;
unsigned int sig_class;
int exportable;
} sig;
@@ -72,7 +72,7 @@ keys[] =
int
-main (int argc, char **argv)
+main (void)
{
gpgme_error_t err;
gpgme_ctx_t ctx;
diff --git a/tests/gpg/t-keylist.c b/tests/gpg/t-keylist.c
index 67844cb..6ee023c 100644
--- a/tests/gpg/t-keylist.c
+++ b/tests/gpg/t-keylist.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -36,13 +36,13 @@
struct key_info_s
{
- char *fpr;
- char *sec_keyid;
+ const char *fpr;
+ const char *sec_keyid;
struct
{
- char *name;
- char *comment;
- char *email;
+ const char *name;
+ const char *comment;
+ const char *email;
} uid[3];
int n_subkeys;
void (*misc_check)(struct key_info_s *keyinfo, gpgme_key_t key);
@@ -121,7 +121,7 @@ struct key_info_s keys[] =
};
-int
+int
main (int argc, char **argv)
{
gpgme_error_t err;
@@ -132,6 +132,9 @@ main (int argc, char **argv)
int n;
gpgme_subkey_t subkey;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
@@ -139,7 +142,7 @@ main (int argc, char **argv)
err = gpgme_op_keylist_start (ctx, NULL, 0);
fail_if_err (err);
-
+
while (!(err = gpgme_op_keylist_next (ctx, &key)))
{
if (!keys[i].fpr)
@@ -223,7 +226,7 @@ main (int argc, char **argv)
exit (1);
}
- for (n=0, subkey = key->subkeys; subkey; subkey = subkey->next)
+ for (n=0, subkey = key->subkeys; subkey; subkey = subkey->next)
n++;
if (!n || n-1 != keys[i].n_subkeys)
{
@@ -583,7 +586,7 @@ check_whisky (struct key_info_s *keyinfo, gpgme_key_t key)
{
const char *name = keyinfo->uid[0].name;
gpgme_subkey_t sub1, sub2;
-
+
sub1 = key->subkeys->next->next;
sub2 = sub1->next;
diff --git a/tests/gpg/t-sig-notation.c b/tests/gpg/t-sig-notation.c
index 7345a52..aee7551 100644
--- a/tests/gpg/t-sig-notation.c
+++ b/tests/gpg/t-sig-notation.c
@@ -2,17 +2,17 @@
Copyright (C) 2005 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
@@ -24,6 +24,7 @@
#include <config.h>
#endif
+#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -33,19 +34,24 @@
#include "t-support.h"
+
+/* GnuPG prior to 2.1.13 did not report the critical flag
+ correctly. */
+int have_correct_sig_data;
+
static struct {
const char *name;
const char *value;
gpgme_sig_notation_flags_t flags;
int seen;
-} expected_notations[] = {
+} expected_notations[] = {
{ "laughing@me",
"Just Squeeze Me",
GPGME_SIG_NOTATION_HUMAN_READABLE },
{ "preferred-email-encoding@pgp.com",
"pgpmime",
GPGME_SIG_NOTATION_HUMAN_READABLE | GPGME_SIG_NOTATION_CRITICAL },
- { NULL,
+ { NULL,
"http://www.gnu.org/policy/",
0 }
};
@@ -55,7 +61,7 @@ check_result (gpgme_verify_result_t result)
{
int i;
gpgme_sig_notation_t r;
-
+
gpgme_signature_t sig;
sig = result->signatures;
@@ -68,7 +74,7 @@ check_result (gpgme_verify_result_t result)
for (i=0; i < DIM(expected_notations); i++ )
expected_notations[i].seen = 0;
-
+
for (r = result->signatures->notations; r; r = r->next)
{
int any = 0;
@@ -84,10 +90,16 @@ check_result (gpgme_verify_result_t result)
&& !strcmp (r->value, expected_notations[i].value)
&& r->value_len == strlen (expected_notations[i].value)
&& r->flags
- == (expected_notations[i].flags & ~GPGME_SIG_NOTATION_CRITICAL)
+ == (have_correct_sig_data
+ ? expected_notations[i].flags
+ : expected_notations[i].flags
+ & ~GPGME_SIG_NOTATION_CRITICAL)
&& r->human_readable
== !!(r->flags & GPGME_SIG_NOTATION_HUMAN_READABLE)
- && r->critical == 0)
+ && r->critical
+ == (have_correct_sig_data
+ ? !!(r->flags & GPGME_SIG_NOTATION_CRITICAL)
+ : 0))
{
expected_notations[i].seen++;
any++;
@@ -112,7 +124,7 @@ check_result (gpgme_verify_result_t result)
}
-int
+int
main (int argc, char *argv[])
{
gpgme_ctx_t ctx;
@@ -121,9 +133,28 @@ main (int argc, char *argv[])
gpgme_verify_result_t result;
char *agent_info;
int i;
+ gpgme_engine_info_t engine_info;
+
+ (void)argc;
+ (void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
+ err = gpgme_get_engine_info (&engine_info);
+ fail_if_err (err);
+ for (; engine_info; engine_info = engine_info->next)
+ if (engine_info->protocol == GPGME_PROTOCOL_OpenPGP)
+ break;
+ assert (engine_info);
+
+ /* GnuPG prior to 2.1.13 did not report the critical flag
+ correctly. */
+ have_correct_sig_data =
+ ! (strncmp ("1.", engine_info->version, 2) == 0
+ || (strncmp ("2.1.1", engine_info->version, 5) == 0
+ && (engine_info->version[5] == 0
+ || engine_info->version[5] < '3')));
+
err = gpgme_new (&ctx);
fail_if_err (err);
@@ -144,7 +175,7 @@ main (int argc, char *argv[])
expected_notations[i].flags);
fail_if_err (err);
}
-
+
err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_NORMAL);
fail_if_err (err);
diff --git a/tests/gpg/t-sign.c b/tests/gpg/t-sign.c
index bdd3323..66f54ea 100644
--- a/tests/gpg/t-sign.c
+++ b/tests/gpg/t-sign.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -82,7 +82,7 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)
}
-int
+int
main (int argc, char **argv)
{
gpgme_ctx_t ctx;
@@ -91,6 +91,9 @@ main (int argc, char **argv)
gpgme_sign_result_t result;
char *agent_info;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
@@ -102,7 +105,7 @@ main (int argc, char **argv)
gpgme_set_textmode (ctx, 1);
gpgme_set_armor (ctx, 1);
-
+
#if 0
{
gpgme_key_t akey;
@@ -126,8 +129,8 @@ main (int argc, char **argv)
check_result (result, GPGME_SIG_MODE_NORMAL);
print_data (out);
gpgme_data_release (out);
-
- /* Now a detached signature. */
+
+ /* Now a detached signature. */
gpgme_data_seek (in, 0, SEEK_SET);
err = gpgme_data_new (&out);
fail_if_err (err);
diff --git a/tests/gpg/t-signers.c b/tests/gpg/t-signers.c
index c75c1d4..b1eb191 100644
--- a/tests/gpg/t-signers.c
+++ b/tests/gpg/t-signers.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -93,7 +93,7 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)
}
-int
+int
main (int argc, char *argv[])
{
gpgme_ctx_t ctx;
@@ -103,6 +103,9 @@ main (int argc, char *argv[])
gpgme_sign_result_t result;
char *agent_info;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
@@ -141,7 +144,7 @@ main (int argc, char *argv[])
check_result (result, GPGME_SIG_MODE_NORMAL);
print_data (out);
gpgme_data_release (out);
-
+
/* Now a detached signature. */
gpgme_data_seek (in, 0, SEEK_SET);
err = gpgme_data_new (&out);
@@ -152,7 +155,7 @@ main (int argc, char *argv[])
check_result (result, GPGME_SIG_MODE_DETACH);
print_data (out);
gpgme_data_release (out);
-
+
/* And finally a cleartext signature. */
gpgme_data_seek (in, 0, SEEK_SET);
err = gpgme_data_new (&out);
@@ -161,10 +164,10 @@ main (int argc, char *argv[])
fail_if_err (err);
result = gpgme_op_sign_result (ctx);
check_result (result, GPGME_SIG_MODE_CLEAR);
- print_data (out);
+ print_data (out);
gpgme_data_release (out);
gpgme_data_seek (in, 0, SEEK_SET);
-
+
gpgme_data_release (in);
gpgme_release (ctx);
diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h
index 6a18b5c..db69dd0 100644
--- a/tests/gpg/t-support.h
+++ b/tests/gpg/t-support.h
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -61,7 +61,7 @@ print_data (gpgme_data_t dh)
#define BUF_SIZE 512
char buf[BUF_SIZE + 1];
int ret;
-
+
ret = gpgme_data_seek (dh, 0, SEEK_SET);
if (ret)
fail_if_err (gpgme_err_code_from_errno (errno));
@@ -76,27 +76,25 @@ gpgme_error_t
passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info,
int last_was_bad, int fd)
{
-#ifdef HAVE_W32_SYSTEM
- DWORD written;
- WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0);
-#else
int res;
- char *pass = "abc\n";
+ char pass[] = "abc\n";
int passlen = strlen (pass);
int off = 0;
+ (void)opaque;
+ (void)uid_hint;
+ (void)passphrase_info;
+ (void)last_was_bad;
+
do
{
- res = write (fd, &pass[off], passlen - off);
+ res = gpgme_io_write (fd, &pass[off], passlen - off);
if (res > 0)
off += res;
}
while (res > 0 && off != passlen);
return off == passlen ? 0 : gpgme_error_from_errno (errno);
-#endif
-
- return 0;
}
@@ -109,7 +107,7 @@ make_filename (const char *fname)
if (!srcdir)
srcdir = ".";
buf = malloc (strlen(srcdir) + strlen(fname) + 2);
- if (!buf)
+ if (!buf)
exit (8);
strcpy (buf, srcdir);
strcat (buf, "/");
diff --git a/tests/gpg/t-thread1.c b/tests/gpg/t-thread1.c
index 86ea51a..2f9ee5d 100644
--- a/tests/gpg/t-thread1.c
+++ b/tests/gpg/t-thread1.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -68,7 +68,7 @@ thread_one (void *name)
err = gpgme_get_key (ctx, "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2",
&key[1], 0);
fail_if_err (err);
-
+
err = gpgme_op_encrypt (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out);
fail_if_err (err);
result = gpgme_op_encrypt_result (ctx);
@@ -94,7 +94,7 @@ void *
thread_two (void *name)
{
int i;
- const char *cipher_1_asc = make_filename ("cipher-1.asc");
+ char *cipher_1_asc = make_filename ("cipher-1.asc");
char *agent_info;
agent_info = getenv("GPG_AGENT_INFO");
@@ -119,7 +119,7 @@ thread_two (void *name)
err = gpgme_data_new (&out);
fail_if_err (err);
-
+
err = gpgme_op_decrypt (ctx, in, out);
fail_if_err (err);
result = gpgme_op_decrypt_result (ctx);
@@ -130,24 +130,27 @@ thread_two (void *name)
exit (1);
}
printf ("Decrypt %s %i\n", (char *) name, i);
-
+
gpgme_data_release (in);
gpgme_data_release (out);
gpgme_release (ctx);
}
+ free (cipher_1_asc);
return NULL;
}
-int
-main (int argc, char *argv[])
+int
+main (void)
{
pthread_t tone;
pthread_t ttwo;
+ char arg_A[] = "A";
+ char arg_B[] = "B";
init_gpgme (GPGME_PROTOCOL_OpenPGP);
- pthread_create (&tone, NULL, thread_one, "A");
- pthread_create (&ttwo, NULL, thread_two, "B");
+ pthread_create (&tone, NULL, thread_one, arg_A);
+ pthread_create (&ttwo, NULL, thread_two, arg_B);
pthread_join (tone, NULL);
pthread_join (ttwo, NULL);
diff --git a/tests/gpg/t-trustlist.c b/tests/gpg/t-trustlist.c
index 5d24518..eeab85e 100644
--- a/tests/gpg/t-trustlist.c
+++ b/tests/gpg/t-trustlist.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -34,13 +34,16 @@
#include "t-support.h"
-int
+int
main (int argc, char *argv[])
{
gpgme_ctx_t ctx;
gpgme_error_t err;
gpgme_trust_item_t item;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
diff --git a/tests/gpg/t-verify.c b/tests/gpg/t-verify.c
index dceabac..9842d3a 100644
--- a/tests/gpg/t-verify.c
+++ b/tests/gpg/t-verify.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -77,7 +77,7 @@ static const char test_sig2[] =
"-----END PGP MESSAGE-----\n";
/* A message with a prepended but unsigned plaintext packet. */
-static const char double_plaintext_sig[] =
+static const char double_plaintext_sig[] =
"-----BEGIN PGP MESSAGE-----\n"
"\n"
"rDRiCmZvb2Jhci50eHRF4pxNVGhpcyBpcyBteSBzbmVha3kgcGxhaW50ZXh0IG1l\n"
@@ -92,7 +92,8 @@ static const char double_plaintext_sig[] =
static void
-check_result (gpgme_verify_result_t result, unsigned int summary, char *fpr,
+check_result (gpgme_verify_result_t result, unsigned int summary,
+ const char *fpr,
gpgme_error_t status, int notation)
{
gpgme_signature_t sig;
@@ -135,7 +136,7 @@ check_result (gpgme_verify_result_t result, unsigned int summary, char *fpr,
" das waren Umlaute und jetzt ein prozent%-Zeichen" },
{ "foobar.1",
"this is a notation data with 2 lines" },
- { NULL,
+ { NULL,
"http://www.gu.org/policy/" }
};
int i;
@@ -201,7 +202,7 @@ check_result (gpgme_verify_result_t result, unsigned int summary, char *fpr,
}
-int
+int
main (int argc, char *argv[])
{
gpgme_ctx_t ctx;
@@ -209,6 +210,9 @@ main (int argc, char *argv[])
gpgme_data_t sig, text;
gpgme_verify_result_t result;
+ (void)argc;
+ (void)argv;
+
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
diff --git a/tests/gpg/t-wait.c b/tests/gpg/t-wait.c
index e58adad..352b9bf 100644
--- a/tests/gpg/t-wait.c
+++ b/tests/gpg/t-wait.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004, 2005, 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
@@ -38,8 +38,8 @@
#include "t-support.h"
-int
-main (int argc, char *argv[])
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
diff --git a/tests/gpgsm/Makefile.in b/tests/gpgsm/Makefile.in
index edcd1a1..d653b96 100644
--- a/tests/gpgsm/Makefile.in
+++ b/tests/gpgsm/Makefile.in
@@ -106,12 +106,16 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
$(top_srcdir)/build-aux/depcomp $(noinst_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/glib-2.0.m4 \
- $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnupg-ttyname.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_pkg_swig.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
+ $(top_srcdir)/m4/gnupg-ttyname.m4 \
$(top_srcdir)/m4/gpg-error.m4 $(top_srcdir)/m4/libassuan.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/qt.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@@ -269,6 +273,7 @@ BUILD_REVISION = @BUILD_REVISION@
BUILD_TIMESTAMP = @BUILD_TIMESTAMP@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
@@ -280,12 +285,14 @@ CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLED_LANGUAGES = @ENABLED_LANGUAGES@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GITLOG_TO_CHANGELOG = @GITLOG_TO_CHANGELOG@
@@ -296,15 +303,23 @@ GLIB_LIBS = @GLIB_LIBS@
GLIB_MKENUMS = @GLIB_MKENUMS@
GOBJECT_QUERY = @GOBJECT_QUERY@
GPGME_CONFIG_API_VERSION = @GPGME_CONFIG_API_VERSION@
+GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
+GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
+GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
+GPGME_QT_LIBS = @GPGME_QT_LIBS@
GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@
GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@
GPG_ERROR_LIBS = @GPG_ERROR_LIBS@
GPG_ERROR_MT_CFLAGS = @GPG_ERROR_MT_CFLAGS@
GPG_ERROR_MT_LIBS = @GPG_ERROR_MT_LIBS@
+GRAPHVIZ = @GRAPHVIZ@
GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_DOT = @HAVE_DOT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -315,10 +330,16 @@ LDFLAGS = @LDFLAGS@
LIBASSUAN_CFLAGS = @LIBASSUAN_CFLAGS@
LIBASSUAN_CONFIG = @LIBASSUAN_CONFIG@
LIBASSUAN_LIBS = @LIBASSUAN_LIBS@
+LIBGPGMEPP_LT_AGE = @LIBGPGMEPP_LT_AGE@
+LIBGPGMEPP_LT_CURRENT = @LIBGPGMEPP_LT_CURRENT@
+LIBGPGMEPP_LT_REVISION = @LIBGPGMEPP_LT_REVISION@
LIBGPGME_LT_AGE = @LIBGPGME_LT_AGE@
LIBGPGME_LT_CURRENT = @LIBGPGME_LT_CURRENT@
LIBGPGME_LT_REVISION = @LIBGPGME_LT_REVISION@
LIBOBJS = @LIBOBJS@
+LIBQGPGME_LT_AGE = @LIBQGPGME_LT_AGE@
+LIBQGPGME_LT_CURRENT = @LIBQGPGME_LT_CURRENT@
+LIBQGPGME_LT_REVISION = @LIBQGPGME_LT_REVISION@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
@@ -328,6 +349,8 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
+MOC = @MOC@
+MOC2 = @MOC2@
NEED__FILE_OFFSET_BITS = @NEED__FILE_OFFSET_BITS@
NM = @NM@
NMEDIT = @NMEDIT@
@@ -344,14 +367,27 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
-QT4_CORE_CFLAGS = @QT4_CORE_CFLAGS@
-QT4_CORE_LIBS = @QT4_CORE_LIBS@
+PYTHON = @PYTHON@
+PYTHONS = @PYTHONS@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
+PYTHON_VERSION = @PYTHON_VERSION@
+PYTHON_VERSIONS = @PYTHON_VERSIONS@
+QTCHOOSER = @QTCHOOSER@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+SWIG = @SWIG@
+SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
VERSION_NUMBER = @VERSION_NUMBER@
@@ -400,9 +436,13 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/tests/gpgsm/t-decrypt.c b/tests/gpgsm/t-decrypt.c
index 654c7e1..658809c 100644
--- a/tests/gpgsm/t-decrypt.c
+++ b/tests/gpgsm/t-decrypt.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -48,8 +48,8 @@ static const char test_cip1[] =
"-----END CMS OBJECT-----\n";
-int
-main (int argc, char *argv[])
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -78,7 +78,7 @@ main (int argc, char *argv[])
exit (1);
}
print_data (out);
-
+
gpgme_data_release (in);
gpgme_data_release (out);
gpgme_release (ctx);
diff --git a/tests/gpgsm/t-encrypt.c b/tests/gpgsm/t-encrypt.c
index 45c772b..50c7a33 100644
--- a/tests/gpgsm/t-encrypt.c
+++ b/tests/gpgsm/t-encrypt.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -33,8 +33,8 @@
#include "t-support.h"
-int
-main (int argc, char **argv)
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -54,7 +54,7 @@ main (int argc, char **argv)
err = gpgme_data_new (&out);
fail_if_err (err);
-
+
err = gpgme_get_key (ctx, "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E",
&key[0], 0);
fail_if_err (err);
diff --git a/tests/gpgsm/t-export.c b/tests/gpgsm/t-export.c
index d8856f2..120df6b 100644
--- a/tests/gpgsm/t-export.c
+++ b/tests/gpgsm/t-export.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -34,15 +34,15 @@
#include "t-support.h"
-int
-main (int argc, char *argv[])
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
gpgme_data_t out;
const char *pattern1[] = { "DFN Top Level Certification Authority", NULL };
const char *pattern2[] = { "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E",
- "DFN Server Certification Authority",
+ "DFN Server Certification Authority",
NULL };
init_gpgme (GPGME_PROTOCOL_CMS);
diff --git a/tests/gpgsm/t-genkey.c b/tests/gpgsm/t-genkey.c
index 9de9d54..fb05034 100644
--- a/tests/gpgsm/t-genkey.c
+++ b/tests/gpgsm/t-genkey.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -40,6 +40,8 @@ static int progress_called;
static void
progress (void *self, const char *what, int type, int current, int total)
{
+ (void)self;
+
if (!strcmp (what, "primegen") && !current && !total
&& (type == '.' || type == '+' || type == '!'
|| type == '^' || type == '<' || type == '>'))
@@ -57,8 +59,8 @@ progress (void *self, const char *what, int type, int current, int total)
}
-int
-main (int argc, char *argv[])
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -83,7 +85,7 @@ main (int argc, char *argv[])
gpgme_set_armor (ctx, 1);
gpgme_set_progress_cb (ctx, progress, NULL);
-
+
err = gpgme_op_genkey (ctx, parms, certreq, NULL);
fail_if_err (err);
diff --git a/tests/gpgsm/t-import.c b/tests/gpgsm/t-import.c
index 2d23779..a8dfcca 100644
--- a/tests/gpgsm/t-import.c
+++ b/tests/gpgsm/t-import.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -36,9 +36,11 @@
void
-check_result (gpgme_import_result_t result, char *fpr, int total,
+check_result (gpgme_import_result_t result, const char *fpr, int total,
int total_stat)
{
+ (void)fpr;
+
if (result->considered != total)
{
fprintf (stderr, "Unexpected number of considered keys %i\n",
@@ -118,14 +120,14 @@ check_result (gpgme_import_result_t result, char *fpr, int total,
result->not_imported);
exit (1);
}
-
+
{
int n;
gpgme_import_status_t r;
for (n=0, r=result->imports; r; r=r->next)
n++;
-
+
if (n != total_stat)
{
fprintf (stderr, "Unexpected number of status reports\n");
@@ -135,24 +137,25 @@ check_result (gpgme_import_result_t result, char *fpr, int total,
}
-int
-main (int argc, char **argv)
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
gpgme_data_t in;
gpgme_import_result_t result;
- const char *cert_1 = make_filename ("cert_dfn_pca01.der");
- const char *cert_2 = make_filename ("cert_dfn_pca15.der");
+ char *cert_1 = make_filename ("cert_dfn_pca01.der");
+ char *cert_2 = make_filename ("cert_dfn_pca15.der");
init_gpgme (GPGME_PROTOCOL_CMS);
err = gpgme_new (&ctx);
fail_if_err (err);
-
+
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
err = gpgme_data_new_from_file (&in, cert_1, 1);
+ free (cert_1);
fail_if_err (err);
err = gpgme_op_import (ctx, in);
@@ -162,6 +165,7 @@ main (int argc, char **argv)
gpgme_data_release (in);
err = gpgme_data_new_from_file (&in, cert_2, 1);
+ free (cert_2);
fail_if_err (err);
err = gpgme_op_import (ctx, in);
diff --git a/tests/gpgsm/t-keylist.c b/tests/gpgsm/t-keylist.c
index bebd9d6..314109c 100644
--- a/tests/gpgsm/t-keylist.c
+++ b/tests/gpgsm/t-keylist.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -36,15 +36,15 @@
struct
{
- char *fpr;
+ const char *fpr;
int secret;
long timestamp;
long expires;
- char *issuer_serial;
- char *issuer_name;
- char *chain_id;
- char *uid;
- char *email;
+ const char *issuer_serial;
+ const char *issuer_name;
+ const char *chain_id;
+ const char *uid;
+ const char *email;
gpgme_validity_t validity;
unsigned int key_length;
}
@@ -80,8 +80,8 @@ keys[] =
};
-int
-main (int argc, char **argv)
+int
+main (void)
{
gpgme_error_t err;
gpgme_ctx_t ctx;
@@ -97,7 +97,7 @@ main (int argc, char **argv)
err = gpgme_op_keylist_start (ctx, NULL, 0);
fail_if_err (err);
-
+
while (!(err = gpgme_op_keylist_next (ctx, &key)))
{
if (!keys[i].fpr)
@@ -110,6 +110,7 @@ main (int argc, char **argv)
{
fprintf (stderr, "Warning: Skipping unknown key %s\n",
key->subkeys->fpr);
+ gpgme_key_unref (key);
continue;
}
else
diff --git a/tests/gpgsm/t-sign.c b/tests/gpgsm/t-sign.c
index dc2d841..d4e143d 100644
--- a/tests/gpgsm/t-sign.c
+++ b/tests/gpgsm/t-sign.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -80,8 +80,8 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)
}
-int
-main (int argc, char *argv[])
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -109,8 +109,8 @@ main (int argc, char *argv[])
check_result (result, GPGME_SIG_MODE_NORMAL);
print_data (out);
gpgme_data_release (out);
-
- /* Now a detached signature. */
+
+ /* Now a detached signature. */
gpgme_data_seek (in, 0, SEEK_SET);
err = gpgme_data_new (&out);
fail_if_err (err);
diff --git a/tests/gpgsm/t-support.h b/tests/gpgsm/t-support.h
index cc1a7db..c3074db 100644
--- a/tests/gpgsm/t-support.h
+++ b/tests/gpgsm/t-support.h
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -47,7 +47,7 @@ print_data (gpgme_data_t dh)
#define BUF_SIZE 512
char buf[BUF_SIZE + 1];
int ret;
-
+
ret = gpgme_data_seek (dh, 0, SEEK_SET);
if (ret)
fail_if_err (gpgme_error_from_errno (errno));
@@ -63,13 +63,18 @@ passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info,
int last_was_bad, int fd)
{
int res;
- char *pass = "abc\n";
+ char pass[] = "abc\n";
int passlen = strlen (pass);
int off = 0;
+ (void)opaque;
+ (void)uid_hint;
+ (void)passphrase_info;
+ (void)last_was_bad;
+
do
{
- res = write (fd, &pass[off], passlen - off);
+ res = gpgme_io_write (fd, &pass[off], passlen - off);
if (res > 0)
off += res;
}
@@ -88,7 +93,7 @@ make_filename (const char *fname)
if (!srcdir)
srcdir = ".";
buf = malloc (strlen(srcdir) + strlen(fname) + 2);
- if (!buf)
+ if (!buf)
exit (8);
strcpy (buf, srcdir);
strcat (buf, "/");
diff --git a/tests/gpgsm/t-verify.c b/tests/gpgsm/t-verify.c
index 901b46f..004a125 100644
--- a/tests/gpgsm/t-verify.c
+++ b/tests/gpgsm/t-verify.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -52,7 +52,7 @@ static const char test_sig1[] =
static void
-check_result (gpgme_verify_result_t result, int summary, char *fpr,
+check_result (gpgme_verify_result_t result, int summary, const char *fpr,
gpgme_error_t status, gpgme_validity_t validity)
{
gpgme_signature_t sig;
@@ -134,8 +134,8 @@ show_auditlog (gpgme_ctx_t ctx)
-int
-main (int argc, char **argv)
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -147,7 +147,7 @@ main (int argc, char **argv)
err = gpgme_new (&ctx);
fail_if_err (err);
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
-
+
/* Checking a valid message. */
err = gpgme_data_new_from_mem (&text, test_text1, strlen (test_text1), 0);
fail_if_err (err);
@@ -179,6 +179,6 @@ main (int argc, char **argv)
gpgme_data_release (text);
gpgme_data_release (sig);
- gpgme_release (ctx);
+ gpgme_release (ctx);
return got_errors? 1 : 0;
}
diff --git a/tests/opassuan/Makefile.in b/tests/opassuan/Makefile.in
index 018cbbe..1740ad0 100644
--- a/tests/opassuan/Makefile.in
+++ b/tests/opassuan/Makefile.in
@@ -103,12 +103,16 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
$(top_srcdir)/build-aux/depcomp $(noinst_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/glib-2.0.m4 \
- $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnupg-ttyname.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_pkg_swig.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
+ $(top_srcdir)/m4/gnupg-ttyname.m4 \
$(top_srcdir)/m4/gpg-error.m4 $(top_srcdir)/m4/libassuan.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/qt.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@@ -224,6 +228,7 @@ BUILD_REVISION = @BUILD_REVISION@
BUILD_TIMESTAMP = @BUILD_TIMESTAMP@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
@@ -235,12 +240,14 @@ CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLED_LANGUAGES = @ENABLED_LANGUAGES@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GITLOG_TO_CHANGELOG = @GITLOG_TO_CHANGELOG@
@@ -251,15 +258,23 @@ GLIB_LIBS = @GLIB_LIBS@
GLIB_MKENUMS = @GLIB_MKENUMS@
GOBJECT_QUERY = @GOBJECT_QUERY@
GPGME_CONFIG_API_VERSION = @GPGME_CONFIG_API_VERSION@
+GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
+GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
+GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
+GPGME_QT_LIBS = @GPGME_QT_LIBS@
GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@
GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@
GPG_ERROR_LIBS = @GPG_ERROR_LIBS@
GPG_ERROR_MT_CFLAGS = @GPG_ERROR_MT_CFLAGS@
GPG_ERROR_MT_LIBS = @GPG_ERROR_MT_LIBS@
+GRAPHVIZ = @GRAPHVIZ@
GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_DOT = @HAVE_DOT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -270,10 +285,16 @@ LDFLAGS = @LDFLAGS@
LIBASSUAN_CFLAGS = @LIBASSUAN_CFLAGS@
LIBASSUAN_CONFIG = @LIBASSUAN_CONFIG@
LIBASSUAN_LIBS = @LIBASSUAN_LIBS@
+LIBGPGMEPP_LT_AGE = @LIBGPGMEPP_LT_AGE@
+LIBGPGMEPP_LT_CURRENT = @LIBGPGMEPP_LT_CURRENT@
+LIBGPGMEPP_LT_REVISION = @LIBGPGMEPP_LT_REVISION@
LIBGPGME_LT_AGE = @LIBGPGME_LT_AGE@
LIBGPGME_LT_CURRENT = @LIBGPGME_LT_CURRENT@
LIBGPGME_LT_REVISION = @LIBGPGME_LT_REVISION@
LIBOBJS = @LIBOBJS@
+LIBQGPGME_LT_AGE = @LIBQGPGME_LT_AGE@
+LIBQGPGME_LT_CURRENT = @LIBQGPGME_LT_CURRENT@
+LIBQGPGME_LT_REVISION = @LIBQGPGME_LT_REVISION@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
@@ -283,6 +304,8 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
+MOC = @MOC@
+MOC2 = @MOC2@
NEED__FILE_OFFSET_BITS = @NEED__FILE_OFFSET_BITS@
NM = @NM@
NMEDIT = @NMEDIT@
@@ -299,14 +322,27 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
-QT4_CORE_CFLAGS = @QT4_CORE_CFLAGS@
-QT4_CORE_LIBS = @QT4_CORE_LIBS@
+PYTHON = @PYTHON@
+PYTHONS = @PYTHONS@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
+PYTHON_VERSION = @PYTHON_VERSION@
+PYTHON_VERSIONS = @PYTHON_VERSIONS@
+QTCHOOSER = @QTCHOOSER@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+SWIG = @SWIG@
+SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
VERSION_NUMBER = @VERSION_NUMBER@
@@ -355,9 +391,13 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/tests/opassuan/t-command.c b/tests/opassuan/t-command.c
index 87f8202..9c791ee 100644
--- a/tests/opassuan/t-command.c
+++ b/tests/opassuan/t-command.c
@@ -7,12 +7,12 @@
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/>.
*/
@@ -46,9 +46,12 @@
static gpgme_error_t
data_cb (void *opaque, const void *data, size_t datalen)
{
+ (void)opaque;
+ (void)data;
+
printf ("DATA_CB: datalen=%d\n", (int)datalen);
return 0;
-}
+}
static gpgme_error_t
@@ -58,12 +61,14 @@ inq_cb (void *opaque, const char *name, const char *args,
gpgme_data_t data;
gpgme_error_t err;
+ (void)opaque;
+
if (name)
{
printf ("INQ_CB: name=`%s' args=`%s'\n", name, args);
/* There shall be no data object. */
assert (!*r_data);
-
+
err = gpgme_data_new (&data);
fail_if_err (err);
*r_data = data;
@@ -85,19 +90,21 @@ inq_cb (void *opaque, const char *name, const char *args,
return 0;
-}
+}
static gpgme_error_t
status_cb (void *opaque, const char *status, const char *args)
{
+ (void)opaque;
+
printf ("STATUS_CB: status=`%s' args=`%s'\n", status, args);
return 0;
-}
+}
-int
+int
main (int argc, char **argv)
{
gpgme_error_t err;
@@ -118,7 +125,7 @@ main (int argc, char **argv)
argv++;
}
command = argc? *argv : "NOP";
-
+
err = gpgme_new (&ctx);
fail_if_err (err);
diff --git a/tests/run-decrypt.c b/tests/run-decrypt.c
new file mode 100644
index 0000000..6d38aee
--- /dev/null
+++ b/tests/run-decrypt.c
@@ -0,0 +1,189 @@
+/* run-decrypt.c - Helper to perform a verify operation
+ Copyright (C) 2009 g10 Code GmbH
+ 2016 Intevation 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/>.
+*/
+
+/* We need to include config.h so that we know whether we are building
+ with large file system (LFS) support. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <gpgme.h>
+
+#define PGM "run-decrypt"
+
+#include "run-support.h"
+
+
+static int verbose;
+
+static gpg_error_t
+status_cb (void *opaque, const char *keyword, const char *value)
+{
+ (void)opaque;
+ fprintf (stderr, "status_cb: %s %s\n", keyword, value);
+ return 0;
+}
+
+
+static void
+print_result (gpgme_decrypt_result_t result)
+{
+ gpgme_recipient_t recp;
+ int count = 0;
+ printf ("Original file name: %s\n", nonnull(result->file_name));
+ printf ("Wrong key usage: %i\n", result->wrong_key_usage);
+ printf ("Unsupported algorithm: %s\n ", nonnull(result->unsupported_algorithm));
+
+ for (recp = result->recipients; recp->next; recp = recp->next)
+ {
+ printf ("recipient %d\n", count++);
+ printf (" status ....: %s\n", gpgme_strerror (recp->status));
+ printf (" keyid: %s\n", nonnull (recp->keyid));
+ printf (" algo ...: %s\n", gpgme_pubkey_algo_name (recp->pubkey_algo));
+ }
+}
+
+
+static int
+show_usage (int ex)
+{
+ fputs ("usage: " PGM " [options] FILE\n\n"
+ "Options:\n"
+ " --verbose run in verbose mode\n"
+ " --status print status lines from the backend\n"
+ " --openpgp use the OpenPGP protocol (default)\n"
+ " --cms use the CMS protocol\n"
+ , stderr);
+ exit (ex);
+}
+
+
+int
+main (int argc, char **argv)
+{
+ int last_argc = -1;
+ gpgme_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP;
+ FILE *fp_in = NULL;
+ gpgme_data_t in = NULL;
+ gpgme_data_t out = NULL;
+ gpgme_decrypt_result_t result;
+ int print_status = 0;
+
+ if (argc)
+ { argc--; argv++; }
+
+ while (argc && last_argc != argc )
+ {
+ last_argc = argc;
+ if (!strcmp (*argv, "--"))
+ {
+ argc--; argv++;
+ break;
+ }
+ else if (!strcmp (*argv, "--help"))
+ show_usage (0);
+ else if (!strcmp (*argv, "--verbose"))
+ {
+ verbose = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--status"))
+ {
+ print_status = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--openpgp"))
+ {
+ protocol = GPGME_PROTOCOL_OpenPGP;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--cms"))
+ {
+ protocol = GPGME_PROTOCOL_CMS;
+ argc--; argv++;
+ }
+ else if (!strncmp (*argv, "--", 2))
+ show_usage (1);
+
+ }
+
+ if (argc < 1 || argc > 2)
+ show_usage (1);
+
+ fp_in = fopen (argv[0], "rb");
+ if (!fp_in)
+ {
+ err = gpgme_error_from_syserror ();
+ fprintf (stderr, PGM ": can't open `%s': %s\n",
+ argv[0], gpgme_strerror (err));
+ exit (1);
+ }
+
+ init_gpgme (protocol);
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+ gpgme_set_protocol (ctx, protocol);
+ if (print_status)
+ {
+ gpgme_set_status_cb (ctx, status_cb, NULL);
+ gpgme_set_ctx_flag (ctx, "full-status", "1");
+ }
+
+ err = gpgme_data_new_from_stream (&in, fp_in);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error allocating data object: %s\n",
+ gpgme_strerror (err));
+ exit (1);
+ }
+
+ err = gpgme_data_new (&out);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error allocating data object: %s\n",
+ gpgme_strerror (err));
+ exit (1);
+ }
+
+ err = gpgme_op_decrypt (ctx, in, out);
+ result = gpgme_op_decrypt_result (ctx);
+ if (err)
+ {
+ fprintf (stderr, PGM ": decrypt failed: %s\n", gpgme_strerror (err));
+ exit (1);
+ }
+ if (result) {
+ print_result (result);
+ print_data (out);
+ }
+
+ gpgme_data_release (out);
+ gpgme_data_release (in);
+
+ gpgme_release (ctx);
+ return 0;
+}
diff --git a/tests/run-encrypt.c b/tests/run-encrypt.c
new file mode 100644
index 0000000..b94b028
--- /dev/null
+++ b/tests/run-encrypt.c
@@ -0,0 +1,293 @@
+/* run-encrypt.c - Helper to perform an encrypt operation
+ * Copyright (C) 2016 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/>.
+ */
+
+/* We need to include config.h so that we know whether we are building
+ with large file system (LFS) support. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <gpgme.h>
+
+#define PGM "run-encrypt"
+
+#include "run-support.h"
+
+
+static int verbose;
+
+
+static gpg_error_t
+status_cb (void *opaque, const char *keyword, const char *value)
+{
+ (void)opaque;
+ fprintf (stderr, "status_cb: %s %s\n", nonnull(keyword), nonnull(value));
+ return 0;
+}
+
+
+static void
+progress_cb (void *opaque, const char *what, int type, int current, int total)
+{
+ (void)opaque;
+ (void)type;
+
+ if (total)
+ fprintf (stderr, "progress for '%s' %u%% (%d of %d)\n",
+ nonnull (what),
+ (unsigned)(((double)current / total) * 100), current, total);
+ else
+ fprintf (stderr, "progress for '%s' %d\n", nonnull(what), current);
+ fflush (stderr);
+}
+
+
+static void
+print_result (gpgme_encrypt_result_t result)
+{
+ gpgme_invalid_key_t invkey;
+
+ for (invkey = result->invalid_recipients; invkey; invkey = invkey->next)
+ printf ("Encryption key `%s' not used: %s <%s>\n",
+ nonnull (invkey->fpr),
+ gpg_strerror (invkey->reason), gpg_strsource (invkey->reason));
+}
+
+
+
+static int
+show_usage (int ex)
+{
+ fputs ("usage: " PGM " [options] FILE\n\n"
+ "Options:\n"
+ " --verbose run in verbose mode\n"
+ " --status print status lines from the backend\n"
+ " --progress print progress info\n"
+ " --openpgp use the OpenPGP protocol (default)\n"
+ " --cms use the CMS protocol\n"
+ " --uiserver use the UI server\n"
+ " --loopback use a loopback pinentry\n"
+ " --key NAME encrypt to key NAME\n"
+ " --symmetric encrypt symmetric (OpenPGP only)\n"
+ , stderr);
+ exit (ex);
+}
+
+
+int
+main (int argc, char **argv)
+{
+ int last_argc = -1;
+ gpgme_error_t err;
+ gpgme_ctx_t ctx;
+ const char *key_string = NULL;
+ gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP;
+ gpgme_data_t in, out;
+ gpgme_encrypt_result_t result;
+ int print_status = 0;
+ int print_progress = 0;
+ int use_loopback = 0;
+ char *keyargs[10];
+ gpgme_key_t keys[10+1];
+ int keycount = 0;
+ int i;
+ gpgme_encrypt_flags_t flags = GPGME_ENCRYPT_ALWAYS_TRUST;
+ gpgme_off_t offset;
+
+ if (argc)
+ { argc--; argv++; }
+
+ if (DIM(keys) != DIM(keyargs)+1)
+ abort ();
+
+ while (argc && last_argc != argc )
+ {
+ last_argc = argc;
+ if (!strcmp (*argv, "--"))
+ {
+ argc--; argv++;
+ break;
+ }
+ else if (!strcmp (*argv, "--help"))
+ show_usage (0);
+ else if (!strcmp (*argv, "--verbose"))
+ {
+ verbose = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--status"))
+ {
+ print_status = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--progress"))
+ {
+ print_progress = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--openpgp"))
+ {
+ protocol = GPGME_PROTOCOL_OpenPGP;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--cms"))
+ {
+ protocol = GPGME_PROTOCOL_CMS;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--uiserver"))
+ {
+ protocol = GPGME_PROTOCOL_UISERVER;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--key"))
+ {
+ argc--; argv++;
+ if (!argc)
+ show_usage (1);
+ if (keycount == DIM (keyargs))
+ show_usage (1);
+ keyargs[keycount++] = *argv;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--loopback"))
+ {
+ use_loopback = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--symmetric"))
+ {
+ flags |= GPGME_ENCRYPT_SYMMETRIC;
+ argc--; argv++;
+ }
+ else if (!strncmp (*argv, "--", 2))
+ show_usage (1);
+
+ }
+
+ if (argc != 1)
+ show_usage (1);
+
+ if (key_string && protocol == GPGME_PROTOCOL_UISERVER)
+ {
+ fprintf (stderr, PGM ": ignoring --key in UI-server mode\n");
+ key_string = NULL;
+ }
+
+ if (!key_string)
+ key_string = "test";
+
+ init_gpgme (protocol);
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+ gpgme_set_protocol (ctx, protocol);
+ gpgme_set_armor (ctx, 1);
+ if (print_status)
+ {
+ gpgme_set_status_cb (ctx, status_cb, NULL);
+ gpgme_set_ctx_flag (ctx, "full-status", "1");
+ }
+ if (print_progress)
+ gpgme_set_progress_cb (ctx, progress_cb, NULL);
+ if (use_loopback)
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
+
+ for (i=0; i < keycount; i++)
+ {
+ err = gpgme_get_key (ctx, keyargs[i], &keys[i], 0);
+ fail_if_err (err);
+ }
+ keys[i] = NULL;
+
+ err = gpgme_data_new_from_file (&in, *argv, 1);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error reading `%s': %s\n",
+ *argv, gpg_strerror (err));
+ exit (1);
+ }
+ offset = gpgme_data_seek (in, 0, SEEK_END);
+ if (offset == (gpgme_off_t)(-1))
+ {
+ err = gpg_error_from_syserror ();
+ fprintf (stderr, PGM ": error seeking `%s': %s\n",
+ *argv, gpg_strerror (err));
+ exit (1);
+ }
+ if (gpgme_data_seek (in, 0, SEEK_SET) == (gpgme_off_t)(-1))
+ {
+ err = gpg_error_from_syserror ();
+ fprintf (stderr, PGM ": error seeking `%s': %s\n",
+ *argv, gpg_strerror (err));
+ exit (1);
+ }
+ {
+ char numbuf[50];
+ char *p;
+
+ p = numbuf + sizeof numbuf;
+ *--p = 0;
+ do
+ {
+ *--p = '0' + (offset % 10);
+ offset /= 10;
+ }
+ while (offset);
+ err = gpgme_data_set_flag (in, "size-hint", p);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error setting size-hint for `%s': %s\n",
+ *argv, gpg_strerror (err));
+ exit (1);
+ }
+ }
+
+ err = gpgme_data_new (&out);
+ fail_if_err (err);
+
+ err = gpgme_op_encrypt (ctx, keycount ? keys : NULL, flags, in, out);
+ result = gpgme_op_encrypt_result (ctx);
+ if (result)
+ print_result (result);
+ if (err)
+ {
+ fprintf (stderr, PGM ": encrypting failed: %s\n", gpg_strerror (err));
+ exit (1);
+ }
+
+ fputs ("Begin Output:\n", stdout);
+ print_data (out);
+ fputs ("End Output.\n", stdout);
+ gpgme_data_release (out);
+
+ gpgme_data_release (in);
+
+ for (i=0; i < keycount; i++)
+ gpgme_key_unref (keys[i]);
+ gpgme_release (ctx);
+ return 0;
+}
diff --git a/tests/run-genkey.c b/tests/run-genkey.c
new file mode 100644
index 0000000..20e7db5
--- /dev/null
+++ b/tests/run-genkey.c
@@ -0,0 +1,439 @@
+/* run-genkey.c - Test tool to perform key generation
+ * Copyright (C) 2016 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/>.
+ */
+
+/* We need to include config.h so that we know whether we are building
+ with large file system (LFS) support. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include <gpgme.h>
+
+#define PGM "run-genkey"
+
+#include "run-support.h"
+
+
+static int verbose;
+
+
+/* Tokenize STRING using the set of delimiters in DELIM. Leading
+ * spaces and tabs are removed from all tokens. The caller must free
+ * the result.
+ *
+ * Returns: A malloced and NULL delimited array with the tokens. On
+ * memory error NULL is returned and ERRNO is set.
+ */
+static char **
+strtokenize (const char *string, const char *delim)
+{
+ const char *s;
+ size_t fields;
+ size_t bytes, n;
+ char *buffer;
+ char *p, *px, *pend;
+ char **result;
+
+ /* Count the number of fields. */
+ for (fields = 1, s = strpbrk (string, delim); s; s = strpbrk (s + 1, delim))
+ fields++;
+ fields++; /* Add one for the terminating NULL. */
+
+ /* Allocate an array for all fields, a terminating NULL, and space
+ for a copy of the string. */
+ bytes = fields * sizeof *result;
+ if (bytes / sizeof *result != fields)
+ {
+ gpg_err_set_errno (ENOMEM);
+ return NULL;
+ }
+ n = strlen (string) + 1;
+ bytes += n;
+ if (bytes < n)
+ {
+ gpg_err_set_errno (ENOMEM);
+ return NULL;
+ }
+ result = malloc (bytes);
+ if (!result)
+ return NULL;
+ buffer = (char*)(result + fields);
+
+ /* Copy and parse the string. */
+ strcpy (buffer, string);
+ for (n = 0, p = buffer; (pend = strpbrk (p, delim)); p = pend + 1)
+ {
+ *pend = 0;
+ while (*p == ' ' || *p == '\t')
+ p++;
+ for (px = pend - 1; px >= p && (*px == ' ' || *px == '\t'); px--)
+ *px = 0;
+ result[n++] = p;
+ }
+ while (*p == ' ' || *p == '\t')
+ p++;
+ for (px = p + strlen (p) - 1; px >= p && (*px == ' ' || *px == '\t'); px--)
+ *px = 0;
+ result[n++] = p;
+ result[n] = NULL;
+
+ assert ((char*)(result + n + 1) == buffer);
+
+ return result;
+}
+
+
+static gpg_error_t
+status_cb (void *opaque, const char *keyword, const char *value)
+{
+ (void)opaque;
+ fprintf (stderr, "status_cb: %s %s\n", nonnull(keyword), nonnull(value));
+ return 0;
+}
+
+
+static void
+progress_cb (void *opaque, const char *what, int type, int current, int total)
+{
+ (void)opaque;
+ (void)type;
+
+ if (total)
+ fprintf (stderr, "progress for '%s' %u%% (%d of %d)\n",
+ nonnull (what),
+ (unsigned)(((double)current / total) * 100), current, total);
+ else
+ fprintf (stderr, "progress for '%s' %d\n", nonnull(what), current);
+ fflush (stderr);
+}
+
+
+static unsigned long
+parse_expire_string (const char *string)
+{
+ unsigned long seconds;
+
+ if (!string || !*string || !strcmp (string, "none")
+ || !strcmp (string, "never") || !strcmp (string, "-"))
+ seconds = 0;
+ else if (strspn (string, "01234567890") == strlen (string))
+ seconds = strtoul (string, NULL, 10);
+ else
+ {
+ fprintf (stderr, PGM ": invalid value '%s'\n", string);
+ exit (1);
+ }
+
+ return seconds;
+}
+
+
+/* Parse a usage string and return flags for gpgme_op_createkey. */
+static unsigned int
+parse_usage_string (const char *string)
+{
+ gpg_error_t err;
+ char **tokens = NULL;
+ const char *s;
+ int i;
+ unsigned int flags = 0;
+
+ tokens = strtokenize (string, " \t,");
+ if (!tokens)
+ {
+ err = gpg_error_from_syserror ();
+ fprintf (stderr, PGM": strtokenize failed: %s\n", gpg_strerror (err));
+ exit (1);
+ }
+
+ for (i=0; (s = tokens[i]); i++)
+ {
+ if (!*s)
+ ;
+ else if (!strcmp (s, "default"))
+ ;
+ else if (!strcmp (s, "sign"))
+ flags |= GPGME_CREATE_SIGN;
+ else if (!strcmp (s, "encr"))
+ flags |= GPGME_CREATE_ENCR;
+ else if (!strcmp (s, "cert"))
+ flags |= GPGME_CREATE_CERT;
+ else if (!strcmp (s, "auth"))
+ flags |= GPGME_CREATE_AUTH;
+ else
+ {
+ free (tokens);
+ fprintf (stderr, PGM": invalid value '%s': %s\n",
+ string, "bad usage");
+ exit (1);
+ }
+ }
+
+ free (tokens);
+ return flags;
+}
+
+
+
+static int
+show_usage (int ex)
+{
+ fputs ("usage: " PGM " [options] ARGS\n"
+ " args: USERID [ALGO [USAGE [EXPIRESECONDS]]]\n"
+ " for addkey: FPR [ALGO [USAGE [EXPIRESECONDS]]]\n"
+ " for adduid: FPR USERID\n"
+ " for revuid: FPR USERID\n"
+ "Options:\n"
+ " --addkey add a subkey to the key with FPR\n"
+ " --adduid add a user id to the key with FPR\n"
+ " --revuid Revoke a user id from the key with FPR\n"
+ " --verbose run in verbose mode\n"
+ " --status print status lines from the backend\n"
+ " --progress print progress info\n"
+ " --openpgp use the OpenPGP protocol (default)\n"
+ " --cms use the CMS protocol\n"
+ " --loopback use a loopback pinentry\n"
+ " --unprotected do not use a passphrase\n"
+ " --force do not check for a duplicated user id\n"
+ , stderr);
+ exit (ex);
+}
+
+
+int
+main (int argc, char **argv)
+{
+ int last_argc = -1;
+ gpgme_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP;
+ int print_status = 0;
+ int print_progress = 0;
+ int use_loopback = 0;
+ int addkey = 0;
+ int adduid = 0;
+ int revuid = 0;
+ const char *userid;
+ const char *algo = NULL;
+ const char *newuserid = NULL;
+ unsigned int flags = 0;
+ unsigned long expire = 0;
+ gpgme_genkey_result_t result;
+
+ if (argc)
+ { argc--; argv++; }
+
+ while (argc && last_argc != argc )
+ {
+ last_argc = argc;
+ if (!strcmp (*argv, "--"))
+ {
+ argc--; argv++;
+ break;
+ }
+ else if (!strcmp (*argv, "--help"))
+ show_usage (0);
+ else if (!strcmp (*argv, "--addkey"))
+ {
+ addkey = 1;
+ adduid = 0;
+ revuid = 0;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--adduid"))
+ {
+ addkey = 0;
+ adduid = 1;
+ revuid = 0;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--revuid"))
+ {
+ addkey = 0;
+ adduid = 0;
+ revuid = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--verbose"))
+ {
+ verbose = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--status"))
+ {
+ print_status = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--progress"))
+ {
+ print_progress = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--openpgp"))
+ {
+ protocol = GPGME_PROTOCOL_OpenPGP;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--cms"))
+ {
+ protocol = GPGME_PROTOCOL_CMS;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--loopback"))
+ {
+ use_loopback = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--unprotected"))
+ {
+ flags |= GPGME_CREATE_NOPASSWD;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--force"))
+ {
+ flags |= GPGME_CREATE_FORCE;
+ argc--; argv++;
+ }
+ else if (!strncmp (*argv, "--", 2))
+ show_usage (1);
+ }
+
+ if (adduid || revuid)
+ {
+ if (argc != 2)
+ show_usage (1);
+ userid = argv[0];
+ newuserid = argv[1];
+ }
+ else
+ {
+ if (!argc || argc > 4)
+ show_usage (1);
+ userid = argv[0];
+ if (argc > 1)
+ algo = argv[1];
+ if (argc > 2)
+ flags |= parse_usage_string (argv[2]);
+ if (argc > 3)
+ expire = parse_expire_string (argv[3]);
+ }
+
+ init_gpgme (protocol);
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+ gpgme_set_protocol (ctx, protocol);
+ gpgme_set_armor (ctx, 1);
+ if (print_status)
+ {
+ gpgme_set_status_cb (ctx, status_cb, NULL);
+ gpgme_set_ctx_flag (ctx, "full-status", "1");
+ }
+ if (print_progress)
+ gpgme_set_progress_cb (ctx, progress_cb, NULL);
+ if (use_loopback)
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
+
+ if (addkey || adduid || revuid)
+ {
+ gpgme_key_t akey;
+
+ err = gpgme_get_key (ctx, userid, &akey, 1);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error getting secret key for '%s': %s\n",
+ userid, gpg_strerror (err));
+ exit (1);
+ }
+
+ if (addkey)
+ {
+ err = gpgme_op_createsubkey (ctx, akey, algo, 0, expire, flags);
+ if (err)
+ {
+ fprintf (stderr, PGM ": gpgme_op_createsubkey failed: %s\n",
+ gpg_strerror (err));
+ exit (1);
+ }
+ }
+ else if (adduid)
+ {
+ err = gpgme_op_adduid (ctx, akey, newuserid, flags);
+ if (err)
+ {
+ fprintf (stderr, PGM ": gpgme_op_adduid failed: %s\n",
+ gpg_strerror (err));
+ exit (1);
+ }
+ }
+ else if (revuid)
+ {
+ err = gpgme_op_revuid (ctx, akey, newuserid, flags);
+ if (err)
+ {
+ fprintf (stderr, PGM ": gpgme_op_revuid failed: %s\n",
+ gpg_strerror (err));
+ exit (1);
+ }
+ }
+ gpgme_key_unref (akey);
+ }
+ else
+ {
+ err = gpgme_op_createkey (ctx, userid, algo, 0, expire, NULL, flags);
+ if (err)
+ {
+ fprintf (stderr, PGM ": gpgme_op_createkey failed: %s\n",
+ gpg_strerror (err));
+ exit (1);
+ }
+ }
+
+ result = gpgme_op_genkey_result (ctx);
+ if (!result)
+ {
+ fprintf (stderr, PGM": gpgme_op_genkey_result returned NULL\n");
+ exit (1);
+ }
+
+ printf ("Generated key: %s (%s)\n",
+ result->fpr ? result->fpr : "none",
+ result->primary ? (result->sub ? "primary, sub" : "primary")
+ /**/ : (result->sub ? "sub" : "none"));
+
+ if (result->fpr && strlen (result->fpr) < 40)
+ fprintf (stderr, PGM": generated key has unexpected fingerprint\n");
+ if (!result->primary)
+ fprintf (stderr, PGM": primary key was not generated\n");
+ if (!result->sub)
+ fprintf (stderr, PGM": sub key was not generated\n");
+ if (!result->uid)
+ fprintf (stderr, PGM": uid was not generated\n");
+
+ gpgme_release (ctx);
+ return 0;
+}
diff --git a/tests/run-identify.c b/tests/run-identify.c
new file mode 100644
index 0000000..d5ce55f
--- /dev/null
+++ b/tests/run-identify.c
@@ -0,0 +1,129 @@
+/* run-identify - Helper to run the identify command
+ * Copyright (C) 2016 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/>.
+ */
+
+/* We need to include config.h so that we know whether we are building
+ with large file system (LFS) support. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <gpgme.h>
+
+#define PGM "run-identify"
+
+#include "run-support.h"
+
+
+static int verbose;
+
+
+static const char *
+data_type_to_string (gpgme_data_type_t dt)
+{
+ const char *s = "[?]";
+
+ switch (dt)
+ {
+ case GPGME_DATA_TYPE_INVALID : s = "invalid"; break;
+ case GPGME_DATA_TYPE_UNKNOWN : s = "unknown"; break;
+ case GPGME_DATA_TYPE_PGP_SIGNED : s = "PGP-signed"; break;
+ case GPGME_DATA_TYPE_PGP_SIGNATURE: s = "PGP-signature"; break;
+ case GPGME_DATA_TYPE_PGP_ENCRYPTED: s = "PGP-encrypted"; 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;
+ }
+ return s;
+}
+
+
+static int
+show_usage (int ex)
+{
+ fputs ("usage: " PGM " [options] FILENAMEs\n\n"
+ "Options:\n"
+ " --verbose run in verbose mode\n"
+ , stderr);
+ exit (ex);
+}
+
+int
+main (int argc, char **argv)
+{
+ int last_argc = -1;
+ gpgme_error_t err;
+ int anyerr = 0;
+ gpgme_data_t data;
+ gpgme_data_type_t dt;
+
+ if (argc)
+ { argc--; argv++; }
+ while (argc && last_argc != argc )
+ {
+ last_argc = argc;
+ if (!strcmp (*argv, "--"))
+ {
+ argc--; argv++;
+ break;
+ }
+ else if (!strcmp (*argv, "--help"))
+ show_usage (0);
+ else if (!strcmp (*argv, "--verbose"))
+ {
+ verbose = 1;
+ argc--; argv++;
+ }
+ else if (!strncmp (*argv, "--", 2))
+ show_usage (1);
+
+ }
+
+ init_gpgme (GPGME_PROTOCOL_OpenPGP);
+
+ for (; argc; argc--, argv++)
+ {
+ if (verbose)
+ printf ("reading file `%s'\n", *argv);
+ err = gpgme_data_new_from_file (&data, *argv, 1);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error reading '%s': %s\n",
+ *argv, gpg_strerror (err));
+ anyerr = 1;
+ }
+ else
+ {
+ dt = gpgme_data_identify (data, 0);
+ if (dt == GPGME_DATA_TYPE_INVALID)
+ anyerr = 1;
+ printf ("%s: %s\n", *argv, data_type_to_string (dt));
+ gpgme_data_release (data);
+ }
+ }
+
+ return anyerr;
+}
diff --git a/tests/run-keylist.c b/tests/run-keylist.c
index 8abdf43..647a9ed 100644
--- a/tests/run-keylist.c
+++ b/tests/run-keylist.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <time.h>
#include <gpgme.h>
@@ -49,16 +50,38 @@ show_usage (int ex)
" --local use GPGME_KEYLIST_MODE_LOCAL\n"
" --extern use GPGME_KEYLIST_MODE_EXTERN\n"
" --sigs use GPGME_KEYLIST_MODE_SIGS\n"
+ " --tofu use GPGME_KEYLIST_MODE_TOFU\n"
" --sig-notations use GPGME_KEYLIST_MODE_SIG_NOTATIONS\n"
" --ephemeral use GPGME_KEYLIST_MODE_EPHEMERAL\n"
" --validate use GPGME_KEYLIST_MODE_VALIDATE\n"
" --import import all keys\n"
" --offline use offline mode\n"
+ " --require-gnupg required at least the given GnuPG version\n"
, stderr);
exit (ex);
}
+static const char *
+isotimestr (unsigned long value)
+{
+ time_t t;
+ static char buffer[25+5];
+ struct tm *tp;
+
+ if (!value)
+ return "none";
+ t = value;
+
+ tp = gmtime (&t);
+ snprintf (buffer, sizeof buffer, "%04d-%02d-%02d %02d:%02d:%02d",
+ 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
+ tp->tm_hour, tp->tm_min, tp->tm_sec);
+ return buffer;
+}
+
+
+
int
main (int argc, char **argv)
{
@@ -67,6 +90,7 @@ main (int argc, char **argv)
gpgme_ctx_t ctx;
gpgme_keylist_mode_t mode = 0;
gpgme_key_t key;
+ gpgme_subkey_t subkey;
gpgme_keylist_result_t result;
int import = 0;
gpgme_key_t keyarray[100];
@@ -118,6 +142,11 @@ main (int argc, char **argv)
mode |= GPGME_KEYLIST_MODE_EXTERN;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--tofu"))
+ {
+ mode |= GPGME_KEYLIST_MODE_WITH_TOFU;
+ argc--; argv++;
+ }
else if (!strcmp (*argv, "--sigs"))
{
mode |= GPGME_KEYLIST_MODE_SIGS;
@@ -148,9 +177,16 @@ main (int argc, char **argv)
offline = 1;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--require-gnupg"))
+ {
+ argc--; argv++;
+ if (!argc)
+ show_usage (1);
+ gpgme_set_global_flag ("require-gnupg", *argv);
+ argc--; argv++;
+ }
else if (!strncmp (*argv, "--", 2))
show_usage (1);
-
}
if (argc > 1)
@@ -172,33 +208,95 @@ main (int argc, char **argv)
while (!(err = gpgme_op_keylist_next (ctx, &key)))
{
gpgme_user_id_t uid;
+ gpgme_tofu_info_t ti;
int nuids;
-
+ int nsub;
printf ("keyid : %s\n", key->subkeys?nonnull (key->subkeys->keyid):"?");
printf ("fpr : %s\n", key->subkeys?nonnull (key->subkeys->fpr):"?");
+ if (key->subkeys && key->subkeys->keygrip)
+ printf ("grip : %s\n", key->subkeys->keygrip);
+ if (key->subkeys && key->subkeys->curve)
+ printf ("curve : %s\n", key->subkeys->curve);
printf ("caps : %s%s%s%s\n",
key->can_encrypt? "e":"",
key->can_sign? "s":"",
key->can_certify? "c":"",
key->can_authenticate? "a":"");
- printf ("flags :%s%s%s%s%s%s\n",
+ printf ("flags :%s%s%s%s%s%s%s\n",
key->secret? " secret":"",
key->revoked? " revoked":"",
key->expired? " expired":"",
key->disabled? " disabled":"",
key->invalid? " invalid":"",
- key->is_qualified? " qualifid":"");
+ key->is_qualified? " qualifid":"",
+ key->subkeys && key->subkeys->is_cardkey? " cardkey":"");
+
+ subkey = key->subkeys;
+ if (subkey)
+ subkey = subkey->next;
+ for (nsub=1; subkey; subkey = subkey->next, nsub++)
+ {
+ printf ("fpr %2d: %s\n", nsub, nonnull (subkey->fpr));
+ if (subkey->keygrip)
+ printf ("grip %2d: %s\n", nsub, subkey->keygrip);
+ if (subkey->curve)
+ printf ("curve %2d: %s\n", nsub, subkey->curve);
+ printf ("caps %2d: %s%s%s%s\n",
+ nsub,
+ subkey->can_encrypt? "e":"",
+ subkey->can_sign? "s":"",
+ subkey->can_certify? "c":"",
+ subkey->can_authenticate? "a":"");
+ printf ("flags %2d:%s%s%s%s%s%s%s\n",
+ nsub,
+ subkey->secret? " secret":"",
+ subkey->revoked? " revoked":"",
+ subkey->expired? " expired":"",
+ subkey->disabled? " disabled":"",
+ subkey->invalid? " invalid":"",
+ subkey->is_qualified? " qualifid":"",
+ subkey->is_cardkey? " cardkey":"");
+ }
for (nuids=0, uid=key->uids; uid; uid = uid->next, nuids++)
{
printf ("userid %d: %s\n", nuids, nonnull(uid->uid));
- printf ("valid %d: %s\n", nuids,
+ printf (" mbox: %s\n", nonnull(uid->address));
+ if (uid->email && uid->email != uid->address)
+ printf (" email: %s\n", uid->email);
+ if (uid->name)
+ printf (" name: %s\n", uid->name);
+ if (uid->comment)
+ printf (" cmmnt: %s\n", uid->comment);
+ printf (" valid: %s\n",
uid->validity == GPGME_VALIDITY_UNKNOWN? "unknown":
uid->validity == GPGME_VALIDITY_UNDEFINED? "undefined":
uid->validity == GPGME_VALIDITY_NEVER? "never":
uid->validity == GPGME_VALIDITY_MARGINAL? "marginal":
uid->validity == GPGME_VALIDITY_FULL? "full":
uid->validity == GPGME_VALIDITY_ULTIMATE? "ultimate": "[?]");
+ if ((ti = uid->tofu))
+ {
+ printf (" tofu: %u (%s)\n", ti->validity,
+ ti->validity == 0? "conflict" :
+ ti->validity == 1? "no history" :
+ ti->validity == 2? "little history" :
+ ti->validity == 3? "enough history" :
+ ti->validity == 4? "lot of history" : "?");
+ printf (" policy: %u (%s)\n", ti->policy,
+ ti->policy == GPGME_TOFU_POLICY_NONE? "none" :
+ ti->policy == GPGME_TOFU_POLICY_AUTO? "auto" :
+ ti->policy == GPGME_TOFU_POLICY_GOOD? "good" :
+ ti->policy == GPGME_TOFU_POLICY_UNKNOWN? "unknown" :
+ ti->policy == GPGME_TOFU_POLICY_BAD? "bad" :
+ ti->policy == GPGME_TOFU_POLICY_ASK? "ask" : "?");
+ printf (" nsigs: %hu\n", ti->signcount);
+ printf (" first: %s\n", isotimestr (ti->signfirst));
+ printf (" last: %s\n", isotimestr (ti->signlast));
+ printf (" nencr: %hu\n", ti->encrcount);
+ printf (" first: %s\n", isotimestr (ti->encrfirst));
+ printf (" last: %s\n", isotimestr (ti->encrlast));
+ }
}
putchar ('\n');
diff --git a/tests/run-keysign.c b/tests/run-keysign.c
new file mode 100644
index 0000000..f5a13e4
--- /dev/null
+++ b/tests/run-keysign.c
@@ -0,0 +1,261 @@
+/* run-keysign.c - Test tool to sign a key
+ * Copyright (C) 2016 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/>.
+ */
+
+/* We need to include config.h so that we know whether we are building
+ with large file system (LFS) support. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include <gpgme.h>
+
+#define PGM "run-keysign"
+
+#include "run-support.h"
+
+
+static int verbose;
+
+
+static gpg_error_t
+status_cb (void *opaque, const char *keyword, const char *value)
+{
+ (void)opaque;
+ fprintf (stderr, "status_cb: %s %s\n", nonnull(keyword), nonnull(value));
+ return 0;
+}
+
+
+static unsigned long
+parse_expire_string (const char *string)
+{
+ unsigned long seconds;
+
+ if (!string || !*string || !strcmp (string, "none")
+ || !strcmp (string, "never") || !strcmp (string, "-"))
+ seconds = 0;
+ else if (strspn (string, "01234567890") == strlen (string))
+ seconds = strtoul (string, NULL, 10);
+ else
+ {
+ fprintf (stderr, PGM ": invalid value '%s'\n", string);
+ exit (1);
+ }
+
+ return seconds;
+}
+
+
+
+static int
+show_usage (int ex)
+{
+ fputs ("usage: " PGM " [options] FPR USERIDS\n\n"
+ "Options:\n"
+ " --verbose run in verbose mode\n"
+ " --status print status lines from the backend\n"
+ " --loopback use a loopback pinentry\n"
+ " --signer NAME use key NAME for signing\n"
+ " --local create a local signature\n"
+ " --noexpire force no expiration\n"
+ " --expire EPOCH expire the signature at EPOCH\n"
+ , stderr);
+ exit (ex);
+}
+
+
+int
+main (int argc, char **argv)
+{
+ int last_argc = -1;
+ gpgme_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP;
+ const char *signer_string = NULL;
+ int print_status = 0;
+ int use_loopback = 0;
+ const char *userid;
+ unsigned int flags = 0;
+ unsigned long expire = 0;
+ gpgme_key_t thekey;
+ int i;
+ size_t n;
+ char *userid_buffer = NULL;
+
+ if (argc)
+ { argc--; argv++; }
+
+ while (argc && last_argc != argc )
+ {
+ last_argc = argc;
+ if (!strcmp (*argv, "--"))
+ {
+ argc--; argv++;
+ break;
+ }
+ else if (!strcmp (*argv, "--help"))
+ show_usage (0);
+ else if (!strcmp (*argv, "--verbose"))
+ {
+ verbose = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--status"))
+ {
+ print_status = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--signer"))
+ {
+ argc--; argv++;
+ if (!argc)
+ show_usage (1);
+ signer_string = *argv;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--loopback"))
+ {
+ use_loopback = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--local"))
+ {
+ flags |= GPGME_KEYSIGN_LOCAL;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--noexpire"))
+ {
+ flags |= GPGME_KEYSIGN_NOEXPIRE;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--expire"))
+ {
+ argc--; argv++;
+ if (!argc)
+ show_usage (1);
+ expire = parse_expire_string (*argv);
+ argc--; argv++;
+ }
+ else if (!strncmp (*argv, "--", 2))
+ show_usage (1);
+ }
+
+ if (!argc)
+ show_usage (1);
+ userid = argv[0];
+ argc--; argv++;
+
+ init_gpgme (protocol);
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+ gpgme_set_protocol (ctx, protocol);
+ gpgme_set_armor (ctx, 1);
+ if (print_status)
+ {
+ gpgme_set_status_cb (ctx, status_cb, NULL);
+ gpgme_set_ctx_flag (ctx, "full-status", "1");
+ }
+ if (use_loopback)
+ {
+ gpgme_set_pinentry_mode (ctx, GPGME_PINENTRY_MODE_LOOPBACK);
+ gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
+ }
+
+ if (signer_string)
+ {
+ gpgme_key_t akey;
+
+ err = gpgme_get_key (ctx, signer_string, &akey, 1);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error getting signer key '%s': %s\n",
+ signer_string, gpg_strerror (err));
+ exit (1);
+ }
+ err = gpgme_signers_add (ctx, akey);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error adding signer key: %s\n",
+ gpg_strerror (err));
+ exit (1);
+ }
+ gpgme_key_unref (akey);
+ }
+
+
+ err = gpgme_get_key (ctx, userid, &thekey, 0);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error getting key for '%s': %s\n",
+ userid, gpg_strerror (err));
+ exit (1);
+ }
+
+ if (argc > 1)
+ {
+ /* Several user ids given */
+ for (i=0, n = 0; i < argc; i++)
+ n += strlen (argv[1]) + 1;
+ n++;
+ userid_buffer = malloc (n);
+ if (!userid_buffer)
+ {
+ fprintf (stderr, PGM ": malloc failed: %s\n",
+ gpg_strerror (gpg_error_from_syserror ()));
+ exit (1);
+ }
+ *userid_buffer = 0;
+ for (i=0; i < argc; i++)
+ {
+ strcat (userid_buffer, argv[i]);
+ strcat (userid_buffer, "\n");
+ }
+ userid = userid_buffer;
+ flags |= GPGME_KEYSIGN_LFSEP;
+ }
+ else if (argc)
+ {
+ /* One user id given */
+ userid = *argv;
+ }
+ else
+ {
+ /* No user id given. */
+ userid = NULL;
+ }
+
+ err = gpgme_op_keysign (ctx, thekey, userid, expire, flags);
+ if (err)
+ {
+ fprintf (stderr, PGM ": gpgme_op_adduid failed: %s\n",
+ gpg_strerror (err));
+ exit (1);
+ }
+
+ free (userid_buffer);
+ gpgme_key_unref (thekey);
+ gpgme_release (ctx);
+ return 0;
+}
diff --git a/tests/run-sign.c b/tests/run-sign.c
index c59c356..70853ed 100644
--- a/tests/run-sign.c
+++ b/tests/run-sign.c
@@ -51,6 +51,8 @@ print_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)
gpgme_invalid_key_t invkey;
gpgme_new_signature_t sig;
+ (void)type;
+
for (invkey = result->invalid_signers; invkey; invkey = invkey->next)
printf ("Signing key `%s' not used: %s <%s>\n",
nonnull (invkey->fpr),
diff --git a/tests/run-support.h b/tests/run-support.h
index b1aea4b..e4a4f70 100644
--- a/tests/run-support.h
+++ b/tests/run-support.h
@@ -75,27 +75,25 @@ gpgme_error_t
passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info,
int last_was_bad, int fd)
{
-#ifdef HAVE_W32_SYSTEM
- DWORD written;
- WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0);
-#else
int res;
- char *pass = "abc\n";
+ char pass[] = "abc\n";
int passlen = strlen (pass);
int off = 0;
+ (void)opaque;
+ (void)uid_hint;
+ (void)passphrase_info;
+ (void)last_was_bad;
+
do
{
- res = write (fd, &pass[off], passlen - off);
+ res = gpgme_io_write (fd, &pass[off], passlen - off);
if (res > 0)
off += res;
}
while (res > 0 && off != passlen);
return off == passlen ? 0 : gpgme_error_from_errno (errno);
-#endif
-
- return 0;
}
diff --git a/tests/run-tofu.c b/tests/run-tofu.c
new file mode 100644
index 0000000..ff55789
--- /dev/null
+++ b/tests/run-tofu.c
@@ -0,0 +1,178 @@
+/* run-tofu.c - Test tool for Tofu functions
+ * Copyright (C) 2016 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/>.
+ */
+
+/* We need to include config.h so that we know whether we are building
+ with large file system (LFS) support. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include <gpgme.h>
+
+#define PGM "run-tofu"
+
+#include "run-support.h"
+
+
+static int verbose;
+
+
+static gpg_error_t
+status_cb (void *opaque, const char *keyword, const char *value)
+{
+ (void)opaque;
+ fprintf (stderr, "status_cb: %s %s\n", nonnull(keyword), nonnull(value));
+ return 0;
+}
+
+
+
+static gpgme_tofu_policy_t
+parse_policy_string (const char *string)
+{
+ gpgme_tofu_policy_t policy;
+
+ if (!strcmp (string, "auto"))
+ policy = GPGME_TOFU_POLICY_AUTO;
+ else if (!strcmp (string, "good"))
+ policy = GPGME_TOFU_POLICY_GOOD;
+ else if (!strcmp (string, "bad"))
+ policy = GPGME_TOFU_POLICY_BAD;
+ else if (!strcmp (string, "ask"))
+ policy = GPGME_TOFU_POLICY_ASK;
+ else if (!strcmp (string, "unknown"))
+ policy = GPGME_TOFU_POLICY_UNKNOWN;
+ else
+ {
+ fprintf (stderr, PGM ": invalid policy value '%s'\n", string);
+ exit (1);
+ }
+
+ return policy;
+}
+
+
+
+static int
+show_usage (int ex)
+{
+ fputs ("usage: " PGM " [options] FPR\n\n"
+ "Options:\n"
+ " --policy NAME Set tofu policy for key to NAME\n"
+ " --verbose run in verbose mode\n"
+ " --status print status lines from the backend\n"
+ , stderr);
+ exit (ex);
+}
+
+
+int
+main (int argc, char **argv)
+{
+ int last_argc = -1;
+ gpgme_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP;
+ int print_status = 0;
+ gpgme_key_t thekey;
+ const char *fpr;
+ const char *policystr = NULL;
+ gpgme_tofu_policy_t policy;
+
+ if (argc)
+ { argc--; argv++; }
+
+ while (argc && last_argc != argc )
+ {
+ last_argc = argc;
+ if (!strcmp (*argv, "--"))
+ {
+ argc--; argv++;
+ break;
+ }
+ else if (!strcmp (*argv, "--help"))
+ show_usage (0);
+ else if (!strcmp (*argv, "--verbose"))
+ {
+ verbose = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--status"))
+ {
+ print_status = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--policy"))
+ {
+ argc--; argv++;
+ if (!argc)
+ show_usage (1);
+ policystr = *argv;
+ argc--; argv++;
+ }
+ else if (!strncmp (*argv, "--", 2))
+ show_usage (1);
+ }
+
+ if (argc != 1)
+ show_usage (1);
+ fpr = argv[0];
+
+ init_gpgme (protocol);
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+ gpgme_set_protocol (ctx, protocol);
+ gpgme_set_armor (ctx, 1);
+ if (print_status)
+ {
+ gpgme_set_status_cb (ctx, status_cb, NULL);
+ gpgme_set_ctx_flag (ctx, "full-status", "1");
+ }
+
+ err = gpgme_get_key (ctx, fpr, &thekey, 0);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error getting key '%s': %s\n",
+ fpr, gpg_strerror (err));
+ exit (1);
+ }
+
+ if (policystr)
+ {
+ policy = parse_policy_string (policystr);
+
+ err = gpgme_op_tofu_policy (ctx, thekey, policy);
+ if (err)
+ {
+ fprintf (stderr, PGM ": gpgme_op_tofu_polciy failed: %s\n",
+ gpg_strerror (err));
+ exit (1);
+ }
+ }
+
+ gpgme_key_unref (thekey);
+ gpgme_release (ctx);
+ return 0;
+}
diff --git a/tests/run-verify.c b/tests/run-verify.c
index b49ea2a..ebc20d9 100644
--- a/tests/run-verify.c
+++ b/tests/run-verify.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <time.h>
#include <gpgme.h>
@@ -36,6 +37,35 @@
static int verbose;
+
+static const char *
+isotimestr (unsigned long value)
+{
+ time_t t;
+ static char buffer[25+5];
+ struct tm *tp;
+
+ if (!value)
+ return "none";
+ t = value;
+
+ tp = gmtime (&t);
+ snprintf (buffer, sizeof buffer, "%04d-%02d-%02d %02d:%02d:%02d",
+ 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
+ tp->tm_hour, tp->tm_min, tp->tm_sec);
+ return buffer;
+}
+
+
+static gpg_error_t
+status_cb (void *opaque, const char *keyword, const char *value)
+{
+ (void)opaque;
+ fprintf (stderr, "status_cb: %s %s\n", keyword, value);
+ return 0;
+}
+
+
static void
print_summary (gpgme_sigsum_t summary)
{
@@ -85,9 +115,25 @@ print_validity (gpgme_validity_t val)
static void
+print_description (const char *text, int indent)
+{
+ for (; *text; text++)
+ {
+ putchar (*text);
+ if (*text == '\n')
+ printf ("%*s", indent, "");
+ }
+ putchar ('\n');
+}
+
+
+static void
print_result (gpgme_verify_result_t result)
{
gpgme_signature_t sig;
+ gpgme_sig_notation_t nt;
+ gpgme_user_id_t uid;
+ gpgme_tofu_info_t ti;
int count = 0;
printf ("Original file name: %s\n", nonnull(result->file_name));
@@ -102,8 +148,10 @@ print_result (gpgme_verify_result_t result)
printf (" validity ..: ");
print_validity (sig->validity); putchar ('\n');
printf (" val.reason : %s\n", gpgme_strerror (sig->status));
- printf (" pubkey algo: %d\n", sig->pubkey_algo);
- printf (" digest algo: %d\n", sig->hash_algo);
+ printf (" pubkey algo: %d (%s)\n", sig->pubkey_algo,
+ nonnull(gpgme_pubkey_algo_name (sig->pubkey_algo)));
+ printf (" digest algo: %d (%s)\n", sig->hash_algo,
+ nonnull(gpgme_hash_algo_name (sig->hash_algo)));
printf (" pka address: %s\n", nonnull (sig->pka_address));
printf (" pka trust .: %s\n",
sig->pka_trust == 0? "n/a" :
@@ -113,8 +161,52 @@ print_result (gpgme_verify_result_t result)
sig->wrong_key_usage? " wrong-key-usage":"",
sig->chain_model? " chain-model":""
);
- printf (" notations .: %s\n",
- sig->notations? "yes":"no");
+ for (nt = sig->notations; nt; nt = nt->next)
+ {
+ printf (" notation ..: '%s'\n", nt->name);
+ if (strlen (nt->name) != nt->name_len)
+ printf (" warning : name larger (%d)\n", nt->name_len);
+ printf (" flags ...:%s%s (0x%02x)\n",
+ nt->critical? " critical":"",
+ nt->human_readable? " human":"",
+ nt->flags);
+ if (nt->value)
+ printf (" value ...: '%s'\n", nt->value);
+ if ((nt->value?strlen (nt->value):0) != nt->value_len)
+ printf (" warning : value larger (%d)\n", nt->value_len);
+ }
+ if (sig->key)
+ {
+ printf (" primary fpr: %s\n", nonnull (sig->key->fpr));
+ for (uid = sig->key->uids; uid; uid = uid->next)
+ {
+ printf (" tofu addr .: %s\n", nonnull (uid->address));
+ ti = uid->tofu;
+ if (!ti)
+ continue;
+ printf (" validity : %u (%s)\n", ti->validity,
+ ti->validity == 0? "conflict" :
+ ti->validity == 1? "no history" :
+ ti->validity == 2? "little history" :
+ ti->validity == 3? "enough history" :
+ ti->validity == 4? "lot of history" : "?");
+ printf (" policy ..: %u (%s)\n", ti->policy,
+ ti->policy == GPGME_TOFU_POLICY_NONE? "none" :
+ ti->policy == GPGME_TOFU_POLICY_AUTO? "auto" :
+ ti->policy == GPGME_TOFU_POLICY_GOOD? "good" :
+ ti->policy == GPGME_TOFU_POLICY_UNKNOWN? "unknown" :
+ ti->policy == GPGME_TOFU_POLICY_BAD? "bad" :
+ ti->policy == GPGME_TOFU_POLICY_ASK? "ask" : "?");
+ printf (" signcount: %hu\n", ti->signcount);
+ printf (" first..: %s\n", isotimestr (ti->signfirst));
+ printf (" last ..: %s\n", isotimestr (ti->signlast));
+ printf (" encrcount: %hu\n", ti->encrcount);
+ printf (" first..: %s\n", isotimestr (ti->encrfirst));
+ printf (" last ..: %s\n", isotimestr (ti->encrlast));
+ printf (" desc ....: ");
+ print_description (nonnull (ti->description), 15);
+ }
+ }
}
}
@@ -126,6 +218,7 @@ show_usage (int ex)
fputs ("usage: " PGM " [options] [DETACHEDSIGFILE] FILE\n\n"
"Options:\n"
" --verbose run in verbose mode\n"
+ " --status print status lines from the backend\n"
" --openpgp use the OpenPGP protocol (default)\n"
" --cms use the CMS protocol\n"
, stderr);
@@ -145,6 +238,7 @@ main (int argc, char **argv)
FILE *fp_msg = NULL;
gpgme_data_t msg = NULL;
gpgme_verify_result_t result;
+ int print_status = 0;
if (argc)
{ argc--; argv++; }
@@ -164,6 +258,11 @@ main (int argc, char **argv)
verbose = 1;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--status"))
+ {
+ print_status = 1;
+ argc--; argv++;
+ }
else if (!strcmp (*argv, "--openpgp"))
{
protocol = GPGME_PROTOCOL_OpenPGP;
@@ -207,6 +306,12 @@ main (int argc, char **argv)
err = gpgme_new (&ctx);
fail_if_err (err);
gpgme_set_protocol (ctx, protocol);
+ if (print_status)
+ {
+ gpgme_set_status_cb (ctx, status_cb, NULL);
+ gpgme_set_ctx_flag (ctx, "full-status", "1");
+ }
+ /* gpgme_set_ctx_flag (ctx, "raw-description", "1"); */
err = gpgme_data_new_from_stream (&sig, fp_sig);
if (err)
@@ -232,7 +337,7 @@ main (int argc, char **argv)
print_result (result);
if (err)
{
- fprintf (stderr, PGM ": signing failed: %s\n", gpgme_strerror (err));
+ fprintf (stderr, PGM ": verify failed: %s\n", gpgme_strerror (err));
exit (1);
}
diff --git a/tests/t-data.c b/tests/t-data.c
index 888475f..fe2d59e 100644
--- a/tests/t-data.c
+++ b/tests/t-data.c
@@ -86,6 +86,8 @@ read_cb (void *cb_value, char *buffer, size_t count, size_t *nread)
unsigned int amount = strlen (text) - off;
/* round_t round = *((round_t *) cb_value); */
+ (void)cb_value;
+
if (!buffer && !count && !nread)
{
/* Rewind requested. */
@@ -143,7 +145,7 @@ read_test (round_t round, gpgme_data_t data)
read = gpgme_data_read (data, buffer, sizeof (buffer));
if (read > 0)
{
- fprintf (stderr, "%s:%d: (%i) gpgme_data_read succeded unexpectedly\n",
+ fprintf (stderr, "%s:%d: (%i) gpgme_data_read succeeded unexpectedly\n",
__FILE__, __LINE__, round);
exit (1);
}
@@ -190,12 +192,13 @@ write_test (round_t round, gpgme_data_t data)
}
}
+
int
-main (int argc, char **argv)
+main (void)
{
round_t round = TEST_INITIALIZER;
- const char *text_filename = make_filename ("t-data-1.txt");
- const char *longer_text_filename = make_filename ("t-data-2.txt");
+ char *text_filename = make_filename ("t-data-1.txt");
+ char *longer_text_filename = make_filename ("t-data-2.txt");
const char *missing_filename = "this-file-surely-does-not-exist";
gpgme_error_t err = 0;
gpgme_data_t data;
@@ -269,7 +272,7 @@ main (int argc, char **argv)
}
break;
case TEST_END:
- return 0;
+ goto out;
case TEST_INITIALIZER:
/* Shouldn't happen. */
fprintf (stderr, "%s:%d: impossible condition\n", __FILE__, __LINE__);
@@ -281,5 +284,8 @@ main (int argc, char **argv)
write_test (round, data);
gpgme_data_release (data);
}
+ out:
+ free (text_filename);
+ free (longer_text_filename);
return 0;
}
diff --git a/tests/t-engine-info.c b/tests/t-engine-info.c
index 53f5b2f..8f617f9 100644
--- a/tests/t-engine-info.c
+++ b/tests/t-engine-info.c
@@ -111,8 +111,20 @@ main (int argc, char **argv )
gpgme_check_version (NULL);
{
- const char *keys[] = {"homedir", "agent-socket", "uiserver-socket",
- "gpgconf-name", "gpg-name", "gpgsm-name",
+ const char *keys[] = {"homedir",
+ "sysconfdir",
+ "bindir",
+ "libexecdir",
+ "libdir",
+ "datadir",
+ "localedir",
+ "agent-socket",
+ "agent-ssh-socket",
+ "dirmngr-socket",
+ "uiserver-socket",
+ "gpgconf-name",
+ "gpg-name",
+ "gpgsm-name",
"g13-name", NULL };
const char *s;
int i;