Commit Graph

39 Commits

Author SHA1 Message Date
Yaroslav Isakov fc08818f6f OpenPGP: Fix read/write certs with Ed25519/X25519 public key
Proper Ed25519/X25519 certs have pubkey algo with OID 1.3.101.112/110, according to
RFC8410. This commit add these OIDs, and also fixes pubkey parsing/creation - according
to the same RFC, it's just a bytestring, without ASN.1 wrapping.

Also, according to the same RFC, EDDSA/X25519 MUST not have params, even empty.
2021-05-21 14:37:30 +02:00
Jakub Jelen caae75758c Add internal support for (X)EdDSA keys 2021-03-01 15:42:26 +01:00
Frank Morgner f2145eca79 don't debug pointers 2018-12-06 09:26:42 +01:00
Maciej S. Szmigiero 62cbda6cd9 Fix log messages format and parameter issues flagged by GCC
Since "Add GCC format checking attributes to log functions" commit GCC
warns us about problems with format strings and their arguments provided
to OpenSC message logging functions.

This commit fixes all cases where GCC warned about incorrect format on
64-bit Linux, 32-bit and 64-bit mingw builds (with SM and OpenSSL enabled).
Well, almost all since on mingw GCC does not recognize "ll" size specifier
(present at least since Visual Studio 2005, also in mingw own CRT) so these
(few) warnings about it remain.

In most cases format size specifier for size_t type was missing (usually
size was left at default int level, with is different on 64-bit x86).
Some formats had too few / too many arguments.
In some cases pointers were printed as integers.
Some long variables were missing "l" prefix (especially with regard to %x
format).

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +02:00
Jakub Jelen ae47e06d57 Typos 2016-05-16 10:58:22 +02:00
Olaf Kirch f42a1c2563 Replace outdated address okir@lst.de -> okir@suse.de
Signed-off-by: Olaf Kirch <okir@suse.de>
2015-10-05 14:07:28 +02:00
Frank Morgner c7afbb4ca2 pkcs15-algo: fixed resource leak 2015-05-08 09:10:47 +02:00
Frank Morgner bcb5fc15e5 honour HAVE_CONFIG_H 2015-04-22 23:55:33 +02:00
Viktor Tarasov fa923831f8 introduce EC curve OID into algorithm info data
needed to store information about EC curve supported by card.
Primary usage is when importing/generating key to get know if particular curve is supported by card.
2015-02-20 13:49:18 +01:00
Viktor Tarasov e374f88b82 pkcs15-pubkey: add EC params in SPKI encoding 2015-02-07 19:55:08 +01:00
Andreas Schwier 3a6e7ba959 pkcs15: Changed encoding for EC public keys in PuKDF to SPKI rather than ECPoint, preserving domain parameter 2013-11-15 11:41:10 +01:00
Viktor Tarasov f641ebd248 fixed errors reported by cppcheck: part 1
partially applied the pull request #182 from Frank Morgner -- updated the common frameworks source files
2013-09-29 20:28:45 +02:00
Andreas Schwier 7b943b934b pkcs15: Fixed typo 2012-10-01 13:04:01 +02:00
Viktor Tarasov 58b4304957 libopensc: 'init', 'format', 'compare', 'is-valid' OID procedures
In a reason of number of bugs(*) that concern the OID management,
the general usage OID procedures 'init', 'format', 'compare', 'is-valid' are introduced.
These procedures should be used by all actors: libopensc, pkcs15, pkcs11, tools, ....

(*)
This bug reported by Andreas Schwier :
8e75d971cb (commitcomment-1792477)

In pkcs15-algo sc_asn1_get_algorithm_info() can return the OID without ending '-1's:
https://github.com/OpenSC/OpenSC/blob/staging/src/libopensc/pkcs15-algo.c#L452
https://github.com/OpenSC/OpenSC/blob/staging/src/libopensc/pkcs15-algo.c#L459
2012-09-06 10:47:29 +02:00
vtarasov a9e9aaee78 gost: GOST key parameters data type, encode gost parameters procedure
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5520 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-29 18:18:43 +00:00
andre 8defdf9aed pkcs15-algo.c: Just making the compiler happy.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4949 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-14 03:11:31 +00:00
dengert c2fe4609a9 Modifications to support EC and ECDSA for
emulated cards. True PKCS#15 cards with EC 
will need additional changes. 

Main changes are in framework-pkcs15.c, mechanism.c,
padding.c, pkcs15-algo.c and pkcs15-sec.c 
where switch statements for key type, and testing
of flags was modified to make it easier to add 
additional key types in the future. 

The code was tested using RSA and ECDSA using a PIV card 
from pkcs11-tool, OpenSSL and Thunderbird with 
modifications to NSS-3.12.7 to get ECDSA to sign e-mail. 

Only named curves are supported for ECDSA, ECDH is still 
needed. pkcs11-tool has only minimal changes need to work 
with the -O option to list EC keys. 

One additional line was added to pkcs15-sec.c which 
should get GOSTR sign to work. 

libp11 and engine do not yet have EC support. 

 --This line, and those below, will be ignored--

M    src/tools/piv-tool.c
M    src/tools/pkcs11-tool.c
M    src/pkcs11/framework-pkcs15.c
M    src/pkcs11/mechanism.c
M    src/pkcs11/pkcs11-object.c
M    src/libopensc/pkcs15-prkey.c
M    src/libopensc/card-piv.c
M    src/libopensc/padding.c
M    src/libopensc/cardctl.h
M    src/libopensc/pkcs15-algo.c
M    src/libopensc/libopensc.exports
M    src/libopensc/pkcs15-piv.c
M    src/libopensc/pkcs15-sec.c


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4904 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-01 20:08:42 +00:00
dengert a71b64f3fc Fix erros with freeing algorithm parameters and
last entry of the algorithm_table. 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4780 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-04 15:58:34 +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
s 5320ca6fd1 Corrected GOSTR3410 public key structure
Working now with GOST R 34.10:
$ pkcs15-init --store-private-key key --key-usage sign,decrypt --auth-id 2 --id 1 --pin "12345678"
$ pkcs15-init --store-certificate my_cert --id 1 --pin "12345678"

But have problem: no CKA_GOSTR3410_PARAMS by retrieve pub_key from certificate, if pub_key object was removed (see parse_x509_cert, asn1_decode_gostr3410_params)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3859 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-19 15:41:03 +00:00
martin ea37069272 Merged r3749:3758 from trunk
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3759 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-05 20:10:07 +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 0ecc294ed8 add support of ruToken
Thanks to Andrew V. Stepanov for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2007-December/010617.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3304 c6295689-39f2-0310-b995-f0e70906c6a9
2007-12-17 13:39:20 +00:00
nils e8c05ca648 use more opensc specific names for ASN.1 tags to avoid name conflicts
with other ASN.1 libraries


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2815 c6295689-39f2-0310-b995-f0e70906c6a9
2006-01-20 20:52:36 +00:00
aj e49f78a360 fix typo on *paramp test.
check alg_info always, not only in some case.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2720 c6295689-39f2-0310-b995-f0e70906c6a9
2005-12-05 21:49:59 +00:00
nils 23802d825e properly initialize sc_asn1_entry elements + some cleanup
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2463 c6295689-39f2-0310-b995-f0e70906c6a9
2005-08-05 07:24:43 +00:00
bert 2d97002824 API fixup: use defined type instead of struct for exposed structs
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2232 c6295689-39f2-0310-b995-f0e70906c6a9
2005-03-08 20:59:35 +00:00
nils a82a40e977 some cleanup + improved error checking
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2051 c6295689-39f2-0310-b995-f0e70906c6a9
2005-01-03 17:20:17 +00:00
nils f044157553 fix incorrect use of realloc (x = realloc(x, y) doesn't free
the x in case of a failure)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1775 c6295689-39f2-0310-b995-f0e70906c6a9
2004-04-21 18:10:58 +00:00
sth e87ba3c387 Fix: add room for a 'last-flag' object (Ivo Pieck)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1490 c6295689-39f2-0310-b995-f0e70906c6a9
2003-10-06 14:22:03 +00:00
aet 5616dba08e - Stop using unflexible automake conditionals when
building PC/SC, OpenCT or USBToken support,
  use ifdef's directly in source.
- Because of above, add HAVE_PCSCLITE for winconfig.h
- Remove unnecessary includes for log.h, opensc.h and
  errors.h in libopensc sources, they're already taken
  care by internal.h.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1406 c6295689-39f2-0310-b995-f0e70906c6a9
2003-09-03 09:28:55 +00:00
aet 763fc16704 Rename libopensc specific error/debug to sc_error/sc_debug
We should have done this ages ago.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1392 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-25 14:21:18 +00:00
okir 2abc504051 - remove signedness warnings printed by new gcc
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1176 c6295689-39f2-0310-b995-f0e70906c6a9
2003-05-30 08:54:42 +00:00
aet 3dccd63989 - C++ support. Compiles with gcc/g++ for Linux, otherwise
completely untested.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@574 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-19 14:23:31 +00:00
okir 2b9ae3613b - fix algorithm_id decoding
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@558 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-18 09:10:33 +00:00
okir 228b6645c8 - correctly encode AlgorithmIdentifier w/o params as OID+NULL
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@541 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-17 12:19:43 +00:00
okir 1424c83854 - minor bugfix
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@540 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-17 10:33:26 +00:00
okir 77a2db5f5e - Moved ASN.1 handling of AlgorithmIdentifier to separate file
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@527 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-17 08:55:06 +00:00