欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 房产 > 家装 > error: conflicting types for ‘SSL_SESSION_get_master_key’

error: conflicting types for ‘SSL_SESSION_get_master_key’

2025/2/22 16:59:54 来源:https://blog.csdn.net/fareast_mzh/article/details/145626407  浏览:    关键词:error: conflicting types for ‘SSL_SESSION_get_master_key’

$ make
make all-am
make[1]: Entering directory ‘/home/linuxuser/tor’
CC src/lib/tls/libtor_tls_a-tortls_openssl.o
In file included from src/lib/tls/tortls_openssl.c:61:
./src/lib/tls/tortls_internal.h:55:8: error: conflicting types for ‘SSL_SESSION_get_master_key’
55 | size_t SSL_SESSION_get_master_key(struct ssl_session_st *s,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/lib/tls/tortls_openssl.c:48:
/usr/local/ssl/include/openssl/ssl.h:2017:15: note: previous declaration of ‘SSL_SESSION_get_master_key’ was here
2017 | __owur size_t SSL_SESSION_get_master_key(const SSL_SESSION *sess,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib/tls/tortls_openssl.c: In function ‘find_cipher_by_id’:
src/lib/tls/tortls_openssl.c:780:21: error: unused variable ‘c’ [-Werror=unused-variable]
780 | const SSL_CIPHER *c;
| ^
src/lib/tls/tortls_openssl.c: In function ‘tor_tls_client_is_using_v2_ciphers’:
src/lib/tls/tortls_openssl.c:957:20: error: invalid use of incomplete typedef ‘SSL_SESSION’ {aka ‘struct ssl_session_st’}
957 | ciphers = session->ciphers;
| ^~
src/lib/tls/tortls_openssl.c: At top level:
src/lib/tls/tortls_openssl.c:1592:1: error: conflicting types for ‘SSL_get_client_random’
1592 | SSL_get_client_random(SSL *s, uint8_t *out, size_t len)
| ^~~~~~~~~~~~~~~~~~~~~

I was encountering OpenSSL-related type conflicts while compiling Tor. This is likely caused by an incompatibility between Tor’s code and the OpenSSL version installed on your system. Here’s how you can approach fixing this:

1. Check OpenSSL Version

Run:

openssl version

Tor expects OpenSSL 1.1.1 or 3.x, but if you’re using an incompatible version (e.g., OpenSSL 3.x with an older Tor version), it can cause these conflicts.

2. Verify OpenSSL Headers

Since you installed OpenSSL manually in /usr/local/ssl, double-check that you’re using the correct headers:

ls -l /usr/local/ssl/include/openssl/

Ensure that the ssl.h file matches the installed OpenSSL version.

3. Force Correct OpenSSL Paths in Compilation

Reconfigure Tor to use the correct OpenSSL paths by running:

export TOR_OPENSSL_CFLAGS='-I/usr/local/ssl/include'
export TOR_OPENSSL_LIBS='-L/usr/local/ssl/lib64 -lssl -lcrypto'
./configure --with-openssl-dir=/usr/local/ssl

Then, try compiling again:

make clean && make -j$(nproc)

4. Check for OpenSSL API Changes

The errors suggest that the SSL_SESSION_get_master_key function has different signatures in OpenSSL versions. If Tor is using an outdated declaration, you might need to patch it or use an older OpenSSL version.

You can check the function prototype in your OpenSSL headers:

grep -r "SSL_SESSION_get_master_key" /usr/local/ssl/include/openssl/

If it has changed, you may need to modify Tor’s source code (tortls_internal.h and tortls_openssl.c) to match the correct function signature.

5. Try an Older OpenSSL Version

If Tor is not yet compatible with your OpenSSL version, consider downgrading to OpenSSL 1.1.1:

cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz
tar xvf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl
make -j$(nproc)
make install

Then, recompile Tor with the updated OpenSSL.

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词