1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-09-11 08:30:59 +03:00
Commit Graph

28 Commits

Author SHA1 Message Date
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
Vladislav Vaintroub
463a50e973 Merge remote-tracking branch 'origin/3.1' into 3.3
# Conflicts:
#	include/ma_crypt.h
#	libmariadb/mariadb_lib.c
2023-09-21 23:45:35 +02:00
Vladislav Vaintroub
1b3cf6b441 CONC-669 Cache bcrypt algorithm providers in win_crypt.c
CryptOpenAlgorithmProvider() documentation states:
"We recommend that you cache any algorithm provider handles that you will
use more than once, rather than opening and closing the algorithm providers
over and over."

This patch implements algorithm handle caching,
and also simplifies how hashes are handled in win_crypt.c

- MA_HASH_CTX* is now just BCrypt hash handle.
- We no longer allocate or free memory any memory outselves.

There are small change in the ma_hash API:
ma_hash_new() lost the second parameter, only used on Windows previously
2023-09-21 18:06:01 +02:00
Georg Richter
4e3905c20a Fix for bcrypt hash functions:
Using a global crypt provider is not thread safe, so we need to load
provider via BCryptOpenProvider in ma_hash_new().
2023-08-23 16:18:50 +02:00
Georg Richter
f12448885f Merge branch '3.1' into 3.3 2022-08-01 12:28:02 +02:00
Georg Richter
3bb04cddfe Follow up of OpenSSL 3.0 backport
check for HAVE_WINCRYPT instead of _WIN32
2022-07-28 15:06:25 +02:00
Marko Mäkelä
788535f217 Fix GCC -Og -Wmaybe-uninitialized 2022-07-25 15:45:36 +03:00
Georg Richter
8260fe53e6 Backport of CONC-503:
OpenSSL 3.0 support for Connector/C 3.1. Backported from 3.3
2022-07-25 13:52:43 +02:00
Georg Richter
3f7719c74d Typo fixes (from PR #200) 2022-06-27 13:23:35 +02:00
Daniel Black
03b25fb087 crypt: WIN32 -> HAVE_WINCRYPT
Apply HAVE_WINCRYPT as the defination for using the wincrypt/bcrypt
APIs for the authentication plugins caching_sha256_password,
ed25519 and sha256_password in the same way as the HAVE_OPENSSL and
HAVE_GNUTLS are applied.
2021-08-13 11:38:28 +10:00
Marko Mäkelä
c288f7d0b6 CONC-503 fixup: rsa_size may be uninitialized 2021-07-22 14:27:05 +03:00
Georg Richter
96b9afc42d OpenSSL fix (caching_sha2_pw):
If we can't obtain public key from BIO,
an error should be returned instead of
clearing the error.
2021-07-22 13:11:29 +02:00
Georg Richter
c610dc7de5 CONC-503: Add support for OpenSSL 3.0
Exchanged deprecated functions for RSA encryption
 by EVP_PKEY functions using an EVP_PKEY context.
2021-06-17 16:43:49 +02:00
Georg Richter
85c3742252 Follow up of dec061fa95
Use EVP_PKEY_set1_RSA() instead of EVP_PKEY_assign_RSA, since
the public key will be freed when releasing pkey-
2021-06-16 16:13:14 +02:00
Georg Richter
dec061fa95 CONC-503: Support for OpenSSL 3.0
Minor fix for building with latest OpenSSL 3.0 beta:
replaced RSA_size function by EVP_KEY api calls.
2021-05-31 11:12:55 +02:00
Georg Richter
820faff627 codespell fixes, removed MSDOS preprocessor macros 2020-11-26 09:07:17 +01:00
Georg Richter
1fed6c3184 Build fix:
declared deinit function of plugins as deinit(void) instead
of deinit().
2020-10-21 07:23:50 +02:00
Vladislav Vaintroub
ce011210d1 small cleanups
remove MSVC specific #pragma comment(lib)
TARGET_LINK_LIBRARIES is good enough
2020-05-27 20:32:56 +02:00
Otto Kekäläinen
c0d5d7d15b Fix typo in output string: inital -> initial 2020-03-04 20:05:56 +02:00
Georg Richter
1218ffac1a Fix for CONC-452 and CONC-453:
Various coverity scan fixes, including CONC-452 and CONC-453.
Special thanks to Lukas Javorsky for fixing numerous covscan
issues (This patch includes part of his pull request #126).

Coverity scan build was using the following cmake parameters:
-WITH_EXTERNAL_ZLIB=ON -DWITH_UNIT_TESTS=OFF.

CWE-416 (use after free) in dtoa.c (from netlib) is still open.
2020-02-14 09:52:21 +01:00
Yuriy
538da15b4d fixed caching_sha2_password behaviour when SSL is enabled 2019-09-09 08:58:59 +03:00
Georg Richter
11a2d035dd CONC-431: Use windows crypto libraries on Windows platforms
By default Windows builds now use the native system crypto libraries used
by ed25519, caching_sha2_password and sha256_password authentication plugins.
Even if configuration option WITH_SSL=OFF was specified (or no TLS library was found) authentication plugins using crypto will be available.
2019-08-01 14:02:04 +02:00
Oleksandr Byelkin
5fa9c4615e Merge branch '3.0' into 3.1 2019-07-18 13:51:03 +02:00
Georg Richter
07f6f951e4 Fix for Windows OpenSSL build: Link crypt and ws2_32 in case OpenSSL is a newer
version which was build with capi engine support
2019-07-17 08:22:19 +02:00
Sergei Golubchik
d1de8bd2fa compiler warning 2019-03-28 15:38:18 +01:00
Georg Richter
1285dc72a0 Fix compiler warning when using GnuTLS 2019-03-11 18:03:44 +01:00
Inada Naoki
14c8a88976 Support static linking auth plugins
It was failed when both of caching_sha2_password and sha256_password
are linked statically.
2019-01-18 17:58:53 +09:00
Georg Richter
005195f9cb CONC-312: Implementation for caching_sha2_password plugin 2018-12-01 08:56:24 +01:00