summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* psk: Add basic support for RFC 9258 external PSK importer interfaceDaiki Ueno2023-05-0412-85/+533
| | | | | | | | | | | | | | | | | | | | | | | | 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-24460-72311/+67567
| | | | Signed-off-by: Daiki Ueno <ueno@gnu.org>
* gnutls.h.in: stop indenting doc-comments for typedefsDaiki Ueno2023-04-241-81/+81
| | | | Signed-off-by: Daiki Ueno <ueno@gnu.org>
* build: use /* clang-format {on|off} */ annotationDaiki Ueno2023-04-2416-70/+8
| | | | Signed-off-by: Daiki Ueno <ueno@gnu.org>
* hello_ext: minor cleanup of extension shuffling codeDaiki Ueno2023-04-204-38/+46
| | | | | | | | | | This reduces the number of calls to gnutls_rnd(GNUTLS_RND_RANDOM) based on the assumption that extension indices fit in uint8_t. This also renames the priority string modifier from %NO_EXTS_SHUFFLE to %NO_SHUFFLE_EXTENSIONS. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* Merge branch 'pbkdf' into 'master'Daiki Ueno2023-04-011-0/+10
|\ | | | | | | | | fips: add additional pbkdf limit checks as defined in SP 800-132 See merge request gnutls/gnutls!1736
| * fips: add additional pbkdf limit checks as defined in SP 800-132Tobias Heider2023-03-301-0/+10
| | | | | | | | Signed-off-by: Tobias Heider <tobias.heider@canonical.com>
* | hello_ext: add ClientHello extension permutation@Ajit2023-04-014-1/+57
|/ | | | | | | | | This adds a mechanism to randomize the order of TLS extensions in the ClientHello to make fingerprinting harder. The mechanism is enabled by default and a new priority keyword %NO_EXTS_SHUFFLE has been added to turn it off. Signed-off-by: peonix <ajeetsinghchahar2@gmail.com>
* Merge branch 'wip/dueno/psk-username' into 'master'Daiki Ueno2023-03-304-14/+5
|\ | | | | | | | | src: print_info: prefer gnutls_psk_server_get_username2 See merge request gnutls/gnutls!1730
| * psk: guard against the case where psk_auth_info_t has NULL usernameDaiki Ueno2023-03-214-14/+5
| | | | | | | | | | | | | | This happens when gnutls_psk_server_get_username is called from a client. Also simplify the embedded NUL-byte check with memchr. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* | changes to keep backward compatibilitypeonix2023-03-282-0/+6
| | | | | | | | Signed-off-by: peonix <ajeetsinghchahar2@gmail.com>
* | Updated desc for @GNUTLS_NO_DEFAULT_EXTENSIONSpeonix2023-03-281-1/+1
| | | | | | | | Signed-off-by: peonix <ajeetsinghchahar2@gmail.com>
* | Modifier GNUTLS_NO_EXTENSIONS renamed to GNUTLS_NO_DEFAULT_EXTENSIONSpeonix2023-03-283-7/+7
| | | | | | | | Signed-off-by: peonix <ajeetsinghchahar2@gmail.com>
* | fix incorrect parameter description of crl import functionxuraoqing2023-03-221-4/+4
|/ | | | Signed-off-by: xuraoqing <xuraoqing@huawei.com>
* pkcs11: respect Mozilla's time-based distrust upon issuer lookupDaiki Ueno2023-03-175-2/+206
| | | | | | | | | This implements the basic logic needed to support time-based distrust of CA, according to [1]. 1. https://wiki.mozilla.org/CA/Additional_Trust_Changes#Distrust_After Signed-off-by: Daiki Ueno <ueno@gnu.org>
* ktls: Do not return GNUTLS_E_INTERRUPTED/AGAIN from short writesRichard W.M. Jones2023-03-101-2/+10
| | | | | | | | | | | | | | | | | | If sendmsg returns a short write, we end up going around the loop with data_to_send being smaller. However if sendmsg then returns -EAGAIN or -EINTR then we return an error. But we have "forgotten" that we already sent some data. This causes the caller to retry gnutls_record_send with the full buffer (ie. with a buffer that has already been partially sent), causing desynchronization. Instead check if we sent some data in this case and return the number of bytes sent. Fixes: https://gitlab.com/gnutls/gnutls/-/issues/1470 Thanks: Dan Berrange for suggesting a fix Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
* Merge branch 'wip/dueno/ems' into 'master'Daiki Ueno2023-03-094-8/+39
|\ | | | | | | | | | | | | priority: add %FORCE_SESSION_HASH modifier Closes #1445 See merge request gnutls/gnutls!1711
| * fips: enable %FORCE_SESSION_HASH by default under FIPS modeDaiki Ueno2023-03-091-0/+4
| | | | | | | | Signed-off-by: Daiki Ueno <ueno@gnu.org>
| * priority: add %FORCE_SESSION_HASH modifierDaiki Ueno2023-03-094-8/+35
| | | | | | | | | | | | | | | | This adds a new priority string modifier %FORCE_SESSION_HASH, which requires to negotiate extended master secret and aborts the connection if the peer does not send the extension in hello messages. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* | pk: extend pair-wise consistency to cover DH key generationPedro Monreal2023-02-271-0/+29
| | | | | | | | | | | | | | | | | | Perform SP800 56A (rev 3) 5.6.2.1.4 Owner Assurance of Pair-wise Consistency check, even if we only support ephemeral DH, as it is required by FIPS 140-3 IG 10.3.A. Signed-off-by: Pedro Monreal <pmgdeb@gmail.com> Co-authored-by: Daiki Ueno <ueno@gnu.org>
* | ecdh: perform SP800-56A rev3 full pubkey validation on key derivationPedro Monreal2023-02-241-3/+125
|/ | | | | | | | This implements full public key validation required in SP800-56A rev3, section 5.6.2.3.3. Co-authored-by: Daiki Ueno <ueno@gnu.org> Signed-off-by: Pedro Monreal <pmgdeb@gmail.com>
* 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>
* remove inoperative variablexuraoqing2023-02-071-2/+0
| | | | Signed-off-by: xuraoqing <609179072@qq.com>
* Indent cpp headerZoltan Fridrich2023-01-301-907/+746
| | | | Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* gnutlsxx: add source file for shared libraryNikolaos Chatzikonstantinou2023-01-302-2/+28
| | | | | | | The compiler will not produce a shared library from a header, so a source file is necessary when producing the gnutlsxx shared library. Signed-off-by: Nikolaos Chatzikonstantinou <nchatz314@gmail.com>
* gnutlsxx: become header-only libraryNikolaos Chatzikonstantinou2023-01-303-931/+918
| | | | | | | | | | | | | | | | | | | This patch removes the old gnutlsxx library and instead moves all the definitions of the source file `gnutlsxx.c` to the header file `gnutlsxx.h`. However, both the C and the C++ library are built. (as before.) The user of the C++ interface has two options to choose from: 1. include `gnutlsxx.h` in their application and link against the C library. (the default.) 2. include `gnutlsxx.h` in their application, compile with the GNUTLS_GNUTLSXX_NO_HEADERONLY macro defined and link against the C++ library. Addresses Ref #1381 Signed-off-by: Nikolaos Chatzikonstantinou <nchatz314@gmail.com>
* Indent codeZoltan Fridrich2023-01-27457-39364/+53302
| | | | | Co-authored-by: Simon Josefsson <simon@josefsson.org> Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* Fix indent errorsZoltan Fridrich2023-01-274-56/+68
| | | | | Co-authored-by: Simon Josefsson <simon@josefsson.org> Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* trust: make filesystem path construction flexibleDaiki Ueno2023-01-117-63/+314
| | | | | | | | | | To handle pathnames longer than the fixed length (previously 256), this adds a set of internal API functions around the gnutls_pathbuf_st struct, which enables to safely and efficiently construct pathnames. The new API initially uses the statically allocated buffer and starts allocating memory on heap only after the limit has reached. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* Merge branch 'zfridric_devel2' into 'master'Zoltán Fridrich2023-01-104-8/+53
|\ | | | | | | | | | | | | Forbid uncolicited CompressedCertificate messages Closes #1440 See merge request gnutls/gnutls!1678
| * Fix error codes for unsolicited compressed certificateZoltan Fridrich2023-01-101-1/+5
| | | | | | | | Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
| * Forbid unsolicited CompressedCertificate messageZoltan Fridrich2023-01-033-1/+4
| | | | | | | | Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
| * Fail when received cert is compressed with disabled methodZoltan Fridrich2023-01-033-3/+34
| | | | | | | | Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
| * Slight reformating of compress_certificate codeZoltan Fridrich2023-01-032-5/+12
| | | | | | | | Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* | Merge branch 'wip/dueno/srtp' into 'master'Daiki Ueno2023-01-062-13/+31
|\ \ | | | | | | | | | | | | | | | | | | srtp: support AES-GCM profiles Closes #1266 See merge request gnutls/gnutls!1685
| * | srtp: support AES-GCM profilesDaiki Ueno2022-12-242-13/+31
| | | | | | | | | | | | | | | | | | | | | This adds support for SRTP_AEAD_AES_128_GCM and SRTP_AEAD_AES_256_GCM profiles defined in RFC 7714. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* | | Merge branch 'wip/dueno/max-record-send-size' into 'master'Daiki Ueno2023-01-064-12/+9
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | build: remove MAX_RECORD_SEND_SIZE in favor of max_record_send_size Closes #815 See merge request gnutls/gnutls!1684
| * | build: remove MAX_RECORD_SEND_SIZE in favor of max_record_send_sizeDaiki Ueno2022-12-244-12/+9
| |/ | | | | | | Signed-off-by: Daiki Ueno <ueno@gnu.org>
* | Merge branch 'https' into 'master'Daiki Ueno2022-12-2734-52/+34
|\ \ | | | | | | | | | | | | Prefer HTTPS to HTTP in URLs See merge request gnutls/gnutls!1687
| * | Replace FSF snail mail addresses with URLStefan Kangas2022-12-2712-30/+12
| | | | | | | | | | | | | | | | | | | | | 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-2722-22/+22
| |/ | | | | | | | | | | | | This mostly updates NEWS and license links. All links have been manually tested and confirmed working. Signed-off-by: Stefan Kangas <stefankangas@gmail.com>
* | Fix typosStefan Kangas2022-12-272-3/+3
|/ | | | Signed-off-by: Stefan Kangas <stefankangas@gmail.com>
* record: enable check on CCS content also in TLS 1.2Daiki Ueno2022-12-211-8/+25
| | | | | | | | | This generilizes the value check of Change Cipher Spec for all TLS protocol versions including TLS 1.2 or earlier. It also fixes the logic of the check so the value is decrypted before being examined, according to the RFC. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* Merge branch 'master' into 'master'Daiki Ueno2022-12-203-9/+13
|\ | | | | | | | | 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>
| * fix log print server write mac key size errorxuraoqing2022-12-121-1/+1
| | | | | | | | Signed-off-by: xuraoqing <xuraoqing@huawei.com>
| * fix log print client write mac key size errorxuraoqing2022-12-121-1/+1
| | | | | | | | Signed-off-by: xuraoqing <xuraoqing@huawei.com>
| * fix get credential type with key exchange algorithm failxuraoqing2022-12-121-4/+4
| | | | | | | | Signed-off-by: xuraoqing <xuraoqing@huawei.com>
* | cert-auth: alloc_and_load_x509_certs: check requested cert countDaiki Ueno2022-12-181-1/+7
| | | | | | | | | | | | | | | | ... instead of pointer. Otherwise GCC analyzer treats it as -Wanalyzer-null-dereference in the caller side. While that shouldn't happen, it would be nice to make the code handle it robustly. Signed-off-by: Daiki Ueno <ueno@gnu.org>