Commit Graph

22 Commits

Author SHA1 Message Date
martin 4697cc386b libpkcs11: Print error messages from PKCS#11 module loading
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4672 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 13:38:56 +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
aj b9daff9b28 replace rsa pkcs#11 header files with rewrite.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3066 c6295689-39f2-0310-b995-f0e70906c6a9
2006-11-30 08:11:58 +00:00
nils ffb7928f6e we need lt_dlinit()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2538 c6295689-39f2-0310-b995-f0e70906c6a9
2005-09-05 17:05:26 +00:00
aj ff62b88e1c big configure update.
use pkg-config for openct, openssl, pcsc.
do not compilke libp11. do not compile sslengines.
remove scdl. use libltdl instead.
use libassuan.m4 macro for m4 detection.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2528 c6295689-39f2-0310-b995-f0e70906c6a9
2005-09-01 14:01:58 +00:00
pisi 118c1f914a test label
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2190 c6295689-39f2-0310-b995-f0e70906c6a9
2005-02-15 14:41:30 +00:00
aet ba1a685c8e Don't bother exposing sc_pkcs11_module_t and scdl_context_t
to public headers, use void instead.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1424 c6295689-39f2-0310-b995-f0e70906c6a9
2003-09-06 16:18:15 +00:00
aet 86475ea7c0 - Remove sslengines/libpkcs11.h, it's almost identical
to libpkcs11's pkcs11.h.
- Move default PKCS#11 library defines to pkcs11.h,
  so they can be used by 3rdparty applications as
  well.
- Minor cleanups


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1407 c6295689-39f2-0310-b995-f0e70906c6a9
2003-09-03 17:07:15 +00:00
aet bac2b601a9 Move scdl to it's own subdirectory, although it's merely
for internal purposes only.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1403 c6295689-39f2-0310-b995-f0e70906c6a9
2003-09-01 08:43:38 +00:00
aet bd54ea7a62 - Move all dynamic loading related code to src/common/scdl.c,
probably needs some more work.

As a side bonus, we now have a working CT-API support for MacOS X.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1402 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-29 16:29:52 +00:00
aet e6258f8049 - Install OpenSSL engines as bundles as well
- Don't bother "renaming" opensc-pkcs11.so
  when installing as bundle.
- More irrelevant cleanups


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1382 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-18 13:45:37 +00:00
aet bfc584e3ef - Allow MacOS X build to be able to support simultaneously
loading of .dylibs, .bundles (native MacOS X) and bundle
  objects (.so) created by GNU libtool, if dlcompat is found.
  Otherwise just support .dylibs and .bundles.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1359 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-14 12:45:22 +00:00
aet 890d6ee2bc Cleanups
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1358 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-14 11:47:17 +00:00
aet 8dd292fc4b Blah, unify the string handling a bit
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1337 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-06 12:01:40 +00:00
aet c42a3bfc0f - Fixed a mac specific compiler warning
- Fixed libdl-specific code to work with Fink's dlcompat package


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1335 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-06 08:45:57 +00:00
aet c4d2611d12 - Various build fixes for various operating systems and compilers
- Add missing .cvsignore files
- Remove tools/ and make configure to work again


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1251 c6295689-39f2-0310-b995-f0e70906c6a9
2003-07-11 16:31:06 +00:00
sth c79e42d82e Added support for Mac bundles
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1092 c6295689-39f2-0310-b995-f0e70906c6a9
2003-05-08 07:54:30 +00:00
sth a85d6d7aa4 Added code for MacOSX
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1047 c6295689-39f2-0310-b995-f0e70906c6a9
2003-04-18 11:55:16 +00:00
okir 2e4f640c2d - More win32 fixes from Stef
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@785 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-17 20:44:48 +00:00
okir 29dd06ba9f - more win32 fixes from Stef
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@779 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-17 16:00:40 +00:00
okir 317a0663c9 - New utility library libpkcs11 - supposed to provide easy loading and
unloading of modules, and possibly a few other features in the future.
  Needed by pkcs11-tool


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@773 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-17 11:48:14 +00:00