Commit Graph

34 Commits

Author SHA1 Message Date
Frank Morgner c5e40127d0 Coverity fixes (#1012)
card-cac.c
 * CLANG_WARNING: The left operand of '<' is a garbage value
card-coolkey.c
 * CLANG_WARNING: overwriting variable
 * CPPCHECK_WARNING: memory leak / overwrite variable
 * CLANG_WARNING: null pointer dereference
 * UNUSED_VALUE: unused return value
card-gids.c
 * CLANG_WARNING: Branch condition evaluates to a garbage value
 * SIZEOF_MISMATCH: suspicious_sizeof
card-myeid.c
 * RESOURCE_LEAK: Variable "buf" going out of scope leaks the storage it points to.
 * CLANG_WARNING: overwriting variable
 * (rewrite not to confuse coverity)
pkcs15-cac.c
 * RESOURCE_LEAK: Variable "cert_out" going out of scope leaks the storage it points to.
pkcs15-coolkey.c
 * UNUSED_VALUE: unused return value
pkcs15-piv.c
 * RESOURCE_LEAK: Variable "cert_out" going out of scope leaks the storage it points to.
pkcs15-sc-hsm.c
 * DEADCODE
pkcs11/framework-pkcs15.c
 * RESOURCE_LEAK: Variable "p15_cert" going out of scope leaks the storage it points to.
pkcs15init/pkcs15-lib.c
 * CLANG_WARNING: Assigned value is garbage or undefined
pkcs15init/pkcs15-myeid.c
 * UNREACHABLE: Probably wrong placement of code block
tests/p15dump.c
 * IDENTICAL_BRANCHES
pkcs15-init.c
 * CLANG_WARNING: Potential leak of memory pointed to by 'args.der_encoded.value'
pkcs15-tool.c
 * RESOURCE_LEAK: Variable "cert" going out of scope leaks the storage it points to.
 * MISSING_BREAK: The above case falls through to this one.
sc-hsm-tool.c
 * CLANG_WARNING: Potential leak of memory pointed to by 'sp'
westcos-tool.c
 * FORWARD_NULL: Passing null pointer "pin" to "unlock_pin", which dereferences it.
 * (rewrite not to confuse coverity)
card-cac.c
* Avoid malloc with 0 argument
gids-tool.c
* FORWARD_NULL -- copy&paste error
scconf.c
* CLANG_WARNING: Call to 'malloc' has an allocation size of 0 bytes

closes #982
2017-04-03 13:43:30 +02:00
Jakub Jelen f52f6bb310 [p15dump] Error message with a reason for missing unusedSpace file 2016-06-06 21:36:09 +02:00
Jakub Jelen e309d0f06f [p15dump] Do not attempt to access NULL pointer 2016-05-23 11:41:48 +02:00
Frank Morgner 6759c04b26 don't ignore errors 2015-01-28 04:45:08 +01:00
andre a9eba2b205 libopensc: Remove unused parameter 'file_out' in function 'sc_pkcs15_read_file'.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5546 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-05 11:08:36 +00:00
vtarasov f2924672d8 pkcs15: add 'aid' parameter to the prototype of the 'bind' functions ...
prepare for the multi-application support


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5041 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-05 14:21:04 +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 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 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 4f0329cd18 silence more gcc/sparse warnings.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3180 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 12:01:39 +00:00
aj 61c4acc141 convert to utf-8.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3087 c6295689-39f2-0310-b995-f0e70906c6a9
2006-12-19 21:33:40 +00:00
nils 573ce9c9e5 suppress errors when EF(unusedSpace) is missing
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2774 c6295689-39f2-0310-b995-f0e70906c6a9
2005-12-21 21:19:37 +00:00
sth 9df2cde416 Add support for reading and writing from/to an EF(UnusedSpace) file; this functionality can be used for deleting and creating pkcs15 objects (that reside in a file)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2769 c6295689-39f2-0310-b995-f0e70906c6a9
2005-12-17 19:53:12 +00:00
okir 839dab0fe4 - use sc_test_print_card instead of sc_pkcs15_print_card
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1591 c6295689-39f2-0310-b995-f0e70906c6a9
2003-10-31 16:02:42 +00:00
okir 51100d16f1 - prevent excessive calls to logout
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1187 c6295689-39f2-0310-b995-f0e70906c6a9
2003-06-10 06:32:31 +00:00
okir b86d2e994b - First shot at pkcs15 data objects from Danny De Cock
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@788 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-18 10:17:01 +00:00
aet 148f4051f6 Various build fixes
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@697 c6295689-39f2-0310-b995-f0e70906c6a9
2002-10-19 16:51:37 +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
okir 0877a5da74 - display non-RSA keys
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@556 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-17 20:46:56 +00:00
aet 076a26bbac Rework the header structure
Currently fails to compile, unless you symlink
all the necessary headers to src/include/opensc
by yourself.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@459 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-05 13:48:00 +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
aet 50e266567a Fix memory leaks
Indent lines


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@369 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-22 00:13:25 +00:00
okir cdd735e36d - moved object printing stuff to separate file
- dump public key info if present


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@274 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-07 13:03:23 +00:00
okir 86df1c55ff - adapted to juha's latest changes
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@254 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-04 08:35:48 +00:00
aet b098c097a1 Upgrade to current OpenSC API
Compiles, so far untested


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@229 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-25 12:04:39 +00:00
jey db0740d1ca - fixed some compile warnings
- updated TODO


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@108 c6295689-39f2-0310-b995-f0e70906c6a9
2001-12-28 14:19:41 +00:00
jey 36965ca6eb - updated to work with latest library version
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@90 c6295689-39f2-0310-b995-f0e70906c6a9
2001-12-22 20:52:57 +00:00
jey 5be3bd3b7e - a few fixes for libopensc 0.3.2 support
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@58 c6295689-39f2-0310-b995-f0e70906c6a9
2001-11-27 21:25:15 +00:00
jey 939146ffed - changed project name to OpenSC
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@52 c6295689-39f2-0310-b995-f0e70906c6a9
2001-11-24 13:32:52 +00:00
jey e53cfa4595 - added README for PAM module
- added a few error messages
- fixed certificate caching (which is still kludgy)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@44 c6295689-39f2-0310-b995-f0e70906c6a9
2001-11-17 15:48:10 +00:00
jey 1194017d5a - added defaults; full PKCS#15 parsing is no-longer required at startup
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@43 c6295689-39f2-0310-b995-f0e70906c6a9
2001-11-17 14:55:41 +00:00
jey 18bab373b8 - changed license to LGPL
- moved ASN.1 function definitions from sc.h to sc-asn1.h


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@36 c6295689-39f2-0310-b995-f0e70906c6a9
2001-11-06 18:34:19 +00:00
jey 16c6db4b2a assorted small fixes
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@34 c6295689-39f2-0310-b995-f0e70906c6a9
2001-11-04 14:08:38 +00:00
jey c57e2e266d - moved libsc to its own directory
- added non-working MIME plugin for "text/x-text-to-sign"
- added pseudo-random number generator support
- split hst-test.c into smaller files


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@31 c6295689-39f2-0310-b995-f0e70906c6a9
2001-11-01 15:43:20 +00:00