summaryrefslogtreecommitdiff
path: root/mysys_ssl/my_crypt.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.4 into 10.5Marko Mäkelä2023-02-101-1/+1
|\
| * Apply clang-tidy to remove empty constructors / destructorsVicențiu Ciorbaru2023-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is the result of running run-clang-tidy -fix -header-filter=.* -checks='-*,modernize-use-equals-default' . Code style changes have been done on top. The result of this change leads to the following improvements: 1. Binary size reduction. * For a -DBUILD_CONFIG=mysql_release build, the binary size is reduced by ~400kb. * A raw -DCMAKE_BUILD_TYPE=Release reduces the binary size by ~1.4kb. 2. Compiler can better understand the intent of the code, thus it leads to more optimization possibilities. Additionally it enabled detecting unused variables that had an empty default constructor but not marked so explicitly. Particular change required following this patch in sql/opt_range.cc result_keys, an unused template class Bitmap now correctly issues unused variable warnings. Setting Bitmap template class constructor to default allows the compiler to identify that there are no side-effects when instantiating the class. Previously the compiler could not issue the warning as it assumed Bitmap class (being a template) would not be performing a NO-OP for its default constructor. This prevented the "unused variable warning".
* | MDEV-25785 Add support for OpenSSL 3.0Vladislav Vaintroub2022-07-041-17/+29
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of changes - MD_CTX_SIZE is increased - EVP_CIPHER_CTX_buf_noconst(ctx) does not work anymore, points to nobody knows where. The assumption made previously was that (since the function does not seem to be documented) was that it points to the last partial source block. Add own partial block buffer for NOPAD encryption instead - SECLEVEL in CipherString in openssl.cnf had been downgraded to 0, from 1, to make TLSv1.0 and TLSv1.1 possible (according to https://github.com/openssl/openssl/blob/openssl-3.0.0/NEWS.md even though the manual for SSL_CTX_get_security_level claims that it should not be necessary) - Workaround Ssl_cipher_list issue, it now returns TLSv1.3 ciphers, in addition to what was set in --ssl-cipher - ctx_buf buffer now must be aligned to 16 bytes with openssl( previously with WolfSSL only), ot crashes will happen - updated aes-t , to be better debuggable using function, rather than a huge multiline macro added test that does "nopad" encryption piece-wise, to test replacement of EVP_CIPHER_CTX_buf_noconst part of MDEV-29000
* WolfSSL fixesSergei Golubchik2020-05-081-0/+2
| | | | | | remove Timeval workaround (not needed anymore). add template workaround. comments.
* Update WolfSSL, remove older workarounds.Vladislav Vaintroub2019-07-281-16/+0
|
* MDEV-19684 enable intel assembly (AESNI etc) and fastmath when compiling WolfSSLVladislav Vaintroub2019-06-041-5/+20
| | | | | | | | | | Using different recommended speedup options for WolfSSL. - Enable x64 assembly code on Intel. - in my_crypt.cc, align EVP_CIPHER_CTX buffer, since some members need alignment of 16 (for AESNI instructions), when assembler is enabled. - Adjust MY_AES_CTX_SIZE - Enable fastmath in wolfssl (large integer math).
* Fix compilation on LinuxVladislav Vaintroub2019-05-291-1/+1
|
* MDEV-19617 Assertion `src' failed in MyCTX::updateVladislav Vaintroub2019-05-281-1/+10
| | | | | | | | Apprently, sometimes there will be null pointers with 0 length passed to the MyCTX::update() function, and will need to return a valid buffer. So weaken the assertion, and use a valid pointer for src if it was NULL.
* MDEV-19604 WolfSSL breaks binlog_encryption.binlog_incidentVladislav Vaintroub2019-05-271-0/+1
| | | | | | | | | Log_event_writer::encrypt_and_write() can pass NULL pointer as source buffer for the encryption. WolfSSL EVP_CipherUpdate(), rightfully rejects this as invalid parameter. Fix Log_event_writer::encrypt_and_write() and check, with assertion, that src parameterm is sane in MyCTX::update()
* MDEV-18531 : Use WolfSSL instead of YaSSL as "bundled" SSL/encryption libraryVladislav Vaintroub2019-05-221-7/+19
| | | | | | | | - Add new submodule for WolfSSL - Build and use wolfssl and wolfcrypt instead of yassl/taocrypt - Use HAVE_WOLFSSL instead of HAVE_YASSL - Increase MY_AES_CTX_SIZE, to avoid compile time asserts in my_crypt.cc (sizeof(EVP_CIPHER_CTX) is larger on WolfSSL)
* Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
|\
| * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| |
* | MDEV-15587 AES test fails, segfaults in EVP_CipherInit_exMarko Mäkelä2019-03-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When HAVE_YASSL is defined (due to cmake -DWITH_SSL=bundled or otherwise), mysys_ssl/my_crypt.cc will #include "yassl.cc" from the same directory. When MariaDB 10.2 or later is compiled with GCC 8 and optimizations are enabled, then the check if (iv) in EVP_CipherInit_ex() can be wrongly optimized away. The reason appears to be that __attribute__((nonnull)) is attached to the variable iv, because there is a (no-op) call memcpy(oiv, iv, ivlen=0) earlier in the code path. It is possible that this started failing after the code was refactored in MDEV-10332 (MariaDB 10.2.6). In MariaDB 10.1, there is a similar memcpy() call in MyCTX_nopad::init(), but the code appears to work fine.
* | Merge branch 'github/10.1' into 10.2Sergei Golubchik2018-02-061-14/+1
|\ \ | |/
| * MDEV-14343 Server crash on FIPS with openssl-1.0.2kSergei Golubchik2018-01-301-21/+2
| | | | | | | | don't use internal undocumented OpenSSL functionality
* | MDEV-12763 10.2 uses deprecated openssl 1.0 apis even with 1.1Sergei Golubchik2017-09-181-1/+1
| | | | | | | | | | Use OpenSSL 1.1 when applicable. Create compatibility macros for OpenSSL 1.0- and YaSSL.
* | MDEV-10332 support for OpenSSL 1.1 and LibreSSLSergei Golubchik2017-05-091-63/+39
| | | | | | | | | | | | | | | | | | | | | | | | post-review fixes: * move all ssl implementation related ifdefs/defines to one file (ssl_compat.h) * work around OpenSSL-1.1 desire to malloc every EVP context by run-time checking that context allocated on the stack is big enough (openssl.c) * use newer version of the AWS SDK for OpenSSL 1.1 * use get_dh2048() function as generated by openssl 1.1 (viosslfactories.c)
* | MDEV-10332 support for OpenSSL 1.1 and LibreSSLGeorg Richter2017-05-091-35/+80
| | | | | | | | | | | | | | | | | | | | | | Initial support tested against OpenSSL 1.0.1, 1.0.2, 1.1.0, Yassl and LibreSSL not working on Windows with native SChannel support, due to wrong cipher mapping: Latter one requires push of CONC-241 fixes. Please note that OpenSSL 0.9.8 and OpenSSL 1.1.0 will not work: Even if the build succeeds, test cases will fail with various errors, especially when using different tls libraries or versions for client and server.
* | Merge 10.1 into 10.2Marko Mäkelä2017-05-061-0/+26
|\ \ | |/ | | | | | | | | Also, include fixes by Vladislav Vaintroub to the aws_key_management plugin. The AWS C++ SDK specifically depends on OPENSSL_LIBRARIES, not generic SSL_LIBRARIES (such as YaSSL).
| * MDEV-11663 Create services for functionality used by pluginsVladislav Vaintroub2017-04-271-0/+26
| | | | | | | | | | | | Added service for - encryption (AES) - error reporting, e.g my_printf_error()
* | Fix for MDEV-11174:Georg Richter2017-02-011-0/+3
|/ | | | A GCM encrypted ciphertext must contain an authentication tag with AES_BLOCK_SIZE length, so we need to check that the length of ciphertext is at least AES_BLOCK_SIZE.
* Merge branch '10.0' into 10.1Sergei Golubchik2015-12-211-0/+4
|
* New encryption API. Piece-wise encryption.Sergei Golubchik2015-09-041-275/+174
| | | | | | | | | | | | | Instead of encrypt(src, dst, key, iv) that encrypts all data in one go, now we have encrypt_init(key,iv), encrypt_update(src,dst), and encrypt_finish(dst). This also causes collateral changes in the internal my_crypt.cc encryption functions and in the encryption service. There are wrappers to provide the old all-at-once encryption functionality. But binlog events are often written piecewise, they'll need the new api.
* MDEV-8281 aes_decrypt crashes in block_crypt()Sergei Golubchik2015-06-271-1/+1
| | | | fix aes_decrypt of yassl to support zero-length input
* my_aes_encrypt_gcm() and my_aes_decrypt_gcm()Sergei Golubchik2015-06-021-1/+85
|
* my_aes_get_size()Sergei Golubchik2015-06-021-8/+10
| | | | | return unsigned, not signed. return a value large enough for GCM
* Merge tag 'mariadb-10.0.19' into 10.1Sergei Golubchik2015-06-011-1/+2
|
* MDEV-8162 func_str crashes on SELECT AES_DECRYPT(AES_ENCRYPT(...)) on line 107Sergei Golubchik2015-05-151-23/+24
| | | | encrypting 0 byte string *is* possible
* MDEV-8022 Assertion `rc == 0' failed in ma_encrypt on dropping an encrypted ↵Sergei Golubchik2015-05-131-51/+61
| | | | | | | | | | | Aria table fix encryption of the last partial block * now really encrypt it, using key and iv * support the case of very short plaintext (less than one block) * recommend aes_ctr over aes_cbc, because the former doesn't have problems with partial blocks
* move AES_CTR to its own greatly simplified functionSergei Golubchik2015-05-131-32/+41
| | | | | * don't use do_crypt() for stream cipher AES_CTR * rename do_crypt to block_crypt to emphasize its specialization
* remove now-empty my_aes.{h,cc}Sergei Golubchik2015-04-091-11/+28
| | | | move remaning defines to my_crypt, add MY_ namespace prefix
* encryption plugin controls the encryptionSergei Golubchik2015-04-091-39/+39
| | | | | | | | | * no --encryption-algorithm option anymore * encrypt/decrypt methods in the encryption plugin * ecnrypt/decrypt methods in the encryption_km service * file_km plugin has --file-key-management-encryption-algorithm * debug_km always uses aes_cbc * example_km changes between aes_cbc and aes_ecb for different key versions
* yassl paddingSergei Golubchik2015-04-081-11/+33
|
* my_aes* functions: support for different key lengthsSergei Golubchik2015-04-081-14/+38
| | | | to: different key lengths
* yassl supportSergei Golubchik2015-04-051-30/+63
|
* unify my_{en|de}crypt_{cbc|ecb|ctr}. no yassl support yet.Sergei Golubchik2015-04-051-29/+96
|
* simplify my_crypt.cc, remove duplicate codeSergei Golubchik2015-04-051-278/+30
|
* cmake-time detection for EVP_aes_128_ctr()Sergei Golubchik2015-02-101-1/+2
| | | | because old openssl versions (e.g. on labrador) don't have it
* Push for testing of encryptionMonty2015-02-101-0/+370