Commit Graph

48 Commits

Author SHA1 Message Date
Peter Marschall 58ecb4aba2 cardos-tool: cleanup
- remove command line option '--card-driver';
- instead force driver 'cardos' and fail if card is not a CardOS card
- overhaul option parsing
      - remove unused variable 'long_optind'
      - bail out with usage message on all unknown/unhandled args
      - correctly terminate option parsing (no infinite loop)
2020-01-12 09:40:54 +01:00
Peter Marschall a10368769c cardos-tool: make '--card-driver ?' list all available drivers
Extend cardos-tool the same way opensc-explorer was extended. I.e.
treat the question mark given as argument to option '--card-driver'
special: list all available drivers instead of stupidly bailing out.

In contrast to opensc-tool and opensc-explorer, which are card-agnostic,
I am not sure whether the option '--card-driver' makes sense on this
card-specific tool.
2020-01-12 09:36:49 +01:00
Frank Morgner 6472027848 tools: release context when card connection fails 2019-03-07 22:18:54 +02:00
Frank Morgner 070370895f fixed 333707 Dereference before null check 2019-03-06 00:42:38 +01:00
Frank Morgner c858d4b3d1 fixed argument checking 2019-02-14 09:22:23 +01:00
Frank Morgner fbb4d1f843 tools: use consistent behavior of -v
-v switches to debug output to stderr in OpenSC tools regardless of the opensc.conf setting
2019-01-15 07:30:46 +01:00
Peter Marschall 5abe99d228 fix typos
Mass-typo fixing, almost exclusively in comments and text strings.

While at it also fixed a few (very few) grammar errors.
2018-04-15 09:34:45 +02:00
Frank Morgner 04a7075290 fixed compiler warnings 2017-11-09 12:42:29 +01:00
Jakub Jelen 789dd16320 List human-readable version in the cardos-tool 2017-09-02 00:19:35 +02:00
Maciej S. Szmigiero b646a306dc Print size_t variables on properly on Windows
OpenSC used SUSv3 "z" printf length modifier for printing size_t variables,
however this modifier is not available on Windows ("I" must be used
instead), at least for now.

Introduce SC_FORMAT_LEN_SIZE_T define for that purpose and convert existing
code to use it when printing size_t variables.

This define can't go into libopensc/internal.h since tools use it, too.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 10:57:21 +02:00
Frank Morgner 9a4b58800b fixed Printf arg type mismatch 2015-01-24 20:00:03 +01:00
Frank Morgner ec2eb86bec don't reimplement output of status words
Closes #326
2014-12-07 23:54:32 +01:00
Etienne Cordonnier 9cbec38cfa Fix bug in verbose flag handling.
Using the verbose flag was causing cardos-tool to return as if an error
had occured.
2014-12-07 23:54:09 +01:00
Jean-Pierre Szikora ad91449c87 Gives the "Current Maximum Data Field Length" for CardOS card in cardos-tool -i. 2013-06-21 10:46:35 +02:00
Jean-Pierre Szikora f6b1b0c873 ATR status in GET DATA is 0x80 with a custom ATR 2012-12-05 10:03:52 +01:00
Jean-Pierre Szikora 9ad8cd96ac CardOS V5.0 is recognized now. Some useful infos are given with cardostool -i,
but the card is still not supported by other tools.
2012-12-05 10:03:52 +01:00
Peter Marschall 367ebd94d4 tools: allow arguments to be printed in usage message
Extend util_print_usage_and_die() by a string argument that describes
further arguments to the program.

1st user: opensc-explorer
2012-05-30 09:39:12 +02:00
Viktor Tarasov cb13633634 remove trailing whitespaces
inspired by
http://www.opensc-project.org/pipermail/opensc-devel/2012-March/017883.html

Change-Id: If170e830d8d9587a31742feffb6fff54cfdf75b4
2012-04-03 00:00:56 +02:00
martin 007d27feeb Introduce sc_ctx_log_to_file to set the debug file of libopensc.
On Windows every DLL has their own file descriptor table, thus specifying
-v from any of the OpenSC tools resulted in a crash when the tool tried to override
ctx->debug_file with stderr.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5359 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-18 10:01:27 +00:00
vtarasov a576582701 libioensc: use 'struct sc_atr' instead of 'u8 *atr, size_t atr_len'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5061 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-07 17:18:58 +00:00
andre 5481e61dad cardos-tool.c: According to ANSI C the type of size_t is always an unsigned type.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5009 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-31 00:00:00 +00:00
martin fa0e236881 Missed these from r4818
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4820 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-20 12:33:07 +00:00
martin 11dc9ba797 cardos-tool: fix handing of --help/--verbose/--debug
--debug was not documented and not used by other tools; --help was not handled.

Thanks to Ludolf Holzheid for noticing this.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4596 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-26 11:18:00 +00:00
jps f9daf30bba cardos-tool.c can be now compiled with OpenSSL 0.9.7 (SHA256 checksum verification is replaced by SHA1)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4401 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-08 14:41:49 +00:00
martin 127136caf8 tools: Mac OS X 10.5 uses OpenSSL 0.9.7 which does not include SHA256 support. Fix building for 10.5.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4400 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-08 10:45:07 +00:00
viktor.tarasov ac41eba3ac win32: merge the branches/vtarasov/opensc-sm.trunk
update win32 compilation;
Unix style line ending in src/pkcs15init/pkcs15-oberthur.h;
variables declaration issue in src/tools/cardos-tool.c.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4280 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-01 12:15:36 +00:00
jps aa4d951101 Support for CardOS 4.4
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4264 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-21 14:38:23 +00:00
ludovic.rousseau 629aef2ee8 Use an argument to cardos_format()
Thanks to Andreas Jellinghaus for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2010-March/013849.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4190 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-01 11:21:57 +00:00
ludovic.rousseau ad648c4a18 Use the correct type (const_DES_cblock *) instead of (const_DES_cblock)
for DES_ecb_encrypt() input and output parameters.

I have no idea how it could have worked.

Fix
cardos-tool.c: In function ‘cardos_sm4h’:
cardos-tool.c:421: warning: passing argument 1 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:421: warning: passing argument 2 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:426: warning: passing argument 1 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:426: warning: passing argument 2 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:432: warning: passing argument 1 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:432: warning: passing argument 2 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:434: warning: passing argument 1 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:434: warning: passing argument 2 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:472: warning: passing argument 1 of ‘DES_ecb3_encrypt’ from incompatible pointer type
cardos-tool.c:472: warning: passing argument 2 of ‘DES_ecb3_encrypt’ from incompatible pointer type
cardos-tool.c:483: warning: passing argument 1 of ‘DES_ecb3_encrypt’ from incompatible pointer type
cardos-tool.c:483: warning: passing argument 2 of ‘DES_ecb3_encrypt’ from incompatible pointer type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4181 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-29 12:55:13 +00:00
aj d22a2483c0 Header file cleanup.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4081 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-04 08:14:36 +00:00
martin 5a0cc50123 tools: remove slots; implement change in sc_disconnect_card(); convert util_connect_card()/--wait to support the changes in r3931
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3933 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-24 15:29:47 +00:00
aj 06aaa718cc Describe now option for --help.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3874 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-02 11:10:16 +00:00
aj 724c3485a6 remove dead code for now - easy to recreate later.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3873 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-02 11:07:45 +00:00
aj 29407cf2d8 fixed and tested by Viktor TARASOV. Thanks!
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3872 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-02 09:52:12 +00:00
aj 5b21dd6a05 basic command to change startkey,
so far untested.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3871 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-01 21:10:06 +00:00
viktor.tarasov b9935bf410 cardos-tool: invalid parsing of the 'common system keys' info
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3870 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-01 11:47:19 +00:00
martin bc1d4c4e06 Fix compiler warnings and a typo
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3835 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-13 11:21:09 +00:00
ludovic.rousseau 8b4a1f673b cardos_sm4h(): fix memory leaks. Thanks to cppckeck(1)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3694 c6295689-39f2-0310-b995-f0e70906c6a9
2009-05-12 14:35:49 +00:00
ludovic.rousseau dd9a40ad0e avoid a compilation failure with --disable-openssl
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3687 c6295689-39f2-0310-b995-f0e70906c6a9
2009-05-06 16:25:50 +00:00
aj a767600ee8 fix apdu length check: 0..3 is wrong (too short). 4 is ok.
5 is not (length byte for data, but no data?). 6 or more is ok
(length byte and data). checking for "5" is not important.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3573 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 14:36:46 +00:00
jps 042d9d06a5 An erased CardOS with a StartKey version 0xFF can now be directly formatted.
Verbose output contains now some useful data.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3572 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 14:21:01 +00:00
jps 8136c8b40f fix some bad crash on Mac
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3571 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 10:38:34 +00:00
jps 524672345b CardOS 4.2C is working too after changing Default StartKey to 16 * 0xFF
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3570 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 09:47:43 +00:00
jps e0d1bb5410 fixing typo
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3569 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 08:35:54 +00:00
aj aee10c8a13 Fix a comment and allow cardos 4.3B too.
Thanks to JP for testing.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3568 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 07:01:34 +00:00
aj cbf0c28d63 fix a few missing \n
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3567 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-19 10:21:14 +00:00
aj 5c29dcdb94 commit changes: cardos-info is now cardos-tool.
and it knows to format, at least some cards/tokens with cardos.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3566 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-18 17:44:54 +00:00
aj 021dfaccba rename files only.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3565 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-18 17:43:38 +00:00