]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 years ago_gnutls_privkey_update_spki_params: use GNUTLS_E_CONSTRAINT_ERROR on mismatch of...
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 13:07:42 +0000 (15:07 +0200)] 
_gnutls_privkey_update_spki_params: use GNUTLS_E_CONSTRAINT_ERROR on mismatch of hash

That is a more specific error code for hash mismatch between
public key information and signature. In addition only override
the salt size, if it is set to zero without the proper flags.

That prevents the update function from setting an invalid (lower)
than the expected size.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agocert-tests: use .tmp suffix for all tests
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 13:00:17 +0000 (15:00 +0200)] 
cert-tests: use .tmp suffix for all tests

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agocerttool: allow specifying RSA-PSS parameters for key generation
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 12:43:15 +0000 (14:43 +0200)] 
certtool: allow specifying RSA-PSS parameters for key generation

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years ago_gnutls_x509_write_rsa_pss_params: refuse to write RSA-PSS parameters we cannot use
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 12:56:36 +0000 (14:56 +0200)] 
_gnutls_x509_write_rsa_pss_params: refuse to write RSA-PSS parameters we cannot use

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agocerttool: group together common options
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 12:30:03 +0000 (14:30 +0200)] 
certtool: group together common options

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agotests: modified to account new errors
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 11:41:46 +0000 (13:41 +0200)] 
tests: modified to account new errors

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agognutls_x509_*_get_signature_algorithm: simplified error handling
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 15:58:06 +0000 (17:58 +0200)] 
gnutls_x509_*_get_signature_algorithm: simplified error handling

These functions were documented to return a negative error code
on failure, as well as GNUTLS_SIGN_UNKNOWN on unknown algorithms.
Simplify them by only returning GNUTLS_SIGN_UNKNOWN on all error
conditions.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years ago_gnutls_x509_get_signature_algorithm: return negative error code on unknown algorithm
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 11:24:52 +0000 (13:24 +0200)] 
_gnutls_x509_get_signature_algorithm: return negative error code on unknown algorithm

This allows internal callers to quickly fail on errors.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agocompare_sig_algorithm: modify to work even for certs with unsupported signature algorithm
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 11:40:31 +0000 (13:40 +0200)] 
compare_sig_algorithm: modify to work even for certs with unsupported signature algorithm

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agopubkey_verify_hashed_data: simplified and made static
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 07:20:22 +0000 (09:20 +0200)] 
pubkey_verify_hashed_data: simplified and made static

That also removes its ability to operate with the 'unknown'
signature algorithm, and forces the TLS 1.0 key exchange to
supply the right algorithm or flags.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agopubkey_verify_data: accept signature entry instead of PK and hash
Nikos Mavrogiannopoulos [Wed, 26 Jul 2017 07:16:03 +0000 (09:16 +0200)] 
pubkey_verify_data: accept signature entry instead of PK and hash

That aligns better with current callers which know the signature
algorithm in use.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agoNEWS: documented the SPKI handling functions
Nikos Mavrogiannopoulos [Thu, 27 Jul 2017 15:00:00 +0000 (17:00 +0200)] 
NEWS: documented the SPKI handling functions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agotests: added RSA and RSA PSS key unit tests
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 11:42:12 +0000 (13:42 +0200)] 
tests: added RSA and RSA PSS key unit tests

That is test:
 1. Whether RSA-PSS keys will refuse to sign with incompatible signature
 2. Whether RSA-PSS public keys cannot be used for encryption
 3. Whether RSA-PSS keys cannot be used for signing with PKCS#1 1.5
 4. Whether an RSA key can be converted to an RSA-PSS one with the public APIs

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agocerttool: do not print error on missing RSA-PSS parameters on key
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 14:52:18 +0000 (16:52 +0200)] 
certtool: do not print error on missing RSA-PSS parameters on key

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agoAdded convention for missing SubjectPublicKeyInfo params field
Nikos Mavrogiannopoulos [Thu, 27 Jul 2017 14:53:57 +0000 (16:53 +0200)] 
Added convention for missing SubjectPublicKeyInfo params field

That is, when that field is missing, the spki_st structure field
pk will be set to GNUTLS_PK_UNKNOWN. In that case other fields
are undefined.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years ago*set_spki(): return error on incompatible algorithms
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 12:01:48 +0000 (14:01 +0200)] 
*set_spki(): return error on incompatible algorithms

In addition update the public key algorithm field in the
respective structure.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agognutls_x509_privkey_generate2: do not hardcode the RSA-PSS hash to SHA256
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 14:33:26 +0000 (16:33 +0200)] 
gnutls_x509_privkey_generate2: do not hardcode the RSA-PSS hash to SHA256

Instead use _gnutls_pk_bits_to_sha_hash() to set an appropriate hash
for the number of bits of the key. This matches better the "intention"
of RSA-PSS or tying the security parameter with the salt and hash.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years ago_decode_pkcs8_rsa_pss_key: ensure we set the PSS PK identifier
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 12:14:49 +0000 (14:14 +0200)] 
_decode_pkcs8_rsa_pss_key: ensure we set the PSS PK identifier

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agocleanup: removed duplicate parameter in gnutls_pubkey_st
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 11:38:34 +0000 (13:38 +0200)] 
cleanup: removed duplicate parameter in gnutls_pubkey_st

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agognutls_x509_privkey_int: eliminated duplicate pk_algorithm field
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 11:28:44 +0000 (13:28 +0200)] 
gnutls_x509_privkey_int: eliminated duplicate pk_algorithm field

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agocleanup: removed unnecessary/duplicate parameters in _dsa_q_to_hash
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 11:34:50 +0000 (13:34 +0200)] 
cleanup: removed unnecessary/duplicate parameters in _dsa_q_to_hash

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agocleanup: removed unnecessary/duplicate parameters in functions
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 11:18:05 +0000 (13:18 +0200)] 
cleanup: removed unnecessary/duplicate parameters in functions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agocleanup: removed unnecessary/duplicate parameters in functions
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 11:12:19 +0000 (13:12 +0200)] 
cleanup: removed unnecessary/duplicate parameters in functions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agoabstract.h: added functions to read and write SPKI information
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 10:01:52 +0000 (12:01 +0200)] 
abstract.h: added functions to read and write SPKI information

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agognutls_x509_privkey_set_spki: introduced function to update SPKI on a key
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 09:48:58 +0000 (11:48 +0200)] 
gnutls_x509_privkey_set_spki: introduced function to update SPKI on a key

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agotests: added unit test for the SPKI related functions
Nikos Mavrogiannopoulos [Mon, 24 Jul 2017 14:35:50 +0000 (16:35 +0200)] 
tests: added unit test for the SPKI related functions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agox509.h: Renamed SPKI related functions
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 09:37:04 +0000 (11:37 +0200)] 
x509.h: Renamed SPKI related functions

This better reflects their purpose as providers of information
for subject public key. In addition use 'const' for fields that
should be left intact.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agotests: introduced RSA-PSS key exchange with a key fixed to rsa-pss with sha256
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 07:43:05 +0000 (09:43 +0200)] 
tests: introduced RSA-PSS key exchange with a key fixed to rsa-pss with sha256

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years ago_gnutls_pubkey_compatible_with_sig: enforce RSA-PSS requirements
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 08:06:10 +0000 (10:06 +0200)] 
_gnutls_pubkey_compatible_with_sig: enforce RSA-PSS requirements

That is require that parameters in an RSA-PSS key which has them
explicitly set, are respected with regards to signature algorithm
negotiation.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agotests: eagain-common.h: remove superfluous information
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 07:39:32 +0000 (09:39 +0200)] 
tests: eagain-common.h: remove superfluous information

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agotests: renamed tests for uniformity
Nikos Mavrogiannopoulos [Wed, 12 Jul 2017 06:49:30 +0000 (08:49 +0200)] 
tests: renamed tests for uniformity

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agotests: added unit test for RSA-PSS signing over PKCS#11
Nikos Mavrogiannopoulos [Mon, 24 Jul 2017 14:15:15 +0000 (16:15 +0200)] 
tests: added unit test for RSA-PSS signing over PKCS#11

This requires a softhsm with support for RSA_PKCS_PSS mechanism.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agognutls_pubkey_verify*: use common function to set RSA-PSS parameters
Nikos Mavrogiannopoulos [Mon, 24 Jul 2017 14:05:36 +0000 (16:05 +0200)] 
gnutls_pubkey_verify*: use common function to set RSA-PSS parameters

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agopkcs11: added support for signatures with RSA-PSS
Nikos Mavrogiannopoulos [Mon, 24 Jul 2017 09:21:34 +0000 (11:21 +0200)] 
pkcs11: added support for signatures with RSA-PSS

Relates #209

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agognutls_pk_params_st: renamed sign field to spki
Nikos Mavrogiannopoulos [Tue, 25 Jul 2017 08:16:40 +0000 (10:16 +0200)] 
gnutls_pk_params_st: renamed sign field to spki

The name "sign" was ambiguous with regard to its intented
use, as it could refer to digital signature parameters
which was not exactly the case. That field contains parameters
present in the subject public key info (SPKI), which could
be used in a digital signature, but not necessarily.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agoClarified the purpose of the spki params related functions
Nikos Mavrogiannopoulos [Mon, 24 Jul 2017 08:12:54 +0000 (10:12 +0200)] 
Clarified the purpose of the spki params related functions

_gnutls_privkey_get_sign_params was renamed to _gnutls_privkey_get_spki_params,
_gnutls_privkey_update_sign_params to _gnutls_privkey_update_spki_params,
and the dig entry of gnutls_x509_spki_st was renamed to rsa_pss_dig.

The reason is that there could be a confusion on the purpose of
the 'dig' entry, as it could be assumed to be the signature's hash
algorithm in the general case. That could not be because the SPKI
parameters do not contain it for any other algorithm than RSA-PSS.
As such, make a logical separation from SPKI reading functions
with the signature reading functions and try to use the
gnutls_sign_entry_st when signature information is required.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agoPass the signature algorithm lower in the verification stack
Nikos Mavrogiannopoulos [Fri, 21 Jul 2017 21:56:20 +0000 (23:56 +0200)] 
Pass the signature algorithm lower in the verification stack

This will allow enhancing the back-ends (PKCS#11 and ext) for
signing with the new signature algorithms like RSA-PSS and Ed25519.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agofuzz: introduced mem.h with common callbacks for mem access
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 05:46:11 +0000 (07:46 +0200)] 
fuzz: introduced mem.h with common callbacks for mem access

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agoupdated auto-generated files
Nikos Mavrogiannopoulos [Thu, 3 Aug 2017 05:38:13 +0000 (07:38 +0200)] 
updated auto-generated files

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agofuzz: added SRP server and client fuzzers
Nikos Mavrogiannopoulos [Mon, 31 Jul 2017 08:50:52 +0000 (10:50 +0200)] 
fuzz: added SRP server and client fuzzers

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agofuzz: introduced psk.h common header
Nikos Mavrogiannopoulos [Sun, 30 Jul 2017 01:01:08 +0000 (03:01 +0200)] 
fuzz: introduced psk.h common header

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agofuzz: added PSK server fuzzer
Nikos Mavrogiannopoulos [Sun, 30 Jul 2017 00:48:11 +0000 (02:48 +0200)] 
fuzz: added PSK server fuzzer

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agofuzz: added PSK client fuzzer
Nikos Mavrogiannopoulos [Sun, 30 Jul 2017 00:30:43 +0000 (02:30 +0200)] 
fuzz: added PSK client fuzzer

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agognutls-cli: introduced options to save client and server traces
Nikos Mavrogiannopoulos [Sun, 30 Jul 2017 00:12:19 +0000 (02:12 +0200)] 
gnutls-cli: introduced options to save client and server traces

This allows to easier obtain traces for use in fuzzers.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agofuzz: ported libidn2's main.c taking advantage of afl-clang-fast
Nikos Mavrogiannopoulos [Sat, 29 Jul 2017 23:45:22 +0000 (01:45 +0200)] 
fuzz: ported libidn2's main.c taking advantage of afl-clang-fast

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agognutls_system_recv_timeout: doc update
Nikos Mavrogiannopoulos [Sat, 29 Jul 2017 23:55:43 +0000 (01:55 +0200)] 
gnutls_system_recv_timeout: doc update

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agotlsfuzzer: enabled EC tests for x25519
Nikos Mavrogiannopoulos [Wed, 2 Aug 2017 18:52:57 +0000 (20:52 +0200)] 
tlsfuzzer: enabled EC tests for x25519

That includes tests for default curve.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agotlsfuzzer: enabled test for ECDHE without the supported groups/EC extension
Nikos Mavrogiannopoulos [Fri, 21 Jul 2017 13:18:38 +0000 (15:18 +0200)] 
tlsfuzzer: enabled test for ECDHE without the supported groups/EC extension

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agoSet a default supported curve
Nikos Mavrogiannopoulos [Wed, 2 Aug 2017 15:25:17 +0000 (17:25 +0200)] 
Set a default supported curve

RFC4492 and draft-ietf-tls-rfc4492bis-17 mention:
"A client that proposes ECC cipher suites may choose not to include these
extensions.  In this case, the server is free to choose any one of
the elliptic curves or point formats listed in Section 5."

As such, we set a default curve to be used in the case the
server encounters a handshake with no supported groups/curves
extension.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agotlsfuzzer: removed duplicate tests
Nikos Mavrogiannopoulos [Wed, 2 Aug 2017 10:58:48 +0000 (12:58 +0200)] 
tlsfuzzer: removed duplicate tests

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agotlsfuzzer: fixed comment fields
Nikos Mavrogiannopoulos [Wed, 2 Aug 2017 10:55:24 +0000 (12:55 +0200)] 
tlsfuzzer: fixed comment fields

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agodoc update
Nikos Mavrogiannopoulos [Tue, 11 Jul 2017 06:02:56 +0000 (08:02 +0200)] 
doc update

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
8 years agoupdated auto-generated files
Nikos Mavrogiannopoulos [Mon, 24 Jul 2017 06:39:00 +0000 (08:39 +0200)] 
updated auto-generated files

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agognutls-cli: use FFDHE3072 parameters for benchmarking
Nikos Mavrogiannopoulos [Tue, 18 Jul 2017 06:13:00 +0000 (08:13 +0200)] 
gnutls-cli: use FFDHE3072 parameters for benchmarking

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years ago_gnutls_figure_dh_params: do not use have_ffdhe flag
Nikos Mavrogiannopoulos [Tue, 1 Aug 2017 08:21:37 +0000 (10:21 +0200)] 
_gnutls_figure_dh_params: do not use have_ffdhe flag

This flag is intended to indicate whether the peer has advertized
at least one FFDHE group, and not whether we have negotiated FFDHE.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agotests: added unit test for group listings in priority structure
Nikos Mavrogiannopoulos [Mon, 10 Jul 2017 10:23:55 +0000 (12:23 +0200)] 
tests: added unit test for group listings in priority structure

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
8 years agotests: updated cipher-listings.sh for the new groups listing
Nikos Mavrogiannopoulos [Mon, 10 Jul 2017 10:05:01 +0000 (12:05 +0200)] 
tests: updated cipher-listings.sh for the new groups listing

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