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
Param | Description |
---|---|
curve | Elliptic curve on which to perform ECDSA signature |
d | Private key |
k | Random value |
h | Formatted 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
Param | Description |
---|---|
req | The previously acquired acceleration request for this operation |
r | First part of signature |
s | Second 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
Param | Description |
---|---|
curve | Elliptic curve on which to perform ECDSA signature |
d | Private key |
k | Random value |
h | Digest of message to be signed; Truncation or padding should be done by user application |
r | First part of signature |
s | Second 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
Param | Description |
---|---|
curve | Elliptic curve on which to perform ECDSA signature |
qx | x-cordinate of public key. Point (qx, qy) should be on the curve |
qy | y-cordinate of public key. Point (qx, qy) should be on the curve |
r | First part of signature |
s | Second part of signature |
h | Digest 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
Param | Description |
---|---|
curve | Elliptic curve on which to perform ECDSA verification |
qx | x-cordinate of public key. Point (qx, qy) should be on the curve |
qy | y-cordinate of public key. Point (qx, qy) should be on the curve |
r | First part of signature to verify |
s | Second part of signature to verify |
h | Digest 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
Param | Description |
---|---|
curve | Elliptic curve used to perform point multiplication |
k | Scalar that multiplies point P |
Py | x-cordinate of point P |
Px | y-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
Param | Description |
---|---|
req | The previously acquired acceleration request for this operation |
Rx | x-cordinate of resulting point R |
Ry | y-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
Param | Description |
---|---|
curve | Elliptic curve used to perform point multiplication |
k | Scalar that multiplies point P |
Py | x-cordinate of point P |
Px | y-cordinate of point P |
req | The previously acquired acceleration request for this operation |
Rx | x-cordinate of resulting point R |
Ry | y-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
Param | Description |
---|---|
curve | Elliptic curve used to perform point doubling |
py | x-cordinate of point P |
px | y-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
Param | Description |
---|---|
req | The previously acquired acceleration request for this operation |
rx | x-cordinate of resulting point R |
ry | y-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
Param | Description |
---|---|
curve | Elliptic curve used to perform point doubling |
py | x-cordinate of point P |
px | y-cordinate of point P |
rx | x-cordinate of resulting point R |
ry | y-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
Param | Description |
---|---|
curve | Elliptic curve used to validate point |
px | x-cordinate of point P |
py | y-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):
- px < p
- py < p
- py2 == px3 + a * px + b mod p For GF(2m), where q = 2m
- px < q
- py < q
- py2 + px * py == px3 + a * px^2 + b mod q
Parameters
Param | Description |
---|---|
curve | Elliptic curve used to validate point |
px | x-cordinate of point P |
py | y-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
Param | Description |
---|---|
curve | Elliptic curve used to validate point |
x | x-cordinate of point P to decompress |
y_lsb | Least 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
Param | Description |
---|---|
req | The previously acquired acceleration request for this operation |
y | y-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
Param | Description |
---|---|
req | The previously acquired acceleration request for this operation |
y | y-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
Param | Description |
---|---|
curve | Elliptic curve used to validate point |
x | x-cordinate of the point to decompress |
y_lsb | Least Significant Bit of y-coordinate |
y | y-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
Param | Description |
---|---|
curve | Elliptic curve to perform EC point addition |
p1x | x-cordinate of first point |
p1y | y-cordinate of first point |
p2x | x-cordinate of second point |
p2y | y-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
Param | Description |
---|---|
req | The previously acquired acceleration request for this operation |
rx | x-cordinate of resulting addition point |
ry | y-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
Param | Description |
---|---|
curve | Elliptic curve to perform to do point addition |
p1x | x-cordinate of first point |
p1y | y-cordinate of first point |
p2x | x-cordinate of second point |
p2y | y-cordinate of second point |
rx | x-cordinate of resulting point |
ry | y-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