Skip to content

Commit

Permalink
Allow to compile both mbedtls 3.5.2 and 3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shirok committed Jun 28, 2024
1 parent dcbc10d commit 1b4bfdf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ext/tls/tls-mbed.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,10 @@ static ScmObj mbed_read(ScmTLS *tls)
do {
int r = mbedtls_ssl_read(&t->ctx, buf+nread, sizeof(buf));
if (r == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) return SCM_EOF;
if (r == MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET) continue;
if (r == MBEDTLS_ERR_SSL_WANT_READ) continue;
#if defined(MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET)
if (r == MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET) continue;
#endif
if (r < 0) mbed_error("mbedtls_ssl_read() failed: %s (%d)", r);
nread += r;
} while (nread == 0);
Expand All @@ -341,8 +343,10 @@ static ScmObj mbed_write(ScmTLS *tls, ScmObj msg)
int nsent = 0;
do {
int r = mbedtls_ssl_write(&t->ctx, cmsg+nsent, size-nsent);
if (r == MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET) continue;
if (r == MBEDTLS_ERR_SSL_WANT_WRITE) continue;
#if defined(MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET)
if (r == MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET) continue;
#endif
if (r < 0) mbed_error("mbedtls_ssl_write() failed: %s (%d)", r);
nsent += r;
} while (nsent < size);
Expand Down

0 comments on commit 1b4bfdf

Please sign in to comment.