加载OpenSSL的方法顺序正确吗?

时间:2018-10-01 22:54:37

标签: c openssl

OpenSSL中有几种初始化方法

OpenSSL_add_all_algorithms(); /* Load cryptos, et.al. */
SSL_load_error_strings();     /* Bring in and register error messages */
SSL_library_init();

如果我使用TLS,是否有特定的调用顺序?

1 个答案:

答案 0 :(得分:1)

这个问题还有些模糊:

SSL_load_error_strings()OpenSSL_add_all_algorithms()的顺序在技术上并不重要。

如果您使用的是OpenSSL 1.1.0或更高版本,则完全不需要调用OpenSSL_add_all_algorithms()The function has been deprecated and superseded by OPENSSL_init_crypto().

This建议按以下顺序执行初始化:

[first, set up threading callbacks if your program is multithreaded]
SSL_load_error_strings ();
SSL_library_init ();
OpenSSL_add_all_algorithms ();
OPENSSL_config (NULL);

您可能还想查看OpenSSL Wiki on initialization

中的内容