/* SPDX-License-Identifier: GPL-2.0 */1/* Copyright (c) 2021 HiSilicon */23#ifndef _CRYTO_ECC_CURVE_H4#define _CRYTO_ECC_CURVE_H56#include <linux/types.h>78/**9* struct ecc_point - elliptic curve point in affine coordinates10*11* @x: X coordinate in vli form.12* @y: Y coordinate in vli form.13* @ndigits: Length of vlis in u64 qwords.14*/15struct ecc_point {16u64 *x;17u64 *y;18u8 ndigits;19};2021/**22* struct ecc_curve - definition of elliptic curve23*24* @name: Short name of the curve.25* @nbits: The number of bits of a curve.26* @g: Generator point of the curve.27* @p: Prime number, if Barrett's reduction is used for this curve28* pre-calculated value 'mu' is appended to the @p after ndigits.29* Use of Barrett's reduction is heuristically determined in30* vli_mmod_fast().31* @n: Order of the curve group.32* @a: Curve parameter a.33* @b: Curve parameter b.34*/35struct ecc_curve {36char *name;37u32 nbits;38struct ecc_point g;39u64 *p;40u64 *n;41u64 *a;42u64 *b;43};4445/**46* ecc_get_curve() - get elliptic curve;47* @curve_id: Curves IDs:48* defined in 'include/crypto/ecdh.h';49*50* Returns curve if get curve succssful, NULL otherwise51*/52const struct ecc_curve *ecc_get_curve(unsigned int curve_id);5354/**55* ecc_get_curve25519() - get curve25519 curve;56*57* Returns curve2551958*/59const struct ecc_curve *ecc_get_curve25519(void);6061#endif626364