Commit Graph

114 Commits

Author SHA1 Message Date
Frank Morgner 267aea759c use platform dependant implementation of erasing memory
fixes potentially insecure use of memset in CWA SM implementation

fixes https://github.com/OpenSC/OpenSC/issues/1957
2020-03-06 12:23:16 +01:00
Frank Morgner 9294058d5c fixed requesting DWORD with sc_ctx_win32_get_config_value
the length of the value is not determined by strlen()
2018-08-05 11:35:12 +02:00
Frank Morgner 9983c4185f fixed incompatible types ('DWORD *' to 'size_t *') 2016-06-14 14:11:26 +02:00
Frank Morgner b9cefa6825 removed unused variable 2016-06-05 02:28:50 +02:00
Viktor Tarasov 66515989d8 win32: method to get config option from registers 2016-04-17 12:43:18 +02:00
Frank Morgner 50f03bca3f fixed memory leak 2016-02-29 13:08:34 +01:00
Frank Morgner 9e1a5447d4 profile.c: fixed potential resource leak 2015-10-30 12:15:06 +01:00
Frank Morgner b96ba14aae added fall through comment 2015-10-30 12:15:06 +01:00
Olaf Kirch f42a1c2563 Replace outdated address okir@lst.de -> okir@suse.de
Signed-off-by: Olaf Kirch <okir@suse.de>
2015-10-05 14:07:28 +02:00
Frank Morgner 01e573b987 profile: fixed resource leak 2015-05-08 09:11:54 +02:00
Frank Morgner 8d902d1ed3 fixed out of bounds read/write/access 2015-02-04 09:24:50 +01:00
Frank Morgner 7fb495ac31 fixed self assignment 2015-01-28 07:10:57 +01:00
Frank Morgner 7a34c204c1 fixed dereference before null check
silence warnings reported by coverity-scan
2015-01-22 20:29:33 +01:00
Viktor Tarasov b1a5ebfac7 pkcs15init: introduce 'max-unblocks' PIN init parameter 2013-12-29 22:00:28 +01:00
Viktor Tarasov 13d1b8e9f2 pkcs15init: file 'content' and 'prop-attrs' in the card profile
Now it's possible to describe in the card profile
the 'prop-attr' and 'encoded-content' data of the file to create
2013-12-29 20:05:35 +01:00
Viktor Tarasov 51262f00ac pkcs15init: in profile more AC operations are parsed, ...
new AC-OP 'pin-use'
2013-12-29 20:05:35 +01:00
Viktor Tarasov 4b30292585 more macros for the values from ISO specification 2013-02-24 19:37:35 +01:00
Viktor Tarasov b432e9767f pkcs15init: add 'minidriver-style' profile option
The on-card support of minidriver could need some MD specific pkcs#15 (DATA) objects.
There is no standard for these objects.
New option will allow to choose one of the possible implementations.
2012-05-26 09:36:49 +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
jps c5c2366a0b Revert 5558
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5562 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-08 07:58:51 +00:00
jps b422872813 For CardOS 4.3B and 4.4, the Verify Retry Counter Package
can be loaded at ADMINISTRATION life cycle phase to change
the behavior of the VERIFY command in regard to return codes.
When that package is loaded, the PIN can be created with this
"verifyRC" flag in cardos.profile if the return code must be 
ISO7816-4 compliant (63Cx with x being the value of the remaining 
retry counter when required verification has failed).



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5558 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-07 12:44:53 +00: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
andre ff7bb8fbf4 profile.c: Avoid warning:
profile.c:1212: warning: comparison between signed and unsigned

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5373 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 12:59:23 +00:00
ludovic.rousseau f88bbe117f Remove typedef file_info to complete the change/cleanup in revision 5250
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5251 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:12:40 +00:00
ludovic.rousseau 99bbc06bcb Fix compiler warning
profile.c: In function 'sc_profile_get_pin_id_by_reference':
profile.c:785: warning: declaration of ‘pin_info’ shadows a global declaration
profile.c:217: warning: shadowed declaration is here

Avoid using a typedef with a "common" name


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5250 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:10:10 +00:00
martin 7ab9b7f10d Fix a typo reported by lintian
I: libopensc3: spelling-error-in-binary ./usr/lib/libopensc.so.3.0.0 extention extension

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5238 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-20 12:18:55 +00:00
vtarasov 2fff7a1e91 pkcs15init: profile: unused variables
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5113 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-19 14:16:12 +00:00
vtarasov d1f7e7b8c8 pkcs15init: profile: little fix of the previous commit
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5102 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-17 16:52:04 +00:00
vtarasov 2adfa05ac8 pkcs15init: profile: use short form of the log message call
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5101 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-17 16:49:56 +00:00
vtarasov 51ab68db83 pkcs15init: profile: redesign 'sc_profile_find_file_by_path()' ...
to take into account the non-zero 'aid' member in the 'path' parameter 
or in the path of the file's instance

also take into account the non-zero 'aid' when getting 'file-id'


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5099 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-17 16:05:43 +00:00
vtarasov c65bc9023b pkcs15init: profile: new function 'get_parent' ...
to get profile instance of the parent of some file presented by it's profile name.

;accept hexadecimal values presented in 'xAB' form;
;coding style issues;


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5098 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-17 15:51:47 +00:00
vtarasov 1519cb38a1 pkcs15init: profile: handles for 'profile-extention' and 'exclusive-aid' ...
'profile-extention' profile parameter used to load from the separate file 
the AID dependent profile part.

'exclusive-aid' profile parameter used to introduce the AID for the DF
that do not have file-id and that can be selected only by 'DF-NAME' selection.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5097 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-17 15:18:11 +00:00
vtarasov 35a54b511c pkcs15init: profile: sc_profile_finish() accept additional parameter 'application info' ...
Each application of the multi-application PKCS#15 card has it's own associated pkcs15init profile file.
Profile of the multi-application card contains an association between the ID of the on-card application 
and associated profile name.

When sc_profile_finish() is called
 - sc_card is connected,
 - information on the preset on-card applications is available;
 - AID of the applicaition to be binded is known.
thus allowing to sc_profile_finish() to load the final part of the profile.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5096 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-17 14:51:10 +00:00
vtarasov 41731ce56f pkcs15init: profile: parse new AC operation types ...
debug messages and some coding style issues


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5095 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-17 14:03:01 +00:00
vtarasov 4fbe008623 pkcs15init: more of debug messages in profile.c
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5032 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-03 09:44:10 +00:00
vtarasov ae9854d7bc pkcs15-init: profile: instantiate 'BSO' file
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5025 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-02 14:27:42 +00:00
vtarasov 6cc1134fac pkcs15-init: 'PSO-*' ACL names in profile
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5020 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-02 14:02:47 +00:00
vtarasov e259021d36 win32: change path to OpenSC windows registers
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4935 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-09 09:23:21 +00:00
martin f5a21e417b pkcs15: don't play with TokenInfo.version. 0 means PKCS#15 v1.1. The flag is not used by OpenSC.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4789 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 16:02:57 +00:00
martin 50f99a20f8 libopensc: move TokenInfo fields from sc_pkcs15_card_t to a separate structure.
Thanks to Andre Zepezauer for the patch.

See http://www.opensc-project.org/pipermail/opensc-devel/2010-September/015076.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4788 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 15:44:58 +00:00
viktor.tarasov ec6bb9859d MyEID: For Aventra card applied Toni's patch, enriched by Andre's proposal
see:
http://www.opensc-project.org/pipermail/opensc-devel/2010-August/014662.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4686 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-04 20:46:07 +00:00
martin cd01ad0936 pkcs15init: On Windows, get the profile directory from registry instead of configuration file.
This allows the installation directory for non-dll files to be anywhere on the system.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4652 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-25 12:51:55 +00:00
ludovic.rousseau f47416d60e Do not cast the return value of malloc(3) and calloc(3)
From http://en.wikipedia.org/wiki/Malloc#Casting_and_type_safety
" Casting and type safety

malloc returns a void pointer (void *), which indicates that it is a
pointer to a region of unknown data type. One may "cast" (see type
conversion) this pointer to a specific type, as in

int *ptr = (int*)malloc(10 * sizeof (int));

When using C, this is considered bad practice; it is redundant under the
C standard. Moreover, putting in a cast may mask failure to include the
header stdlib.h, in which the prototype for malloc is found. In the
absence of a prototype for malloc, the C compiler will assume that
malloc returns an int, and will issue a warning in a context such as the
above, provided the error is not masked by a cast. On certain
architectures and data models (such as LP64 on 64 bit systems, where
long and pointers are 64 bit and int is 32 bit), this error can actually
result in undefined behavior, as the implicitly declared malloc returns
a 32 bit value whereas the actually defined function returns a 64 bit
value. Depending on calling conventions and memory layout, this may
result in stack smashing.

The returned pointer need not be explicitly cast to a more specific
pointer type, since ANSI C defines an implicit conversion between the
void pointer type and other pointers to objects. An explicit cast of
malloc's return value is sometimes performed because malloc originally
returned a char *, but this cast is unnecessary in standard C
code.[4][5] Omitting the cast, however, creates an incompatibility with
C++, which does require it.

The lack of a specific pointer type returned from malloc is type-unsafe
behaviour: malloc allocates based on byte count but not on type. This
distinguishes it from the C++ new operator that returns a pointer whose
type relies on the operand. (see C Type Safety). "

See also
http://www.opensc-project.org/pipermail/opensc-devel/2010-August/014586.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4636 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-18 15:08:51 +00:00
aj 6545b42c02 cleanup of the debug code:
* reduce to a few, supported functions.
* change all functions to take the debug level as parameter.
* use symbolic names for the debug levels.
* fix tools to pass "verbose"/"opt_debug" as ctx->debug.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4118 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-15 12:17:13 +00:00
viktor.tarasov aff7b5523c pkcs15init: homegenize pin reference type in a different structures; remove unused parameters in the internal procedures;
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4088 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-05 10:37:11 +00:00
viktor.tarasov 21acf3ed3d pkcs15init profile: fix indexed instantiation of pin/key domain; more of debug messages
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4083 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-04 12:55:09 +00:00
aj d22a2483c0 Header file cleanup.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4081 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-04 08:14:36 +00:00
viktor.tarasov 1bd07bacd6 pkcs15init profile: syntax error can provoke segmentation fault
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4080 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-03 17:22:01 +00:00
viktor.tarasov dbd315c7e9 profile: 'cbs' member of 'struct sc_profile' is not used
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4075 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-01 14:01:25 +00:00
viktor.tarasov 4dd6abf41b pkcs15init: in the prototypes of the internal procedures the 'struct sc_card' argument replaced with the 'struct sc_pkcs15_card' one
This patch is not largely tested and it will be followed (hope in a few hours) with another one 
that will replace the using of the static pincache 
with the pincache as the content of the AUTH pkcs15 object.

In the intervention into the card specific part I tried to respect its creator's coding style.
Sorry, if it's not always the case.




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4057 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-21 16:21:57 +00:00