summaryrefslogtreecommitdiff
path: root/lib/includes
Commit message (Collapse)AuthorAgeFilesLines
* psk: Add basic support for RFC 9258 external PSK importer interfaceDaiki Ueno2023-05-041-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | 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-2418-4242/+3861
| | | | 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>
* 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-281-3/+3
| | | | Signed-off-by: peonix <ajeetsinghchahar2@gmail.com>
* Indent cpp headerZoltan Fridrich2023-01-301-907/+746
| | | | Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* gnutlsxx: become header-only libraryNikolaos Chatzikonstantinou2023-01-301-1/+916
| | | | | | | | | | | | | | | | | | | 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-2718-2326/+2225
| | | | | Co-authored-by: Simon Josefsson <simon@josefsson.org> Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* Fix indent errorsZoltan Fridrich2023-01-271-0/+2
| | | | | Co-authored-by: Simon Josefsson <simon@josefsson.org> Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* srtp: support AES-GCM profilesDaiki Ueno2022-12-241-1/+5
| | | | | | | 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>
* includes: move KTLS function definition out of <gnutls/socket.h>Daiki Ueno2022-11-282-21/+21
| | | | | | | | | | <gnutls/socket.h> is meant for the functions that depend on <sys/socket.h>, which is not available on Windows platforms. As the KTLS API doesn't rely on <sys/socket.h>, move the function and enum to <gnutls/gnutls.h>. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* Add GNUTLS_NO_STATUS_REQUEST flag and NO_STATUS_REQUEST priority string modifierZoltan Fridrich2022-10-181-1/+4
| | | | Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* Update doc for GNUTLS_CB_TLS_EXPORTER towards RFC9266.Simon Josefsson2022-07-301-1/+1
| | | | Signed-off-by: Simon Josefsson <simon@josefsson.org>
* crypto-api: add block cipher API with automatic paddingDaiki Ueno2022-07-221-0/+22
| | | | | | | | This adds a couple of functions gnutls_cipher_encrypt3 and gnutls_cipher_decrypt3, which add or remove padding as necessary if the length of the plaintext is not a multiple of the block size. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* fips: provide function to manually run FIPS self-testsDaiki Ueno2022-06-091-0/+2
| | | | | | | | | | | | | | | | | FIPS140-3 IG 10.3.E Periodic Self-Testing says: At security levels 1 and 2, acceptable means for initiating the periodic self-tests include a provided service, resetting, rebooting or power cycling. Neither resetting, rebooting, nor power-cycling is suitable because those involve operations outside of the module. Therefore this patch adds a new API to manually run the substance of FIPS140 self-tests. Suggeested by Richard Costa and Stephan Mueller in: https://gitlab.com/gnutls/gnutls/-/issues/1364 Signed-off-by: Daiki Ueno <ueno@gnu.org>
* gnutls_aead_cipher_set_key: new functionDaiki Ueno2022-05-051-0/+4
| | | | | | | This adds gnutls_aead_cipher_set_key, which enables to reuse the same handle but reset the context and key, without releasing the memory. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* tls: add flag to disable session ticket in TLS 1.2Daiki Ueno2022-05-041-1/+3
| | | | | | | | | | | | | | The existing GNUTLS_NO_TICKETS flag affects all versions of TLS, where PFS is assured in TLS 1.3, while it is not in TLS 1.2. This adds a new flag GNUTLS_NO_TICKETS_TLS12 to allow applications to disable session tickets only in TLS 1.2. As the only means of resumption in TLS 1.3 is using session tickets, we could repurpose the GNUTLS_NO_TICKETS flag make it no-op in TLS 1.3. However it would break backward compatibility, so we defer it to the next major release. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* Fix for #1132Brian Wickman2022-04-211-1/+3
|
* Merge branch 'config' into 'master'František Krenželok2022-04-131-0/+1
|\ | | | | | | | | system config disable KTLS See merge request gnutls/gnutls!1559
| * system config disable KTLSFrantisek Krenzelok2022-03-291-0/+1
| | | | | | | | | | | | | | Added option for system config `ktls = false` to disable ktls system-wide Signed-off-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
* | Add missing gtk-doc for GNUTLS_COMP_BROTLI/ZSTD.Andreas Metzler2022-04-121-0/+2
|/ | | | Signed-off-by: Andreas Metzler <ametzler@bebt.de>
* Add compress_certificate extension (RFC8879)Zoltan Fridrich2022-03-011-1/+12
| | | | Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
* Merge branch 'ktls_sendfile' into 'master'Daiki Ueno2022-02-241-0/+2
|\ | | | | | | | | ktls: sendfile See merge request gnutls/gnutls!1486
| * ktls: sendfileFrantisek Krenzelok2022-02-221-0/+2
| | | | | | | | | | | | | | | | | | | | added API function: gnutls_record_send_file(). added: _gnutls_ktls_send_file() function which increases the performance by offloading the file encryption to kernel, thus the data never goes to userspace. updated tests/gnutls_ktls to cover new API Signed-off-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
* | Merge branch 'bump-max-algorithm' into 'master'Daiki Ueno2022-02-211-1/+1
|\ \ | | | | | | | | | | | | bump GNUTLS_MAX_ALGORITHM_NUM / MAX_ALGOS See merge request gnutls/gnutls!1538
| * | bump GNUTLS_MAX_ALGORITHM_NUM / MAX_ALGOSAlexander Sosedkin2022-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fedora 36 LEGACY crypto-policy uses allowlisting format and is long enough to blow past the 64 priority string elements mark, causing, effectively, priority string truncation. Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
* | | Fix typosDimitris Apostolou2022-02-171-1/+1
| |/ |/| | | | | Signed-off-by: Dimitris Apostolou <dimitris.apostolou@icloud.com>
* | gnutls_ciphersuite_get: new function to get unique ciphersuite nameDaiki Ueno2022-02-101-0/+3
|/ | | | | | | | | | | | | | | | | | The existing method to obtain the name of the currently negotiated TLS ciphersuite is as follows: - call gnutls_cipher_get, gnutls_mac_get, gnutls_kx_get - call gnutls_cipher_suite_get_name with the value from the above functions This process is cumbersome and only works with TLS 1.2 or earlier; moreover the returned names are GnuTLS specific. This change adds a new function gnutls_ciphersuite_get to eliminate those limitations. It returns the "canonical" name of the ciphersuite, which is mostly identical to the ones registered in IANA, with an exception for compatibility. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* global: add API to retrieve library configuration at run timeDaiki Ueno2022-01-161-0/+7
| | | | Signed-off-by: Daiki Ueno <ueno@gnu.org>
* fips: add functions to inspect thread-local FIPS operation stateDaiki Ueno2022-01-071-0/+39
| | | | Signed-off-by: Daiki Ueno <ueno@gnu.org>
* ktls: flagsFrantisek Krenzelok2021-12-161-2/+20
| | | | | | ktls enum flags API Signed-off-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
* KTLS: APIFrantisek Krenzelok2021-12-151-0/+2
| | | | | | | ktls is enabled by default, we can check if inicialization was succesfull with gnutls_transport_is_ktls_enabled Signed-off-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
* x509 CT: implement new public APIAnder Juaristi2021-12-042-0/+17
| | | | | | | | | | | | | | | | | | | | This commit implements import and export functions for the X.509 Certificate Transparency Signed Certificate Timestamp (SCT) extension (RFC 6962). A new constant GNUTLS_X509EXT_OID_CT_SCT is introduced with the value "1.3.6.1.4.1.11129.2.4.2". The following new public API functions are introduced: - gnutls_x509_ext_ct_scts_init - gnutls_x509_ext_ct_scts_deinit - gnutls_x509_ext_ct_import_scts - gnutls_x509_ext_ct_export_scts - gnutls_x509_ct_sct_get_version - gnutls_x509_ct_sct_get Signed-off-by: Ander Juaristi <a@juaristi.eus>
* priority: support allowlisting in configuration fileDaiki Ueno2021-11-291-0/+11
| | | | | | | | | | | | This adds a new mode of interpreting the [overrides] section. If "override-mode" is set to "allowlisting" in the [global] section, all the algorithms (hashes, signature algorithms, curves, and versions) are initially marked as insecure/disabled. Then the user can enable them by specifying allowlisting keywords such as "secure-hash" in the [overrides] section. Signed-off-by: Daiki Ueno <ueno@gnu.org> Co-authored-by: Alexander Sosedkin <asosedkin@redhat.com>
* pk: add flags to force RSA-PSS salt length to match digest lengthDaiki Ueno2021-08-072-2/+10
| | | | | | | | | This adds a couple of flags to RSA-PSS signing and verification, to enforce that the salt length matches the digest length. That is not only recommended in RFC 4055, but also mandated in RFC 8446 in the TLS 1.3 context. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* gnutls_early_{cipher,prf_hash}_get: new functionsDaiki Ueno2021-05-131-1/+4
| | | | Signed-off-by: Daiki Ueno <ueno@gnu.org>
* gnutls_init: add flag to omit EndOfEarlyData messagesDaiki Ueno2021-05-131-1/+3
| | | | | | | The message is prohibited in QUIC: https://tools.ietf.org/html/draft-ietf-quic-tls-34#section-8.3 Signed-off-by: Daiki Ueno <ueno@gnu.org>
* gnutls_init: redefine GNUTLS_ENABLE_EARLY_DATA flag for clientDaiki Ueno2021-05-131-3/+3
| | | | | | | | The flag was only for the server, but it turned out to be useful for client to explicitly indicate early data, when 0-RTT is handled out-of-band as in QUIC. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* Introduce new tls channel binding types into gnutls_channel_binding_tRuslan N. Marchenko2021-05-011-2/+6
| | | | | | | | | This commit adds two new tls channel binding types into enum gnutls_channel_binding_t: * tls-server-end-point * tls-exporter Signed-off-by: Ruslan N. Marchenko <me@ruff.mobi>
* Changed certificate retrieval callback prototype parameter name to be in ↵Tom Vrancken2021-02-281-1/+1
| | | | | | line with the other parameters. Signed-off-by: Tom Vrancken <dev@tomvrancken.nl>
* gnutlsxx: add const and explicit specifiers where possibleDaiki Ueno2021-02-171-7/+7
| | | | | | Flagged by cppcheck. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* Merge branch 'wip/dueno/aia-api' into 'master'Daiki Ueno2020-11-211-2/+4
|\ | | | | | | | | | | | | x509: check certificate trust status when adding CA through AIA Closes #1100 See merge request gnutls/gnutls!1354
| * x509: rework issuer callbackDaiki Ueno2020-11-191-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous issuer callback API had a drawback: the callback is supposed to add CA to the trust list by itself. This was error-prone, because the callback must check the new CA is trusted by the already added CA. This instead moves the responsibility to the library. This also rewrites the chain amendment logic in a side-effect free manner. The application can assume that the trust information stored on gnutls_x509_trust_list_t shouldn't change after the verification. The missingissuer test has been extended to cover all the possible patterns exhaustively. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* | alert: add callback to intercept alert messagesDaiki Ueno2020-11-191-0/+22
| | | | | | | | | | | | | | This adds gnutls_alert_set_read_function(), to allow QUIC implementations to be notified when an alert message is sent. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* | handshake: add callback to get notified with traffic secret changeDaiki Ueno2020-11-191-0/+24
| | | | | | | | | | | | | | | | For the use with QUIC, the change of traffic secrets must be notified _after_ a new epoch is set up for reading or writing, and we can't simply reuse the keylog mechanism. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* | handshake: add functions to read/write handshake messages directlyDaiki Ueno2020-11-191-0/+49
| | | | | | | | | | | | | | | | This adds a couple of functions, gnutls_handshake_set_read_function() and gnutls_handshake_write(), to allow QUIC implementations to directly interact with the TLS state machine. Signed-off-by: Daiki Ueno <ueno@gnu.org>
* | pkcs11: increase the maximum PIN length from 31 to 255Daiki Ueno2020-11-131-1/+1
|/ | | | | | | The maximum is chosen from the default configuration of SoftHSMv2: https://github.com/opendnssec/SoftHSMv2/blob/develop/CMakeLists.txt#L61 Signed-off-by: Daiki Ueno <ueno@gnu.org>
* Adds a new API gnutls_session_set_verify_output_function() that allows TLS ↵Sahana Prasad2020-11-101-2/+6
| | | | | | | | | applications to have a way to pass the gnutls_verify_output_function() as a callback so that the full path of the certificate chain to the trusted root can be avaiable as output. Signed-off-by: Sahana Prasad <sahana@redhat.com>
* fips: add self-tests for TLS-PRFDaiki Ueno2020-10-081-0/+1
| | | | | | | | | FIPS140-2 IG D.8 mandates self-tests on approved KDF algorithms. As the guidance only requires to run a single instance of each KDF mechanism, this only exercises TLS1.2 PRF with HMAC-SHA-256 as the underlying MAC algorithm. Signed-off-by: Daiki Ueno <ueno@gnu.org>