sx_pk_dreq sx_async_ecdsa_generate_go

C

struct sx_pk_dreq sx_async_ecdsa_generate_go(
      const struct sx_pk_ecurve *curve,
      const sx_op *d,
      const sx_op *k,
      const sx_op *h)

Description

Asynchronous ECDSA signature generation

Start an ECDSA signature generation on the accelerator and return immediately. When the operation finishes on the accelerator, call sx_async_ecdsa_generate_end()

Parameters

ParamDescription
curveElliptic curve on which to perform ECDSA signature
dPrivate key
kRandom value
hFormatted hash digest of message to be signed. Truncation or padding should be done by user application

Returns

Acquired accleration request for this operation

sx_async_ecdsa_generate_end

C

void sx_async_ecdsa_generate_end(sx_pk_accel *req, sx_op *r,
      sx_op *s)

Description

Finish asynchronous (non-blocking) ECDSA generation. Get the output operands of the ECDSA signature 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
rFirst part of signature
sSecond part of signature

Returns

None

sx_ecdsa_generate

C

int sx_ecdsa_generate(
        const struct sx_pk_ecurve *curve,
        const sx_op *d,
        const sx_op *k,
        const sx_op *h,
        sx_op *r,
        sx_op *s)

Description

Generate an ECDSA signature on an elliptic curve

The signature generation has the following steps : 1. P(x1, y1) = k * G 2. r = x1 mod n 3. if r == 0 then report failure 4. w = k -1 mod n 5. s = k -1 * (h + d * r) mod n 6. if s == 0 then report failure 7. signature is the r and s

Parameters

ParamDescription
curveElliptic curve on which to perform ECDSA signature
dPrivate key
kRandom value
hDigest of message to be signed; Truncation or padding should be done by user application
rFirst part of signature
sSecond part of signature

SEE

sx_async_ecdsa_generate_go(), sx_async_ecdsa_generate_end() for an asynchronous version

Returns

SX_OK SX_ERR_INVALID_PARAM SX_ERR_NOT_INVERTIBLE SX_ERR_INVALID_SIGNATURE SX_ERR_OUT_OF_RANGE SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED

sx_pk_dreq sx_async_ecdsa_verify_go

C

struct sx_pk_dreq sx_async_ecdsa_verify_go(
      const struct sx_pk_ecurve *curve,
      const sx_op *qx,
      const sx_op *qy,
      const sx_op *r,
      const sx_op *s,
      const sx_op *h)

Description

Asynchronous (non-blocking) ECDSA verification. Start an ECDSA signature verification on the accelerator and return immediately. When the operation finishes on the accelerator, call SX_PK_RELEASE_REQ()

Parameters

ParamDescription
curveElliptic curve on which to perform ECDSA signature
qxx-cordinate of public key. Point (qx, qy) should be on the curve
qyy-cordinate of public key. Point (qx, qy) should be on the curve
rFirst part of signature
sSecond part of signature
hDigest of message to be signed

Returns

Acquired acceleration request for this application

sx_ecdsa_verify

C

int sx_ecdsa_verify(
        const struct sx_pk_ecurve *curve,
        const sx_op *qx,
        const sx_op *qy,
        const sx_op *r,
        const sx_op *s,
        const sx_op *h)

Description

Verify ECDSA signature on an elliptic curve

The verification has the following steps: 1. check qx and qy are smaller than q from the domain 2. Check that Q lies on the elliptic curve from the domain 3. Check that r and s are smaller than n 4. w = s ^ -1 mod n 5. u1 = h * w mod n 6. u2 = r * w mod n 7. X(x1, y1) = u1 * G + u2 * Q 8. If X is invalid, then the signature is invalid 9. v = x1 mod n 10. Accept signature if and only if v == r

Parameters

ParamDescription
curveElliptic curve on which to perform ECDSA verification
qxx-cordinate of public key. Point (qx, qy) should be on the curve
qyy-cordinate of public key. Point (qx, qy) should be on the curve
rFirst part of signature to verify
sSecond part of signature to verify
hDigest of message to be signed

SEE

sx_async_ecdsa_verify_go() for an asynchronous version

Returns

SX_OK SX_ERR_INVALID_PARAM SX_ERR_NOT_INVERTIBLE SX_ERR_INVALID_SIGNATURE SX_ERR_OUT_OF_RANGE SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED

sx_pk_dreq sx_async_ecp_mult_go

C

struct sx_pk_dreq sx_async_ecp_mult_go(
      const struct sx_pk_ecurve *curve,
      const sx_op *k,
      const sx_op *Px,
      const sx_op *Py)

Description

AAsynchronous EC point multiplication.

Starts an EC point multiplication on the accelerator and return immediately. When the operation finishes on the accelerator, call sx_async_ecp_mult_end()

Parameters

ParamDescription
curveElliptic curve used to perform point multiplication
kScalar that multiplies point P
Pyx-cordinate of point P
Pxy-cordinate of point P

Returns

Acquired acceleration request for this application

sx_async_ecp_mult_end

C

void sx_async_ecp_mult_end(
      sx_pk_accel *req,
      sx_op *Rx,
      sx_op *Ry)

Description

Finish asynchronous EC point multiplication.

Get the output operands of the EC point multiplication 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
Rxx-cordinate of resulting point R
Ryy-cordinate of resulting point R

Returns

None

sx_ecp_ptmult

C

int sx_ecp_ptmult(
        const struct sx_pk_ecurve *curve,
        const sx_op *k,
        const sx_op *Px,
        const sx_op *Py,
        sx_op *Rx,
        sx_op *Ry)

Description

Compute point multiplication on an elliptic curve (Rx, Ry) = k * (Px, Py)

Parameters

ParamDescription
curveElliptic curve used to perform point multiplication
kScalar that multiplies point P
Pyx-cordinate of point P
Pxy-cordinate of point P
reqThe previously acquired acceleration request for this operation
Rxx-cordinate of resulting point R
Ryy-cordinate of resulting point R

See

sx_async_ecp_mult_go(), sx_async_ecp_mult_end() for an asynchronous versions

Returns

SX_OK SX_ERR_NOT_INVERTIBLE SX_ERR_OUT_OF_RANGE SX_ERR_POINT_NOT_ON_CURVE SX_ERR_INVALID_PARAM SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED

sx_async_ecp_double_go

C

struct sx_pk_dreq sx_async_ecp_double_go(
        const struct sx_pk_ecurve *curve,
        const sx_op *px,
        const sx_op *py)

Description

Asynchronous EC point doubling. Starts an EC point doubling on the accelerator and return immediately. When the operation finishes on the accelerator, call sx_async_ecp_double_end()

Parameters

ParamDescription
curveElliptic curve used to perform point doubling
pyx-cordinate of point P
pxy-cordinate of point P

Returns

Acquired acceleration request for this operation

sx_async_ecp_double_end

C

void sx_async_ecp_double_end(
      sx_pk_accel *req,
      sx_op *rx,
      sx_op *ry)

Description

Finish asynchronous EC point doubling. Get the output operands of the EC point doubling 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
rxx-cordinate of resulting point R
ryy-cordinate of resulting point R

Returns

None

sx_ecp_double

C

int sx_ecp_double(
        const struct sx_pk_ecurve *curve,
        const sx_op *px,
        const sx_op *py,
        sx_op *rx,
        sx_op *ry)

Description

Compute point doubling on an elliptic curve

(Rx, Ry) = 2 * (Px, Py)

Parameters

ParamDescription
curveElliptic curve used to perform point doubling
pyx-cordinate of point P
pxy-cordinate of point P
rxx-cordinate of resulting point R
ryy-cordinate of resulting point R

See

sx_async_ecp_double_go(), sx_async_ecp_double_end() for an asynchronous verion

Returns

SX_OK SX_ERR_NOT_INVERTIBLE SX_ERR_OUT_OF_RANGE SX_ERR_POINT_NOT_ON_CURVE SX_ERR_INVALID_PARAM SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED

sx_async_ec_ptoncurve_go

C

struct sx_pk_dreq sx_async_ec_ptoncurve_go(
      const struct sx_pk_ecurve *curve,
      const sx_op *px,
      const sx_op *py)

Description

Asynchronous (non-blocking) EC point on curve check. Starts an EC point on curve check on the accelerator and return immediately. When the operation finishes on the accelerator, call SX_PK_RELEASE_REQ()

Parameters

ParamDescription
curveElliptic curve used to validate point
pxx-cordinate of point P
pyy-cordinate of point P

Returns

Acquired acceleration request for this operation

sx_ec_ptoncurve

C

int sx_ec_ptoncurve(
        const struct sx_pk_ecurve *curve,
        const sx_op *px,
        const sx_op *py)

Description

Check if the given point is on the given elliptic curve

It succeeds if the following checks pass: For GF(p):

  1. px < p
  2. py < p
  3. py2 == px3 + a * px + b mod p For GF(2m), where q = 2m
  4. px < q
  5. py < q
  6. py2 + px * py == px3 + a * px^2 + b mod q

Parameters

ParamDescription
curveElliptic curve used to validate point
pxx-cordinate of point P
pyy-cordinate of point P

Returns

SX_OK SX_ERR_NOT_INVERTIBLE SX_ERR_OUT_OF_RANGE SX_ERR_POINT_NOT_ON_CURVE SX_ERR_INVALID_PARAM SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED

sx_async_ec_pt_decompression_go

C

struct sx_pk_dreq sx_async_ec_pt_decompression_go(
      const struct sx_pk_ecurve *curve,
      const sx_op *x,
      const int y_lsb)

Description

Asynchronous (non-blocking) EC point decompression.

Starts an EC point decompression on the accelerator and return immediately. When the operation finishes on the accelerator, call sx_async_ec_pt_decompression_end()

Parameters

ParamDescription
curveElliptic curve used to validate point
xx-cordinate of point P to decompress
y_lsbLeast Significant Bit of y-coordinate

Returns

Acquired acceleration request for this operation

sx_async_ec_pt_decompression_end

C

void sx_async_ec_pt_decompression_end(
      sx_pk_accel *req,
      sx_op *y)

Description

Finish asynchronous (non-blocking) EC point decompression. Get the output operand of the EC point decompression 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
yy-cordinate of decompressed point

Returns

None

sx_async_ec_pt_decompression_end

C

void sx_async_ec_pt_decompression_end(
      sx_pk_accel *req,
      sx_op *y)

Description

Finish asynchronous (non-blocking) EC point decompression. Get the output operand of the EC point decompression 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
yy-cordinate of decompressed point

Returns

None

sx_ec_pt_decompression

C

int sx_ec_pt_decompression(
        const struct sx_pk_ecurve *curve,
        const sx_op *x,
        const int y_lsb,
        sx_op *y)

Description

ECC point decompression Recover the y coordinate of a point using x value and LSB of y: 1. y = sqrt(x^3 + a * x + b) 2. if (y & 1) != y_lsb then y = p - y with a and p the curve parameters 3. else return ::SX_ERR_NOT_QUADRATIC_RESIDUE

Point decompression is supported for GF(p) only

Parameters

ParamDescription
curveElliptic curve used to validate point
xx-cordinate of the point to decompress
y_lsbLeast Significant Bit of y-coordinate
yy-cordinate of decompressed point

Returns

SX_OK SX_ERR_NOT_QUADRATIC_RESIDUE SX_ERR_INVALID_PARAM SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED

sx_pk_dreq sx_async_ecp_add_go

C

struct sx_pk_dreq sx_async_ecp_add_go(
      const struct sx_pk_ecurve *curve,
      const sx_op *p1x,
      const sx_op *p1y,
      const sx_op *p2x,
      const sx_op *p2y)

Description

Asynchronous (non-blocking) EC point addition. Start an EC point addition on the accelerator and return immediately. When the operation finishes on the accelerator, call sx_async_ecp_add_end()

Parameters

ParamDescription
curveElliptic curve to perform EC point addition
p1xx-cordinate of first point
p1yy-cordinate of first point
p2xx-cordinate of second point
p2yy-cordinate of second point

Returns

Acquired acceleration request for this operation

sx_async_ecp_add_end

C

void sx_async_ecp_add_end(
      sx_pk_accel *req,
      sx_op *rx,
      sx_op *ry)

Description

Finish asynchronous (non-blocking) EC point addition.

Get the output operands of the EC point addition 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
rxx-cordinate of resulting addition point
ryy-cordinate of resulting addition point

Returns

None

sx_async_ecp_ptadd

C

int sx_ecp_ptadd(
        const struct sx_pk_ecurve *curve,
        const sx_op *p1x,
        const sx_op *p1y,
        const sx_op *p2x,
        const sx_op *p2y,
        sx_op *rx,
        sx_op *ry)

Description

Compute point addition on an elliptic curve (Rx, Ry) = P1 + P2

If P1 == P2 returns an SX_ERR_NOT_INVERTIBLE error Use point doubling operation for the addition of equal points

Parameters

ParamDescription
curveElliptic curve to perform to do point addition
p1xx-cordinate of first point
p1yy-cordinate of first point
p2xx-cordinate of second point
p2yy-cordinate of second point
rxx-cordinate of resulting point
ryy-cordinate of resulting point

See

Use point doubling for the addition of equal points sx_ecp_double()

Returns

SX_OK SX_ERR_NOT_INVERTIBLE SX_ERR_OUT_OF_RANGE SX_ERR_POINT_NOT_ON_CURVE SX_ERR_INVALID_PARAM SX_ERR_UNKNOWN_ERROR SX_ERR_BUSY SX_ERR_NOT_IMPLEMENTED SX_ERR_OPERAND_TOO_LARGE SX_ERR_PLATFORM_ERROR SX_ERR_EXPIRED