Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions build-ps/percona-server-8.0_builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,11 @@ install_deps() {
if [ "x${RHEL}" = "x8" -o "x${RHEL}" = "x7" ]; then
switch_to_vault_repo
fi
if [ "x${RHEL}" = "x7" ]; then
sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's|^#baseurl=|baseurl=|g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's|mirror.centos.org|vault.centos.org|g' /etc/yum.repos.d/CentOS-Base.repo
fi
if [ x"$ARCH" = "xx86_64" ]; then
if [ "${RHEL}" -lt 8 ]; then
# add_percona_yum_repo
Expand Down Expand Up @@ -1120,25 +1125,25 @@ OS=
TOKUBACKUP_REPO=
PERCONAFT_REPO=
INSTALL=0
RPM_RELEASE=1
DEB_RELEASE=1
RPM_RELEASE=2
DEB_RELEASE=2
DEBUG=0
REVISION=0
BRANCH="release-8.0.30-22"
RPM_RELEASE=1
DEB_RELEASE=1
BRANCH="CUSTOM-220"
RPM_RELEASE=2
DEB_RELEASE=2
MECAB_INSTALL_DIR="${WORKDIR}/mecab-install"
REPO="https://github.com/percona/percona-server.git"
PRODUCT=Percona-Server-8.0
MYSQL_VERSION_MAJOR=8
MYSQL_VERSION_MINOR=0
MYSQL_VERSION_PATCH=30
MYSQL_VERSION_EXTRA=-22
PRODUCT_FULL=Percona-Server-8.0.30
MYSQL_VERSION_PATCH=42
MYSQL_VERSION_EXTRA=-33
PRODUCT_FULL=Percona-Server-8.0.42
BOOST_PACKAGE_NAME=boost_1_77_0
BUILD_TOKUDB_TOKUBACKUP=0
PERCONAFT_BRANCH=Percona-Server-8.0.30-22
TOKUBACKUP_BRANCH=Percona-Server-8.0.30-22
PERCONAFT_BRANCH=Percona-Server-8.0.42-33
TOKUBACKUP_BRANCH=Percona-Server-8.0.42-33
parse_arguments PICK-ARGS-FROM-ARGV "$@"

check_workdir
Expand Down
2 changes: 1 addition & 1 deletion build-ps/percona-server.spec
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
%global compatver 5.6.51
%global percona_compatver 91.0
%global compatlib 18
%global compatsrc https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-%{compatver}-%{percona_compatver}/binary/redhat/7/x86_64/Percona-Server-shared-56-%{compatver}-rel%{percona_compatver}.1.el7.x86_64.rpm
%global compatsrc https://repo.percona.com/yum/release/7/RPMS/x86_64/Percona-Server-shared-56-5.6.51-rel91.0.1.el7.x86_64.rpm
%endif

%if 0%{?rhel} == 6
Expand Down
35 changes: 21 additions & 14 deletions extra/opensslpp/src/opensslpp/evp_pkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@

#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/rsa.h> // Needed for EVP_PKEY_get0_RSA

#ifndef EVP_PKEY_get0_RSA
extern "C" {
static inline const RSA *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is hard to verify as implementation is different in various OpenSSL versions but probably a client doesn't use
Enterprise Encryption UDFs for OpenSSL at all so we should be safe.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra/opensslpp is Percona's Enterprise Encryption UDFs for OpenSSL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried to adopt it to solve compilation issue with openssl1.0.2k and as this build should be used just for tests I hope it should be fine :)

if (!pkey || EVP_PKEY_base_id(pkey) != EVP_PKEY_RSA)
return nullptr;
return pkey->pkey.rsa;
}
}
#endif


#include <opensslpp/evp_pkey.hpp>

Expand Down Expand Up @@ -81,16 +93,12 @@ void evp_pkey::evp_pkey_deleter::operator()(void *evp_pkey) const noexcept {
evp_pkey::evp_pkey(const evp_pkey &obj) : impl_{} {
if (!obj.is_empty()) {
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
// due to a bug in openssl interface, EVP_PKEY_dup() expects
// non-const parameter while it does not do any modifications with the
// object - it just performs duplication via ASN1_item_i2d/ASN1_item_d2i
// conversions
impl_.reset(EVP_PKEY_dup(evp_pkey_accessor::get_impl_const_casted(obj)));
if (!impl_) {
throw core_error{"cannot duplicate EVP_PKEY key"};
}
impl_.reset(EVP_PKEY_dup(evp_pkey_accessor::get_impl_const_casted(obj)));
if (!impl_) {
throw core_error{"cannot duplicate EVP_PKEY key"};
}
#else
duplicate_evp_pkey(*this, obj, !obj.is_private());
duplicate_evp_pkey(*this, obj, !obj.is_private());
#endif
}
}
Expand All @@ -105,14 +113,14 @@ void evp_pkey::swap(evp_pkey &obj) noexcept { impl_.swap(obj.impl_); }

evp_pkey_algorithm evp_pkey::get_algorithm() const noexcept {
assert(!is_empty());
auto native_algorithm{EVP_PKEY_base_id(evp_pkey_accessor::get_impl(*this))};
auto native_algorithm{EVP_PKEY_base_id(
const_cast<EVP_PKEY *>(evp_pkey_accessor::get_impl(*this)))};
return native_algorithm_to_evp_pkey_algorithm(native_algorithm);
}

bool evp_pkey::is_private() const noexcept {
assert(!is_empty());

// TODO: implement checks for other algorithms
const auto *native_rsa{
EVP_PKEY_get0_RSA(evp_pkey_accessor::get_impl_const_casted(*this))};
assert(native_rsa != nullptr);
Expand All @@ -125,12 +133,12 @@ bool evp_pkey::is_private() const noexcept {

std::size_t evp_pkey::get_size_in_bits() const noexcept {
assert(!is_empty());
return EVP_PKEY_bits(evp_pkey_accessor::get_impl(*this));
return EVP_PKEY_bits(const_cast<EVP_PKEY *>(evp_pkey_accessor::get_impl(*this)));
}

std::size_t evp_pkey::get_size_in_bytes() const noexcept {
assert(!is_empty());
return EVP_PKEY_size(evp_pkey_accessor::get_impl(*this));
return EVP_PKEY_size(const_cast<EVP_PKEY *>(evp_pkey_accessor::get_impl(*this)));
}

evp_pkey evp_pkey::derive_public_key() const {
Expand Down Expand Up @@ -160,7 +168,6 @@ class evp_pkey_keygen_ctx {
}

evp_pkey generate(std::size_t bits) {
// TODO: implement setting bit length for other algorithms
if (EVP_PKEY_CTX_set_rsa_keygen_bits(impl_.get(), bits) <= 0) {
throw core_error{"cannot set EVP_PKEY context key generation parameters"};
}
Expand Down
19 changes: 13 additions & 6 deletions include/my_checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,17 @@
#include <cstdint> // std::uint32_t
#include <limits> // std::numeric_limits
#include <type_traits> // std::is_convertible
#include <cstring> // memcpy

#include <zlib.h> // crc32_z
#include <zlib.h> // crc32 or crc32_z

#include "my_compiler.h" // My_ATTRIBUTE
#if ZLIB_VERNUM >= 0x1290
#define MY_CRC32(crc, buf, len) crc32_z(crc, buf, len)
#else
#define MY_CRC32(crc, buf, len) crc32(crc, buf, len)
#endif
Comment on lines +41 to +45
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine.


#include "my_compiler.h" // MY_ATTRIBUTE
#include "my_config.h"

#ifdef HAVE_ARMV8_CRC32_INTRINSIC
Expand Down Expand Up @@ -77,7 +84,7 @@ inline std::uint32_t IntegerCrc32(std::uint32_t crc, I i) {
unsigned char buf[sizeof(I)];
memcpy(buf, &i, sizeof(I));
crc = ~crc;
crc = crc32_z(crc, buf, sizeof(I));
crc = MY_CRC32(crc, buf, sizeof(I));
return ~crc;
}

Expand Down Expand Up @@ -122,7 +129,7 @@ inline ha_checksum my_checksum(ha_checksum crc, const unsigned char *pos,
#endif // HAVE_ARMV8_CRC32_INTRINSIC
static_assert(std::is_convertible<uLong, ha_checksum>::value,
"uLong cannot be converted to ha_checksum");
assert(crc32_z(crc, pos, length) <= std::numeric_limits<ha_checksum>::max());
return crc32_z(crc, pos, length);
assert(MY_CRC32(crc, pos, length) <= std::numeric_limits<ha_checksum>::max());
return MY_CRC32(crc, pos, length);
}
#endif /* not defined(MY_CEHCKSUM_INCLUDED) */
#endif /* MY_CHECKSUM_INCLUDED */
Loading