7 years agoHonor --cert-digest-algo when recreating a cert.
David Shaw [Wed, 1 Feb 2012 02:30:05 +0000 (21:30 -0500)]
Honor --cert-digest-algo when recreating a cert.

* g10/sign.c (update_keysig_packet): Honor --cert-digest-algo when
  recreating a cert.

This is used by various things in --edit-key like setpref, primary,
etc.  Suggested by Christian Aistleitner.

7 years agogl: Add support for Android to stdint.h replacement.
Werner Koch [Fri, 27 Jan 2012 16:29:57 +0000 (17:29 +0100)]
gl: Add support for Android to stdint.h replacement.

* gl/stdint_.h: When included from Bionic <sys/types.h>, just include
the system's <stdint.h>.

7 years agogpg-connect-tool: Take the string "true" as a true condition.
Werner Koch [Fri, 27 Jan 2012 14:40:24 +0000 (15:40 +0100)]
gpg-connect-tool: Take the string "true" as a true condition.

* tools/gpg-connect-agent.c (main): Handle strings "true" and "yes" in
conditions as expected.

7 years agoReturn GPG_ERR_CARD_NOT_PRESENT when pinentry-mode=loopback.
Ben Kibbey [Thu, 26 Jan 2012 00:16:33 +0000 (19:16 -0500)]
Return GPG_ERR_CARD_NOT_PRESENT when pinentry-mode=loopback.

Since there isn't a way to prompt the user to insert the smartcard when
pinentry-mode=loopback, return GPG_ERR_CARD_NOT_PRESENT instead of

* agent/divert-scd.c (ask_for_card): Return GPG_ERR_CARD_NOT_PRESENT
when pinentry-mode=loopback.

7 years agoAlso check for GPG_ERR_ASS_CANCELED during an inquire.
Ben Kibbey [Wed, 25 Jan 2012 23:14:51 +0000 (18:14 -0500)]
Also check for GPG_ERR_ASS_CANCELED during an inquire.

Fix pinentry-mode=loopback when cancelling an inquire from scdaemon.
This is similar to commit 4f21f8d but for both protocol command
cancellation and pinentry cancellation.

* agent/call-scd.c (agent_card_pkdecrypt): Check for
(agent_card_pksign): Ditto.

7 years agonPth is now a hard requirement for GnuPG.
Werner Koch [Wed, 25 Jan 2012 14:48:01 +0000 (15:48 +0100)]
nPth is now a hard requirement for GnuPG.

* Remove cruft to allow building without npth.

Previous versions of GnuPG allowed to build a subset of it without
support of Pth.  Meanwhile gpg-agent is a requirement even for gpg and
thus it does not make any sense to allow such a restricted build.

7 years agoRequire libassuan 2.1.0.
Werner Koch [Wed, 25 Jan 2012 14:01:19 +0000 (15:01 +0100)]
Require libassuan 2.1.0.

* (NEED_LIBASSUAN_VERSION): Set to 2.1.0.  This is due to
the npth changes.
Note that libassuan 2.1.0 has not yet been released.

7 years agoFix strerror vs. gpg_strerror usage.
Werner Koch [Wed, 25 Jan 2012 13:59:01 +0000 (14:59 +0100)]
Fix strerror vs. gpg_strerror usage.

This bug was introduced by the migration to npth.
* agent/gpg-agent.c (handle_connections): Use strerror.

7 years agoRe-indent overlong lines.
Werner Koch [Wed, 25 Jan 2012 13:44:34 +0000 (14:44 +0100)]
Re-indent overlong lines.


7 years agoAdd missing variable.
Werner Koch [Wed, 25 Jan 2012 11:11:41 +0000 (12:11 +0100)]
Add missing variable.

* agent/gpg-agent.c (handle_connections) [!W32]: Add missing variable.

7 years agoPort LDAP wrapper to NPTH.
Marcus Brinkmann [Tue, 24 Jan 2012 16:37:01 +0000 (17:37 +0100)]
Port LDAP wrapper to NPTH.

* agent/gpg-agent.c (handle_connections): Handle error.
* dirmngr/dirmngr_ldap.c, dirmngr/ldap-wrapper-ce.c: Port to NPTH.

7 years agoPort Windows code to NPTH.
Marcus Brinkmann [Thu, 19 Jan 2012 21:27:44 +0000 (22:27 +0100)]
Port Windows code to NPTH.

* agent/gpg-agent.c (get_agent_ssh_socket_name): Use
(handle_signal) [!HAVE_W32_SYSTEM]: Don't define.
(handle_connections): Port Windows code to NPTH.
* dirmngr/dirmngr.c (handle_connections): Port Windows code to NPTH.
* g13/g13.c (handle_connections): Port Windows code to NPTH.
* scd/scdaemon.c (handle_connections): Port Windows code to NPTH.

7 years agoPort to npth.
Marcus Brinkmann [Tue, 3 Jan 2012 21:12:37 +0000 (22:12 +0100)]
Port to npth.

* Don't check for PTH but for NPTH.
(have_pth): Rename to ...
(have_npth): ... this.
(USE_GNU_NPTH): Rename to ...
(USE_GNU_PTH): ... this.
* m4/npth.m4: New file.
* agent/, agent/cache.c, agent/call-pinentry.c,
agent/call-scd.c, agent/findkey.c, agent/gpg-agent.c,
agent/trustlist.c, common/, common/estream.c,
common/exechelp-posix.c, common/exechelp-w32.c,
common/exechelp-w32ce.c, common/http.c, common/init.c,
common/sysutils.c, dirmngr/, dirmngr/crlfetch.c,
dirmngr/dirmngr.c, dirmngr/dirmngr_ldap.c, dirmngr/ldap-wrapper-ce.c,
dirmngr/ldap-wrapper.c, dirmngr/ldap.c, g13/,
g13/call-gpg.c, g13/g13.c, g13/runner.c, scd/,
scd/apdu.c, scd/app.c, scd/ccid-driver.c, scd/command.c,
scd/scdaemon.c, tools/ Port to npth.

7 years agoRequire gitlog-to-changelog to be installed.
Werner Koch [Wed, 25 Jan 2012 11:11:41 +0000 (12:11 +0100)]
Require gitlog-to-changelog to be installed.

(gen-ChangeLog): Use installed version of gitlog-to-changelog.

In case an appropriate version of gitlog-to-changelog is not in the
PATH, it is possible to override it using something like:

  make distcheck GITLOG_TO_CHANGELOG=/foo/bar/my-gitlog-to-changelog

7 years agoExtend gitlog-to-changelog option --tear-off.
Werner Koch [Wed, 25 Jan 2012 10:58:54 +0000 (11:58 +0100)]
Extend gitlog-to-changelog option --tear-off.

It is now possible to suppress git log entries from being copied to
the ChangeLog by using the option --tear-off and having a "--" line
as the first line in the body (like this very log entry).

Note that the GnuPG master branch is the canonical source for our
version of the gitlog-to-changelog script.

7 years agoChanges to --min-cert-level should cause a trustdb rebuild (issue 1366)
David Shaw [Fri, 20 Jan 2012 03:33:51 +0000 (22:33 -0500)]
Changes to --min-cert-level should cause a trustdb rebuild (issue 1366)

* g10/gpgv.c, g10/trustdb.c (read_trust_options): Add min_cert_level

* g10/trustdb.c (check_trustdb_stale): Request a rebuild if
  pending_check_trustdb is true (set when we detect a trustdb
  parameter has changed).

* g10/keylist.c (public_key_list): Use 'l' in the "tru" with-colons
  listing for min_cert_level not matching.

* g10/tdbio.c (tdbio_update_version_record, create_version_record,
  tdbio_db_matches_options, tdbio_dump_record, tdbio_read_record,
  tdbio_write_record): Add a byte for min_cert_level in the tdbio
  version record.

7 years agoestream: Fix unclean usage of realloc.
Werner Koch [Fri, 20 Jan 2012 13:27:36 +0000 (14:27 +0100)]
estream: Fix unclean usage of realloc.

* common/estream-printf.c (_ESTREAM_PRINTF_MALLOC): Remove.
(fixed_realloc) [!_ESTREAM_PRINTF_REALLOC]): New.
(estream_vasprintf): Use my_printf_realloc instead of my_printf_malloc
and my_printf_free.
(dynamic_buffer_out): Use my_printf_realloc instead of realloc.

This bug will never happen in current GnuPG/Libgcrypt because we use
the standard memory allocation functions via Libgcrypt.  However, when
used in other environments it would mess up the heap for an asprintf
with an output length larger than ~512 bytes.

7 years agoDo not copy default merge commit log entries into the ChangeLog.
Werner Koch [Fri, 20 Jan 2012 10:08:06 +0000 (11:08 +0100)]
Do not copy default merge commit log entries into the ChangeLog.

* scripts/gitlog-to-changelog: Skip merge commits.

7 years agoAdd the INQUIRE_MAXLEN status message.
Ben Kibbey [Wed, 18 Jan 2012 00:49:10 +0000 (19:49 -0500)]
Add the INQUIRE_MAXLEN status message.

This status message is used to inform the client of the maximum length
of an inquired passphrase and is used in pinentry-mode=loopback.

* agent/command.c (pinentry_loopback): Send the INQUIRE_MAXLEN status
message before doing the inquire.

7 years agoyat2m: don't dereference pointer to freed memory
Jim Meyering [Sat, 14 Jan 2012 21:34:58 +0000 (22:34 +0100)]
yat2m: don't dereference pointer to freed memory

* doc/yat2m.c (top_parse_file): Correct macrolist-freeing loop.

7 years agogpg-agent: fix lc-messages handling not to change Xauthority setting
Jim Meyering [Sat, 14 Jan 2012 21:20:39 +0000 (22:20 +0100)]
gpg-agent: fix lc-messages handling not to change Xauthority setting

* agent/gpg-agent.c (main): Supply omitted "break" statement for
lc-messages option.  Otherwise, control would fall through to the
following oXauthority case and use the same value there.

7 years agoFix indentation.
Werner Koch [Sun, 15 Jan 2012 11:37:33 +0000 (12:37 +0100)]
Fix indentation.

7 years agoFix scdaemon pinentry inquire cancelation.
Ben Kibbey [Sat, 14 Jan 2012 14:57:31 +0000 (09:57 -0500)]
Fix scdaemon pinentry inquire cancelation.

Similar to commit 29af488 but also fixes PKDECRYPT and PKSIGN.

* agent/call-scd.c (agent_card_pkdecrypt): Check for GPG_ERR_CANCELED
when returning from the PKDECRYPT operation of scdaemon and cancel the
(agent_card_pksign): Ditto.
(cancel_inquire): New.

7 years agogpg: Fix segv with RSA_S keys.
Werner Koch [Wed, 11 Jan 2012 19:15:47 +0000 (20:15 +0100)]
gpg: Fix segv with RSA_S keys.

* g10/misc.c (pubkey_get_npkey, pubkey_get_nskey)
(pubkey_get_nsig, pubkey_get_nenc): Map all RSA algo ids to

The problem is that Libgcrypt has no more support for the alternate
RSA ids and thus if asking for the number of parameters, they will
return zero.  Now, this leads to packing the key parameters into an
opaque MPI but because the algorithm id is actually known to GPG, it
assumes valid RSA parameters.

An example key with RSA_S is 0x5434509D.

7 years agoestream: Avoid printing leading zeroes by %p on 32 bit systems.
Werner Koch [Wed, 11 Jan 2012 16:06:17 +0000 (17:06 +0100)]
estream: Avoid printing leading zeroes by %p on 32 bit systems.

* common/estream-printf.c (pr_pointer): Synchronize definition of
AULONG with its use.

7 years agoRefresh sample keys
David Shaw [Tue, 10 Jan 2012 15:32:03 +0000 (10:32 -0500)]
Refresh sample keys

7 years agoAdapt HKP fix for fingerprint/long keyid retrievals for dirmngr
David Shaw [Tue, 10 Jan 2012 15:23:54 +0000 (10:23 -0500)]
Adapt HKP fix for fingerprint/long keyid retrievals for dirmngr

* dirmngr/ks-engine-hkp.c (ks_hkp_get): Use the longest valid keyid form

7 years agogpg: Make the double space in the middle of a fingerprint optional.
Werner Koch [Fri, 6 Jan 2012 14:17:49 +0000 (15:17 +0100)]
gpg: Make the double space in the middle of a fingerprint optional.

This change might help to c+p a fingerprint from an HTML page without
being enclosed in a "pre" tag.
* common/userids.c (classify_user_id): Skip a second blank in the
middle of a fingerprint.

7 years agogpg: Allow use of a standard space separated fingerprint.
Werner Koch [Fri, 6 Jan 2012 12:33:10 +0000 (13:33 +0100)]
gpg: Allow use of a standard space separated fingerprint.

* common/userids.c (classify_user_id): Check for space separated GPG

7 years agoMerge ccid_driver_improvement branch.
NIIBE Yutaka [Fri, 6 Jan 2012 04:50:21 +0000 (13:50 +0900)]
Merge ccid_driver_improvement branch.

* scd/apdu.c (ccid_keypad_operation): Rename from ccid_keypad_verify.
(open_ccid_reader): Use ccid_keypad_operation for verify and modify.

* scd/ccid-driver.c (VENDOR_VASCO, VASCO_920): New.
(ccid_transceive_apdu_level): Permit sending packet where
apdulen <= 289.  Support receiving packets in a chain.
(ccid_transceive_secure): Maximum is 15 for VASCO DIGIPASS 920.
Support keypad_modify method such as CHANGE_REFERENCE_DATA: 0x24.

7 years agoSilence gcc warning.
Marcus Brinkmann [Tue, 3 Jan 2012 16:38:24 +0000 (17:38 +0100)]
Silence gcc warning.

* sm/call-dirmngr.c (get_cached_cert): Make sure buflen is initialized.

7 years agoRevert last change, add comment about link() return values.
Marcus Brinkmann [Tue, 3 Jan 2012 16:32:41 +0000 (17:32 +0100)]
Revert last change, add comment about link() return values.

* common/dotlock.c (use_hardlinks_p, dotlock_take_unix): Do not check
return value of link().

7 years agoFix compiler warnings.
Marcus Brinkmann [Tue, 3 Jan 2012 16:08:01 +0000 (17:08 +0100)]
Fix compiler warnings.

* common/dotlock.c (use_hardlinks_p, dotlock_take_unix): Check return
value of link().
* g13/g13.c: Make sure err is initialized.
* scd/scdaemon.c (main) [!USE_GCRY_THREAD_CBS]: Do not define ERR.

7 years agoFix last change: Only set gcrypt thread callback for older versions.
Marcus Brinkmann [Tue, 3 Jan 2012 15:50:52 +0000 (16:50 +0100)]
Fix last change: Only set gcrypt thread callback for older versions.

* dirmngr/dirmngr.c, g13/g13.c: Rename FIX_GCRY_PTH_INIT to

7 years agoTerminate csh commands with a semicolon also for dirmngr.
Werner Koch [Tue, 3 Jan 2012 10:14:14 +0000 (11:14 +0100)]
Terminate csh commands with a semicolon also for dirmngr.

* dirmngr/dirmngr.c (main): Terminate csh style output with a semicolon.

7 years agoTerminate csh commands with a semicolon.
Werner Koch [Tue, 3 Jan 2012 10:13:30 +0000 (11:13 +0100)]
Terminate csh commands with a semicolon.

Fixes bug#1386.

* agent/gpg-agent.c (main): Terminate csh style output with a semicolon.
* scd/scdaemon.c: Ditto.

7 years agoOnly set gcrypt thread callback for older version of gcrypt.
Marcus Brinkmann [Mon, 2 Jan 2012 21:15:00 +0000 (22:15 +0100)]
Only set gcrypt thread callback for older version of gcrypt.

* agent/gpg-agent.c, dirmngr/dirmngr.c, g13/g13.c, scd/scdaemon.c
(USE_GCRY_THREAD_CBS): New macro, defined if
(fixed_gcry_pth_init) [!USE_GCRY_THREAD_CBS]: Don't define.
(main) [!USE_GCRY_THREAD_CBS]: Do not install thread callbacks.

7 years agoUse the longest key ID available when talking to a HKP server.
David Shaw [Wed, 28 Dec 2011 21:41:31 +0000 (16:41 -0500)]
Use the longest key ID available when talking to a HKP server.

This is issue 1340.  Now that PKSD is dead, and SKS supports long key
IDs, this is safe to do.  Patch from Daniel Kahn Gillmor

7 years agoPost-release version number update
Werner Koch [Tue, 20 Dec 2011 16:10:28 +0000 (17:10 +0100)]
Post-release version number update

7 years agoRelease 2.1.0beta3. gnupg-2.1.0beta3
Werner Koch [Tue, 20 Dec 2011 15:46:18 +0000 (16:46 +0100)]
Release 2.1.0beta3.

7 years agoPrepare for the beta3 release.
Werner Koch [Tue, 20 Dec 2011 14:55:43 +0000 (15:55 +0100)]
Prepare for the beta3 release.

7 years agopo: Update the German translation.
Werner Koch [Tue, 20 Dec 2011 14:54:43 +0000 (15:54 +0100)]
po: Update the German translation.

7 years agoAdd the STEED Self-Signing Nonthority certificate.
Werner Koch [Tue, 20 Dec 2011 14:35:42 +0000 (15:35 +0100)]
Add the STEED Self-Signing Nonthority certificate.

* doc/com-certs.pem: Install it when creating a keybox.

7 years agofaq: Add section on US export restrictions.
Werner Koch [Tue, 20 Dec 2011 10:13:40 +0000 (11:13 +0100)]
faq: Add section on US export restrictions.

7 years agoRequire Libassuan 2.0.3
Werner Koch [Tue, 20 Dec 2011 10:12:21 +0000 (11:12 +0100)]
Require Libassuan 2.0.3

* Require Libassuan 2.0.3.
* agent/call-scd.c (ASSUAN_CONVEY_COMMENTS): Remove macro replacement.
* agent/command.c (cmd_killagent) [ASSUAN_FORCE_CLOSE]: Remove
(cmd_killagent) [ASSUAN_FORCE_CLOSE]: Ditto.
* scd/command.c (cmd_killscd) [ASSUAN_FORCE_CLOSE]: Ditto.

7 years agoAdd error log and debug log for pcsc_keypad_verify and pcsc_keypad_modify.
NIIBE Yutaka [Tue, 20 Dec 2011 04:34:27 +0000 (13:34 +0900)]
Add error log and debug log for pcsc_keypad_verify and pcsc_keypad_modify.

* scd/apdu.c (pcsc_keypad_verify): Add debug log and error log.
(pcsc_keypad_modify): Likewise.

7 years agoscd: Fix for card change returning GPG_ERR_CARD_RESET.
Werner Koch [Mon, 19 Dec 2011 17:26:47 +0000 (18:26 +0100)]
scd: Fix for card change returning GPG_ERR_CARD_RESET.

* scd/apdu.c (apdu_connect): Do not test for zero atrlen.
When gpg-agent prompts for insertion of a card this error would be

Co-authored-by: Ben Kibbey <>
7 years agoDon't kill pinentry by SIGKILL but let it quit by SIGINT.
NIIBE Yutaka [Fri, 16 Dec 2011 00:07:56 +0000 (09:07 +0900)]
Don't kill pinentry by SIGKILL but let it quit by SIGINT.

* agent/call-pinentry.c (agent_popup_message_stop): To pinentry, send

7 years agoMerge fix for issue 1331 from 1.4.
David Shaw [Thu, 15 Dec 2011 21:46:28 +0000 (16:46 -0500)]
Merge fix for issue 1331 from 1.4.

* photoid.c (generate_photo_id): Check for the JPEG magic numbers
instead of JFIF since some programs generate an EXIF header first.

7 years agoscd: Prefer application Geldkarte over DINSIG.
Werner Koch [Thu, 15 Dec 2011 20:45:35 +0000 (21:45 +0100)]
scd: Prefer application Geldkarte over DINSIG.

* scd/app.c (select_application): Reorder application tests.

Although the DINSIG application is available on most German cards, it
is in reality not used.  Thus showing the Geldkarte application is
more desirable for a good user experience.

7 years agoscd: Add option --dump-atr to command APDU.
Werner Koch [Thu, 15 Dec 2011 13:47:04 +0000 (14:47 +0100)]
scd: Add option --dump-atr to command APDU.

* scd/atr.c: Rewrite.
* scd/ (scdaemon_SOURCES): Add atr.c and atr.h.
* scd/command.c (cmd_apdu): Add option --dump-atr.

7 years agoestream: New function es_fclose_snatch.
Werner Koch [Thu, 15 Dec 2011 13:45:08 +0000 (14:45 +0100)]
estream: New function es_fclose_snatch.

* common/estream.c (cookie_ioctl_function_t): New type.
(es_fclose_snatch): New function.
(struct estream_internal): Add field FUNC_IOCTL.
(es_initialize): Clear FUNC_IOCTL.
(es_func_mem_ioctl): New function.
(es_fopenmem, es_fopenmem_init): Init FUNC_IOCTL.

7 years agoscd: Skip S/N reading for the "undefined" application.
Werner Koch [Wed, 14 Dec 2011 17:56:10 +0000 (18:56 +0100)]
scd: Skip S/N reading for the "undefined" application.

* scd/app.c (select_application): Skip serial number reading.

7 years agoscd: Add more status word values for documentation.
Werner Koch [Wed, 14 Dec 2011 17:48:47 +0000 (18:48 +0100)]
scd: Add more status word values for documentation.

7 years agoscd: Add the "undefined" stub application.
Werner Koch [Wed, 14 Dec 2011 16:00:50 +0000 (17:00 +0100)]
scd: Add the "undefined" stub application.

* scd/app.c (select_application): Implement the "undefined"

7 years agoagent: Pass comment lines from scd verbatim thru gpg-agent.
Werner Koch [Wed, 14 Dec 2011 14:42:28 +0000 (15:42 +0100)]
agent: Pass comment lines from scd verbatim thru gpg-agent.

* agent/call-scd.c (pass_status_thru): Pass comment lines verbatim.
* tools/gpg-connect-agent.c (help_cmd_p): New.
(main): Treat an "SCD HELP" the same as "HELP".

7 years agoscd: Fix resetting and closing of the reader.
Werner Koch [Wed, 14 Dec 2011 09:30:01 +0000 (10:30 +0100)]
scd: Fix resetting and closing of the reader.

* scd/command.c (update_card_removed): Do no act on an invalid VRDR.
(do_reset): Ignore apdu_reset error codes for no and inactive card.
Close the reader before setting the slot to -1.
(update_reader_status_file): Notify the application before closing the

With this change the scd now works as it did in the past.  In
particular there is no more endless loop trying to open the reader by
the update_reader_status_file ticker function.  That bug basically
blocked all card operations until the scdaemon was killed.

7 years agoscd: Add debug option for reader function calls.
Werner Koch [Wed, 14 Dec 2011 09:21:15 +0000 (10:21 +0100)]
scd: Add debug option for reader function calls.

* scd/scdaemon.h (DBG_READER_VALUE, DBG_READER): New.
* scd/apdu.c (apdu_open_reader, apdu_close_reader)
(apdu_shutdown_reader, apdu_connect, apdu_disconnect)
(apdu_reset, apdu_get_atr, apdu_get_status): Add debug code.
(apdu_activate): Remove this unused function.

7 years agoscd: New option --debug-assuan-log-cats.
Werner Koch [Tue, 13 Dec 2011 16:59:00 +0000 (17:59 +0100)]
scd: New option --debug-assuan-log-cats.

* scd/scdaemon.c (oDebugAssuanLogCats): New.
(opts): Add option --debug-assuan-log-cats.
(main): Implement option.
* common/asshelp.c (set_libassuan_log_cats): New.


The old way of setting the logging categories with an environment
variable is awkward if sdaemon is spawned from a running gpg-agent.

7 years agoscd: Introduce a virtual reader table.
Werner Koch [Tue, 13 Dec 2011 15:55:42 +0000 (16:55 +0100)]
scd: Introduce a virtual reader table.

The vreader table makes the code more clear by explicitly talking
about APDU slots and reader indices.  It also accommodates for future

* scd/scdaemon.h (server_control_s): Remove READER_SLOT.
* scd/scdaemon.c (scd_init_default_ctrl): Do not init READER_SLOT.
* scd/app.c (check_application_conflict): Add arg SLOT.
* scd/command.c (slot_status_s): Rename to vreader_s.
(server_local_s): Add field VREADER_IDX as replacement for
the READER_SLOT in server_control_s.  Change all users.
(slot_table): Rename to vreader_table.  Change all users.
(vreader_slot): New.
(do_reset, cmd_apdu): Map vreader to apdu slot.
(get_reader_slot): Rename to get_current_reader.  Return -1 on error.
(open_card): Map vreader toapdu slot.  Pass slot to
(scd_command_handler): Init VREADER_IDX.
(update_reader_status_file): Reset SLOT field on error.

7 years agoscd: Retry command SERIALNO for an inactive card.
Werner Koch [Mon, 12 Dec 2011 20:02:54 +0000 (21:02 +0100)]
scd: Retry command SERIALNO for an inactive card.

* scd/command.c (cmd_serialno): Retry once for an inactive card.

7 years agoFix detection of card removal and insertion.
Werner Koch [Mon, 12 Dec 2011 19:34:12 +0000 (20:34 +0100)]
Fix detection of card removal and insertion.

* scd/apdu.c (apdu_connect): Return status codes for no card available
and inactive card.
* scd/command.c (TEST_CARD_REMOVAL): Also test for GPG_ERR_CARD_RESET.
(open_card): Map apdu_connect status to GPG_ERR_CARD_RESET.

7 years agogitlog-to-changelog: New option --tear-off.
Werner Koch [Mon, 12 Dec 2011 19:28:58 +0000 (20:28 +0100)]
gitlog-to-changelog: New option --tear-off.

* scripts/gitlog-to-changelog: Add option --tear-off.
* (gen-ChangeLog): Use that option.

7 years agogpgsm: Add new validation model "steed".
Werner Koch [Wed, 7 Dec 2011 15:15:15 +0000 (16:15 +0100)]
gpgsm: Add new validation model "steed".

* sm/gpgsm.h (VALIDATE_FLAG_STEED): New.
* sm/gpgsm.c (gpgsm_parse_validation_model): Add model "steed".
* sm/server.c (option_handler): Allow validation model "steed".
* sm/certlist.c (gpgsm_cert_has_well_known_private_key): New.
* sm/certchain.c (do_validate_chain): Handle the
well-known-private-key attribute.  Support the "steed" model.
(gpgsm_validate_chain): Ditto.
* sm/verify.c (gpgsm_verify): Return "steed" in the trust status line.
* sm/keylist.c (list_cert_colon): Print the new 'w' flag.

This is the first part of changes to implement the STEED proposal as
described at .  The idea for X.509 is
not to use plain self-signed certificates but certificates signed by a
dummy CA (i.e. one for which the private key is known).  Having a
single CA as an indication for the use of STEED might help other X.509
implementations to implement STEED.

7 years agoCorrect punctuation in the ChangeLog summary line.
Werner Koch [Wed, 7 Dec 2011 10:07:21 +0000 (11:07 +0100)]
Correct punctuation in the ChangeLog summary line.

* (gen-ChangeLog): Supply --append-dot.

7 years agoAllow comments which will not show up in the ChangeLog
Werner Koch [Wed, 7 Dec 2011 10:01:39 +0000 (11:01 +0100)]
Allow comments which will not show up in the ChangeLog

* scripts/gitlog-to-changelog: Ignore lines after a "--" line.

The first line with two dashes at the start of a line (optionally
followed by white space) stops copying the commit log lines to the
ChangeLog entry in "make dist".  This is useful to allow adding
comments to the log which are not useful in a ChangeLog.

7 years agogpgsm: Allow specification of an AuthorityKeyIdentifier.
Werner Koch [Tue, 6 Dec 2011 20:43:18 +0000 (21:43 +0100)]
gpgsm: Allow specification of an AuthorityKeyIdentifier.

* sm/certreqgen.c (pAUTHKEYID): New.
(read_parameters): Add keyword Authority-Key-Id.
(proc_parameters): Check its value.
(create_request): Insert an Authority-Key-Id.

7 years agogpgsm: Allow arbitrary extensions for cert creation.
Werner Koch [Tue, 6 Dec 2011 18:57:27 +0000 (19:57 +0100)]
gpgsm: Allow arbitrary extensions for cert creation.

* sm/certreqgen.c (pSUBJKEYID, pEXTENSION): New.
(read_parameters): Add new keywords.
(proc_parameters): Check values of new keywords.
(create_request): Add SubjectKeyId and extensions.
(parse_parameter_usage): Support "cert" and the encrypt alias "encr".

7 years agogpgsm: Fix storing of the serial number
Werner Koch [Tue, 6 Dec 2011 15:45:46 +0000 (16:45 +0100)]
gpgsm: Fix storing of the serial number

* sm/certreqgen.c (create_request): Fix hex-bin conversion.

7 years agoFix last change.
Werner Koch [Mon, 5 Dec 2011 14:14:47 +0000 (15:14 +0100)]
Fix last change.

* agent/command.c (start_command_handler): Remove use of removed var.

7 years agoAmend the agent code with more comments.
Werner Koch [Mon, 5 Dec 2011 09:54:59 +0000 (10:54 +0100)]
Amend the agent code with more comments.

* agent/command.c (server_local_s): Remove unused field MESSAGE_FD.

7 years agoSupport the Cherry ST-2000 card reader.
Werner Koch [Fri, 2 Dec 2011 17:09:58 +0000 (18:09 +0100)]
Support the Cherry ST-2000 card reader.

* scd/ccid-driver.c (SCM_SCR331, SCM_SCR331DI, SCM_SCR335)
(SCM_SCR3320, SCM_SPR532, CHERRY_ST2000): New constants.
(parse_ccid_descriptor): Use them.
(scan_or_find_usb_device, ccid_transceive_secure): Handle Cherry
ST-2000.  Suggested by Matthias-Christian Ott.

7 years agoAvoid possible double free in export.c.
Werner Koch [Fri, 2 Dec 2011 16:04:58 +0000 (17:04 +0100)]
Avoid possible double free in export.c.

* g10/export.c (transfer_format_to_openpgp): Avoid possible double
  free of LIST.  Reported by NIIBE Yutaka.

7 years agoFix pinpad input support for passphrase modification.
NIIBE Yutaka [Fri, 2 Dec 2011 04:57:12 +0000 (13:57 +0900)]
Fix pinpad input support for passphrase modification.

* apdu.c (pcsc_keypad_verify): Have dummy Lc field with value 0.
(pcsc_keypad_modify): Likewise.
(pcsc_keypad_modify): It's only for ISO7816_CHANGE_REFERENCE_DATA.
bConfirmPIN value is determined by the parameter p0.

* app-openpgp.c (do_change_pin): The flag use_keypad should be 0 when
reset_mode is on, or resetcode is on.  use_keypad only makes sense for

* iso7816.h (iso7816_put_data_kp): Remove.
(iso7816_reset_retry_counter_kp): Remove.
(iso7816_reset_retry_counter_with_rc_kp): Remove.
(iso7816_change_reference_data_kp): Add an argument: IS_EXCHANGE.

* iso7816.c (iso7816_put_data_kp): Remove.
(iso7816_reset_retry_counter_kp): Remove.
(iso7816_reset_retry_counter_with_rc_kp): Remove.
(iso7816_change_reference_data_kp): Add an argument: IS_EXCHANGE.

7 years agoAdd hook to check the commit log syntax.
Werner Koch [Thu, 1 Dec 2011 17:13:44 +0000 (18:13 +0100)]
Add hook to check the commit log syntax.

* Install commit-msg hook for git.

7 years agoGenerate the ChangeLog from commit logs.
Werner Koch [Thu, 1 Dec 2011 09:51:36 +0000 (10:51 +0100)]
Generate the ChangeLog from commit logs.

* scripts/gitlog-to-changelog: New script.  Taken from gnulib.
* scripts/git-log-fix: New file.
* scripts/git-log-footer: New file.
* doc/HACKING: Describe the ChangeLog policy
* ChangeLog: New file.
* (EXTRA_DIST): Add new files.
(gen-ChangeLog): New.
(dist-hook): Run gen-ChangeLog.

Rename all ChangeLog files to ChangeLog-2011.

7 years agoFix pinpad input support
NIIBE Yutaka [Thu, 1 Dec 2011 02:09:51 +0000 (11:09 +0900)]
Fix pinpad input support

7 years agoRewrite dns-cert.c to not use the gpg-only iobuf stuff.
Werner Koch [Wed, 30 Nov 2011 16:14:08 +0000 (17:14 +0100)]
Rewrite dns-cert.c to not use the gpg-only iobuf stuff.

* common/dns-cert.c: Remove iobuf.h.
(get_dns_cert): Rename to _get_dns_cert.  Remove MAX_SIZE arg.  Change
iobuf arg to a estream-t.  Rewrite function to make use of estream
instead of iobuf.  Require all parameters.  Return an gpg_error_t
error instead of the type.  Add arg ERRSOURCE.
* common/dns-cert.h (get_dns_cert): New macro to pass the error source
to _gpg_dns_cert.
* common/t-dns-cert.c (main): Adjust for changes in get_dns_cert.
* g10/keyserver.c (keyserver_import_cert): Ditto.
* doc/gpg.texi (GPG Configuration Options): Remove max-cert-size.

7 years ago* common/estream.c (es_fopenmem_init): New.
Werner Koch [Wed, 30 Nov 2011 16:03:53 +0000 (17:03 +0100)]
* common/estream.c (es_fopenmem_init): New.
* common/estream.h (es_fopenmem_init): New.

7 years agoAdd parameter checks and extend documentation of estream.
Werner Koch [Tue, 29 Nov 2011 17:02:05 +0000 (18:02 +0100)]
Add parameter checks and extend documentation of estream.

* estream.c (func_mem_create): Don't set FUNC_REALLOC if GROW is not
set.  Require FUNC_REALLOC if DATA is NULL and FUNC_FREE is given.

7 years agodns-cert.c: Use constants for better readability.
Werner Koch [Tue, 29 Nov 2011 12:17:20 +0000 (13:17 +0100)]
dns-cert.c: Use constants for better readability.

7 years agoActually increase buffer size of t-dns-cert.c.
Werner Koch [Mon, 28 Nov 2011 17:36:21 +0000 (18:36 +0100)]
Actually increase buffer size of t-dns-cert.c.

7 years agoRe-indented dns-cert.c
Werner Koch [Mon, 28 Nov 2011 17:35:19 +0000 (18:35 +0100)]
Re-indented dns-cert.c

7 years agoIncrease the default buffer size for DNS certificates.
Werner Koch [Mon, 28 Nov 2011 17:18:12 +0000 (18:18 +0100)]
Increase the default buffer size for DNS certificates.

* common/t-dns-cert.c (main): Increase MAX_SIZE to 64k.
* g10/keyserver.c (DEFAULT_MAX_CERT_SIZE): Increase from 16k to 64k.

7 years agoUse separate test module for dns-cert.c.
Werner Koch [Mon, 28 Nov 2011 17:11:59 +0000 (18:11 +0100)]
Use separate test module for dns-cert.c.

* dns-cert.c (get_dns_cert): Factor test code out to ...
* t-dns-cert.c: new file.

7 years agoMerge branch 'master' of git+ssh://
NIIBE Yutaka [Tue, 29 Nov 2011 08:59:56 +0000 (17:59 +0900)]
Merge branch 'master' of git+ssh://

7 years agoPC/SC pinpad support (pinpad input for modify pass phrase with resetcode, by admin).
NIIBE Yutaka [Tue, 29 Nov 2011 08:56:22 +0000 (17:56 +0900)]
PC/SC pinpad support (pinpad input for modify pass phrase with resetcode, by admin).

7 years agoMake sure HOME et al have no unsafe characters.
Werner Koch [Tue, 29 Nov 2011 07:52:12 +0000 (08:52 +0100)]
Make sure HOME et al have no unsafe characters.

7 years agoPC/SC pinpad support (pinpad input for modify pass phrase).
NIIBE Yutaka [Tue, 29 Nov 2011 02:59:32 +0000 (11:59 +0900)]
PC/SC pinpad support (pinpad input for modify pass phrase).

7 years agoAdd build script to build all components in one run.
Werner Koch [Mon, 28 Nov 2011 19:28:10 +0000 (20:28 +0100)]
Add build script to build all components in one run.

Run this script in the parent directory of the working copies.  It
does a VPATH build in ~/tmp/gpg-tmp/b in the right order and installs
everything below ~/tmp/gpg-tmp/.

Based on a script by Jim Meyering.

7 years agoaccept --with-libgpg-error-prefix as well as --with-gpg-error-prefix
Jim Meyering [Mon, 28 Nov 2011 12:47:08 +0000 (13:47 +0100)]
accept --with-libgpg-error-prefix as well as --with-gpg-error-prefix

* m4/gpg-error.m4: Update from git master.

7 years agoImprove ssh card key diagnostic message.
Werner Koch [Mon, 28 Nov 2011 09:39:36 +0000 (10:39 +0100)]
Improve ssh card key diagnostic message.

* command-ssh.c (card_key_available): Change wording of no key
(ssh_handler_request_identities): Do not call card_key_available
if the scdaemon is disabled.

7 years agoPC/SC pinpad support.
NIIBE Yutaka [Mon, 28 Nov 2011 07:16:38 +0000 (16:16 +0900)]
PC/SC pinpad support.

Before this change, it is layered like following:

apdu_send_simple, apdu_send_simple_kp

After this change, it will be layered like:

iso7816_verify      iso7816_verify_kp
        apdu_send_simple    apdu_keypad_verify

and apdu_send_simple_kp will be deprecated.

For PC/SC API, we use:
  SCardControl API to compose CCID PC_to_RDR_Secure message
  SCardTransmit API to compose CCID PC_to_RDR_XfrBlock message

Considering the support of PC/SC, we have nothing to share between _kp
version of iso7816_* and no _kp version.

7 years agoMerge branch 'master' of git+ssh://
Werner Koch [Thu, 24 Nov 2011 15:16:43 +0000 (16:16 +0100)]
Merge branch 'master' of git+ssh://

7 years agoMake HKP keyserver engine work again.
Werner Koch [Thu, 24 Nov 2011 14:48:24 +0000 (15:48 +0100)]
Make HKP keyserver engine work again.

We had some debug code here which prevented it from working.
The host selection code still needs a review!

* ks-engine-http.c (ks_http_help): Do not print help for hkp.
* ks-engine-hkp.c (ks_hkp_help): Print help only for hkp.
(send_request): Remove test code.
(map_host): Use xtrymalloc.

* certcache.c (classify_pattern): Remove unused variable and make
explicit substring search work.

7 years agoMake HKP kyeserver engine work again.
Werner Koch [Thu, 24 Nov 2011 14:48:24 +0000 (15:48 +0100)]
Make HKP kyeserver engine work again.

We had some debug code here which prevented it from working.
The host selection code still needs a review!

* ks-engine-http.c (ks_http_help): Do not print help for hkp.
* ks-engine-hkp.c (ks_hkp_help): Print help only for hkp.
(send_request): Remove test code.
(map_host): Use xtrymalloc.

* certcache.c (classify_pattern): Remove unused variable and make
explicit substring search work.

7 years agoUpdated the German translation.
Werner Koch [Thu, 24 Nov 2011 13:16:22 +0000 (14:16 +0100)]
Updated the German translation.

* po/de.po: Update.

7 years agoDon't print anonymous recipient messages in quiet mode.
Werner Koch [Tue, 22 Nov 2011 14:30:26 +0000 (15:30 +0100)]
Don't print anonymous recipient messages in quiet mode.

This is bug#1378.

7 years agoAllow creating subkeys using an existing key
Werner Koch [Sun, 6 Nov 2011 16:01:31 +0000 (17:01 +0100)]
Allow creating subkeys using an existing key

This works by specifying the keygrip instead of an algorithm (section
number 13) and requires that the option -expert has been used.  It
will be easy to extend this to the primary key.

7 years agotypo fixes
Werner Koch [Wed, 2 Nov 2011 17:29:47 +0000 (18:29 +0100)]
typo fixes