Commit Graph

265 Commits

Author SHA1 Message Date
Viktor Tarasov cfd5aaba7d SM: initial implementation of secure messaging framework 2012-06-08 20:17:35 +02:00
Viktor Tarasov be81263d8e log: config option to reopen debug file at every debug log ...
To be used in windows:
"In Windows, file handles can not be shared between DLL-s, each DLL has a separate file handle table.
For that reason reopen debug file before every debug message."

sc_context_repair() procedure from Hunter William
"Workaround some threading and data lifetime issues when card handle changes and need to re-associate card"
http://www.opensc-project.org/pipermail/opensc-devel/2011-December/017445.html
2012-05-29 19:44:54 +02:00
Viktor Tarasov 9d5404bac6 libopensc: some usefull macros, crc32 calculation procedure
Introduce some usefull define macros, error code 'inconsistent configuration'.
Introduce procedure to calculate CRC32 digest,
to be used in minidriver to calculate the 'freshness' values.
2012-05-29 11:29:44 +02:00
Viktor Tarasov 230b782309 pkcs15: add 'sc_pkcs15_derive' missing for ECDH support
also, key path, that has to be selected before crypto operation,
can contain an aid.
2012-05-28 23:15:37 +02:00
Frank Morgner 1141ae5202 Add support for PACE-enabled readers
Implements PC/SC interface to PACE-enabled readers defined in PC/SC
pt. 10 AMD 1 and BSI TR-03119.

PACE can be started using `sc_perform_pace`. This function currently
calls the new `perform_pace` from `struct sc_reader_operations`, if the
reader has the needed capabilities. `sc_perform_pace` could also be
extended with a stand-alone implementation of PACE (code could be
imported from here http://vsmartcard.sourceforge.net/npa/README.html).

Note that the reader's PACE capabilities are correctly determined by
calling GetReaderPACECapabilities.

OpenSC's new PACE capabilities can be tested using the `npa-tool` from
the Virtual Smart Card Architecture (see link above).
2012-02-21 14:10:47 +01:00
Stef Walter 00e02359a3 libopensc: Add 'paranoid-memory' setting for behavior when mlock() fails
* Setting paranoid-memory to true, and mlock() fails, then
   allocations which require non-pageable memory will return NULL
2012-02-17 10:02:55 +01:00
Stef Walter 6ed52a06b8 libopensc: Don't fail to allocate memory when mlock fails
* Print out warning when mlock fails, and continue.
 * The warning required a ctx to be passed in, so that means
   changing a few function signatures.

https://www.opensc-project.org/opensc/ticket/389
2012-02-17 10:02:55 +01:00
andre a28bacf02c libopensc: Reveal another Belpic hack introduced in r2117.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5561 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-08 07:35:03 +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
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
vtarasov 65e10c29ad libopensc: add description for the 'remote data' data types
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5443 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-13 15:34:03 +00:00
vtarasov 4fbb37ae7e libopensc: 'remote data' related procedures: init, allocate, free
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5438 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-13 12:44:31 +00:00
vtarasov 292d561882 libopensc: move declaration of 'serial number' related data types from 'opensc.h' to 'types.h'...
also define CPLC and 'remote_data' data types.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5437 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-13 12:19:29 +00:00
martin 1cdb3fa971 APDU parsing: switch to Frank Morgner's implementation
Patch by Frank Morgner, proposed in
http://www.opensc-project.org/pipermail/opensc-devel/2011-April/016419.html and
http://www.opensc-project.org/pipermail/opensc-devel/2011-April/016420.html:

* replace partly incorrect extended APU parsing implementation
  with one factored-out in function sc_bytes2apdu() in apdu.c
* re-factor APDU parsing functions in
  - opensc-explorer
  - opensc-tool
  - piv-tool
  to make use of sc_bytes2apdu()

Thanks to Peter Marschall and Frank Morgner
This fixes #260 and #351.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5394 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-26 07:29:53 +00:00
martin 007d27feeb Introduce sc_ctx_log_to_file to set the debug file of libopensc.
On Windows every DLL has their own file descriptor table, thus specifying
-v from any of the OpenSC tools resulted in a crash when the tool tried to override
ctx->debug_file with stderr.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5359 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-18 10:01:27 +00:00
martin 44cf3d06ae MiniDriver: rename cardmod to minidriver in source.
Also change some grammar, whitespace (reported by git) and wording (Opensc->OpenSC) issues.
Add some comments here and there.

See http://www.opensc-project.org/pipermail/opensc-devel/2011-April/016261.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5329 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-12 07:40:12 +00:00
andre 69c846f904 libopensc: Re-defines SC_CARD_FLAG_ONBOARD_KEY_GEN to be local to the file card-flex.c, because that flag is used nowhere else. In principle, this patch only reverts some changes made by r2192.
Relates to #296.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5312 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-08 13:30:32 +00:00
andre b21eeb46b9 libopensc: Removes unused flag SC_CARD_CAP_RSA_2048.
Relates to [http://www.opensc-project.org/opensc/ticket/296#comment:1 #296].

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5308 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-07 18:16:40 +00:00
andre 89b975022c opensc.h: Removes unused flag SC_CARD_CAP_EMV.
Relates to [http://www.opensc-project.org/opensc/ticket/296#comment:1 #296].

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5301 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-07 16:18:56 +00:00
dengert d3b3faa91a Add sc_ctx_use_reader as a reader driver operation.
It is used by cardmod to pass in pointers to the PC/SC handles 
provided by the caller of cardmod. Other drivers will return
an error if this routine called. 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5190 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-09 14:33:52 +00:00
vtarasov 7f5ea5b013 libopensc: export sc_find_app(), remove debug message, ...
avoid double '::' separator in path_print();
touch authentic profile file


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5087 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-12 17:41:10 +00:00
vtarasov 8f5f0b684a libopensc: remove non-ISO7816 members from the EF.ATR data, thanks to Andre Zepezauer
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5079 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-10 14:15:37 +00:00
vtarasov 8ee55a38b3 libopensc: extend DDO data type with the parsed 'aid', 'oid' and 'iid' members
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5068 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-09 09:29:39 +00:00
vtarasov b2d885fe34 libopensc: extend serial number to the ISO/IEC 7812 PAN definition
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5067 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-09 09:25:22 +00:00
vtarasov a576582701 libioensc: use 'struct sc_atr' instead of 'u8 *atr, size_t atr_len'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5061 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-07 17:18:58 +00:00
vtarasov bf4aa793af libopensc: parse content of the EF(ATR) file
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5059 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-07 15:49:10 +00:00
vtarasov 209224816a libopensc: introduce TLV and LV data type, use it to store DDO data
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5051 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-06 16:16:24 +00:00
vtarasov 0761a61a65 libopensc: use 'struct sc_aid' instead of 'u8 *aid, size_t aid_len'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5048 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-05 15:42:36 +00:00
vtarasov 121260b846 pkcs15: some changes to the discovery on-card applications code ...
; 'known' pkcs#15 applications are moved to the head of the card applications array;
; card specific 'bind finalization' code moved to the dedicated procedures;
; remove unused sc_application member, procedures;
; remove commented code;
; add debug messages;


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5045 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-05 14:53:52 +00:00
vtarasov 89d47696dd AuthentIC: remove unused macros, code layout
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5031 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-02 16:26:41 +00:00
vtarasov aec6e175f5 AuthentIC: read/write/update binary card handles can use the 'WAITING-AREA' reader facility ...
when used with virtual reader, the APDUs can be buffered in the reader's
internal buffer, before sending it to the distant card.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5021 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-02 14:11:00 +00:00
martin c911c2ffeb PC/SC: add additional flags to indicate readers which are in use and readers which are in exclusive mode.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5015 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-02 12:54:51 +00:00
vtarasov 8b270205cc libopensc: API for the 'erase-binary' card operation
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5005 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-30 13:25:09 +00:00
vtarasov ee907b7a69 libopensc: add new authentication methods, add ACLs to PIN info, ...
add 'next' member to 'sc_apdu' structure


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5004 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-30 13:20:19 +00:00
vtarasov 92c3e59e16 libopensc: Now 'cache-valid' flag is a member of 'sc_card_cache' ...
add 'current_ef' and 'current_df' member to 'sc_card_cache'.
The main purpose of this is to reduce number of APDU transactions.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5002 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-30 13:04:55 +00:00
s d66b3c71d2 fix: implicit depending on the RSA algo_info for GOSTR3410 algo
add sc_card_find_gostr3410_alg function

Thanks to Douglas E. Engert
http://www.opensc-project.org/pipermail/opensc-devel/2010-December/015408.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4931 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-09 08:23:14 +00:00
dengert c34caeb662 Support for ECC keys (part 1) header files and
support routines. Add definitions for EC keys,
parameters and extensions to structures. 
Add the sc_card_find_ec_alg, sc_pkcs15_decode_pubkey_ec,
sc_pkcs15_encode_pubkey_ec, sc_pkcs15emu_add_ec_prkey,
sc_pkcs15emu_add_ec_pubkey routines. 
Only EC named curves are currently supported. 



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4902 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 19:13:48 +00:00
martin 7ab591a684 libopensc: make sc_reset() take an additional parameter "do_cold_reset" which will unpower the card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4896 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 11:22:31 +00:00
martin c51156875f libopensc: remove meaningless sc_card_valid()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4785 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 14:58:50 +00:00
martin 72d961beb2 Fix #216: initial go with multiple reader subsystem removal.
* One sc_context has only a single reader driver.
 * remove dynamic reader driver loading capabilities
 * remove opensc-tool -R command
 * change the internal API, we don't need to pass around a "driver data" pointer as it can be found directly from the context.
 * check in ./configure for only a single enabled reader driver

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4709 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-11 13:00:47 +00:00
martin f085a9b373 libopensc: add SC_PIN_CMD_GET_INFO and related fields to sc_pin_cmd_pin
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4688 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 16:52:43 +00:00
viktor.tarasov 2db473a160 libopensc: export 'sc_card_find_rsa_alg'
Following proposal of Andre Zepezauer, see
http://www.opensc-project.org/pipermail/opensc-devel/2010-August/014699.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4683 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-04 20:16:54 +00:00
ep fbf1d621cb Remove unused give_random operation
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4677 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 22:58:34 +00:00
martin 241d3b5d86 libopensc: improve max_send/recv_size related code comments.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4670 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 11:50:39 +00:00
ep 71cdef0ed2 New card driver: Italian CNS/CIE (eID)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4627 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-16 00:56:27 +00:00
viktor.tarasov f18ba7d984 pkcs15: decode 'supportedAlgorithms' in 'TokenInfo'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4510 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-05 12:54:23 +00:00
viktor.tarasov 1d82e8abab re-distribute 'define' macros between types.h and opensc.h
move 'define' macros closer to the definition of the related data types


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4509 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-05 09:33:51 +00:00
viktor.tarasov 73c516a7a0 pkcs11: resolve 'endless polling' in C_WaitForSlotEvent()
http://www.opensc-project.org/pipermail/opensc-devel/2010-April/013947.html

Tested with Firefox 3.6.3 in WinXP SP3 .




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4363 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-19 09:18:38 +00:00
aj 02768fb5dc remove "split-key" option and emulat sign for sign,decrypt keys with padding
and decrypt() for cardos.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4113 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-13 22:52: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