Commit Graph

128 Commits

Author SHA1 Message Date
Jakub Jelen 1ae8b60425 mcrd: Do not leak memory
Similar as in 62049ea18c

Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28405
2020-12-09 15:50:54 +01:00
Raul Metsma 57f37ffd8d Remove unused and broken RSA EstEID support
Signed-off-by: Raul Metsma <raul@metsma.ee>
2020-09-02 11:21:33 +02:00
Zoltan Kelemen 48d939b057 Removed length_offset since it is not used any more. 2020-08-19 10:01:58 +02:00
Raul Metsma e91853bda8 Simplify code and card detection
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-12-05 10:51:55 +01:00
Frank Morgner 192994fa13 fixed 13608 Unchecked return value 2019-11-05 21:49:30 +01:00
Jakub Jelen 61cd7fcdb2 card-mcrd: Free the allocated structures on cleanup
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18416
2019-10-25 20:25:06 +02:00
Jakub Jelen 19f4c7e428 card-mcrd.c: Avoid null dereference
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18477
2019-10-23 13:50:52 +02:00
Jakub Jelen 62049ea18c Avoid memory leaks from file selection
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17106
2019-10-22 09:38:30 +02:00
Frank Morgner 9099d95c77 fixed interface change
fixes https://github.com/OpenSC/OpenSC/issues/1768
2019-08-20 14:21:44 +02:00
Raul Metsma fdf80761cf Remove duplicate code
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-08-20 13:38:00 +02:00
Frank Morgner 94388f9538 fixed more clang-tidy warnings 2019-06-05 13:48:51 +02:00
Raul Metsma 1e59643caa Remove process_arr unused file argument and fix clang-tidy warnings
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-05-21 19:34:46 +02:00
Raul Metsma 5123531e62 Fix EstEID 3.4 signing
opensc master requires now SC_ALGORITHM_RSA_HASH_NONE

Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-05-02 10:06:19 +02:00
Frank Morgner b389b19ca5
Merge pull request #1633 from metsma/esteid
Only EstEID 3.5 has EC 384 keys
2019-03-25 14:31:02 +01:00
Raul Metsma 7ae54f490d Remove dead code (#1638) 2019-03-25 14:28:53 +01:00
Raul Metsma 4d2254a092 Only EstEID 3.5 has EC 384 keys
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-03-13 23:01:07 +02:00
Raul Metsma 1e6d3df201 Remove un-lincenced header file
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-03-13 21:19:26 +01:00
Raul Metsma b227fb8b9f Cleanup EstEID 1.0/1.1 lefovers
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-03-07 21:31:08 +02:00
Frank Morgner 01d515a026 fixed use of garbage value 2019-02-14 09:22:23 +01:00
Raul Metsma c2cc83754e select_esteid_df is only used in card-mcrd.c
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-02-12 08:56:20 +01:00
Raul Metsma f37a8a5c52 is_esteid_card is only used card-mcrd.c
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-02-12 08:56:20 +01:00
Frank Morgner 7a7ff50422 fixed memory leaks during card initialization 2019-01-30 21:57:59 +01:00
Frank Morgner 893be0d9c0 fixed memory leaks 2019-01-30 21:57:59 +01:00
Frank Morgner a899a46b09 replaced SC_TEST_RET with LOG_TEST_RET 2018-12-06 09:26:42 +01:00
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