Skip to content

lws/openssl-wrapper: Align ssl_handshake and openssl standard return values#3441

Open
ThePassionate wants to merge 3 commits intowarmcat:mainfrom
ThePassionate:returncode-sslconnect
Open

lws/openssl-wrapper: Align ssl_handshake and openssl standard return values#3441
ThePassionate wants to merge 3 commits intowarmcat:mainfrom
ThePassionate:returncode-sslconnect

Conversation

@ThePassionate
Copy link
Copy Markdown
Contributor

https://docs.openssl.org/1.0.2/man3/SSL_do_handshake/#return-values
standard return code of ssl_handshake list following:
0:
The TLS/SSL handshake was not successful but was shut down controlled and by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the return value ret to find out the reason.

1:
The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been established.

<0:
The TLS/SSL handshake was not successful because a fatal error occurred either at the protocol level or a connection failure occurred. The shutdown was not clean. It can also occur of action is need to continue the operation for non-blocking BIOs. Call SSL_get_error() with the return value ret to find out the reason.

so ssl_error_read/write should return -1.
Also mapping ssl->err from mbedtls error to openssl error, not return mbedtls error directly.

lws-team and others added 3 commits August 13, 2025 11:05
Co-developed-by: Gemini 2.5 Pro
…values

standard return code of ssl_handshake list following:
0
The TLS/SSL handshake was not successful but was shut down controlled and by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the return value ret to find out the reason.

1
The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been established.

<0
The TLS/SSL handshake was not successful because a fatal error occurred either at the protocol level or a connection failure occurred. The shutdown was not clean. It can also occur of action is need to continue the operation for non-blocking BIOs. Call SSL_get_error() with the return value ret to find out the reason.

so ssl_error_read/write should return -1.
Signed-off-by: makejian <makejian@xiaomi.com>
@lws-team
Copy link
Copy Markdown
Member

I notice that we change the return code meaning, but we don't adapt the caller. Since mbedtls works today, are we sure that is a good idea?

@lws-team lws-team force-pushed the main branch 7 times, most recently from 37dca44 to b4c7439 Compare August 21, 2025 06:24
@lws-team lws-team force-pushed the main branch 6 times, most recently from c5ef352 to 46b045e Compare August 24, 2025 18:51
@lws-team lws-team force-pushed the main branch 8 times, most recently from 1faedc3 to efb9f35 Compare September 6, 2025 03:47
@lws-team lws-team force-pushed the main branch 3 times, most recently from a0c73c1 to 7c9d4bc Compare September 9, 2025 14:28
@lws-team lws-team force-pushed the main branch 2 times, most recently from 217e720 to 4f15c21 Compare September 14, 2025 07:52
@lws-team lws-team force-pushed the main branch 2 times, most recently from 2b74af4 to 5f77374 Compare October 12, 2025 10:02
@lws-team lws-team force-pushed the main branch 5 times, most recently from a677221 to 0c67054 Compare October 24, 2025 16:36
@lws-team lws-team force-pushed the main branch 2 times, most recently from f5fa440 to 278c671 Compare November 6, 2025 08:28
@lws-team lws-team force-pushed the main branch 2 times, most recently from 580b993 to c837e3f Compare December 29, 2025 15:24
@lws-team lws-team force-pushed the main branch 9 times, most recently from 260929d to f06bf53 Compare January 25, 2026 20:25
@lws-team lws-team force-pushed the main branch 4 times, most recently from fb3f410 to d8c745e Compare February 4, 2026 16:59
@lws-team lws-team force-pushed the main branch 6 times, most recently from de6b829 to 73d7e58 Compare March 1, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants