Commit Graph

50 Commits

Author SHA1 Message Date
Frank Morgner 439a95f2d2
If card initialization fails, return SC_ERROR_INVALID_CARD (#1251)
fixes https://github.com/OpenSC/OpenSC/issues/946
2018-05-18 23:49:29 +02: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
Jakub Jelen 58cd9aaeb6 card-authentic.c: Initialize variables and make it build
Ammends: #1205
2018-04-04 21:43:01 +02:00
sergioag 098eed146f [AuthentIC v3] Correctly handle APDUs with more than 256 bytes (#1205) 2018-03-31 21:51:11 +02:00
Frank Morgner d719977d14 Reselect PKI-Applets after card reset
PKI-Applets may not be active if the card has been reset or unpowered.
The SELECT command used to activate the applet, is identical to the one
used during card matching or initialization.
2018-02-07 11:57:48 +01:00
Frank Morgner 8de544653c dump data with sc_debug_hex and sc_log_hex 2017-11-17 10:03:54 +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
Michał Trojnara 645780e6d4 NULL parameter check moved to sc_file_free()
This fixes numerous issues where the check is *not* performed,
and also simplifies the code.
2017-01-10 12:46:44 +01:00
Frank Morgner 2f10de4f5c use sc_pkcs15_get_pin_info in C_GetTokenInfo
introduced paramter to signal back the login state
- used for the pin command SC_PIN_CMD_GET_INFO
- implemented in accordance to ISO 7816-4; all other implementations
  are currently set to an unknown login state

implemented and exporeted sc_pkcs15_get_pin_info

use sc_pkcs15_get_pin_info in C_GetTokenInfo

C_GetSessionInfo: Check whether a logout was done

Closes https://github.com/OpenSC/OpenSC/pull/624

rebased by @viktorTarasov
2016-07-17 14:07:43 +02:00
Ludovic Rousseau ad11c9937c card-authentic.c: fix 1 compiler warning
card-authentic.c:1452:57: error: address of 'data->pin2.data' will always
      evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
        if (!data->pin1.data && !data->pin1.len && &data->pin2.data && !...
                                                ~~  ~~~~~~~~~~~^~~~
2016-03-02 14:57:42 +01:00
Frank Morgner 2963588887 card-authentic.c: fixed potential resource leak 2015-10-30 12:15:06 +01:00
Frank Morgner 6c01750ba8 Removes dead code 2015-09-17 22:24:33 +02:00
Frank Morgner 4af4308d19 authentic: fixed resource leak
pkcs15-authentic: fixed resource leak
card-authentic: fixed resource leak
2015-05-08 09:10:48 +02:00
Frank Morgner 1f69a0d687 fixed indenting 2015-05-08 09:08:24 +02:00
Frank Morgner da07e22c97 use memmove for overlapping memory 2015-02-20 19:54:40 +01:00
Frank Morgner a3fc62f79f fixed NULL dereference (or warning thereof) 2015-02-05 01:38:40 +01:00
Frank Morgner ed9572422f check return values 2015-02-05 01:37:53 +01:00
Frank Morgner ac4da89d0d use memmove for overlapping memory 2015-02-05 01:37:53 +01:00
Frank Morgner 7a34c204c1 fixed dereference before null check
silence warnings reported by coverity-scan
2015-01-22 20:29: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
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 4b30292585 more macros for the values from ISO specification 2013-02-24 19:37:35 +01:00
Viktor Tarasov c7827e5e4b sm: change SM data types, thanks to Frank Morgner for revision
http://www.opensc-project.org/pipermail/opensc-devel/2012-July/018232.html
2012-07-29 21:41:44 +02:00
Frank Morgner 31bdbd6b6a use error code if no SM was applied 2012-07-05 10:12:34 +02:00
Viktor Tarasov f9a13179d8 AuthentIC: when using SM decrease max-send-size value
update list of APDUs that always sent in plain (non SM wrapped) mode
2012-06-19 17:37:51 +02:00
Viktor Tarasov 9c882ff5c2 AuthentIC: add SM related procedures
Added to facilitate future SM merge,
for a while disabled by conditional macro.
2012-05-29 09:52:33 +02:00
andre 93baf137c3 libopensc: Fix for drivers returning an error if a challenge of length zero was requested. Actually nothing is done when obtaining such a challenge, thus nothing could fail.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5564 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-09 10:59:04 +00:00
vtarasov 32d035a9ad AuthentIC: when returning PIN info set the 'tries-left' data to the 'non-initialized' value
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5549 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-05 15:13:06 +00:00
vtarasov da0a77b8c0 authentic: spelling of message
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5541 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-02 18:22:42 +00:00
vtarasov 7179778e22 authentic: avoid warning C4018: signed/unsigned mismatch
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5509 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-28 19:30:26 +00:00
vtarasov c7ed3da502 libopensc: authentIC: use macros; use common CPLC data type
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5440 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-13 12:57:18 +00:00
andre b21eeb46b9 libopensc: Removes unused flag SC_CARD_CAP_RSA_2048.
Relates to [http://www.opensc-project.org/opensc/ticket/296#comment:1 #296].

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5308 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-07 18:16:40 +00:00
ludovic.rousseau 11ae160d55 Fix compiler warning by commenting dead code
card-authentic.c:510: warning: 'authentic_resize_file' defined but not used


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5263 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:58:17 +00:00
ludovic.rousseau 577499f80c Fix compiler warning
card-authentic.c: In function 'authentic_chv_verify_pinpad':
card-authentic.c:1255: warning: declaration of 'ffs' shadows a global declaration
/usr/include/string.h:121: warning: shadowed declaration is here


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5262 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:57:20 +00:00
andre 8ff3d5d647 Fixing misuse of SC_CARD_FLAG_RNG. From opensc.h :
[http://www.opensc-project.org/opensc/browser/trunk/src/libopensc/opensc.h?rev=5190#L88 #define SC_ALGORITHM_RSA_PAD_PKCS1      0x00000002]
[http://www.opensc-project.org/opensc/browser/trunk/src/libopensc/opensc.h?rev=5190#L413 #define SC_CARD_FLAG_RNG                0x00000002]

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5218 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-04 16:23:07 +00:00
ludovic.rousseau 2f186bee8b Remove unused variables
card-authentic.c: In function ‘authentic_init_oberthur_authentic_3_2’:
card-authentic.c:423: warning: unused variable ‘resp’
card-authentic.c: In function ‘authentic_process_fci’:
card-authentic.c:1042: warning: unused variable ‘acls_NEVER’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5184 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 22:40:08 +00:00
ludovic.rousseau 7c81ad9aa3 Fix typo in error message
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5177 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 22:08:13 +00:00
ludovic.rousseau 034cdb1151 Add missing checks for NULL before dereferencing
card-authentic.c:913:33: warning: Field access results in a dereference of a
      null pointer (loaded from variable 'apdus')
                rv = sc_check_sw(card, apdus->sw1, apdus->sw2);
                                       ~~~~~  ^
card-authentic.c:958:33: warning: Field access results in a dereference of a
      null pointer (loaded from variable 'apdus')
                rv = sc_check_sw(card, apdus->sw1, apdus->sw2);
                                       ~~~~~  ^
card-authentic.c:1001:33: warning: Field access results in a dereference of a
      null pointer (loaded from variable 'apdus')
                rv = sc_check_sw(card, apdus->sw1, apdus->sw2);
                                       ~~~~~  ^


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5176 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 22:07:52 +00:00
ludovic.rousseau 52251f931c Remove dead code
card-authentic.c:440:2: warning: Value stored to 'resp_len' is never read
        resp_len = sizeof(resp);
        ^          ~~~~~~~~~~~~
card-authentic.c:1053:4: warning: Value stored to 'acls' is never read
                        acls = acls_NEVER;
                        ^      ~~~~~~~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5175 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 22:02:42 +00:00
ludovic.rousseau 9811426bc5 Fix compiled warnings
card-authentic.c:1770:1: warning: no previous prototype for function
      'authentic_manage_sdo_encode_prvkey' [-Wmissing-prototypes]
authentic_manage_sdo_encode_prvkey(struct sc_card *card, struct ...
^
card-authentic.c:1832:1: warning: no previous prototype for function
      'authentic_manage_sdo_encode' [-Wmissing-prototypes]
authentic_manage_sdo_encode(struct sc_card *card, struct ...
^


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5132 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 17:11:18 +00:00
vtarasov 5ab90b9219 libopensc: avoid using of the not completely initialized 'sc_path' variables
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5106 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-18 09:48:26 +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
vtarasov cb5b141391 pkcs15: remove unused variables
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5057 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-07 15:44:13 +00:00
vtarasov 103af724fe liopensc: log: use 'normal' as default debug level ...
and make shorter short call to insert debug message


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5040 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-04 11:33:03 +00:00
vtarasov 392e6eff98 AuthentIC: use short form to insert 'normal' debug messages
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5038 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-04 09:19:09 +00:00
vtarasov 0056eeb34c AuthentIC: memory allocation errors, thanks to Martin
for memory allocation errors use SC_ERROR_OUT_MEMORY instead of SC_ERROR_MEMORY_FAILURE


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5029 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-02 15:01:03 +00:00
vtarasov aec6e175f5 AuthentIC: read/write/update binary card handles can use the 'WAITING-AREA' reader facility ...
when used with virtual reader, the APDUs can be buffered in the reader's
internal buffer, before sending it to the distant card.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5021 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-02 14:11:00 +00:00
vtarasov 6aaf1a79e3 AuthentIC: cleanup dead code
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5012 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-31 10:52:15 +00:00
vtarasov 682c464540 AuthentIC: "now there is no way to build without OpenSSL" (Andre Zepezauer)
Thanks for patch.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5011 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-31 08:54:07 +00:00
vtarasov 1a58c429cb 'AuthentIC': basic support of Oberthur's 'COSMO.v7/AuthentIC.v3.2' ...
it's the natively PKCS#15 card


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5006 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-30 14:40:28 +00:00