Commit Graph

4769 Commits

Author SHA1 Message Date
vtarasov 1dd7d1fdeb pkcs11: debug title for GOSTRPARAMS
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5519 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-29 18:07:18 +00:00
vtarasov 4d2428378d pkcs11-tool: CKA_VALUE of imported GOST key has to be presented in the little endian order
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5518 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-29 17:55:26 +00:00
vtarasov 71b1f55f7c pkcs15-init: use general function to reverse memory buffer
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5517 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-29 17:49:00 +00:00
vtarasov dce63c8bfc libopensc: new exported function to reverse memory buffer
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5516 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-29 17:47:54 +00:00
pk 4f9924eae8 added news about TOCS-driver to NEWS-file
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5515 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-29 12:04:18 +00:00
vtarasov a045543cc1 minidriver: unused variable
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5514 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-29 11:50:13 +00:00
vtarasov 319cb6f071 minidriver: when reading 'cardid' file return the content of 'cardid' file ...
'cardid' size is 16 bytes.
It's initialized by the 'empty-cardid' value (00-0F) overwritten (from left) by the last 16 (or less) bytes
of the card's serial.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5513 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-29 11:48:50 +00:00
vtarasov ee4f346b07 pkcs15init oberthur: avoid warnings 'signed/unsigned mismatch'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5512 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-28 22:47:05 +00:00
martin 2d43c601e9 Remove unused code: sc_pkcs15init_get_label()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5511 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-28 22:14:14 +00:00
martin 215c133ba0 libopensc: remove more traces of software token/non-native private key related code.
pkcs15-wrap.c can be removed. Clarified/changed the meaning of "insecure" flag to pkcs15-init tool,
which will be needed to explicitly enforce the creation of a key which does not require a PIN.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5510 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-28 22:14:07 +00:00
vtarasov 7179778e22 authentic: avoid warning C4018: signed/unsigned mismatch
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5509 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-28 19:30:26 +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
andre 661cc0dd47 libopensc: Remove the somewhat mysterious flag SC_CARD_CAP_NO_FCI.
It's solely purpose was to get opensc-explorer to work with card-belpic (r2118, r2119).

Relates to #296.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5507 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-27 12:33:52 +00:00
andre 487a7ab372 sc-test.c: In function ‘sc_test_init’:
sc-test.c:80: warning: comparison between signed and unsigned
sc-test.c:94: warning: comparison between signed and unsigned


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5506 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-27 09:29:01 +00:00
andre 4a2dfa6822 pkcs11-tool.c: In function ‘sign_data’:
pkcs11-tool.c:1253: warning: comparison between signed and unsigned
pkcs11-tool.c: In function ‘write_object’:
pkcs11-tool.c:1777: warning: unused variable ‘type’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5505 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-27 09:24:09 +00:00
andre bbcb867a8f card-openpgp.c: In function ‘pgp_enumerate_blob’:
card-openpgp.c:584: warning: comparison between signed and unsigned
card-openpgp.c: In function ‘pgp_card_ctl’:
card-openpgp.c:1036: warning: unused variable ‘priv’
card-openpgp.c: In function ‘pgp_init’:
card-openpgp.c:272: warning: ‘child’ may be used uninitialized in this function


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5504 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-27 08:49:43 +00:00
martin 2facf39042 NightlyBuilds: add NEWS file entries for r5502 and r5468 to r5499
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5503 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-24 20:46:14 +00:00
martin dffe79d559 SetCOS/FinEID: add support for cards issued after 01.03.2011
Thanks to Juha Tuomala & Tero Kivinen <kivinen@iki.fi> for the patch.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5502 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-24 19:08:55 +00:00
martin 1bb6c706b9 pkcs15-crypt: remove extractable key support. Only native keys (operations on the card) are supported.
This amends r4646 and related commits.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5501 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-24 19:08:43 +00:00
martin 3655d1a1e4 pkcs15-tool: align access flags with the rest of output.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5500 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-24 19:08:05 +00:00
martin 4899f70b4e OpenPGP: use updated ushort2bebytes() in pgp_get_pubkey()
Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5499 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:33:50 +00:00
martin 15cdf5367d rewrite bebyte conversion functions: NULL check, return buffer
Rewrite bebyte conversion functions:
* check whether the buffer passed is non-NULL
* for conversions to bebytes, return the buffer passed

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5498 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:33:45 +00:00
martin fa259c63d5 OpenPGP: re-factor pgp_list_files()
Use ushort2bebytes instead of calculating the mapping to IDs ourselves.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5497 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:33:38 +00:00
martin e422a57449 OpenPGP: re-factor pgp_get_blob()
Instead of jumping out of the loop when the correct child is found,
and checking afterwards again if we found the correct object,
do everything directly in the loop and return from there.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5496 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:33:33 +00:00
martin 782b4efa73 OpenPGP: get flags & algorithms in pgp_get_card_features()
Extend pgp_get_card_features() to get card's flags & supported algorithms
from the card:
* get algorith values from "algorithm attributes" DOs 0x00c1 - 0x00c3

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5495 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:33:27 +00:00
martin c46152d89b OpenPGP: extend pgp_get_card_features()
Extend pgp_get_card_features() with these features:
* get SC_CARD_CAP_RNG capability from "extended capabilities" DO 0x00c0
* for OpenPGP 2.0 cards get max_send_size / max_recv_size values
  from "extended capabilities" DI 0x00c0
* get max_pin_len from "CHV status bytes" DO 0x00c4

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5494 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:33:15 +00:00
martin 1342648a89 OpenPGP: new function to get card's features
Add a new function pgp_get_card_features() to get the card's capabilities,
algorithms, features, ... instead of doing it all in pgp_init():
* get SC_CARD_CAP_APDU_EXT capability from ATR
* for openPGP 2.0 cards, if not found in ATR,
  get SC_CARD_CAP_APDU_EXT capability from "historical bytes" DO 0x5f52

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5493 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:33:04 +00:00
martin ee446adf09 OpenPGP: check for get_fn != NULL in pgp_read_blob()
In pgp_read_blob(), check if the pointer to the function we want to call
is defined.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5492 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:32:59 +00:00
martin 19142ee9af OpenPGP: deal with DOs depending on card version
Have separate copies of pgp_objects[] data elements specific to the card's
version, and extend these structures with additional information:
* Some spec changes cannot be compatibly expressed in one common
  simple data structure without making it too complex.
* depending on specification version, only deal with those DOs
  that are legal within that version
* add information or read & write access conditions
* add information for non-toplevel and/or write-only DOs
* use symbolic names for constants

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5491 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:32:54 +00:00
martin 88e88d9317 OpenPGP: read BCD version from card
Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5490 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:32:49 +00:00
martin cf3a34cbef OpenPGP: re-factor pgp_select_file()
* remove unnecessary copy operations with a temporary path object,
  instead increase the start index.
* addd comments

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5489 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:32:43 +00:00
martin 4a3df98450 OpenPGP: comment use of "current"
Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5488 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:32:36 +00:00
martin 101cf28766 OpenPGP: clean up with pgp_finish()
Use pgp_finish() wherever possible to clean up.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5487 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:32:31 +00:00
martin 9aa7342000 OpenPGP: re-factor pgp_finish()
Re-structure pgp_finish() for easier reading.
While at it, check for priv != NULL before free()ing it.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5486 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:32:26 +00:00
martin ec1f1bd812 OpenPGP: sprinkle with LOG_... macros
Instrument functions used in the card operations table pgp_ops[]
with log macros to ease debugging.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5485 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:32:21 +00:00
martin 9c26b8f7d3 OpenPGP: briefly document each function
Write a short comment at the beginning of each function,
shortly sketching what the function does.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5484 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:32:10 +00:00
martin 70fa98232a OpenPGP: remove unused element from structure
The element size in struct do_info is never used. Get rid of it.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5483 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:32:05 +00:00
martin 9765eda21c OpenPGP: implement card_ctl() command SC_CARDCTL_GET_SERIALNR
Implement card_ctl(), crrently restricted only to SC_CARDCTL_GET_SERIALNR.
The card's serial number is copied from the respective bytes in the AID.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5482 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:32:00 +00:00
martin 6e04d7f6bf OpenPGP: free memory when selecting the application fails
free() the memory already reserved when the file identifying the OpenPGP
application fails & reset the pointers in the card strcuture back to NULL.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5481 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:31:55 +00:00
martin 56f6718bf2 OpenPGP: allow extended APDUs in all functions
Depending on the card's capabilities and the necessity (requested response
size > 256) allow extended APDUs in all functions talking to the card.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5480 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:31:50 +00:00
martin f32a8ff59c OpenPGP: use card "extended Lc/Le" capabilities
adapt pgp_get_pubkey() and pgp_read_blob() to make use of the information
about the "extended Lc/Le" capabilities.

This allows reading OpenPGP Card v2.0 keys!

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5479 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:31:45 +00:00
martin 1911db7532 OpenPGP: update card capabilities from historical bytes
According to OpenPGP card specs 1.1 & 2.0 historical bytes in the ATR
indicate capabilities:
* bit 0x40 of the 3rd byte of the compact-TLV entry with TL 0x73 tells
  whether the card supports extended Lc/Le fields in APDUs.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5478 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:31:39 +00:00
martin 1bb69cb847 OpenPGP: catch calloc() errors in pgp_new_blob()
Detect and react on out of memory errors in pgp_new_blob() and its callers.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5477 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:31:31 +00:00
martin 6b7906f0a2 OpenPGP: use symbolic names for errors/success
Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5476 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:31:24 +00:00
martin 75a89e7c25 OpenPGP: add some comments
Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5475 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:31:18 +00:00
martin 4892af32c4 OpenPGP: re-factor pgp_set_blob()
* NULL-ify freed data pointer
* avoid unnecessary malloc() calls
* cope with malloc() errors
* do not rely on blob->file for be set

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5474 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:31:09 +00:00
martin ea64ba24af OpenPGP: NULL-ify free()'d pointer
Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5473 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:31:02 +00:00
martin d248026abc OpenPGP: implement function to free the fake file system
* pgp_iterate_blobs(): walk through the blob tree
* pgp_free_blob(): free a blob

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5472 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:30:56 +00:00
martin 03381a2594 OpenPGP: re-factor pgp_enumerate_blob()
Leverage the fact that OpenPGP cards use TLV encoding according to
ASN.1 BER-encoding rules and use sc_asn1_read_tag() as the workhorse
within pgp_enumerate_blob().

There's one peculiarity though:
OpenPGP cards expect 'cla' to be merged into 'tag'.
This is done manually after calling sc_asn1_read_tag().

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5471 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:30:49 +00:00
martin 61bbb0f904 OpenPGP: try to match flags with specification
Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5470 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-23 17:30:42 +00:00