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.