crm_curve_slots Struct

C

struct crm_curve_slots {
    struct crm_pk_slot p; /**< Field size of curve **/
    struct crm_pk_slot n; /**< Order of curve **/
    struct crm_pk_slot gx; /**< x-coordinate of generator point of curve **/
    struct crm_pk_slot gy; /**< y-coordinate of generator point of curve **/
    struct crm_pk_slot a; /**< Curve parameter a **/
    struct crm_pk_slot b; /**< Curve parameter b **/
};

Description

Slots to write custom curve parameters into

CRM_PK_CREATE_ECP_CURVE

C

typedef void (*FUNC_CRM_PK_CREATE_ECP_CURVE)( struct crm_pk_cnx *cnx, struct crm_pk_ecurve *curve, char *mem, int sz, struct crm_curve_slots *slots);
#define CRM_PK_CREATE_ECP_CURVE         ((FUNC_CRM_PK_CREATE_ECP_CURVE)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_CREATE_ECP_CURVE)))

Description

Create a prime elliptic curve 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

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup
curveCurve to initialise as a prime elliptic curve
memMemory 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
slotsSlots for the curve parameters

SEE

CRM_PK_CREATE_ECB_CURVE() and CRM_PK_DESTROY_EC_CURVE()

Returns

None

CRM_PK_CREATE_ECB_CURVE

C

typedef void (*FUNC_CRM_PK_CREATE_ECB_CURVE)(struct crm_pk_cnx *cnx, struct crm_pk_ecurve *curve, char *mem, int sz, struct crm_curve_slots *slots);
#define CRM_PK_CREATE_ECB_CURVE         ((FUNC_CRM_PK_CREATE_ECB_CURVE)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_CREATE_ECB_CURVE)))

Description

Create a binary elliptic curve 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

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup
curveCurve to initialise as a binary elliptic curve
memMemory 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
slotsSlots for the curve parameters

SEE

CRM_PK_CREATE_ECP_CURVE() and CRM_PK_DESTROY_EC_CURVE()

Returns

None

CRM_PK_DESTROY_EC_CURVE

C

typedef void (*FUNC_CRM_PK_DESTROY_EC_CURVE)(struct crm_pk_ecurve *curve);
#define CRM_PK_DESTROY_EC_CURVE         ((FUNC_CRM_PK_DESTROY_EC_CURVE)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_DESTROY_EC_CURVE)))

Description

Destroy a custom ecp or ecb curve. Destroy a curve created previously by CRM_PK_CREATE_ECP_CURVE() or CRM_PK_CREATE_ECB_CURVE().

Parameters

ParamDescription
curveCurve initialized to destroy

Returns

None

CRM_PK_GET_CURVE_NISTP192

C

typedef struct crm_pk_ecurve (*FUNC_CRM_PK_GET_CURVE_NISTP192)(struct crm_pk_cnx *cnx);
#define CRM_PK_GET_CURVE_NISTP192         ((FUNC_CRM_PK_GET_CURVE_NISTP192)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_GET_CURVE_NISTP192)))

Description

Get a reference to the predefined NIST P192 elliptic curve

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup

Returns

Curve structure for P192 curve

CRM_PK_GET_CURVE_NISTP256

C

typedef struct crm_pk_ecurve (*FUNC_CRM_PK_GET_CURVE_NISTP256)(struct crm_pk_cnx *cnx);
#define CRM_PK_GET_CURVE_NISTP256         ((FUNC_CRM_PK_GET_CURVE_NISTP256)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_GET_CURVE_NISTP256)))

Description

Get a reference to the predefined NIST P256 elliptic curve

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup

Returns

Curve structure for P256 curve

CRM_PK_GET_CURVE_NISTP384

C

typedef struct crm_pk_ecurve (*FUNC_CRM_PK_GET_CURVE_NISTP384)(struct crm_pk_cnx *cnx);
#define CRM_PK_GET_CURVE_NISTP384         ((FUNC_CRM_PK_GET_CURVE_NISTP384)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_GET_CURVE_NISTP384)))

Description

Get a reference to the predefined NIST P384 elliptic curve

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup

Returns

Curve structure for P384 curve

CRM_PK_GET_CURVE_NISTP521

C

typedef struct crm_pk_ecurve (*FUNC_CRM_PK_GET_CURVE_NISTP521)(struct crm_pk_cnx *cnx);
#define CRM_PK_GET_CURVE_NISTP521         ((FUNC_CRM_PK_GET_CURVE_NISTP521)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_GET_CURVE_NISTP521)))

Description

Get a reference to the predefined NIST P521 elliptic curve

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup

Returns

Curve structure for P521 curve

CRM_PK_GET_CURVE_ED25519

C

typedef struct crm_pk_ecurve (*FUNC_CRM_PK_GET_CURVE_ED25519)(struct crm_pk_cnx *cnx);
#define CRM_PK_GET_CURVE_ED25519         ((FUNC_CRM_PK_GET_CURVE_ED25519)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_GET_CURVE_ED25519)))

Description

Get a reference to the predefined ED25519 elliptic curve

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup

Returns

Curve structure for ED25510 curve

CRM_PK_GET_CURVE_ED448

C

typedef struct crm_pk_ecurve (*FUNC_CRM_PK_GET_CURVE_ED448)(struct crm_pk_cnx *cnx);
#define CRM_PK_GET_CURVE_ED448         ((FUNC_CRM_PK_GET_CURVE_ED448)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_GET_CURVE_ED448)))

Description

Get a reference to the predefined ED448 elliptic curve

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup

Returns

Curve structure for ED448 curve

CRM_PK_GET_CURVE_X25519

C

typedef struct crm_pk_ecurve (*FUNC_CRM_PK_GET_CURVE_X25519)(struct crm_pk_cnx *cnx);
#define CRM_PK_GET_CURVE_X25519         ((FUNC_CRM_PK_GET_CURVE_X25519)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_GET_CURVE_X25519)))

Description

Get a reference to the predefined X25519 elliptic curve

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup

Returns

Curve structure for X25519 curve

CRM_PK_GET_CURVE_X448

C

typedef struct crm_pk_ecurve (*FUNC_CRM_PK_GET_CURVE_X448)(struct crm_pk_cnx *cnx);
#define CRM_PK_GET_CURVE_X448         ((FUNC_CRM_PK_GET_CURVE_X448)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_GET_CURVE_X448)))

Description

Get a reference to the predefined X448 elliptic curve

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup

Returns

Curve structure for X448 curve

CRM_PK_GET_CURVE_SECP256K1

C

typedef struct crm_pk_ecurve (*FUNC_CRM_PK_GET_CURVE_SECP256K1)(struct crm_pk_cnx *cnx);
#define CRM_PK_GET_CURVE_SECP256K1         ((FUNC_CRM_PK_GET_CURVE_SECP256K1)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_GET_CURVE_SECP256K1)))

Description

Get a reference to the predefined SEC p256k1 elliptic curve

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup

Returns

Curve structure for SEC p256k1 curve

CRM_PK_GET_CURVE_FP256

C

typedef struct crm_pk_ecurve (*FUNC_CRM_PK_GET_CURVE_FP256)(struct crm_pk_cnx *cnx);
#define CRM_PK_GET_CURVE_FP256         ((FUNC_CRM_PK_GET_CURVE_FP256)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_GET_CURVE_FP256)))

Description

Get a reference to the predefined fp256 elliptic curve

Parameters

ParamDescription
cnxConnection structure obtained through CRM_PK_OPEN() at startup

Returns

Curve structure for fp256 curve (used in SM2)

CRM_PK_WRITE_CURVE_GEN

C

typedef void (*FUNC_CRM_PK_WRITE_CURVE_GEN)(crm_pk_accel *pk, const struct crm_pk_ecurve *curve, struct crm_pk_slot px, struct crm_pk_slot py);
#define CRM_PK_WRITE_CURVE_GEN         ((FUNC_CRM_PK_WRITE_CURVE_GEN)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_AEAD_CREATE_AESGCM_ENC)))

Description

Write the generator point of the curve into the slots (internal). Write the parameter gx & gy from curve to px.addr & py.addr respectively

Parameters

ParamDescription
pkThe accelerator request
curveInitialised curve to get generator point from
pxx-coordinate slot of generator point. The curve generator (x-coordinate) will be written to this address
pyy-coordinate slot of generator point. The curve generator (y-coordinate) will be written to this address

Returns

None

C CRM_PK_CURVE_OPSIZE

typedef int (*FUNC_CRM_PK_CURVE_OPSIZE)(const struct crm_pk_ecurve *curve);
#define CRM_PK_CURVE_OPSIZE         ((FUNC_CRM_PK_CURVE_OPSIZE)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_PK_CURVE_OPSIZE)))

Description

Return the operand size in bytes for the given curve

Parameters

ParamDescription
curveCurve initialized to get operand size from

SEE

CRM_PK_CREATE_ECP_CURVE() and CRM_PK_DESTROY_EC_CURVE()

Returns

Operand size in bytes for the given curve