Commit Graph

56 Commits

Author SHA1 Message Date
Jakub Jelen 5df913b7f5 tcos: Check bounds in insert_pin()
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28383
2020-12-09 15:50:54 +01:00
Jakub Jelen 69544553c3 tcos: Reformat insert_pin() for readability 2020-12-09 15:50:54 +01:00
Jakub Jelen 78cdab949f tcos: prevent out of bounds read
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27719
2020-12-04 09:30:10 +01:00
Jakub Jelen 412372b024 tcos: Make sure we have at least two bytes to dive into the cycle 2020-11-18 23:02:34 +01:00
Jakub Jelen b5b1afe401 tcos: Avoid reading behind the end of allocated buffer
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27480
2020-11-18 23:02:34 +01:00
Jakub Jelen d3451faa21 tcos: Reformat insert_key 2020-11-18 23:02:34 +01:00
Julian Strobl 9ffb9bae63 tcos: add missing encryption certificates 2020-07-30 02:00:15 +02:00
Jakub Jelen f49162af04 Avoid memory leaks when initializing tokeninfo in various drivers
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22578
2020-06-09 13:02:27 +02:00
Jakub Jelen 8940ed5d85 tcos: Avoid memory leak on invalid inputs
(make sure the pointer is initialized)

Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22765#c2
2020-06-09 13:02:27 +02:00
Frank Morgner 4bc03cb55d fixed memory leak
fixes https://oss-fuzz.com/testcase-detail/5113223765557248
2020-06-04 00:13:57 +02:00
Frank Morgner 7e1679b2db fixed memory leak
fixes https://oss-fuzz.com/testcase-detail/5675417580339200
2020-05-18 16:38:43 +02:00
Julian Strobl 9eed40ea31 tcos: add encryption certificate for IDKey
Fixes https://github.com/frankmorgner/OpenSCToken/issues/21
2019-12-28 18:15:55 +01:00
Jakub Jelen 2bab09ac03 tcos: Use unique IDs for certificates 2019-12-05 10:43:17 +01:00
Raul Metsma 63fd71c245 Remove unused sc_pkcs15emu_opt_t structure
Only usage was removed SC_PKCS15EMU_FLAGS_NO_CHECK flag

Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-05-02 10:08:46 +02:00
Raul Metsma bbec50bfdb Remove unused SC_PKCS15EMU_FLAGS_NO_CHECK flag
Fixes #1634

Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-04-25 14:53:25 +02:00
Frank Morgner 9fa1722f73 sc_bin_to_hex returns a Nul terminated string 2019-03-13 21:17:00 +01:00
Frank Morgner 24b50a4277 replace sc_debug with sc_log 2018-12-06 09:26:42 +01:00
Frank Morgner 78f0055338 fixed uninitialized use of variable 2018-08-14 16:13:22 +02:00
Frank Morgner 8fe377e93b fixed out of bounds reads
Thanks to Eric Sesterhenn from X41 D-SEC GmbH
for reporting and suggesting security fixes.
2018-08-14 15:50:13 +02:00
Maciej S. Szmigiero d84ee6c96a Initialize PIN logged_in field for cards that do not support PIN info
Commit 2f10de4f5c ("use sc_pkcs15_get_pin_info in C_GetTokenInfo")
introduced dependency of logged in state returned for session
by C_GetTokenInfo() on logged_in field of that session slot PIN.

This field is updated by sending pin_cmd of type SC_PIN_CMD_GET_INFO to
card.
However, not all cards support such pin_cmd type (in fact, majority of
them don't). In this case logged_in field is usually left zero-initialized
which means SC_PIN_STATE_LOGGED_OUT.

With such logged_in field value C_GetTokenInfo() always returns
CKS_R{O,W}_PUBLIC_SESSION, instead of CKS_R{O,W}_USER_FUNCTIONS when
logged in.

At least Firefox (and probably other NSS-based software, too) is confused
by such value and keeps repeating PIN prompts a few times until it
ultimately considers that logging in to this slot has failed.

Fix this by initializing PIN logged_in field to SC_PIN_STATE_UNKNOWN for
cards that do not support SC_PIN_CMD_GET_INFO pin_cmd.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2016-09-01 02:03:42 +02:00
Viktor Tarasov 9ac4120594 pkcs15: 'aid' argument for emulator init
Allows to PKCS#15 emulator to bind more then one application
2016-04-08 10:48:58 +02:00
Frank Morgner bcb5fc15e5 honour HAVE_CONFIG_H 2015-04-22 23:55:33 +02:00
Frank Morgner fdd38f6e04 fixed copy into fixed size buffer 2015-01-28 04:30:40 +01:00
Frank Morgner 6641cbf455 fixed potential string overflow 2015-01-24 20:17:26 +01:00
Thomas Calderon 91ddcfb514 PKCS15: remove redundant code for access_flags.
* With commit facaf59, access_flags were set for most cards. A closer look
    revealed that this is already done in `sc_pkcs15emu_add_rsa_prkey`.
    Therefore, this removes the duplicated code for cards calling this function.
2015-01-16 10:03:13 +01:00
Thomas Calderon facaf5969b Improve PKCS#11 compliance. Issue #335
* Add default behavior for cards using the PKCS#15 emulation layer.
    Hence, this patch provide a default value for access_flags compatible with
    current OpenSC's behavior while allowing compatible cards to fetch the real
    value from the card (IAS-ECC and AuthentIC).
2014-12-29 13:11:23 +01: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
pk c97fc2e719 support for TCOS3 IdKey cards and fix for bug #256
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5508 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-28 14:24:27 +00:00
vtarasov 5ab90b9219 libopensc: avoid using of the not completely initialized 'sc_path' variables
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5106 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-18 09:48:26 +00:00
ludovic.rousseau 96deb9d4d4 Use 'const char *' instead of 'char *' for static strings and avoids a
lot of "discards qualifiers from pointer target type" warnings


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4869 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 18:05:21 +00:00
ludovic.rousseau c64cb12f2f pkcs15-tcos.c: In function ‘insert_pin’:
pkcs15-tcos.c:216: warning: declaration of ‘r’ shadows a previous local
pkcs15-tcos.c:194: warning: shadowed declaration is here


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4868 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 17:07:13 +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
pk 238ebeb159 fixed incorrect IDs of SigG-PINs from 6,7 to 5,6
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4250 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-18 08:24:17 +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 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
ludovic.rousseau bdaf49b0c8 add missing prototype for sc_pkcs15emu_tcos_init_ex()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3522 c6295689-39f2-0310-b995-f0e70906c6a9
2008-05-22 12:30:16 +00:00
ludovic.rousseau e928d5565c convert C++ in C comment
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3502 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-28 07:57:03 +00:00
alonbl 0a809dd5cb Complete rewrite of OpenSC build system.
1.  Build system now supports MinGW (Windows) compilation using msys and cross compilation.
2.  Ability to explicitly disable and enable dependencies of the package.
3.  openct, pcsc and nsplugins features are disabled by default.
4.  Modified pcsc driver to use pcsc dynamically, no compile time dependency is required.
5.  --enable-pcsc-lite configuration option renamed to --enable-pcsc.
6.  Install opensc.conf file (as opensc.conf.new if opensc.conf exists).
7.  Add--enable-doc configuration option, allow installing documentation into target.
8.  Add --disable-man configuration option, allow msys mingw32 users to
    build from svn without extra dependencies.
9.  Add export files to each library in order to export only required symbols.
    Windows native build may use these files instead of scanning objects' symbols.
10. Add opensc-tool --info to display some general information about the build.
11. Create compatibility library to be linked against library instread of recompiling the
    same source files in different places.
12. Add different win32 version resource to each class of outputs.
13. Make xsl-stylesheets location selectable.
14. Some win32 fixups.
15. Some warning fixups.
16. Many other autoconf/automake cleanups.

Alon Bar-Lev

svn diff -r 3315:3399 https://www.opensc-project.org/svn/opensc/branches/alonbl/mingw

_M   .
D    configure.in
_M   src
_M   src/openssh
M    src/openssh/Makefile.am
_M   src/tools
M    src/tools/rutoken-tool.c
M    src/tools/opensc-tool.c
M    src/tools/cardos-info.c
M    src/tools/pkcs15-crypt.c
M    src/tools/pkcs15-init.c
M    src/tools/piv-tool.c
M    src/tools/netkey-tool.c
M    src/tools/eidenv.c
M    src/tools/cryptoflex-tool.c
M    src/tools/util.c
M    src/tools/pkcs11-tool.c
M    src/tools/pkcs15-tool.c
M    src/tools/util.h
M    src/tools/opensc-explorer.c
M    src/tools/Makefile.am
_M   src/pkcs11
M    src/pkcs11/pkcs11-global.c
M    src/pkcs11/framework-pkcs15.c
M    src/pkcs11/mechanism.c
M    src/pkcs11/pkcs11-display.c
M    src/pkcs11/pkcs11-object.c
A    src/pkcs11/opensc-pkcs11.exports
M    src/pkcs11/sc-pkcs11.h
M    src/pkcs11/pkcs11-spy.c
M    src/pkcs11/openssl.c
M    src/pkcs11/Makefile.am
A    src/pkcs11/pkcs11-spy.exports
_M   src/tests
_M   src/tests/regression
M    src/tests/regression/Makefile.am
M    src/tests/sc-test.c
M    src/tests/pintest.c
M    src/tests/Makefile.am
_M   src/include
_M   src/include/opensc
M    src/include/opensc/Makefile.am
A    src/include/opensc/svnignore
M    src/include/Makefile.am
_M   src/signer
_M   src/signer/npinclude
M    src/signer/npinclude/Makefile.am
M    src/signer/Makefile.am
A    src/signer/signer.exports
_M   src/common
A    src/common/compat_dummy.c
D    src/common/getopt.txt
D    src/common/strlcpy.c
D    src/common/LICENSE
A    src/common/compat_getopt.txt
A    src/common/compat_strlcpy.c
A    src/common/LICENSE.compat_getopt
A    src/common/compat_getopt.c
D    src/common/strlcpy.h
D    src/common/ChangeLog
D    src/common/getpass.c
D    src/common/my_getopt.c
A    src/common/compat_strlcpy.h
A    src/common/compat_getpass.c
A    src/common/compat_getopt.h
A    src/common/ChangeLog.compat_getopt
D    src/common/README.strlcpy
D    src/common/my_getopt.h
A    src/common/compat_getpass.h
A    src/common/README.compat_strlcpy
D    src/common/strlcpy.3
A    src/common/README.compat_getopt
D    src/common/getopt.3
D    src/common/README.my_getopt
A    src/common/compat_strlcpy.3
A    src/common/compat_getopt.3
M    src/common/Makefile.am
M    src/Makefile.am
_M   src/pkcs15init
M    src/pkcs15init/pkcs15-oberthur.c
M    src/pkcs15init/profile.c
M    src/pkcs15init/pkcs15-lib.c
M    src/pkcs15init/pkcs15-rutoken.c
A    src/pkcs15init/pkcs15init.exports
M    src/pkcs15init/pkcs15-gpk.c
M    src/pkcs15init/Makefile.am
_M   src/scconf
M    src/scconf/Makefile.am
M    src/scconf/parse.c
A    src/scconf/scconf.exports
_M   src/libopensc
M    src/libopensc/card-rutoken.c
M    src/libopensc/compression.c
M    src/libopensc/sc.c
M    src/libopensc/card-piv.c
M    src/libopensc/pkcs15-openpgp.c
M    src/libopensc/pkcs15-postecert.c
M    src/libopensc/pkcs15-tcos.c
M    src/libopensc/opensc-config.in
M    src/libopensc/reader-pcsc.c
A    src/libopensc/internal-winscard.h
M    src/libopensc/ctx.c
A    src/libopensc/libopensc.exports
M    src/libopensc/pkcs15-piv.c
M    src/libopensc/pkcs15-infocamere.c
M    src/libopensc/internal.h
M    src/libopensc/pkcs15-actalis.c
M    src/libopensc/pkcs15-starcert.c
M    src/libopensc/card-oberthur.c
M    src/libopensc/pkcs15-atrust-acos.c
M    src/libopensc/p15card-helper.c
D    src/libopensc/part10.h
M    src/libopensc/ui.c
M    src/libopensc/card-gpk.c
M    src/libopensc/pkcs15-wrap.c
M    src/libopensc/pkcs15-gemsafeGPK.c
M    src/libopensc/log.c
M    src/libopensc/pkcs15-esteid.c
M    src/libopensc/pkcs15-prkey-rutoken.c
M    src/libopensc/log.h
M    src/libopensc/Makefile.am
M    src/libopensc/reader-openct.c
_M   aclocal
M    aclocal/Makefile.am
_M   win32
M    win32/Makefile.am
A    win32/versioninfo.rc.in
A    win32/ltrc.inc
A    configure.ac
_M   doc
_M   doc/tools
M    doc/tools/pkcs15-profile.xml
D    doc/changelog.sh
D    doc/export-wiki.xsl
_M   doc/api
_M   doc/api/file
M    doc/api/man.xsl
_M   doc/api/asn1
_M   doc/api/apps
_M   doc/api/init
_M   doc/api/types
_M   doc/api/card
M    doc/api/html.xsl
_M   doc/api/misc
_M   doc/api/util
M    doc/Makefile.am
D    doc/export-wiki.sh
AM   doc/nonpersistent
A    doc/nonpersistent/export-wiki.xsl
A    doc/nonpersistent/Makefile.am
A    doc/nonpersistent/export-wiki.sh
A    doc/nonpersistent/svn2cl.xsl
D    doc/generate-man.sh
D    doc/svn2cl.xsl
M    Makefile.am
A    svnignore
_M   etc
M    etc/opensc.conf.in
M    etc/Makefile.am
D    man
_M   solaris
M    solaris/Makefile



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3405 c6295689-39f2-0310-b995-f0e70906c6a9
2008-03-06 16:06:59 +00:00
pk 513a3dde0a support for TCOS3
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3309 c6295689-39f2-0310-b995-f0e70906c6a9
2007-12-28 18:18:57 +00:00
aj 9c35397f50 revert change - is needed by pkcs15-syn.c
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3179 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 11:34:08 +00:00
aj 047ee1d73e fix more warnings found by gcc/sparse.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3178 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 11:07:00 +00:00
pk 4744121915 Support for DATEV smartcard classic
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3059 c6295689-39f2-0310-b995-f0e70906c6a9
2006-11-18 00:05:48 +00:00
pk 1c78d9e688 Netkey E4 emulation
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3046 c6295689-39f2-0310-b995-f0e70906c6a9
2006-10-31 17:29:19 +00:00
ludovic.rousseau 126593aa01 - use strlcpy() instead of strncpy() to always have a terminating
NUL-byte

- use sizeof(field) instead of SC_PKCS15_MAX_LABEL_SIZE-1 or equivalent as
  the 3rd argument of strlcpy()


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2993 c6295689-39f2-0310-b995-f0e70906c6a9
2006-07-12 08:12:38 +00:00
pk_opensc 60d9e4bf0e TCOS-Emulation, support for Uni-Giessen card
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2920 c6295689-39f2-0310-b995-f0e70906c6a9
2006-04-29 22:10:32 +00:00
aj 1810d4d3fb tcos updates by Peter Koch.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2891 c6295689-39f2-0310-b995-f0e70906c6a9
2006-04-24 18:41:57 +00:00
nils 5b0119ca6d change name + fix warning
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2859 c6295689-39f2-0310-b995-f0e70906c6a9
2006-02-23 19:15:06 +00:00
martin 9213a29a34 Small fixes for windows compilation (Visual Studio Express 2005)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2855 c6295689-39f2-0310-b995-f0e70906c6a9
2006-02-23 11:02:24 +00:00
nils 99a28c35ba add support a TCOS card used at the uni Giessen; this is still experimental
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2849 c6295689-39f2-0310-b995-f0e70906c6a9
2006-02-16 21:45:53 +00:00