Skip to content

Commit

Permalink
Fixed ecc_point size for 64bit builds (FASTMATH)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielinux committed Aug 9, 2024
1 parent dd7e2a9 commit 3fc2c98
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/xmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,24 @@ struct xmalloc_slot {
#define MP_SCHEME "TFM ECC256"
#define MP_CURVE_SPECS_SIZE (MP_INT_TYPE_SIZE)
#define MP_CURVE_FIELD_COUNT_SIZE (380)
#define ECC_POINT_SIZE (228)
#ifndef _LP64
#define ECC_POINT_SIZE (228)
#else
#define ECC_POINT_SIZE (312)
#define MP_INT_BUFFER_SIZE_1 (MP_INT_TYPE_SIZE * 5)
#endif
#define MP_INT_BUFFER_SIZE (MP_INT_TYPE_SIZE * 6)
#define MP_DIGIT_BUFFER_MONT_SIZE (sizeof(fp_digit)*(FP_SIZE + 1))
#endif
#ifdef WOLFBOOT_SIGN_ECC384
#define MP_SCHEME "TFM ECC384"
#define MP_CURVE_SPECS_SIZE (MP_INT_TYPE_SIZE)
#define MP_CURVE_FIELD_COUNT_SIZE (380)
#define ECC_POINT_SIZE (408)
#ifndef _LP64
#define ECC_POINT_SIZE (408)
#else
#define ECC_POINT_SIZE (504)
#endif
#define MP_INT_BUFFER_SIZE (MP_INT_TYPE_SIZE * 5)
#define MP_INT_BUFFER_SIZE_1 (MP_INT_TYPE_SIZE * 6)
#define MP_DIGIT_BUFFER_MONT_SIZE (sizeof(fp_digit)*(FP_SIZE + 1))
Expand All @@ -153,7 +162,11 @@ struct xmalloc_slot {
#define MP_SCHEME "TFM ECC521"
#define MP_CURVE_SPECS_SIZE (MP_INT_TYPE_SIZE)
#define MP_CURVE_FIELD_COUNT_SIZE (380)
#define ECC_POINT_SIZE (516)
#ifndef _LP64
#define ECC_POINT_SIZE (516)
#else
#define ECC_POINT_SIZE (600)
#endif
#define MP_INT_BUFFER_SIZE (MP_INT_TYPE_SIZE * 5)
#define MP_INT_BUFFER_SIZE_1 (MP_INT_TYPE_SIZE * 6)
#define MP_DIGIT_BUFFER_MONT_SIZE (sizeof(fp_digit)*(FP_SIZE + 1))
Expand Down Expand Up @@ -331,7 +344,7 @@ static uint8_t asncheck_buf[ASNCHECK_BUF_SIZE];
#endif
{ NULL, 0, 0}
};
#else
#else /* FAST MATH */
#define MP_SCHEME "TFM RSA"
#define MP_INT_TYPE_SIZE (sizeof(mp_int))
#define MP_MONT_REDUCE_BUF_SIZE (sizeof(fp_digit)*(FP_SIZE + 1))
Expand Down

0 comments on commit 3fc2c98

Please sign in to comment.