Commit Graph

36 Commits

Author SHA1 Message Date
Peter Marschall 16c889cf7d spelling fixes
Fix various spelling errors, mostly in comments but also in texts displayed.

Errors found & interactively fixed using 'codespell', with additional manual
checks after the fixes.
2020-08-30 10:35:14 +02:00
Frank Morgner a899a46b09 replaced SC_TEST_RET with LOG_TEST_RET 2018-12-06 09:26:42 +01:00
Frank Morgner 00a150f74c replaced SC_FUNC_RETURN with LOG_FUNC_RETURN 2018-12-06 09:26:42 +01:00
Frank Morgner 24b50a4277 replace sc_debug with sc_log 2018-12-06 09:26:42 +01:00
Frank Morgner 6184c1fbab avoid out of bounds read 2018-06-29 17:14:55 +02:00
Frank Morgner 1d03000222 fixed dead assignment 2017-11-09 12:42:29 +01: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 4f13fde7f1 use size_t for a length instead of int 2015-10-14 22:56:53 +02:00
Frank Morgner de58f51012 msc: check the length of input 2015-09-17 22:24:33 +02:00
Frank Morgner bcb5fc15e5 honour HAVE_CONFIG_H 2015-04-22 23:55:33 +02:00
Frank Morgner b9f1fb333c fixed bad output data length 2015-01-28 07:07:33 +01: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
Viktor Tarasov 61254f8651 muscle: coverity scan warning OVERRUN-STATIC
CID 402559: Out-of-bounds access (OVERRUN_STATIC)
CID 402558: Out-of-bounds access (OVERRUN_STATIC)
2012-06-11 21:18:51 +02:00
Martin Paljak bc307ae975 compiler warning: muscle.c:588:12: warning: unused variable ‘buffer_size’
Also remove asserts, production code is compiled with asserts turned off, thus the unused variable warning.
2011-06-16 15:49:04 +03:00
ludovic.rousseau 67d0a41ed2 Remove dead code
muscle.c:417:2: warning: Value stored to 'ptr' is never read
        ptr += newPinLength;
        ^      ~~~~~~~~~~~~
muscle.c:918:2: warning: Value stored to 'inPtr' is never read
        inPtr += toSend;
        ^        ~~~~~~
muscle.c:917:2: warning: Value stored to 'left' is never read
        left -= toSend;
        ^       ~~~~~~
muscle.c:1012:26: warning: Value stored to 'p' is never read
        ushort2bebytes(p, use); p+=2;   
                                ^  ~



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5160 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 21:18:34 +00:00
martin 37944007aa libopensc: move MIN/MAX macros from muscle.c to internal.h
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4912 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 12:52:07 +00:00
martin 98037b795d MuscleApplet: Detect MuscleApplet specific SW-s; re-organize the source a little.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4350 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-14 13:37:48 +00:00
ludovic.rousseau a2ff157eef Rename variables and parameters
Fix
muscle.c: In function ‘msc_create_object’:
muscle.c:144: warning: declaration of ‘read’ shadows a global declaration
/usr/include/unistd.h:477: warning: shadowed declaration is here
muscle.c:144: warning: declaration of ‘write’ shadows a global declaration
/usr/include/unistd.h:513: warning: shadowed declaration is here
muscle.c: In function ‘msc_import_key’:
muscle.c:941: warning: declaration of ‘read’ shadows a global declaration
/usr/include/unistd.h:477: warning: shadowed declaration is here
muscle.c:942: warning: declaration of ‘write’ shadows a global declaration
/usr/include/unistd.h:513: warning: shadowed declaration is here


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4210 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-02 13:49:54 +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 56fb57603b Merge [3758:3783/trunk]
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3785 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-22 09:18:16 +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
ludovic.rousseau 117d790aea Do not use msc_crypt_process (OP_PROCESS). This operation is used to do
multipart encryption when, for example, the data is too big to fit in
one APDU. It basically calls the Cipher.update() method until all data
has been processed. However, the Java Card API documentation advises
against using update():

"This method requires temporary storage of intermediate results. In
addition, if the input data length is not block aligned (multiple of
block size) then additional internal storage may be allocated at this
time to store a partial input data block. This may result in additional
resource consumption and/or slow performance.  This method should only
be used if all the input data required for the cipher is not available
in one byte array. If all the input data required for the cipher is
located in a single byte array, use of the doFinal() method to process
all of the input data is recommended."

As the card's JVM was returning an internal exception when using
OP_PROCESS, it was decided to implement an msc_crypt_final_object()
function in OpenSC that uses the msc_object_*() functions to read/write
all the data from the card. This way, it is possible to transmit/receive
"arbitrarily" large data chunks to/from the card and use doFinal(). This
is the fallback method when, for example, using 2048 bit keys and the
card doesn't support extended APDUs.

Thanks to Joao Poupino for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2009-March/011978.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3673 c6295689-39f2-0310-b995-f0e70906c6a9
2009-03-25 14:31:21 +00:00
ludovic.rousseau 7b07db6b59 msc_get_challenge(): return SC_SUCCESS instead of dataLength in case of
success

Thanks to Joao Poupino for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2009-March/011978.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3669 c6295689-39f2-0310-b995-f0e70906c6a9
2009-03-25 13:47:46 +00:00
ludovic.rousseau 89b2ac778f msc_get_challenge(): use 0x62 instead of 0x72 for GET CHALLENGE as it is
the value used by the Muscle applet (INS_GET_CHALLENGE)

Thanks to João Poupino for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2009-March/011978.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3668 c6295689-39f2-0310-b995-f0e70906c6a9
2009-03-25 13:42:13 +00:00
ludovic.rousseau 91177e51ec Use size_t instead of int when needed, plus some other minor changes
Patch bug.1 included in Ticket #176


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3510 c6295689-39f2-0310-b995-f0e70906c6a9
2008-05-05 13:00:01 +00:00
aj c3fcd9f7dd Steve Jacobs: fix muscle driver.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3148 c6295689-39f2-0310-b995-f0e70906c6a9
2007-04-10 19:49:26 +00:00
martin 30d0066a58 Stop MS visual studio 2005 complaints.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3103 c6295689-39f2-0310-b995-f0e70906c6a9
2007-01-06 16:35:38 +00:00
aj 38720ba5e1 update to latest muscle code.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3080 c6295689-39f2-0310-b995-f0e70906c6a9
2006-12-18 21:58:16 +00:00
aj 31f4fada5b define these constants where used to kill warnings.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3069 c6295689-39f2-0310-b995-f0e70906c6a9
2006-12-07 10:53:37 +00:00
aj b3822c349b update the MuscleCard driver for OpenSC to use an msc_id struct rather than
int/bytes and messing around with byte-swapping for that. (by Thomas Harning)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3067 c6295689-39f2-0310-b995-f0e70906c6a9
2006-11-30 08:14:16 +00:00
vtarasov 2d4bd463b0 Use do {...} while(0) construction for SC_TEST_RET, SC_FUNC_RETURN and SC_FUNC_CALLED defines
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3050 c6295689-39f2-0310-b995-f0e70906c6a9
2006-11-06 11:15:09 +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
sth 6d96437c4a The applet returns unexpected values when entering a wrong PIN; this is a work-around by Thomas Harning
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2973 c6295689-39f2-0310-b995-f0e70906c6a9
2006-06-18 20:52:10 +00:00
nils 409fe3a9a0 fix warnings
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2972 c6295689-39f2-0310-b995-f0e70906c6a9
2006-06-17 15:07:49 +00:00
sth 50490acca0 Added support for MuscleCard applet. Thanks to Thomas Harning, David Corcoran of Identity Alliance
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2968 c6295689-39f2-0310-b995-f0e70906c6a9
2006-06-07 08:33:37 +00:00