简体   繁体   English

OpenSSL SSL_read() 返回 0 而 SSL_get_error() 返回 6,我该怎么做才能解决这个问题?

[英]OpenSSL SSL_read() returns 0 and SSL_get_error() returns 6, what can I do to fix this?

I'm receiving data via an SSL connection and after several minutes SSL_read() returns 0 (I'm using blocking socket, so it shouldn't return 0) and then SSL_get_error() returns 6. However, I cannot find what 6 means and what I need to do to fix this?我通过 SSL 连接接收数据,几分钟后SSL_read()返回 0(我使用的是阻塞套接字,因此它不应该返回 0)然后SSL_get_error()返回 6。但是,我找不到 6 的含义我需要做什么来解决这个问题?

It's happening multiple times, each time it occurs several minutes after I establish connection.它发生了多次,每次都是在我建立连接后几分钟发生的。

As i'm only streaming data there's not much I can be doing wrong.因为我只是在传输数据,所以我不会做错太多。

Any advice how to log additional information on SSL problems?任何建议如何记录有关 SSL 问题的附加信息?

However, I cannot find what 6 means但是,我找不到 6 是什么意思

The relevant define's are in ssl.h:相关定义在 ssl.h 中:

$ grep  SSL_ERROR_ /usr/include/openssl/ssl.h 
# define SSL_ERROR_NONE                  0
...
# define SSL_ERROR_ZERO_RETURN           6
...

From the documentation on this error :有关此错误的文档中

SSL_ERROR_ZERO_RETURN SSL_ERROR_ZERO_RETURN
The TLS/SSL peer has closed the connection for writing by sending the close_notify alert. TLS/SSL 对等端已通过发送 close_notify 警报关闭写入连接。 No more data can be read.无法读取更多数据。 Note that SSL_ERROR_ZERO_RETURN does not necessarily indicate that the underlying transport has been closed.请注意,SSL_ERROR_ZERO_RETURN 不一定表示底层传输已关闭。

In other words: the peer did a shutdown of the TLS session. So this is not actually a SSL problem since the peer behaves how it is supposed when closing the SSL session.换句话说:对等点关闭了 TLS session。因此,这实际上不是 SSL 问题,因为对等点在关闭 SSL session 时的行为是预期的。

what I need to do to fix this?我需要做什么来解决这个问题?

It is unknown why the peer closes the connection but it unlikely has anything to do with SSL.不知道为什么对等方关闭连接,但它不太可能与 SSL 有任何关系。

Unfortunately there is nothing known about he peer or the application protocol you are using.不幸的是,关于他的对等点或您正在使用的应用程序协议一无所知。 So it is unclear how the peer should behave in the first place, ie if what you see is normal behavior and your expectations are wrong or if there is some problem at the peer.因此,首先不清楚对等点应该如何表现,即如果您看到的是正常行为而您的期望是错误的,或者对等点是否存在问题。

So first step for fixing would be to understand what application protocol is used here and if what you see might even be the expected behavior.因此,修复的第一步是了解此处使用的是什么应用程序协议,以及您看到的是否可能是预期的行为。 If this is not the case check any log files on the peer side or analyze the source code of the peer for bugs.如果不是这种情况,请检查对等方的任何日志文件或分析对等方的源代码以查找错误。

If you expect more help from the community please provide enough context about application protocol and the peer, so that ideally others can reproduce and thus debug what you see.如果您希望从社区获得更多帮助,请提供有关应用程序协议和对等方的足够上下文,以便理想情况下其他人可以重现并调试您所看到的内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SSL_read() 返回 0,SSL_get_error 返回 6。为什么在 SSL_read() 期间连接关闭? - SSL_read() returns 0 and SSL_get_error return 6. Why is connection shutdown during SSL_read()? 如何查找在跨数据包拆分响应时是否有更多数据要读取但SSL_pending为零并且SSL_get_error返回SSL_ERROR_NONE - How to find if there is more data to read when response is split across packets but SSL_pending is zero and SSL_get_error returns SSL_ERROR_NONE openssl ssl_read将读取的二进制数据发送到char * - openssl ssl_read sends read binary data into char* SSL_read未收到 - SSL_read not receiving SSL_read解密错误代码 - SSL_read decipher error code 如果我想使用非阻塞套接字调用SSL_shutdown(),我是否需要先保持调用SSL_read()直到产生SSL_ERROR_WANT_READ? - If I want to call SSL_shutdown() with non-blocking sockets, do I need to keep calling SSL_read() first until it yields SSL_ERROR_WANT_READ? OpenSSL非阻塞套接字SSL_read()不可预测 - OpenSSL Non-Blocking Socket SSL_read() unpredictable 在 openssl TLS1.3 中, SSL_write 会产生 SSL_ERROR_WANT_READ 吗? SSL_read 会产生 SSL_ERROR_WANT_WRITE 吗? - In openssl TLS1.3, will SSL_write yield SSL_ERROR_WANT_READ ? And will SSL_read yield SSL_ERROR_WANT_WRITE? 即使在 select() 以可读的服务器套接字返回后,客户端上的 SSL_read() 也会阻塞 - SSL_read() on client blocks even after select() returns with readable server socket OpenSSL:在没有SSL_read()/ SSL_write()的情况下执行en / / decryption - OpenSSL: perform en-/decryption without SSL_read() / SSL_write()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM