]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
9 years agoupdated auto-generated files
Nikos Mavrogiannopoulos [Wed, 9 Aug 2017 08:44:56 +0000 (10:44 +0200)] 
updated auto-generated files

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agop11tool: --generate-xxx options were replaced by generate-privkey
Nikos Mavrogiannopoulos [Wed, 9 Aug 2017 08:41:58 +0000 (10:41 +0200)] 
p11tool: --generate-xxx options were replaced by generate-privkey

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoFix memleaks in gnutls_x509_trust_list_add_crls()
Tim Rühsen [Mon, 7 Aug 2017 21:04:36 +0000 (23:04 +0200)] 
Fix memleaks in gnutls_x509_trust_list_add_crls()

Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
9 years agoFix memleak in gnutls_x509_crl_list_import()
Tim Rühsen [Mon, 7 Aug 2017 21:04:05 +0000 (23:04 +0200)] 
Fix memleak in gnutls_x509_crl_list_import()

Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
9 years agopublickey: fixed incorrect assignment
Nikos Mavrogiannopoulos [Tue, 8 Aug 2017 13:03:53 +0000 (15:03 +0200)] 
publickey: fixed incorrect assignment

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agomac: simplified iteration functions
Nikos Mavrogiannopoulos [Tue, 8 Aug 2017 13:03:11 +0000 (15:03 +0200)] 
mac: simplified iteration functions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocorrected input to gnutls_sign_supports_pk_algorithm
Nikos Mavrogiannopoulos [Tue, 8 Aug 2017 12:59:56 +0000 (14:59 +0200)] 
corrected input to gnutls_sign_supports_pk_algorithm

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoextensions: corrected flag check
Nikos Mavrogiannopoulos [Tue, 8 Aug 2017 12:59:44 +0000 (14:59 +0200)] 
extensions: corrected flag check

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: updated for new rsa-pss key in doc/credentials
Nikos Mavrogiannopoulos [Tue, 8 Aug 2017 13:50:44 +0000 (15:50 +0200)] 
tests: updated for new rsa-pss key in doc/credentials

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocert selection: prioritize RSA-PSS certs over RSA
Nikos Mavrogiannopoulos [Tue, 8 Aug 2017 10:51:58 +0000 (12:51 +0200)] 
cert selection: prioritize RSA-PSS certs over RSA

RSA and RSA-PSS can both be used for RSA-PSS operations, and
as such without prioritizing RSA-PSS certificates it is unknown
which certificate will be used for an RSA-PSS operation. The
reason we want to have only RSA-PSS keys used for RSA-PSS operations
is to cover the use case where a server uses a legacy RSA certificate
for clients that don't support RSA-PSS and an RSA-PSS certificate
for the rest, thus separating the keys used for these client
groups. That separation ensures that any issue on PKCS#1 1.5
(legacy RSA), would not affect sessions which use RSA-PSS.

Resolves #243

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_certificate_credentials_t: combine privkey into cert_st structure
Nikos Mavrogiannopoulos [Tue, 8 Aug 2017 09:35:26 +0000 (11:35 +0200)] 
gnutls_certificate_credentials_t: combine privkey into cert_st structure

This reduces the number of applications and allows for easier
use of the structure information, as they are now self-contained
for most uses.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: verify whether the RSA-PSS key is preferred on RSA-PSS sigs
Nikos Mavrogiannopoulos [Tue, 8 Aug 2017 08:56:17 +0000 (10:56 +0200)] 
tests: verify whether the RSA-PSS key is preferred on RSA-PSS sigs

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocerttool: eliminated unused variable
Nikos Mavrogiannopoulos [Tue, 8 Aug 2017 07:27:57 +0000 (09:27 +0200)] 
certtool: eliminated unused variable

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added negative tests in provable-privkey
Nikos Mavrogiannopoulos [Mon, 7 Aug 2017 14:32:17 +0000 (16:32 +0200)] 
tests: added negative tests in provable-privkey

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_pk_params_st: separate flags/qbits and curve
Nikos Mavrogiannopoulos [Mon, 7 Aug 2017 14:23:29 +0000 (16:23 +0200)] 
gnutls_pk_params_st: separate flags/qbits and curve

Previously we were using the field flags to store the
size of q in case of GNUTLS_PK_DH, some key generation flags
in case of GNUTLS_PK_RSA, and the curve in case of elliptic
curve key. Separate this into multiple fields to reduce
confusion on the field.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: check whether validation parameters are lost on key re-import
Nikos Mavrogiannopoulos [Mon, 7 Aug 2017 12:55:38 +0000 (14:55 +0200)] 
tests: check whether validation parameters are lost on key re-import

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocerttool: improved documentation on --provable option
Nikos Mavrogiannopoulos [Sat, 5 Aug 2017 18:08:31 +0000 (20:08 +0200)] 
certtool: improved documentation on --provable option

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agocerttool: create mapping between --load-x and --info options
Nikos Mavrogiannopoulos [Sat, 5 Aug 2017 17:52:40 +0000 (19:52 +0200)] 
certtool: create mapping between --load-x and --info options

That allows using:
certtool --certificate-info --load-certificate FILE
and
certtool --certificate-info --infile FILE

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agocerttool: removed definitions of non-existing functions
Nikos Mavrogiannopoulos [Sat, 5 Aug 2017 17:35:53 +0000 (19:35 +0200)] 
certtool: removed definitions of non-existing functions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agotests: updated for the new provable private key format
Nikos Mavrogiannopoulos [Sat, 5 Aug 2017 15:08:16 +0000 (17:08 +0200)] 
tests: updated for the new provable private key format

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agognutls_x509_privkey_verify_seed: improved error on missing validation parameters
Nikos Mavrogiannopoulos [Sat, 5 Aug 2017 08:17:46 +0000 (10:17 +0200)] 
gnutls_x509_privkey_verify_seed: improved error on missing validation parameters

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agocerttool: silence warnings related to --pkcs8
Nikos Mavrogiannopoulos [Tue, 1 Aug 2017 14:17:45 +0000 (16:17 +0200)] 
certtool: silence warnings related to --pkcs8

There is no reason to bug the user with such details by default.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocerttool: better print provable key validation parameters
Nikos Mavrogiannopoulos [Tue, 1 Aug 2017 13:18:34 +0000 (15:18 +0200)] 
certtool: better print provable key validation parameters

That is, include hash in the printable set, and keep spaces
from next fields.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocerttool: provable private keys are always exported in PKCS#8 form
Nikos Mavrogiannopoulos [Tue, 1 Aug 2017 13:11:12 +0000 (15:11 +0200)] 
certtool: provable private keys are always exported in PKCS#8 form

That allows the provable parameters to be included.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agox509: no longer emit the previous custom format for provable parameters
Nikos Mavrogiannopoulos [Tue, 1 Aug 2017 12:43:04 +0000 (14:43 +0200)] 
x509: no longer emit the previous custom format for provable parameters

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agox509: store and read provable seed in PKCS#8 form of key
Nikos Mavrogiannopoulos [Tue, 1 Aug 2017 12:30:06 +0000 (14:30 +0200)] 
x509: store and read provable seed in PKCS#8 form of key

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoAdded information on OID registry
Nikos Mavrogiannopoulos [Wed, 2 Aug 2017 08:28:07 +0000 (10:28 +0200)] 
Added information on OID registry

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agopkix.asn: removed unused DomainParameters
Nikos Mavrogiannopoulos [Tue, 1 Aug 2017 12:23:31 +0000 (14:23 +0200)] 
pkix.asn: removed unused DomainParameters

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agox509: separated PKIX1 attributes parsing code for cert request handling
Nikos Mavrogiannopoulos [Tue, 1 Aug 2017 09:29:26 +0000 (11:29 +0200)] 
x509: separated PKIX1 attributes parsing code for cert request handling

This allows other code to utilize it.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago_gnutls_fbase64_decode will always return non-zero
Nikos Mavrogiannopoulos [Mon, 7 Aug 2017 07:36:20 +0000 (09:36 +0200)] 
_gnutls_fbase64_decode will always return non-zero

That is, document that fact and update its callers to remove
checks for zero.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago_gnutls_base64_decode: reject all zero-length string encodings on decoding
Nikos Mavrogiannopoulos [Sun, 6 Aug 2017 15:23:52 +0000 (17:23 +0200)] 
_gnutls_base64_decode: reject all zero-length string encodings on decoding

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agowrap_nettle_pk_fixup: added sanity check in RSA-PSS param checking
Nikos Mavrogiannopoulos [Sun, 6 Aug 2017 09:34:39 +0000 (11:34 +0200)] 
wrap_nettle_pk_fixup: added sanity check in RSA-PSS param checking

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years ago_decode_pkcs8_rsa_key: signal error in RSA privkey decoding
Nikos Mavrogiannopoulos [Sun, 6 Aug 2017 09:34:10 +0000 (11:34 +0200)] 
_decode_pkcs8_rsa_key: signal error in RSA privkey decoding

Addresses oss-fuzz issue:
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2865

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agotests: added reproducer for private key crash
Nikos Mavrogiannopoulos [Sun, 6 Aug 2017 09:28:15 +0000 (11:28 +0200)] 
tests: added reproducer for private key crash

Found using oss-fuzz:
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2865

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agotests: added unit test of gnutls_x509_crt_list_import
Nikos Mavrogiannopoulos [Sun, 6 Aug 2017 08:17:29 +0000 (10:17 +0200)] 
tests: added unit test of gnutls_x509_crt_list_import

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agotests: added reproducer applications for psk and srp fuzzers
Nikos Mavrogiannopoulos [Sat, 5 Aug 2017 07:35:14 +0000 (09:35 +0200)] 
tests: added reproducer applications for psk and srp fuzzers

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agoupdated auto-generated files
Nikos Mavrogiannopoulos [Fri, 4 Aug 2017 17:47:00 +0000 (19:47 +0200)] 
updated auto-generated files

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agognutls_server_fuzzer: added ed25519 key/cert
Nikos Mavrogiannopoulos [Sun, 30 Jul 2017 00:57:03 +0000 (02:57 +0200)] 
gnutls_server_fuzzer: added ed25519 key/cert

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agoremoved references for "new" semantics of PEM base64 encode and decode
Nikos Mavrogiannopoulos [Mon, 31 Jul 2017 07:22:51 +0000 (09:22 +0200)] 
removed references for "new" semantics of PEM base64 encode and decode

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agobase64: reverted the raw semantics from the PEM encoding/decoding functions
Nikos Mavrogiannopoulos [Mon, 31 Jul 2017 07:19:22 +0000 (09:19 +0200)] 
base64: reverted the raw semantics from the PEM encoding/decoding functions

Keeping the complex semantics with NULL headers would most likely cause
issues in the future.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agobase64: test the new base64 encoding and decoding functions
Nikos Mavrogiannopoulos [Mon, 31 Jul 2017 07:15:20 +0000 (09:15 +0200)] 
base64: test the new base64 encoding and decoding functions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agobase64: uniformly use GNUTLS_E_BASE64_DECODING_ERROR for decoding errors
Nikos Mavrogiannopoulos [Mon, 31 Jul 2017 07:13:35 +0000 (09:13 +0200)] 
base64: uniformly use GNUTLS_E_BASE64_DECODING_ERROR for decoding errors

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agobase64: introduced new functions for base64 encoding
Nikos Mavrogiannopoulos [Mon, 31 Jul 2017 07:08:24 +0000 (09:08 +0200)] 
base64: introduced new functions for base64 encoding

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agotests: gnutls_x509_privkey_import: enhanced to test DER key import
Nikos Mavrogiannopoulos [Sun, 30 Jul 2017 17:05:23 +0000 (19:05 +0200)] 
tests: gnutls_x509_privkey_import: enhanced to test DER key import

It seems that this function was not tested for multiple cases of
private keys in DER mode.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agognutls_x509_privkey_import: allow importing ed25519 PKCS#8 keys in DER form
Nikos Mavrogiannopoulos [Sun, 30 Jul 2017 01:43:42 +0000 (03:43 +0200)] 
gnutls_x509_privkey_import: allow importing ed25519 PKCS#8 keys in DER form

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agosign/digest: separate "brokenness" of signatures and hash algorithms
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 12:00:27 +0000 (14:00 +0200)] 
sign/digest: separate "brokenness" of signatures and hash algorithms

That is, allow digital signatures to be marked as broken irrespective
of their used hash, and restrict hash brokenness to preimage resistance.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agosign: use C99 syntax for signature algorithm's table
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 11:40:21 +0000 (13:40 +0200)] 
sign: use C99 syntax for signature algorithm's table

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago.gitlab-ci.yml: enable multiple undefined sub-sanitizers
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 11:22:51 +0000 (13:22 +0200)] 
.gitlab-ci.yml: enable multiple undefined sub-sanitizers

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoupdated auto-generated files
Nikos Mavrogiannopoulos [Fri, 4 Aug 2017 14:40:29 +0000 (16:40 +0200)] 
updated auto-generated files

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agop11tool: auto-generate the list of PKCS#11 mechanisms from p11-kit
Nikos Mavrogiannopoulos [Mon, 31 Jul 2017 11:51:56 +0000 (13:51 +0200)] 
p11tool: auto-generate the list of PKCS#11 mechanisms from p11-kit

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added unit test for gnutls_x509_privkey_import
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 10:11:06 +0000 (12:11 +0200)] 
tests: added unit test for gnutls_x509_privkey_import

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added TLS negotiation with various keys under PKCS#11
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 09:52:28 +0000 (11:52 +0200)] 
tests: added TLS negotiation with various keys under PKCS#11

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agox509_privkey: handle keys which can only have PKCS#8 form transparently
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 09:48:40 +0000 (11:48 +0200)] 
x509_privkey: handle keys which can only have PKCS#8 form transparently

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: updated for errors returned due to early signature selection
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 09:00:03 +0000 (11:00 +0200)] 
tests: updated for errors returned due to early signature selection

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added check for the negotiation of ext keys
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 08:30:25 +0000 (10:30 +0200)] 
tests: added check for the negotiation of ext keys

That is, check whether we can negotiate TLS with ext abstract
key types, and whether the algorithms which cannot be used
with that key type, gracefully fail.

Relates #234

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoprivkey: reject signing with ext keys and GNUTLS_PK_RSA_PSS or GNUTLS_PK_EDDSA_ED25519
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 08:22:29 +0000 (10:22 +0200)] 
privkey: reject signing with ext keys and GNUTLS_PK_RSA_PSS or GNUTLS_PK_EDDSA_ED25519

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago_gnutls_check_key_cert_match: use the new API for signing
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 08:09:54 +0000 (10:09 +0200)] 
_gnutls_check_key_cert_match: use the new API for signing

This ensures that the same signature algorithm is used for
signing and verification.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoprivkey: return less specific but more appropriate error on invalid pks for ext keys
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 08:02:59 +0000 (10:02 +0200)] 
privkey: return less specific but more appropriate error on invalid pks for ext keys

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoprior to negotiating a signature check compatibility with private key
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 07:27:03 +0000 (09:27 +0200)] 
prior to negotiating a signature check compatibility with private key

That is, check if the private key can support the public key operation
needed for the signature. That in particular includes, excluding the
Ed25519 and RSA-PSS from being used with the 'EXT' keys as the
current API cannot handle them, and RSA-PSS from being used by PKCS#11
RSA keys which do not provide the CKM_RSA_PKCS_PSS mechanism.

Relates #234
Resolves #209

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agopkcs11: mark RSA PKCS#11 key which can do RSA-PSS
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 07:21:59 +0000 (09:21 +0200)] 
pkcs11: mark RSA PKCS#11 key which can do RSA-PSS

Also refuse to sign with RSA-PSS if the mechanism is not supported.

Relates #208

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agohandshake: select a signature algorithm early
Nikos Mavrogiannopoulos [Tue, 11 Jul 2017 09:55:52 +0000 (11:55 +0200)] 
handshake: select a signature algorithm early

That is, select the signature algorithm at the point the certificate and
ciphersuites are decided. Also ensure that a compatible signature algorithm
with the ciphersuite and the key is selected.

That prevents situations where a ciphersuite and a certificate are
negotiated, but later on the handshake we figure that there are no
common signature algorithms.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added basic unit test of gnutls_pkcs11_token_check_mechanism
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 06:46:18 +0000 (08:46 +0200)] 
tests: added basic unit test of gnutls_pkcs11_token_check_mechanism

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_pkcs11_token_check_mechanism: introduced function to check token for a particu...
Nikos Mavrogiannopoulos [Thu, 27 Jul 2017 16:07:54 +0000 (18:07 +0200)] 
gnutls_pkcs11_token_check_mechanism: introduced function to check token for a particular mechanism

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoupdated auto-generated files
Nikos Mavrogiannopoulos [Fri, 4 Aug 2017 08:45:20 +0000 (10:45 +0200)] 
updated auto-generated files

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agox509/output: print error on invalid public key parameters on certificate
Nikos Mavrogiannopoulos [Fri, 4 Aug 2017 08:21:06 +0000 (10:21 +0200)] 
x509/output: print error on invalid public key parameters on certificate

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_pk_get_oid: return early on unknown algorithm
Nikos Mavrogiannopoulos [Fri, 4 Aug 2017 08:05:29 +0000 (10:05 +0200)] 
gnutls_pk_get_oid: return early on unknown algorithm

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: check whether the gnutls_x509_*_set_spki will reject invalid values
Nikos Mavrogiannopoulos [Fri, 4 Aug 2017 07:48:42 +0000 (09:48 +0200)] 
tests: check whether the gnutls_x509_*_set_spki will reject invalid values

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: updated for gnutls_x509_spki_get_rsa_pss_params
Nikos Mavrogiannopoulos [Fri, 4 Aug 2017 07:34:23 +0000 (09:34 +0200)] 
tests: updated for gnutls_x509_spki_get_rsa_pss_params

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added unit test of generation of legal and illegal rsa-pss parameters
Nikos Mavrogiannopoulos [Fri, 4 Aug 2017 07:29:12 +0000 (09:29 +0200)] 
tests: added unit test of generation of legal and illegal rsa-pss parameters

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agospki: combined all exported functions to a single set and get
Nikos Mavrogiannopoulos [Fri, 4 Aug 2017 07:25:31 +0000 (09:25 +0200)] 
spki: combined all exported functions to a single set and get

This simplifies setting parameters for a particular key type,
as well as getting them. The advantage is that they are set
atomically, preventing an inadverterly half-filled structure.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocerttool: set RSA-PSS parameters using GNUTLS_KEYGEN_SPKI kdata type
Nikos Mavrogiannopoulos [Fri, 4 Aug 2017 07:13:15 +0000 (09:13 +0200)] 
certtool: set RSA-PSS parameters using GNUTLS_KEYGEN_SPKI kdata type

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agointroduced error code GNUTLS_E_PK_INVALID_PUBKEY_PARAMS
Nikos Mavrogiannopoulos [Fri, 4 Aug 2017 07:06:32 +0000 (09:06 +0200)] 
introduced error code GNUTLS_E_PK_INVALID_PUBKEY_PARAMS

This is being use to indicate errors in the public key parameters
such as the RSA-PSS salt size or digest algorithm.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_x509_privkey_generate*: allow specifying the SPKI parameters for key generation
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 14:46:32 +0000 (16:46 +0200)] 
gnutls_x509_privkey_generate*: allow specifying the SPKI parameters for key generation

This in turn removes the need for reading the flag GNUTLS_PRIVKEY_FLAG_REPRODUCIBLE
on the key generation process. The flag is now only used during key signing
which is also its documented purpose.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_x509_privkey_set_spki: check validity of parameters set
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 14:29:18 +0000 (16:29 +0200)] 
gnutls_x509_privkey_set_spki: check validity of parameters set

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_x509_cr*_set_spki: check for validity of parameters set
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 14:21:26 +0000 (16:21 +0200)] 
gnutls_x509_cr*_set_spki: check for validity of parameters set

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago_gnutls_x509_check_pubkey_params: removed unnecessary parameter
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 14:16:49 +0000 (16:16 +0200)] 
_gnutls_x509_check_pubkey_params: removed unnecessary parameter

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added check for import of RSA-PSS key with invalid salt
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 14:06:06 +0000 (16:06 +0200)] 
tests: added check for import of RSA-PSS key with invalid salt

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_pubkey_import_x509: propagate errors from gnutls_x509_crt_get_pk_algorithm
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 13:37:18 +0000 (15:37 +0200)] 
gnutls_pubkey_import_x509: propagate errors from gnutls_x509_crt_get_pk_algorithm

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago_rsa_pss_verify_digest: verify the validity of the salt_size length on verification
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 13:16:08 +0000 (15:16 +0200)] 
_rsa_pss_verify_digest: verify the validity of the salt_size length on verification

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_x509_privkey_import: immediately exit on GNUTLS_E_PK_INVALID_PRIVKEY
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 13:08:43 +0000 (15:08 +0200)] 
gnutls_x509_privkey_import: immediately exit on GNUTLS_E_PK_INVALID_PRIVKEY

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agowrap_nettle_pk_fixup: check RSA PSS parameters for validity on import
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 13:00:00 +0000 (15:00 +0200)] 
wrap_nettle_pk_fixup: check RSA PSS parameters for validity on import

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_x509_*_set_spki: removed arbitrary restrictions to setting parameters
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 09:03:44 +0000 (11:03 +0200)] 
gnutls_x509_*_set_spki: removed arbitrary restrictions to setting parameters

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added unit test for the SPKI abstract functions
Nikos Mavrogiannopoulos [Fri, 28 Jul 2017 06:20:16 +0000 (08:20 +0200)] 
tests: added unit test for the SPKI abstract functions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: chainverify: included negative and positive tests with RSA-PSS signed chains
Nikos Mavrogiannopoulos [Thu, 27 Jul 2017 09:24:40 +0000 (11:24 +0200)] 
tests: chainverify: included negative and positive tests with RSA-PSS signed chains

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agopct_test: use local SPKI structure to override parameters if not set
Nikos Mavrogiannopoulos [Thu, 27 Jul 2017 13:03:00 +0000 (15:03 +0200)] 
pct_test: use local SPKI structure to override parameters if not set

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agofixup_spki_params: use GNUTLS_E_CONSTRAINT_ERROR for RSA-PSS violations
Nikos Mavrogiannopoulos [Thu, 27 Jul 2017 06:44:05 +0000 (08:44 +0200)] 
fixup_spki_params: use GNUTLS_E_CONSTRAINT_ERROR for RSA-PSS violations

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago_gnutls_x509_read_pkalgo_params: initialize params structure
Nikos Mavrogiannopoulos [Thu, 27 Jul 2017 06:28:54 +0000 (08:28 +0200)] 
_gnutls_x509_read_pkalgo_params: initialize params structure

That is the primary call on these parameters, thus it should
initialize the structure with something reasonable. That is
similar to behavior of _gnutls_x509_read_rsa_pss_params.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoRSA-PSS parameter checking was moved to lower level functions
Nikos Mavrogiannopoulos [Thu, 27 Jul 2017 06:14:37 +0000 (08:14 +0200)] 
RSA-PSS parameter checking was moved to lower level functions

That way all PKI callers get protected by the checks.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agosignature security level check were moved to lower level functions
Nikos Mavrogiannopoulos [Thu, 27 Jul 2017 05:55:24 +0000 (07:55 +0200)] 
signature security level check were moved to lower level functions

That way all callers (including PKI functions) get protected by
the available checks.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago_wrap_nettle_pk_encrypt: return GNUTLS_E_INVALID_REQUEST on unsupported algorithms
Nikos Mavrogiannopoulos [Thu, 27 Jul 2017 05:19:36 +0000 (07:19 +0200)] 
_wrap_nettle_pk_encrypt: return GNUTLS_E_INVALID_REQUEST on unsupported algorithms

That is a more specific error code than internal error.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocerttool: print signature algorithm in cert verification output
Nikos Mavrogiannopoulos [Thu, 27 Jul 2017 05:10:22 +0000 (07:10 +0200)] 
certtool: print signature algorithm in cert verification output

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoverify_crt: translate GNUTLS_E_CONSTRAINT_ERROR to verification status flag
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 15:51:00 +0000 (17:51 +0200)] 
verify_crt: translate GNUTLS_E_CONSTRAINT_ERROR to verification status flag

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agox509/sign: in debugging mode print the signature algorithm
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 15:50:33 +0000 (17:50 +0200)] 
x509/sign: in debugging mode print the signature algorithm

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago_gnutls_x509_validate_sign_params: use GNUTLS_E_CONSTRAINT_ERROR for mismatch of...
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 15:34:14 +0000 (17:34 +0200)] 
_gnutls_x509_validate_sign_params: use GNUTLS_E_CONSTRAINT_ERROR for mismatch of RSA-PSS parameters

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago_gnutls_x509_read_rsa_pss_params: fail early on unknown hash algorithms
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 15:28:00 +0000 (17:28 +0200)] 
_gnutls_x509_read_rsa_pss_params: fail early on unknown hash algorithms

Also utilize GNUTLS_E_CONSTRAINT_ERROR for signaling differences
between the hash functions.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_pubkey_get_preferred_hash_algorithm: will take into account the RSA-PSS SPKI
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 14:55:02 +0000 (16:55 +0200)] 
gnutls_pubkey_get_preferred_hash_algorithm: will take into account the RSA-PSS SPKI

In addition it will offer a SHA hash depending on the key size for
RSA public keys.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocerttool: sign_params_to_flags: use strtok to parse input
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 14:45:00 +0000 (16:45 +0200)] 
certtool: sign_params_to_flags: use strtok to parse input

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocerttool: copy SPKI information from private key when available
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 13:41:51 +0000 (15:41 +0200)] 
certtool: copy SPKI information from private key when available

That also addresses a bug due to which SPKI information was not set.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agox509/output: Subject Public Key parameters are printed just before actual key
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 13:54:07 +0000 (15:54 +0200)] 
x509/output: Subject Public Key parameters are printed just before actual key

That allows to easier figure out algorithm and basic parameters, rather
than having them at the end of long key output.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_x509_crt_set_spki: be more verbose in parameter restrictions
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 13:35:15 +0000 (15:35 +0200)] 
gnutls_x509_crt_set_spki: be more verbose in parameter restrictions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>