crm_pk_dreq crm_async_ecdsa_generate_go

C

struct crm_pk_dreq crm_async_ecdsa_generate_go(
      const struct crm_pk_ecurve *curve,
      const crm_op *d,
      const crm_op *k,
      const crm_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 crm_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

crm_async_ecdsa_generate_end

C

void crm_async_ecdsa_generate_end(crm_pk_accel *req, crm_op *r,
      crm_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

crm_ecdsa_generate

C

int crm_ecdsa_generate(
        const struct crm_pk_ecurve *curve,
        const crm_op *d,
        const crm_op *k,
        const crm_op *h,
        crm_op *r,
        crm_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

crm_async_ecdsa_generate_go(), crm_async_ecdsa_generate_end() for an asynchronous version

Returns

CRM_OK CRM_ERR_INVALID_PARAM CRM_ERR_NOT_INVERTIBLE CRM_ERR_INVALID_SIGNATURE CRM_ERR_OUT_OF_RANGE CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED

crm_pk_dreq crm_async_ecdsa_verify_go

C

struct crm_pk_dreq crm_async_ecdsa_verify_go(
      const struct crm_pk_ecurve *curve,
      const crm_op *qx,
      const crm_op *qy,
      const crm_op *r,
      const crm_op *s,
      const crm_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 CRM_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

crm_ecdsa_verify

C

int crm_ecdsa_verify(
        const struct crm_pk_ecurve *curve,
        const crm_op *qx,
        const crm_op *qy,
        const crm_op *r,
        const crm_op *s,
        const crm_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

crm_async_ecdsa_verify_go() for an asynchronous version

Returns

CRM_OK CRM_ERR_INVALID_PARAM CRM_ERR_NOT_INVERTIBLE CRM_ERR_INVALID_SIGNATURE CRM_ERR_OUT_OF_RANGE CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED

crm_pk_dreq crm_async_ecp_mult_go

C

struct crm_pk_dreq crm_async_ecp_mult_go(
      const struct crm_pk_ecurve *curve,
      const crm_op *k,
      const crm_op *Px,
      const crm_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 crm_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

crm_async_ecp_mult_end

C

void crm_async_ecp_mult_end(
      crm_pk_accel *req,
      crm_op *Rx,
      crm_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

crm_ecp_ptmult

C

int crm_ecp_ptmult(
        const struct crm_pk_ecurve *curve,
        const crm_op *k,
        const crm_op *Px,
        const crm_op *Py,
        crm_op *Rx,
        crm_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

crm_async_ecp_mult_go(), crm_async_ecp_mult_end() for an asynchronous versions

Returns

CRM_OK CRM_ERR_NOT_INVERTIBLE CRM_ERR_OUT_OF_RANGE CRM_ERR_POINT_NOT_ON_CURVE CRM_ERR_INVALID_PARAM CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED

crm_async_ecp_double_go

C

struct crm_pk_dreq crm_async_ecp_double_go(
        const struct crm_pk_ecurve *curve,
        const crm_op *px,
        const crm_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 crm_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

crm_async_ecp_double_end

C

void crm_async_ecp_double_end(
      crm_pk_accel *req,
      crm_op *rx,
      crm_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

crm_ecp_double

C

int crm_ecp_double(
        const struct crm_pk_ecurve *curve,
        const crm_op *px,
        const crm_op *py,
        crm_op *rx,
        crm_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

crm_async_ecp_double_go(), crm_async_ecp_double_end() for an asynchronous verion

Returns

CRM_OK CRM_ERR_NOT_INVERTIBLE CRM_ERR_OUT_OF_RANGE CRM_ERR_POINT_NOT_ON_CURVE CRM_ERR_INVALID_PARAM CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED

crm_async_ec_ptoncurve_go

C

struct crm_pk_dreq crm_async_ec_ptoncurve_go(
      const struct crm_pk_ecurve *curve,
      const crm_op *px,
      const crm_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 CRM_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

crm_ec_ptoncurve

C

int crm_ec_ptoncurve(
        const struct crm_pk_ecurve *curve,
        const crm_op *px,
        const crm_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

CRM_OK CRM_ERR_NOT_INVERTIBLE CRM_ERR_OUT_OF_RANGE CRM_ERR_POINT_NOT_ON_CURVE CRM_ERR_INVALID_PARAM CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED

crm_async_ec_pt_decompression_go

C

struct crm_pk_dreq crm_async_ec_pt_decompression_go(
      const struct crm_pk_ecurve *curve,
      const crm_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 crm_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

crm_async_ec_pt_decompression_end

C

void crm_async_ec_pt_decompression_end(
      crm_pk_accel *req,
      crm_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

crm_async_ec_pt_decompression_end

C

void crm_async_ec_pt_decompression_end(
      crm_pk_accel *req,
      crm_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

crm_ec_pt_decompression

C

int crm_ec_pt_decompression(
        const struct crm_pk_ecurve *curve,
        const crm_op *x,
        const int y_lsb,
        crm_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 ::CRM_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

CRM_OK CRM_ERR_NOT_QUADRATIC_RESIDUE CRM_ERR_INVALID_PARAM CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED

crm_pk_dreq crm_async_ecp_add_go

C

struct crm_pk_dreq crm_async_ecp_add_go(
      const struct crm_pk_ecurve *curve,
      const crm_op *p1x,
      const crm_op *p1y,
      const crm_op *p2x,
      const crm_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 crm_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

crm_async_ecp_add_end

C

void crm_async_ecp_add_end(
      crm_pk_accel *req,
      crm_op *rx,
      crm_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

crm_async_ecp_ptadd

C

int crm_ecp_ptadd(
        const struct crm_pk_ecurve *curve,
        const crm_op *p1x,
        const crm_op *p1y,
        const crm_op *p2x,
        const crm_op *p2y,
        crm_op *rx,
        crm_op *ry)

Description

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

If P1 == P2 returns an CRM_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 crm_ecp_double()

Returns

CRM_OK CRM_ERR_NOT_INVERTIBLE CRM_ERR_OUT_OF_RANGE CRM_ERR_POINT_NOT_ON_CURVE CRM_ERR_INVALID_PARAM CRM_ERR_UNKNOWN_ERROR CRM_ERR_BUSY CRM_ERR_NOT_IMPLEMENTED CRM_ERR_OPERAND_TOO_LARGE CRM_ERR_PLATFORM_ERROR CRM_ERR_EXPIRED