Andreas Kemnade
9ca836975a
Starcos: added another ATR for 2nd gen. eGK (TK)
2019-05-02 10:09:08 +02: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
Frank Morgner
f0a6a568f4
fixed Local variable hides global variable
2019-05-02 10:08:28 +02:00
Frank Morgner
0bc95cb6a1
added include guards
2019-05-02 10:08:28 +02:00
Frank Morgner
86ba3ea489
fixed Wrong type of arguments to formatting function
2019-05-02 10:08:28 +02:00
Raul Metsma
5123531e62
Fix EstEID 3.4 signing
...
opensc master requires now SC_ALGORITHM_RSA_HASH_NONE
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-05-02 10:06:19 +02:00
Frank Morgner
7449b00768
pkcs11: avoid double initialization of notify
2019-04-26 23:51:37 +02:00
Frank Morgner
c671083ee3
fixed missing file
2019-04-25 16:46:07 +02:00
Frank Morgner
7df789ec5d
fixed 337490 Unchecked return value
2019-04-25 15:44:11 +02:00
Frank Morgner
8382f243b2
fixed 337891 Out-of-bounds write
2019-04-25 15:44:11 +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
Timo Teräs
3688dfe238
MyEID: simplify key component loading
...
Encode the component ID to be key type and component ID. This allows
each combination to be unique and direct mapping to card component
ID type in the code by just taking the low byte. This simplifies
the code, and reduces confusion as there is now only one #define
for each component.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2019-04-25 14:53:10 +02:00
Timo Teräs
3f832ca6da
MyEID: implement support for 4K RSA keys (MyEID 4.5+)
...
MyEID starting version 4.5 supports 4K RSA keys. The card also
now supports proper APDU chainging (for sending large APDUs) and
receiving large responses via GET_RESPONSE splitting.
This updates the following:
* detection code properly announces 3K and 4K RSA support
when available
* APDU chaining is used when possible
* use ISO GET_RESPONSE handling for large responses
* max_recv_size is set to 256 which it always was supposed to be
as the old cards respond with that large responses too
* use the 2K signing kludge only on cards that need it
* unwrap and decipher code paths unified to the extent possible
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2019-04-25 14:53:10 +02:00
Timo Teräs
0e25c1d2a6
MyEID: detect card from ATR historical data instead of full ATR
...
This will simplify the matching code, and match prototype cards.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2019-04-25 14:53:10 +02:00
Ludovic Rousseau
ffaaf1c0d3
pkcs11-spy: parse CKM_AES_GCM for C_EncryptInit()
2019-04-25 14:52:20 +02:00
Ludovic Rousseau
69727c79ad
pkcs11.h: add CK_GCM_PARAMS structure
2019-04-25 14:52:20 +02:00
Ludovic Rousseau
98ec27e768
pkcs11-spy: log pParameter buffer for C_EncryptInit & C_DecryptInit
2019-04-25 14:52:20 +02:00
Frank Morgner
bfa94dc90d
Merge pull request #1600 from AlexandreGonzalo/trustonic_pkcs11
2019-04-25 14:51:54 +02:00
alegon01
e21cb5712c
Fix in encrypt_decrypt(), initialize the mgf
2019-04-24 14:03:35 +02:00
Jakub Jelen
13429baed0
cac: Avoid signed/unsigned casting reported by coverity
...
src/libopensc/card-cac.c:1707: negative_returns: "val_len" is passed to a parameter that cannot be negative.
2019-04-23 14:49:45 +02:00
Dmitriy Fortinskiy
8cf1e6f769
pkcs11-tool: List supported GOST mechanisms
2019-04-17 16:42:12 +02:00
Dmitriy Fortinskiy
a5382d32fd
pkcs11-tool: Show GOSTR3410-2012 keys
2019-04-17 16:42:12 +02:00
Dmitriy Fortinskiy
0e12b1dc71
pkcs11-tool: Generate GOSTR3410-2012 keys
2019-04-17 16:42:12 +02:00
Dmitriy Fortinskiy
4614beb87e
pkcs11-tool: Add keys access flags
2019-04-17 16:40:41 +02:00
Dmitriy Fortinskiy
aff2059ec1
card-rtecp: Fix SELECT FILE
2019-04-17 16:38:49 +02:00
Dmitriy Fortinskiy
fe4dae4d31
card-rtecp: Add Rutoken ECP SC ATR
2019-04-17 16:38:49 +02:00
Raul Metsma
91a1dd9af4
Option to delete object by index
...
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-04-17 14:38:40 +02:00
Raul Metsma
3935d501bf
Implement Secret Key write object
...
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-04-17 14:37:49 +02:00
Frank Morgner
066c30bb4e
opensc-notify: add to autostart
2019-04-08 11:16:13 +02:00
Frank Morgner
159821497c
egk-tool: fixed verbose logging
2019-04-08 11:16:13 +02:00
Frank Morgner
fe95520e3e
explicitly import libpkcs11.h
2019-04-08 11:16:13 +02:00
Frank Morgner
6f9b58af72
added pkcs11-register
2019-04-08 11:16:13 +02:00
Jakub Jelen
fc4d600634
pkcs11-tool: Allow to set CKA_ALLOWED_MECHANISMS when creating an objects
...
Also list them in the attributes listing
2019-04-08 11:15:19 +02:00
alegon01
f631b5f733
Fix in encrypt_decrypt(), check for (in_len <= sizeof orig_data)
2019-04-05 10:39:52 +02:00
alegon01
4913feadb8
Fix in encrypt_decrypt(), check for (in_len <= sizeof orig_data)
2019-04-05 10:38:12 +02:00
Frank Morgner
fd20ffe608
optimize bin/hex low parsing level functions ( #1646 )
...
* optimize sc_hex_to_bin
* optimize sc_bin_to_hex
* added documentation
closes https://github.com/OpenSC/OpenSC/pull/1643
thanks to carblue <ka6613-496@online.de>
2019-04-04 12:52:08 +02:00
Frank Morgner
0abe9d11c7
pkcs11: (de-) initialize notifications on load
...
fixes https://github.com/OpenSC/OpenSC/issues/1507
fixes https://github.com/OpenSC/pkcs11-helper/issues/16
2019-04-04 11:04:50 +02:00
Raul Metsma
9ba8f56037
Change u8 *data to const because sc_apdu unsigned char *data is const
...
Name sc_format_apdu parameters for IDE help hints
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-04-03 22:15:54 +02:00
Raul Metsma
4ba086bfd4
Use strdup and fix all casts
...
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-04-01 12:53:33 +02:00
Martin Paljak
ea74308512
iso7816_read_binary: do not assume that 6282 is returned with data
...
Instead of a double check_sw call in case there is no data, assume
that a SW is properly sent by the card and do not expose
SC_ERROR_FILE_END_REACHED outside of the function
(like sc_pkcs15_read_file)
This is to facilitate Estonian eID 2018+ that instead of properly returning
6282 with trunkated data, 9000 is returned and next READ BINARY returns
6b00 (invalid p1/p2). The change should be generally harmless for well-behaving
cards.
Change-Id: I7511ab4841d3bcdf8d6f4a37a9315ea4ac569b10
2019-04-01 12:51:00 +02:00
Peter Popovec
f070c99b65
opensc-tool: do not use card driver to read ATR
...
If card driver fails to connect to card, 'opensc-tool -a' may fail to print
ATR even if ATR is available from card reader. Before use of card driver,
do only card reader connect, then print ATR. Only if it is neccesary, use
card driver for the rest of opensc-tool functions.
2019-03-25 14:34:26 +01:00
Frank Morgner
b389b19ca5
Merge pull request #1633 from metsma/esteid
...
Only EstEID 3.5 has EC 384 keys
2019-03-25 14:31:02 +01:00
Frank Morgner
2f4df1b93e
tools: unified handling of gengetopt
2019-03-25 14:30:09 +01:00
Frank Morgner
fc9277b778
use compat_getopt_long if getopt_long is not available
...
uses the autoconf way for replacing getopt.h
fixes https://github.com/OpenSC/OpenSC/issues/1527
2019-03-25 14:30:09 +01:00
Raul Metsma
7ae54f490d
Remove dead code ( #1638 )
2019-03-25 14:28:53 +01:00
Frank Morgner
8dea0a9028
fix overlapping memcpy
...
Fixes https://github.com/OpenSC/OpenSC/issues/1631
2019-03-18 23:33:24 +01:00
Frank Morgner
6aa5410e73
goid-tool: live with short length APDUs
2019-03-18 13:59:11 +01:00
Raul Metsma
4d2254a092
Only EstEID 3.5 has EC 384 keys
...
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-03-13 23:01:07 +02:00
Frank Morgner
2e87e4cfed
fixed issues from review
2019-03-13 21:22:19 +01:00
Frank Morgner
b7ec7f95b1
pkcs11: fixed token label
2019-03-13 21:22:19 +01:00
Frank Morgner
0079d836f3
pkcs11: truncate oversized labels with '...'
2019-03-13 21:22:19 +01:00
Raul Metsma
1e6d3df201
Remove un-lincenced header file
...
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-03-13 21:19:26 +01:00
Frank Morgner
71b85d15e4
opensc.conf: Configure handling of private_certificate
...
possible choices: ignore, protect, declassify
fixes https://github.com/OpenSC/OpenSC/issues/1430
2019-03-13 21:18:57 +01:00
Frank Morgner
1e0743b29f
removed untested use of SC_SEC_OPERATION_AUTHENTICATE
...
fixes https://github.com/OpenSC/OpenSC/issues/1271
2019-03-13 21:17:54 +01:00
Frank Morgner
106b3a28b1
acos5: removed incomplete driver
...
fixes https://github.com/OpenSC/OpenSC/issues/1204
2019-03-13 21:17:54 +01:00
Frank Morgner
9fa1722f73
sc_bin_to_hex returns a Nul terminated string
2019-03-13 21:17:00 +01:00
Frank Morgner
eb8f28db20
fixed error handling
2019-03-13 21:17:00 +01:00
Frank Morgner
d4f1decd15
Make sure card's strings are Nul terminated
...
Avoids out of bounds reads when using internal operations with the given string
2019-03-13 21:17:00 +01:00
Frank Morgner
d953998aa3
npa-tool: force default card driver
2019-03-13 12:01:09 +01:00
alegon01
31831c300b
Remove the call to OPENSSL_init_crypto() which is not needed. I have a segmentation fault when the process exits.
2019-03-12 08:52:06 +01:00
Frank Morgner
6472027848
tools: release context when card connection fails
2019-03-07 22:18:54 +02:00
Pierre Ossman
bc4eeda573
Remove readers when smart card service stops
...
The code already removes all active cards when the service goes
away, but it doesn't remove the reader. This can be a bit confusing
since they will still be polled and listed.
2019-03-07 21:51:02 +02:00
Pierre Ossman
9ed5f63c17
Fix smart card removal handling for older PC/SC
...
Older PC/SC doesn't have the code SCARD_E_NO_READERS_AVAILABLE, so fix
the code to handle such systems as well.
2019-03-07 21:51:02 +02:00
Pierre Ossman
9e9bdac2f1
Handle reader going missing
...
It might just be this specific reader going missing, and not all
of them.
2019-03-07 21:51:02 +02:00
Raul Metsma
b227fb8b9f
Cleanup EstEID 1.0/1.1 lefovers
...
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-03-07 21:31:08 +02:00
Scott Gayou
0d79675497
Small memory leak fix (CVE-2019-6502 in #1586 )
...
CVE-2019-6502 was assigned to what appears to be a very minor
memory leak that only occurs on an error-case in a CLI tool.
If util_connect_card fails, we still need to release the sc
context previously allocated by sc_context_create else memory
will leak.
2019-03-06 19:51:43 +01:00
alegon01
728d099a53
FIX typo OpenSSL vs OpenSsl.
2019-03-06 11:35:11 +01:00
alegon01
b327b76134
FIX use pseudo_randomize() for a proper initialization of orig_data in encrypt_decrypt().
2019-03-06 10:26:05 +01:00
Frank Morgner
19c5ab315d
fixed uninitialized use of variable
2019-03-06 08:53:47 +01:00
Frank Morgner
070370895f
fixed 333707 Dereference before null check
2019-03-06 00:42:38 +01:00
Frank Morgner
8fbd0b3ee1
fixed 333708 Dereference after null check
2019-03-06 00:42:38 +01:00
Frank Morgner
ba185954c5
fixed 333709 Unchecked return value
2019-03-06 00:42:38 +01:00
Frank Morgner
e8f8f0bfbb
fixed 333714 Uninitialized scalar variable
2019-03-06 00:42:38 +01:00
Frank Morgner
9abe44f03c
fixed 333715 Dereference after null check
2019-03-06 00:42:38 +01:00
Frank Morgner
e876cf62eb
fixed 333711 Dereference before null check
2019-03-06 00:42:38 +01:00
Frank Morgner
b1a58c7925
removed dead code
2019-03-06 00:42:38 +01:00
Frank Morgner
27526de021
implemented sc_format_apdu_ex
2019-03-05 13:54:13 +01:00
Frank Morgner
155b197932
sc-hsm: require T=1 connection
2019-03-05 13:47:45 +01:00
alegon01
7271fe610b
Add support for the OpenSsl signature format for the signature verification.
2019-02-18 16:03:41 +01:00
Frank Morgner
20daced605
fixed special case of deletion in gnuk_write_certificate
2019-02-14 09:22:23 +01:00
Frank Morgner
1a61ae849f
fixed Null pointer argument in call to memcpy
2019-02-14 09:22:23 +01:00
Frank Morgner
b6fadb469f
fixed sc_decompress_zlib_alloc return code
2019-02-14 09:22:23 +01:00
Frank Morgner
6e48de83c7
avoid allocation of 0 bytes
2019-02-14 09:22:23 +01:00
Frank Morgner
f4fccfd94e
fixed undefined bitshift
2019-02-14 09:22:23 +01:00
Frank Morgner
c858d4b3d1
fixed argument checking
2019-02-14 09:22:23 +01:00
Frank Morgner
6fdb29a470
fixed use of uninitialized values
2019-02-14 09:22:23 +01:00
Frank Morgner
01d515a026
fixed use of garbage value
2019-02-14 09:22:23 +01:00
Frank Morgner
8ea77a83e0
fixed misuse of realloc
2019-02-14 09:22:23 +01:00
Frank Morgner
32e1995300
fixed dead assignment
2019-02-14 09:22:23 +01:00
Frank Morgner
e4a01643a6
fixed possible NULL pointer dereference
2019-02-14 09:22:23 +01:00
Frank Morgner
53954e9ff1
fixed OpenSSL handling in PKCS#11 mapping
...
prevents NULL pointer dereference
2019-02-14 09:22:23 +01:00
Frank Morgner
b708cab0a3
fixed assignment of garbage value
2019-02-14 09:22:23 +01:00
Frank Morgner
85485eb9b0
fixed unused assignments
2019-02-14 09:22:23 +01:00
Frank Morgner
fdb0e6d581
Fixed Potential leak of memory
2019-02-14 09:22:23 +01:00
alegon01
9ae507c5f8
Fix indentation.
2019-02-12 14:09:26 +01:00
alegon01
b63a868e68
Fix build when EVP_PKEY_CTX_set_rsa_oaep_md is not defined.
2019-02-12 10:42:39 +01:00
Raul Metsma
c2cc83754e
select_esteid_df is only used in card-mcrd.c
...
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-02-12 08:56:20 +01:00
Raul Metsma
f37a8a5c52
is_esteid_card is only used card-mcrd.c
...
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-02-12 08:56:20 +01:00
Peter Marschall
4757466f27
OpenPGP: space police
...
remove trailing spaces & tabs
2019-02-12 08:55:59 +01:00
Alex Karabanov
04ef9dbf3b
Fix build on cygwin in strict mode ( #1605 )
2019-02-11 20:50:12 +01:00