# define TOBN(hi,lo) ((BN_ULONG)hi<<32|lo)
#endif
-#define ALIGNPTR(p,N) ((unsigned char *)p+N-(size_t)p%N)
#define P256_LIMBS (256/BN_BITS2)
typedef unsigned short u16;
void *table_storage = NULL;
if ((num * 16 + 6) > OPENSSL_MALLOC_MAX_NELEMS(P256_POINT)
- || (table_storage =
- OPENSSL_malloc((num * 16 + 5) * sizeof(P256_POINT) + 64)) == NULL
+ || (table =
+ OPENSSL_aligned_alloc_array(num * 16 + 5, sizeof(P256_POINT), 64,
+ &table_storage)) == NULL
|| (p_str = OPENSSL_malloc_array(num, 33)) == NULL
|| (scalars = OPENSSL_malloc_array(num, sizeof(BIGNUM *))) == NULL)
goto err;
- table = (void *)ALIGNPTR(table_storage, 64);
temp = (P256_POINT *)(table + num);
for (i = 0; i < num; i++) {
size_t w;
PRECOMP256_ROW *preComputedTable = NULL;
- unsigned char *precomp_storage = NULL;
+ void *precomp_storage = NULL;
/* if there is an old NISTZ256_PRE_COMP object, throw it away */
EC_pre_comp_free(group);
w = 7;
- if ((precomp_storage =
- OPENSSL_malloc(37 * 64 * sizeof(P256_POINT_AFFINE) + 64)) == NULL)
+ if ((preComputedTable =
+ OPENSSL_aligned_alloc_array(37 * 64, sizeof(P256_POINT_AFFINE), 64,
+ &precomp_storage)) == NULL)
goto err;
- preComputedTable = (void *)ALIGNPTR(precomp_storage, 64);
-
P = EC_POINT_new(group);
T = EC_POINT_new(group);
if (P == NULL || T == NULL)