Commit Graph

51 Commits

Author SHA1 Message Date
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
okir b68cb1e0b3 - added sc_free_apps to undo sc_enum_apps
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1122 c6295689-39f2-0310-b995-f0e70906c6a9
2003-05-15 13:32:17 +00:00
okir 8160bf64a1 - fixed typo in previous patch
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@901 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-05 15:43:51 +00:00
okir af6cfb5537 - Support Belgian eID - be less pedantic about the AID listed in EF(DIR)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@899 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-05 14:45:48 +00:00
sth 7dab6baeee file size fix + removed unnecessary code from previous commit
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@889 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-30 09:45:13 +00:00
sth 20ad65a858 made buf[1024] dynamic (malloc)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@886 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-28 15:36:08 +00:00
aet 3dccd63989 - C++ support. Compiles with gcc/g++ for Linux, otherwise
completely untested.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@574 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-19 14:23:31 +00:00
jey 22636c2df9 - Added SC_ERROR_FILE_ALREADY_EXISTS
- Changed call convention for reader finish()
- CT-API driver now frees its resources correctly
- Added year 2002 to some of the copyright statements
- sc_pkcs15_decipher() and sc_pkcs15_compute_signature()
  now select only the parent DF of the private key file


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@463 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-05 14:46:44 +00:00
aet d81d10ba90 Upgrade sources to use new headers, part #1
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@458 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-05 10:44:51 +00:00
jey 23e956cf9b - Fixed PKCS #15 structure generation on Cryptoflex cards
and implemented a default profile
- Cryptoflex now reports its supported PK algorithms
  correctly
- Various pkcs15-init fixes


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@295 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-12 13:00:57 +00:00
jey 04dfc47d92 - added a driver for MioCOS cards by Miotec
- implemented EF(DIR) updating


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@242 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-26 11:23:25 +00:00