Skip to content

Commit c985b74

Browse files
committed
mbedTLS: Add patch to fix build errors with some MSVC versions
1 parent b2f425f commit c985b74

File tree

4 files changed

+118
-0
lines changed

4 files changed

+118
-0
lines changed

thirdparty/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,8 @@ File extracted from upstream release tarball:
532532
- The `LICENSE` file (edited to keep only the Apache 2.0 variant)
533533
- Applied the patch `no-flexible-arrays.diff` to fix Windows build (see
534534
upstream GH-9020)
535+
- Applied the patch `msvc-redeclaration-bug.diff` to fix a compilation error
536+
with some MSVC versions
535537
- Added 2 files `godot_core_mbedtls_platform.c` and `godot_core_mbedtls_config.h`
536538
providing configuration for light bundling with core
537539
- Added the file `godot_module_mbedtls_config.h` to customize the build

thirdparty/mbedtls/include/psa/crypto.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ psa_status_t psa_crypto_init(void);
107107

108108
/** Return an initial value for a key attributes structure.
109109
*/
110+
#if !(defined(__cplusplus) && defined(_MSC_VER))
110111
static psa_key_attributes_t psa_key_attributes_init(void);
112+
#endif
111113

112114
/** Declare a key as persistent and set its key identifier.
113115
*
@@ -333,7 +335,9 @@ static void psa_set_key_bits(psa_key_attributes_t *attributes,
333335
*
334336
* \return The key type stored in the attribute structure.
335337
*/
338+
#if !(defined(__cplusplus) && defined(_MSC_VER))
336339
static psa_key_type_t psa_get_key_type(const psa_key_attributes_t *attributes);
340+
#endif
337341

338342
/** Retrieve the key size from key attributes.
339343
*
@@ -936,7 +940,9 @@ typedef struct psa_hash_operation_s psa_hash_operation_t;
936940

937941
/** Return an initial value for a hash operation object.
938942
*/
943+
#if !(defined(__cplusplus) && defined(_MSC_VER))
939944
static psa_hash_operation_t psa_hash_operation_init(void);
945+
#endif
940946

941947
/** Set up a multipart hash operation.
942948
*
@@ -1295,7 +1301,9 @@ typedef struct psa_mac_operation_s psa_mac_operation_t;
12951301

12961302
/** Return an initial value for a MAC operation object.
12971303
*/
1304+
#if !(defined(__cplusplus) && defined(_MSC_VER))
12981305
static psa_mac_operation_t psa_mac_operation_init(void);
1306+
#endif
12991307

13001308
/** Set up a multipart MAC calculation operation.
13011309
*
@@ -1708,7 +1716,9 @@ typedef struct psa_cipher_operation_s psa_cipher_operation_t;
17081716

17091717
/** Return an initial value for a cipher operation object.
17101718
*/
1719+
#if !(defined(__cplusplus) && defined(_MSC_VER))
17111720
static psa_cipher_operation_t psa_cipher_operation_init(void);
1721+
#endif
17121722

17131723
/** Set the key for a multipart symmetric encryption operation.
17141724
*
@@ -2226,7 +2236,9 @@ typedef struct psa_aead_operation_s psa_aead_operation_t;
22262236

22272237
/** Return an initial value for an AEAD operation object.
22282238
*/
2239+
#if !(defined(__cplusplus) && defined(_MSC_VER))
22292240
static psa_aead_operation_t psa_aead_operation_init(void);
2241+
#endif
22302242

22312243
/** Set the key for a multipart authenticated encryption operation.
22322244
*
@@ -3213,7 +3225,9 @@ typedef struct psa_key_derivation_s psa_key_derivation_operation_t;
32133225

32143226
/** Return an initial value for a key derivation operation object.
32153227
*/
3228+
#if !(defined(__cplusplus) && defined(_MSC_VER))
32163229
static psa_key_derivation_operation_t psa_key_derivation_operation_init(void);
3230+
#endif
32173231

32183232
/** Set up a key derivation operation.
32193233
*

thirdparty/mbedtls/include/psa/crypto_extra.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,9 @@ typedef struct psa_pake_cipher_suite_s psa_pake_cipher_suite_t;
915915

916916
/** Return an initial value for a PAKE cipher suite object.
917917
*/
918+
#if !(defined(__cplusplus) && defined(_MSC_VER))
918919
static psa_pake_cipher_suite_t psa_pake_cipher_suite_init(void);
920+
#endif
919921

920922
/** Retrieve the PAKE algorithm from a PAKE cipher suite.
921923
*
@@ -1048,7 +1050,9 @@ typedef struct psa_jpake_computation_stage_s psa_jpake_computation_stage_t;
10481050

10491051
/** Return an initial value for a PAKE operation object.
10501052
*/
1053+
#if !(defined(__cplusplus) && defined(_MSC_VER))
10511054
static psa_pake_operation_t psa_pake_operation_init(void);
1055+
#endif
10521056

10531057
/** Get the length of the password in bytes from given inputs.
10541058
*
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
diff --git a/thirdparty/mbedtls/include/psa/crypto.h b/thirdparty/mbedtls/include/psa/crypto.h
2+
index 92f9c824e9..1cc2e7e729 100644
3+
--- a/thirdparty/mbedtls/include/psa/crypto.h
4+
+++ b/thirdparty/mbedtls/include/psa/crypto.h
5+
@@ -107,7 +107,9 @@ psa_status_t psa_crypto_init(void);
6+
7+
/** Return an initial value for a key attributes structure.
8+
*/
9+
+#if !(defined(__cplusplus) && defined(_MSC_VER))
10+
static psa_key_attributes_t psa_key_attributes_init(void);
11+
+#endif
12+
13+
/** Declare a key as persistent and set its key identifier.
14+
*
15+
@@ -333,7 +335,9 @@ static void psa_set_key_bits(psa_key_attributes_t *attributes,
16+
*
17+
* \return The key type stored in the attribute structure.
18+
*/
19+
+#if !(defined(__cplusplus) && defined(_MSC_VER))
20+
static psa_key_type_t psa_get_key_type(const psa_key_attributes_t *attributes);
21+
+#endif
22+
23+
/** Retrieve the key size from key attributes.
24+
*
25+
@@ -936,7 +940,9 @@ typedef struct psa_hash_operation_s psa_hash_operation_t;
26+
27+
/** Return an initial value for a hash operation object.
28+
*/
29+
+#if !(defined(__cplusplus) && defined(_MSC_VER))
30+
static psa_hash_operation_t psa_hash_operation_init(void);
31+
+#endif
32+
33+
/** Set up a multipart hash operation.
34+
*
35+
@@ -1295,7 +1301,9 @@ typedef struct psa_mac_operation_s psa_mac_operation_t;
36+
37+
/** Return an initial value for a MAC operation object.
38+
*/
39+
+#if !(defined(__cplusplus) && defined(_MSC_VER))
40+
static psa_mac_operation_t psa_mac_operation_init(void);
41+
+#endif
42+
43+
/** Set up a multipart MAC calculation operation.
44+
*
45+
@@ -1708,7 +1716,9 @@ typedef struct psa_cipher_operation_s psa_cipher_operation_t;
46+
47+
/** Return an initial value for a cipher operation object.
48+
*/
49+
+#if !(defined(__cplusplus) && defined(_MSC_VER))
50+
static psa_cipher_operation_t psa_cipher_operation_init(void);
51+
+#endif
52+
53+
/** Set the key for a multipart symmetric encryption operation.
54+
*
55+
@@ -2226,7 +2236,9 @@ typedef struct psa_aead_operation_s psa_aead_operation_t;
56+
57+
/** Return an initial value for an AEAD operation object.
58+
*/
59+
+#if !(defined(__cplusplus) && defined(_MSC_VER))
60+
static psa_aead_operation_t psa_aead_operation_init(void);
61+
+#endif
62+
63+
/** Set the key for a multipart authenticated encryption operation.
64+
*
65+
@@ -3213,7 +3225,9 @@ typedef struct psa_key_derivation_s psa_key_derivation_operation_t;
66+
67+
/** Return an initial value for a key derivation operation object.
68+
*/
69+
+#if !(defined(__cplusplus) && defined(_MSC_VER))
70+
static psa_key_derivation_operation_t psa_key_derivation_operation_init(void);
71+
+#endif
72+
73+
/** Set up a key derivation operation.
74+
*
75+
diff --git a/thirdparty/mbedtls/include/psa/crypto_extra.h b/thirdparty/mbedtls/include/psa/crypto_extra.h
76+
index 6ed1f6c43a..2686b9d74d 100644
77+
--- a/thirdparty/mbedtls/include/psa/crypto_extra.h
78+
+++ b/thirdparty/mbedtls/include/psa/crypto_extra.h
79+
@@ -915,7 +915,9 @@ typedef struct psa_pake_cipher_suite_s psa_pake_cipher_suite_t;
80+
81+
/** Return an initial value for a PAKE cipher suite object.
82+
*/
83+
+#if !(defined(__cplusplus) && defined(_MSC_VER))
84+
static psa_pake_cipher_suite_t psa_pake_cipher_suite_init(void);
85+
+#endif
86+
87+
/** Retrieve the PAKE algorithm from a PAKE cipher suite.
88+
*
89+
@@ -1048,7 +1050,9 @@ typedef struct psa_jpake_computation_stage_s psa_jpake_computation_stage_t;
90+
91+
/** Return an initial value for a PAKE operation object.
92+
*/
93+
+#if !(defined(__cplusplus) && defined(_MSC_VER))
94+
static psa_pake_operation_t psa_pake_operation_init(void);
95+
+#endif
96+
97+
/** Get the length of the password in bytes from given inputs.
98+
*

0 commit comments

Comments
 (0)