在SSL_do_handshake

时间:2015-06-07 07:55:48

标签: openssl

  ......
  SSL_set_bio(mSsl, rbio, wbio);
  ......
  BIO* rBio0 = SSL_get_rbio(mSsl);
  BIO* wBio0 = SSL_get_wbio(mSsl);
  printf("xxxxxxxxxxx get0 write %p\n", wBio0);
  printf("xxxxxxxxxxx get0 read %p\n", rBio0);
  int r = SSL_do_handshake(mSsl);
  BIO* rBio1 = SSL_get_rbio(mSsl);
  BIO* wBio1 = SSL_get_wbio(mSsl);
  printf("xxxxxxxxxxx get1 write %p\n", wBio1);
  printf("xxxxxxxxxxx get1 read %p\n", rBio1);

使用BIO_new(BIO_s_mem())生成此2 bio,运行包含此代码段的已编译代码后,在我的终端中打印出以下内容:

xxxxxxxxxxx get0 write 0xc18800
xxxxxxxxxxx get0 read 0xc16730
xxxxxxxxxxx get1 write 0xc27f80
xxxxxxxxxxx get1 read 0xc16730

这是正常的吗?

在此片段之后,我想使用BIO_get_mem_data从内存中获取数据并将其发送到远程,因为写入生物已更改,我无法获取数据。

BTW,我以前用2个全局变量来存储写生物和阅读生物,一切运作良好。

0 个答案:

没有答案