This repository was archived by the owner on Mar 23, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathlibmbedtls-2.7.0.patch
More file actions
108 lines (98 loc) · 2.89 KB
/
libmbedtls-2.7.0.patch
File metadata and controls
108 lines (98 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h
index 79eedffd..7294a9da 100644
--- a/include/mbedtls/config.h
+++ b/include/mbedtls/config.h
@@ -435,7 +435,7 @@
*
* Uncomment to use your own hardware entropy collector.
*/
-//#define MBEDTLS_ENTROPY_HARDWARE_ALT
+#define MBEDTLS_ENTROPY_HARDWARE_ALT
/**
* \def MBEDTLS_AES_ROM_TABLES
@@ -944,7 +944,7 @@
*
* Uncomment this macro to disable the built-in platform entropy functions.
*/
-//#define MBEDTLS_NO_PLATFORM_ENTROPY
+#define MBEDTLS_NO_PLATFORM_ENTROPY
/**
* \def MBEDTLS_ENTROPY_FORCE_SHA256
@@ -1061,7 +1061,7 @@
*
* Enable the checkup functions (*_self_test).
*/
-#define MBEDTLS_SELF_TEST
+//#define MBEDTLS_SELF_TEST
/**
* \def MBEDTLS_SHA256_SMALLER
@@ -2531,7 +2531,7 @@
*
* This module is used by the HAVEGE random number generator.
*/
-#define MBEDTLS_TIMING_C
+//#define MBEDTLS_TIMING_C
/**
* \def MBEDTLS_VERSION_C
diff --git a/library/entropy.c b/library/entropy.c
index e17512e7..871f7863 100644
--- a/library/entropy.c
+++ b/library/entropy.c
@@ -123,6 +123,20 @@ void mbedtls_entropy_init( mbedtls_entropy_context *ctx )
#endif /* MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES */
}
+#define LIBCTRU
+#ifdef LIBCTRU
+ #include <3ds.h>
+ int mbedtls_hardware_poll( void *data,
+ unsigned char *output, size_t len, size_t *olen )
+ {
+ (void)(data);
+ sslcGenerateRandomData(output, len);
+ if(olen)
+ *olen = len;
+ return 0;
+ }
+#endif
+
void mbedtls_entropy_free( mbedtls_entropy_context *ctx )
{
#if defined(MBEDTLS_HAVEGE_C)
diff --git a/library/net_sockets.c b/library/net_sockets.c
index 345f1022..846e798d 100644
--- a/library/net_sockets.c
+++ b/library/net_sockets.c
@@ -27,11 +27,6 @@
#if defined(MBEDTLS_NET_C)
-#if !defined(unix) && !defined(__unix__) && !defined(__unix) && \
- !defined(__APPLE__) && !defined(_WIN32)
-#error "This module only works on Unix and Windows, see MBEDTLS_NET_C in config.h"
-#endif
-
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
@@ -271,7 +266,7 @@ static int net_would_block( const mbedtls_net_context *ctx )
static int net_would_block( const mbedtls_net_context *ctx )
{
int err = errno;
-
+
/*
* Never return 'WOULD BLOCK' on a non-blocking socket
*/
@@ -398,7 +393,7 @@ int mbedtls_net_accept( mbedtls_net_context *bind_ctx,
memcpy( client_ip, &addr4->sin_addr.s_addr, *ip_len );
}
- else
+ /* else
{
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *) &client_addr;
*ip_len = sizeof( addr6->sin6_addr.s6_addr );
@@ -407,7 +402,7 @@ int mbedtls_net_accept( mbedtls_net_context *bind_ctx,
return( MBEDTLS_ERR_NET_BUFFER_TOO_SMALL );
memcpy( client_ip, &addr6->sin6_addr.s6_addr, *ip_len);
- }
+ } */
}
return( 0 );