Fixed openssl incompatibility
This commit is contained in:
parent
5a740e1853
commit
e78b900937
@ -64,10 +64,21 @@ inline std::shared_ptr<WebCertificate> 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<WebCertificate> 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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user