summaryrefslogtreecommitdiff
path: root/lib/auth
Commit message (Collapse)AuthorAgeFilesLines
* psk: Add basic support for RFC 9258 external PSK importer interfaceDaiki Ueno2023-05-046-23/+35
| | | | | | | | | | | | | | | | | | | | | | | | This adds a minimal, callback-based API to import external PSK, following RFC 9258. The client and the server importing external PSK are supposed to set a callback to retrieve PSK, which returns flags that may indicate the PSK is imported, along with the key: typedef int gnutls_psk_client_credentials_function3( gnutls_session_t session, gnutls_datum_t *username, gnutls_datum_t *key, gnutls_psk_key_flags *flags); typedef int gnutls_psk_server_credentials_function3( gnutls_session_t session, const gnutls_datum_t *username, gnutls_datum_t *key, gnutls_psk_key_flags *flags); Those callbacks are responsible to call gnutls_psk_format_imported_identity() for external PSKs to build a serialized PSK identity, and set GNUTLS_PSK_KEY_EXT in flags if the identity is an imported one. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* build: re-indent codeDaiki Ueno2023-04-2425-1876/+1492
| | | | Signed-off-by: Daiki Ueno <ueno@gnu.org>
* rsa: remove dead codeHubert Kario2023-02-081-17/+3
| | | | | | | since the `ok` variable isn't used any more, we can remove all code used to calculate it Signed-off-by: Hubert Kario <hkario@redhat.com>
* auth/rsa: side-step potential side-channelAlexander Sosedkin2023-02-081-10/+0
| | | | | | | | Remove branching that depends on secret data. Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com> Signed-off-by: Hubert Kario <hkario@redhat.com> Tested-by: Hubert Kario <hkario@redhat.com>
* Indent codeZoltan Fridrich2023-01-2725-729/+786
| | | | | Co-authored-by: Simon Josefsson <simon@josefsson.org> Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* Replace FSF snail mail addresses with URLStefan Kangas2022-12-271-3/+1
| | | | | | | This is the latest recommendation, as described here: https://www.gnu.org/licenses/gpl-howto.html Signed-off-by: Stefan Kangas <stefankangas@gmail.com>
* Prefer HTTPS to HTTP in URLsStefan Kangas2022-12-271-1/+1
| | | | | | | This mostly updates NEWS and license links. All links have been manually tested and confirmed working. Signed-off-by: Stefan Kangas <stefankangas@gmail.com>
* Merge branch 'master' into 'master'Daiki Ueno2022-12-201-3/+7
|\ | | | | | | | | fix obtain credential type based on the key exchange type fail;fix log print key mac size error See merge request gnutls/gnutls!1670
| * fix memory leak when process client ecdh key exchagexuraoqing2022-12-191-3/+7
| | | | | | | | Signed-off-by: xuraoqing <xuraoqing@huawei.com>
* | srp: provide stubs of public functions even if SRP is disabledDaiki Ueno2022-12-162-1/+36
| | | | | | | | | | | | | | This adds stub definitions of public SRP functions even if SRP is disabled with --disable-srp-authentication, to preserve the ABI. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* | build: suppress GCC analyzer warningsDaiki Ueno2022-11-221-0/+4
| | | | | | | | Signed-off-by: Daiki Ueno <ueno@gnu.org>
* | Fix handshake segfault if no privkey is suppliedZoltan Fridrich2022-10-211-0/+3
| | | | | | | | Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* | Reduce sensitive languageZoltan Fridrich2022-09-201-1/+1
|/ | | | Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* Increase the limit of TLS PSK usernames from 128 to 65535 charactersZoltan Fridrich2022-07-086-85/+87
| | | | | Co-authored-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* cert-auth: suppress false-positive warnings with GCC analyzerDaiki Ueno2022-01-121-1/+9
| | | | | | | | | | When compiled with gcc -fanalyzer, it reports: cert.c: In function '_gnutls_pcert_to_auth_info': cert.c:85:17: error: dereference of NULL 'info' [CWE-476] [-Werror=analyzer-null-dereference] 85 | if (info->raw_certificate_list != NULL) { Signed-off-by: Daiki Ueno <ueno@gnu.org>
* ASN1 : Remove warnings related to old libtasn1 namingsLeonardo Bras2021-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | While compiling gnutls, some warnings related to deprecated names can be printed, such as: ./../x509/x509_int.h:392:13: warning: 'ASN1_TYPE' macro is deprecated, use 'asn1_node' instead. 392 | int _gnutls_x509_write_key_int_le(ASN1_TYPE node, const char *value, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To avoid that, rename types as show in devel/libtasn1/NEWS (release 3.1): ASN1_DATA_NODE -> asn1_data_node_st ASN1_ARRAY_TYPE -> asn1_static_node (was asn1_static_node_t) ASN1_TYPE -> asn1_node ASN1_TYPE_EMPTY -> NULL static_struct_asn -> asn1_static_node_st node_asn_struct -> asn1_node_st node_asn -> asn1_node_st Signed-off-by: Leonardo Bras <leobras.c@gmail.com>
* cert auth: filter out unsupported cert types from TLS 1.2 CRDaiki Ueno2021-05-171-6/+70
| | | | | | | | When the server is advertising signature algorithms in TLS 1.2 CertificateRequest, it shouldn't send certificate_types not backed by any of those algorithms. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* spelling: The possessive pronoun "its" has no apostrophe.Daniel Kahn Gillmor2021-05-051-1/+1
| | | | | | | | "it's" is for contractions like "it is" or "it has". "its" is a possessive pronoun, like "his" or "hers" or "theirs", none of which have an apostrophe in them either. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* build: remove dead assignmentsDaiki Ueno2020-09-182-4/+2
| | | | Signed-off-by: Daiki Ueno <ueno@gnu.org>
* doc: assorted typo fixestmp-typo-fixesDaiki Ueno2020-08-121-1/+1
| | | | | | Spotted by codespell. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* dh-primes: make the FIPS approved check return Q valueDaiki Ueno2020-07-181-1/+1
| | | | | | | This is necessary for full public key validation in SP800-56A (revision 3), section 5.6.2.3.1. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* dhe: check if DH params in SKE match the FIPS approved algorithmstmp-sp800-56ar3Daiki Ueno2020-06-271-0/+8
| | | | | | | | SP800-56A rev. 3 restricts the FIPS compliant clients to use only approved DH parameters, defined in RFC 7919 and RFC 3526. This adds a check in the handling of ServerKeyExchange if DHE is negotiated. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* build: write "FILE *fp" instead of "FILE *fd"tmp-fileioDaiki Ueno2020-05-302-17/+17
| | | | | | | This makes it clear that "fd" is not a file descriptor but a FILE pointer. Suggested by Tim Rühsen. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* lib: avoid file descriptor leak when application forksDaiki Ueno2020-05-302-3/+3
| | | | | | | | | | | This makes use of the "e" flag of fopen, provided by the Gnulib's fopen-gnu module. Reported by Remi Denis-Courmont in: https://gitlab.com/gnutls/gnutls/-/issues/985 and fix suggested by Tim Rühsen. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* Ensure that an incorrectly formatted password file doesn't cause invalid ↵Nikos Mavrogiannopoulos2020-03-231-1/+2
| | | | | | memory access Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
* psk: Allow non-NULL PSK usernamesAnder Juaristi2020-03-236-35/+79
| | | | | | | | | | | | | | | | | | | | | | | This commit closes #586. Two new functions are introduced: gnutls_psk_server_get_username2() and gnutls_psk_set_client_username2(), which are identical in behavior to those named similarly (without the final '2'), but allow arbitrary gnutls datums (not strings) to be used as usernames. Two new callback functions are also introduced, with their respective setters: gnutls_psk_set_server_credentials_function2() and gnutls_psk_set_client_credentials_function2(). In addition, the password file format is extended so that non-string usernames can be specified. A leading '#' character tells GnuTLS that the username should be interpreted as a raw byte string (encoded in HEX). Example: #deadbeef:9e32cf7786321a828ef7668f09fb35db Signed-off-by: Ander Juaristi's avatarAnder Juaristi <a@juaristi.eus>
* algorithms: implement X448 key exchange and Ed448 signature schemeDaiki Ueno2020-01-231-6/+11
| | | | Signed-off-by: Daiki Ueno <dueno@redhat.com>
* SignatureAlgorithms: force-enable GOST signatures for GOST KXDmitry Eremin-Solenikov2019-12-281-1/+1
| | | | | | | | SChannel-based clients can not send GOST identifiers as a part of SignatureAlgorithms extension. To mitigate this forcefully enable GOST signature algorithms if client sends GOST ciphersuite. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* Support GOST certificate request valuesDmitry Eremin-Solenikov2019-12-181-8/+27
| | | | Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* Add support for VKO GOST key exchangeDmitry Eremin-Solenikov2019-11-082-1/+324
| | | | Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* lib/auth/srp_passwd.c: Fix NULL dereference in _gnutls_srp_pwd_read_entry()Tim Rühsen2019-10-131-2/+4
| | | | | | Fixes Coverity issue 1454652 Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* Remove malloc from gnutls_srp_set_server_fake_salt_seed()tmp-datum-cleanupNikos Mavrogiannopoulos2019-05-282-3/+7
| | | | Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
* Pass down Q for FFDHE in al pre TLS1.3 as wellSimo Sorce2019-05-231-2/+16
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* server auth: disable TLS 1.3 if no signature algorithm is usableDaiki Ueno2019-05-201-0/+4
| | | | | | | | | | This is a server side counterpart of 005a4d04145707daad9588acedfdb5f6cd97c80c. Instead of signalling an error when no algorithm is usable in TLS 1.3, it downgrades the session to TLS 1.2 with a warning. Signed-off-by: Daiki Ueno <dueno@redhat.com>
* _gnutls_srp_entry_free: follow consistent behavior in freeing datatmp-fix-srpNikos Mavrogiannopoulos2019-05-101-4/+8
| | | | | | | | | | | | | | _gnutls_srp_entry_free would previously not free any parameters that were known to gnutls to account for documented behavior of gnutls_srp_set_server_credentials_function(). This was not updated when the newly added 8192 parameter was added to the library. This introduces a safety check for generator parameters, even though in practice they are the same pointer. Resolves: #761 Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
* Add or clean header guards in lib/auth/Tim Rühsen2019-05-079-18/+34
| | | | Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* Use https:// for www.gnu.org and www.example.comTim Rühsen2019-03-1324-24/+24
| | | | Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* Merge branch 'tmp-reset-after-free' into 'master'Tim Rühsen2019-02-233-6/+2
|\ | | | | | | | | Automatically NULLify after gnutls_free() See merge request gnutls/gnutls!923
| * Remove redundant resets of variables after free()Tim Rühsen2019-02-223-6/+2
| | | | | | | | Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* | Cleanup lib/auth/cert.c as suggested by cppchecktmp-cleanup-certTim Rühsen2019-02-131-26/+12
|/ | | | Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* _gnutls_gen_rawpk_crt: corrected the use of asserttmp-key-usageNikos Mavrogiannopoulos2019-02-061-9/+10
| | | | | | | The API could return 0 or 1 matching certificates. The case of zero can only happen in client side. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* raw public keys: apply the key usage bits the same way as X.509Nikos Mavrogiannopoulos2019-02-061-6/+14
| | | | | | | That is, we require a signing certificate when negotiating TLS1.3, or when sending a client certificate (on all cases). Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* Fallback to TLS 1.2 when incompatible with signature certs are providedNikos Mavrogiannopoulos2019-02-061-1/+2
| | | | | | | | | | This only takes into account certificates in the credentials structure. If certificates are provided in a callback, these must be checked by the provider. For that we assume that the credentials structure is filled when associated with a session; if not then the fallback mechanism will not work and the handshake will fail. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* Enforce the certificate key usage restrictions on all casesNikos Mavrogiannopoulos2019-02-062-6/+33
| | | | | | | | | | | | | | | That is, we require a signing certificate when negotiating TLS1.3, or when sending a client certificate (on all cases). Before we would not perform any checks under TLS1.3 or when client certificates are sent, assuming that the certificates used will always be signing ones. However if the user sets up incorrectly a decryption certificate we would use it for signing. This fix makes sure that an error is returned early when these scenarios are detected. Resolves: #690 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* Fix typos in lib/tmp-fix-typos-in-libTim Rühsen2019-01-042-4/+4
| | | | Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* Implemented support for raw public-key functionality (RFC7250).Tom Vrancken2018-12-153-66/+261
| | | | Signed-off-by: Tom Vrancken <dev@tomvrancken.nl>
* Constant time/cache PKCS#1 RSA decryptiontmp-fix-CVE-2018-16868Simo Sorce2018-11-301-55/+54
| | | | | | | | | | | This patch tries to make the code have the same time and memory access aptterns across all branches of the decryption function so that timining or cache side channels are minimized or neutralized. To do so it uses a new nettle rsa decryption function that is side-channel silent. Signed-off-by: Simo Sorce <simo@redhat.com>
* Renamed _gnutls_server_select_cert() to _gnutls_select_server_cert() for ↵Tom Vrancken2018-10-182-3/+3
| | | | | | consistency reasons with its client couterpart. Signed-off-by: Tom Vrancken <dev@tomvrancken.nl>
* Renamed _gnutls_auth_info_set() to _gnutls_auth_info_init().Tom Vrancken2018-10-189-18/+18
| | | | Signed-off-by: Tom Vrancken <dev@tomvrancken.nl>
* Renamed _gnutls_proc_x509_server_crt to _gnutls_proc_x509_crt.Tom Vrancken2018-10-181-2/+2
| | | | Signed-off-by: Tom Vrancken <dev@tomvrancken.nl>