Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
10b76a96
Commit
10b76a96
authored
Oct 30, 2017
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extmod/modussl_mbedtls: Allow to compile with unix coverage build.
Fixes a few C warnings. No functional changes.
parent
74ec52d8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
extmod/modussl_mbedtls.c
extmod/modussl_mbedtls.c
+13
-6
No files found.
extmod/modussl_mbedtls.c
View file @
10b76a96
...
...
@@ -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
;
in
t
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
;
in
t
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment