Elliptic Curve Digital Signature Algorithm (ECDSA). More...
Functions | |
C4eSysStatus | c4e_ecc2n_dsa_sign (C4eEcDomain *C4E_RESTRICT dom, C4E_CONST C4eElement *C4E_RESTRICT d, C4eHashId hid, C4E_CONST C4eArchUint8 *C4E_RESTRICT digest, C4eArchDigit tmp[C4E_RESTRICT], C4eArchUint8 *C4E_RESTRICT signature) |
ECDSA over signature of a digest, according to ANSI X9.62 and FIPS 186-4, with binary encoded signature. | |
C4eSysStatus | c4e_ecc2n_dsa_verify (C4eEcDomain *C4E_RESTRICT dom, C4E_CONST C4eEcPoint *C4E_RESTRICT q, C4eHashId hid, C4E_CONST C4eArchUint8 *C4E_RESTRICT digest, C4E_CONST C4eArchUint8 *C4E_RESTRICT signature, C4eArchSize len, C4eArchDigit tmp[C4E_RESTRICT]) |
ECDSA over signature verification, according to ANSI X9.62 and FIPS 186-4, with binary encoded signature. |
Elliptic Curve Digital Signature Algorithm (ECDSA).
C4eSysStatus c4e_ecc2n_dsa_sign | ( | C4eEcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eElement *C4E_RESTRICT | d, | |||
C4eHashId | hid, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | digest, | |||
C4eArchDigit | tmp[C4E_RESTRICT], | |||
C4eArchUint8 *C4E_RESTRICT | signature | |||
) |
ECDSA over signature of a digest, according to ANSI X9.62 and FIPS 186-4, with binary encoded signature.
The Elliptic Curve Digital Signature Algorithm (ECDSA) is based on the following formulas for calculating the signature (r,s):
with z the (partial) digest, G the base point, k the (random) one-time private key, d the private key and q the order of base point G in binary field .
d
and digest
are the same as in the previous one.dom->q
is temporary modified - so it must be writable. After function return it holds the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_ecc2n_domchk(). d
must be assured by the caller, either implicit or by using function c4e_ecc2n_keychk_prv(). tmp
[]:dom->q.val.size
<= dom->m.val.size
), by using macro C4E_ECC2N_TMP_NUM() in conjunction with temp. space qualifier C4E_ECC2N_DSA_TMPID_SIGN;dom->q.val.size
> dom->m.val.size
using the exact value: 8U * C4E_GF2N_INV_SPACE(dom->m.val.size) + C4E_GFP_INV_SPACE(dom->q.val.size)
8U * C4E_GF2N_INV_SPACE(dom->m.val.size) + C4E_GFP_INV_SPACE(C4E_EC_FIELD_DIGITS_MAX(dom->m.val.size))
dom->q.val.size <= dom->m.val.size
[in] | dom | Pointer to EC domain parameters. |
[in] | d | Pointer to private key d < dom->q . |
[in] | hid | Hash algorithm identifier associated with digest and it's length. |
[in] | digest | Digest calculated by the caller using a hash function. |
tmp | Array of temporary space elements (see preconditions for details on size). | |
[out] | signature | Signature buffer, with implicit length of (2U * dom->q.len ) bytes. It is binary encoded according to IEEE Std 1363, annex E.3.1. |
C4E_STATUS_OK | If the operation was successful. | |
other | If the operation has failed. |
C4eSysStatus c4e_ecc2n_dsa_verify | ( | C4eEcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eEcPoint *C4E_RESTRICT | q, | |||
C4eHashId | hid, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | digest, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | signature, | |||
C4eArchSize | len, | |||
C4eArchDigit | tmp[C4E_RESTRICT] | |||
) |
ECDSA over signature verification, according to ANSI X9.62 and FIPS 186-4, with binary encoded signature.
The Elliptic Curve Digital Signature Algorithm (ECDSA) is based on the following formulas for verification of the signature (r,s):
with z the (partial) digest, G the generator, Q the public key and q the order of base point G in binary field . The condition for a correct signature is: .
dom->q
is temporary modified - so it must be writable. After function return it holds the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_ecc2n_domchk(). q
must be assured by the caller, for example by using function c4e_ecc2n_keychk_pub(). tmp
[]:dom->q.val.size
<= dom->m.val.size
), by using macro C4E_ECC2N_TMP_NUM() in conjunction with temp. space qualifier C4E_ECC2N_DSA_TMPID_VERIFY;dom->q.val.size
> dom->m.val.size
using the exact value: 12U * C4E_GF2N_INV_SPACE(dom->m.val.size) + 2U * C4E_GFP_INV_SPACE(dom->q.val.size)
12U * C4E_GF2N_INV_SPACE(dom->m.val.size) + 2U * C4E_GFP_INV_SPACE(C4E_EC_FIELD_DIGITS_MAX(dom->m.val.size))
dom->q.val.size <= dom->m.val.size
[in] | dom | Pointer to EC domain parameters. |
[in] | q | Pointer to ECDSA public key, a curve point. |
[in] | hid | Hash algorithm identifier associated with digest and it's length. |
[in] | digest | Digest calculated by the caller using a hash function. |
[in] | signature | Signature to be verified. It must be binary encoded according to IEEE Std 1363, annex E.3.1. |
[in] | len | Length of signature in bytes. |
tmp | Array of temporary space elements (see preconditions for details on size). |
C4E_STATUS_OK | If the signature is valid. | |
other | If the signature verification has failed. |