diff --git a/license/LicenseServerMain.cpp b/license/LicenseServerMain.cpp index 93f7be8..099bddf 100644 --- a/license/LicenseServerMain.cpp +++ b/license/LicenseServerMain.cpp @@ -64,10 +64,21 @@ inline std::shared_ptr load_web_certificate() { return nullptr; } - if(!BIO_mem_contents(&*bio, &mem_ptr, &length)) { - logError(0, "Failed to receive memptr to private key"); - return nullptr; - } +#ifdef CRYPTO_BORINGSSL + if(!BIO_mem_contents(&*bio_private_key, &mem_ptr, &length)) { + logError(0, "Failed to receive memptr to private key"); + return nullptr; + } +#else + BUF_MEM* memory{nullptr}; + if(!BIO_get_mem_ptr(&*bio, &memory) || !memory) { + logError(0, "Failed to receive memptr to private key"); + return nullptr; + } + + mem_ptr = (uint8_t*) memory->data; + length = memory->length; +#endif key.resize(length); memcpy(key.data(), mem_ptr, length); } @@ -78,10 +89,21 @@ inline std::shared_ptr load_web_certificate() { logError(0, "Failed to export certificate"); return nullptr; } - if(!BIO_mem_contents(&*bio, &mem_ptr, &length)) { - logError(0, "Failed to receive memptr to certificate"); - return nullptr; - } +#ifdef CRYPTO_BORINGSSL + if(!BIO_mem_contents(&*bio_private_key, &mem_ptr, &length)) { + logError(0, "Failed to receive memptr to public key"); + return nullptr; + } +#else + BUF_MEM* memory{nullptr}; + if(!BIO_get_mem_ptr(&*bio, &memory) || !memory) { + logError(0, "Failed to receive memptr to public key"); + return nullptr; + } + + mem_ptr = (uint8_t*) memory->data; + length = memory->length; +#endif certificate.resize(length); memcpy(certificate.data(), mem_ptr, length); }