我正在玩apps/s_client.c
in the openssl
源代码。我想进行一些更改并运行它,但是在保存文件并执行操作后,我的更改没有得到反映make all
, or a make
.
例如,我改变了sc_usage
函数为此:
BIO_printf(bio_err,"This is how you use s_client\n");
BIO_printf(bio_err,"usage: s_client args\n");
BIO_printf(bio_err,"\n");
BIO_printf(bio_err," -host host - use -connect instead\n");
BIO_printf(bio_err," -port port - use -connect instead\n");
然后我保存并执行make all
in the apps
文件夹,但是当我通过这样做运行程序时:openssl s_client abc
,我没有看到我介绍的那一行,this is how you use s_client
,在输出中。
我哪里错了?
我想进行一些更改并运行它,但在保存文件并执行 make all 或 make 后,我的更改没有得到反映。
一旦你了解了技巧,事情就变得更容易了。
- 正常配置 OpenSSL 库(
configure
)
- 正常构建 OpenSSL 库(
make depend && make
)
- 正常安装 OpenSSL 库(
sudo make install
)
- 进行更改
s_client.c
- Compile
s_client.c
到位(apps/
目录):
这是油脂。您必须构建一些额外的目标文件,例如apps.o
and apps_rand.o
, 支持s_client.o
.
export OPENSSLDIR=/usr/local/ssl/darwin
gcc -DOPENSSL_NO_PSK -DMONOLITH -I$OPENSSLDIR/include -I../ -c apps.c
gcc -DOPENSSL_NO_PSK -DMONOLITH -I$OPENSSLDIR/include -I../ -c app_rand.c
gcc -DOPENSSL_NO_PSK -DMONOLITH -I$OPENSSLDIR/include -I../ -c s_cb.c
gcc -DOPENSSL_NO_PSK -DMONOLITH -I$OPENSSLDIR/include -I../ -c s_socket.c
gcc -DOPENSSL_NO_PSK -I$OPENSSLDIR/include -I../ \
app_rand.o apps.o s_cb.o s_socket.o \
$OPENSSLDIR/lib/libssl.a $OPENSSLDIR/lib/libcrypto.a \
s_client.c -o my_s_client.exe
The OPENSSL_NO_PSK
之所以需要,是因为声明 (psk_key
)被注释掉了。这-I../
需要因为e_os.h
后未安装make install
。如果 OpenSSL 在发布之前真正测试了他们的东西,那肯定会很好......
Then:
$ ./my_s_client.exe -connect www.google.com:443
CONNECTED(00000003)
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
i:/C=US/O=Google Inc/CN=Google Internet Authority G2
...
无需重建整个库或所有应用程序。不需要openssl s_client ...
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)