Commit Graph

35 Commits

Author SHA1 Message Date
Jakub Jelen 46cfe89b3c pkcs15-iasecc: Avoid memory leak
Thanks coverity

CID 365818
2021-02-25 09:08:52 +01:00
Jakub Jelen cee431a3ce pkcs15-iasecc: Check return value as in other cases
Thanks coverity

CID 365820
2021-02-25 09:08:52 +01: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 09af8714ad Avoid GCC 7 warnings with -Werror (#1196)
* Avoid GCC 7 warnings with -Werror

-Werror=implicit-fallthrough=
	libopensc/card-incrypto34.c
		not sure if this is a bug or intention
	libopensc/card-rutoken.c
		most probably intention
	libopensc/card-westcos.c
		remove bogus if so the compile is not confused
		I will fill a separate bug to gcc probably
	pkcs15init/pkcs15-iasecc.c
		Simplify the log and avoid compiler confusion
	sm/sm-common.c
		explicit fallthrough
	tools/pkcs11-tool.c
		use explicit fallthrough comment
	tools/pkcs15-init.c
		The fallthrough is obvious here

-Werror=format-truncation=
	libopensc/pkcs15-itacns.c
		use explicit string lengths
	pkcs11/framework-pkcs15.c
		calculate the truncation
	tests/pintest.c
		avoid sprintf
	tools/pkcs15-crypt.c
		avoid sprintf
	tools/pkcs15-init.c
		calculate the truncation
2017-11-17 10:47:53 +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
Viktor Tarasov 07493c11d8 iasecc: select parent before fixing ACLs of a new file
With MD, after card rebinding, the context to fix ACLs for a
new certificate file can be changed.
2016-04-01 18:09:04 +02:00
Frank Morgner 4f4c4aa5ec pkcs15-iasecc.c: fixed potential resource leak 2015-10-30 12:15:06 +01:00
Viktor Tarasov 475ce71453 iasecc: fixed resource leak
pkcs15-iasecc: fix memory leakage
iasecc: fix memory leakage
2015-05-08 09:11:20 +02:00
Thomas Calderon 117f3a74be iasecc: Fix key usage when provisioning card
* Avoids overriding key_usage when creating objects on the card.
2015-03-31 18:25:54 +02:00
Frank Morgner 3a92bf7af5 fixed resource leaks 2015-02-05 01:38:41 +01:00
Frank Morgner a3fc62f79f fixed NULL dereference (or warning thereof) 2015-02-05 01:38:40 +01:00
Thomas Calderon bbedd4ef00 IAS-ECC: improve PKCS#11 compliance Issue #336
* Ensure CKA_ALWAYS_SENSITIVE and CKA_NEVER_EXTRACTABLE are only set when
  generating the key on board, not reason to set them when importing a private
  key.
2015-01-05 13:59:37 +01: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 122c58de85 pkcs15init: do not use 'der-data' of pubkey data 2014-02-09 18:49:58 +01:00
Viktor Tarasov 085f971f95 pkcs15init: iasecc: fix uncomplete merge
prototype of sc_pkcs15_get_object_guid has been changed
2014-01-19 19:19:17 +01:00
Viktor Tarasov 98325ab7f2 pkcs15: export 'sc_pkcs15_serialize_guid' ...
change name of exported 'sc_pkcs15_get_guid' to 'sc_pkcs15_get_object_guid' ;
add more 'CALLED' and 'RETURN' macros ;
2013-12-29 19:46:56 +01:00
Frank Morgner d21830344f fixed a ton of compiler warnings 2013-08-03 19:15:55 +02:00
Viktor Tarasov 8fc679bf40 libopensc: invalid usage of SC_ERROR_MEMORY_FAILURE
Initiated by discussion in https://github.com/OpenSC/OpenSC/pull/134 .

SC_ERROR_MEMORY_FAILURE has to be used as a resulting code of the card related operations,
and not as result of the memory allocation problems.

New 'warning' category of SC_ERRORs introduced -- SC_WARNING_xx .
Error text and SC_ERROR associated with return codes 6300 and 6200 has been changed.
2013-03-02 19:29:14 +01:00
Viktor Tarasov ceef4c0be3 iasecc: remove ostentatious TODO messages 2012-09-24 11:50:56 +02:00
Viktor Tarasov 58b4304957 libopensc: 'init', 'format', 'compare', 'is-valid' OID procedures
In a reason of number of bugs(*) that concern the OID management,
the general usage OID procedures 'init', 'format', 'compare', 'is-valid' are introduced.
These procedures should be used by all actors: libopensc, pkcs15, pkcs11, tools, ....

(*)
This bug reported by Andreas Schwier :
8e75d971cb (commitcomment-1792477)

In pkcs15-algo sc_asn1_get_algorithm_info() can return the OID without ending '-1's:
https://github.com/OpenSC/OpenSC/blob/staging/src/libopensc/pkcs15-algo.c#L452
https://github.com/OpenSC/OpenSC/blob/staging/src/libopensc/pkcs15-algo.c#L459
2012-09-06 10:47:29 +02:00
Andreas Schwier ee94020919 pkcs15-init: Fixed bugs and improved isolation between framework and emulation layer
select_object_path: Fixed misplaced return and wrong return code. This bug is the cause why a profile
must include a template even for fully emulated cards.

sc_pkcs15init_store_certificate: Added a call to the emulation layer when the private key
description requires an update after storing a certificate. Should not break existing code.

sc_pkcs15init_delete_object: Now calling the emulation layer before the frameworks tries to delete
files itself. An emulation that deletes object explicitly and leaves the deletion of some objects
to the framework will now need to completely handle deleting objects (by calling the methods of the
framework).

sc_pkcs15init_update_certificate: Missing call to the emulation layer added.
2012-09-01 21:01:51 +02:00
Viktor Tarasov 78fe16654e pkcs15init: iasecc: create objects for minidriver support
- Create/delete the PKCS#15 'DATA' objects destinated to supply support of minidriver. For a while only 'Gemalto' style of such support is implemented.
- Declare epass2003 pkcs15init operations.
- include into OpenSC configuration the SM related sections
2012-06-08 20:17:36 +02:00
Viktor Tarasov e57d443e86 pkcd15init: remove trailing whitespaces
inspired by
http://www.opensc-project.org/pipermail/opensc-devel/2012-March/017883.html

Change-Id: I817f903e67965942d9cc0c30931dbaea0c5f736e
2012-04-02 23:40:05 +02:00
Stef Walter 6ed52a06b8 libopensc: Don't fail to allocate memory when mlock fails
* Print out warning when mlock fails, and continue.
 * The warning required a ctx to be passed in, so that means
   changing a few function signatures.

https://www.opensc-project.org/opensc/ticket/389
2012-02-17 10:02:55 +01:00
vtarasov d888b3fd55 pkcs15: use general 'AuthenticationObject' instead of 'PinObject'
now the attributes of the previous 'pin-info' data type are included
as the sub-type attributes of the general 'auth-info' data .
It will allow to include support of the 'biometricTemplate' and 'authKey' authentication types.

http://www.opensc-project.org/pipermail/opensc-devel/2011-May/016655.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5550 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-05 15:46:25 +00:00
vtarasov f026db6f84 compile warnings: resolve 'comparison between signed and unsigned' compiler warnings
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5534 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-02 16:59:39 +00:00
vtarasov fc07974be8 iasecc: pkcs15init: test for the wrong error code was used ...
in 'Delete SDO' procedure to ignore the 'SDO don not exist' error.
Thanks to Gilles Blanc.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5422 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-04 11:41:13 +00:00
vtarasov 0783ffd4c7 iasecc: pkcs15init: when deleting SDO, do not try to overwrite 'non-updateable' SDO attribut
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5419 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-03 07:54:13 +00:00
vtarasov 06347f3a44 iasecc pkcs15init: when creating key slot, there is no needs to write zero value components
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5400 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-27 13:45:27 +00:00
vtarasov 81e1676122 iasecc pkcs15init: create/delete SDO private/public RSA key
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5399 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-26 17:32:34 +00:00
vtarasov 614e9fa566 pkcs15init: sipmlify the 'delete-object' callaback prototype ...
now it takes 'sc_pkcs15_object' argument instead of two arguments - object's type and object's data.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5343 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-15 16:50:04 +00:00
ludovic.rousseau 6fe27b2c4a Fix compiler warning
pkcs15-iasecc.c:63: warning: no previous prototype for 'iasecc_reference_to_pkcs15_id'


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5254 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:19:15 +00:00
vtarasov 53dd2ceafa IAS/ECC: remove dead code and '//' coments, resolve some warnings ...
to be continued, thanks to Martin


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5200 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 14:05:17 +00:00
vtarasov 57b7a81c3a IAS/ECC: add IAS/ECC card specific files ...
as it was announced in 
http://www.opensc-project.org/pipermail/opensc-devel/2011-January/015756.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5197 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 10:55:05 +00:00