aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/mbedtls/mbedtls_Kalray.patch
blob: 8b271130575bc78b20f1c5ea564f2b2c0ed7850f (plain)
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
diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h
index f89bf9604..9f8a4faeb 100644
--- a/include/mbedtls/config.h
+++ b/include/mbedtls/config.h
@@ -1076,7 +1076,7 @@
  *
  * Enable functions that use the filesystem.
  */
-#define MBEDTLS_FS_IO
+// DMonniaux #define MBEDTLS_FS_IO
 
 /**
  * \def MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
@@ -1100,7 +1100,8 @@
  *
  * Uncomment this macro to disable the built-in platform entropy functions.
  */
-//#define MBEDTLS_NO_PLATFORM_ENTROPY
+//DMonniaux
+#define MBEDTLS_NO_PLATFORM_ENTROPY
 
 /**
  * \def MBEDTLS_ENTROPY_FORCE_SHA256
@@ -2441,7 +2442,7 @@
  *
  * This module provides networking routines.
  */
-#define MBEDTLS_NET_C
+// DMonniaux #define MBEDTLS_NET_C
 
 /**
  * \def MBEDTLS_OID_C
@@ -2838,7 +2839,7 @@
  *
  * This module is used by the HAVEGE random number generator.
  */
-#define MBEDTLS_TIMING_C
+// DMonniaux #define MBEDTLS_TIMING_C
 
 /**
  * \def MBEDTLS_VERSION_C
diff --git a/library/bignum.c b/library/bignum.c
index 87015af0c..a2bad7b84 100644
--- a/library/bignum.c
+++ b/library/bignum.c
@@ -1696,6 +1696,8 @@ cleanup:
     return( ret );
 }
 
+#define INT_DIV(x,y) (((long)(x)) / (y))
+
 /*
  * Modulo: r = A mod b
  */
@@ -1734,12 +1736,12 @@ int mbedtls_mpi_mod_int( mbedtls_mpi_uint *r, const mbedtls_mpi *A, mbedtls_mpi_
     {
         x  = A->p[i - 1];
         y  = ( y << biH ) | ( x >> biH );
-        z  = y / b;
+        z  = INT_DIV(y, b);
         y -= z * b;
 
         x <<= biH;
         y  = ( y << biH ) | ( x >> biH );
-        z  = y / b;
+        z  = INT_DIV(y, b);
         y -= z * b;
     }
 
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 8710a5076..e47c859fe 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -2482,6 +2482,8 @@ static int ssl_decompress_buf( mbedtls_ssl_context *ssl )
 }
 #endif /* MBEDTLS_ZLIB_SUPPORT */
 
+#define INT_DIV(x, y)  (((long)(x))/(y))
+
 #if defined(MBEDTLS_SSL_SRV_C) && defined(MBEDTLS_SSL_RENEGOTIATION)
 static int ssl_write_hello_request( mbedtls_ssl_context *ssl );
 
@@ -2492,7 +2494,7 @@ static int ssl_resend_hello_request( mbedtls_ssl_context *ssl )
      * timeout if we were using the usual handshake doubling scheme */
     if( ssl->conf->renego_max_records < 0 )
     {
-        uint32_t ratio = ssl->conf->hs_timeout_max / ssl->conf->hs_timeout_min + 1;
+      uint32_t ratio = INT_DIV(ssl->conf->hs_timeout_max, ssl->conf->hs_timeout_min + 1);
         unsigned char doublings = 1;
 
         while( ratio != 0 )
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function
index 1255ff4be..103abe9a8 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -40,10 +40,10 @@ typedef UINT32 uint32_t;
 #endif
 
 #include <string.h>
+#include <strings.h>
 
 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
 #include <unistd.h>
-#include <strings.h>
 #endif
 
 /* Type for Hex parameters */