Commit Graph

61 Commits

Author SHA1 Message Date
Vincent JARDIN a21bcf4b41 IASECC/Gemalto: register application
Register application for Gemalto Dual ID ONE Cosmo.
2021-04-26 21:37:39 +02:00
Vincent JARDIN fd97f49a84 IASECC: CPX have 2 applications
There are 2 applications: default one (contact mode) and the contactless
mode.
2021-03-17 10:58:20 +01:00
Frank Morgner dc29b0fe18 fixed memory leak
fixes https://oss-fuzz.com/testcase-detail/6237284133502976
2020-03-12 23:07:17 +01:00
Jakub Jelen 708cedbdad dir: Correctly free allocated memory on error
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19265
2019-12-11 09:19:45 +01:00
Jakub Jelen 75847f4e93 Make ef_dir variable local
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18821
2019-11-13 15:48:40 +01:00
Frank Morgner 49f59d9fc9 clean up already enumerated apps 2019-10-29 17:54:40 +01:00
Jakub Jelen 532b06d07e pkcs15: Avoid insane allocations
and use single max constant accross the code

https://oss-fuzz.com/testcase-detail/6314983763214336
2019-10-25 20:22:40 +02:00
Jakub Jelen eac516fd41 dir: Avoid insane allocations
Resolves:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17449
2019-10-03 13:57:09 +02:00
Frank Morgner d4f1decd15 Make sure card's strings are Nul terminated
Avoids out of bounds reads when using internal operations with the given string
2019-03-13 21:17:00 +01:00
Frank Morgner 7f7bcbff52 fixed misuse of realloc
calling it with size 0 leads to a free, which eventually may lead to a
double free corruption.
2019-01-30 21:57:59 +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
Frank Morgner 87cdfcb08c OpenPGP: Implemented "keep alive" command 2018-02-07 11:57:48 +01: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 754eaf3c14 config: allow disabling of PKCS15 application 2016-02-16 16:54:14 +01:00
vletoux 976db5cb04 card-masktech: initial commit
card-masktech.c: fix building issues on the integration platform

card-masktech.c: fix linux compilation errors

honour HAVE_CONFIG_H

card-masktech.c: take in account Frank's remark about extended APDU in masktech_decipher

remove trailing spaces
2015-05-05 10:13:26 +02:00
Frank Morgner bcb5fc15e5 honour HAVE_CONFIG_H 2015-04-22 23:55:33 +02:00
Frank Morgner 69b27179eb use path only if it is actually present 2014-12-12 21:45:52 +01:00
Viktor Tarasov 954d0b9375 pkcs15: DIR EF can have EF_LINEAR structure
and so, in this case the checking file size is not appropriate method to validate it.
;use short call form for the log messages;
2012-05-29 19:19:06 +02:00
andre e966cc1e6e dir.c: In function ‘update_single_record’:
dir.c:318: warning: unused parameter ‘file’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5531 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-01 16:54:40 +00:00
andre 93deff0161 dir.c: Avoid warnings:
dir.c:212: warning: comparison between signed and unsigned
dir.c:220: warning: comparison between signed and unsigned


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5298 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-06 15:11:18 +00:00
vtarasov a1c3191ba1 libopensc: parse EF.DIR: no need to check the presence of mandatory AID after success of ASN1 decoding
use "struct sc_aid"


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5080 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-11 10:08:05 +00:00
vtarasov 42fbe85a52 libopensc: use 'calloc' to allocate application info ...
remove unused variable


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5063 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-09 08:31:06 +00:00
vtarasov 209224816a libopensc: introduce TLV and LV data type, use it to store DDO data
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5051 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-06 16:16:24 +00:00
vtarasov 0761a61a65 libopensc: use 'struct sc_aid' instead of 'u8 *aid, size_t aid_len'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5048 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-05 15:42:36 +00:00
vtarasov 121260b846 pkcs15: some changes to the discovery on-card applications code ...
; 'known' pkcs#15 applications are moved to the head of the card applications array;
; card specific 'bind finalization' code moved to the dedicated procedures;
; remove unused sc_application member, procedures;
; remove commented code;
; add debug messages;


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5045 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-05 14:53:52 +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
s 15d51479ae fix: SIGSEGV
Program received signal SIGSEGV, Segmentation fault.
0x00007f7d6f29fd55 in free () from /lib64/libc.so.6
(gdb) bt
#0  0x00007f7d6f29fd55 in free () from /lib64/libc.so.6
#1  0x00007f7d703a4128 in sc_update_dir (card=0x17463a0, app=<value optimized out>) at dir.c:306
#2  0x00007f7d7040cb58 in sc_pkcs15init_add_app (card=<value optimized out>, profile=0x1754840,
    args=<value optimized out>) at pkcs15-lib.c:2354



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4389 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-30 13:52:04 +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
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
martin 9c7eb8122a Add support for Portugese eID on IAS and Gemsafe cards, by João Poupino.
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3755 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-03 14:41:14 +00:00
martin d672fde449 Remove sc_error and sc_ctx_suppress_errors_* in favor of sc_debug/fprintf
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3721 c6295689-39f2-0310-b995-f0e70906c6a9
2009-09-14 08:46:59 +00:00
aj b3ad2f9dd2 convert to utf-8.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3084 c6295689-39f2-0310-b995-f0e70906c6a9
2006-12-19 21:31:17 +00:00
aj bc23ab4cd2 free allocated variable in error path.
set rec=NULL after freeing it to prevent
double free'ing.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2707 c6295689-39f2-0310-b995-f0e70906c6a9
2005-12-05 21:33:11 +00:00
nils 47ee84e72d add functions
void sc_ctx_suppress_errors_on(sc_context_t *ctx);
	void sc_ctx_suppress_errors_off(sc_context_t *ctx);
to turn on/off error suppression (to avoid accessing
sc_context_t directly) and use it.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2671 c6295689-39f2-0310-b995-f0e70906c6a9
2005-10-30 19:08:06 +00:00
nils c7a8e84caf suppress errors in pkcs15 card detection if we don't know whether we really have a pkcs15 card
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2640 c6295689-39f2-0310-b995-f0e70906c6a9
2005-10-08 11:08:34 +00:00
nils 23802d825e properly initialize sc_asn1_entry elements + some cleanup
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2463 c6295689-39f2-0310-b995-f0e70906c6a9
2005-08-05 07:24:43 +00:00
nils d88f377747 interpret rec_nr == 0 as a request to create a new record, fix for bug report #21
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2398 c6295689-39f2-0310-b995-f0e70906c6a9
2005-07-12 21:03:47 +00:00
bert 2d97002824 API fixup: use defined type instead of struct for exposed structs
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2232 c6295689-39f2-0310-b995-f0e70906c6a9
2005-03-08 20:59:35 +00:00
aet 864825651e - Fixed typos
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2155 c6295689-39f2-0310-b995-f0e70906c6a9
2005-02-07 17:03:47 +00:00
nils 912ddbdf57 fix compiler warnings
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1938 c6295689-39f2-0310-b995-f0e70906c6a9
2004-10-17 18:34:24 +00:00
nils c994105bcf suppress annoying (but unimportant) error message
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1931 c6295689-39f2-0310-b995-f0e70906c6a9
2004-10-14 06:37:04 +00:00
nils 47de5b0a4a fix usage flag
Thanks to Peter Koch <pk.opensc@naev.de>


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1786 c6295689-39f2-0310-b995-f0e70906c6a9
2004-05-21 10:15:30 +00:00
nils b62825d319 fix memory leak
Discovered by Victor Tarasov (thanks)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1774 c6295689-39f2-0310-b995-f0e70906c6a9
2004-04-21 16:52:40 +00:00
okir c20fcf5e7b - bump max number of apps per card to 8
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1544 c6295689-39f2-0310-b995-f0e70906c6a9
2003-10-19 18:05:03 +00:00
okir 734bceb682 - Error logging changes: replace ctx->log_errors with ctx->suppress_errors,
so that we can nest error suppression using suppress_errors++/suppress_errors--


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1518 c6295689-39f2-0310-b995-f0e70906c6a9
2003-10-14 09:56:50 +00:00
aet 0077a0876d Fix various C compiler warnings and C++ errors / name conflicts
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1463 c6295689-39f2-0310-b995-f0e70906c6a9
2003-09-25 09:33:16 +00:00
sth cdc2f67c60 Bugfix: return SC_ERROR_OUT_OF_MEMORY if malloc() fails (Kevin Stefanik)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1445 c6295689-39f2-0310-b995-f0e70906c6a9
2003-09-16 06:36:41 +00:00
aet 5616dba08e - Stop using unflexible automake conditionals when
building PC/SC, OpenCT or USBToken support,
  use ifdef's directly in source.
- Because of above, add HAVE_PCSCLITE for winconfig.h
- Remove unnecessary includes for log.h, opensc.h and
  errors.h in libopensc sources, they're already taken
  care by internal.h.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1406 c6295689-39f2-0310-b995-f0e70906c6a9
2003-09-03 09:28:55 +00:00
aet 763fc16704 Rename libopensc specific error/debug to sc_error/sc_debug
We should have done this ages ago.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1392 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-25 14:21:18 +00:00
okir 2abc504051 - remove signedness warnings printed by new gcc
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1176 c6295689-39f2-0310-b995-f0e70906c6a9
2003-05-30 08:54:42 +00:00