sx_pk_point Struct

C

struct sx_pk_point {
   sx_op *x; /**< x-coordinate */
   sx_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

sx_ecjpake_generate_zkp_go

C

struct sx_pk_dreq sx_ecjpake_generate_zkp_go(
   const struct sx_pk_ecurve *curve,
   const sx_op *v,
   const sx_op *x,
   const sx_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 sx_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

sx_ecjpake_generate_zkp_end

C

void sx_ecjpake_generate_zkp_end(
   sx_pk_accel *req,
   sx_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

sx_ecjpake_generate_zkp

C

int sx_ecjpake_generate_zkp(
   const struct sx_pk_ecurve *curve,
   const sx_op *v,
   const sx_op *x,
   const sx_op *h,
   sx_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

sx_async_ecjpake_generate_zkp_go(), sx_async_ecjpake_generate_zkp_end() for an asynchronous version

Returns

SX_OK SX_ERR_OUT_OF_RANGE SX_ERR_POINT_NOT_ON_CURVE SX_ERR_NOT_INVERTIBLE SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED

sx_ecjpake_verify_zkp_go

C

struct sx_pk_dreq sx_ecjpake_verify_zkp_go(
   const struct sx_pk_ecurve *curve,
   const struct sx_pk_point *v,
   const struct sx_pk_point *x,
   const sx_op *r,
   const sx_op *h,
   const struct sx_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 sx_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 SX_PT_CURVE_GENERATOR to use the curve generator point)

Truncation or padding should be done by user application

See

sx_async_ecjpake_generate_zkp_go(), sx_async_ecjpake_generate_zkp_end() for an asynchronous version

Returns

Acquired acceleration request for this operation

sx_ecjpake_verify_zkp_end

C

void sx_ecjpake_verify_zkp_end(
   sx_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

sx_ecjpake_verify_zkp

C

int sx_ecjpake_verify_zkp(
   const struct sx_pk_ecurve *curve,
   const struct sx_pk_point *v,
   const struct sx_pk_point *x,
   const sx_op *r,
   const sx_op *h,
   const struct sx_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 SX_ERR_INVALID_SIGNATURE shall be returned. When the operation finishes on the accelerator, call sx_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 SX_PT_CURVE_GENERATOR to use the curve generator point)

Truncation or padding should be done by user application

See

sx_async_ecjpake_verify_zkp_go(), sx_async_ecjpake_verify_zkp_end() for an asynchronous version

Returns

SX_OK SX_ERR_INVALID_SIGNATURE SX_ERR_OUT_OF_RANGE SX_ERR_POINT_NOT_ON_CURVE SX_ERR_NOT_INVERTIBLE SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED

sx_ecjpake_3pt_add_go

C

struct sx_pk_dreq sx_ecjpake_3pt_add_go(
   const struct sx_pk_ecurve *curve,
   const struct sx_pk_point *a,
   const struct sx_pk_point *b,
   const struct sx_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 sx_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

sx_ecjpake_3pt_add_end

C

void sx_ecjpake_3pt_add_end(
   sx_pk_accel *req,
   struct sx_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

sx_ecjpake_3pt_add_go

C

int sx_ecjpake_3pt_add(
   const struct sx_pk_ecurve *curve,
   const struct sx_pk_point *a,
   const struct sx_pk_point *b,
   const struct sx_pk_point *c,
   struct sx_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 sx_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

sx_async_ecjpake_verify_zkp_go(), sx_async_ecjpake_verify_zkp_end() for an asynchronous version

Returns

SX_OK SX_ERR_INVALID_SIGNATURE SX_ERR_OUT_OF_RANGE SX_ERR_POINT_NOT_ON_CURVE SX_ERR_NOT_INVERTIBLE SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED

sx_ecjpake_gen_sess_key_go

C

struct sx_pk_dreq sx_ecjpake_gen_sess_key_go(
   const struct sx_pk_ecurve *curve,
   const struct sx_pk_point *x4,
   const struct sx_pk_point *b,
   const sx_op *x2,
   const sx_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 sx_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

sx_ecjpake_gen_sess_key_end

C

void sx_ecjpake_gen_sess_key_end(
   sx_pk_accel *req,
   struct sx_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

sx_ecjpake_3pt_add_go

C

int sx_ecjpake_gen_sess_key(
   const struct sx_pk_ecurve *curve,
   const struct sx_pk_point *x4,
   const struct sx_pk_point *b,
   const sx_op *x2,
   const sx_op *x2s,
   struct sx_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 sx_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

sx_async_ecjpake_gen_sess_key_go(), sx_async_ecjpake_gen_sess_key_end() for an asynchronous version

Returns

SX_OK SX_ERR_INVALID_SIGNATURE SX_ERR_OUT_OF_RANGE SX_ERR_POINT_NOT_ON_CURVE SX_ERR_NOT_INVERTIBLE SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED

sx_ecjpake_gen_step_2_go

C

struct sx_pk_dreq sx_ecjpake_gen_step_2_go(
   const struct sx_pk_ecurve *curve,
   const struct sx_pk_point *x4,
   const struct sx_pk_point *x3,
   const struct sx_pk_point *x1,
   const sx_op *x2s,
   const sx_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 sx_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

sx_ecjpake_gen_step_2_end

C

void sx_ecjpake_gen_step_2_end(
   sx_pk_accel *req,
   struct sx_pk_point *a,
   sx_op *x2s,
   struct sx_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

sx_ecjpake_gen_step_2

C

int sx_ecjpake_gen_step_2(
   const struct sx_pk_ecurve *curve,
   const struct sx_pk_point *x4,
   const struct sx_pk_point *x3,
   const struct sx_pk_point *x1,
   const sx_op *x2s,
   const sx_op *s,
   struct sx_pk_point *a,
   sx_op *rx2s,
   struct sx_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

sx_async_ecjpake_gen_step_2_go(), sx_async_ecjpake_gen_step_2_end() for an asynchronous version

Returns

SX_OK SX_ERR_INVALID_SIGNATURE SX_ERR_OUT_OF_RANGE SX_ERR_POINT_NOT_ON_CURVE SX_ERR_NOT_INVERTIBLE SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED