summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'tmp-ext-name' into 'master'Daiki Ueno2020-04-244-0/+35
|\ | | | | | | | | gnutls_session_ext_register: keep track of extension name See merge request gnutls/gnutls!1224
| * gnutls_session_ext_register: keep track of extension nametmp-ext-nameDaiki Ueno2020-04-212-0/+3
| | | | | | | | | | | | | | | | | | | | | | Previously it discarded the name argument, and that was making the debug output awkward, e.g., running tests/tls-session-ext-register -v: client|<4>| EXT[0x9cdc20]: Preparing extension ((null)/242) for 'client hello' client|<4>| EXT[0x9cdc20]: Preparing extension ((null)/241) for 'client hello' client|<4>| EXT[0x9cdc20]: Sending extension (null)/241 (2 bytes) Signed-off-by: Daiki Ueno <dueno@redhat.com>
| * gnutls_ext_get_name2: new functionDaiki Ueno2020-04-213-0/+32
| | | | | | | | | | | | | | | | This adds a generalized version of gnutls_ext_get_name, which can retrieve the name of the extension, even if it is registered per session. Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | fips: check library soname during configuretmp-check-sonameDaiki Ueno2020-04-241-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | Previously, we hard-coded the sonames of linked libraries for FIPS integrity checking. That required downstream packagers to manually adjust the relevant code in lib/fips.c, when a new interface version of the dependent libraries (nettle, gmp) becomes available and linked to libgnutls. This patch automates that process with the configure script. Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | gost: update gostdsa_vko to follow NettleDmitry Baryshkov2020-04-213-29/+53
|/ | | | | | Update gostdsa_vko() following changes going to be accepted into Nettle. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* Merge branch 'tmp-no-auto-send-ticket' into 'master'Daiki Ueno2020-04-202-4/+9
|\ | | | | | | | | handshake-tls13: add session flag to disable sending session tickets See merge request gnutls/gnutls!1234
| * handshake-tls13: add session flag to disable sending session ticketstmp-no-auto-send-ticketDaiki Ueno2020-04-132-4/+9
| | | | | | | | | | | | | | | | | | While GnuTLS by default implicitly sends NewSessionTicket during handshake, application protocols like QUIC set a clear boundary between "in handshake" and "post handshake", and NST must be sent in the post handshake state. Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | Merge branch 'tmp-xts-ig-a9' into 'master'Daiki Ueno2020-04-191-4/+48
|\ \ | | | | | | | | | | | | xts: check key block according to FIPS-140-2 IG A.9 See merge request gnutls/gnutls!1233
| * | xts: check key blocks according to FIPS-140-2 IG A.9tmp-xts-ig-a9Daiki Ueno2020-04-141-4/+48
| | | | | | | | | | | | | | | | | | | | | | | | The implementation guidance suggests that a check of key1 != key2 should be done at any place before the keys are used: https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Module-Validation-Program/documents/fips140-2/FIPS1402IG.pdf Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | | nettle: vendor in poly1305 codeDmitry Baryshkov2020-04-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Nettle's poly1305 code ended up with internal symbol _poly1305_block in public header. This causes issues on Nettle version changes. Since those symbols are going to become nettle-internal, vendor in relevant source file. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* | | gost: import _nettle_write_le32 to stop using Nettle's internal symbolDmitry Baryshkov2020-04-143-1/+73
| | | | | | | | | | | | | | | | | | | | | Remove another dependency on nettle internal symbol by vendoring in _nettle_write_le32 code Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* | | nettle: use new imported source files for GOST DSADmitry Baryshkov2020-04-1423-4993/+297
| | | | | | | | | | | | | | | | | | | | | Provide GOST support using source files copied by script rather than manually crafted by me. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* | | build: import-curve448 -> import-eccDmitry Baryshkov2020-04-142-36/+36
| | | | | | | | | | | | | | | | | | | | | As the script now imports not just Curve448, but also gost code, rename the script, target directory and symbols to follow that. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* | | curve448: import write-le64.c which defines internal symbolDmitry Baryshkov2020-04-131-0/+1
|/ / | | | | | | Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* | Merge branch 'tmp-valgrind-memcheck' into 'master'Nikos Mavrogiannopoulos2020-04-052-3/+33
|\ \ | | | | | | | | | | | | build: use valgrind client request to detect undefined memory use See merge request gnutls/gnutls!1228
| * | build: use valgrind client request to detect undefined memory usetmp-valgrind-memcheckDaiki Ueno2020-04-042-3/+33
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This tightens the check introduced in ac2f71b892d13a7ab4cc39086eef179042c7e23c, by using the valgrind client request to explicitly mark the "uninitialized but initialization is needed before use" regions. With this patch and the fix (c01011c2d8533dbbbe754e49e256c109cb848d0d) reverted, you will see the following error when running dtls_hello_random_value under valgrind: $ valgrind ./dtls_hello_random_value testing: default ==520145== Conditional jump or move depends on uninitialised value(s) ==520145== at 0x4025F5: hello_callback (dtls_hello_random_value.c:90) ==520145== by 0x488BF97: _gnutls_call_hook_func (handshake.c:1215) ==520145== by 0x488C1AA: _gnutls_send_handshake2 (handshake.c:1332) ==520145== by 0x488FC7E: send_client_hello (handshake.c:2290) ==520145== by 0x48902A1: handshake_client (handshake.c:2908) ==520145== by 0x48902A1: gnutls_handshake (handshake.c:2740) ==520145== by 0x402CB3: client (dtls_hello_random_value.c:153) ==520145== by 0x402CB3: start (dtls_hello_random_value.c:317) ==520145== by 0x402EFE: doit (dtls_hello_random_value.c:331) ==520145== by 0x4023D4: main (utils.c:254) ==520145== Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | Compare DNs by comparing their string representationsPierre Ossman2020-04-032-3/+49
| | | | | | | | | | | | | | | | A binary comparison will not work in case the contents is the same but the ASN.1 type differ (e.g. PrintableString vs UTF8String). Such variations are permitted so we need to handle them. Signed-off-by: Pierre Ossman <ossman@cendio.se>
* | Properly compare DNs when checking sortingPierre Ossman2020-04-031-11/+2
| | | | | | | | | | | | | | We might want to do other things than a simple memcmp() so make sure we're using the right helper when comparing DNs. Signed-off-by: Pierre Ossman <ossman@cendio.se>
* | IDNA: require libidn2 2.0.0Nikos Mavrogiannopoulos2020-03-312-83/+1
|/ | | | | | | | | | | We require private symbols which dissapear at some point in IDN2 releases in order to support old versions of libidn2. Simplify the code by requiring only recent versions and avoid issues such as #832. Resolves: #832 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* Merge branch 'fix-padlock' into 'master'Nikos Mavrogiannopoulos2020-03-302-4/+7
|\ | | | | | | | | | | | | Fix padlock accelerated code Closes #930 See merge request gnutls/gnutls!1226
| * padlock: fix exception in wrap_padlock_hash_fastDmitry Baryshkov2020-03-281-1/+0
| | | | | | | | | | | | | | | | | | | | wrap_padlock_hash_fast() allocates a context on a stack (via local variable) then tries to free it by calling wrap_padlock_hash_deinit() causing a crash. Remove a call to deinit() to fix a crash. Fixes #930 Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
| * padlock: fix exception in sha codeDmitry Baryshkov2020-03-281-0/+2
| | | | | | | | | | | | | | | | padlock sha code will segfault (at least on Nano) if it is passed a NULL data pointer (even if size is 0). Pass digest output buffer as a dummy data pointer in such case. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
| * padlock: make cbc code return error properlyDmitry Baryshkov2020-03-281-3/+5
| | | | | | | | | | | | | | If underlying padlock_cbc_en/decrypt return an error, pass this error to calling code. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* | psk: added checks to satisfy static analyzersNikos Mavrogiannopoulos2020-03-301-0/+6
| | | | | | | | | | | | | | | | Added null checks in legacy callbacks to avoid warnings from static analyzers. The issues do not appear to be reproducible in real-world use. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
* | dtls client hello: fix zeroed random (fixes #960)Stefan Bühler2020-03-271-1/+1
| | | | | | | | | | | | | | This broke with bcf4de03 "handshake: treat reply to HRR as a reply to hello verify request", which failed to "De Morgan" properly. Signed-off-by: Stefan Bühler <stbuehler@web.de>
* | Merge branch 'tmp-get-keylog-func' into 'master'Daiki Ueno2020-03-253-0/+19
|\ \ | | | | | | | | | | | | gnutls_session_get_keylog_function: new function See merge request gnutls/gnutls!1220
| * | gnutls_session_get_keylog_function: new functiontmp-get-keylog-funcDaiki Ueno2020-03-223-0/+19
| |/ | | | | | | | | | | | | | | This adds a way to retrieve the keylog function set by gnutls_session_set_keylog_function() to allow application protocols to implement custom logging facility. Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | Merge branch 'ajuaristi-issue-586' into 'master'Nikos Mavrogiannopoulos2020-03-2417-78/+309
|\ \ | | | | | | | | | | | | | | | | | | support non-NULL-terminated PSKs Closes #586 See merge request gnutls/gnutls!917
| * | _gnutls_check_id_for_change: ensure that we check the username lengthajuaristi-issue-586Nikos Mavrogiannopoulos2020-03-233-5/+8
| | | | | | | | | | | | Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.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-2315-75/+302
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'postpone_config_loading' into 'master'Daiki Ueno2020-03-231-1/+1
|\ \ | |/ |/| | | | | | | | | global: Load configuration after FIPS POST Closes #956 See merge request gnutls/gnutls!1216
| * global: Load configuration after FIPS POSTAnderson Toshiyuki Sasaki2020-03-181-1/+1
| | | | | | | | | | | | | | | | | | Previously, if the loaded configuration file disabled an algorithm tested during FIPS-140 power-on self-tests, the test would fail. By loading the configuration file after the test is finished, such failure is avoided as any algorithm is allowed during the tests. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
* | Merge branch 'eddsa-pkcs11' into 'master'Nikos Mavrogiannopoulos2020-03-205-4/+197
|\ \ | | | | | | | | | | | | | | | | | | Add support for loading Ed25519 keys from PKCS#11 and using them Closes #946 See merge request gnutls/gnutls!1200
| * | Validate EC_PARAMS for EdDSA keysJakub Jelen2020-03-183-4/+123
| | | | | | | | | | | | Signed-off-by: Jakub Jelen <jjelen@redhat.com>
| * | pubkey: Validate input parameters in pubkey_import_ecc_rawJakub Jelen2020-03-181-1/+6
| | | | | | | | | | | | Signed-off-by: Jakub Jelen <jjelen@redhat.com>
| * | pkcs11_write: Copy data to avoid double-free crashes and properly encode ↵Jakub Jelen2020-03-181-3/+12
| | | | | | | | | | | | | | | | | | EC_POINT attribute Signed-off-by: Jakub Jelen <jjelen@redhat.com>
| * | Add support for loading EdDSA keys from PKCS#11 and using themJakub Jelen2020-02-282-0/+60
| | | | | | | | | | | | Signed-off-by: Jakub Jelen <jjelen@redhat.com>
* | | state: add function to get the current hash algorithmtmp-prf-getDaiki Ueno2020-03-193-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | This is particularly useful when the application applies key derivation function by itself with the same underlying hash algorithm as the session. Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | | cipher: allow setting ChaCha20 initial block counterDaiki Ueno2020-03-194-6/+68
| | | | | | | | | | | | | | | | | | | | | This also introduces GNUTLS_CIPHER_CHACHA20_32, which is a 96-bit nonce variant of GNUTLS_CIPHER_CHACHA20_64. Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | | nettle: vendor in ChaCha20 implementation from nettleDaiki Ueno2020-03-191-0/+8
| | | | | | | | | | | | | | | | | | | | | This enables to use bundled ChaCha20 implementation if the system nettle doesn't have nettle_chacha_set_counter. Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | | cipher: expose raw ChaCha20 cipherDaiki Ueno2020-03-193-0/+30
| |/ |/| | | | | Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | Merge branch 'tmp-ed448-fixes' into 'master'Daiki Ueno2020-03-183-3/+37
|\ \ | | | | | | | | | | | | ed448: fix certificate signature verification See merge request gnutls/gnutls!1213
| * | algorithms: properly calculate hash strength for Ed448Daiki Ueno2020-03-163-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Ed448 signature scheme internally uses XOF (SHAKE256) as the hash function with 114-octet output. According to FIPS-202, the strength against collisions is calculated as: min(114*8/2, 256) = 256 Reported by Peter Dettman in: https://gitlab.com/gnutls/gnutls/-/issues/128#note_304892538 Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | | Merge branch 'improve_fips_selftests' into 'master'Nikos Mavrogiannopoulos2020-03-181-309/+377
|\ \ \ | | | | | | | | | | | | | | | | Improve FIPS signatures self-tests See merge request gnutls/gnutls!1206
| * | | crypto-selftests-pk.c: Use deterministic signatures in test_known_sig()Anderson Toshiyuki Sasaki2020-03-161-165/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use deterministic signatures for ECDSA and DSA in test_known_sig(). Do not call test_known_sig() for non-deterministic algorithms. Do not run PK_TEST() for algorithms tested with PK_KNOWN_TEST(). The deterministic algorithms are used if in FIPS-140 POST or if FIPS-140 mode is disabled. When called explicitly with FIPS-140 mode enabled, the pairwise-consistency test (PK_TEST()) is used instead. test_known_sig() was modified to support only deterministic algorithms. The "deterministic" parameter was replaced with the "flags" parameter through which the flags to be used in gnutls_privkey_sign_data() are passed. The hard-coded values for the ECDSA and DSA signatures were replaced with the values corresponding to the deterministic signatures to be used in known answer tests. The unused values for GOST signatures were removed. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
| * | | crypto-selftests-pk.c: Use specified key in test_sig()Anderson Toshiyuki Sasaki2020-03-161-192/+269
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, test_sig() would use the same key regardless the value provided in bits parameter. The changes introduced make test_sig() to choose the key according to the value provided in bits. For RSA, only 2048 bits key is available for testing. The calls were adjusted accordingly. Introduced 2048 bits DSA key in test_sig(). Removed unused 512 bits key, leaving only the 2048 bits key available. For GOST, use the same keys for test_sig() and test_known_sig(). Remove the unused keys. Reorder constant values and change variables names for better readability. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
| * | | crypto-selftests-pk.c: Fix PK_KNOWN_TEST and PK_TESTAnderson Toshiyuki Sasaki2020-03-111-17/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when multiple tests where declared in sequence using one of the macros, only the first test would be executed. This happened because a check for the GNUTLS_SELF_TEST_FLAG_ALL was embedded in the macro. To allow more than one test to be executed in sequence, the check for the flag was removed from both macros. To keep the previous behaviour (execute only the first test) the check for the flag was moved to be after the first test, except for RSA since the RSA encryption test must be executed in FIPS mode. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
| * | | crypto-selftests-pk.c: Move hardcoded values to the topAnderson Toshiyuki Sasaki2020-03-111-112/+112
| | | | | | | | | | | | | | | | Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
* | | | lib/x509: use common routine for parsing data versionDmitry Baryshkov2020-03-126-62/+27
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | OSS Fuzzer noted an issue in parsing (incorrect) CRL files with zero-length version field. Certificate parser does not have this issue, while CRL and OCSP Request and Response parsers shows this problem. To remove code duplication extract common function and use it from all four parsers. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>