sx_pk_dreq sx_async_dsa_sign_go
C
struct sx_pk_dreq sx_async_dsa_sign_go(struct sx_pk_cnx *cnx, const sx_op *p, const sx_op *q, const sx_op *g, const sx_op *k, const sx_op *privkey, const sx_op *h)
Description
Asynchronous (non-blocking) DSA signature generation Start an DSA signature generation on the accelerator and return immediately. When the operation finishes on the accelerator, call sx_async_finish_pair()
Parameters
Param | Description |
---|---|
cnx | Connection structure obtained through SX_PK_OPEN() at startup |
p | Prime modulus p |
q | Prime divisor of p-1 |
g | Generator of order q mod p |
k | Random value |
privkey | Private key |
h | Hash digest of message reduced by means of Secure Hash Algorithm specified in FIPS 180-3 |
SEE sx_dsa_sign() for a synchronous version
Returns
Acquired acceleration request for this operation
sx_dsa_sign
C
int sx_dsa_sign(struct sx_pk_cnx *cnx,
const sx_op *p, const sx_op *q, const sx_op *g, const sx_op *k,
const sx_op *privkey, const sx_op *h, sx_op *r, sx_op *s)
Description
DSA signature generation
Computes the following: 1. X = g k mod p 2. r = X mod q 3. if r == 0 the return ::SX_ERR_INVALID_SIGNATURE 4. else w = k (-1) mod q 5. s = w * (h + x * r) mod q 6. if s == 0 then return ::SX_ERR_INVALID_SIGNATURE 7. (r,s) is the signature
Parameters
Param | Description |
---|---|
cnx | Connection structure obtained through SX_PK_OPEN() at startup |
p | Prime modulus p |
q | Prime divisor of p-1 |
g | Generator of order q mod p |
k | Random value |
privkey | Private key |
h | Hash digest of message reduced by means of Secure Hash Algorithm specified in FIPS 180-3 |
r | First part of signature |
s | Second part of signature |
SEE sx_dsa_sign_go() for an asynchronous version
Returns
SX_OK SX_ERR_NOT_INVERTIBLE SX_ERR_INVALID_SIGNATURE 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_dsa_ver_go
C
struct sx_pk_dreq sx_async_dsa_ver_go(struct sx_pk_cnx *cnx,
const sx_op *p, const sx_op *q, const sx_op *g, const sx_op *pubkey,
const sx_op *h, const sx_op *r, const sx_op *s)
Description
Asynchronous (non-blocking) DSA signature verification
Start an DSA signature verification on the accelerator and return immediately. When the operation finishes on the accelerator, call SX_PK_RELEASE_REQ()
Parameters
Param | Description |
---|---|
cnx | Connection structure obtained through SX_PK_OPEN() at startup |
p | Prime modulus p |
q | Prime divisor of p-1 |
g | Generator of order q mod p |
pubkey | Public key |
h | Hash digest of message reduced by means of Secure Hash Algorithm specified in FIPS 180-3 |
r | First part of signature to verify |
s | Second part of signature to verify |
SEE
sx_dsa_ver() for a synchronous version
Returns
Acquired acceleration request for this operation
sx_dsa_ver
C
int sx_dsa_ver(struct sx_pk_cnx *cnx,
const sx_op *p, const sx_op *q, const sx_op *g, const sx_op *pubkey,
const sx_op *h, const sx_op *r, const sx_op *s)
Description
DSA signature verification
Checks if a signature is valid: 1. w = s (-1) mod q 2. u1 = h * w mod q 3. u2 = r * w mod q 4. X = g (u1) * y ^ (u2) mod p 5. v = X mod q 6. if v == r then signature is valid (::SX_OK) 7. else return ::SX_ERR_INVALID_SIGNATURE
Before launching the operation, verify the domain D(p,q,g) by checking: 1. 21023 < p < 21024 \b or 22047 < p < 22048 2. 2159 < q < 2160 \b or 2223 < q < 2224 \b or 2255 < q < 2256 3. 1 < g < p
Parameters
Param | Description |
---|---|
cnx | Connection structure obtained through SX_PK_OPEN() at startup |
p | Prime modulus p |
q | Prime divisor of p-1 |
g | Generator of order q mod p |
pubkey | Public key |
h | Hash digest of message reduced by means of Secure Hash Algorithm specified in FIPS 180-3 |
r | First part of signature to verify |
s | Second part of signature to verify |
SEE
sx_async_dsa_ver_go() for an asynchronous version
Returns
SX_OK SX_ERR_NOT_INVERTIBLE SX_ERR_INVALID_SIGNATURE SX_ERR_OUT_OF_RANGE 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