Click here to Skip to main content
15,918,050 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I use another libssl.so library in a program that references libcrypto.so.10?

target os : centos 6.8

1. checking "a.out" target shared libraries
[root@centos69 cui]# ldd a.out
linux-vdso.so.1 => (0x00007ffe52fed000)
libdl.so.2 => /lib64/libdl.so.2 (0x000000358a200000)
libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x0000003594600000)
libc.so.6 => /lib64/libc.so.6 (0x0000003589a00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003589200000)
libz.so.1 => /lib64/libz.so.1 (0x0000003589600000)

2. Here is the code I wrote
VB
ssl = dlopen("/usr/local/my/libssl.so", RTLD_LAZY);//`  i wanna use!!!!
	if (!ssl) {
		fprintf(stderr, "%s\n", dlerror());
		exit(1);
	}

	hd1 = dlopen("/usr/lib64/libssl.so.10", RTLD_LAZY);
	if (!ssl) {
		fprintf(stderr, "%s\n", dlerror());
		exit(1);
	}

	SSL_library_init_1= (FN_SSL_LIBRARY_INIT) LibLoader_GetProcAddress(ssl, "SSL_library_init");
	printf("SSL_library_init_1 [%x]\n", SSL_library_init_1);
	SSL_library_init_1();//` Die!!!!!!

	SSL_library_init_2= (FN_SSL_LIBRARY_INIT) LibLoader_GetProcAddress(hd1, "SSL_library_init");
	printf("SSL_library_init_2 [%x]\n", SSL_library_init_2);
	SSL_library_init_2();


What I have tried:

How can I use another libssl.so library in a program that references libcrypto.so.10?
Posted
Updated 3-Jun-18 21:19pm
v2

1 solution

Why?

The goal of using shared libraries is that always the newest version is used. This should not be changed; especially for security relevant libraries like OpenSSL.

Using an older library with fixed version may make your application insecure or even not work anymore when the old version is removed by an update.

Also, both libraries belong to OpenSSL and depend on each other. So you can't use different versions. Just link with -lssl. libssl uses functions from libcrypto so that it is automatically included in the linking process.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900