Skip to content

Commit e186531

Browse files
committed
Fixed preprocessor symbol clash MP_INT_SIZE
1 parent b131ae5 commit e186531

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

src/xmalloc.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -106,32 +106,32 @@ struct xmalloc_slot {
106106
#endif
107107
#else
108108
/* TFM */
109-
#define MP_INT_SIZE ((sizeof (fp_int)))
109+
#define MP_INT_TYPE_SIZE ((sizeof (fp_int)))
110110
#ifdef WOLFBOOT_SIGN_ECC256
111-
#define MP_CURVE_SPECS_SIZE (MP_INT_SIZE)
111+
#define MP_CURVE_SPECS_SIZE (MP_INT_TYPE_SIZE)
112112
#define MP_CURVE_FIELD_COUNT_SIZE (380)
113113
#define ECC_POINT_SIZE (228)
114-
#define MP_INT_BUFFER_SIZE (MP_INT_SIZE * 6)
114+
#define MP_INT_BUFFER_SIZE (MP_INT_TYPE_SIZE * 6)
115115
#define MP_DIGIT_BUFFER_MONT_SIZE (sizeof(fp_digit)*(FP_SIZE + 1))
116116
#endif
117117
#ifdef WOLFBOOT_SIGN_ECC384
118-
#define MP_CURVE_SPECS_SIZE (MP_INT_SIZE)
118+
#define MP_CURVE_SPECS_SIZE (MP_INT_TYPE_SIZE)
119119
#define MP_CURVE_FIELD_COUNT_SIZE (380)
120120
#define ECC_POINT_SIZE (408)
121-
#define MP_INT_BUFFER_SIZE (MP_INT_SIZE * 5)
122-
#define MP_INT_BUFFER_SIZE_1 (MP_INT_SIZE * 6)
121+
#define MP_INT_BUFFER_SIZE (MP_INT_TYPE_SIZE * 5)
122+
#define MP_INT_BUFFER_SIZE_1 (MP_INT_TYPE_SIZE * 6)
123123
#define MP_DIGIT_BUFFER_MONT_SIZE (sizeof(fp_digit)*(FP_SIZE + 1))
124124
#endif
125125

126126
static uint8_t mp_curve_field_count[MP_CURVE_FIELD_COUNT_SIZE];
127-
static uint8_t mp_int_v[MP_INT_SIZE];
128-
static uint8_t mp_int_w[MP_INT_SIZE];
129-
static uint8_t mp_int_u1[MP_INT_SIZE];
130-
static uint8_t mp_int_u2[MP_INT_SIZE];
131-
static uint8_t mp_int_t[MP_INT_SIZE];
132-
static uint8_t mp_int_tmp0[MP_INT_SIZE];
133-
static uint8_t mp_int_tmp1[MP_INT_SIZE];
134-
static uint8_t mp_int_q[MP_INT_SIZE * 5];
127+
static uint8_t mp_int_v[MP_INT_TYPE_SIZE];
128+
static uint8_t mp_int_w[MP_INT_TYPE_SIZE];
129+
static uint8_t mp_int_u1[MP_INT_TYPE_SIZE];
130+
static uint8_t mp_int_u2[MP_INT_TYPE_SIZE];
131+
static uint8_t mp_int_t[MP_INT_TYPE_SIZE];
132+
static uint8_t mp_int_tmp0[MP_INT_TYPE_SIZE];
133+
static uint8_t mp_int_tmp1[MP_INT_TYPE_SIZE];
134+
static uint8_t mp_int_q[MP_INT_TYPE_SIZE * 5];
135135
static uint8_t ecc_point0[ECC_POINT_SIZE];
136136
static uint8_t ecc_point1[ECC_POINT_SIZE];
137137
static uint8_t ecc_point2[ECC_POINT_SIZE];
@@ -176,14 +176,14 @@ static struct xmalloc_slot xmalloc_pool[] = {
176176
#endif
177177
#else
178178
{ mp_curve_field_count, MP_CURVE_FIELD_COUNT_SIZE, 0},
179-
{ mp_int_v, MP_INT_SIZE, 0},
180-
{ mp_int_w, MP_INT_SIZE, 0},
181-
{ mp_int_u1, MP_INT_SIZE, 0},
182-
{ mp_int_u2, MP_INT_SIZE, 0},
183-
{ mp_int_t, MP_INT_SIZE, 0},
184-
{ mp_int_tmp0, MP_INT_SIZE, 0},
185-
{ mp_int_tmp1, MP_INT_SIZE, 0},
186-
{ mp_int_q, MP_INT_SIZE * 5, 0},
179+
{ mp_int_v, MP_INT_TYPE_SIZE, 0},
180+
{ mp_int_w, MP_INT_TYPE_SIZE, 0},
181+
{ mp_int_u1, MP_INT_TYPE_SIZE, 0},
182+
{ mp_int_u2, MP_INT_TYPE_SIZE, 0},
183+
{ mp_int_t, MP_INT_TYPE_SIZE, 0},
184+
{ mp_int_tmp0, MP_INT_TYPE_SIZE, 0},
185+
{ mp_int_tmp1, MP_INT_TYPE_SIZE, 0},
186+
{ mp_int_q, MP_INT_TYPE_SIZE * 5, 0},
187187
{ ecc_point0, ECC_POINT_SIZE, 0},
188188
{ ecc_point1, ECC_POINT_SIZE, 0},
189189
{ ecc_point2, ECC_POINT_SIZE, 0},
@@ -282,23 +282,23 @@ static uint32_t sha_block[HASH_BLOCK_SIZE];
282282
{ NULL, 0, 0}
283283
};
284284
#else
285-
#define MP_INT_SIZE (sizeof(mp_int))
285+
#define MP_INT_TYPE_SIZE (sizeof(mp_int))
286286
#define MP_MONT_REDUCE_BUF_SIZE (sizeof(fp_digit)*(FP_SIZE + 1))
287-
static uint8_t mp_int_buffer0[MP_INT_SIZE];
288-
static uint8_t mp_int_buffer1[MP_INT_SIZE * 3];
289-
static uint8_t mp_int_buffer2[MP_INT_SIZE];
290-
static uint8_t mp_int_buffer3[MP_INT_SIZE];
291-
static uint8_t mp_int_buffer4[MP_INT_SIZE * 5];
287+
static uint8_t mp_int_buffer0[MP_INT_TYPE_SIZE];
288+
static uint8_t mp_int_buffer1[MP_INT_TYPE_SIZE * 3];
289+
static uint8_t mp_int_buffer2[MP_INT_TYPE_SIZE];
290+
static uint8_t mp_int_buffer3[MP_INT_TYPE_SIZE];
291+
static uint8_t mp_int_buffer4[MP_INT_TYPE_SIZE * 5];
292292
static uint8_t mp_mont_reduce_buffer[MP_MONT_REDUCE_BUF_SIZE];
293293
static struct xmalloc_slot xmalloc_pool[] = {
294294
#if defined(WOLFBOOT_HASH_SHA256) || defined(WOLFBOOT_HASH_SHA384)
295295
{ (uint8_t *)sha_block, HASH_BLOCK_SIZE * sizeof(uint32_t), 0 },
296296
#endif
297-
{ mp_int_buffer0, MP_INT_SIZE, 0},
298-
{ mp_int_buffer1, MP_INT_SIZE * 3, 0},
299-
{ mp_int_buffer2, MP_INT_SIZE, 0},
300-
{ mp_int_buffer3, MP_INT_SIZE, 0},
301-
{ mp_int_buffer4, MP_INT_SIZE * 5, 0},
297+
{ mp_int_buffer0, MP_INT_TYPE_SIZE, 0},
298+
{ mp_int_buffer1, MP_INT_TYPE_SIZE * 3, 0},
299+
{ mp_int_buffer2, MP_INT_TYPE_SIZE, 0},
300+
{ mp_int_buffer3, MP_INT_TYPE_SIZE, 0},
301+
{ mp_int_buffer4, MP_INT_TYPE_SIZE * 5, 0},
302302
{ mp_mont_reduce_buffer, MP_MONT_REDUCE_BUF_SIZE, 0 },
303303
{ NULL, 0, 0}
304304
};

0 commit comments

Comments
 (0)