ERR_print_errors_fpにファイルポインタを指定すると、そのストリームにOpenSSLのエラーメッセージを書き込む。
/docs/man1.1.0/crypto/ERR_print_errors_fp.html
ERR_print_errors_fp.cで、
SSL_CTX_load_verify_locationsで"dummyurl"という存在しないパスを指定し、わざとエラーを起こす。
ERR_print_errors_fpにstderrを指定し、エラーメッセージを標準エラー出力に出力するようにする。
$ vi ERR_print_errors_fp.c $ gcc -o ERR_print_errors_fp ERR_print_errors_fp.c -lssl -lcrypto $ ./ERR_print_errors_fp ctx = 01cdf820 SSL_CTX_load_verify_locations error! 140164446353304:error:02001002:lib(2):func(1):reason(2):bss_file.c:175:fopen('dummyurl','r') 140164446353304:error:2006D080:lib(32):func(109):reason(128):bss_file.c:182: 140164446353304:error:0B084002:lib(11):func(132):reason(2):by_file.c:258: $
とはいえ、これだけだと、さっぱりわからない。