Fixed TeaSpeak for openssl
This commit is contained in:
parent
3661056d2a
commit
8cdcf31450
@ -337,7 +337,15 @@ std::shared_ptr<SSLContext> SSLManager::loadContext(std::string &rawKey, std::st
|
|||||||
|
|
||||||
const uint8_t* mem_ptr{nullptr};
|
const uint8_t* mem_ptr{nullptr};
|
||||||
size_t length{0};
|
size_t length{0};
|
||||||
|
#ifdef CRYPTO_BORINGSSL
|
||||||
if(!BIO_mem_contents(&*bio_private_key, &mem_ptr, &length)) SSL_ERROR("Failed to get mem contents: ");
|
if(!BIO_mem_contents(&*bio_private_key, &mem_ptr, &length)) SSL_ERROR("Failed to get mem contents: ");
|
||||||
|
#else
|
||||||
|
BUF_MEM memory{};
|
||||||
|
if(!BIO_get_mem_ptr(&*bio_private_key, &memory)) SSL_ERROR("Failed to get mem contents: ");
|
||||||
|
|
||||||
|
mem_ptr = (uint8_t*) memory.data;
|
||||||
|
length = memory.length;
|
||||||
|
#endif
|
||||||
if(!mem_ptr || length < 0) SSL_ERROR("Could not get private key mem pointer/invalid length: ");
|
if(!mem_ptr || length < 0) SSL_ERROR("Could not get private key mem pointer/invalid length: ");
|
||||||
rawKey.reserve(length);
|
rawKey.reserve(length);
|
||||||
memcpy(rawKey.data(), mem_ptr, length);
|
memcpy(rawKey.data(), mem_ptr, length);
|
||||||
@ -354,7 +362,15 @@ std::shared_ptr<SSLContext> SSLManager::loadContext(std::string &rawKey, std::st
|
|||||||
|
|
||||||
const uint8_t* mem_ptr{nullptr};
|
const uint8_t* mem_ptr{nullptr};
|
||||||
size_t length{0};
|
size_t length{0};
|
||||||
|
#ifdef CRYPTO_BORINGSSL
|
||||||
if(!BIO_mem_contents(&*bio_private_key, &mem_ptr, &length)) SSL_ERROR("Failed to get mem contents: ");
|
if(!BIO_mem_contents(&*bio_private_key, &mem_ptr, &length)) SSL_ERROR("Failed to get mem contents: ");
|
||||||
|
#else
|
||||||
|
BUF_MEM memory{};
|
||||||
|
if(!BIO_get_mem_ptr(&*bio_private_key, &memory)) SSL_ERROR("Failed to get mem contents: ");
|
||||||
|
|
||||||
|
mem_ptr = (uint8_t*) memory.data;
|
||||||
|
length = memory.length;
|
||||||
|
#endif
|
||||||
if(!mem_ptr || length < 0) SSL_ERROR("Could not get cert bio mem pointer/invalid length: ");
|
if(!mem_ptr || length < 0) SSL_ERROR("Could not get cert bio mem pointer/invalid length: ");
|
||||||
rawCert.reserve(length);
|
rawCert.reserve(length);
|
||||||
memcpy(rawCert.data(), mem_ptr, length);
|
memcpy(rawCert.data(), mem_ptr, length);
|
||||||
|
Loading…
Reference in New Issue
Block a user