summaryrefslogtreecommitdiff
path: root/lib/x509
Commit message (Collapse)AuthorAgeFilesLines
...
* psk: Allow non-NULL PSK usernamesAnder Juaristi2020-03-232-18/+4
| | | | | | | | | | | | | | | | | | | | | | | 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 'tmp-ed448-fixes' into 'master'Daiki Ueno2020-03-181-2/+2
|\ | | | | | | | | ed448: fix certificate signature verification See merge request gnutls/gnutls!1213
| * algorithms: properly calculate hash strength for Ed448Daiki Ueno2020-03-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | 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>
* Merge branch 'fix-crq-ext' into 'master'Dmitry Baryshkov2020-03-111-11/+9
|\ | | | | | | | | x509: drop endless loop in print_extensions See merge request gnutls/gnutls!1205
| * x509: apply same fix to print_crqDmitry Baryshkov2020-03-101-4/+3
| | | | | | | | Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
| * x509: apply same fix to print_crlDmitry Baryshkov2020-03-101-4/+3
| | | | | | | | Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
| * x509: drop endless loop in print_extensionsDmitry Baryshkov2020-03-101-3/+3
| | | | | | | | | | | | | | | | | | | | If crq is malformed in extensions part, print_extensions() might loop endlessly because gnutls_x509_crq_get_extension_info would return unhandled GNUTLS_ASN1_DER_ERROR looping over extension index, rather than bailing out. Fix this by handling this error code properly. Found thanks to oss-fuzz. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* | lib/x509/output.c: remove occasioinal memory leak in print_issuer_sign_tool()Dmitry Baryshkov2020-03-071-1/+2
|/ | | | | | | Remove memory leak in error handling in print_issuer_sign_tool() by moving asn1_delete_structure to the end of the function. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* privkey_pkcs8: remove unused #include <nettle/pbkdf2.h>Daiki Ueno2020-02-041-1/+0
| | | | Signed-off-by: Daiki Ueno <dueno@redhat.com>
* pkcs7-crypt: refactor using gnutls_pbkdf2Daiki Ueno2020-02-041-37/+9
| | | | Signed-off-by: Daiki Ueno <dueno@redhat.com>
* pkcs12: refactor using gnutls_pbkdf2Daiki Ueno2020-02-041-26/+12
| | | | Signed-off-by: Daiki Ueno <dueno@redhat.com>
* pkcs12: do not go try calculating pbkdf2 with 0 iterationsDmitry Baryshkov2020-01-281-0/+3
| | | | | | | Nettle will abort on a call to pbkdf2 if iterations is 0. Add check to GnuTLS PKCS12 GOST code to check that iter is not 0. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* Merge branch 'legacy-gost-512' into 'master'Nikos Mavrogiannopoulos2020-01-241-0/+4
|\ | | | | | | | | x509: include digestParamSet into GOST 512-bit curves A and B params See merge request gnutls/gnutls!1173
| * x509: include digestParamSet into GOST 512-bit curves A and B paramsDmitry Eremin-Solenikov2020-01-201-0/+4
| | | | | | | | | | | | | | | | Old implementations do not understand PublicKeyParams with omitted digestParamSet. So include the field for old 512-bit curves to improve compatibility with old implementations. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* | Merge branch 'tmp-ed448' into 'master'Daiki Ueno2020-01-248-4/+40
|\ \ | | | | | | | | | | | | algorithms: implement X448 key exchange and Ed448 signature scheme See merge request gnutls/gnutls!984
| * | algorithms: implement X448 key exchange and Ed448 signature schemeDaiki Ueno2020-01-238-4/+40
| |/ | | | | | | Signed-off-by: Daiki Ueno <dueno@redhat.com>
* | Merge branch 'fix-gost-pkcs12' into 'master'Dmitry Baryshkov2020-01-201-1/+1
|\ \ | | | | | | | | | | | | pkcs12: use correct key length when using STREEBOG-512 See merge request gnutls/gnutls!1171
| * | pkcs12: use correct key length when using STREEBOG-512Dmitry Baryshkov2020-01-201-1/+1
| |/ | | | | | | | | | | | | | | | | PKCS#12 files using GOST HMAC (GOST R 34.11-94 and Streebog) use special function to generate MAC key. Pass correct key length (fixed to be 32) when generating PKCS#12 files protected with Streebog (currently it incorrectly uses 64 there). Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* | x509: add OGRNIP DN entry definition used by qualified GOST certificatesDmitry Baryshkov2020-01-201-0/+2
|/ | | | Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* Merge branch 'tmp-check-dup-extensions' into 'master'Nikos Mavrogiannopoulos2020-01-091-34/+88
|\ | | | | | | | | | | | | x509: reject certificates having duplicate extensions Closes #887 See merge request gnutls/gnutls!1145
| * gnutls_x509_crt_get_extension_info: optimize when critical equals NULLNikos Mavrogiannopoulos2020-01-031-9/+9
| | | | | | | | | | | | | | That is, do not perform the look ups necessary to calculate the value when it will not be used. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
| * x509: reject certificates having duplicate extensionsNikos Mavrogiannopoulos2020-01-031-25/+79
| | | | | | | | | | | | | | | | | | | | | | According to RFC5280 a certificate must not include more than one instance of a particular extension. We were previously printing warnings when such extensions were found, but that is insufficient to flag such certificates. Instead, refuse to import them. Resolves: #887 Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
* | Fix implicit value change in verify-high.cTim Rühsen2020-01-031-10/+10
|/ | | | | | | | | verify-high.c:284:7: runtime error: implicit conversion from type 'size_t' (aka 'unsigned long') of value 15421545260338 418178 (64-bit, unsigned) to type 'uint32_t' (aka 'unsigned int') changed the value to 437555714 (32-bit, unsigned) Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* x509: do not tolerate invalid DER timeNikos Mavrogiannopoulos2019-12-262-3/+6
| | | | | | | | | | | This effectively reverts !400 and ensures that we no longer tolerate invalid DER time. This complements the previous commit by Lili Quan and ensures we provide the --disable-strict-der-time backwards compatibility option. Resolves: #207 Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
* _gnutls_verify_crt_status: apply algorithm checks to trusted CAsNikos Mavrogiannopoulos2019-12-191-25/+43
| | | | | | | | | | | If a CA is found in the trusted list, check in addition to time validity, whether the algorithms comply to the expected level. This addresses the problem of accepting CAs which would have been marked as insecure otherwise. Resolves: #877 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* is_level_acceptable: apply the system-wide profile in all verificationsNikos Mavrogiannopoulos2019-12-191-1/+13
| | | | Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* Introduced check to reject certificates with non-digits in time fieldLili Quan2019-12-191-7/+17
| | | | | | | | According to RFC5280 we should reject such certificates. Resolves: #870 Signed-off-by: Lili Quan <13132239506@163.com>
* Add const to function arguments in lib/x509Tim Rühsen2019-12-0710-76/+76
| | | | | | | This change does not introduce functionality changes. It just adds const promises to the caller. Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* lib/x509/x509.c: Check before pointer dereference in get_alt_name()Tim Rühsen2019-10-131-1/+1
| | | | | | Fixes Coverity issue 1361513 Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* lib/x509/output.c: Remove unneeded NULL check in print_crt_pubkey()Tim Rühsen2019-10-131-2/+1
| | | | | | Fixes Coverity issue 1454670 Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* Remove trailing spaces in several filesTim Rühsen2019-10-122-36/+36
| | | | Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* crq APIs: fix typos [ci skip]Nikos Mavrogiannopoulos2019-10-091-2/+2
| | | | | | Resolves: #842 Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
* lib: implement support for updated GOST PublicKeyParametersDmitry Eremin-Solenikov2019-10-062-21/+30
| | | | | | | | | | Recomendation for standardization R 1323565.1.023-2018 has made changes to PublicKeyParameters for GOST R 34.10-2012 keys. It has removed encryptionParamSet (since now S-BOX is basically fixed as TC26-Z) and made digestParamSet OPTIONAL (as it can be concluded from public key OID). Implement these requirements. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* x509: add support for Russian extensions defined for qualified certificateDmitry Eremin-Solenikov2019-09-281-0/+100
| | | | Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* pk: implement deterministic ECDSA/DSADaiki Ueno2019-08-083-0/+6
| | | | | | | This exposes the deterministic ECDSA/DSA functionality through the GNUTLS_PRIVKEY_FLAG_REPRODUCIBLE flag. Signed-off-by: Daiki Ueno <dueno@redhat.com>
* Support for Generalname registeredID from RFC 5280 in subject alt nameKarsten Ohme2019-07-224-2/+19
| | | | | | | | | | Added test certificates (cert10.der) with registered ID Updated Makefile for inclusion of test certificates Updated SAN unknown test certificates (cert5.der) Signed-off-by: Karsten Ohme <k_o_@users.sourceforge.net>
* lib: mark infinite loops explicitlytmp-mark-infinite-loopsNikos Mavrogiannopoulos2019-07-102-35/+24
| | | | | | | | | There were few infinite loop constructions which were checking for an always true condition. Make sure that this construction is marked explicitly as while(1) to assist static analysers, or reviewers. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* gnutls_x509_crt_list_import2: updated doc to reflect the actual return value ↵Nikos Mavrogiannopoulos2019-06-281-1/+1
| | | | | | | | options Resolves: #794 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* config: added ability to override and mark algorithms as disabledNikos Mavrogiannopoulos2019-06-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This allows the system administrator or the distributor to use the gnutls configuration file to mark hashes, signature algorithms, TLS versions, curves, groups, ciphers KX, and MAC algorithms as insecure (the last four only in the context of a TLS session). It also allows to set a minimum profile which the applications cannot fall below. The options intentionally do not allow marking algorithms as secure so that the configuration file cannot be used as an attack vector. This change also makes sure that unsupported and disabled protocols during compile time (e.g., SSL3.0), do not get listed by gnutls-cli. The configuration file feature can be disabled at compile time with an empty --with-system-priority-file. This patch it introduces the function gnutls_get_system_config_file() allowing applications to check whether a configuration file was used. Resolves: #587 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* Merge branch 'mark_const' into 'master'Tim Rühsen2019-05-211-1/+1
|\ | | | | | | | | Mark second argument of function gnutls_x509_crt_equals2 as const See merge request gnutls/gnutls!1000
| * Mark second argument of function gnutls_x509_crt_equals2 as constAleksei Nikiforov2019-05-211-1/+1
| | | | | | | | | | | | | | | | | | This will allow using this function with certificates returned by function gnutls_certificate_get_peers without casts dropping const qualifier or making temporary copies out of retrieved data. Signed-off-by: Aleksei Nikiforov <darktemplar@basealt.ru>
* | Added profile to correspond to the future security parameterNikos Mavrogiannopoulos2019-05-201-1/+5
| | | | | | | | | | | | | | | | | | | | It seems that the FUTURE security level parameter was added without a corresponding verification profile. This patch address the issue by introducing it. Resolves: #770 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* | tests: added unit tests of utc and generalTime convertorNikos Mavrogiannopoulos2019-05-201-2/+4
|/ | | | Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* Add or clean header guards in lib/x509/Tim Rühsen2019-05-0712-21/+46
| | | | Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* [OSCP] Fix : null pointer respElta Koepp2019-04-051-0/+3
| | | | Signed-off-by: Elta Koepp <elta_koepp@gmail.com>
* _x509_en/decode_provable_seed: clarified purpose of functions [ci skip]Nikos Mavrogiannopoulos2019-03-201-0/+6
| | | | Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* Removed all FIXME comments in code [ci skip]Nikos Mavrogiannopoulos2019-03-163-14/+2
| | | | | | | | We expand informational comments on limitations, but with removing FIXME (keyword didn't help fixing these), and remove completely unhelpful comments, obsolete ones, or comments about ideas. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
* Use https:// in lib/, src/, and m4/Tim Rühsen2019-03-131-1/+1
| | | | Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
* Use https:// for www.gnu.org and www.example.comTim Rühsen2019-03-1355-55/+55
| | | | Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>