From 10b76a9620b7407ffed8366d71f5463496f98838 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 30 Oct 2017 15:41:37 +1100 Subject: [PATCH] extmod/modussl_mbedtls: Allow to compile with unix coverage build. Fixes a few C warnings. No functional changes. --- extmod/modussl_mbedtls.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c index 59dceb6cff..69a64d2f7a 100644 --- a/extmod/modussl_mbedtls.c +++ b/extmod/modussl_mbedtls.c @@ -65,23 +65,30 @@ struct ssl_args { STATIC const mp_obj_type_t ussl_socket_type; -void mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) { +#ifdef MBEDTLS_DEBUG_C +STATIC void mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) { + (void)ctx; + (void)level; printf("DBG:%s:%04d: %s\n", file, line, str); } +#endif // TODO: FIXME! -int null_entropy_func(void *data, unsigned char *output, size_t len) { +STATIC int null_entropy_func(void *data, unsigned char *output, size_t len) { + (void)data; + (void)output; + (void)len; // enjoy random bytes return 0; } -int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) { +STATIC int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) { mp_obj_t sock = *(mp_obj_t*)ctx; const mp_stream_p_t *sock_stream = mp_get_stream_raise(sock, MP_STREAM_OP_WRITE); int err; - int out_sz = sock_stream->write(sock, buf, len, &err); + mp_uint_t out_sz = sock_stream->write(sock, buf, len, &err); if (out_sz == MP_STREAM_ERROR) { if (mp_is_nonblocking_error(err)) { return MBEDTLS_ERR_SSL_WANT_WRITE; @@ -92,13 +99,13 @@ int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) { } } -int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) { +STATIC int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) { mp_obj_t sock = *(mp_obj_t*)ctx; const mp_stream_p_t *sock_stream = mp_get_stream_raise(sock, MP_STREAM_OP_READ); int err; - int out_sz = sock_stream->read(sock, buf, len, &err); + mp_uint_t out_sz = sock_stream->read(sock, buf, len, &err); if (out_sz == MP_STREAM_ERROR) { if (mp_is_nonblocking_error(err)) { return MBEDTLS_ERR_SSL_WANT_READ;