本文介绍了使用SSL动态库时出现问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在引用libcrypto.so.10的程序中使用另一个libssl.so库?



目标os:centos 6.8



1.检查a.out目标共享库

[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.这是我写的代码

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

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();





我尝试过:



如何在引用libcrypto.so.10的程序中使用另一个libssl.so库?



What I have tried:

How can I use another libssl.so library in a program that references libcrypto.so.10?

推荐答案


这篇关于使用SSL动态库时出现问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 04:20