}
EXPORT_SYMBOL(ecc_digits_from_bytes);
-static u64 *ecc_alloc_digits_space(unsigned int ndigits)
+struct ecc_point *ecc_alloc_point(unsigned int ndigits)
{
- size_t len = ndigits * sizeof(u64);
+ struct ecc_point *p;
+ size_t ndigits_sz;
- if (!len)
+ if (!ndigits)
return NULL;
- return kmalloc(len, GFP_KERNEL);
-}
-
-static void ecc_free_digits_space(u64 *space)
-{
- kfree_sensitive(space);
-}
-
-struct ecc_point *ecc_alloc_point(unsigned int ndigits)
-{
- struct ecc_point *p = kmalloc(sizeof(*p), GFP_KERNEL);
-
+ p = kmalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return NULL;
- p->x = ecc_alloc_digits_space(ndigits);
+ ndigits_sz = ndigits * sizeof(u64);
+ p->x = kmalloc(ndigits_sz, GFP_KERNEL);
if (!p->x)
goto err_alloc_x;
- p->y = ecc_alloc_digits_space(ndigits);
+ p->y = kmalloc(ndigits_sz, GFP_KERNEL);
if (!p->y)
goto err_alloc_y;
return p;
err_alloc_y:
- ecc_free_digits_space(p->x);
+ kfree(p->x);
err_alloc_x:
kfree(p);
return NULL;