The usual way this is done, f.ex. in Apache, is that you use the CHAIN file to contain the intermediate cert, so that it can provide a path from leaf cert to root cert. SSL_CTX_use_certificate_chain_file() should be provided with the intermediate cert(s) in correct order. Would have to check some documentation somewhere whether it was from root or leaf up. The actual root certificate is not required to be on the chain file.
The usual way this is done, f.ex. in Apache, is that you use the CHAIN file to contain the intermediate cert, so that it can provide a path from leaf cert to root cert. SSL_CTX_ use_certificate _chain_ file() should be provided with the intermediate cert(s) in correct order. Would have to check some documentation somewhere whether it was from root or leaf up. The actual root certificate is not required to be on the chain file.