セキュアな接続をするには、SSL_CTX_load_verify_locationsで、信頼できる証明書ストアをロードする必要がある。
/docs/man1.0.2/ssl/SSL_CTX_load_verify_locations.html
SSL_CTX_load_verify_locations.cで、
SSL_CTX_load_verify_locationsにSSLコンテキストctxと、信頼できる証明書ストアのパスを指定している。
(OpenSSL API によるセキュア・プログラミング: 第 1 回 API の概要
ここだと、ソースにTrustStore.pemがあると書いてるが、ソースではなくyumでインストールしているせいか見当たらないので、とりあえず"/etc/pki/tls/cert.pem"にあるpemを使った。)
$ vi SSL_CTX_load_verify_locations.c $ gcc -o SSL_CTX_load_verify_locations SSL_CTX_load_verify_locations.c -lssl -lcrypto $ ./SSL_CTX_load_verify_locations ctx = 00de1820 SSL_CTX_load_verify_locations success! $
どうも成功した模様。