diff options
Diffstat (limited to 'tests/gpg')
-rw-r--r-- | tests/gpg/Makefile.am | 30 | ||||
-rw-r--r-- | tests/gpg/Makefile.in | 160 | ||||
-rw-r--r-- | tests/gpg/gpg.conf.in | 5 | ||||
-rw-r--r-- | tests/gpg/t-cancel.c | 67 | ||||
-rw-r--r-- | tests/gpg/t-edit-sign.c | 54 | ||||
-rw-r--r-- | tests/gpg/t-eventloop.c | 63 | ||||
-rw-r--r-- | tests/gpg/t-import.c | 32 |
7 files changed, 328 insertions, 83 deletions
diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am index d24a312..6d99539 100644 --- a/tests/gpg/Makefile.am +++ b/tests/gpg/Makefile.am @@ -38,8 +38,8 @@ endif 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-edit t-keylist t-keylist-sig t-keylist-secret-sig t-wait \ - t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed t-edit-sign \ + t-import t-edit t-keylist t-keylist-sig t-keylist-secret-sig t-wait \ + t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed t-edit-sign \ $(tests_unix) TESTS = initial.test $(c_tests) final.test @@ -60,17 +60,26 @@ private_keys = \ EXTRA_DIST = initial.test final.test \ pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \ cipher-3.asc cipher-no-sig.asc \ - geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys) + geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys) \ + gpg.conf.in BUILT_SOURCES = gpg.conf gpg-agent.conf pubring-stamp \ gpg-sample.stamp AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ AM_LDFLAGS = -no-install LDADD = ../../src/libgpgme.la @LDADD_FOR_TESTS_KLUDGE@ -t_thread1_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@ -t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@ -t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@ -t_cancel_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@ + +WITH_THREAD_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_MT_CFLAGS@ +WITH_THREAD_LDADD = ../../src/libgpgme.la \ + @GPG_ERROR_MT_LIBS@ @LDADD_FOR_TESTS_KLUDGE@ +t_thread1_CPPFLAGS = $(WITH_THREAD_CPPFLAGS) +t_thread1_LDADD = $(WITH_THREAD_LDADD) +t_thread_keylist_CPPFLAGS = $(WITH_THREAD_CPPFLAGS) +t_thread_keylist_LDADD = $(WITH_THREAD_LDADD) +t_thread_keylist_verify_CPPFLAGS = $(WITH_THREAD_CPPFLAGS) +t_thread_keylist_verify_LDADD = $(WITH_THREAD_LDADD) +t_cancel_CPPFLAGS = $(WITH_THREAD_CPPFLAGS) +t_cancel_LDADD = $(WITH_THREAD_LDADD) # We don't run t-genkey and t-cancel in the test suite, because it # takes too long @@ -101,11 +110,8 @@ pubring-stamp: $(srcdir)/pubdemo.asc gpg-sample.stamp --import $(srcdir)/secdemo.asc echo x > ./pubring-stamp -gpg.conf: -# This is required for t-sig-notations. - echo no-force-v3-sigs > ./gpg.conf -# This is required for t-edit-sign. - echo allow-weak-key-signatures >> ./gpg.conf +gpg.conf: $(srcdir)/gpg.conf.in + cp $(srcdir)/gpg.conf.in gpg.conf gpg-agent.conf: # This is required for gpg2, which does not support command fd for the diff --git a/tests/gpg/Makefile.in b/tests/gpg/Makefile.in index 9fcd92b..f24fffa 100644 --- a/tests/gpg/Makefile.in +++ b/tests/gpg/Makefile.in @@ -149,8 +149,9 @@ am__EXEEXT_2 = t-encrypt$(EXEEXT) t-encrypt-sym$(EXEEXT) \ am__EXEEXT_4 = t-genkey$(EXEEXT) $(am__EXEEXT_3) PROGRAMS = $(noinst_PROGRAMS) t_cancel_SOURCES = t-cancel.c -t_cancel_OBJECTS = t-cancel.$(OBJEXT) -t_cancel_DEPENDENCIES = ../../src/libgpgme.la +t_cancel_OBJECTS = t_cancel-t-cancel.$(OBJEXT) +am__DEPENDENCIES_1 = ../../src/libgpgme.la +t_cancel_DEPENDENCIES = $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -240,14 +241,16 @@ t_signers_OBJECTS = t-signers.$(OBJEXT) t_signers_LDADD = $(LDADD) t_signers_DEPENDENCIES = ../../src/libgpgme.la t_thread_keylist_SOURCES = t-thread-keylist.c -t_thread_keylist_OBJECTS = t-thread-keylist.$(OBJEXT) -t_thread_keylist_DEPENDENCIES = ../../src/libgpgme.la +t_thread_keylist_OBJECTS = \ + t_thread_keylist-t-thread-keylist.$(OBJEXT) +t_thread_keylist_DEPENDENCIES = $(am__DEPENDENCIES_1) t_thread_keylist_verify_SOURCES = t-thread-keylist-verify.c -t_thread_keylist_verify_OBJECTS = t-thread-keylist-verify.$(OBJEXT) -t_thread_keylist_verify_DEPENDENCIES = ../../src/libgpgme.la +t_thread_keylist_verify_OBJECTS = \ + t_thread_keylist_verify-t-thread-keylist-verify.$(OBJEXT) +t_thread_keylist_verify_DEPENDENCIES = $(am__DEPENDENCIES_1) t_thread1_SOURCES = t-thread1.c -t_thread1_OBJECTS = t-thread1.$(OBJEXT) -t_thread1_DEPENDENCIES = ../../src/libgpgme.la +t_thread1_OBJECTS = t_thread1-t-thread1.$(OBJEXT) +t_thread1_DEPENDENCIES = $(am__DEPENDENCIES_1) t_verify_SOURCES = t-verify.c t_verify_OBJECTS = t-verify.$(OBJEXT) t_verify_LDADD = $(LDADD) @@ -271,21 +274,22 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/conf depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/t-cancel.Po \ - ./$(DEPDIR)/t-decrypt-verify.Po ./$(DEPDIR)/t-decrypt.Po \ - ./$(DEPDIR)/t-edit-sign.Po ./$(DEPDIR)/t-edit.Po \ - ./$(DEPDIR)/t-encrypt-large.Po ./$(DEPDIR)/t-encrypt-mixed.Po \ - ./$(DEPDIR)/t-encrypt-sign.Po ./$(DEPDIR)/t-encrypt-sym.Po \ - ./$(DEPDIR)/t-encrypt.Po ./$(DEPDIR)/t-eventloop.Po \ - ./$(DEPDIR)/t-export.Po ./$(DEPDIR)/t-file-name.Po \ - ./$(DEPDIR)/t-genkey.Po ./$(DEPDIR)/t-gpgconf.Po \ - ./$(DEPDIR)/t-import.Po ./$(DEPDIR)/t-keylist-secret-sig.Po \ +am__depfiles_remade = ./$(DEPDIR)/t-decrypt-verify.Po \ + ./$(DEPDIR)/t-decrypt.Po ./$(DEPDIR)/t-edit-sign.Po \ + ./$(DEPDIR)/t-edit.Po ./$(DEPDIR)/t-encrypt-large.Po \ + ./$(DEPDIR)/t-encrypt-mixed.Po ./$(DEPDIR)/t-encrypt-sign.Po \ + ./$(DEPDIR)/t-encrypt-sym.Po ./$(DEPDIR)/t-encrypt.Po \ + ./$(DEPDIR)/t-eventloop.Po ./$(DEPDIR)/t-export.Po \ + ./$(DEPDIR)/t-file-name.Po ./$(DEPDIR)/t-genkey.Po \ + ./$(DEPDIR)/t-gpgconf.Po ./$(DEPDIR)/t-import.Po \ + ./$(DEPDIR)/t-keylist-secret-sig.Po \ ./$(DEPDIR)/t-keylist-sig.Po ./$(DEPDIR)/t-keylist.Po \ ./$(DEPDIR)/t-sig-notation.Po ./$(DEPDIR)/t-sign.Po \ - ./$(DEPDIR)/t-signers.Po \ - ./$(DEPDIR)/t-thread-keylist-verify.Po \ - ./$(DEPDIR)/t-thread-keylist.Po ./$(DEPDIR)/t-thread1.Po \ - ./$(DEPDIR)/t-verify.Po ./$(DEPDIR)/t-wait.Po + ./$(DEPDIR)/t-signers.Po ./$(DEPDIR)/t-verify.Po \ + ./$(DEPDIR)/t-wait.Po ./$(DEPDIR)/t_cancel-t-cancel.Po \ + ./$(DEPDIR)/t_thread1-t-thread1.Po \ + ./$(DEPDIR)/t_thread_keylist-t-thread-keylist.Po \ + ./$(DEPDIR)/t_thread_keylist_verify-t-thread-keylist-verify.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -582,8 +586,8 @@ noinst_HEADERS = t-support.h 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-edit t-keylist t-keylist-sig t-keylist-secret-sig t-wait \ - t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed t-edit-sign \ + t-import t-edit t-keylist t-keylist-sig t-keylist-secret-sig t-wait \ + t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed t-edit-sign \ $(tests_unix) CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ @@ -601,7 +605,8 @@ private_keys = \ EXTRA_DIST = initial.test final.test \ pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \ cipher-3.asc cipher-no-sig.asc \ - geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys) + geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys) \ + gpg.conf.in BUILT_SOURCES = gpg.conf gpg-agent.conf pubring-stamp \ gpg-sample.stamp @@ -609,10 +614,18 @@ BUILT_SOURCES = gpg.conf gpg-agent.conf pubring-stamp \ AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ AM_LDFLAGS = -no-install LDADD = ../../src/libgpgme.la @LDADD_FOR_TESTS_KLUDGE@ -t_thread1_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@ -t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@ -t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@ -t_cancel_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@ +WITH_THREAD_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_MT_CFLAGS@ +WITH_THREAD_LDADD = ../../src/libgpgme.la \ + @GPG_ERROR_MT_LIBS@ @LDADD_FOR_TESTS_KLUDGE@ + +t_thread1_CPPFLAGS = $(WITH_THREAD_CPPFLAGS) +t_thread1_LDADD = $(WITH_THREAD_LDADD) +t_thread_keylist_CPPFLAGS = $(WITH_THREAD_CPPFLAGS) +t_thread_keylist_LDADD = $(WITH_THREAD_LDADD) +t_thread_keylist_verify_CPPFLAGS = $(WITH_THREAD_CPPFLAGS) +t_thread_keylist_verify_LDADD = $(WITH_THREAD_LDADD) +t_cancel_CPPFLAGS = $(WITH_THREAD_CPPFLAGS) +t_cancel_LDADD = $(WITH_THREAD_LDADD) # We don't run t-genkey and t-cancel in the test suite, because it # takes too long @@ -775,7 +788,6 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-cancel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-decrypt-verify.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-decrypt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-edit-sign.Po@am__quote@ # am--include-marker @@ -797,11 +809,12 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-sig-notation.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-sign.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-signers.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread-keylist-verify.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread-keylist.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-verify.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-wait.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_cancel-t-cancel.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_thread1-t-thread1.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_thread_keylist-t-thread-keylist.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_thread_keylist_verify-t-thread-keylist-verify.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @@ -830,6 +843,62 @@ am--depfiles: $(am__depfiles_remade) @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< +t_cancel-t-cancel.o: t-cancel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_cancel_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_cancel-t-cancel.o -MD -MP -MF $(DEPDIR)/t_cancel-t-cancel.Tpo -c -o t_cancel-t-cancel.o `test -f 't-cancel.c' || echo '$(srcdir)/'`t-cancel.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/t_cancel-t-cancel.Tpo $(DEPDIR)/t_cancel-t-cancel.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t-cancel.c' object='t_cancel-t-cancel.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_cancel_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_cancel-t-cancel.o `test -f 't-cancel.c' || echo '$(srcdir)/'`t-cancel.c + +t_cancel-t-cancel.obj: t-cancel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_cancel_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_cancel-t-cancel.obj -MD -MP -MF $(DEPDIR)/t_cancel-t-cancel.Tpo -c -o t_cancel-t-cancel.obj `if test -f 't-cancel.c'; then $(CYGPATH_W) 't-cancel.c'; else $(CYGPATH_W) '$(srcdir)/t-cancel.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/t_cancel-t-cancel.Tpo $(DEPDIR)/t_cancel-t-cancel.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t-cancel.c' object='t_cancel-t-cancel.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_cancel_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_cancel-t-cancel.obj `if test -f 't-cancel.c'; then $(CYGPATH_W) 't-cancel.c'; else $(CYGPATH_W) '$(srcdir)/t-cancel.c'; fi` + +t_thread_keylist-t-thread-keylist.o: t-thread-keylist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread_keylist_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_thread_keylist-t-thread-keylist.o -MD -MP -MF $(DEPDIR)/t_thread_keylist-t-thread-keylist.Tpo -c -o t_thread_keylist-t-thread-keylist.o `test -f 't-thread-keylist.c' || echo '$(srcdir)/'`t-thread-keylist.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/t_thread_keylist-t-thread-keylist.Tpo $(DEPDIR)/t_thread_keylist-t-thread-keylist.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t-thread-keylist.c' object='t_thread_keylist-t-thread-keylist.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread_keylist_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_thread_keylist-t-thread-keylist.o `test -f 't-thread-keylist.c' || echo '$(srcdir)/'`t-thread-keylist.c + +t_thread_keylist-t-thread-keylist.obj: t-thread-keylist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread_keylist_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_thread_keylist-t-thread-keylist.obj -MD -MP -MF $(DEPDIR)/t_thread_keylist-t-thread-keylist.Tpo -c -o t_thread_keylist-t-thread-keylist.obj `if test -f 't-thread-keylist.c'; then $(CYGPATH_W) 't-thread-keylist.c'; else $(CYGPATH_W) '$(srcdir)/t-thread-keylist.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/t_thread_keylist-t-thread-keylist.Tpo $(DEPDIR)/t_thread_keylist-t-thread-keylist.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t-thread-keylist.c' object='t_thread_keylist-t-thread-keylist.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread_keylist_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_thread_keylist-t-thread-keylist.obj `if test -f 't-thread-keylist.c'; then $(CYGPATH_W) 't-thread-keylist.c'; else $(CYGPATH_W) '$(srcdir)/t-thread-keylist.c'; fi` + +t_thread_keylist_verify-t-thread-keylist-verify.o: t-thread-keylist-verify.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread_keylist_verify_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_thread_keylist_verify-t-thread-keylist-verify.o -MD -MP -MF $(DEPDIR)/t_thread_keylist_verify-t-thread-keylist-verify.Tpo -c -o t_thread_keylist_verify-t-thread-keylist-verify.o `test -f 't-thread-keylist-verify.c' || echo '$(srcdir)/'`t-thread-keylist-verify.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/t_thread_keylist_verify-t-thread-keylist-verify.Tpo $(DEPDIR)/t_thread_keylist_verify-t-thread-keylist-verify.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t-thread-keylist-verify.c' object='t_thread_keylist_verify-t-thread-keylist-verify.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread_keylist_verify_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_thread_keylist_verify-t-thread-keylist-verify.o `test -f 't-thread-keylist-verify.c' || echo '$(srcdir)/'`t-thread-keylist-verify.c + +t_thread_keylist_verify-t-thread-keylist-verify.obj: t-thread-keylist-verify.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread_keylist_verify_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_thread_keylist_verify-t-thread-keylist-verify.obj -MD -MP -MF $(DEPDIR)/t_thread_keylist_verify-t-thread-keylist-verify.Tpo -c -o t_thread_keylist_verify-t-thread-keylist-verify.obj `if test -f 't-thread-keylist-verify.c'; then $(CYGPATH_W) 't-thread-keylist-verify.c'; else $(CYGPATH_W) '$(srcdir)/t-thread-keylist-verify.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/t_thread_keylist_verify-t-thread-keylist-verify.Tpo $(DEPDIR)/t_thread_keylist_verify-t-thread-keylist-verify.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t-thread-keylist-verify.c' object='t_thread_keylist_verify-t-thread-keylist-verify.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread_keylist_verify_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_thread_keylist_verify-t-thread-keylist-verify.obj `if test -f 't-thread-keylist-verify.c'; then $(CYGPATH_W) 't-thread-keylist-verify.c'; else $(CYGPATH_W) '$(srcdir)/t-thread-keylist-verify.c'; fi` + +t_thread1-t-thread1.o: t-thread1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_thread1-t-thread1.o -MD -MP -MF $(DEPDIR)/t_thread1-t-thread1.Tpo -c -o t_thread1-t-thread1.o `test -f 't-thread1.c' || echo '$(srcdir)/'`t-thread1.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/t_thread1-t-thread1.Tpo $(DEPDIR)/t_thread1-t-thread1.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t-thread1.c' object='t_thread1-t-thread1.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_thread1-t-thread1.o `test -f 't-thread1.c' || echo '$(srcdir)/'`t-thread1.c + +t_thread1-t-thread1.obj: t-thread1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_thread1-t-thread1.obj -MD -MP -MF $(DEPDIR)/t_thread1-t-thread1.Tpo -c -o t_thread1-t-thread1.obj `if test -f 't-thread1.c'; then $(CYGPATH_W) 't-thread1.c'; else $(CYGPATH_W) '$(srcdir)/t-thread1.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/t_thread1-t-thread1.Tpo $(DEPDIR)/t_thread1-t-thread1.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t-thread1.c' object='t_thread1-t-thread1.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_thread1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_thread1-t-thread1.obj `if test -f 't-thread1.c'; then $(CYGPATH_W) 't-thread1.c'; else $(CYGPATH_W) '$(srcdir)/t-thread1.c'; fi` + mostlyclean-libtool: -rm -f *.lo @@ -1060,8 +1129,7 @@ clean-am: clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/t-cancel.Po - -rm -f ./$(DEPDIR)/t-decrypt-verify.Po + -rm -f ./$(DEPDIR)/t-decrypt-verify.Po -rm -f ./$(DEPDIR)/t-decrypt.Po -rm -f ./$(DEPDIR)/t-edit-sign.Po -rm -f ./$(DEPDIR)/t-edit.Po @@ -1082,11 +1150,12 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/t-sig-notation.Po -rm -f ./$(DEPDIR)/t-sign.Po -rm -f ./$(DEPDIR)/t-signers.Po - -rm -f ./$(DEPDIR)/t-thread-keylist-verify.Po - -rm -f ./$(DEPDIR)/t-thread-keylist.Po - -rm -f ./$(DEPDIR)/t-thread1.Po -rm -f ./$(DEPDIR)/t-verify.Po -rm -f ./$(DEPDIR)/t-wait.Po + -rm -f ./$(DEPDIR)/t_cancel-t-cancel.Po + -rm -f ./$(DEPDIR)/t_thread1-t-thread1.Po + -rm -f ./$(DEPDIR)/t_thread_keylist-t-thread-keylist.Po + -rm -f ./$(DEPDIR)/t_thread_keylist_verify-t-thread-keylist-verify.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -1132,8 +1201,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/t-cancel.Po - -rm -f ./$(DEPDIR)/t-decrypt-verify.Po + -rm -f ./$(DEPDIR)/t-decrypt-verify.Po -rm -f ./$(DEPDIR)/t-decrypt.Po -rm -f ./$(DEPDIR)/t-edit-sign.Po -rm -f ./$(DEPDIR)/t-edit.Po @@ -1154,11 +1222,12 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/t-sig-notation.Po -rm -f ./$(DEPDIR)/t-sign.Po -rm -f ./$(DEPDIR)/t-signers.Po - -rm -f ./$(DEPDIR)/t-thread-keylist-verify.Po - -rm -f ./$(DEPDIR)/t-thread-keylist.Po - -rm -f ./$(DEPDIR)/t-thread1.Po -rm -f ./$(DEPDIR)/t-verify.Po -rm -f ./$(DEPDIR)/t-wait.Po + -rm -f ./$(DEPDIR)/t_cancel-t-cancel.Po + -rm -f ./$(DEPDIR)/t_thread1-t-thread1.Po + -rm -f ./$(DEPDIR)/t_thread_keylist-t-thread-keylist.Po + -rm -f ./$(DEPDIR)/t_thread_keylist_verify-t-thread-keylist-verify.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -1216,11 +1285,8 @@ pubring-stamp: $(srcdir)/pubdemo.asc gpg-sample.stamp --import $(srcdir)/secdemo.asc echo x > ./pubring-stamp -gpg.conf: -# This is required for t-sig-notations. - echo no-force-v3-sigs > ./gpg.conf -# This is required for t-edit-sign. - echo allow-weak-key-signatures >> ./gpg.conf +gpg.conf: $(srcdir)/gpg.conf.in + cp $(srcdir)/gpg.conf.in gpg.conf gpg-agent.conf: # This is required for gpg2, which does not support command fd for the diff --git a/tests/gpg/gpg.conf.in b/tests/gpg/gpg.conf.in new file mode 100644 index 0000000..ab05c17 --- /dev/null +++ b/tests/gpg/gpg.conf.in @@ -0,0 +1,5 @@ +# This is required for t-sig-notations. +no-force-v3-sigs + +# This is required for t-edit-sign. +allow-weak-key-signatures diff --git a/tests/gpg/t-cancel.c b/tests/gpg/t-cancel.c index 48158fb..d5fb666 100644 --- a/tests/gpg/t-cancel.c +++ b/tests/gpg/t-cancel.c @@ -38,8 +38,16 @@ #include <sys/types.h> #include <unistd.h> #include <pthread.h> -#ifdef HAVE_SYS_SELECT_H -# include <sys/select.h> +#ifdef HAVE_POLL_H +# include <poll.h> +#else +# ifdef HAVE_SYS_SELECT_H +# include <sys/select.h> +# else +# ifdef HAVE_SYS_TIME_H +# include <sys/time.h> +# endif +# endif #endif #include <gpgme.h> @@ -116,6 +124,60 @@ io_event (void *data, gpgme_event_io_t type, void *type_data) } +#ifdef HAVE_POLL_H +static int +do_select (void) +{ + struct pollfd poll_fds[FDLIST_MAX]; + nfds_t poll_nfds; + int i, n; + int any = 0; + + pthread_mutex_lock (&lock); + poll_nfds = 0; + for (i = 0; i < FDLIST_MAX; i++) + if (fdlist[i].fd != -1) + { + poll_fds[poll_nfds].fd = fdlist[i].fd; + poll_fds[poll_nfds].events = 0; + poll_fds[poll_nfds].revents = 0; + if (fdlist[i].dir) + poll_fds[poll_nfds].events |= POLLIN; + else + poll_fds[poll_nfds].events |= POLLOUT; + poll_nfds++; + } + pthread_mutex_unlock (&lock); + + do + { + n = poll (poll_fds, poll_nfds, 1000); + } + while (n < 0 && (errno == EINTR || errno == EAGAIN)); + + if (n < 0) + return n; /* Error or timeout. */ + + pthread_mutex_lock (&lock); + poll_nfds = 0; + for (i = 0; i < FDLIST_MAX && n; i++) + { + if (fdlist[i].fd != -1) + { + if ((poll_fds[poll_nfds++].revents + & (fdlist[i].dir ? (POLLIN|POLLHUP) : POLLOUT))) + { + assert (n); + n--; + any = 1; + (*fdlist[i].fnc) (fdlist[i].fnc_data, fdlist[i].fd); + } + } + } + pthread_mutex_unlock (&lock); + return any; +} +#else static int do_select (void) { @@ -162,6 +224,7 @@ do_select (void) pthread_mutex_unlock (&lock); return any; } +#endif static int my_wait (void) diff --git a/tests/gpg/t-edit-sign.c b/tests/gpg/t-edit-sign.c index 2f98362..e0494c5 100644 --- a/tests/gpg/t-edit-sign.c +++ b/tests/gpg/t-edit-sign.c @@ -107,31 +107,19 @@ interact_fnc (void *opaque, const char *status, const char *args, int fd) } -int -main (int argc, char **argv) +void +sign_key (const char *key_fpr, const char *signer_fpr) { gpgme_ctx_t ctx; gpgme_error_t err; gpgme_data_t out = NULL; - const char *signer_fpr = "A0FF4590BB6122EDEF6E3C542D727CC768697734"; /* Alpha Test */ gpgme_key_t signing_key = NULL; - const char *key_fpr = "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2"; /* Bravo Test */ gpgme_key_t key = NULL; - gpgme_key_t signed_key = NULL; - gpgme_user_id_t signed_uid = NULL; - gpgme_key_sig_t key_sig = NULL; char *agent_info; - int mode; - - (void)argc; - (void)argv; - - init_gpgme (GPGME_PROTOCOL_OpenPGP); err = gpgme_new (&ctx); fail_if_err (err); - /* Sign the key */ agent_info = getenv("GPG_AGENT_INFO"); if (!(agent_info && strchr (agent_info, ':'))) gpgme_set_passphrase_cb (ctx, passphrase_cb, 0); @@ -159,8 +147,23 @@ main (int argc, char **argv) gpgme_data_release (out); gpgme_key_unref (key); gpgme_key_unref (signing_key); + gpgme_release (ctx); +} + + +void +verify_key_signature (const char *key_fpr, const char *signer_keyid) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_key_t signed_key = NULL; + gpgme_user_id_t signed_uid = NULL; + gpgme_key_sig_t key_sig = NULL; + int mode; + + err = gpgme_new (&ctx); + fail_if_err (err); - /* Verify the key signature */ mode = gpgme_get_keylist_mode (ctx); mode |= GPGME_KEYLIST_MODE_SIGS; err = gpgme_set_keylist_mode (ctx, mode); @@ -168,7 +171,7 @@ main (int argc, char **argv) err = gpgme_get_key (ctx, key_fpr, &signed_key, 0); fail_if_err (err); - signed_uid = key->uids; + signed_uid = signed_key->uids; if (!signed_uid) { fprintf (stderr, "Signed key has no user IDs\n"); @@ -180,7 +183,7 @@ main (int argc, char **argv) exit (1); } key_sig = signed_uid->signatures->next; - if (strcmp ("2D727CC768697734", key_sig->keyid)) + if (strcmp (signer_keyid, key_sig->keyid)) { fprintf (stderr, "Unexpected key ID in second user ID sig: %s\n", key_sig->keyid); @@ -196,6 +199,23 @@ main (int argc, char **argv) gpgme_key_unref (signed_key); gpgme_release (ctx); +} + + +int +main (int argc, char **argv) +{ + const char *signer_fpr = "A0FF4590BB6122EDEF6E3C542D727CC768697734"; /* Alpha Test */ + const char *signer_keyid = signer_fpr + strlen(signer_fpr) - 16; + const char *key_fpr = "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2"; /* Bravo Test */ + + (void)argc; + (void)argv; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + sign_key (key_fpr, signer_fpr); + verify_key_signature (key_fpr, signer_keyid); return 0; } diff --git a/tests/gpg/t-eventloop.c b/tests/gpg/t-eventloop.c index b31764e..0106670 100644 --- a/tests/gpg/t-eventloop.c +++ b/tests/gpg/t-eventloop.c @@ -31,7 +31,17 @@ #include <assert.h> #include <errno.h> #include <sys/types.h> -#include <sys/select.h> +#ifdef HAVE_POLL_H +# include <poll.h> +#else +# ifdef HAVE_SYS_SELECT_H +# include <sys/select.h> +# else +# ifdef HAVE_SYS_TIME_H +# include <sys/time.h> +# endif +# endif +#endif #include <gpgme.h> @@ -104,6 +114,56 @@ io_event (void *data, gpgme_event_io_t type, void *type_data) } +#ifdef HAVE_POLL_H +int +do_select (void) +{ + struct pollfd poll_fds[FDLIST_MAX]; + nfds_t poll_nfds; + int i, n; + int any = 0; + + poll_nfds = 0; + for (i = 0; i < FDLIST_MAX; i++) + if (fdlist[i].fd != -1) + { + poll_fds[poll_nfds].fd = fdlist[i].fd; + poll_fds[poll_nfds].events = 0; + poll_fds[poll_nfds].revents = 0; + if (fdlist[i].dir) + poll_fds[poll_nfds].events |= POLLIN; + else + poll_fds[poll_nfds].events |= POLLOUT; + poll_nfds++; + } + + do + { + n = poll (poll_fds, poll_nfds, 1000); + } + while (n < 0 && (errno == EINTR || errno == EAGAIN)); + + if (n < 0) + return n; /* Error or timeout. */ + + poll_nfds = 0; + for (i = 0; i < FDLIST_MAX && n; i++) + { + if (fdlist[i].fd != -1) + { + if ((poll_fds[poll_nfds++].revents + & (fdlist[i].dir ? (POLLIN|POLLHUP) : POLLOUT))) + { + assert (n); + n--; + any = 1; + (*fdlist[i].fnc) (fdlist[i].fnc_data, fdlist[i].fd); + } + } + } + return any; +} +#else int do_select (void) { @@ -146,6 +206,7 @@ do_select (void) } return any; } +#endif int my_wait (void) diff --git a/tests/gpg/t-import.c b/tests/gpg/t-import.c index ae82263..1f7fdbc 100644 --- a/tests/gpg/t-import.c +++ b/tests/gpg/t-import.c @@ -149,16 +149,17 @@ check_result (gpgme_import_result_t result, const char *fpr, int secret) exit (1); } } - if (strcmp (fpr, result->imports->fpr)) + if (!result->imports->fpr || strcmp (fpr, result->imports->fpr)) { fprintf (stderr, "Unexpected fingerprint %s\n", - result->imports->fpr); + result->imports->fpr ? result->imports->fpr : "null"); exit (1); } - if (result->imports->next && strcmp (fpr, result->imports->next->fpr)) + if (result->imports->next + && (!result->imports->next->fpr || strcmp (fpr, result->imports->next->fpr))) { fprintf (stderr, "Unexpected fingerprint on second status %s\n", - result->imports->next->fpr); + result->imports->next->fpr ? result->imports->next->fpr : "null"); exit (1); } if (result->imports->result != 0) @@ -214,6 +215,7 @@ main (int argc, char *argv[]) gpgme_error_t err; gpgme_data_t in; gpgme_import_result_t result; + gpgme_key_t key; char *pubkey_1_asc = make_filename ("pubkey-1.asc"); char *seckey_1_asc = make_filename ("seckey-1.asc"); @@ -225,6 +227,9 @@ main (int argc, char *argv[]) err = gpgme_new (&ctx); fail_if_err (err); + err = gpgme_set_ctx_flag (ctx, "key-origin", "wkd,https://openpgpkey.gnupg.org"); + fail_if_err (err); + err = gpgme_data_new_from_file (&in, pubkey_1_asc, 1); free (pubkey_1_asc); fail_if_err (err); @@ -246,5 +251,24 @@ main (int argc, char *argv[]) gpgme_data_release (in); gpgme_release (ctx); + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_get_key (ctx, "0xADAB7FCC1F4DE2616ECFA402AF82244F9CD9FD55", &key, 0); + fail_if_err (err); + + if (!key) + { + fprintf (stderr, "Imported key not found\n"); + exit (1); + } + if (key->origin != GPGME_KEYORG_WKD) + { + fprintf (stderr, "Key has unexpected origin: %d\n", key->origin); + exit (1); + } + + return 0; } |