crm_pk_point Struct

C

struct crm_pk_point {
   crm_op *x; /**< x-coordinate */
   crm_op *y; /**< y-coordinate */
};

Description

Affine point parameter group. This structure is used for point values which are stored in two consecutive locations (x and y0

crm_ecjpake_generate_zkp_go

C

struct crm_pk_dreq crm_ecjpake_generate_zkp_go(
   const struct crm_pk_ecurve *curve,
   const crm_op *v,
   const crm_op *x,
   const crm_op *h)

Description

Asynchronous EC J-PAKE proof generation

Start a EC J-PAKE proof generation operation on the accelerator and return immediately.

When the operation finishes on the accelerator, call crm_async_generate_zkp_end()

Parameters

ParamDescription
curveElliptic curve on which to perform the operation
vRandom input ( < n )
xExponent
hHash digest

Truncation or padding should be done by user application

Returns

Acquired acceleration request for this operation

crm_ecjpake_generate_zkp_end

C

void crm_ecjpake_generate_zkp_end(
   crm_pk_accel *req,
   crm_op *r)

Description

Finish asynchronous (non-blocking) EC J-PAKE proof generation.

Get the output operands of the EC J-PAKE proof generation and release the reserved resources.

The operation on the accelerator must be finished before calling this function.

Parameters

ParamDescription
reqThe previously acquired acceleration request for this operation
rThe resulting value

Returns

None

crm_ecjpake_generate_zkp

C

int crm_ecjpake_generate_zkp(
   const struct crm_pk_ecurve *curve,
   const crm_op *v,
   const crm_op *x,
   const crm_op *h,
   crm_op *r
   )

Description

Perform an EC J-PAKE proof generation

The proof generation has the following steps:

  1. r = (v - (x * h)) % n

Parameters

ParamDescription
curveElliptic curve on which to perform the operation
vRandom input ( < n )
xExponent
hHash digest

Truncation or padding should be done by user application

See

crm_async_ecjpake_generate_zkp_go(), crm_async_ecjpake_generate_zkp_end() for an asynchronous version

Returns

CRM_OK CRM_ERR_OUT_OF_RANGE CRM_ERR_POINT_NOT_ON_CURVE CRM_ERR_NOT_INVERTIBLE CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED

crm_ecjpake_verify_zkp_go

C

struct crm_pk_dreq crm_ecjpake_verify_zkp_go(
   const struct crm_pk_ecurve *curve,
   const struct crm_pk_point *v,
   const struct crm_pk_point *x,
   const crm_op *r,
   const crm_op *h,
   const struct crm_pk_point *g)

Description

Asynchronous EC J-PAKE proof verification

Start an EC J-PAKE proof verification operation on the accelerator and return immediately. When the operation finishes on the accelerator, call crm_ecjpake_verify_zkp_end()

Parameters

ParamDescription
curveElliptic curve on which to perform the operation
vPOint on the curve
xPoint on the curve
rProof to be verified
hHash digest
gPoint on the curve (Optional, pass CRM_PT_CURVE_GENERATOR to use the curve generator point)

Truncation or padding should be done by user application

See

crm_async_ecjpake_generate_zkp_go(), crm_async_ecjpake_generate_zkp_end() for an asynchronous version

Returns

Acquired acceleration request for this operation

crm_ecjpake_verify_zkp_end

C

void crm_ecjpake_verify_zkp_end(
   crm_pk_accel *req
   )

Description

Finish asynchronous (non-blocking) EC J-PAKE proof verification

Finishes the EC J-PAKE proof verification and releases the reserved resources. The operation on the accelerator must be finished before calling this function.

Parameters

ParamDescription
reqThe previously acquired acceleration request for this operation

Returns

None

crm_ecjpake_verify_zkp

C

int crm_ecjpake_verify_zkp(
   const struct crm_pk_ecurve *curve,
   const struct crm_pk_point *v,
   const struct crm_pk_point *x,
   const crm_op *r,
   const crm_op *h,
   const struct crm_pk_point *g
   )

Description

Synchronous EC J-PAKE proof verification Start an EC J-PAKE proof verification operation on the accelerator and return immediately. The proof verification has the following steps:

  1. ( (G * r) + (X * h) ) ?= V

In case of a comparison failure CRM_ERR_INVALID_SIGNATURE shall be returned. When the operation finishes on the accelerator, call crm_ecjpake_verify_zkp_end()

Parameters

ParamDescription
curveElliptic curve on which to perform the operation
vPOint on the curve
xPoint on the curve
rProof to be verified
hHash digest
gPoint on the curve (Optional, pass CRM_PT_CURVE_GENERATOR to use the curve generator point)

Truncation or padding should be done by user application

See

crm_async_ecjpake_verify_zkp_go(), crm_async_ecjpake_verify_zkp_end() for an asynchronous version

Returns

CRM_OK CRM_ERR_INVALID_SIGNATURE CRM_ERR_OUT_OF_RANGE CRM_ERR_POINT_NOT_ON_CURVE CRM_ERR_NOT_INVERTIBLE CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED

crm_ecjpake_3pt_add_go

C

struct crm_pk_dreq crm_ecjpake_3pt_add_go(
   const struct crm_pk_ecurve *curve,
   const struct crm_pk_point *a,
   const struct crm_pk_point *b,
   const struct crm_pk_point *c)

Description

Start a EC J-PAKE 3 point addition operation on the accelerator and return immediately. When the operation finishes on the accelerator, call crm_ecjpake_3pt_add_end()

Parameters

ParamDescription
curveElliptic curve on which to perform the operation
aPoint on the curve
bPoint on the curve
cPoint on the curve

Returns

Acquired acceleration request for this operation

crm_ecjpake_3pt_add_end

C

void crm_ecjpake_3pt_add_end(
   crm_pk_accel *req,
   struct crm_pk_point *gb
   )

Description

Finish asynchronous (non-blocking) EC J-PAKE 3 point addition. Finishes the EC J-PAKE 3 point addition and releases the reserved resources. The operation on the accelerator must be finished before calling this function.

Parameters

ParamDescription
reqThe previously acquired acceleration request for this operation
gbThe addition result

Returns

None

crm_ecjpake_3pt_add_go

C

int crm_ecjpake_3pt_add(
   const struct crm_pk_ecurve *curve,
   const struct crm_pk_point *a,
   const struct crm_pk_point *b,
   const struct crm_pk_point *c,
   struct crm_pk_point *gb
   )

Description

Synchronous EC J-PAKE 3 point addition Start a EC J-PAKE 3 point addition operation on the accelerator and return immediately. The 3 point addition operation has the following steps:

  1. gb = a + b + c When the operation finishes on the accelerator, call crm_ecjpake_3pt_add_end()

Parameters

ParamDescription
curveElliptic curve on which to perform the operation
aPoint on the curve
bPoint on the curve
cPoint on the curve
gbThe addition result

Truncation or padding should be done by user application

See

crm_async_ecjpake_verify_zkp_go(), crm_async_ecjpake_verify_zkp_end() for an asynchronous version

Returns

CRM_OK CRM_ERR_INVALID_SIGNATURE CRM_ERR_OUT_OF_RANGE CRM_ERR_POINT_NOT_ON_CURVE CRM_ERR_NOT_INVERTIBLE CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED

crm_ecjpake_gen_sess_key_go

C

struct crm_pk_dreq crm_ecjpake_gen_sess_key_go(
   const struct crm_pk_ecurve *curve,
   const struct crm_pk_point *x4,
   const struct crm_pk_point *b,
   const crm_op *x2,
   const crm_op *x2s)

Description

Asynchronous EC J-PAKE session key generation tart a EC J-PAKE session key generation operation on the accelerator and return immediately. When the operation finishes on the accelerator, call crm_ecjpake_gen_sess_key_end()

Parameters

ParamDescription
curveThe previously acquired acceleration request for this operation
x4Point on the curve
bPoint on the curve
x2Generated random number
x2s(x2*s) % n

Truncation or padding should be done by user application

Returns

Acquired acceleration request for this operation

crm_ecjpake_gen_sess_key_end

C

void crm_ecjpake_gen_sess_key_end(
   crm_pk_accel *req,
   struct crm_pk_point *t)

Description

Finish asynchronous (non-blocking) EC J-PAKE session key generation Finishes the EC J-PAKE session key generation operation and releases the reserved resources. The operation on the accelerator must be finished before calling this function.

Parameters

ParamDescription
reqThe previously acquired acceleration request for this operation
tThe result

Returns

None

crm_ecjpake_3pt_add_go

C

int crm_ecjpake_gen_sess_key(
   const struct crm_pk_ecurve *curve,
   const struct crm_pk_point *x4,
   const struct crm_pk_point *b,
   const crm_op *x2,
   const crm_op *x2s,
   struct crm_pk_point *t
   )

Description

Synchronous EC J-PAKE session key generation Start a EC J-PAKE session key generation operation on the accelerator and return immediately. The session key generation has the following steps:

  1. T = (b - (x4 * x2s)) * x2 When the operation finishes on the accelerator, call crm_ecjpake_gen_sess_key_end()

Parameters

ParamDescription
curveElliptic curve on which to perform the operation
x4Point on the curve
bPoint on the curve
x2Generated Random number
x2sx2 * password

Truncation or padding should be done by user application

See

crm_async_ecjpake_gen_sess_key_go(), crm_async_ecjpake_gen_sess_key_end() for an asynchronous version

Returns

CRM_OK CRM_ERR_INVALID_SIGNATURE CRM_ERR_OUT_OF_RANGE CRM_ERR_POINT_NOT_ON_CURVE CRM_ERR_NOT_INVERTIBLE CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED

crm_ecjpake_gen_step_2_go

C

struct crm_pk_dreq crm_ecjpake_gen_step_2_go(
   const struct crm_pk_ecurve *curve,
   const struct crm_pk_point *x4,
   const struct crm_pk_point *x3,
   const struct crm_pk_point *x1,
   const crm_op *x2s,
   const crm_op *s)

Description

Asynchronous EC J-PAKE step 2 calculation Start an EC J-PAKE step 2 calculation operation on the accelerator and return immediately. When the operation finishes on the accelerator, call crm_ecjpake_gen_step_2_end()

Parameters

ParamDescription
curveThe previously acquired acceleration request for this operation
x4Point on the curve
x3Point on the curve
x1Point on the curve
x2s(x2*s) % n
spassword

Truncation or padding should be done by user application

Returns

Acquired acceleration request for this operation

crm_ecjpake_gen_step_2_end

C

void crm_ecjpake_gen_step_2_end(
   crm_pk_accel *req,
   struct crm_pk_point *a,
   crm_op *x2s,
   struct crm_pk_point *ga)

Description

Finish an asynchronous (non-blocking) EC J-PAKE step 2 calculation Finishes the EC J-PAKE step 2 calculation operation and releases the reserved resources. The operation on the accelerator must be finished before calling this function.

Parameters

ParamDescription
reqThe previously acquired acceleration request for this operation
aPoint on the curve
x2sGenerated random * password
gaPoint on the curve

Returns

None

crm_ecjpake_gen_step_2

C

int crm_ecjpake_gen_step_2(
   const struct crm_pk_ecurve *curve,
   const struct crm_pk_point *x4,
   const struct crm_pk_point *x3,
   const struct crm_pk_point *x1,
   const crm_op *x2s,
   const crm_op *s,
   struct crm_pk_point *a,
   crm_op *rx2s,
   struct crm_pk_point *ga
   )

Description

Synchronous EC J-PAKE step 2 calculation Start an EC J-PAKE step 2 calculation operation on the accelerator and return immediately. The step 2 calculation has the following steps:

  1. ga = x1 + x3 + x4
  2. rx2s = (x2s * s) % curve.n
  3. a = ga * rx2s

Parameters

| Param | Description | |:----- |:----------- | PO | curve | Elliptic curve on which to perform the operation | | x4 | Point on the curve | | x3 | Point on the curve | | x1 | Point on the curve | | x2s | Generated random * password | | s | Password | | a | Point on the curve | | rx2s | Generated random * password | | ga | Point on the curve |

Truncation or padding should be done by user application

See

crm_async_ecjpake_gen_step_2_go(), crm_async_ecjpake_gen_step_2_end() for an asynchronous version

Returns

CRM_OK CRM_ERR_INVALID_SIGNATURE CRM_ERR_OUT_OF_RANGE CRM_ERR_POINT_NOT_ON_CURVE CRM_ERR_NOT_INVERTIBLE CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED