@@ -65,23 +65,30 @@ struct ssl_args {
65
65
66
66
STATIC const mp_obj_type_t ussl_socket_type ;
67
67
68
- void mbedtls_debug (void * ctx , int level , const char * file , int line , const char * str ) {
68
+ #ifdef MBEDTLS_DEBUG_C
69
+ STATIC void mbedtls_debug (void * ctx , int level , const char * file , int line , const char * str ) {
70
+ (void )ctx ;
71
+ (void )level ;
69
72
printf ("DBG:%s:%04d: %s\n" , file , line , str );
70
73
}
74
+ #endif
71
75
72
76
// TODO: FIXME!
73
- int null_entropy_func (void * data , unsigned char * output , size_t len ) {
77
+ STATIC int null_entropy_func (void * data , unsigned char * output , size_t len ) {
78
+ (void )data ;
79
+ (void )output ;
80
+ (void )len ;
74
81
// enjoy random bytes
75
82
return 0 ;
76
83
}
77
84
78
- int _mbedtls_ssl_send (void * ctx , const byte * buf , size_t len ) {
85
+ STATIC int _mbedtls_ssl_send (void * ctx , const byte * buf , size_t len ) {
79
86
mp_obj_t sock = * (mp_obj_t * )ctx ;
80
87
81
88
const mp_stream_p_t * sock_stream = mp_get_stream_raise (sock , MP_STREAM_OP_WRITE );
82
89
int err ;
83
90
84
- int out_sz = sock_stream -> write (sock , buf , len , & err );
91
+ mp_uint_t out_sz = sock_stream -> write (sock , buf , len , & err );
85
92
if (out_sz == MP_STREAM_ERROR ) {
86
93
if (mp_is_nonblocking_error (err )) {
87
94
return MBEDTLS_ERR_SSL_WANT_WRITE ;
@@ -92,13 +99,13 @@ int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
92
99
}
93
100
}
94
101
95
- int _mbedtls_ssl_recv (void * ctx , byte * buf , size_t len ) {
102
+ STATIC int _mbedtls_ssl_recv (void * ctx , byte * buf , size_t len ) {
96
103
mp_obj_t sock = * (mp_obj_t * )ctx ;
97
104
98
105
const mp_stream_p_t * sock_stream = mp_get_stream_raise (sock , MP_STREAM_OP_READ );
99
106
int err ;
100
107
101
- int out_sz = sock_stream -> read (sock , buf , len , & err );
108
+ mp_uint_t out_sz = sock_stream -> read (sock , buf , len , & err );
102
109
if (out_sz == MP_STREAM_ERROR ) {
103
110
if (mp_is_nonblocking_error (err )) {
104
111
return MBEDTLS_ERR_SSL_WANT_READ ;
0 commit comments