Commit Graph

176 Commits

Author SHA1 Message Date
ludovic.rousseau c8f5ab4fe5 Fix analyzer warnings. The code looked good.
sc.c:667:12: warning: The left operand of '>=' is a garbage value
        if (tx[2] >= 0)
            ~~~~~ ^
sc.c:656:12: warning: The left operand of '>=' is a garbage value
        if (tx[0] >= 0) {
            ~~~~~ ^


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5152 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:59:28 +00:00
ludovic.rousseau 4459b3df6c Fix compiler warnings
sc.c:406:39: warning: missing field 'usage' initializer
      [-Wmissing-field-initializers]
                SC_AC_NEVER, SC_AC_KEY_REF_NONE, {{0}}, NULL
                                                    ^
sc.c:409:38: warning: missing field 'usage' initializer
      [-Wmissing-field-initializers]
                SC_AC_NONE, SC_AC_KEY_REF_NONE, {{0}}, NULL
                                                   ^
sc.c:412:41: warning: missing field 'usage' initializer
      [-Wmissing-field-initializers]
                SC_AC_UNKNOWN, SC_AC_KEY_REF_NONE, {{0}}, NULL
                                                      ^


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5133 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 17:16:54 +00:00
vtarasov 7f5ea5b013 libopensc: export sc_find_app(), remove debug message, ...
avoid double '::' separator in path_print();
touch authentic profile file


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5087 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-12 17:41:10 +00:00
vtarasov 76b0a73a80 tools: reserve more place for the print path and AID buffer ...
to insert the '::' indicator of 'AID' or 'DF_NAME' path type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5084 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-11 10:46:09 +00:00
vtarasov a808379756 libopensc: when printing 'path', print also the value of 'aid' if available.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5075 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-09 17:17:01 +00:00
vtarasov 2b47d90daf libopensc: to be compiled with Visual Studio
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5070 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-09 10:02:43 +00:00
vtarasov f304fed517 libopensc: add 'crts' array to 'struct sc_acl_entry' ...
For some cards the acl bytes, retrived from 'select' response, can reference 
a SE (and not directly PIN).
In such case, to proceed an authentication for the card operation 
the information about the SE's CRTs is needed.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5066 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-09 09:13:47 +00:00
vtarasov 5a7f8a2d60 libopensc: initialize 'sc_path' type variables ...
it's needed to initialize the 'aid' member of 'struct sc_path'


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5064 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-09 08:49:15 +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
ludovic.rousseau f47416d60e Do not cast the return value of malloc(3) and calloc(3)
From http://en.wikipedia.org/wiki/Malloc#Casting_and_type_safety
" Casting and type safety

malloc returns a void pointer (void *), which indicates that it is a
pointer to a region of unknown data type. One may "cast" (see type
conversion) this pointer to a specific type, as in

int *ptr = (int*)malloc(10 * sizeof (int));

When using C, this is considered bad practice; it is redundant under the
C standard. Moreover, putting in a cast may mask failure to include the
header stdlib.h, in which the prototype for malloc is found. In the
absence of a prototype for malloc, the C compiler will assume that
malloc returns an int, and will issue a warning in a context such as the
above, provided the error is not masked by a cast. On certain
architectures and data models (such as LP64 on 64 bit systems, where
long and pointers are 64 bit and int is 32 bit), this error can actually
result in undefined behavior, as the implicitly declared malloc returns
a 32 bit value whereas the actually defined function returns a 64 bit
value. Depending on calling conventions and memory layout, this may
result in stack smashing.

The returned pointer need not be explicitly cast to a more specific
pointer type, since ANSI C defines an implicit conversion between the
void pointer type and other pointers to objects. An explicit cast of
malloc's return value is sometimes performed because malloc originally
returned a char *, but this cast is unnecessary in standard C
code.[4][5] Omitting the cast, however, creates an incompatibility with
C++, which does require it.

The lack of a specific pointer type returned from malloc is type-unsafe
behaviour: malloc allocates based on byte count but not on type. This
distinguishes it from the C++ new operator that returns a pointer whose
type relies on the operand. (see C Type Safety). "

See also
http://www.opensc-project.org/pipermail/opensc-devel/2010-August/014586.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4636 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-18 15:08:51 +00:00
aj 6545b42c02 cleanup of the debug code:
* reduce to a few, supported functions.
* change all functions to take the debug level as parameter.
* use symbolic names for the debug levels.
* fix tools to pass "verbose"/"opt_debug" as ctx->debug.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4118 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-15 12:17: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
aj f1471e4a0c Fix bebytes2ushort function, reported by Roland Schwarz.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3999 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-05 06:20:45 +00:00
martin d006b1845e libopensc:
- Remove slot abstraction from internal API and all reader drivers. CT-API (from where it all comes from) readers with multiple slots (if still found) can be presented as separate readers, OpenCT should remove the slot abstraction, PC/SC never knew about it. None of the tools knew how to use slots.
 - Add sc_cancel (translates to SCardCancel)
 - Re-implement sc_wait_for_event; support a blocking call.
 - Replace the "int reader" API with "* sc_reader_t" style; add "Get reader by name" functionality.
 - Remove "action" parameter from sc_disconnect_card() (was not used)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3931 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-24 15:25:08 +00:00
martin f48ec9528e OpenSSL 1.0.0-beta series crash when assembler implementations underflow with 0 byte length call to OPENSSL_cleanse() and overwrite memory.
Avoid it by nut trying to eraze zero memory.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3925 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-23 06:28:35 +00:00
martin 95a5ab0654 Re-implement PIN cache on PKCS#15 layer; remove it from PKCS#11. Re-name and log PKCS#15 options to better reflect the purpose.
Data objects and PKCS#15 init are left broken currently.



git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3784 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-22 08:59:59 +00:00
martin d672fde449 Remove sc_error and sc_ctx_suppress_errors_* in favor of sc_debug/fprintf
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3721 c6295689-39f2-0310-b995-f0e70906c6a9
2009-09-14 08:46:59 +00:00
alonbl 5d218007c3 Fix last reference to VERSION and not PACKAGE_VERSION
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3475 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-16 04:32:56 +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
aj 4acfe6b096 fix compiler/sparse warnings.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3177 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 10:07:01 +00:00
nils 1b4472ca9f use const, add yet another ACL
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3114 c6295689-39f2-0310-b995-f0e70906c6a9
2007-01-20 12:46:40 +00:00
aj b3ad2f9dd2 convert to utf-8.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3084 c6295689-39f2-0310-b995-f0e70906c6a9
2006-12-19 21:31:17 +00:00
nils 4f1bdbe99d fix typo
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3056 c6295689-39f2-0310-b995-f0e70906c6a9
2006-11-11 11:47:48 +00:00
nils c208794ca8 check types before concatenating paths
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3054 c6295689-39f2-0310-b995-f0e70906c6a9
2006-11-11 11:09:57 +00:00
nils 01f72933af add support to parse the seInfo TokenInfo entry, improve aid support in opensc-explorer
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3045 c6295689-39f2-0310-b995-f0e70906c6a9
2006-10-30 18:51:48 +00:00
nils 8d38746c28 keep index and count parameters
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3023 c6295689-39f2-0310-b995-f0e70906c6a9
2006-09-24 12:50:41 +00:00
nils 81fd37e617 fix sc_compare_path_prefix(); patch supplied by Henryk Plötz <henryk@ploetzli.ch>
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3002 c6295689-39f2-0310-b995-f0e70906c6a9
2006-08-01 18:49:08 +00:00
nils ae5866b244 don't accept invalid OIDs
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2997 c6295689-39f2-0310-b995-f0e70906c6a9
2006-07-13 20:40:50 +00:00
sth bf23c032ca Endian-independent way to convert numbers to a byte array + vice versa
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2979 c6295689-39f2-0310-b995-f0e70906c6a9
2006-06-27 17:49:19 +00:00
nils 8e77e87551 sc_mutex_destroy should have a return value
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2832 c6295689-39f2-0310-b995-f0e70906c6a9
2006-02-05 19:35:55 +00:00
nils 5c3aed1189 - remove dependence on a specific threading library
- add two new structures: sc_thread_context_t which let
  the user specify the mutex functions to use and
  sc_context_param_t to specify parameters for the sc_context_t
  creation (including mutex functions) using sc_create_context()
- add new function sc_context_create()  
- remove timestamp code from libopensc


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2829 c6295689-39f2-0310-b995-f0e70906c6a9
2006-02-01 22:59:42 +00:00
nils de4b5c280f - implement thread-safe path printing function sc_path_print() and use
it src/libopensc/ and src/pkcs15init/
- use size_t for the certlen parameter of sc_pkcs15init_update_certificate()


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2811 c6295689-39f2-0310-b995-f0e70906c6a9
2006-01-11 23:41:17 +00:00
nils f18b38fe7f summary: -add more general path concatenation function
sc_concatenate_path() and let sc_append_path use it.
         -add function sc_compare_path_prefix to check whether
          a path starts with a certain sub-path (prefix).
         -add some doxygen docu to some path handling functions


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2801 c6295689-39f2-0310-b995-f0e70906c6a9
2006-01-01 23:11:00 +00:00
aj 138dfad842 simply code / remove dead code.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2711 c6295689-39f2-0310-b995-f0e70906c6a9
2005-12-05 21:36:55 +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
nils d858b4f84c fix build with openssl 0.9.8:
move "#include <openssl/crypto.h> up and remove unnecessary 
include for asn1.h 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2642 c6295689-39f2-0310-b995-f0e70906c6a9
2005-10-09 22:15:35 +00:00
nils 6abeaf1f1c add a new function
void sc_mem_clear(void *ptr, size_t len);
to clear a memory buffer. If OpenSSL is used this function
is a wrapper for OPENSSL_cleanse, otherwise memset is currenlty used.

Use this function to clear memory buffers with sensitive content.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2601 c6295689-39f2-0310-b995-f0e70906c6a9
2005-09-17 10:44:45 +00:00
nils f317e2966a sc_file_dup(): copy attributes as well, use explicit assignement and check return values
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2498 c6295689-39f2-0310-b995-f0e70906c6a9
2005-08-19 06:39:16 +00:00
nils 7ff54c7e2e use calloc instead of malloc + memset
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2497 c6295689-39f2-0310-b995-f0e70906c6a9
2005-08-18 22:43:01 +00:00
nils eab657fb52 change sc_bin_to_hex separator parameter from char to int as character constants are integers in c
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2461 c6295689-39f2-0310-b995-f0e70906c6a9
2005-08-03 18:43:40 +00:00
sth d0f267468e Added function sc_compare_oid()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2456 c6295689-39f2-0310-b995-f0e70906c6a9
2005-08-03 09:00:00 +00:00
sth e992e1ddfb Prevent doubles in the ACL entries
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2282 c6295689-39f2-0310-b995-f0e70906c6a9
2005-03-26 19:48:28 +00:00
bert 2d97002824 API fixup: use defined type instead of struct for exposed structs
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2232 c6295689-39f2-0310-b995-f0e70906c6a9
2005-03-08 20:59:35 +00:00
aet 69d2e9014d - Optimize a few cpu cycles from _sc_match_atr_hex
- Replace struct sc_atr_table / _sc_match_atr with
  recently introduced _hex variants
- Rewrote _add_atr
- Introduce int type variable to sc_card_t, so that
  every other card driver won't have to glue around
  with this
- Card driver cleanups, optimize the number of
  sc_match_atr called per card driver. Also
  always try direct match with _sc_match_atr
  first, before relying on eg. historical bytes
  information on some card drivers
- Fixed a memory leak from the miocos driver


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2145 c6295689-39f2-0310-b995-f0e70906c6a9
2005-02-06 19:40:40 +00:00
nils 2c0781335c fix signed vs. unsigned mismatch
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1934 c6295689-39f2-0310-b995-f0e70906c6a9
2004-10-17 16:20:46 +00:00
nils f044157553 fix incorrect use of realloc (x = realloc(x, y) doesn't free
the x in case of a failure)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1775 c6295689-39f2-0310-b995-f0e70906c6a9
2004-04-21 18:10:58 +00:00
okir 624e345a58 - in sc_format_path, initialize path->count = -1
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1623 c6295689-39f2-0310-b995-f0e70906c6a9
2003-11-20 15:40:01 +00:00
okir bf7e801fac - new path functions: sc_append_file_id, sc_compare_path
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1503 c6295689-39f2-0310-b995-f0e70906c6a9
2003-10-13 14:34:18 +00:00
aet 5616dba08e - Stop using unflexible automake conditionals when
building PC/SC, OpenCT or USBToken support,
  use ifdef's directly in source.
- Because of above, add HAVE_PCSCLITE for winconfig.h
- Remove unnecessary includes for log.h, opensc.h and
  errors.h in libopensc sources, they're already taken
  care by internal.h.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1406 c6295689-39f2-0310-b995-f0e70906c6a9
2003-09-03 09:28:55 +00:00
okir dc42cd3fa7 - added sc_print_path
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1400 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-29 12:55:30 +00:00
aet 763fc16704 Rename libopensc specific error/debug to sc_error/sc_debug
We should have done this ages ago.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1392 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-25 14:21:18 +00:00
aj 1091548eda seperator is written to an u8, so it should be a char or u8 anyway.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1324 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-01 07:03:16 +00:00
okir 21fe5ef918 - Patch from Stef to implement sc_wait_for_event, slightly enhanced by
yours truly.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@825 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-03 16:32:06 +00:00
okir 34d45b2210 - minor signedness issue
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@801 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-19 21:17:06 +00:00
jey 9a8c3b2b20 - Added support for separator characters in sc_bin_to_hex()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@767 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-10 14:44:42 +00:00
jey 3bced8aeae - Changed sc_bin_to_hex() prototype a bit and removed the ':' characters
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@760 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-10 13:26:31 +00:00
okir 868d1d7a20 - added sc_bin_to_hex
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@757 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-06 12:49:19 +00:00
okir 59ca2a4b0f - sc_parse_atr: initialize slot->atr_info.hist_bytes even if the ATR is bad
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@756 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-05 09:34:24 +00:00
okir c83fa88ca8 - Parsing pkcs11 IDs and paths with an odd number of bytes would scan past
the end of the string. Made sc_hex_to_bin more robust and change various
  place to use it rather than doing it on their own with scanf(%02x)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@754 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-04 15:36:33 +00:00
aet 1d2c9e4c48 Cleanups for initial win32 port, untested.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@696 c6295689-39f2-0310-b995-f0e70906c6a9
2002-10-19 14:04:52 +00:00
fabled 7635468ed9 - Initial support for win32
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@654 c6295689-39f2-0310-b995-f0e70906c6a9
2002-06-14 12:52:56 +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
okir 5d8b1000ca - eToken patches from Markus Friedl
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@546 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-17 13:36:35 +00:00
jey 6e0b7dea2c - Divided errors into different groups, added new ones
and renamed some
- Moved sc_strerror() to errors.c
- Added a 'sensitive' flag to struct sc_apdu


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@479 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-06 12:02:28 +00:00
jey 22636c2df9 - Added SC_ERROR_FILE_ALREADY_EXISTS
- Changed call convention for reader finish()
- CT-API driver now frees its resources correctly
- Added year 2002 to some of the copyright statements
- sc_pkcs15_decipher() and sc_pkcs15_compute_signature()
  now select only the parent DF of the private key file


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@463 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-05 14:46:44 +00:00
aet d81d10ba90 Upgrade sources to use new headers, part #1
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@458 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-05 10:44:51 +00:00
okir 0683b3463f - added two new error codes for pkcs15init
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@426 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-03 11:51:07 +00:00
aet 2fbf01e87d Remove #include "config.h", sc-internal.h already does that
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@409 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-31 16:32:07 +00:00
jey 7ddcb3d692 - sec_attr and prop_attr are now dynamically allocated in
struct sc_file


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@404 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-28 14:13:36 +00:00
jey 59d4e9b7be - Added support for CT-API
- Improved config file loading
- Implemented ATR parsing


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@396 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-26 11:38:40 +00:00
jey cd4e3650a4 - Moved functions from sc.c to ctx.c
- Card and reader drivers are now configurable


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@387 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-24 22:47:35 +00:00
aet 7d27225e0c Oops, scconf_parse was called twice. Fixed.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@382 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-24 17:09:47 +00:00
aet 21aae9c4d0 - Fix a potential segfault for the new sc_establish_context
- Keep the variable names in opensc.conf the same as they
  are in code structs.

Always try to parse app default { } first, then upgrade
the settings with the application specific configuration block.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@381 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-24 16:57:39 +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
jey 23e956cf9b - Fixed PKCS #15 structure generation on Cryptoflex cards
and implemented a default profile
- Cryptoflex now reports its supported PK algorithms
  correctly
- Various pkcs15-init fixes


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@295 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-12 13:00:57 +00:00
jey 6b07ff64f6 - Reworked PKCS #15 structure a bit (MANY THINGS
WILL BREAK)
- Added support for public key DFs (not tested yet)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@251 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-03 00:32:28 +00:00
jey 4fa7283ae2 - added some missing files
- renamed card-setec.c to card-setcos.c


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@243 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-26 11:27:49 +00:00
jey 04dfc47d92 - added a driver for MioCOS cards by Miotec
- implemented EF(DIR) updating


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@242 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-26 11:23:25 +00:00
jey 3fa1b27736 - implemented reader abstraction layer; now it's easier to
add support for e.g. CT-API
- renamed ops_data field to drv_data in struct sc_card
- copied coding style document from Linux kernel


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@221 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-24 19:32:14 +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
aet 3adef373bf Fix memory leak for sc_establish_context
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@214 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-20 18:42:16 +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
aet 092e87969d Bugfix for sc_destroy_context, pcsc_ctx was never released
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@212 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-17 21:55:57 +00:00
jey 262e5c2083 - added error reporting for several new SWs
- added check_sw function to sc_card_operations


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@211 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-15 23:17:58 +00:00
jey 709727d469 - added partial support for TCOS 2.0 cards
- default card driver now tries to do a GET RESPONSE
  instead of SELECT FILE to detect the correct
  CLA byte
- moved security attribute parsing from iso7816.c to card-setec.c
- added some more sanity checking to sc_check_apdu
- added 'debug' command line option to opensc-explorer


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@210 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-11 15:55:34 +00:00
jey b4063302bf - added partial support for GPK 4000
- made line parsing in opensc-explorer saner
- moved change_reference_data and reset_retry_counter to
  iso7816.c, where they belong
- added partial libreadline support to opensc-explorer


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@206 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-10 18:04:03 +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 a016a59259 - added PKCS #15 structure generation to cryptoflex-tool
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@182 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-21 12:49:00 +00:00
jey d9792242cc - fixed a bug with file permissions in flex_create_file()
- added RSA signature generation with Cryptoflex cards
- improved security environment handling
- implemented cryptoflex-tool


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@177 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-20 21:20:09 +00:00
jey 20adb4b39c - continued to improve PKCS #15 generation
- fixed a few problems in sc_set_security_env
- started to implement Better (tm) object handling for
  PKCS #15 objects


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@167 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-16 23:59:18 +00:00
jey 9dc7054919 - added preliminary ASN.1 encoding support
- modified ASN.1 decoding to make it easier to
  port decoder structures to the encoder
- fixed a recently introduced bug in card driver handling
- opensc-explorer will now allow only DF's to be cd'd into


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@156 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-10 12:33:56 +00:00
jey 7ff4c4544c - added preliminary CryptoFlex 16k support
- added short names to card drivers
- moved various ISO 7816-9 functions to their correct places
- added write binary support
- renamed opensc-crypt to pkcs15-crypt
- split a part opensc-tool to pkcs15-tool


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@150 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-08 13:56:50 +00:00
jey 9197babe53 - renamed sc_asn1_parse to sc_asn1_decode
- added capabilities and flags fields to struct sc_card
- added a mutex to sc_context for future use


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@148 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-07 18:23:34 +00:00
aet a327209319 SCardGetStatusChange/rgReaderStates changes for compatibility
with older and/or modified pcsc-lite releases.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@135 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-05 19:01:55 +00:00
jey 5cdd262385 - some fixes to the PKCS #11 module
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@125 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-01 17:25:10 +00:00
jey ad2e34cb6c - added preliminary support for EMV cards
- changed a few function prototypes
- implemented access control lists to files
- added sc_read_record() function
- updated the NEWS file


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@111 c6295689-39f2-0310-b995-f0e70906c6a9
2001-12-29 02:07:32 +00:00
jey 695ad01b28 - added preliminary EMV support
- made a few bug fixes relating to select_file operation


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@107 c6295689-39f2-0310-b995-f0e70906c6a9
2001-12-27 17:25:10 +00:00
jey 2b99f2df14 - added default driver for unidentified cards
- added select_file operation in Multiflex driver
- added 'list-drivers' command to opensc-tool
- moved stuff from opensc.h to sc-internal.h
- improved locking behaviour


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@106 c6295689-39f2-0310-b995-f0e70906c6a9
2001-12-25 20:45:48 +00:00
jey c344e28a92 - added card abstraction layer support
- pretty much finished migrating to new ASN.1 code
- changed call semantics for sc_select_file()
- moved functions around


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@89 c6295689-39f2-0310-b995-f0e70906c6a9
2001-12-22 20:43:09 +00:00
jey 0bba170d91 - LINT fixes
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@88 c6295689-39f2-0310-b995-f0e70906c6a9
2001-12-22 13:38:25 +00:00