1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

61 Commits

Author SHA1 Message Date
Georg Richter
6d28fe89af Merge branch '3.1' into 3.3 2024-12-08 11:50:43 +01:00
Georg Richter
af44fc5c5e CONC-748: Allow to set TLSv1.3 ciphers in GnuTLS
- Added TLSv1.3 ciphers to cipher map.
- Fixed retrieval of cipher suite: Since gnutls_cipher_suite_get_name
  supports only TLSv1.2 (and lower) cipher suites, we have to call
  gnutls_ciphersuite_get() (requires GnuTLS 3.7.4 or newer).
2024-12-08 11:27:32 +01:00
Sergei Golubchik
f6e99af056 Revert "self-signed certificate verification", it's 3.4 feature
This reverts 395641549ac7..536d9e2b9e5b, in particular:

8dffd56936 MDEV-31857 enable MYSQL_OPT_SSL_VERIFY_SERVER_CERT by default
a99570c118 MDEV-31855 SSL cert validation protocol extension
9aa15e72a7 TLS fingerprint

and related commits
2024-02-19 11:16:26 +01:00
Sergei Golubchik
8dffd56936 MDEV-31857 enable MYSQL_OPT_SSL_VERIFY_SERVER_CERT by default
because the default value of every option is 0
(option and option.extension are bzero-ed to reset),
tls_verify_server_cert was renamed to tls_allow_invalid_server_cert
with the default value of 0, "do not allow".

API didn't change, it's still MYSQL_OPT_SSL_VERIFY_SERVER_CERT
2024-02-04 22:17:25 +01:00
Sergei Golubchik
a99570c118 MDEV-31855 SSL cert validation protocol extension
* extend the client auth plugin API with a new callback
* relax the plugin version check to allow load a plugin with the
  same major version, even if the minor versions differ
* implement the protocol extension:
  - don't abort at once if the certificate is self signed and
    no CA was explicitly specified
  - allow it if it passes fingerprint check
  - allow it if plugin has hash_password_bin callback, password was
    non-empty and the control hash matches server's
2024-02-04 22:17:25 +01:00
Georg Richter
9aa15e72a7 TLS fingerprint
Beside SHA1 fingerprint hash, Connector/C now also supports
SHA224 (OpenSSL and GnuTLS only), SHA256, SHA384 and SHA512
fingerprint hashes.
2024-02-04 22:17:22 +01:00
Georg Richter
3a255ee3ea Merge branch '3.1' into 3.3 2023-07-24 11:07:05 +02:00
Georg Richter
45feebb99d Remove server certification verification
Since the server certification option is used by client
only, there is no need to have this flag in server and or
client capabilities. The server itself validates client
certificate depending on the user definition.
2023-07-13 09:30:33 +02:00
Georg Richter
dcb14e3c5d erge branch '3.1' into 3.3 2022-08-01 12:26:27 +02:00
Georg Richter
12722e3131 Error message fix:
Since TLS errors might happen not only when connecting and SSL protocol
is not longer used, errormessage for CR_SSL_CONNECTION_ERROR was replaced
by TLS/SSL error.
2022-07-27 14:52:20 +02:00
Georg Richter
6dbd953420 Merge branch '3.1' into 3.3 2022-07-24 10:52:52 +02:00
Georg Richter
8e8d175a64 Fix gnutls error message:
When using default error string (2026), a zero ptr
for error message needs to be specified.
2022-07-22 08:16:25 +02:00
Georg Richter
6700ee4a7c Make TLS/SSL more verbose:
Added TLS/SSL prefixes for error strings
Report Error string for errno
2022-07-21 09:47:23 +02:00
Georg Richter
e8e356e355 Merge branch '3.1' into 3.3 2022-07-18 11:48:33 +02:00
Georg Richter
9a572bc548 Fix for CONC-604 and CONC-605:
This patch fixes a crash when reconnectiong via TLS.
2022-07-18 11:41:46 +02:00
Georg Richter
dac298de61 CONC-605: Disable sigpipe
Added option GNUTLS_NO_SIGNAL in gnutls_init options to disable
SIGPIPE errors on platforms which support MSG_NOSIGNAL.
2022-07-11 07:53:31 +02:00
Georg Richter
903c3ef3fc Merge branch '3.1' into 3.2 2021-06-29 10:10:01 +02:00
Georg Richter
07a15f23a2 Fix for CONC-558:
Allow all curves when specifiying a cipher suite.
2021-06-29 10:07:51 +02:00
Georg Richter
971489fa44 Reverted remove of TLSv1.0 protocol
TLSv1.0 protocol was removed by mistake
in commit e4e5b28452
2021-06-08 10:13:02 +02:00
Georg Richter
e4e5b28452 CONC-533: Support for asynchronous statements (binary protocol)
Added a new option MARIADB_OPT_SKIP_READ_RESPONSE which skips automatic
reading of server response after sending a command to the server.

Server packets have to be retrieved by calling the corresponding methods,
e.g:

Send command                         Read method
mysql_real_query/mysql_send_query    db_read_query_result
mysql_stmt_prepare                   db_read_prepare_response
mysql_stmt_execute,
mariadb_stmt_execute_direct          db_read_execute_response
2021-05-13 21:21:43 +02:00
Georg Richter
132c5b51c1 CONC-433: Add CRL support for GnuTLS
Added support for certificate revocation list (CRL) in GnuTLS.
2021-04-15 18:19:45 +02:00
Georg Richter
820faff627 codespell fixes, removed MSDOS preprocessor macros 2020-11-26 09:07:17 +01:00
Sergei Golubchik
ce74fd0c40 properly free gnutls ssl data if connection fails 2020-05-26 18:27:57 +02:00
Georg Richter
8e9c311610 Follow up of ffbdaaac2b
commit ffbdaaac2b was incomplete, changes from ma_pvio.c
were missing. Beside this fix, this commit also contains necessary changes for GnuTLS.
2020-01-22 11:08:18 +01:00
Georg Richter
05f70d204c Windows build fix: Include ma_global.h before including gnutls header files 2019-08-01 14:33:10 +02:00
Georg Richter
5e5bb66e32 Merge commit 'c6b344d730885051fdaf347f0d33c54ec22c415c' into 3.1 2019-06-26 09:18:38 +02:00
Georg Richter
c6b344d730 Fix for CONC-423: GnuTLS fails with "error reading authentication packet" with a TLSv1.3 connection
We now check the return code of gnutls_record_send() and gnutls_record_recv().
If GNUTLS_E_AGAIN or GNUTLS_E_INTERRUPTED was returned we will loop and read/write
again until a timeout occurs or buffer was read or written.
2019-06-26 09:13:00 +02:00
Georg Richter
94d87e8559 Merge commit 'ff13dd446dcd6dd861026a8aa3cd23f3a9c759d3' into 3.1 2019-06-24 18:10:30 +02:00
Georg Richter
ff13dd446d CONC-421:
Fixed crash in case certificate and key are stored in the same file.
Instead of reading key and cert separately we now call gnutls api function
gnutls_certificate_x509_keyfile2() to load certificate and key.
2019-06-24 18:07:53 +02:00
Georg Richter
d95dec811a Move NORMAL priority at the end of priority string, otherwise possible version specifications will not work. 2019-06-08 09:05:04 +02:00
Vladislav Vaintroub
eb28bf1dad CONC-385 Remove some irrelevant cmake system checks 2019-01-11 20:36:03 +01:00
Georg Richter
f226c3b257 Fix for CONC-320:
Non blocking/asynchronous support for OpenSSL and GnuTLS.
Please note that Schannel in asynchronous mode is not supported yet.
2018-04-17 10:35:49 +02:00
luz.paz
b2e6ed0295 Fixes misc. typos
found via `codespell -q 3`
2018-04-13 07:30:23 +02:00
Georg Richter
c9c40a37a4 TLS/SSL fixes:
- don't run fingerprint and passphrase protected tests if the corresponding
  files (sha1 and encrypted client key) are not found in CERT_PATH
- don't overwrite SSL errors if handshake failed
- Use gnutls read/write instead of pvio
2018-01-10 11:11:02 +01:00
Georg Richter
b241f8995f MDEV-14101: tls-version
Client part of MDEV-14101: Add support for tls-version, via
mysql_options(mysql, MARIADB_OPT_TLS_VERSION, value)
Accepted values are "TLSv1.1", "TLSv1.2" and "TLSv1.3".

Fixed testcase openssl_1 for schannel
2017-10-23 11:09:54 +02:00
Georg Richter
abf4bf8024 Provide details about TLS/SSL library in use
When calling mariadb_get_infov with option MARIADB_TLS_LIBRARY
the functioni now returns the correct version number and name
of the tls/ssl library in use.
2017-10-17 15:57:42 +02:00
Georg Richter
3b297e08c9 Revert "MDEV-14027: Determine TLS/SSL library version"
This reverts commit 7b02cbb721.
2017-10-15 09:30:24 +02:00
Georg Richter
7b02cbb721 MDEV-14027: Determine TLS/SSL library version 2017-10-15 06:07:54 +02:00
Georg Richter
7bcd78f93b CONC-286:
- Force TLS/SSL connection if finger print options were specified
- Allow hex finger prints with colon separated 2 digit numbers
2017-10-10 12:25:27 +02:00
Georg Richter
967b2830d8 renamed ma_errmsg.h back to errmsg.h 2016-11-16 18:13:59 +01:00
Georg Richter
468cda3cfb Fixed compilation errors introduced by 629ec646303.. 2016-10-18 10:53:31 +02:00
Georg Richter
c20974b039 - removed global context for tls, so code can be used also with no yassl branch in 10.2
- added new gnutls cipher mapping
- fixed ssl test case: skip hostname verification if both server and client run on localhost
- added server certificates
2016-10-17 16:02:51 +02:00
Georg Richter
9b436eaaf7 TLS fixes:
- don't use password in global context
  - load keys and certs via callback functions
  - don't use gnutls_bye since server is not able to detect dead socket
  - fixed valgrind errors in gnutls
2016-09-13 16:12:34 +02:00
Georg Richter
571dc5f397 Fixed crash in gnutls:
In case handshake will fail a further call to gnutls_bye function will lead in a crash.
Therefore we free the ssl handle immediately after handshake failed.
2016-09-08 09:45:37 +02:00
Georg Richter
7d26557cbc GnuTLS: Added support for cipher mapping
The following openssl cipher names are supported and will be mapped to gnutls priority:
DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA256 DHE-RSA-AES256-SHA DHE-RSA-CAMELLIA256-SHA AES256-GCM-SHA384 AES256-SHA256 AES256-SHA CAMELLIA256-SHA DHE-RSA-AES128-GCM-SHA256 DHE-RSA-AES128-SHA256 DHE-RSA-AES128-SHA DHE-RSA-CAMELLIA128-SHA AES128-GCM-SHA256 AES128-SHA256 AES128-SHA CAMELLIA128-SHA EDH-RSA-DES-CBC3-SHA DES-CBC3-SHA DHE-RSA-AES256-SHA DHE-RSA-CAMELLIA256-SHA AES256-SHA CAMELLIA256-SHA
2016-09-08 08:36:07 +02:00
Georg Richter
9f88e25fd6 Compiler warning fixes 2016-09-03 12:46:50 +02:00
Georg Richter
4b1e94bccc Since we use TLS and not SSL functions and structures were renamed
from SSL to TLS
2016-03-16 18:20:08 +01:00
Georg Richter
ee004a83d3 GnuTLS fix: we need to check server certificate if no ca was specified
but verify_server flag was set
2016-02-29 15:47:50 +01:00
Georg Richter
85525c2ba7 Merge remote-tracking branch 'origin/3.1' 2016-02-16 17:40:03 +01:00
Georg Richter
509b948e7d SSL fixes:
- added MARIADB_OPT_SSL_CIPHER_STRENGTH (value uint) for Schannel
- fixed mutes in all ssl variants
2016-02-16 13:04:16 +01:00