/* ec.c - Elliptic Curve functions
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 2013 g10 Code GmbH
*
* This file is part of Libgcrypt.
*
* Libgcrypt is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* Libgcrypt is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "mpi-internal.h"
#include "longlong.h"
#define point_init(a) mpi_point_init((a))
#define point_free(a) mpi_point_free_parts((a))
#define log_error(fmt, ...) pr_err(fmt, ##__VA_ARGS__)
#define log_fatal(fmt, ...) pr_err(fmt, ##__VA_ARGS__)
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
/* Create a new point option. NBITS gives the size in bits of one
* coordinate; it is only used to pre-allocate some resources and
* might also be passed as 0 to use a default value.
*/
MPI_POINT mpi_point_new(unsigned int nbits)
{
MPI_POINT p;
(void)nbits; /* Currently not used. */
p = kmalloc(sizeof(*p), GFP_KERNEL);
if (p)
mpi_point_init(p);
return p;
}
EXPORT_SYMBOL_GPL(mpi_point_new);
/* Release the point object P. P may be NULL. */
void mpi_point_release(MPI_POINT p)
{
if (p) {
mpi_point_free_parts(p);
kfree(p);
}
}
EXPORT_SYMBOL_GPL(mpi_point_release);
/* Initialize the fie