Commit Graph

209 Commits

Author SHA1 Message Date
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 81389383a3 Made the KILLAGENT and KILLSCD commands working again.
This requires that GnuPG is build with a newer version of Libassuan
(2.0.3).
2011-08-10 11:47:04 +02:00
Werner Koch 37228cfa05 Allow generation of card keys up to 4096 bit.
This patch implementes a chunk mode to pass the key parameters from
scdaemon to gpg.  This allows to pass arbitrary long key paremeters;
it is used for keys larger than 3072 bit.

Note: the card key generation in gpg is currently broken.  The keys
are generated but it is not possible to create the self-signature
because at that time the gpg-agent does not yet know about the new
keys and thus can't divert the sign request to the card.  We either
need to run the learn command right after calling agent_scd_genkey or
implement a way to sign using the currently inserted card.  Another
option would be to get rid of agent_scd_genkey and implement the
feature directly in agent_genkey.
2011-06-16 14:27:33 +02:00
Werner Koch b008274afd Nuked almost all trailing white space.
We better do this once and for all instead of cluttering all future
commits with diffs of trailing white spaces.  In the majority of cases
blank or single lines are affected and thus this change won't disturb
a git blame too much.  For future commits the pre-commit scripts
checks that this won't happen again.
2011-02-04 12:57:53 +01:00
Werner Koch 576de6e539 Fixed problem with unplugging card readers.
From Grant Olsons's mail to gnupg-devel@:

  This is three-quarters NIIBE and one-quarter me, but I though it would
  be easier to have a single complete patch that applies to
  STABLE-BRANCH-2-0 than two patches floating around.

  This is basically NIIBE Yatuka's patch here:

  http://lists.gnupg.org/pipermail/gnupg-devel/2010-November/025828.html

  Plus another check that closes down the reader explicitly if we get a
  SW_HOST_NO_READER error, so that an unplugged reader doesn't hold onto
  the first slot, preventing us from getting to the active plugged reader.
2011-01-25 22:03:16 +01:00
Werner Koch ca2d315765 Detect non operational readers.
Backport from 2.0.
2011-01-25 21:51:58 +01:00
Werner Koch 37870234a1 Use a custom log handler for libassuan. 2010-03-11 12:34:11 +00:00
Marcus Brinkmann 18bdcc0881 agent/
2009-11-25  Marcus Brinkmann  <marcus@g10code.de>

	* command.c (start_command_handler): Use assuan_fd_t and
	assuan_fdopen on fds.

scd/
2009-11-25  Marcus Brinkmann  <marcus@g10code.de>

	* command.c (scd_command_handler): Use assuan_fd_t and
	assuan_fdopen on fds.

sm/
2009-11-25  Marcus Brinkmann  <marcus@g10code.de>

	* server.c (gpgsm_server): Use assuan_fd_t and assuan_fdopen on
	fds.

g10/
2009-11-25  Marcus Brinkmann  <marcus@g10code.de>

	* server.c (gpg_server): Use assuan_fd_t and assuan_fdopen on fds.
2009-11-25 17:58:26 +00:00
Marcus Brinkmann 1d3c39fd7b agent/
2009-11-05  Marcus Brinkmann  <marcus@g10code.de>

	* call-pinentry.c (start_pinentry): Call assuan_pipe_connect, not
	assuan_pipe_connect_ext.
	* command.c (start_command_handler): Change
	assuan_init_socket_server_ext into assuan_init_socket_server.
	* call-scd.c (start_scd): Update use of assuan_socket_connect and
	assuan_pipe_connect.
	* gpg-agent.c (check_own_socket_thread, check_for_running_agent):
	Update use of assuan_socket_connect.

common/
2009-11-05  Marcus Brinkmann  <marcus@g10code.de>

	* asshelp.c (start_new_gpg_agent): Update use of
	assuan_socket_connect and assuan_pipe_connect.

scd/
2009-11-05  Marcus Brinkmann  <marcus@g10code.de>

	* command.c (scd_command_handler): Call assuan_init_socket_server,
	not assuan_init_socket_server_ext.

sm/
2009-11-05  Marcus Brinkmann  <marcus@g10code.de>

	* call-dirmngr.c (start_dirmngr_ext): Update use of
	assuan_pipe_connect and assuan_socket_connect.

tools/
2009-11-05  Marcus Brinkmann  <marcus@g10code.de>

	* gpg-connect-agent.c (start_agent): Update use of
	assuan_socket_connect and assuan_pipe_connect.
2009-11-05 12:06:45 +00:00
Werner Koch 0f4a5db22e Add help strings for all commands. 2009-11-04 12:22:09 +00:00
Werner Koch 8e8368b00e Adjust for assuan_register_command change. 2009-11-04 10:06:38 +00:00
Marcus Brinkmann 717c38381a agent/
2009-11-02  Marcus Brinkmann  <marcus@g10code.de>

	* command.c (reset_notify): Take LINE arg and return error.
	(register_commands): Use assuan_handler_t type.

common/
2009-11-02  Marcus Brinkmann  <marcus@g10code.de>

	* get-passphrase.c (default_inq_cb, membuf_data_cb): Change return
	type to gpg_error_t.

g10/
2009-11-02  Marcus Brinkmann  <marcus@g10code.de>

	* server.c (reset_notify, input_notify, output_notify): Update to
	new assuan interface.
	(register_commands): Use assuan_handler_t.

scd/
2009-11-02  Marcus Brinkmann  <marcus@g10code.de>

	* command.c (reset_notify): Take LINE arg and return error.
	(register_commands): Use assuan_handler_t type.

sm/
2009-11-02  Marcus Brinkmann  <marcus@g10code.de>

	* server.c (reset_notify, input_notify, output_notify): Update to
	new assuan interface.
	(register_commands): Use assuan_handler_t.
	* call-agent.c (membuf_data_cb, default_inq_cb)
	(inq_ciphertext_cb, scd_serialno_status_cb)
	(scd_keypairinfo_status_cb, istrusted_status_cb)
	(learn_status_cb, learn_cb, keyinfo_status_cb): Return gpg_error_t.
2009-11-02 17:47:11 +00:00
Werner Koch a1b6142855 [scd] Memory leak fix.
[g13] Send MOUNTPOINT status line
2009-10-28 12:02:15 +00:00
Marcus Brinkmann 3974488cd1 2009-09-23 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (NEED_LIBASSUAN_API, NEED_LIBASSUAN_VERSION):
	Update to new API (2, 1.1.0).

agent/
2009-09-23  Marcus Brinkmann  <marcus@g10code.de>

	* gpg-agent.c (parse_rereadable_options): Don't set global assuan
	log file (there ain't one anymore).
	(main): Update to new API.
	(check_own_socket_pid_cb): Return gpg_error_t instead of int.
	(check_own_socket_thread, check_for_running_agent): Create assuan
	context before connecting to server.
	* command.c: Include "scdaemon.h" before <assuan.h> because of
	GPG_ERR_SOURCE_DEFAULT check.
	(write_and_clear_outbuf): Use gpg_error_t instead of
	assuan_error_t.
	(cmd_geteventcounter, cmd_istrusted, cmd_listtrusted)
	(cmd_marktrusted, cmd_havekey, cmd_sigkey, cmd_setkeydesc)
	(cmd_sethash, cmd_pksign, cmd_pkdecrypt, cmd_genkey, cmd_readkey)
	(cmd_keyinfo, cmd_get_passphrase, cmd_clear_passphrase)
	(cmd_get_confirmation, cmd_learn, cmd_passwd)
	(cmd_preset_passphrase, cmd_scd, cmd_getval, cmd_putval)
	(cmd_updatestartuptty, cmd_killagent, cmd_reloadagent)
	(cmd_getinfo, option_handler): Return gpg_error_t instead of int.
	(post_cmd_notify): Change type of ERR to gpg_error_t from int.
	(io_monitor): Add hook argument.  Use symbols for constants.
	(register_commands): Change return type of HANDLER to gpg_error_t.
	(start_command_handler): Allocate assuan context before starting
	server.
	* call-pinentry.c: Include "scdaemon.h" before <assuan.h> because
	of GPG_ERR_SOURCE_DEFAULT check.
	(unlock_pinentry): Call assuan_release instead of
	assuan_disconnect.
	(getinfo_pid_cb, getpin_cb): Return gpg_error_t instead of int.
	(start_pinentry): Allocate assuan context before connecting to
	server.
	* call-scd.c (membuf_data_cb, learn_status_cb, get_serialno_cb)
	(membuf_data_cb, inq_needpin, card_getattr_cb, pass_status_thru)
	(pass_data_thru): Change return type to gpg_error_t.
	(start_scd): Allocate assuan context before connecting to server.

common/
2009-09-23  Marcus Brinkmann  <marcus@g10code.de>

	* asshelp.c (start_new_gpg_agent): Allocate assuan context before
	starting server.

g10/
2009-09-23  Marcus Brinkmann  <marcus@g10code.de>

	* call-agent.c: Include "scdaemon.h" before <assuan.h> because of
	GPG_ERR_SOURCE_DEFAULT check.
	(learn_status_cb, dummy_data_cb, get_serialno_cb, default_inq_cb)
	(learn_status_cb, inq_writecert_parms, inq_writekey_parms)
	(scd_genkey_cb, membuf_data_cb): Return gpg_error_t instead of
	int.
	* gpg.c: Include "scdaemon.h" before <assuan.h> because of
	GPG_ERR_SOURCE_DEFAULT check.
	(main): Update to new Assuan API.
	* server.c: Include "scdaemon.h" before <assuan.h> because of
	GPG_ERR_SOURCE_DEFAULT check.
	(option_handler, cmd_recipient, cmd_signer, cmd_encrypt)
	(cmd_decrypt, cmd_verify, cmd_sign, cmd_import, cmd_export)
	(cmd_delkeys, cmd_message, do_listkeys, cmd_listkeys)
	(cmd_listsecretkeys, cmd_genkey, cmd_getinfo): Return gpg_error_t
	instead of int.
	(register_commands): Allocate assuan context before starting
	server.
	(gpg_server): Allocate assuan_context before starting server.

scd/
2009-09-23  Marcus Brinkmann  <marcus@g10code.de>

	* command.c: Include "scdaemon.h" before <assuan.h> because of
	GPG_ERR_SOURCE_DEFAULT check.
	(option_handler, open_card, cmd_serialno, cmd_lean, cmd_readcert)
	(cmd_readkey, cmd_setdata, cmd_pksign, cmd_pkauth, cmd_pkdecrypt)
	(cmd_getattr, cmd_setattr, cmd_writecert, cmd_writekey)
	(cmd_genkey, cmd_random, cmd_passwd, cmd_checkpin, cmd_lock)
	(cmd_unlock, cmd_getinfo, cmd_restart, cmd_disconnect, cmd_apdu)
	(cmd_killscd): Return gpg_error_t instead of int.
	(scd_command_handler): Allocate assuan context before starting server.
	* scdaemon.c (main): Update to new Assuan API.

sm/
2009-09-23  Marcus Brinkmann  <marcus@g10code.de>

	* gpgsm.c (main): Update to new assuan API.
	* server.c: Include "gpgsm.h" before <assuan.h> due to check for
	GPG_ERR_SOURCE_DEFAULT and assuan.h now including gpg-error.h.
	(option_handler, cmd_recipient, cmd_signer, cmd_encrypt)
	(cmd_decrypt, cmd_verify, cmd_sign, cmd_import, cmd_export)
	(cmd_delkeys, cmd_message, cmd_listkeys, cmd_dumpkeys)
	(cmd_listsecretkeys, cmd_dumpsecretkeys, cmd_genkey)
	(cmd_getauditlog, cmd_getinfo): Return gpg_error_t instead of int.
	(register_commands): Same for member HANDLER in table.
	(gpgsm_server): Allocate assuan context before starting server.
	* sm/call-dirmngr.c:
	* call-dirmngr.c (prepare_dirmngr): Check for CTX and error before
	setting LDAPSERVER.
	(start_dirmngr_ext): Allocate assuan context before starting
	server.
	(inq_certificate, isvalid_status_cb, lookup_cb, lookup_status_cb)
	(run_command_cb, run_command_inq_cb, run_command_status_cb):
	Return gpg_error_t instead of int.

tools/
2009-09-23  Marcus Brinkmann  <marcus@g10code.de>

	* gpg-connect-agent.c (getinfo_pid_cb, read_and_print_response)
	(main): Update to new Assuan API.
2009-09-23 00:01:25 +00:00
Werner Koch e49d808e1f Add code to better handle unplugging of a reader. 2009-07-16 15:54:59 +00:00
Werner Koch 5e208460a1 Improved smartcard robustness. 2009-05-13 17:12:00 +00:00
Werner Koch f8b4cd7650 Import/export of pkcs#12 now uses the gpg-agent directly.
Removed duplicated code (percent unescaping).
2009-04-01 10:51:53 +00:00
Werner Koch 98e1a75e20 Implement decryption for TCOS 3 cards. 2009-03-30 12:46:06 +00:00
Werner Koch 990585ad7d Signing using Netkey 3 cards does now work. 2009-03-26 19:27:04 +00:00
Werner Koch f07e762d68 Better syncronization of several smartcard sessions. 2009-03-24 11:40:57 +00:00
Werner Koch a3b63ac1dc Add server option with-ephemeral-keys.
Extend SCD LEARN command.
2009-03-18 11:18:56 +00:00
Werner Koch 1eeefbf7f7 Add new attribute KEY-ATTR. 2009-03-10 16:10:35 +00:00
Werner Koch 59d7a54e72 New PIN Callback attributes in gpg-agent.
Common prompts for keypad and simple card reader.
More support for Netkey cards;  PIN management works now.
2009-03-05 19:19:37 +00:00
Werner Koch 2749c6bcd9 Fix segv. 2009-03-03 12:02:42 +00:00
Werner Koch ec4a3eb3c5 Fix a gpg2 problem with removed cards.
Allow runtime conf change for scdaemon.
New commands for scdaemon.
2009-02-27 14:36:59 +00:00
Werner Koch 943f783de7 New scd getinfo subcommand deny_admin 2009-02-12 17:45:40 +00:00
Werner Koch d1c2e66fbc Change default gpgsm cipher back to 3DES.
Typo fixes.
2009-02-09 10:25:41 +00:00
Werner Koch 38251aa74f Add a sample key.
Detect and show the card type.
2009-01-13 14:01:56 +00:00
Werner Koch 7ddd27a836 Minor fixes 2009-01-12 10:08:55 +00:00
Werner Koch 7784e86a66 Add limited support for NetKey 3.0 cards. 2009-01-08 19:56:30 +00:00
Werner Koch 7bd2e417d1 Fixed some card related problems. 2008-12-18 16:34:28 +00:00
Werner Koch 041c764672 Add option --card-timeout.
Add a new attribyte to app-openpgp.c
Fix two portability bugs.
Have gpg-connect-agent autostart gpg-agent on W32.
2008-12-05 12:01:01 +00:00
Werner Koch aec79fc731 Minor cleanups. 2008-11-11 08:22:06 +00:00
Werner Koch 4019792423 Fixed the card removed with cached app bug. (Famous last fix). 2008-11-03 19:09:34 +00:00
Werner Koch 338ddd0bb6 Use bin2hex if possible. 2008-11-03 10:54:18 +00:00
Werner Koch 738f3c74b5 Cosmetic fix 2008-10-29 08:45:13 +00:00
Marcus Brinkmann b04901468f 2008-10-21 Marcus Brinkmann <marcus@g10code.com>
* command.c (open_card): If connect error is SW_HOST_NO_CARD,
	return a more descriptive error.
2008-10-21 13:53:08 +00:00
Werner Koch 0a5f742466 Marked all unused args on non-W32 platforms. 2008-10-20 13:53:23 +00:00
Werner Koch 0698c5169f Use more warning options with modern GCCs.
Other minor changes.
2008-10-17 19:18:46 +00:00
Werner Koch b519a52cea Made scdaemon more robust on Windows. 2008-10-15 13:23:10 +00:00
Werner Koch d0ca953014 SCD changes for PC/SC under W32. 2008-10-14 18:18:21 +00:00
Werner Koch f899b9683b Support the Certifciate DO of the v2 OpenPGP cards. 2008-09-23 09:57:45 +00:00
Moritz Schulte 72110961f1 2008-08-30 Moritz <moritz@gnu.org>
* scdaemon.c (main): Use estream_asprintf instead of asprintf.
	* command.c (update_reader_status_file): Likewise.
	(cmd_serialno): Use estream_asprintf instead of asprintf
	and xfree instead of free to release memory allocated
	through (estream_)asprintf.
	(cmd_learn): Likewise.
	(pin_cb): Likewise.
	* app-openpgp.c (get_public_key): Likewise.
2008-08-31 11:55:09 +00:00
Werner Koch 9d5a10a453 Do not run the setuid test if running under as root proper.
Documentation fixes.
Some enhancements for the new OpenPGP Card.
2008-07-17 19:40:53 +00:00
Werner Koch 4817ff6528 Add support for the TCOS NullPIN feature. 2008-06-24 16:00:29 +00:00
Werner Koch ed7d2d72c6 Extended gpg-connect-agent.
New "GETINFO pid" command for scdaemon and gpg-agent.
2007-10-02 16:30:58 +00:00
Werner Koch 4631bc8ddf Fixed card key generation of gpg2.
Reveal less information about timings while generating a key.
2007-07-05 16:58:19 +00:00
Werner Koch 93d3811abc Changed to GPLv3.
Removed intl/.
2007-07-04 19:49:40 +00:00
Werner Koch f54b85bc2d A bunch of minor changes for Windows. 2007-07-04 09:34:28 +00:00
Werner Koch 0cfbfd6186 A whole bunch of changes to allow building for Windows.
See the ChangeLogs for details.
2007-06-14 17:05:07 +00:00
Werner Koch 3bbc481935 Add a way to get a listing of available CCID readers. 2007-04-03 16:57:37 +00:00
Werner Koch 80007b9411 Final fix for rc1 2006-11-23 10:35:31 +00:00
Werner Koch 5885142c83 Made some PIN pads work.
Some cleanups for 64 bit CPUs.
2006-11-20 16:49:41 +00:00
Werner Koch 4b48bcacc9 Fix for bug 537 2006-10-02 11:54:35 +00:00
Marcus Brinkmann bacb77af29 2006-10-02 Marcus Brinkmann <marcus@g10code.de>
* command.c (update_reader_status_file): Increase buffer of
        NUMBUF2 (fixing typo).
2006-10-02 00:34:53 +00:00
Werner Koch 03d3322e5f Take advantage of newer gpg-error features. 2006-09-14 16:50:33 +00:00
Werner Koch 6374763c98 Let scdaemon call a script on status changes 2006-09-07 15:13:33 +00:00
Werner Koch eef036df23 The big Assuan error code removal. 2006-09-06 16:35:52 +00:00
Marcus Brinkmann 1c4af2666b 2006-09-02 Marcus Brinkmann <marcus@g10code.de>
* command.c (get_reader_slot): Return the slot_table index, not
	the APDU slot number.
	(update_reader_status_file): Use the slot_table index in the
	update_card_removed invocation.
2006-09-02 14:47:47 +00:00
Marcus Brinkmann 59a5681e63 2006-09-01 Marcus Brinkmann <marcus@g10code.de>
* command.c (cmd_getinfo): Handle status command.
2006-09-01 13:57:33 +00:00
Marcus Brinkmann 9bdb549dc4 2006-08-30 Marcus Brinkmann <marcus@g10code.de>
* command.c (do_reset): Delay resetting CTRL->reader_slot until
	after update_card_removed invocation.
2006-08-30 15:57:17 +00:00
Werner Koch f98537733a Updated FSF's address. 2006-06-20 17:21:37 +00:00
Werner Koch c664309a0a Added command APDU 2006-04-11 13:53:21 +00:00
Werner Koch 79f749fec9 Allo RMD160 signatures 2006-03-21 12:48:51 +00:00
Werner Koch 89824e5d59 Fixed card removal problems 2006-03-01 11:05:47 +00:00
Werner Koch 4472efd12c PIN caching of cards does now work. 2006-02-09 18:29:31 +00:00
Werner Koch d9d2d3da91 The BELPIC card does now work. 2005-09-06 18:42:13 +00:00
Werner Koch deeba405a9 gcc-4 defaults forced me to edit many many files to get rid of the
char * vs. unsigned char * warnings.  The GNU coding standards used to
say that these mismatches are okay and better than a bunch of casts.
Obviously this has changed now.
2005-06-16 08:12:03 +00:00
Werner Koch 3370164182 New debugging optionhs, updates to the manual. 2005-06-07 19:09:18 +00:00
Werner Koch f1dac8851d * command.c (cmd_updatestartuptty): New.
* gpg-agent.c: New option --write-env-file.

* gpg-agent.c (handle_connections): Make sure that the signals we
are handling are not blocked.Block signals while creating new
threads.

* estream.c: Use HAVE_CONFIG_H and not USE_CONFIG_H!
(es_func_fd_read, es_func_fd_write): Protect against EINTR.

* gpg-agent.texi (Agent UPDATESTARTUPTTY): New.

* scdaemon.c (handle_connections): Make sure that the signals we
are handling are not blocked.Block signals while creating new
threads.
(handle_connections): Include the file descriptor into the name of
the thread.
2005-06-03 13:57:24 +00:00
Werner Koch a43586d0e8 * Makefile.am: Do not build sc-copykeys anymore.
* app-openpgp.c (app_openpgp_storekey, app_openpgp_readkey)
(app_openpgp_cardinfo): Removed.
2005-05-23 20:18:13 +00:00
Werner Koch 41862f5f13 * protect-tool.c: New option --canonical.
(show_file): Implement it.

* keyformat.txt: Define the created-at attribute for keys.

* ccid-driver.c: Replaced macro DEBUG_T1 by a new debug level.
(parse_ccid_descriptor): Mark SCR335 firmware version 5.18 good.
(ccid_transceive): Arghhh.  The seqno is another bit in the
R-block than in the I block, this was wrong at one place.

* scdaemon.c: New options --debug-ccid-driver and
--debug-disable-ticker.

* app-openpgp.c (do_genkey, do_writekey): Factored code to check
for existing key out into ..
(does_key_exist): .. New function.

* gpg-connect-agent.c (add_definq, show_definq, clear_definq)
(handle_inquire): New.
(read_and_print_response): Handle INQUIRE command.
(main): Implement control commands.
2005-05-20 20:39:36 +00:00
Werner Koch 4237a9cc7f Changed the scdaemon to handle concurrent sessions. Adjusted
gpg-agent accordingly. Code cleanups.
2005-05-18 10:48:06 +00:00
Werner Koch a22750dc1e * configure.ac: Removed OpenSC detection and options.
* acinclude.m4: Ditto.

* scdaemon.texi: Removed OpenSC specific options.

* app-p15.c: New.  Basic support for pkcs15 cards without OpenSC.
There are quite a couple of things missing but at least I can use
my old TCOS cards from the Aegypten-1 development for signing.
* app.c (select_application): Detect pkcs15 applications.
* Makefile.am (scdaemon_SOURCES): Removed card.c, card-common.h
and card-p15.c because they are now obsolete. Added app-p15.c.
Removed all OpenSC stuff.
* command.c (do_reset, open_card, cmd_serialno, cmd_learn)
(cmd_readcert, cmd_readkey, cmd_pksign, cmd_pkdecrypt): Removed
all special cases for the old card.c based mechanisms.
* scdaemon.c, apdu.c: Removed all special cases for OpenSC.
2005-04-27 12:09:21 +00:00
Werner Koch 3ff9a743bf * configure.ac: Do not build gpg by default.
* gpgsm.c: New options --{enable,disable}-trusted-cert-crl-check.
* certchain.c (gpgsm_validate_chain): Make use of it.

* certchain.c (gpgsm_validate_chain): Check revocations even for
expired certificates.  This is required because on signature
verification an expired key is fine whereas a revoked one is not.

* gpgconf-comp.c: Add gpgsm option disable-trusted-cert-crl-check.
2005-04-21 09:33:07 +00:00
Werner Koch 9f9a18c011 (retrieve_key_material): Rewritten. Return a
proper error code.
(retrieve_next_token): Removed.
(retrieve_fpr_from_card): Rewritten to make use of DO caching and
to take the KEYNO as arg.
(get_public_key): Renamed variable for clarity.
2005-04-14 17:25:43 +00:00
Werner Koch 6b002f0602 * app-openpgp.c (do_check_pin): Add hack to allow verification of
CHV3.
(get_public_key): Don't use gcry functions to create S-expressions.
(do_deinit, do_readkey, do_genkey, send_keypair_info): Adjust for
above change.
2005-04-11 16:20:10 +00:00
Werner Koch 1f1f28555a * call-scd.c (unescape_status_string): New. Actual a copy of
../g10/call-agent.c
(card_getattr_cb, agent_card_getattr): New.

* command-ssh.c (card_key_available): New.
(ssh_handler_request_identities): First see whether a card key is
available.

* app.c (app_getattr): Return APPTYPE or SERIALNO type even if the
application does dot support the getattr call.

* app.c (select_application): Return an error code and the
application context in an new arg.
* command.c (open_card): Adjusted for that.  Don't use the
fallback if no card is present.  Return an error if the card has
been removed without a reset.
(do_reset, cmd_serialno): Clear that error flag.
(TEST_CARD_REMOVAL): New. Use it with all command handlers.
(scd_update_reader_status_file): Set the error flag on all changes.
2005-02-24 21:40:48 +00:00
Werner Koch 3af261572b * gpg-agent.c (handle_connections): Need to check for events if
select returns with -1.

* tools.texi (gpg-connect-agent): New.

* app-openpgp.c (get_one_do): Never try to get a non cacheable
object from the cache.
(get_one_do): Add new arg to return an error code.  Changed all
callers.
(do_getattr): Let it return a proper error code.

* app.c (select_application): Return an error code and the
application context in an new arg.
* command.c (open_card): Adjusted for that.  Don't use the
fallback if no card is present.  Return an error if the card has
been removed without a reset.
(do_reset, cmd_serialno): Clear that error flag.
(TEST_CARD_REMOVAL): New. Use it with all command handlers.

* scdaemon.c (ticker_thread): Termintate if a shutdown is pending.

* apdu.c: Added some PCSC error codes.
(pcsc_error_to_sw): New.
(reset_pcsc_reader, pcsc_get_status, pcsc_send_apdu)
(open_pcsc_reader): Do proper error code mapping.

* gpg-connect-agent.c: New.
* Makefile.am: Add it.
2005-02-24 17:36:11 +00:00
Werner Koch 8c77433de9 * app-openpgp.c (app_local_s): New field PK.
(do_deinit, do_genkey, app_openpgp_storekey): Clear it.
(get_public_key, send_keypair_info): New.
(do_learn_status): Send KEYPAIR info

* app-common.h (app_ctx_t): Add function pointer READKEY.
* app.c (app_readkey): New.
* command.c (cmd_readkey): Use READKEY function if possible.
2005-02-22 17:29:07 +00:00
Werner Koch 878cf20766 * gpg-agent.c (main): Use default_homedir().
* protect-tool.c (main): Ditto.

* signal.c (got_fatal_signal, got_usr_signal)
(got_fatal_signal) [DOSISH]: Don't build.
* simple-gettext.c: Include sysutils.h

* homedir.c: New.
* Makefile.am (libcommon_a_SOURCES): Add it.
(EXTRA_DIST): Removed mkerror and mkerrtok.

* gpgv.c, g10.c (main): Use default_hoemdir ().

* scdaemon.c (main): Use default_homedir().

* gpgsm.c (main): Use default_homedir().
2004-12-21 10:03:00 +00:00
Werner Koch 69967b0412 A whole bunch of changes to allow building for W32. 2004-12-15 14:15:54 +00:00
Werner Koch 4624e9dfb3 * command.c (scd_update_reader_status_file): Send a signal back to
the client.
(option_handler): Parse the new event-signal option.

* scdaemon.c (handle_signal): Do not use SIGUSR{1,2} anymore for
changing the verbosity.
2004-04-21 14:44:09 +00:00
Werner Koch 78f797d11d * command.c (scd_update_reader_status_file): Write status files.
* app-help.c (app_help_read_length_of_cert): Fixed calculation of
R_CERTOFF.

* pcsc-wrapper.c: New.
* Makefile.am (pkglib_PROGRAMS): Install it here.
* apdu.c (writen, readn): New.
(open_pcsc_reader, pcsc_send_apdu, close_pcsc_reader): Use the
pcsc-wrapper if we are using Pth.
(apdu_send_le): Reinitialize RESULTLEN.  Handle SW_EOF_REACHED
like SW_SUCCESS.
2004-04-20 16:42:55 +00:00
Werner Koch e950b01ff5 * pcsc-wrapper.c: New.
* Makefile.am (pkglib_PROGRAMS): Install it here.
* apdu.c (writen, readn): New.
(open_pcsc_reader, pcsc_send_apdu, close_pcsc_reader): Use the
pcsc-wrapper if we are using Pth.
2004-04-20 14:17:10 +00:00
Werner Koch f8d44bc637 *** empty log message *** 2004-03-16 10:49:37 +00:00
Werner Koch a1b487a17a * protect-tool.c: New options --have-cert and --prompt.
(export_p12_file): Read a certificate from STDIN and pass it to
p12_build.  Detect a keygrip and construct the filename in that
case.  Unprotcet a key if needed.  Print error messages for key
formats we can't handle.
(release_passphrase): New.
(get_passphrase): New arg PROMPTNO. Return the allocated
string. Changed all callers.

* minip12.c: Revamped the build part.
(p12_build): New args CERT and CERTLEN.

* simple-pwquery.c (agent_open): Don't mangle INFOSTR.

* export.c (export_p12, popen_protect_tool)
(gpgsm_p12_export): New.
* gpgsm.c (main): New command --export-secret-key-p12.
2004-02-19 16:26:32 +00:00
Werner Koch 94c03c860e (reset_notify): Release the application context and
close the reader.
2004-01-29 20:17:51 +00:00
Werner Koch eb24d8b751 Some minor bug fixes, new test utilities and started support for other
smartcard applications.
2004-01-27 16:40:42 +00:00
Werner Koch c4182e3e24 Replaced deprecated type names.
* card-p15.c (p15_enum_keypairs): Replaced KRC by RC.
* card-dinsig.c (dinsig_enum_keypairs): Ditto.
2003-12-17 12:27:51 +00:00
Werner Koch dba40e5e45 Mainly changes to adjust for the changed KSBA API. 2003-11-12 15:17:44 +00:00
Werner Koch 5ee820978d * command.c (cmd_genkey, cmd_passwd): Fixed faulty use of
!spacep().

* apdu.c (apdu_open_reader): Hacks for PC/SC under Windows.
2003-10-25 14:22:42 +00:00
Werner Koch 21be16dba9 * command.c (cmd_checkpin): New.
(register_commands): Add command CHECKPIN.
* app.c (app_check_pin): New.
* app-openpgp.c (check_against_given_fingerprint): New. Factored
out that code elsewhere.
(do_check_pin): New.
2003-10-21 17:12:50 +00:00
Werner Koch 59a61b3c93 * command.c (cmd_getattr): New command GETATTR.
* app.c (app_setattr): New.
(do_getattr): New.
(do_learn_status): Reimplemented in terms of do_getattr.

* app-openpgp.c (do_change_pin): Make sure CVH1 and CHV2 are
always synced.
(verify_chv2, verify_chv3): New. Factored out common code.
(do_setattr, do_sign, do_auth, do_decipher): Change the names of
the prompts to match that we have only 2 different PINs.
(app_select_openpgp): Check whether the card enforced CHV1.
(convert_sig_counter_value): New. Factor out code from
get_sig_counter.
2003-09-30 17:35:05 +00:00
Werner Koch ab0f32351d (cmd_setattr): Use a copy of LINE.
(cmd_genkey): Use a copy of KEYNO.
(cmd_passwd): Use a copy of CHVNOSTR.
(cmd_pksign, cmd_pkauth, cmd_pkdecrypt): s/strdup/xtrystrdup/.
2003-08-25 09:58:02 +00:00
Repo Admin 9ca4830a5b This commit was manufactured by cvs2svn to create branch
'GNUPG-1-9-BRANCH'.
2003-08-05 17:11:04 +00:00
Repo Admin 82a17c9fb3 This commit was manufactured by cvs2svn to create branch
'GNUPG-1-9-BRANCH'.
2002-10-19 07:55:27 +00:00
Werner Koch 8ed2348ae5 * scdaemon.c: Include i18n.h.
* card-common.h (struct p15_private_s): Forward declaration.  Add
it to card_ctx_s.
* card.c (card_close): Make sure private data is released.
(card_enum_certs): New.
* card-p15.c (p15_release_private_data): New.
(init_private_data): New to work around an OpenSC weirdness.
(p15_enum_keypairs): Do an OpenSC get_objects only once.
(p15_enum_certs): New.
(card_p15_bind): Bind new function.
* command.c (cmd_learn): Return information about the certificates.
2002-08-16 14:23:40 +00:00
Werner Koch a2176634ae * call-agent.c (start_agent): Make copies of old locales and check
for setlocale.

* configure.ac: Check for setlocale.
2002-04-25 08:31:48 +00:00
Werner Koch 4e5bda7655 * command.c (cmd_pksign, cmd_pkdecrypt): Use a copy of the key ID. 2002-04-15 10:11:11 +00:00
Werner Koch c39b866d2a Doc fixes, moved some fizmes to TODO, fixed minor bugs. 2002-03-18 09:30:35 +00:00
Werner Koch 4e637f2285 sm/
* gpgsm.c: New command --learn-card
* call-agent.c (learn_cb,gpgsm_agent_learn): New.
* gpgsm.c (main): Print error messages for non-implemented commands.
agent/
* learncard.c: New.
* divert-scd.c (ask_for_card): The serial number is binary so
convert it to hex here.
* findkey.c (agent_write_private_key): New.
* genkey.c (store_key): And use it here.
scd/
* pkdecrypt.c (agent_pkdecrypt): Changed the way the diversion is done.
* divert-scd.c (divert_pkdecrypt): Changed interface and
implemented it.
2002-03-06 14:16:37 +00:00
Werner Koch 303b4bd636 Decryption using a Cryptoflex card does now work. 2002-03-06 09:01:12 +00:00
Werner Koch 2b5dca457c Well and some stuff to access the SC will be helpful. Note, that the
code requires the latest OpenSC CVS code.
2002-03-05 17:17:08 +00:00
Werner Koch f8efc7c4ef Added more code fragments. 2002-03-04 10:34:09 +00:00
Werner Koch 56341c289c Changes needed to support smartcards. Well, only _support_. There is
no real code yet.
2002-02-28 11:07:59 +00:00
Werner Koch 49b3340e0f Some experimental code - don't use it. 2002-02-18 20:47:17 +00:00
Werner Koch 108f62eb3e * scdaemon.c scdaemon.h, command.c: New. Based on the code from
the gpg-agent.
2002-01-26 13:38:38 +00:00