Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
d06af898
Commit
d06af898
authored
Jan 13, 2020
by
Fabio Alessandrelli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move mbedlts print func to SSLMbedTLSContext.
parent
c4f6ab85
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
ssl_context_mbedtls.cpp
modules/mbedtls/ssl_context_mbedtls.cpp
+5
-0
ssl_context_mbedtls.h
modules/mbedtls/ssl_context_mbedtls.h
+2
-0
stream_peer_mbedtls.cpp
modules/mbedtls/stream_peer_mbedtls.cpp
+4
-9
No files found.
modules/mbedtls/ssl_context_mbedtls.cpp
View file @
d06af898
...
@@ -38,6 +38,11 @@ static void my_debug(void *ctx, int level,
...
@@ -38,6 +38,11 @@ static void my_debug(void *ctx, int level,
fflush
(
stdout
);
fflush
(
stdout
);
}
}
void
SSLContextMbedTLS
::
print_mbedtls_error
(
int
p_ret
)
{
printf
(
"mbedtls error: returned -0x%x
\n\n
"
,
-
p_ret
);
fflush
(
stdout
);
}
Error
SSLContextMbedTLS
::
_setup
(
int
p_endpoint
,
int
p_transport
,
int
p_authmode
)
{
Error
SSLContextMbedTLS
::
_setup
(
int
p_endpoint
,
int
p_transport
,
int
p_authmode
)
{
ERR_FAIL_COND_V_MSG
(
inited
,
ERR_ALREADY_IN_USE
,
"This SSL context is already active"
);
ERR_FAIL_COND_V_MSG
(
inited
,
ERR_ALREADY_IN_USE
,
"This SSL context is already active"
);
...
...
modules/mbedtls/ssl_context_mbedtls.h
View file @
d06af898
...
@@ -51,6 +51,8 @@ protected:
...
@@ -51,6 +51,8 @@ protected:
static
PoolByteArray
_read_file
(
String
p_path
);
static
PoolByteArray
_read_file
(
String
p_path
);
public
:
public
:
static
void
print_mbedtls_error
(
int
p_ret
);
Ref
<
X509CertificateMbedTLS
>
certs
;
Ref
<
X509CertificateMbedTLS
>
certs
;
mbedtls_entropy_context
entropy
;
mbedtls_entropy_context
entropy
;
mbedtls_ctr_drbg_context
ctr_drbg
;
mbedtls_ctr_drbg_context
ctr_drbg
;
...
...
modules/mbedtls/stream_peer_mbedtls.cpp
View file @
d06af898
...
@@ -33,11 +33,6 @@
...
@@ -33,11 +33,6 @@
#include "core/io/stream_peer_tcp.h"
#include "core/io/stream_peer_tcp.h"
#include "core/os/file_access.h"
#include "core/os/file_access.h"
void
_print_error
(
int
ret
)
{
printf
(
"mbedtls error: returned -0x%x
\n\n
"
,
-
ret
);
fflush
(
stdout
);
}
int
StreamPeerMbedTLS
::
bio_send
(
void
*
ctx
,
const
unsigned
char
*
buf
,
size_t
len
)
{
int
StreamPeerMbedTLS
::
bio_send
(
void
*
ctx
,
const
unsigned
char
*
buf
,
size_t
len
)
{
if
(
buf
==
NULL
||
len
<=
0
)
return
0
;
if
(
buf
==
NULL
||
len
<=
0
)
return
0
;
...
@@ -89,7 +84,7 @@ Error StreamPeerMbedTLS::_do_handshake() {
...
@@ -89,7 +84,7 @@ Error StreamPeerMbedTLS::_do_handshake() {
if
(
ret
!=
MBEDTLS_ERR_SSL_WANT_READ
&&
ret
!=
MBEDTLS_ERR_SSL_WANT_WRITE
)
{
if
(
ret
!=
MBEDTLS_ERR_SSL_WANT_READ
&&
ret
!=
MBEDTLS_ERR_SSL_WANT_WRITE
)
{
// An error occurred.
// An error occurred.
ERR_PRINT
(
"TLS handshake error: "
+
itos
(
ret
));
ERR_PRINT
(
"TLS handshake error: "
+
itos
(
ret
));
_print
_error
(
ret
);
SSLContextMbedTLS
::
print_mbedtls
_error
(
ret
);
disconnect_from_stream
();
disconnect_from_stream
();
status
=
STATUS_ERROR
;
status
=
STATUS_ERROR
;
return
FAILED
;
return
FAILED
;
...
@@ -188,7 +183,7 @@ Error StreamPeerMbedTLS::put_partial_data(const uint8_t *p_data, int p_bytes, in
...
@@ -188,7 +183,7 @@ Error StreamPeerMbedTLS::put_partial_data(const uint8_t *p_data, int p_bytes, in
disconnect_from_stream
();
disconnect_from_stream
();
return
ERR_FILE_EOF
;
return
ERR_FILE_EOF
;
}
else
if
(
ret
<=
0
)
{
}
else
if
(
ret
<=
0
)
{
_print
_error
(
ret
);
SSLContextMbedTLS
::
print_mbedtls
_error
(
ret
);
disconnect_from_stream
();
disconnect_from_stream
();
return
ERR_CONNECTION_ERROR
;
return
ERR_CONNECTION_ERROR
;
}
}
...
@@ -233,7 +228,7 @@ Error StreamPeerMbedTLS::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r
...
@@ -233,7 +228,7 @@ Error StreamPeerMbedTLS::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r
disconnect_from_stream
();
disconnect_from_stream
();
return
ERR_FILE_EOF
;
return
ERR_FILE_EOF
;
}
else
if
(
ret
<=
0
)
{
}
else
if
(
ret
<=
0
)
{
_print
_error
(
ret
);
SSLContextMbedTLS
::
print_mbedtls
_error
(
ret
);
disconnect_from_stream
();
disconnect_from_stream
();
return
ERR_CONNECTION_ERROR
;
return
ERR_CONNECTION_ERROR
;
}
}
...
@@ -264,7 +259,7 @@ void StreamPeerMbedTLS::poll() {
...
@@ -264,7 +259,7 @@ void StreamPeerMbedTLS::poll() {
disconnect_from_stream
();
disconnect_from_stream
();
return
;
return
;
}
else
if
(
ret
<
0
)
{
}
else
if
(
ret
<
0
)
{
_print
_error
(
ret
);
SSLContextMbedTLS
::
print_mbedtls
_error
(
ret
);
disconnect_from_stream
();
disconnect_from_stream
();
return
;
return
;
}
}
...
...
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