Commit Graph

104 Commits

Author SHA1 Message Date
Frank Morgner 907c9479e2 replace sc_debug_hex with sc_log_hex 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 cf55cdc637 replace SC_FUNC_CALLED with LOG_FUNC_CALLED 2018-12-06 09:26:42 +01:00
Raul Metsma 83b188c950 Remove long expired EstEID 1.0/1.1 card support
Signed-off-by: Raul Metsma <raul@metsma.ee>
2018-09-30 21:25:13 +02:00
Raul Metsma 430a9b3f5a Commit c463985fed broke EstEID PIN verify
Signed-off-by: Raul Metsma <raul@metsma.ee>
2018-09-12 12:30:05 +02:00
Raul Metsma 336b282324 Reuse gp_select_aid
Signed-off-by: Raul Metsma <raul@metsma.ee>
2018-08-23 20:37:38 +02:00
Frank Morgner 70c4813f30 fixed Dereference before null check 2018-08-23 09:59:45 +02:00
Priit Laes 45f407c021 Mark driver-specific global sc_atr_table structures as const
As most of the drivers do not modify these, we can mark them as const.
Two drivers that we cannot convert are dnie and masktech.

section                 size
.data                  35232 ->   25472
.data.rel.ro           36928 ->   46688
2018-08-22 22:50:30 +02:00
Frank Morgner 92a98cb3bb mcrd: converted assert to proper error handling 2018-08-14 16:13:22 +02:00
Frank Morgner ed0d829eab removed unused check 2018-06-29 17:14:55 +02:00
Frank Morgner c463985fed
Removed code for obsolete cards from D-Trust (#1261) 2018-05-18 23:49:59 +02:00
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
Frank Morgner 45ad44e311 fixed handling SC_ASN1_TAG_EOC from sc_asn1_read_tag
We can't check for `tag == SC_ASN1_TAG_EOC` directly, because this
would also be true for a tag of 0x80 (with `class ==
SC_ASN1_CLASS_CONSTRUCTED`). So what we do is we check for the output
buffer to be NULL!

fixes https://github.com/OpenSC/OpenSC/issues/1273
2018-03-30 08:28:51 +02:00
Raul Metsma 514f898671 Fix reading EstEID certificates with T=0 (#1193) 2017-11-17 10:46:34 +01:00
Frank Morgner 8de544653c dump data with sc_debug_hex and sc_log_hex 2017-11-17 10:03:54 +01:00
Raul Metsma 2846295e1f EstEID ECDH token support (#1185) 2017-11-10 08:58:31 +01:00
Raul Metsma be35d3d026 EstEID ECDSA token support (#1158) 2017-10-27 19:51:33 +02:00
Maciej S. Szmigiero 58c4de26a7 Fix cases of log function format strings not being a string literal
Looks like Travis CI build server found a few cases of log function format
string not being a string literal (now that log functions have necessary
attributes to check for such things).
Some instances clearly aren't a real problem, but to be future-proof and to
avoid compiler warnings let's fix all of them (that I was able to find in
code).

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +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
Jakub Jelen 9fd8a60cfa mcrd: Clean up drv_data in case of failure during initialization (partly resolves #943) 2017-01-23 13:31:26 +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
Frank Morgner 94772c870a Adds error checking 2015-10-14 22:15:17 +02: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 a3fc62f79f fixed NULL dereference (or warning thereof) 2015-02-05 01:38:40 +01:00
Frank Morgner 6759c04b26 don't ignore errors 2015-01-28 04:45:08 +01:00
Frank Morgner ea55c19439 Merge pull request #195 from rainermetsvahi/master
Add AzeDIT 3.5 card support
2014-11-05 10:56:01 +01:00
Martin Paljak 8d000774df EstEID: match card only based on presence of application.
Contact cards have ATR-s, contactless not. Only contact
cards should be broken so that they answer 0x9000 to application
selection, so this should be failsafe.
2014-04-21 21:05:11 +02:00
Rainer Metsvahi a0ceaeecab Add AzeDIT 3.5 card support
AzeDIT cards are similar to EstEID 3.5 cards but have their own
cold ATR and AID
2013-11-07 17:48:16 +02:00
Raul Metsma 2b45194f4b Add EstEID 3.5 card support
EstEID card has new cold ATR and AID
2013-10-20 20:17:57 +02:00
Martin Paljak 16ee818440 Update domain name. paljak.pri.ee is gone since 2011. 2013-02-25 11:58:25 +02:00
ludovic.rousseau 9d490bc273 Remove dead code
card-mcrd.c:1023:20: warning: Value stored to 'linep' during its initialization
      is never read
                char line[256], *linep = line;
                                 ^       ~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5165 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 21:41:24 +00:00
martin d57395173c EstonianEid: better detection and workaround for the double tag bug with v3.0 cards
See wiki:EstonianEid for the description of known issues with the card.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5126 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-01 17:32:03 +00:00
martin bc5ddb7d95 EstonianEid: add new 2011 card ATR (18.01.2011+)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5112 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-19 08:37:07 +00:00
martin 5cc8814e30 EstonianEid: Add SC_ALGORITHM_RSA_RAW to not make sc_pkcs15_compute_signature remove the DigestInfo header.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4939 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-11 22:07:07 +00:00
martin c16179f75a EstonianEid: Don't leak 1024bit key to 2048b card properties
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4899 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 12:33:24 +00:00
martin 7ab591a684 libopensc: make sc_reset() take an additional parameter "do_cold_reset" which will unpower the card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4896 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 11:22:31 +00:00
martin 113dfda494 EstEID: add support for v 3.0 cards with 2048b keys
* Detect different cards based on ATR-s and on card objects
 * Set the card name from the ATR table
 * Conditionally add support for 2048b keys
 * Add workarounds for broken MULTOS and JavaCard cards.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4893 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 14:22:01 +00:00
martin df639efd89 EstonianEid: revert to old behavior and have the T=0 forcing.
Some cards have incorrect ATR-s and can cause troubles if pcsc-lite by default tries to set T=1 by default.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4834 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-28 13:11:13 +00:00
martin 6648255cb0 EstonianEid: add a broken EstEID ATR to the Micardo driver. Don't force a protocol for EstEID cards
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4825 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-22 15:48:04 +00:00
martin df2d7d1dd1 EstEID: remove incorrect ATR matching. A reset is required as there is no way simpler way to identify a broken card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4821 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-20 15:04:31 +00:00
martin f7000a93c1 EstEID: add workarond for a buggy card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4819 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-20 08:48:56 +00:00
martin fc5b3e5417 EstEID: buffer is 2 bytes bigger than max Le.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4720 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-14 09:27:46 +00:00
martin a5ca648afd Revert r4668. Change the way limitations on max send and receive sizes are set.
See http://www.opensc-project.org/pipermail/opensc-devel/2010-September/014836.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4706 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-09 18:58:44 +00:00
martin f9026bc86f EstEID: Fix #250. Force a SELECT FILE by cheating on the internal micardo path cache.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4697 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-06 09:32:13 +00:00
martin d994bb81a1 Micardo: remove redundant mcrd_decipher. Handled by ISO7816
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4696 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-06 08:54:13 +00:00
martin 362a907bf0 Micardo: Add SC_PIN_CMD_GET_INFO support, currently only for EstEID cards.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4690 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 16:52:56 +00:00
martin b04a1ef9f0 EstEID: small fixes for working with a modified max_send/recv_size
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4666 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 11:46:31 +00:00