1 2005-09-09 Werner Koch <wk@g10code.com>
3 * pcsc-wrapper.c (main): Removed bogus free.
5 * app-p15.c (do_auth): New.
6 (do_getattr): New attribs $AUTHKEYID and $DISPSERIALNO.
7 * app-openpgp.c (do_getattr): Ditto.
9 2005-09-08 Werner Koch <wk@g10code.com>
11 * app-openpgp.c (do_getattr): New key $AUTHKEYID.
13 2005-09-06 Werner Koch <wk@g10code.com>
15 * app-p15.c (do_sign): Tweaked for BELPIC cards.
16 (read_home_df): New arg R_BELPIC.
17 (app_select_p15): Set card type for BELPIC.
19 2005-09-05 Werner Koch <wk@g10code.com>
21 * iso7816.c (iso7816_select_path): New.
22 * app-p15.c (select_ef_by_path): Allow for direct path selection.
23 (app_select_p15): Try using the Belgian variant of pkcs#15.
25 (read_ef_odf): Generalized.
26 (read_ef_tokeninfo): New.
27 (read_p15_info): Set serialnumber from TokenInfo.
28 (app_select_p15): Don't munge serialNumber - that must be done
31 * iso7816.c (iso7816_read_binary): Use Le=0 when reading all
32 data. Handle 6C00 error and take 6B00 as indication for EOF.
33 * apdu.h (SW_EXACT_LENGTH_P): New.
34 * apdu.c (new_reader_slot, reset_pcsc_reader, pcsc_get_status)
35 (open_pcsc_reader): Set new reader state IS_T0.
36 (apdu_send_le): When doing T=0 make sure not to send Lc and Le.
37 Problem reported by Carl Meijer.
38 (apdu_send_direct): Initialize RESULTLEN.
39 * pcsc-wrapper.c (handle_status): Return the current protocol as
42 2005-08-05 Werner Koch <wk@g10code.com>
44 * apdu.c (open_rapdu_reader): Set the reader number.
46 2005-07-05 Werner Koch <wk@g10code.com>
48 * app-openpgp.c (do_readkey): Return a mallcoed copy of the key as
49 required by the description. Thanks to Moritz for tracking this
52 2005-06-21 Werner Koch <wk@g10code.com>
54 * scdaemon.c (main): ifdef call to ccid_set_debug_level.
56 * apdu.c (reset_pcsc_reader, open_pcsc_reader): Cast size_t to
59 2005-06-06 Werner Koch <wk@g10code.com>
61 * scdaemon.c (main): New option --debug-allow-core-dump.
63 2005-06-03 Werner Koch <wk@g10code.com>
65 * scdaemon.c (handle_connections): Make sure that the signals we
66 are handling are not blocked.Block signals while creating new
68 (handle_connections): Include the file descriptor into the name of
71 2005-06-02 Werner Koch <wk@g10code.com>
73 * app.c (app_dump_state, dump_mutex_state): New.
74 * scdaemon.c (handle_signal): Print it on SIGUSR1.
76 * app-openpgp.c (do_writekey): Typo fix.
78 * command.c (open_card): Check for locked state even if an
79 application context is available.
81 * app-common.h: Add REF_COUNT field.
82 * app.c (release_application, select_application): Implement
83 reference counting to share the context beween connections.
85 * app.c (lock_reader, unlock_reader): Take SLOT instead of APP as
86 argument. Changed all callers.
87 (select_application): Unlock the reader on error. This should fix
88 the hangs I noticed last week.
90 * scdaemon.h: Removed card_ctx_t cruft.
92 2005-06-01 Werner Koch <wk@g10code.com>
94 * scdaemon.c: Include mkdtemp.h.
96 2005-05-31 Werner Koch <wk@g10code.com>
98 * tlv.c [GNUPG_MAJOR_VERSION==1]: Define constants instead of
99 including a gnupg 1.4 header.
101 2005-05-30 Werner Koch <wk@g10code.com>
103 * tlv.c: Add hack to compile without gpg-error.h when used with
106 2005-05-23 Werner Koch <wk@g10code.com>
108 * Makefile.am: Do not build sc-copykeys anymore.
110 * app-openpgp.c (app_openpgp_storekey, app_openpgp_readkey)
111 (app_openpgp_cardinfo): Removed.
113 * ccid-driver.c (parse_ccid_descriptor): SCR335 FW version 5.14 is
115 (do_close_reader): Never do a reset. The caller should instead
116 make sure that the reader has been closed properly. The new retry
117 code in ccid_slot_status will make sure that the readersatrts up
118 fine even if the last process didn't closed the USB connection
120 (ccid_get_atr): For certain readers try switching to ISO mode.
121 Thanks to Ludovic Rousseau for this hint and the magic numbers.
122 (print_command_failed): New.
123 (bulk_in): Use it here. Add new arg NO_DEBUG.
124 (ccid_slot_status): Disabled debugging.
126 2005-05-21 Werner Koch <wk@g10code.com>
128 * scdaemon.c (handle_signal): Print thread info on SIGUSR1.
130 2005-05-20 Werner Koch <wk@g10code.com>
132 * ccid-driver.c: Replaced macro DEBUG_T1 by a new debug level.
133 (parse_ccid_descriptor): Mark SCR335 firmware version 5.18 good.
134 (ccid_transceive): Arghhh. The seqno is another bit in the
135 R-block than in the I block, this was wrong at one place.
137 * scdaemon.c: New options --debug-ccid-driver and
138 --debug-disable-ticker.
140 * app-openpgp.c (do_genkey, do_writekey): Factored code to check
141 for existing key out into ..
142 (does_key_exist): .. New function.
144 2005-05-19 Werner Koch <wk@g10code.com>
146 * tlv.c (parse_sexp): New.
148 * command.c (cmd_writekey): New.
149 * app.c (app_writekey): New.
150 * app-common.c (app_t): Add function ptr WRITEKEY.
151 * app-openpgp.c (do_writekey): New.
153 * app-openpgp.c (do_readkey) [GNUPG_MAJOR_VERSION==1]: Return error.
154 * app-common.h (app_t) [GNUPG_MAJOR_VERSION==1]: Add a field to
155 store the Assuan context.
157 2005-05-17 Werner Koch <wk@g10code.com>
159 * scdaemon.c: Removed non-pth code paths.
160 (create_socket_name, create_server_socket): New. Taken from
162 (cleanup): Changed to adjust for SOCKET_NAME now being malloced.
163 (ticker_thread): Always use pth_event_occurred; it is again
164 defined for all decent PTH versions.
165 (handle_connections): New. Based on the gpg-agent code.
166 (start_connection_thread): Ditto.
167 (ticker_thread): Removed.
168 (cleanup_sh): Removed.
169 (main): Run the handler for the pipe server in a separate
170 thread. This replaces the old ticker thread.
171 (scd_get_socket_name): New.
172 * command.c (cmd_getinfo): New command GETINFO.
173 (scd_command_handler): Renamed argument and changed code to use an
174 already connected FD.
176 2005-05-15 Werner Koch <wk@g10code.com>
178 * app.c, app-common.h, app-nks.c, app-p15.c, app-dinsig.c
179 * app-openpgp.c: Change most function return types from int to
181 * command.c (pin_cb): Ditto.
182 * sc-copykeys.c (pincb): Ditto.
184 * app.c (lock_reader, unlock_reader): New. Changed call handler
185 wrappers to make use of these functions.
187 2005-05-07 Werner Koch <wk@g10code.com>
189 * ccid-driver.c (do_close_reader): Don't do a reset before close.
190 Some folks reported that it makes the SCR335 hang less often.
191 Look at the source on how to re-enable it.
193 2005-04-27 Werner Koch <wk@g10code.com>
195 * app-p15.c (micardo_mse): New.
197 * iso7816.c (iso7816_manage_security_env): Allow passing DATA as
198 NULL to indicate an empty Lc.
199 * tlv.c (find_tlv): Check that a found object fits into the
201 (find_tlv_unchecked): New as replacement for the old non-checking
203 * app.c (select_application): Keep on using the non-checking
205 * app-openpgp.c (get_one_do, dump_all_do): Ditto.
208 Removal of the old OpenSC based code.
210 * app-p15.c: New. Basic support for pkcs15 cards without OpenSC.
211 There are quite a couple of things missing but at least I can use
212 my old TCOS cards from the Aegypten-1 development for signing.
213 * app.c (select_application): Detect pkcs15 applications.
214 * Makefile.am (scdaemon_SOURCES): Removed card.c, card-common.h
215 and card-p15.c because they are now obsolete. Added app-p15.c.
216 Removed all OpenSC stuff.
217 * command.c (do_reset, open_card, cmd_serialno, cmd_learn)
218 (cmd_readcert, cmd_readkey, cmd_pksign, cmd_pkdecrypt): Removed
219 all special cases for the old card.c based mechanisms.
220 * scdaemon.c, apdu.c: Removed all special cases for OpenSC.
222 2005-04-20 Werner Koch <wk@g10code.com>
224 * command.c: Use GPG_ERR_LOCKED instead of EBUSY.
226 2005-04-14 Werner Koch <wk@g10code.com>
228 * app-openpgp.c (retrieve_key_material): Rewritten. Return a
230 (retrieve_next_token): Removed.
231 (retrieve_fpr_from_card): Rewritten to make use of DO caching and
232 to take the KEYNO as arg.
233 (get_public_key): Renamed variable for clarity.
235 2005-04-12 Werner Koch <wk@g10code.com>
237 Basic support for several sessions.
239 * command.c (scd_command_handler): Replace the primary_connection
240 stuff by a real connection list. Release the local context on
242 (scd_update_reader_status_file): Update accordingly. Send signal
243 to all connections who registered an event signal.
244 (cmd_lock, cmd_unlock, register_commands): New commands LOCK and
246 (cmd_setdata, cmd_pksign, cmd_pkauth, cmd_pkdecrypt, cmd_setattr)
247 (cmd_genkey, cmd_passwd, cmd_checkpin): Return an error if reader
249 (do_reset): Handle locking.
250 (open_card): Ditto. Share the reader slot with other sessions.
251 (get_reader_slot): New.
252 (update_card_removed): New. Use it in the TEST_CARD_REMOVAL macro.
254 2005-04-07 Werner Koch <wk@g10code.com>
256 * app-openpgp.c (do_check_pin): Add hack to allow verification of
258 (get_public_key): Don't use gcry functions to create S-expressions.
259 (do_deinit, do_readkey, do_genkey, send_keypair_info): Adjust for
262 2005-03-29 Moritz Schulte <moritz@g10code.com>
264 * app-openpgp.c (retrieve_fpr_from_card): New function.
265 (retrieve_next_token): New function.
266 (retrieve_key_material): New function.
267 (get_public_key): Implement retrival of key through expernal
268 helper (gpg) in case the openpgp card is not cooperative enough.
270 2005-03-16 Werner Koch <wk@g10code.com>
272 * ccid-driver.c (parse_ccid_descriptor): Make SCM workaround
273 reader type specific.
274 (scan_or_find_devices): Do not check the interface subclass in the
275 SPR532 kludge, as this depends on the firmware version.
276 (ccid_get_atr): Get the Slot status first. This solves the
277 problem with readers hanging on recent Linux 2.6.x.
278 (bulk_in): Add argument TIMEOUT and changed all callers to pass an
279 appropriate one. Change the standard timeout from 10 to 5 seconds.
280 (ccid_slot_status): Add a retry code with an initial short timeout.
281 (do_close_reader): Do an usb_reset before closing the reader.
283 2005-02-25 Werner Koch <wk@g10code.com>
285 * app-openpgp.c (get_public_key): Make sure not to return negative
287 (do_sign): Allow passing of indata with algorithm prefix.
288 (do_auth): Allow OPENPGP.3 as an alternative ID.
290 * app.c (app_getattr): Return just the S/N but not the timestamp.
292 2005-02-24 Werner Koch <wk@g10code.com>
294 * app.c (app_getattr): Return APPTYPE or SERIALNO type even if the
295 application does dot support the getattr call.
297 * app-openpgp.c (get_one_do): Never try to get a non cacheable
298 object from the cache.
299 (get_one_do): Add new arg to return an error code. Changed all
301 (do_getattr): Let it return a proper error code.
303 * app.c (select_application): Return an error code and the
304 application context in an new arg.
305 * command.c (open_card): Adjusted for that. Don't use the
306 fallback if no card is present. Return an error if the card has
307 been removed without a reset.
308 (do_reset, cmd_serialno): Clear that error flag.
309 (TEST_CARD_REMOVAL): New. Use it with all command handlers.
310 (scd_update_reader_status_file): Set the error flag on all changes.
312 * scdaemon.c (ticker_thread): Termintate if a shutdown is pending.
314 * apdu.c: Added some PCSC error codes.
315 (pcsc_error_to_sw): New.
316 (reset_pcsc_reader, pcsc_get_status, pcsc_send_apdu)
317 (open_pcsc_reader): Do proper error code mapping.
319 2005-03-16 Werner Koch <wk@g10code.com>
321 * ccid-driver.c (parse_ccid_descriptor): Make SCM workaround
322 reader type specific.
323 (scan_or_find_devices): Do not check the interface subclass in the
324 SPR532 kludge, as this depends on the firmware version.
325 (ccid_get_atr): Get the Slot status first. This solves the
326 problem with readers hanging on recent Linux 2.6.x.
328 2005-02-22 Werner Koch <wk@g10code.com>
330 * app-openpgp.c (app_local_s): New field PK.
331 (do_deinit, do_genkey, app_openpgp_storekey): Clear it.
332 (get_public_key, send_keypair_info): New.
333 (do_learn_status): Send KEYPAIR info
335 * app-common.h (app_ctx_t): Add function pointer READKEY.
336 * app.c (app_readkey): New.
337 * command.c (cmd_readkey): Use READKEY function if possible.
339 2005-01-26 Werner Koch <wk@g10code.com>
341 * ccid-driver.c (parse_ccid_descriptor): Need the CSM workaround
342 also for newer firmware versions. Need to get a list of fixed
343 firmware versions and use that.
345 2005-01-25 Werner Koch <wk@g10code.com>
347 * apdu.c (apdu_send_le, apdu_send_direct): Fix some compiler
350 * app-openpgp.c (get_cached_data): New arg GET_IMMEDIATE to bypass
351 the cache. Changed all callers.
352 (get_one_do): Bypass the cache if the value would have been read
353 directly for v1.1 cards.It makes things a bit slower but obnly for
354 1.0 cards and there are not that many cards out in the wild. This
355 is required to fix a caching bug when generating new keys; as a
356 side effect of the retrieval of the the C4 DO from the 6E DO the
357 cached fingerprint will get updated to the old value and later
358 when signing the generated key the checking of the fingerprint
359 fails because it won't match the new one. Thanks to Moritz for
360 analyzing this problem.
361 (verify_chv3): Removed the CHV status reread logic because we
362 won't cache the C4 DO anymore.
364 2004-12-28 Werner Koch <wk@g10code.com>
366 * ccid-driver.c (find_endpoint): New.
367 (scan_or_find_devices): Add new args to return endpoint info and
369 (ccid_open_reader, ccid_shutdown_reader): Take care of these new
371 (bulk_in, bulk_out): Use the correct endpoints.
372 (ccid_transceive_apdu_level): New.
373 (ccid_transceive): Divert to above.
374 (parse_ccid_descriptor): Allow APDU level exchange mode.
375 (do_close_reader): Pass the interface number to usb_release_interface.
377 2004-12-21 Werner Koch <wk@g10code.com>
379 * scdaemon.c (main): Use default_homedir().
381 2004-12-18 Werner Koch <wk@g10code.com>
383 * scdaemon.c (main) [W32]: Remove special Pth initialize..
385 * scdaemon.h (map_assuan_err): Define in terms of
386 map_assuan_err_with_source.
388 2004-12-15 Werner Koch <wk@g10code.com>
390 * scdaemon.c [W32]: Various hacks to make it run under W32.
392 * command.c (scd_update_reader_status_file) [W32]: Don't use kill.
394 * apdu.c [W32]: Disable use of pcsc_wrapper.
396 * Makefile.am (scdaemon_LDADD): Reorder libs.
397 (sc_copykeys_LDADD): Add libassuan because it is needed for W32.
399 2004-12-06 Werner Koch <wk@g10code.com>
401 * Makefile.am (pkglib_PROGRAMS): Build only for W32.
403 2004-10-22 Werner Koch <wk@g10code.com>
405 * app-openpgp.c (verify_chv3): The minium length for CHV3 is
406 8. Changed string to match the other ones.
408 2004-10-21 Werner Koch <wk@g10code.com>
410 * app-openpgp.c (do_sign): Replace asprintf by direct allocation.
411 This avoids problems with missing vasprintf implementations in
414 * app-common.h (app_openpgp_storekey: Add prototype.
416 2004-10-20 Werner Koch <wk@g10code.com>
418 * sc-investigate: Removed.
419 * Makefile.am (sc_investigate): Removed.
421 * pcsc-wrapper.c (load_pcsc_driver): Load get_status_change func.
422 (handle_open): Succeed even without a present card.
423 (handle_status, handle_reset): New.
425 * apdu.c (apdu_open_reader): Load pcsc_get_status_change fucntion.
426 (pcsc_get_status): Implemented.
427 (reset_pcsc_reader): Implemented.
428 (open_pcsc_reader): Succeed even with no card inserted.
429 (open_ccid_reader): Set LAST_STATUS.
431 * iso7816.c (iso7816_select_application): Always use 0 for P1.
433 2004-10-18 Werner Koch <wk@g10code.com>
435 * ccid-driver.c (ccid_get_atr): Reset T=1 state info.
437 2004-10-14 Werner Koch <wk@g10code.com>
439 * app-openpgp.c (parse_login_data): New.
440 (app_select_openpgp): Call it.
441 (do_setattr): Reparse it after change.
443 2004-10-06 Werner Koch <wk@g10code.de>
445 * ccid-driver.c (ccid_open_reader): Store the vendor ID.
446 (ccid_transceive_secure): New.
447 (parse_ccid_descriptor): Workaround for an SCM reader problem.
449 2004-10-04 Werner Koch <wk@g10code.de>
451 * ccid-driver.c (send_escape_cmd): New.
453 2004-09-30 Werner Koch <wk@g10code.com>
455 * Makefile.am: Adjusted for gettext 0.14.
457 * app-openpgp.c (do_sign): Add the error string to the verify
460 2004-09-27 Werner Koch <wk@g10code.com>
464 * app-openpgp.c: Made all strings translatable.
465 (verify_chv3) [GNUPG_MAJOR_VERSION]: Make opt.allow_admin
466 available for use in gnupg 2.
467 (verify_chv3): Reimplemented countdown showing to use only
468 functions from this module. Flush the CVH status cache on a
470 (get_one_do): Hack to bypass the cache for cards versions > 1.0.
471 (store_fpr): Store the creation date for card version > 1.0.
473 * app-openpgp.c (app_openpgp_storekey): Call flush_cache.
474 (get_cached_data): Move local data initialization to ..
475 (app_select_openpgp): .. here. Read some flags for later use.
476 (do_getattr): New read-only attribute EXTCAP.
478 * apdu.c (open_pcsc_reader): Do not print empty reader string.
480 * ccid-driver.c (do_close_reader): Factored some code out from ...
481 (ccid_close_reader): ..here.
482 (ccid_shutdown_reader): New.
484 * apdu.c (apdu_shutdown_reader): New.
485 (shutdown_ccid_reader): New.
487 * apdu.c (open_ccid_reader): New arg PORTSTR. Pass it to
489 (apdu_open_reader): Pass portstr to open_ccid_reader.
490 (apdu_open_reader): No fallback if a full CCID reader id has been
493 * ccid-driver.c (ccid_get_reader_list): New.
494 (ccid_open_reader): Changed API to take a string for the reader.
495 Removed al the cruft for the libusb development vesion which seems
496 not to be maintained anymore and there are no packages anyway.
497 The stable library works just fine.
498 (struct ccid_reader_id_s): Deleted and replaced everywhere by a
500 (usb_get_string_simple): Removed.
501 (bulk_in): Do valgrind hack here and not just everywhere.
503 * ccid-driver.c (read_device_info): Removed.
504 (make_reader_id, scan_or_find_devices): New.
505 (ccid_open_reader): Simplified by make use of the new functions.
506 (ccid_set_debug_level): New. Changed the macros to make use of
507 it. It has turned out that it is often useful to enable debugging
508 at runtime so I added this option.
510 From gnupg 1.3 - David Shaw <dshaw@jabberwocky.com>
512 * app-openpgp.c (verify_chv3): Show a countdown of how many wrong
513 admin PINs can be entered before the card is locked.
515 * app-openpgp.c (get_cached_data): Avoid mallocing zero since it
516 breaks us when using --enable-m-guard.
518 * ccid-driver.c (usb_get_string_simple): Replacement function to
519 work with older libusb.
521 * ccid-driver.c (read_device_info): Fix segfault when usb device
523 (ccid_open_reader): Allow working with an even older version of
524 libusb (usb_busses global instead of usb_get_busses()).
526 2004-09-11 Werner Koch <wk@g10code.com>
528 * app-openpgp.c (app_select_openpgp): Its app_munge_serialno and
529 not app_number_serialno.
531 2004-08-20 Werner Koch <wk@g10code.de>
533 * app.c (select_application): Fixed serial number extraction and
534 added the BMI card workaround.
535 (app_munge_serialno): New.
536 * app-openpgp.c (app_select_openpgp): Try munging serialno.
538 2004-08-05 Werner Koch <wk@g10code.de>
540 * scdaemon.c (main): New option --disable-application.
541 * app.c (is_app_allowed): New.
542 (select_application): Use it to check for disabled applications.
544 * ccid-driver.h (CCID_DRIVER_ERR_ABORTED): New.
545 * ccid-driver.c (ccid_open_reader): Support the stable 0.1 version
547 (ccid_get_atr): Handle short messages.
549 * apdu.c (my_rapdu_get_status): Implemented.
551 2004-07-27 Moritz Schulte <moritz@g10code.com>
553 * apdu.c: Include <signal.h>.
555 * Makefile.am: Use @DL_LIBS@ instead of -ldl.
557 2004-07-22 Werner Koch <wk@g10code.de>
559 * Makefile.am: Make OpenSC lib link after libgcrypt. Do not link
561 * apdu.c: Don't use Pth if we use OpenSC.
562 * sc-investigate.c, scdaemon.c: Disable use of pth if OpenSC is used.
564 * scdaemon.c (main): Bumbed thread stack size up to 512k.
566 2004-07-16 Werner Koch <wk@gnupg.org>
568 * apdu.c (reader_table_s): Add function pointers for the backends.
569 (apdu_close_reader, apdu_get_status, apdu_activate)
570 (send_apdu): Make use of them.
571 (new_reader_slot): Intialize them to NULL.
572 (dump_ccid_reader_status, ct_dump_reader_status): New.
573 (dump_pcsc_reader_status): New.
574 (open_ct_reader, open_pcsc_reader, open_ccid_reader)
575 (open_osc_reader, open_rapdu_reader): Intialize function pointers.
576 (ct_activate_card, ct_send_apdu, pcsc_send_apdu, osc_send_apdu)
577 (error_string): Removed. Replaced by apdu_strerror.
578 (get_ccid_error_string): Removed.
579 (ct_activate_card): Remove the unused loop.
580 (reset_ct_reader): Implemented.
581 (ct_send_apdu): Activate the card if not yet done.
582 (pcsc_send_apdu): Ditto.
584 2004-07-15 Werner Koch <wk@gnupg.org>
586 * ccid-driver.h: Add error codes.
587 * ccid-driver.c: Implement more or less proper error codes all
590 * apdu.c (apdu_send_direct): New.
591 (get_ccid_error_string): Add some error code mappings.
592 (send_apdu): Pass error codes along for drivers already supporting
594 (host_sw_string): New.
595 (get_ccid_error_string): Use above.
596 (send_apdu_ccid): Reset the reader if it has not yet been done.
597 (open_ccid_reader): Don't care if the ATR can't be read.
598 (apdu_activate_card): New.
599 (apdu_strerror): New.
600 (dump_reader_status): Only enable it with opt.VERBOSE.
601 * iso7816.c (map_sw): Add mappings for the new error codes.
603 2004-07-02 Werner Koch <wk@gnupg.org>
605 * apdu.c (open_ct_reader, open_pcsc_reader, open_ccid_reader)
606 (reset_ccid_reader, open_osc_reader): Call dump_reader_status only
609 2004-07-01 Werner Koch <wk@gnupg.org>
611 * sc-investigate.c: Initialize Pth which is now required.
612 (interactive_shell): New command "readpk".
614 * app-openpgp.c (do_getattr): Fix for sending CA-FPR.
616 2004-06-30 Werner Koch <wk@gnupg.org>
618 * app-openpgp.c (app_openpgp_readkey): Fixed check for valid
621 2004-06-18 Werner Koch <wk@g10code.com>
623 * sc-investigate.c (my_read_line): Renamed from read_line.
625 2004-06-16 Werner Koch <wk@gnupg.org>
627 * apdu.c (osc_get_status): Fixed type in function name. Noted by
628 Axel Thimm. Yes, I didn't tested it with OpenSC :-(.
630 2004-04-28 Werner Koch <wk@gnupg.org>
632 * app-openpgp.c (do_setattr): Sync FORCE_CHV1.
634 2004-04-27 Werner Koch <wk@gnupg.org>
636 * app-common.h: Do not include ksba.h for gnupg 1.
638 2004-04-26 Werner Koch <wk@gnupg.org>
640 * app-common.h: New members FNC.DEINIT and APP_LOCAL.
641 * app.c (release_application): Call new deconstructor.
642 * app-openpgp.c (do_deinit): New.
643 (get_cached_data, flush_cache_item, flush_cache_after_error)
645 (get_one_do): Replaced arg SLOT by APP. Make used of cached data.
646 (verify_chv2, verify_chv3): Flush some cache item after error.
647 (do_change_pin): Ditto.
649 (do_setattr): Flush cache item.
650 (do_genkey): Flush the entire cache.
651 (compare_fingerprint): Use cached data.
653 * scdaemon.c (main): Do the last change the usual way. This is so
654 that we can easily test for versioned config files above.
656 2004-04-26 Marcus Brinkmann <marcus@g10code.de>
658 * scdaemon.c (main): For now, always print default filename for
659 --gpgconf-list, and never /dev/null.
661 2004-04-21 Werner Koch <wk@gnupg.org>
663 * command.c (scd_update_reader_status_file): Send a signal back to
665 (option_handler): Parse the new event-signal option.
667 * scdaemon.c (handle_signal): Do not use SIGUSR{1,2} anymore for
668 changing the verbosity.
670 2004-04-20 Werner Koch <wk@gnupg.org>
672 * command.c (scd_update_reader_status_file): Write status files.
674 * app-help.c (app_help_read_length_of_cert): Fixed calculation of
677 * pcsc-wrapper.c: New.
678 * Makefile.am (pkglib_PROGRAMS): Install it here.
679 * apdu.c (writen, readn): New.
680 (open_pcsc_reader, pcsc_send_apdu, close_pcsc_reader): Use the
681 pcsc-wrapper if we are using Pth.
682 (apdu_send_le): Reinitialize RESULTLEN. Handle SW_EOF_REACHED
685 2004-04-19 Werner Koch <wk@gnupg.org>
687 * ccid-driver.c (parse_ccid_descriptor): Store some of the reader
688 features away. New arg HANDLE
689 (read_device_info): New arg HANDLE. Changed caller.
690 (bulk_in): Handle time extension requests.
691 (ccid_get_atr): Setup parameters and the IFSD.
692 (compute_edc): New. Factored out code.
693 (ccid_transceive): Use default NADs when required.
695 2004-04-14 Werner Koch <wk@gnupg.org>
697 * scdaemon.h (server_control_s): Add member READER_SLOT.
698 * scdaemon.c (scd_init_default_ctrl): Initialize READER_SLOT to -1.
699 * command.c (open_card): Reuse an open slot.
700 (reset_notify): Just reset the slot if supported by the reader.
701 (do_reset): Factored code from above out.
702 (scd_command_handler): Use it for cleanup.
704 * apdu.h: New pseudo stati SW_HOST_NOT_SUPPORTED,
705 SW_HOST_LOCKING_FAILED and SW_HOST_BUSY.
706 * iso7816.c (map_sw): Map it.
708 * ccid-driver.c (ccid_slot_status): Add arg STATUSBITS.
709 * apdu.c (apdu_get_status): New.
710 (ct_get_status, pcsc_get_status, ocsc_get_status): New stubs.
711 (get_status_ccid): New.
713 (reset_ct_reader, reset_pcsc_reader, reset_osc_reader): New stubs.
714 (reset_ccid_reader): New.
715 (apdu_enum_reader): New.
717 * apdu.c (lock_slot, trylock_slot, unlock_slot): New helpers.
718 (new_reader_slot) [USE_GNU_PTH]: Init mutex.
719 (apdu_reset, apdu_get_status, apdu_send_le): Run functions
722 * command.c (scd_update_reader_status_file): New.
723 * scdaemon.c (handle_tick): Call it.
725 2004-04-13 Werner Koch <wk@gnupg.org>
727 * scdaemon.c: Convert to a Pth application.
728 (handle_signal, ticker_thread, handle_tick): New.
729 (main): Fire up the ticker thread in server mode.
731 2004-03-23 Werner Koch <wk@gnupg.org>
733 * scdaemon.c (main) <gpgconf_list>: Fixed output for pcsc_driver.
735 2004-03-17 Werner Koch <wk@gnupg.org>
737 * tlv.c (parse_ber_header): Do not check for tag overflow - it
738 does not make sense. Simplified the check for length overflow.
740 * scdaemon.c (main) <gpgconf>: Fixed default value quoting.
742 2004-03-16 Werner Koch <wk@gnupg.org>
744 * app-dinsig.c: Implemented. Based on app-nks.c and card-dinsig.c
745 * app-nks.c (get_length_of_cert): Removed.
747 (app_help_read_length_of_cert): New. Code taken from above. New
748 optional arg R_CERTOFF.
750 * card-dinsig.c: Removed.
751 * card.c (card_get_serial_and_stamp): Do not bind to the old and
752 never finsiged card-dinsig.c.
754 * iso7816.c (iso7816_read_binary): Allow for an NMAX > 254.
756 2004-03-11 Werner Koch <wk@gnupg.org>
758 * scdaemon.h (out_of_core): Removed. Replaced callers by standard
761 * apdu.c, iso7816.c, ccid-driver.c [GNUPG_SCD_MAIN_HEADER]: Allow
762 to include a header defined by the compiler. This helps us to
763 reuse the source in other software.
765 2004-03-10 Werner Koch <wk@gnupg.org>
767 * iso7816.c (iso7816_read_record): New arg SHORT_EF. Changed all
770 2004-02-18 Werner Koch <wk@gnupg.org>
772 * sc-investigate.c (main): Setup the used character set.
773 * scdaemon.c (main): Ditto.
775 * scdaemon.c (set_debug): New. Add option --debug-level.
776 (main): Add option --gpgconf-list.
778 2004-02-12 Werner Koch <wk@gnupg.org>
780 * Makefile.am: Include cmacros.am for common flags.
782 2004-01-29 Werner Koch <wk@gnupg.org>
784 * command.c (reset_notify): Release the application context and
787 2004-01-28 Werner Koch <wk@gnupg.org>
789 * iso7816.c (iso7816_manage_security_env): New.
790 (iso7816_decipher): Add PADIND argument.
792 2004-01-27 Werner Koch <wk@gnupg.org>
794 * command.c (cmd_readcert, cmd_readkey): Work on a copy of LINE.
796 * app-common.h (app_ctx_s): Added readcert field.
797 * app.c (app_readcert): New.
798 * tlv.c (parse_ber_header): Added; taken from libksba.
800 2004-01-26 Werner Koch <wk@gnupg.org>
802 * card.c (map_sc_err): Use SCD as the error source.
804 * command.c (open_card): ADD arg NAME to allow requesting a
805 specific application. Changed all callers.
806 (cmd_serialno): Allow optional argument to select the desired
811 * scdaemon.h (opt): Add READER_PORT.
812 * scdaemon.c (main): Set it here.
813 * app.c (app_set_default_reader_port): Removed.
814 (select_application): Add NAME arg and figure out a
815 default serial number from the GDO. Add SLOT arg and remove all
817 (release_application): New.
818 (app_write_learn_status): Output an APPTYPE status line.
819 * command.c (open_card): Adapt for select_application change.
820 * app-openpgp.c (app_select_openpgp): Removed SN and SNLEN args
821 and set it directly. Changed all callers.
823 2004-01-25 Werner Koch <wk@gnupg.org>
825 * iso7816.c (iso7816_select_application): P1 kludge for OpenPGP
827 * app-openpgp.c (find_tlv): Factor out this function to ..
828 * tlv.c, tlv.h: .. new.
830 * scdaemon.h: Introduced app_t and ctrl_t as the new types for APP
833 2004-01-21 Werner Koch <wk@gnupg.org>
835 * apdu.c (apdu_send_le): Treat SW_EOF_REACHED as a warning.
837 2004-01-20 Werner Koch <wk@gnupg.org>
839 * iso7816.c (iso7816_read_binary): New.
840 (iso7816_select_file): New.
841 (iso7816_list_directory): New.
843 * sc-investigate.c: Add option -i.
844 (select_app, read_line, interactive_shell): New.
846 2004-01-16 Werner Koch <wk@gnupg.org>
848 * apdu.h: Add SW_FILE_NOT_FOUND.
849 * iso7816.c (map_sw): Map it to GPG_ERR_ENOENT.
850 * iso7816.c (iso7816_select_file): New.
852 * app-dinsig.c: New file w/o any real code yet.
853 * Makefile.am (scdaemon_SOURCES,sc_investigate_SOURCES): Add file.
855 * sc-investigate.c: Add option --disable-ccid.
857 2003-12-19 Werner Koch <wk@gnupg.org>
859 * apdu.c (apdu_send_le): Send a get_response with the indicated
860 length and not the 64 bytes we used for testing.
862 * app-openpgp.c (verify_chv2, verify_chv3, do_sign): Check the
863 minimum length of the passphrase, so that we don't need to
864 decrement the retry counter.
866 2003-12-17 Werner Koch <wk@gnupg.org>
868 * card-p15.c (p15_enum_keypairs): Replaced KRC by RC.
869 * card-dinsig.c (dinsig_enum_keypairs): Ditto.
871 2003-12-16 Werner Koch <wk@gnupg.org>
873 * scdaemon.c (main): Set the prefixes for assuan logging.
875 2003-11-17 Werner Koch <wk@gnupg.org>
877 * scdaemon.c, scdaemon.h: New options --allow-admin and --deny-admin.
878 * app-openpgp.c (verify_chv3): Check it here.
880 2003-11-12 Werner Koch <wk@gnupg.org>
882 Adjusted for API changes in Libksba.
884 2003-10-30 Werner Koch <wk@gnupg.org>
886 * apdu.c (close_ct_reader, close_pcsc_reader): Implemented.
887 (get_ccid_error_string): New. Not very useful messages, though.
889 2003-10-25 Werner Koch <wk@gnupg.org>
891 * ccid-driver.c (ccid_open_reader): Return an error if no USB
894 * command.c (cmd_genkey, cmd_passwd): Fixed faulty use of
897 * apdu.c (apdu_open_reader): Hacks for PC/SC under Windows.
899 2003-10-20 Werner Koch <wk@gnupg.org>
901 * command.c (cmd_checkpin): New.
902 (register_commands): Add command CHECKPIN.
903 * app.c (app_check_pin): New.
904 * app-openpgp.c (check_against_given_fingerprint): New. Factored
905 out that code elsewhere.
908 2003-10-10 Werner Koch <wk@gnupg.org>
910 * ccid-driver.c (ccid_close_reader): New.
912 * apdu.c (close_ccid_reader, close_ct_reader, close_csc_reader)
913 (close_osc_reader, apdu_close_reader): New. Not all are properly
916 2003-10-09 Werner Koch <wk@gnupg.org>
918 * ccid-driver.c (ccid_transceive): Add T=1 chaining for sending.
920 2003-10-08 Werner Koch <wk@gnupg.org>
922 * app-openpgp.c (do_getattr): Support SERIALNO and AID.
924 2003-10-01 Werner Koch <wk@gnupg.org>
926 * ccid-driver.c: Detect GnuPG 1.3 and include appropriate files.
928 * app-openpgp.c: Ditto.
930 (generate_keypair): Renamed to ..
931 (do_generate_keypair): .. this.
932 * app-common.h [GNUPG_MAJOR_VERSION]: New.
933 * iso7816.h [GNUPG_MAJOR_VERSION]: Include cardglue.h
935 2003-09-30 Werner Koch <wk@gnupg.org>
937 * command.c (cmd_getattr): New command GETATTR.
938 * app.c (app_setattr): New.
940 (do_learn_status): Reimplemented in terms of do_getattr.
942 * app-openpgp.c (do_change_pin): Make sure CVH1 and CHV2 are
944 (verify_chv2, verify_chv3): New. Factored out common code.
945 (do_setattr, do_sign, do_auth, do_decipher): Change the names of
946 the prompts to match that we have only 2 different PINs.
947 (app_select_openpgp): Check whether the card enforced CHV1.
948 (convert_sig_counter_value): New. Factor out code from
951 2003-09-28 Werner Koch <wk@gnupg.org>
953 * app-openpgp.c (dump_all_do): Use gpg_err_code and not gpg_error.
955 2003-09-19 Werner Koch <wk@gnupg.org>
957 * ccid-driver.c (parse_ccid_descriptor): New.
958 (read_device_info): New.
959 (ccid_open_reader): Check that the device has all required features.
961 2003-09-06 Werner Koch <wk@gnupg.org>
963 * scdaemon.c (main): --pcsc-driver again defaults to pcsclite.
964 David Corcoran was so kind to remove the GPL incompatible
965 advertisng clause from pcsclite.
966 * apdu.c (apdu_open_reader): Actually make pcsc-driver option work.
968 2003-09-05 Werner Koch <wk@gnupg.org>
970 * ccid-driver.c: More work, data can now actually be retrieved.
971 * ccid-driver.c, ccid-driver.h: Alternativley allow use under BSD
974 2003-09-02 Werner Koch <wk@gnupg.org>
976 * scdaemon.c, scdaemon.h: New option --pcsc-ccid.
977 * ccid-driver.c, ccid-driver.h: New but far from being useful.
978 * Makefile.am: Add above.
979 * apdu.c: Add support for that ccid driver.
981 2003-08-26 Timo Schulz <twoaday@freakmail.de>
983 * apdu.c (new_reader_slot): Only set 'is_osc' when OpenSC
986 2003-08-25 Werner Koch <wk@gnupg.org>
988 * command.c (cmd_setattr): Use a copy of LINE.
989 (cmd_genkey): Use a copy of KEYNO.
990 (cmd_passwd): Use a copy of CHVNOSTR.
991 (cmd_pksign, cmd_pkauth, cmd_pkdecrypt): s/strdup/xtrystrdup/.
993 2003-08-19 Werner Koch <wk@gnupg.org>
995 * scdaemon.c, scdaemon.h: New option --pcsc-driver.
996 * apdu.c (apdu_open_reader): Use that option here instead of a
999 2003-08-18 Werner Koch <wk@gnupg.org>
1001 * Makefile.am: Add OPENSC_LIBS to all programs.
1003 * scdaemon.c, scdaemon.h: New option --disable-opensc.
1004 * card.c (card_open): Implement it.
1005 * apdu.c (open_osc_reader, osc_send_apdu): New.
1006 (apdu_open_reader) [HAVE_OPENSC]: Use the opensc driver if not
1008 (error_string) [HAVE_OPENSC]: Use sc_strerror.
1009 (send_apdu) [HAVE_OPENSC]: Call osc_apdu_send.
1011 * card-p15.c (p15_enum_keypairs, p15_prepare_key): Adjusted for
1014 2003-08-14 Timo Schulz <twoaday@freakmail.de>
1016 * apdu.c (ct_activate_card): Change the code a little to avoid
1017 problems with other readers.
1018 * Always use 'dynload.h' instead of 'dlfcn.h'.
1020 2003-08-05 Werner Koch <wk@gnupg.org>
1022 * app-openpgp.c (dump_all_do): Don't analyze constructed DOs after
1025 2003-08-04 Werner Koch <wk@gnupg.org>
1027 * app.c (app_set_default_reader_port): New.
1028 (select_application): Use it here.
1029 * scdaemon.c (main): and here.
1030 * sc-copykeys.c: --reader-port does now take a string.
1031 * sc-investigate.c, scdaemon.c: Ditto.
1032 * apdu.c (apdu_open_reader): Ditto. Load pcsclite if no ctapi
1033 driver is configured. Always include code for ctapi.
1034 (new_reader_slot): Don't test for already used ports and remove
1036 (open_pcsc_reader, pcsc_send_apdu, pcsc_error_string): New.
1037 (apdu_send_le): Changed RC to long to cope with PC/SC.
1039 * scdaemon.c, scdaemon.h: New option --ctapi-driver.
1040 * sc-investigate.c, sc-copykeys.c: Ditto.
1042 2003-07-31 Werner Koch <wk@gnupg.org>
1044 * Makefile.am (scdaemon_LDADD): Added INTLLIBS.
1046 2003-07-28 Werner Koch <wk@gnupg.org>
1048 * app-openpgp.c (do_setattr): Change implementation. Allow all
1051 2003-07-27 Werner Koch <wk@gnupg.org>
1053 Adjusted for gcry_mpi_print and gcry_mpi_scan API change.
1055 2003-07-24 Werner Koch <wk@gnupg.org>
1057 * app-openpgp.c (do_learn_status): Print more status information.
1058 (app_select_openpgp): Store the card version.
1059 (store_fpr): Add argument card_version and fix DOs for old cards.
1060 (app_openpgp_storekey): Likewise.
1062 2003-07-23 Werner Koch <wk@gnupg.org>
1064 * command.c (cmd_pkauth): New.
1065 (cmd_setdata): Check whether data was given at all to avoid
1066 passing 0 to malloc.
1068 * app.c (app_auth): New.
1069 * app-openpgp.c (do_auth): New.
1071 2003-07-22 Werner Koch <wk@gnupg.org>
1073 * command.c (cmd_passwd): New.
1074 * app.c (app_change_pin): New.
1075 * app-openpgp.c (do_change_pin): New.
1076 * iso7816.c (iso7816_reset_retry_counter): Implemented.
1078 * sc-investigate.c (main): New option --gen-random.
1079 * iso7816.c (iso7816_get_challenge): Don't create APDUs with a
1080 length larger than 255.
1082 2003-07-17 Werner Koch <wk@gnupg.org>
1084 * command.c (cmd_random): New command RANDOM.
1086 * iso7816.c (map_sw): New. Use it in this file to return
1087 meaningful error messages. Changed all public fucntions to return
1089 (iso7816_change_reference_data): New.
1090 * apdu.c (apdu_open_reader): Use faked status words for soem
1093 2003-07-16 Werner Koch <wk@gnupg.org>
1095 * apdu.c (apdu_send_simple): Use apdu_send_le so that we can
1096 specify not to send Le as it should be.
1098 2003-07-15 Werner Koch <wk@gnupg.org>
1100 * Makefile.am: Add sc-copykeys program.
1101 * sc-copykeys.c: New.
1102 * app-openpgp.c (app_openpgp_storekey): New.
1103 (app_openpgp_cardinfo): New.
1105 (store_fpr): And use it here to get the actual length in bit.
1107 2003-07-03 Werner Koch <wk@gnupg.org>
1109 * app-openpgp.c (do_setattr): Add setting of the URL.
1110 (app_select_openpgp): Dump card data only in very verbose mode.
1113 2003-07-02 Werner Koch <wk@gnupg.org>
1115 * app-openpgp.c (get_sig_counter): New.
1116 (do_sign): Print the signature counter and enable the PIN callback.
1117 (do_genkey): Implement the PIN callback.
1119 2003-07-01 Werner Koch <wk@gnupg.org>
1121 * app-openpgp.c (store_fpr): Fixed fingerprint calculation.
1123 2003-06-26 Werner Koch <wk@gnupg.org>
1125 * app-openpgp.c (find_tlv): Fixed length header parsing.
1127 * app.c (app_genkey): New.
1128 * command.c (cmd_genkey): New.
1130 2003-06-25 Werner Koch <wk@gnupg.org>
1132 * command.c (percent_plus_unescape): New.
1135 2003-06-24 Werner Koch <wk@gnupg.org>
1137 * command.c (send_status_info): New.
1139 * app-openpgp.c (app_select_openpgp): Replace SLOT arg by APP arg
1140 and setup the function pointers in APP on success. Changed callers.
1142 * app-common.h: New.
1143 * scdaemon.h (APP): New type to handle applications.
1144 (server_control_s): Add an APP context field.
1146 * command.c (cmd_serialno): Handle applications.
1147 (cmd_pksign): Ditto.
1148 (cmd_pkdecrypt): Ditto.
1149 (reset_notify): Ditto.
1150 (cmd_learn): For now return error for application contexts.
1151 (cmd_readcert): Ditto.
1152 (cmd_readkey): Ditto.
1154 2003-06-04 Werner Koch <wk@gnupg.org>
1156 * card.c (map_sc_err): Renamed gpg_make_err to gpg_err_make.
1158 Renamed error codes from INVALID to INV and removed _ERROR suffixes.
1160 2003-06-03 Werner Koch <wk@gnupg.org>
1162 Changed all error codes in all files to the new libgpg-error scheme.
1164 * scdaemon.h: Include gpg-error.h and errno.h
1165 * card.c (map_sc_err): Use unknown for the error source.
1166 * Makefile.am: Link with libgpg-error
1168 2003-05-14 Werner Koch <wk@gnupg.org>
1170 * atr.c, atr.h: New.
1171 * sc-investigate.c: Dump the ATR in a human readable format.
1173 2003-05-08 Werner Koch <wk@gnupg.org>
1175 * scdaemon.h (DBG_CARD_IO_VALUE): New.
1177 * sc-investigate.c: New.
1178 * scdaemon.c (main): Removed --print-atr option.
1180 * iso7816.c, iso7816.h, app-openpgp.c: New.
1182 2003-04-29 Werner Koch <wk@gnupg.org>
1184 * scdaemon.c: New options --print-atr and --reader-port
1185 * apdu.c, apdu.h: New
1187 * card.c, card-p15.c, card-dinsig.c: Allow build without OpenSC.
1189 * Makefile.am (LDFLAGS): Removed.
1191 * command.c (register_commands): Adjusted for new Assuan semantics.
1193 2002-08-21 Werner Koch <wk@gnupg.org>
1195 * scdaemon.c (main): New option --daemon so that the program is
1196 not accidently started in the background.
1198 2002-08-16 Werner Koch <wk@gnupg.org>
1200 * scdaemon.c: Include i18n.h.
1202 * card-common.h (struct p15_private_s): Forward declaration. Add
1204 * card.c (card_close): Make sure private data is released.
1205 (card_enum_certs): New.
1206 * card-p15.c (p15_release_private_data): New.
1207 (init_private_data): New to work around an OpenSC weirdness.
1208 (p15_enum_keypairs): Do an OpenSC get_objects only once.
1209 (p15_enum_certs): New.
1210 (card_p15_bind): Bind new function.
1211 * command.c (cmd_learn): Return information about the certificates.
1213 2002-08-09 Werner Koch <wk@gnupg.org>
1215 * card.c (card_get_serial_and_stamp): Use the tokeinfo serial
1216 number as a fallback. Add a special prefix for serial numbers.
1218 2002-07-30 Werner Koch <wk@gnupg.org>
1220 Changes to cope with OpenSC 0.7.0:
1222 * card.c: Removed the check for the packed opensc version.
1223 Changed include file names of opensc.
1224 (map_sc_err): Adjusted error codes for new opensc version.
1225 * card-p15.c: Changed include filename of opensc.
1226 * card-dinsig.c: Ditto.
1228 * card-p15.c (p15_decipher): Add flags argument to OpenSC call.
1230 2002-07-24 Werner Koch <wk@gnupg.org>
1232 * card.c (find_simple_tlv, find_iccsn): New.
1233 (card_get_serial_and_stamp): Improved serial number parser.
1235 2002-06-27 Werner Koch <wk@gnupg.org>
1237 * scdaemon.c (main): Use GNUPG_DEFAULT_HOMEDIR constant.
1239 2002-06-15 Werner Koch <wk@gnupg.org>
1241 * card-dinsig.c: Documented some stuff from the DIN norm.
1243 2002-04-15 Werner Koch <wk@gnupg.org>
1245 * command.c (cmd_pksign, cmd_pkdecrypt): Use a copy of the key ID.
1247 2002-04-12 Werner Koch <wk@gnupg.org>
1249 * scdaemon.c: New option --debug-sc N.
1250 * card.c (card_open): set it here.
1252 * card-p15.c (p15_prepare_key): Factored out common code from ...
1253 (p15_sign, p15_decipher): here and made the decryption work the
1256 2002-04-10 Werner Koch <wk@gnupg.org>
1258 * card.c (card_open): Return immediately when no reader is available.
1260 2002-03-27 Werner Koch <wk@gnupg.org>
1262 * card.c (card_open, card_close): Adjusted for changes in OpenSC.
1264 2002-03-10 Werner Koch <wk@gnupg.org>
1266 * card-p15.c, card-dinsig.c, card-common.h: New.
1267 * card.c: Factored most code out to the new modules, so that we
1268 can better support different types of card applications.
1270 2002-01-26 Werner Koch <wk@gnupg.org>
1272 * scdaemon.c scdaemon.h, command.c: New. Based on the code from
1276 Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
1278 This file is free software; as a special exception the author gives
1279 unlimited permission to copy and/or distribute it, with or without
1280 modifications, as long as this notice is preserved.
1282 This file is distributed in the hope that it will be useful, but
1283 WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
1284 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.