Commit Graph

54 Commits

Author SHA1 Message Date
Viktor Tarasov f641ebd248 fixed errors reported by cppcheck: part 1
partially applied the pull request #182 from Frank Morgner -- updated the common frameworks source files
2013-09-29 20:28:45 +02:00
Viktor Tarasov c66278098b tools: missing names for ACL methods
thanks to fdeybach@gmail.com
https://sourceforge.net/mailarchive/message.php?msg_id=30684430
2013-04-06 22:06:52 +02:00
Viktor Tarasov 8c342ec772 tools: t404: redesign treatment of 'reader' option
in previous version
first of all the 'reader' option's value was converted to hexadecimal form,
used as ATR value
and all present readers where scanned to find the inserted card with such ATR.
Only after this the 'reader' option was used as reader's number or reader's name.

Currently in use the 'hex-to-bin' procedure accepts for conversion one digit,
and so even if the 'reader' option value is one digit,
the useless search over all present readers take place.

In the current version the order of checks if kept (ATR, reader's number, reader's name),
but enforced the validity check of ATR, presented by 'reader' option.
Also the option is accepted as reader's number only if the 'entire' option's string can be converted to integer.

Thanks to 'jbwisemo' for cooperation.
https://www.opensc-project.org/opensc/ticket/404
2012-08-30 18:51:54 +02:00
Viktor Tarasov ca08e97ab7 pkcs11: #162,#370,#115,#413: reselect application DF issue
Limit the number of cases when applicated re-selection of application DF to strict minimum.
I.e. only when pkcs11 login session is not locked and private key PKCS#15 object do not
contain the 'path' attribute.
2012-08-19 18:18:59 +02:00
Peter Marschall 825c8578a9 tools: fix typo/thinko in util_print_usage_and_die()
Fix a typo/thinko in util_print_usage_and_die() that led to the short option
names not to be shown at all.
2012-06-08 20:32:33 +02:00
Viktor Tarasov 53330f9f89 tools: avoid possible matching of zero length ATR 2012-06-01 16:58:47 +02:00
Peter Marschall 93cb77079b tools: re-factor usage message function
* change order of long & short option names: letters first, then the long names
  Effect: nicely aligned short and long option names in the help text
* more space between option names and explanation
  Effect: better readability on long options
* print "Options:" header only if there is at least one non-hidden options
  Effect: nicer output when all options are hidden
* only show printable, non-space short options letters
  Effect: no control codes printed to terminal
* get rid of a temporary variable
2012-05-30 09:39:12 +02: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 Paljak 10ae35fd57 Add LGPL header with a generic copyright to util.c
Individual copyright should be delegated to individual commits.
2011-09-13 21:50:20 +03: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
martin 3e18e0838d Fix compiler warning
util.c: In function ‘util_getpass’:
util.c:348: warning: comparison between signed and unsigned

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5018 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-02 12:55:10 +00:00
martin 16726a55b5 tools: allow to specify an ATR in the --reader option.
This facilitates automated testing on a single machine with several identical readers with inserted cards.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5016 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-02 12:54:57 +00:00
viktor.tarasov 73c516a7a0 pkcs11: resolve 'endless polling' in C_WaitForSlotEvent()
http://www.opensc-project.org/pipermail/opensc-devel/2010-April/013947.html

Tested with Firefox 3.6.3 in WinXP SP3 .




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4363 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-19 09:18:38 +00:00
viktor.tarasov f17ca0fd74 tools: in local 'getpass' procedure getline() is not used any more
Without GNU C extention 'getline()' the same code of the local 'getpass' procedure is used for Mac OS and Linux.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4272 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-28 09:20:18 +00:00
viktor.tarasov 7d5b34d4e8 tools: thanks to Andreas; for win32 'get password' procedure uses _getch() instead of getchar()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4268 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-27 07:30:38 +00:00
viktor.tarasov 122d357fde tools: thanks to Ludovic; check for getline() in configure.ac and use 'HAVE_GETLINE' macro in get password procedure.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4266 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-26 12:29:42 +00:00
viktor.tarasov d0618ba24c tools: #120: 'getpass' sensible to Ctrl-C, thanks to Andreas
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4249 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-18 07:47:16 +00:00
ludovic.rousseau 4ce1e8c831 Rename parameter wait in do_wait
util.c:11: warning: declaration of ‘wait’ shadows a global declaration
/usr/include/sys/wait.h:255: warning: shadowed declaration is here


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4180 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-29 08:23:07 +00:00
ludovic.rousseau cf8a7f894f use a (const char *) for the reader_id and fix 2 warnings
opensc-explorer.c:1606: warning: passing argument 3 of
‘util_connect_card’ discards qualifiers from pointer target type
rutoken-tool.c:492: warning: passing argument 3 of ‘util_connect_card’
discards qualifiers from pointer target type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4179 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-29 08:20:27 +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 b3428a684d [tools] If started with --wait, also wait for a reader if necessary.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3988 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-03 09:58:37 +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 ff9951d94d kill lots of warnings (unused variables, unsigned/signed comparison etc.)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3765 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-06 07:36:51 +00:00
martin de89aa47e7 Fixes #109
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3600 c6295689-39f2-0310-b995-f0e70906c6a9
2008-12-06 11:41:00 +00:00
martin a7967258aa DWIM: If you don't specify a reader on the command line and you have more than one reader (for example, OpenCT virtual readers and one existing PC/SC reader) the tools will skip to the first reader that has a card in it.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3597 c6295689-39f2-0310-b995-f0e70906c6a9
2008-12-05 15:48:49 +00:00
alonbl 0a809dd5cb Complete rewrite of OpenSC build system.
1.  Build system now supports MinGW (Windows) compilation using msys and cross compilation.
2.  Ability to explicitly disable and enable dependencies of the package.
3.  openct, pcsc and nsplugins features are disabled by default.
4.  Modified pcsc driver to use pcsc dynamically, no compile time dependency is required.
5.  --enable-pcsc-lite configuration option renamed to --enable-pcsc.
6.  Install opensc.conf file (as opensc.conf.new if opensc.conf exists).
7.  Add--enable-doc configuration option, allow installing documentation into target.
8.  Add --disable-man configuration option, allow msys mingw32 users to
    build from svn without extra dependencies.
9.  Add export files to each library in order to export only required symbols.
    Windows native build may use these files instead of scanning objects' symbols.
10. Add opensc-tool --info to display some general information about the build.
11. Create compatibility library to be linked against library instread of recompiling the
    same source files in different places.
12. Add different win32 version resource to each class of outputs.
13. Make xsl-stylesheets location selectable.
14. Some win32 fixups.
15. Some warning fixups.
16. Many other autoconf/automake cleanups.

Alon Bar-Lev

svn diff -r 3315:3399 https://www.opensc-project.org/svn/opensc/branches/alonbl/mingw

_M   .
D    configure.in
_M   src
_M   src/openssh
M    src/openssh/Makefile.am
_M   src/tools
M    src/tools/rutoken-tool.c
M    src/tools/opensc-tool.c
M    src/tools/cardos-info.c
M    src/tools/pkcs15-crypt.c
M    src/tools/pkcs15-init.c
M    src/tools/piv-tool.c
M    src/tools/netkey-tool.c
M    src/tools/eidenv.c
M    src/tools/cryptoflex-tool.c
M    src/tools/util.c
M    src/tools/pkcs11-tool.c
M    src/tools/pkcs15-tool.c
M    src/tools/util.h
M    src/tools/opensc-explorer.c
M    src/tools/Makefile.am
_M   src/pkcs11
M    src/pkcs11/pkcs11-global.c
M    src/pkcs11/framework-pkcs15.c
M    src/pkcs11/mechanism.c
M    src/pkcs11/pkcs11-display.c
M    src/pkcs11/pkcs11-object.c
A    src/pkcs11/opensc-pkcs11.exports
M    src/pkcs11/sc-pkcs11.h
M    src/pkcs11/pkcs11-spy.c
M    src/pkcs11/openssl.c
M    src/pkcs11/Makefile.am
A    src/pkcs11/pkcs11-spy.exports
_M   src/tests
_M   src/tests/regression
M    src/tests/regression/Makefile.am
M    src/tests/sc-test.c
M    src/tests/pintest.c
M    src/tests/Makefile.am
_M   src/include
_M   src/include/opensc
M    src/include/opensc/Makefile.am
A    src/include/opensc/svnignore
M    src/include/Makefile.am
_M   src/signer
_M   src/signer/npinclude
M    src/signer/npinclude/Makefile.am
M    src/signer/Makefile.am
A    src/signer/signer.exports
_M   src/common
A    src/common/compat_dummy.c
D    src/common/getopt.txt
D    src/common/strlcpy.c
D    src/common/LICENSE
A    src/common/compat_getopt.txt
A    src/common/compat_strlcpy.c
A    src/common/LICENSE.compat_getopt
A    src/common/compat_getopt.c
D    src/common/strlcpy.h
D    src/common/ChangeLog
D    src/common/getpass.c
D    src/common/my_getopt.c
A    src/common/compat_strlcpy.h
A    src/common/compat_getpass.c
A    src/common/compat_getopt.h
A    src/common/ChangeLog.compat_getopt
D    src/common/README.strlcpy
D    src/common/my_getopt.h
A    src/common/compat_getpass.h
A    src/common/README.compat_strlcpy
D    src/common/strlcpy.3
A    src/common/README.compat_getopt
D    src/common/getopt.3
D    src/common/README.my_getopt
A    src/common/compat_strlcpy.3
A    src/common/compat_getopt.3
M    src/common/Makefile.am
M    src/Makefile.am
_M   src/pkcs15init
M    src/pkcs15init/pkcs15-oberthur.c
M    src/pkcs15init/profile.c
M    src/pkcs15init/pkcs15-lib.c
M    src/pkcs15init/pkcs15-rutoken.c
A    src/pkcs15init/pkcs15init.exports
M    src/pkcs15init/pkcs15-gpk.c
M    src/pkcs15init/Makefile.am
_M   src/scconf
M    src/scconf/Makefile.am
M    src/scconf/parse.c
A    src/scconf/scconf.exports
_M   src/libopensc
M    src/libopensc/card-rutoken.c
M    src/libopensc/compression.c
M    src/libopensc/sc.c
M    src/libopensc/card-piv.c
M    src/libopensc/pkcs15-openpgp.c
M    src/libopensc/pkcs15-postecert.c
M    src/libopensc/pkcs15-tcos.c
M    src/libopensc/opensc-config.in
M    src/libopensc/reader-pcsc.c
A    src/libopensc/internal-winscard.h
M    src/libopensc/ctx.c
A    src/libopensc/libopensc.exports
M    src/libopensc/pkcs15-piv.c
M    src/libopensc/pkcs15-infocamere.c
M    src/libopensc/internal.h
M    src/libopensc/pkcs15-actalis.c
M    src/libopensc/pkcs15-starcert.c
M    src/libopensc/card-oberthur.c
M    src/libopensc/pkcs15-atrust-acos.c
M    src/libopensc/p15card-helper.c
D    src/libopensc/part10.h
M    src/libopensc/ui.c
M    src/libopensc/card-gpk.c
M    src/libopensc/pkcs15-wrap.c
M    src/libopensc/pkcs15-gemsafeGPK.c
M    src/libopensc/log.c
M    src/libopensc/pkcs15-esteid.c
M    src/libopensc/pkcs15-prkey-rutoken.c
M    src/libopensc/log.h
M    src/libopensc/Makefile.am
M    src/libopensc/reader-openct.c
_M   aclocal
M    aclocal/Makefile.am
_M   win32
M    win32/Makefile.am
A    win32/versioninfo.rc.in
A    win32/ltrc.inc
A    configure.ac
_M   doc
_M   doc/tools
M    doc/tools/pkcs15-profile.xml
D    doc/changelog.sh
D    doc/export-wiki.xsl
_M   doc/api
_M   doc/api/file
M    doc/api/man.xsl
_M   doc/api/asn1
_M   doc/api/apps
_M   doc/api/init
_M   doc/api/types
_M   doc/api/card
M    doc/api/html.xsl
_M   doc/api/misc
_M   doc/api/util
M    doc/Makefile.am
D    doc/export-wiki.sh
AM   doc/nonpersistent
A    doc/nonpersistent/export-wiki.xsl
A    doc/nonpersistent/Makefile.am
A    doc/nonpersistent/export-wiki.sh
A    doc/nonpersistent/svn2cl.xsl
D    doc/generate-man.sh
D    doc/svn2cl.xsl
M    Makefile.am
A    svnignore
_M   etc
M    etc/opensc.conf.in
M    etc/Makefile.am
D    man
_M   solaris
M    solaris/Makefile



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3405 c6295689-39f2-0310-b995-f0e70906c6a9
2008-03-06 16:06:59 +00:00
ludovic.rousseau e9135ff347 print_binary(): everything except printable characters (including space)
are displayed in hex

Thanks to Ian Young for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2008-January/010641.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3313 c6295689-39f2-0310-b995-f0e70906c6a9
2008-01-04 13:13:53 +00:00
ludovic.rousseau be309330e5 do not use global variables app_name, options and option_help so they
can be static


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3188 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 13:46:08 +00:00
nils 9c42d1dc8c use sc_ctx_get_reader() etc. instead of of accessing the structure members directly
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2848 c6295689-39f2-0310-b995-f0e70906c6a9
2006-02-15 17:29:40 +00:00
nils d02aaf37de fix warning
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2841 c6295689-39f2-0310-b995-f0e70906c6a9
2006-02-14 22:04:47 +00:00
nils fa65fbf285 summary: - add new function sc_format_oid to libopensc
- cleanup libopensc api


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2670 c6295689-39f2-0310-b995-f0e70906c6a9
2005-10-30 18:05:30 +00:00
bert eb4717ea17 API fixup: use defined type instead of struct for exposed structs (part 2)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2233 c6295689-39f2-0310-b995-f0e70906c6a9
2005-03-09 00:04:44 +00:00
nils bfe73f3b71 improve pkcs15-init + pkcs15-tool support for data objects
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1887 c6295689-39f2-0310-b995-f0e70906c6a9
2004-08-14 13:43:17 +00:00
nils bfd5b49436 pkcs15-init etc. support for pkcs15 data objects
patch supplied by Victor Tarasov <vtarasov@idealx.com>


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1877 c6295689-39f2-0310-b995-f0e70906c6a9
2004-07-26 18:47:23 +00:00
aj 9b7cdbffad cleanup debug/quiet/verbose handling.
now all tools accept "-v" for verbose
operation, and you can specify -v several
times to get more verbose i.e. debugging
output.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1792 c6295689-39f2-0310-b995-f0e70906c6a9
2004-06-13 20:13:12 +00:00
okir beb86f351b - util.c:connect_card() now locks the card; removed sc_lock calls from
calling applications (based on a bug report by Chaskiel)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1699 c6295689-39f2-0310-b995-f0e70906c6a9
2003-12-29 13:06:28 +00:00
okir da8dfa9e66 - fix for previous change
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1143 c6295689-39f2-0310-b995-f0e70906c6a9
2003-05-16 19:11:38 +00:00
okir 35a12ea868 - print_usage_and_die: skip hidden options
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1142 c6295689-39f2-0310-b995-f0e70906c6a9
2003-05-16 16:41:53 +00:00
okir 5b1eb43b93 - add some support for card removal in pkcs11
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@867 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-19 17:47:07 +00:00
okir e60c9d705e - fix the help message for --very-long-options
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@850 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-09 09:09:01 +00:00
okir 608debfc15 - Tools did not work unless -w switch was given
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@836 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-06 11:03:17 +00:00
okir 65ead88908 - New function connect_card() - this does all the work of connecting
to the card, optionally waiting for card insertion using sc_wait_for_event


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@826 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-03 16:57:46 +00:00
aet 3dccd63989 - C++ support. Compiles with gcc/g++ for Linux, otherwise
completely untested.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@574 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-19 14:23:31 +00:00
jey f21926af00 - Started to add configuration file support to
libopensc
- Added typedefs for some basic structs (e.g.
  struct sc_card --> sc_card_t)
- Added a second argument to sc_establish_context()
  to identify the calling application
- Renamed sc_destroy_context() to sc_release_context()


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@378 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-24 14:12:38 +00:00
aet 4aa18a9ff9 Added support for checking libreadline and use it
for opensc-explorer if one is found.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@235 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-25 16:30:38 +00:00
jey e78dc96440 - added ATR for RSA SecurID 3100
- exported pkcs15_encode_* functions
- minor modification to sc_file_add_acl_entry()
- boosted up opensc-explorer
- added error(), warn() and fatal()
- implemented a generic PKCS #15 structure generation tool


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@215 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-21 18:53:23 +00:00
jey 61fc1f9327 - all instances struct sc_file should now be
dynamically allocated with sc_file_new() and released
  with sc_file_free()
- improved ACL's
- moved struct sc_card_error to opensc.h
- moved EF(DIR) parsing and encoding to dir.c
  (encoding is not working yet)
- removed hst-test.c and filetest.c


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@213 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-20 09:56:47 +00:00
jey c1cac5f311 - bumped up version number in preparation of the new release
- unified PKCS #15 DF decoding
- added PKCS #15 file caching


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@191 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-24 16:02:54 +00:00
jey 452b9d4193 - pretty much finished the DER encoder
- added delete and create file support for 'flex cards
- PKCS #15 DF's are now stored more flexibly; this makes
  adding new types of DF's (such as PuKDF's) easier
- added 'get' and 'put' commands to opensc-explorer


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@160 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-13 23:56:13 +00:00