Files
xahaud/ssl_script.sh
Denis Angell 2a18ec563d Fix HBB workflow (#191)
* Update build-in-docker.yml

* Update build-in-docker.yml

* Update build-in-docker.yml

* Update build-core.sh

* update workflow

* Update build-core.sh

* Update build-core.sh

* Update build-core.sh

* Update build-core.sh

* update workflow

* fix workflow

* Update xahaud.binary.dockerfile

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* Update build-in-docker.yml
2023-11-09 12:20:51 +01:00

47 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
if [ "`grep certbundle.h src/ripple/net/impl/RegisterSSLCerts.cpp | wc -l`" -eq "0" ]
then
cp src/ripple/net/impl/RegisterSSLCerts.cpp src/ripple/net/impl/RegisterSSLCerts.cpp.old
perl -i -pe "s/^{/{
#ifdef EMBEDDED_CA_BUNDLE
BIO *cbio = BIO_new_mem_buf(ca_bundle.data(), ca_bundle.size());
X509_STORE *cts = SSL_CTX_get_cert_store(ctx.native_handle());
if(!cts || !cbio)
JLOG(j.warn())
<< \"Failed to create cts\/cbio when loading embedded certs.\";
else
{
X509_INFO *itmp;
int i, count = 0, type = X509_FILETYPE_PEM;
STACK_OF(X509_INFO) *inf = PEM_X509_INFO_read_bio(cbio, NULL, NULL, NULL);
if (!inf)
{
BIO_free(cbio);
JLOG(j.warn())
<< \"Failed to read cbio when loading embedded certs.\";
}
else
{
for (i = 0; i < sk_X509_INFO_num(inf); i++)
{
itmp = sk_X509_INFO_value(inf, i);
if (itmp->x509)
{
X509_STORE_add_cert(cts, itmp->x509);
count++;
}
if (itmp->crl)
{
X509_STORE_add_crl(cts, itmp->crl);
count++;
}
}
sk_X509_INFO_pop_free(inf, X509_INFO_free);
BIO_free(cbio);
}
}
#endif/g" src/ripple/net/impl/RegisterSSLCerts.cpp &&
sed -i "s/#include <ripple\/net\/RegisterSSLCerts.h>/\0\n#include <certs\/certbundle.h>/g" src/ripple/net/impl/RegisterSSLCerts.cpp
fi