Commit Graph

7879 Commits

Author SHA1 Message Date
Jakub Jelen 14dec11ebd travis-ci: Try to run the tests with more recent distros
The javacard simulation unfortunately does not work with anything newer
2019-08-28 11:01:50 +02:00
Frank Morgner bdca524aa8 Fixed memory leak
Credits to OSS-Fuzz
2019-08-27 15:59:46 +02:00
Frank Morgner 03ea3f719c fixed memory leak
Credits to OSS-Fuzz
2019-08-27 15:40:32 +02:00
Frank Morgner 9b4b080be7 fixed compiler warning 2019-08-27 15:27:15 +02:00
Frank Morgner a3fc7693f3 Fixed out of bounds access in ASN.1 Octet string
Credit to OSS-Fuzz
2019-08-27 15:21:46 +02:00
Frank Morgner 412a6142c2 fixed out of bounds access of ASN.1 Bitstring
Credit to OSS-Fuzz
2019-08-27 15:19:22 +02:00
Ludovic Rousseau 2bfd022180 pkcs11-spy: add support of CKM_*_PSS in C_VerifyInit()
In bdb1961dee the same code was added to
C_SignInit(). Now it is also used in C_VerifyInit().
2019-08-27 14:52:10 +02:00
Frank Morgner 2eab2bcd74 fixed out of bounds accessing array
Credit to OSS-Fuzz
2019-08-27 14:00:34 +02:00
Ludovic Rousseau 2240abcef1 spy: display -1 instead of 18446744073709551615
buf_len is a CK_ULONG (unsigned long). But if the attribute is sensitive
or is not extractable or is invalid for the object then the library set
the buffer length value to (CK_LONG)-1.

It is more friendly to see "-1" instead of "18446744073709551615" (on
64-bits CPU)
2019-08-26 10:53:09 +02:00
Ludovic Rousseau 43a8f870e5 pkcs11-spy: add support of CKA_OTP_* values 2019-08-26 10:18:04 +02:00
Ludovic Rousseau e35a7e7395 Add definition of CKA_OTP_* constants 2019-08-26 10:17:05 +02:00
Pierre-Louis Palant b0241eefa1 Integrated virt_CACard in CI jobs (#1757)
Was: "Implement OpenSC CI without HW cards" (https://github.com/OpenSC/OpenSC/pull/1757)
2019-08-20 15:17:14 +02:00
Frank Morgner 9099d95c77 fixed interface change
fixes https://github.com/OpenSC/OpenSC/issues/1768
2019-08-20 14:21:44 +02:00
Peter Popovec d7a86d397f opensc-tool: do not connect card if not neccesary, fix util.c errors
opensc-tool: for options --version, --list-readers, -D, etc. we do not
need to connect card/reader. This removes unnecessary error messages
if card is not present in card reader or if reader is not available.
util.c: use symbolic error codes, pass error codes to caller without change.
2019-08-20 13:38:51 +02:00
Frank Morgner b6be87a348 make sc_format_apdu_ex agnostic to card properties 2019-08-20 13:38:20 +02:00
Frank Morgner 0c563df0c1 document sc_format_apdu_ex() 2019-08-20 13:38:20 +02:00
Frank Morgner 0e97ef2ce3 don't use sc_format_apdu_ex in default driver
fixes https://github.com/OpenSC/OpenSC/issues/1731
closes https://github.com/OpenSC/OpenSC/pull/1734
2019-08-20 13:38:20 +02:00
Frank Morgner 8dc67e6a61 use statement for noop 2019-08-20 13:38:20 +02:00
Raul Metsma fdf80761cf Remove duplicate code
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-08-20 13:38:00 +02:00
Jakub Jelen 9b47462a51 Fix portability warning from coverity
CID 344928 (#1 of 1): Sizeof not portable (SIZEOF_MISMATCH)
suspicious_sizeof: Passing argument object_handles of type CK_OBJECT_HANDLE_PTR and argument objects_length * 8UL /* sizeof (CK_OBJECT_HANDLE_PTR) */ to function realloc is suspicious. In this case, sizeof (CK_OBJECT_HANDLE_PTR) is equal to sizeof (CK_OBJECT_HANDLE), but this is not a portable assumption.
2019-08-20 13:28:54 +02:00
Jakub Jelen 1a0a8e637b p11test: Check return values
CID undefined (#1 of 1): Unchecked return value (CHECKED_RETURN)
10. check_return: Calling RSA_set0_key without checking return value (as is done elsewhere 7 out of 8 times).
2019-08-20 13:28:54 +02:00
Jakub Jelen 818aa5b69c p11test: Avoid possible issues reported by coverity
* The fail_msg() in cmocka has a way not to fail, which confuses coverity. Adding explicit retunr/exit should address this issue
 * Reformat some code in p11test
2019-08-20 13:28:54 +02:00
Jakub Jelen 2958b71c9a typo 2019-08-20 13:28:54 +02:00
Frank Morgner 7d8009e429 PC/SC: handle resets in SCardTransmit
fixes https://github.com/OpenSC/OpenSC/issues/1725
2019-08-20 13:25:06 +02:00
Frank Morgner aa489baf74
md: added missing cardos5 ATRs (#1750)
fixes https://github.com/OpenSC/OpenSC/issues/1735
2019-08-20 13:24:33 +02:00
Frank Morgner 8f838bc1e0 fixed passing LIB_FUZZING_ENGINE 2019-08-19 16:44:54 +02:00
Peter Popovec 426772298a pkcs15-tool: inconsistent -r option fix
Option -r is used in other opensc tools to specify card reader.  pkcs15-tool
uses -r to specify cerfificate.  This fix intorduces warning message if -r
is used, and for future versions of pkcs15-tool -r is used to specify
reader.
2019-08-05 01:14:35 +02:00
Doug Engert 93bdc8c826 Support OpenSSL when deprecated defines have been removed Fixes 1755
sc-ossl-compat.h will check if OpenSSL has been built with or without some
deprecated defines. OpenSSL will provide defines for some of these if
built to still support depreacted routines but not if built with
"no-depracted". .

This commit will define some of the needed defines if ther are not
defined by OpenSSL. Thus if a distro builds OpenSSL with "no-depracted"
it can still be used.

 On branch fix-1755
 Changes to be committed:
	modified:   src/libopensc/sc-ossl-compat.h
2019-07-31 20:12:22 +02:00
Frank Morgner af8f965009 fixed memory leak 2019-07-26 15:23:02 +02:00
Frank Morgner bf8d449795 fixed memory leak 2019-07-26 15:23:02 +02:00
Frank Morgner 973b09f943 fixed exports 2019-07-26 15:23:02 +02:00
Frank Morgner 72f474f09f use consistent parameters
- in sc_pkcs15_wrap()
- and sc_pkcs15_derive()
2019-07-26 15:23:02 +02:00
Frank Morgner e28ada99fe added parameter checking 2019-07-26 15:23:02 +02:00
Frank Morgner b7f202221c fixed undefined reference 2019-07-26 15:23:02 +02:00
Frank Morgner 86c4d3384b removed undefined reference to sc_pkcs15_create 2019-07-26 15:23:02 +02:00
Frank Morgner 45dfc14573 fixed memory leak 2019-07-26 15:23:02 +02:00
Frank Morgner 755ac78a02 added fuzzing with libFuzzer and OSS-Fuzz
makes cmocka detection not required for building tests
2019-07-26 15:23:02 +02:00
Rosen Penev 7159400086 treewide: Fix compilation without deprecated OpenSSL APIs 2019-07-26 08:49:18 +02:00
programatix 91b9aea42a Update pkcs15-sec.c
When card supports SC_ALGORITHM_RSA_PAD_PKCS1 but not SC_ALGORITHM_RSA_HASH_NONE, then the DigestInfo need to be removed.

Current check make requires the card to not support both SC_ALGORITHM_RSA_PAD_PKCS1 and SC_ALGORITHM_RSA_HASH_NONE to have the removal done.
2019-07-26 08:48:10 +02:00
Jó Ágila Bitsch a7766b3de3 allow chaining for pkcs15-init --store-private-key EC keys
when importing a private key onto a pkcs15 card, if the card does not support
extended APDUs, we need to use chaining to store keys longer than 255 bytes.

While for RSA keys, this check was included, it was missing for EC keys.
This patch adds the SC_APDU_FLAGS_CHAINING flag to apdu.flags if data length is
greater than 255 and the card caps does not include SC_CARD_CAP_APDU_EXT.

Fixes #1747
2019-07-24 01:25:49 +02:00
Peter Popovec 8a20b980b9 travis.yml - install socat and ant packages.
Fixes #1745
2019-07-24 01:22:43 +02:00
Raul Metsma d14cf97d7a Allow to create temporary objects with readonly sessions and readonly cards
Fixes #1719

Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-07-22 13:34:59 +02:00
Daniel Kouril 916434f3a2 Fix using environmental variables on WIN32. 2019-07-22 13:32:46 +02:00
carblue 709fa98bb5 opensc-tool: fix --list-algorithms for AES 2019-07-22 13:09:30 +02:00
Frank Morgner ba19a467e4
Rutoken Lite (#1728)
* card-rtecp: Add Rutoken Lite

* avoid seperate rutoken lite driver

* added rutoken lite to minidriver

closes #1722
2019-07-22 13:05:32 +02:00
programatix 130e9bb068 Update strings.c 2019-07-04 10:12:23 +02:00
programatix 6b97071bb3 Update strings.c
The check condition is obviously wrong. It should check for EQUAL. The original bitwise check caused any other language to turn into DE because as long as a bit is filtered, it will hit.
2019-07-04 10:12:23 +02:00
Dmitriy Fortinskiy 3c1624676d card-rtecp,card-rutoken: Set specific card types 2019-07-02 12:13:57 +02:00
Dmitriy Fortinskiy 60a2cf16c7 card-rtecp: Fix list_files on T0 cards
Rutoken ECP SC over T0 expects Get Response after SW1=61 which
is not called with zero le.
2019-07-02 12:13:57 +02:00
Frank Morgner 7fb72ccf7b pkcs11: fixed slotIDs when a new slot list is requested
fixes https://github.com/OpenSC/OpenSC/issues/1706

regression of 24b7507a69
2019-06-30 10:24:11 +02:00