1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-05-31 22:18:03 +02:00
Commit Graph

4020 Commits

Author SHA1 Message Date
Ben Kibbey
74fe0b79a1 Let the RESTART command reset any scdaemon pin prompts.
The gpg-agent sends the RESTART command to scdaemon when the client has
disconnected. This commit allows future connections to scdaemon use the
default pinentry prompts.

It is recommended to use the scdaemon LOCK command to prevent other
scdaemon clients from altering the prompts before the current client has
finished with the scdaemon pinentry since the set prompts are global to
the application.

* scd/command.c (cmd_restart): Free any allocated custom pinentry prompt
strings to let the application use its default.
2012-01-24 20:39:06 -05:00
Ben Kibbey
7a61398e67 Return successfully when the app has no SCD pin prompt callback.
* scd/app.c (app_set_pin_prompt): Create a log message when the app
contains no pinentry prompt callback and return 0.
2012-01-24 20:39:03 -05:00
Ben Kibbey
add0e34bab Fix setting the wrong SCD pin prompt in the app.
* scd/command.c (set_pinentry_prompt): Fix typo.
2012-01-23 21:28:52 -05:00
Ben Kibbey
b5aa197a5f Set both the app and default SCD pin prompt at the same time.
Fixes the case when scdaemon prompts for card insertion.

* scd/app-openpgp.c (do_set_pin_prompt): Fix indentation. No longer
unset the prompt with '-' since the OPTION command without a value
does this anyway.
* scd/app.c (expand_pin_prompt): Fix indentation.
* scd/command.c (set_pinentry_prompt): Set both the default and
application prompt when available.
2012-01-23 20:40:56 -05:00
Ben Kibbey
633ea8531e Add user defined pinentry prompts for SCD.
This adds scdaemon "OPTION pin-prompt" and "OPTION pin-admin-prompt"
along with special escapes to replace in the prompt string to inform the
user of a signature count and admin PIN attempts remaining.

It also adds another "standard" pinentry escape "|I|" to ignore the
default pinentry prompt from gpg-agent and use the supplied 'info'
parameter unmodified (cannot be used with other pinentry flags).

* agent/divert-scd.c (getpin_cb): Add |I| pinentry flag to ignore the
default prompt and use the 'info' parameter as the entire prompt.
* scd/app-common.h (PIN_PROMPT_NONE, PIN_SIGN_PROMPT, PIN_ADMIN_PROMPT):
New enumeration.
(set_pin_prompt): New application callback to set a user-defined
pinentry prompt.
* scd/app-openpgp.c (verify_a_chv): Expand a user-defined pinentry
prompt.
(build_enter_admin_pin_prompt): Ditto.
(do_change_pin): Ditto.
(do_set_pin_prompt): New.
* scd/app.c (expand_pin_prompt): New.
(app_set_pin_prompt): Ditto.
* scd/command.c (set_pinentry_prompt): New.
(option_handler): Add option 'pin-prompt' and 'pin-admin-prompt'.
(open_card): Set the user-defined pinentry prompts after selecting an
application.
2012-01-12 19:40:10 -05:00
Werner Koch
30ec869b8c 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
GCRY_PK_RSA.
--

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.
2012-01-11 20:15:47 +01:00
Werner Koch
b42bc48dfb estream: Avoid printing leading zeroes by %p on 32 bit systems.
* common/estream-printf.c (pr_pointer): Synchronize definition of
AULONG with its use.
2012-01-11 17:06:17 +01:00
David Shaw
860861279b Refresh sample keys 2012-01-11 01:12:10 -05:00
David Shaw
3f59561cee Adapt HKP fix for fingerprint/long keyid retrievals for dirmngr
* dirmngr/ks-engine-hkp.c (ks_hkp_get): Use the longest valid keyid form
2012-01-10 10:23:54 -05:00
Werner Koch
957fe72846 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.
2012-01-06 15:17:49 +01:00
Werner Koch
372fb4fc06 gpg: Allow use of a standard space separated fingerprint.
* common/userids.c (classify_user_id): Check for space separated GPG
fingerprint.
2012-01-06 13:36:47 +01:00
NIIBE Yutaka
5988c8bfb7 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.
2012-01-06 13:50:21 +09:00
Marcus Brinkmann
ed432f030e Silence gcc warning.
* sm/call-dirmngr.c (get_cached_cert): Make sure buflen is initialized.
2012-01-03 17:38:24 +01:00
Marcus Brinkmann
ff2095ad7b 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().
2012-01-03 17:32:41 +01:00
Marcus Brinkmann
0dce26778e 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.
2012-01-03 17:08:01 +01:00
Marcus Brinkmann
61ccd8d92d Fix last change: Only set gcrypt thread callback for older versions.
* dirmngr/dirmngr.c, g13/g13.c: Rename FIX_GCRY_PTH_INIT to
USE_GCRY_THREAD_CBS.
2012-01-03 16:50:52 +01:00
Werner Koch
682df45d15 Terminate csh commands with a semicolon also for dirmngr.
* dirmngr/dirmngr.c (main): Terminate csh style output with a semicolon.
2012-01-03 11:14:14 +01:00
Werner Koch
d01d9ff11f 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.
2012-01-03 11:13:30 +01:00
Marcus Brinkmann
a2d9e48fcc 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
GCRY_THREAD_OPTION_VERSION is 0.
(fixed_gcry_pth_init) [!USE_GCRY_THREAD_CBS]: Don't define.
(main) [!USE_GCRY_THREAD_CBS]: Do not install thread callbacks.
2012-01-02 22:15:00 +01:00
David Shaw
c6aaf02465 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
<dkg@fifthhorseman.net>.
2011-12-28 16:53:36 -05:00
Werner Koch
97d1c884e6 Post-release version number update 2011-12-20 17:10:28 +01:00
Werner Koch
604c130a85 Release 2.1.0beta3. 2011-12-20 16:46:18 +01:00
Werner Koch
8e47f1e576 Prepare for the beta3 release. 2011-12-20 15:55:43 +01:00
Werner Koch
6f02c14344 po: Update the German translation. 2011-12-20 15:54:43 +01:00
Werner Koch
fe2f182699 Add the STEED Self-Signing Nonthority certificate.
* doc/com-certs.pem: Install it when creating a keybox.
2011-12-20 15:35:42 +01:00
Werner Koch
779611494d faq: Add section on US export restrictions. 2011-12-20 11:13:40 +01:00
Werner Koch
366512abe4 Require Libassuan 2.0.3
* configure.ac: Require Libassuan 2.0.3.
* agent/call-scd.c (ASSUAN_CONVEY_COMMENTS): Remove macro replacement.
* agent/command.c (cmd_killagent) [ASSUAN_FORCE_CLOSE]: Remove
dependency.
(cmd_killagent) [ASSUAN_FORCE_CLOSE]: Ditto.
* scd/command.c (cmd_killscd) [ASSUAN_FORCE_CLOSE]: Ditto.
2011-12-20 11:12:21 +01:00
NIIBE Yutaka
07f20f313a 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.
2011-12-20 13:34:27 +09:00
Werner Koch
f4b7f71463 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
returned.

Co-authored-by: Ben Kibbey <bjk@luxsci.net>
2011-12-19 18:26:47 +01:00
NIIBE Yutaka
f6251c0d0a Don't kill pinentry by SIGKILL but let it quit by SIGINT.
* agent/call-pinentry.c (agent_popup_message_stop): To pinentry, send
SIGINT (was: SIGKILL).
2011-12-16 09:09:41 +09:00
David Shaw
a98260c39f 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.
2011-12-15 17:00:40 -05:00
Werner Koch
27089564b6 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.
2011-12-15 21:45:35 +01:00
Werner Koch
b22d62bd14 scd: Add option --dump-atr to command APDU.
* scd/atr.c: Rewrite.
* scd/Makefile.am (scdaemon_SOURCES): Add atr.c and atr.h.
* scd/command.c (cmd_apdu): Add option --dump-atr.
2011-12-15 15:21:02 +01:00
Werner Koch
7737a2c269 estream: New function es_fclose_snatch.
* common/estream.c (cookie_ioctl_function_t): New type.
(es_fclose_snatch): New function.
(COOKIE_IOCTL_SNATCH_BUFFER): New constant.
(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.
2011-12-15 14:45:08 +01:00
Werner Koch
792e137ec7 scd: Skip S/N reading for the "undefined" application.
* scd/app.c (select_application): Skip serial number reading.
2011-12-14 18:56:10 +01:00
Werner Koch
0bac31ee9f scd: Add more status word values for documentation. 2011-12-14 18:48:47 +01:00
Werner Koch
dcd64131c6 scd: Add the "undefined" stub application.
* scd/app.c (select_application): Implement the "undefined"
application.
2011-12-14 17:00:50 +01:00
Werner Koch
45cf9de341 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".
2011-12-14 15:42:28 +01:00
Werner Koch
2d91febbd8 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
reader.
--

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.
2011-12-14 10:30:31 +01:00
Werner Koch
07ea8c56b5 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.
2011-12-14 10:21:15 +01:00
Werner Koch
00c760f628 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.
2011-12-13 17:59:00 +01:00
Werner Koch
24e121ef26 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
extensions.

* 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
check_application_conflict.
(scd_command_handler): Init VREADER_IDX.
(update_reader_status_file): Reset SLOT field on error.
2011-12-13 16:55:42 +01:00
Werner Koch
1116466278 scd: Retry command SERIALNO for an inactive card.
* scd/command.c (cmd_serialno): Retry once for an inactive card.
2011-12-12 21:02:54 +01:00
Werner Koch
cd29dc0f1c 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.
2011-12-12 20:34:12 +01:00
Werner Koch
ea0a21410b gitlog-to-changelog: New option --tear-off.
* scripts/gitlog-to-changelog: Add option --tear-off.
* Makefile.am (gen-ChangeLog): Use that option.
2011-12-12 20:28:58 +01:00
Werner Koch
8a12a2000d 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 http://g10code.com/steed.html .  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.
2011-12-07 16:15:15 +01:00
Werner Koch
14e4fdc9f9 Correct punctuation in the ChangeLog summary line.
* Makefile.am (gen-ChangeLog): Supply --append-dot.
2011-12-07 11:07:21 +01:00
Werner Koch
cd3732841d 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.
2011-12-07 11:02:13 +01:00
Werner Koch
596b84a4de 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.
2011-12-06 21:43:18 +01:00
Werner Koch
5cdad8ff00 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".
2011-12-06 19:57:27 +01:00