Commit Graph

5328 Commits

Author SHA1 Message Date
Viktor Tarasov 6f667e0510 pkcs15: fix warning Wsign-compare 2016-03-21 07:55:02 +01:00
Viktor Tarasov 8b9ce2cf4a coverity: INTEGER_OVERFLOW 2016-03-17 11:30:40 +01:00
Viktor Tarasov bd84e18f45 coverity-scan: supplement to #710 2016-03-15 19:10:52 +01:00
Viktor Tarasov 1329597e33 pkcs15: use file cache for path with AID
also try to resolve TOCTOU coverity-scan issue

Fix #709
2016-03-15 18:11:03 +01:00
Viktor Tarasov 220d80fcec pkcs15: fix length of 'last-update' read 2016-03-15 17:42:09 +01:00
Viktor Tarasov 260b7711b9 coverity-scan: OVERRUN in ctbs.c
Fix #710
2016-03-15 17:40:15 +01:00
Viktor Tarasov 9a22f146f8 pkcs15: fix argument for 'read-tag' call 2016-03-10 11:39:59 +01:00
Viktor Tarasov 205acbd573 coverify-scan: muscle: use return value 2016-03-10 11:23:39 +01:00
viktorTarasov a5550f980b Merge pull request #706 from frankmorgner/npa-generic
generic changes from #611
2016-03-10 11:04:12 +01:00
Viktor Tarasov 1fb741338a pkcs11: remove hot-plug-anb-play
updated version of PR #687

Discussion and motivation in PR #687 and PR #704

Fix #687
Fix #704
2016-03-10 10:43:18 +01:00
Viktor Tarasov 0838520b62 rtecp: fix delete private key
when deleting private key, delete also it's internal public part
Fix #671
Fix #705
2016-03-10 10:33:42 +01:00
Viktor Tarasov f98c8cd37c asn1: tagnum size has not exceed 3 bytes
3 bytes is the size of SC_ASN1_TAG_MASK used when composing
the asn1 templates with 'struct sc_asn1_entry'.
With this limitation maximal supported ASN.1 tag number is 2^^14-1 .

Fixed 'dead-code' coverity-scan issue.

Close #707
2016-03-10 10:13:27 +01:00
Viktor Tarasov 196e476330 coverity: check returned value 2016-03-07 18:30:56 +01:00
Frank Morgner 5403899444 use SCardGetAttrib to initialize reader's metadata 2016-03-07 10:39:42 +01:00
Frank Morgner 415f15e3e2 use autoconf metadata for PKCS#11 library 2016-03-07 10:39:42 +01:00
Frank Morgner c3527f4a5b fixed dylib extensions 2016-03-07 10:39:42 +01:00
Frank Morgner ef40021417 use sc_debug_hex for hexdump 2016-03-07 10:39:42 +01:00
Viktor Tarasov 2173450664 log: print file-id in 'create-file' 2016-03-06 19:28:59 +01:00
Frank Morgner 9985144d45 Merge pull request #702 from viktorTarasov/fix/issue700/invalid-parameter
pkcs11-tool: fix invalid parameter for 'find-mechanism'
2016-03-05 21:37:31 +01:00
Frank Morgner 34a69aeac8 Merge pull request #701 from CardContact/fix698
sc-hsm: Remove path for newly generated key pairs
2016-03-04 17:23:00 +01:00
Hannu Honkanen 91aad373be Added a new ATR that will be used in some new MyEID cards
Closes https://github.com/OpenSC/OpenSC/pull/696
2016-03-04 17:20:37 +01:00
Hannu Honkanen cf04d01676 Removed define MYEID_ECC_SUPPORT as unnecessary.
ECC support is determined by checking MyEID applet version.
2016-03-04 17:20:29 +01:00
Hannu Honkanen 2de41f4a6d Added support for 521 bit ECC keys
Includes ECC related bux fixes.
2016-03-04 17:20:20 +01:00
Frank Morgner 1c0ab2a2d2 Merge pull request #697 from viktorTarasov/feature/package-revision
tools: print package revision
2016-03-04 17:14:26 +01:00
Viktor Tarasov 36b945aa22 tools: print package revision 2016-03-04 14:16:06 +01:00
Viktor Tarasov 998a1e10c5 pkcs11-tool: fix invalid parameter for 'find-mechanism'
Fixes #700
2016-03-04 11:30:51 +01:00
Ludovic Rousseau ae67f16e9b card-iasecc.c: fix 1 compiler warning
card-iasecc.c:3206:3: error: variable 'rv' is used uninitialized whenever 'if'
      condition is false [-Werror,-Wsometimes-uninitialized]
  ...LOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, "Need RSA_HASH_SHA1 or RSA_HASH_SHA256 algorithm");
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/libopensc/log.h:90:36: note: expanded from macro 'LOG_TEST_RET'
  ...r, text) SC_TEST_RET((ctx), SC_LOG_DEBUG_NORMAL, (r), (text))
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/libopensc/log.h:84:6: note: expanded from macro 'SC_TEST_RET'
        if (_ret < 0) { \
            ^~~~~~~~
card-iasecc.c:3207:20: note: uninitialized use occurs here
        LOG_TEST_RET(ctx, rv, "Cannot get QSign data");
                          ^~
../../src/libopensc/log.h:90:77: note: expanded from macro 'LOG_TEST_RET'
  ...r, text) SC_TEST_RET((ctx), SC_LOG_DEBUG_NORMAL, (r), (text))
                                                       ^
../../src/libopensc/log.h:83:14: note: expanded from macro 'SC_TEST_RET'
        int _ret = (r); \
                    ^
card-iasecc.c:3206:3: note: remove the 'if' if its condition is always true
                LOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, "Need RSA_...
                ^
../../src/libopensc/log.h:90:36: note: expanded from macro 'LOG_TEST_RET'
                                   ^
../../src/libopensc/log.h:84:2: note: expanded from macro 'SC_TEST_RET'
        if (_ret < 0) { \
        ^
card-iasecc.c:3185:8: note: initialize the variable 'rv' to silence this warning
        int rv;
              ^
               = 0
2016-03-02 15:01:19 +01:00
Ludovic Rousseau d86ada1c64 card-iasecc.c: fix 1 compiler warning
card-iasecc.c:2322:58: error: address of 'data->pin2.data' will always evaluate
      to 'true' [-Werror,-Wpointer-bool-conversion]
  ...if (!data->pin1.data && !data->pin1.len && &data->pin2.data && !data->pi...
                                             ~~  ~~~~~~~~~~~^~~~
2016-03-02 14:59:27 +01:00
Ludovic Rousseau ad11c9937c card-authentic.c: fix 1 compiler warning
card-authentic.c:1452:57: error: address of 'data->pin2.data' will always
      evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
        if (!data->pin1.data && !data->pin1.len && &data->pin2.data && !...
                                                ~~  ~~~~~~~~~~~^~~~
2016-03-02 14:57:42 +01:00
Ludovic Rousseau d45ae3ba80 sm-card-iasecc.c: fix compiler warning
sm-card-iasecc.c: In function ‘sm_iasecc_get_apdu_delete_file’:
sm-card-iasecc.c:188:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  unsigned int file_id = (unsigned int)sm_info->cmd_data;
                         ^
2016-03-02 14:50:57 +01:00
Andreas Schwier 69eaa66e83 sc-hsm: Fix #698 2016-03-02 14:20:51 +01:00
Ludovic Rousseau 89ec66fbe8 framework-pkcs15.c: fix compiler warning
framework-pkcs15.c:706:1: warning: unused function
      '__pkcs15_create_secret_key_object' [-Wunused-function]
__pkcs15_create_secret_key_object(struct pkcs15_fw_data *fw_data,
^
2016-02-29 20:19:42 +01:00
Ludovic Rousseau 7a7fb19a7d iasecc-sm.c: fix compiler warning
iasecc-sm.c:697:22: warning: cast to 'void *' from smaller integer type
      'unsigned int' [-Wint-to-void-pointer-cast]
        sm_info->cmd_data = (void *)file_id;
                            ^
2016-02-29 20:19:42 +01:00
Ludovic Rousseau ed30d4ebb7 pkcs15-isoApplet.c: fix compiler warning
pkcs15-isoApplet.c:268:38: warning: address of 'df->path' will always evaluate
      to 'true' [-Wpointer-bool-conversion]
        if(!pin || !pin_len || !df || !&df->path)
                                      ~ ~~~~^~~~
2016-02-29 20:19:42 +01:00
Ludovic Rousseau a8c741002d reader-pcsc.c: fix compiler warning
der-pcsc.c:1101:11: warning: comparison of integers of different signs:
      'LONG' (aka 'int') and 'unsigned int' [-Wsign-compare]
                        if (rv == SCARD_E_NO_SERVICE) {
                            ~~ ^  ~~~~~~~~~~~~~~~~~~
2016-02-29 20:19:42 +01:00
Ludovic Rousseau 80a313fb2a pkcs11-spy.c: fix 1 warning
pkcs11-spy.c:259:49: warning: format specifies type 'long' but the argument has
      type 'int' [-Wformat]
        fprintf(spy_output, "%s.%03ld\n", time_string, tv.tv_usec / 1000);
                                ~~~~~                  ^~~~~~~~~~~~~~~~~
                                %03d
2016-02-29 20:19:42 +01:00
Ludovic Rousseau cd42fbbc65 openpgp-tool.c: fix compiler warning
penpgp-tool.c:367:9: warning: comparison of integers of different signs: 'int'
      and 'unsigned int' [-Wsign-compare]
                if (r != count) {
                    ~ ^  ~~~~~

Remove 3 casts
Add 1 cast
Fix a format problem
2016-02-29 20:19:42 +01:00
Ludovic Rousseau e7cbc3ba82 opensc-explorer.c: fix compiler warning
opensc-explorer.c:1727:8: warning: comparison of integers of different signs:
      'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
                if(r > len) {
                   ~ ^ ~~~
2016-02-29 20:19:42 +01:00
Ludovic Rousseau d929532b63 pkcs11-tool.c: fix 2 compiler warnings
pkcs11-tool.c:2650:25: warning: unused variable 'ecdh_parms' [-Wunused-variable]
        CK_ECDH1_DERIVE_PARAMS ecdh_parms;
                               ^
pkcs11-tool.c:2021:7: warning: unused variable 'is_private' [-Wunused-variable]
                int is_private = opt_object_class == CKO_PRIVATE_KEY;
                    ^
2016-02-29 20:19:42 +01:00
Ludovic Rousseau 08529c91ee log.c: fix compiler warning
log.c:94:87: warning: format specifies type 'long' but the argument has type
      'int' [-Wformat]
  ...%03ld ", (unsigned long)pthread_self(), time_string, tv.tv_usec / 1000);
     ~~~~~                                                ^~~~~~~~~~~~~~~~~
     %03d
2016-02-29 20:19:42 +01:00
Viktor Tarasov f29f2e62b3 pkcs15init: fix bug introduced in 50f03bc 2016-02-29 18:52:45 +01:00
Frank Morgner 50f03bca3f fixed memory leak 2016-02-29 13:08:34 +01:00
Frank Morgner 1862970212 fixed typo 2016-02-29 13:08:34 +01:00
Frank Morgner fa71448d1c added fall through comment 2016-02-29 10:52:48 +01:00
Frank Morgner ceb913a7bb Merge pull request #679 from l1k/master
GemSAFE ATR + format string fixes
2016-02-25 16:35:53 +01:00
Viktor Tarasov b8c3722bf5 pkcs11/framework: no more 'for-applications' mode for slot creation
Simplify create tokens rules, no need to manipulate applications in
'pkcs11' configuration part,
applications can be enabled/disabled on the 'pkcs15' one.

Fix the possibility to expose only 'sign' PIN
2016-02-24 13:39:27 +01:00
Frank Morgner ae359ba180 Merge pull request #678 from CardContact/fix-bcd-sopin
sc-hsm: Fix BCD encoding bug with SO-PIN

Fixes https://github.com/OpenSC/OpenSC/issues/674
2016-02-23 22:33:36 +01:00
Lukas Wunner c8fbcdd076 card-gemsafeV1: Add ATR for European Patent Office smart card
The EPO hands this card out to attorneys and inventors to authenticate
with their online services. The applet on the card seems to be identical
to the one on Swedish eID cards.

Ludovic Rousseau's list identifies the card as Gemalto IDClassic 340.
Gemalto Classic Client identifies the card as GemSAFE V3.

Previously the EPO was using a GemSAFE V1 card, its ATR was added with
81bbddfc24 ("card-gemsafeV1: Add a GemSafe V1 ATR").
2016-02-20 14:27:27 +01:00
Lukas Wunner a020e1f7d4 pkcs11: Fix signedness issues in debug messages
Use the appropriate printf conversion for data->buffer_len which is
an unsigned int.
2016-02-20 14:27:27 +01:00
Viktor Tarasov dbca85636f pkcs11-tool: use keygen mech. from cmd arguments
There are can be more then one keygen mechanism for a given
key type.
(ex. CKM_RSA_PKCS_KEY_PAIR_GEN and CKM_RSA_X9_31_KEY_PAIR_GEN)
2016-02-19 16:05:55 +01:00