Skip to content

Commit

Permalink
ssl/tls1.c: If underlying stream returned EAGAIN, return SSL_EAGAIN.
Browse files Browse the repository at this point in the history
This helps better implement blocking vs non-blocking streams on top of
axTLS (e.g. in MicroPython). Value of SSL_EAGAIN is -4, care was taken
to make sure there's no TLS alert with value of 4 (because axTLS returns
negated alert values as errors).
  • Loading branch information
pfalcon committed Oct 29, 2017
1 parent 9b3092e commit dac9176
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions ssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ extern "C" {
#define SSL_NOT_OK -1
#define SSL_ERROR_DEAD -2
#define SSL_CLOSE_NOTIFY -3
#define SSL_EAGAIN -4
#define SSL_ERROR_CONN_LOST -256
#define SSL_ERROR_RECORD_OVERFLOW -257
#define SSL_ERROR_SOCK_SETUP_FAILURE -258
Expand Down
2 changes: 1 addition & 1 deletion ssl/tls1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ int basic_read(SSL *ssl, uint8_t **in_data)
#else
if (SOCKET_ERRNO() == EAGAIN || SOCKET_ERRNO() == EWOULDBLOCK)
#endif
return 0;
return SSL_EAGAIN;
}

/* connection has gone, so die */
Expand Down

0 comments on commit dac9176

Please sign in to comment.