@file
#define EC_CURVES_HEADER_FILE
/ Copyright (c) 2018-2020 Silex Insight sa Copyright (c) 2018-2020 Beerten Engineering scs SPDX-License-Identifier: BSD-3-Clause
typedef int (*FUNC_SX_PK_CURVE_OPSIZE)(const struct sx_pk_ecurve *curve);
@addtogroup SX_PK_CURVES
@{
struct sx_curve_slots { struct sx_pk_slot p; /< Field size of curve / struct sx_pk_slot n; /< Order of curve / struct sx_pk_slot gx; /< x-coordinate of generator point of curve / struct sx_pk_slot gy; /< y-coordinate of generator point of curve / struct sx_pk_slot a; /< Curve parameter a / struct sx_pk_slot b; /< Curve parameter b / };
typedef void (FUNC_SX_PK_CREATE_ECP_CURVE)( struct sx_pk_cnx cnx, struct sx_pk_ecurve curve, char mem, int sz, struct sx_curve_slots slots); #define SX_PK_CREATE_ECP_CURVE ((FUNC_SX_PK_CREATE_ECP_CURVE)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_CREATE_ECP_CURVE)))
@remark When this function returns, copy the paramters of the curve into the slots returned in 'slots'. After that, you can use the prime elliptic curve
cnx Connection structure obtained through SX_PK_OPEN() at startup
curve Curve to initialise as a prime elliptic curve
mem Memory for the parameters of the curve. The size of the memory should be 6 time sz as there are 6 curve parameters of size sz
sz Size of the curve in bytes
slots Slots for the curve parameters @see SX_PK_CREATE_ECB_CURVE() and SX_PK_DESTROY_EC_CURVE()
typedef void (FUNC_SX_PK_CREATE_ECB_CURVE)(struct sx_pk_cnx cnx, struct sx_pk_ecurve curve, char mem, int sz, struct sx_curve_slots slots); #define SX_PK_CREATE_ECB_CURVE ((FUNC_SX_PK_CREATE_ECB_CURVE)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_CREATE_ECB_CURVE)))
@remark When this function returns, copy the paramters of the curve into the slots returned in 'slots'. After that, you can use the binary elliptic curve
cnx Connection structure obtained through SX_PK_OPEN() at startup
curve Curve to initialise as a binary elliptic curve
mem Memory for the parameters of the curve. The size of the memory should be 6 time sz as there are 6 curve parameters of size sz
sz Size of the curve in bytes
slots Slots for the curve parameters @see SX_PK_CREATE_ECP_CURVE() and SX_PK_DESTROY_EC_CURVE()
typedef void (FUNC_SX_PK_DESTROY_EC_CURVE)(struct sx_pk_ecurve curve); #define SX_PK_DESTROY_EC_CURVE ((FUNC_SX_PK_DESTROY_EC_CURVE)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_DESTROY_EC_CURVE)))
Destroy a curve created previously by SX_PK_CREATE_ECP_CURVE() or SX_PK_CREATE_ECB_CURVE().
curve Initialised curve to destroy
typedef struct sx_pk_ecurve (FUNC_SX_PK_GET_CURVE_NISTP192)(struct sx_pk_cnx cnx); #define SX_PK_GET_CURVE_NISTP192 ((FUNC_SX_PK_GET_CURVE_NISTP192)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_GET_CURVE_NISTP192)))
cnx Connection structure obtained through SX_PK_OPEN() at startup @return Curve structure for P192 curve
typedef struct sx_pk_ecurve (FUNC_SX_PK_GET_CURVE_NISTP256)(struct sx_pk_cnx cnx); #define SX_PK_GET_CURVE_NISTP256 ((FUNC_SX_PK_GET_CURVE_NISTP256)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_GET_CURVE_NISTP256)))
cnx Connection structure obtained through SX_PK_OPEN() at startup @return Curve structure for P256 curve
typedef struct sx_pk_ecurve (FUNC_SX_PK_GET_CURVE_NISTP384)(struct sx_pk_cnx cnx); #define SX_PK_GET_CURVE_NISTP384 ((FUNC_SX_PK_GET_CURVE_NISTP384)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_GET_CURVE_NISTP384)))
cnx Connection structure obtained through SX_PK_OPEN() at startup @return Curve structure for P384 curve
typedef struct sx_pk_ecurve (FUNC_SX_PK_GET_CURVE_NISTP521)(struct sx_pk_cnx cnx); #define SX_PK_GET_CURVE_NISTP521 ((FUNC_SX_PK_GET_CURVE_NISTP521)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_GET_CURVE_NISTP521)))
cnx Connection structure obtained through SX_PK_OPEN() at startup @return Curve structure for P521 curve
typedef struct sx_pk_ecurve (FUNC_SX_PK_GET_CURVE_ED25519)(struct sx_pk_cnx cnx); #define SX_PK_GET_CURVE_ED25519 ((FUNC_SX_PK_GET_CURVE_ED25519)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_GET_CURVE_ED25519)))
cnx Connection structure obtained through SX_PK_OPEN() at startup @return Curve structure for ED25519 curve
typedef struct sx_pk_ecurve (FUNC_SX_PK_GET_CURVE_ED448)(struct sx_pk_cnx cnx); #define SX_PK_GET_CURVE_ED448 ((FUNC_SX_PK_GET_CURVE_ED448)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_GET_CURVE_ED448)))
cnx Connection structure obtained through SX_PK_OPEN() at startup @return Curve structure for ED448 curve
typedef struct sx_pk_ecurve (FUNC_SX_PK_GET_CURVE_X25519)(struct sx_pk_cnx cnx); #define SX_PK_GET_CURVE_X25519 ((FUNC_SX_PK_GET_CURVE_X25519)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_GET_CURVE_X25519)))
cnx Connection structure obtained through SX_PK_OPEN() at startup @return Curve structure for X25519 curve
typedef struct sx_pk_ecurve (FUNC_SX_PK_GET_CURVE_X448)(struct sx_pk_cnx cnx); #define SX_PK_GET_CURVE_X448 ((FUNC_SX_PK_GET_CURVE_X448)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_GET_CURVE_X448)))
cnx Connection structure obtained through SX_PK_OPEN() at startup @return Curve structure for X448 curve
typedef struct sx_pk_ecurve (FUNC_SX_PK_GET_CURVE_SECP256K1)(struct sx_pk_cnx cnx); #define SX_PK_GET_CURVE_SECP256K1 ((FUNC_SX_PK_GET_CURVE_SECP256K1)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_GET_CURVE_SECP256K1)))
cnx Connection structure obtained through SX_PK_OPEN() at startup @return Curve structure for SEC p256k1 curve
typedef struct sx_pk_ecurve (FUNC_SX_PK_GET_CURVE_FP256)(struct sx_pk_cnx cnx); #define SX_PK_GET_CURVE_FP256 ((FUNC_SX_PK_GET_CURVE_FP256)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_GET_CURVE_FP256)))
cnx Connection structure obtained through SX_PK_OPEN() at startup @return Curve structure for fp256 curve (used in SM2)
typedef void (FUNC_SX_PK_WRITE_CURVE_GEN)(sx_pk_accel pk, const struct sx_pk_ecurve curve, struct sx_pk_slot px, struct sx_pk_slot py); #define SX_PK_WRITE_CURVE_GEN ((FUNC_SX_PK_WRITE_CURVE_GEN)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_AEAD_CREATE_AESGCM_ENC)))
Write the parameter gx & gy from curve to px.addr & py.addr respectively
pk The accelerator request
curve Initialised curve to get generator point from.
px x-coordinate slot of generator point. The curve generator (x-coordinate) will be written to this address
py y-coordinate slot of generator point. The curve generator (y-coordinate) will be written to this address
typedef int (FUNC_SX_PK_CURVE_OPSIZE)(const struct sx_pk_ecurve curve); #define SX_PK_CURVE_OPSIZE ((FUNC_SX_PK_CURVE_OPSIZE)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_PK_CURVE_OPSIZE)))
curve Initialised curve to get operand size from @return Operand size in bytes for the given curve
}