Commit Graph

96 Commits

Author SHA1 Message Date
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
Maciej S. Szmigiero 62cbda6cd9 Fix log messages format and parameter issues flagged by GCC
Since "Add GCC format checking attributes to log functions" commit GCC
warns us about problems with format strings and their arguments provided
to OpenSC message logging functions.

This commit fixes all cases where GCC warned about incorrect format on
64-bit Linux, 32-bit and 64-bit mingw builds (with SM and OpenSSL enabled).
Well, almost all since on mingw GCC does not recognize "ll" size specifier
(present at least since Visual Studio 2005, also in mingw own CRT) so these
(few) warnings about it remain.

In most cases format size specifier for size_t type was missing (usually
size was left at default int level, with is different on 64-bit x86).
Some formats had too few / too many arguments.
In some cases pointers were printed as integers.
Some long variables were missing "l" prefix (especially with regard to %x
format).

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +02:00
Frank Morgner ef40021417 use sc_debug_hex for hexdump 2016-03-07 10:39:42 +01:00
Frank Morgner fb9dfc5b71 fixed warnings about possible data loss 2015-09-14 10:52:31 +02:00
Frank Morgner bcb5fc15e5 honour HAVE_CONFIG_H 2015-04-22 23:55:33 +02:00
Frank Morgner 5d6c4b391d Merge pull request #253 from github-frankmorgner/remove-deadcode
card-asepcos: removed dead code
card-authentic: removed dead code
card-belpic: removed dead code
card-epass2003: removed dead code
card-flex: removed dead code
card-gpk: removed dead code
card-oberthur: removed dead code
card-piv: removed dead code
card-setcos: removed dead code
ctbcs: removed dead code
cwa14890: removed dead code
muscle: removed dead code
pkcs15-atrust-acos: removed dead code
pkcs15-gemsafeV1: removed dead code
pkcs15-skey: removed dead code
reader-ctapi: removed dead code
framework-pkcs15: removed dead code
pkcs11-object: removed dead code
pkcs15-asepcos: removed dead code
pkcs15-cardos: removed dead code
pkcs15-jcop: removed dead code
pkcs15-lib: removed dead code
pkcs15-oberthur: removed dead code
parse: removed dead code
sclex: removed dead code
sm-card-authentic: removed dead code
sm-card-iasecc: removed dead code
sm-cwa14890: removed dead code
sm-global-platform: removed dead code
sc-test: removed dead code
pkcs11-tool: removed dead code
pkcs15-tool: removed dead code
2014-09-07 21:22:43 +02:00
Frank Morgner a64326e768 fixed compiler warnings (partially submitted)
Signed-off-by: Frank Morgner <morgner@informatik.hu-berlin.de>

PR-222: commit 0b567dbaa8
partially submitted by Viktor Tarasov
2014-05-03 21:47:15 +02:00
Viktor Tarasov 407ffa3388 libopensc: for hex dump in debug messages ...
use dedicated log procedure that uses a static dump buffer

inspired by pull request #164 of Frank Morgner
https://github.com/OpenSC/OpenSC/pull/164
2013-08-02 14:21:02 +02:00
andre 69c846f904 libopensc: Re-defines SC_CARD_FLAG_ONBOARD_KEY_GEN to be local to the file card-flex.c, because that flag is used nowhere else. In principle, this patch only reverts some changes made by r2192.
Relates to #296.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5312 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-08 13:30:32 +00:00
ludovic.rousseau e46c4ccd1f Remove dead code
card-flex.c:358:2: warning: Value stored to 'left' is never read
        left = *p++;
        ^      ~~~~
card-flex.c:358:10: warning: Value stored to 'p' is never read
        left = *p++;
                ^~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5163 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 21:35:17 +00:00
vtarasov 92c3e59e16 libopensc: Now 'cache-valid' flag is a member of 'sc_card_cache' ...
add 'current_ef' and 'current_df' member to 'sc_card_cache'.
The main purpose of this is to reduce number of APDU transactions.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5002 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-30 13:04:55 +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
martin 7d935df1bc Fix #193: cryptoflex driver did not set minimum PIN length.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3922 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-21 19:58:49 +00:00
martin 64f9578202 apdu.sensitive is not in use since [2868]
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3751 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-03 09:31:07 +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
aj ad79822134 convert to utf-8.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3085 c6295689-39f2-0310-b995-f0e70906c6a9
2006-12-19 21:32:31 +00:00
nils 6b40cf4caa remove unused variable, cleanup
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3061 c6295689-39f2-0310-b995-f0e70906c6a9
2006-11-22 19:27:52 +00:00
aj 607e85ad9b add new atr reported by Sven Loeschner as Cryptoflex 32k Card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2981 c6295689-39f2-0310-b995-f0e70906c6a9
2006-06-27 21:54:24 +00:00
aj f1d9cda57c the cryptoflex manual states the last two bytes of the atr are some
software version so we can ignore them. use the atr mask to do that.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2975 c6295689-39f2-0310-b995-f0e70906c6a9
2006-06-19 23:04:13 +00:00
aj ab0066b0d7 fix printf size_t problem with "%lu" and (unsigned long) cast.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2923 c6295689-39f2-0310-b995-f0e70906c6a9
2006-05-01 10:02:50 +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 e56c7a9110 use correct apdu case and set Le value
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2775 c6295689-39f2-0310-b995-f0e70906c6a9
2005-12-22 15:54:44 +00:00
aj 4de18a2552 fix for the combination of cryptoflex, 2048bit keys and
some smart card readers by Jean-Pierre Szikora 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2694 c6295689-39f2-0310-b995-f0e70906c6a9
2005-12-01 22:18:58 +00:00
nils f6c95792fe let src/libopensc/ compile with -Wall -W -Wno-unused-parameter -Werror
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2546 c6295689-39f2-0310-b995-f0e70906c6a9
2005-09-07 08:33:55 +00:00
nils 34e7133bd2 added yet another atr to card-flex, supplied by: Giuseppe Raspanti <graspanti@crytron.com>
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2311 c6295689-39f2-0310-b995-f0e70906c6a9
2005-04-16 12:06:28 +00:00
aj 769792ea31 fix egate token with cryptoflex on windows.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2261 c6295689-39f2-0310-b995-f0e70906c6a9
2005-03-23 22:44:48 +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
pisi 6ca66815b6 whitespace cleanups
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2230 c6295689-39f2-0310-b995-f0e70906c6a9
2005-03-06 14:37:22 +00:00
aet 8a8f2cd6bc - Introduce a new powerful card_atr mechanism to opensc
configuration file to handle any configuring related
  to certain card / cards using atrmask.
- Rewrite Martin's force_protocol to _sc_check_forced_protocol()
  to make it possible to share the code with other reader driver
  implementations than pcsc.
- Implement _sc_match_atr_block() to help out with force protocol
  and pkcs15 emulation layers, to find information that's not
  stored directly to sc_atr_table.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2192 c6295689-39f2-0310-b995-f0e70906c6a9
2005-02-22 07:59:42 +00:00
aet b5528b58d4 - Add ATR for a CryptoFlex card from Mario Strasser, that
I forgot to add over six months ago.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2175 c6295689-39f2-0310-b995-f0e70906c6a9
2005-02-10 12:48:50 +00:00
aet 32b417cbf3 - First stab towards standardized card types
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2172 c6295689-39f2-0310-b995-f0e70906c6a9
2005-02-10 10:07:13 +00:00
aet 539232f0df - Cleanup
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2168 c6295689-39f2-0310-b995-f0e70906c6a9
2005-02-09 20:03:07 +00:00
aet ece96aff98 - Add atrmask to sc_atr_table
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2160 c6295689-39f2-0310-b995-f0e70906c6a9
2005-02-09 11:33:37 +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
aet bd0f86f69c - Unify all card drivers ATR matching code to use _sc_match_atr_hex,
untested as of yet.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2134 c6295689-39f2-0310-b995-f0e70906c6a9
2005-02-04 20:29:35 +00:00
nils d89c7a733d implement serial number support for cryptoflex cards
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2045 c6295689-39f2-0310-b995-f0e70906c6a9
2004-12-24 23:24:12 +00:00
nils 57cc65e485 cleanup
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2011 c6295689-39f2-0310-b995-f0e70906c6a9
2004-12-15 08:38:36 +00:00
nils a9b00f005f use the padding character from the pkcs15 objects
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1799 c6295689-39f2-0310-b995-f0e70906c6a9
2004-06-21 21:20:29 +00:00
aj 37a957cbe4 cryptoflex 32k e-gate v4 also has on board key generation.
thanks for reporting to Pierre JUHEN.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1759 c6295689-39f2-0310-b995-f0e70906c6a9
2004-03-29 07:56:32 +00:00
aet 7d3fc55736 - Minor build and C++ warning fixes
- pkcs15init: Use u8 for pin variable
  declarations like libopensc does


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1686 c6295689-39f2-0310-b995-f0e70906c6a9
2003-12-18 21:37:34 +00:00
aet d6713aff9a - Minor naming convention harmonisation for pc/sc and ct-api
related things


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1669 c6295689-39f2-0310-b995-f0e70906c6a9
2003-12-10 14:52:58 +00:00
okir cec660fda1 - More cyberflex fixes from Martin Buechler
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1665 c6295689-39f2-0310-b995-f0e70906c6a9
2003-12-09 13:57:20 +00:00
okir 85fa4ed0da - Matched Cyberflex patch from Martin Buechler. Created a new
driver named cyberflex which shares a lot of code with the original
  flex driver. This is a lot cleaner than having to create if/else
  monsters.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1661 c6295689-39f2-0310-b995-f0e70906c6a9
2003-12-08 10:54:55 +00:00
okir 931a1dd28a - added error/debug message support to ui.c
- sc_error/sc_debug now use the new ui code
- added language support


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1559 c6295689-39f2-0310-b995-f0e70906c6a9
2003-10-22 06:49:59 +00:00
okir 927ae344cc - fix cflex key generation
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1536 c6295689-39f2-0310-b995-f0e70906c6a9
2003-10-18 08:39:40 +00:00
okir 106351eb5c - some commands used the wrong APDU case
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1498 c6295689-39f2-0310-b995-f0e70906c6a9
2003-10-11 12:41:28 +00:00
sth 842b5cd2f5 Fix: let this card driver do the unblocking itself, don't send it to the iso7816 code (Victor Tarasov)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1419 c6295689-39f2-0310-b995-f0e70906c6a9
2003-09-05 20:16:52 +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