Digital Signature Algorithm (DSA) in discrete logarithm (DL) domain. More...
Typedefs | |
typedef void(* | C4eDlcDsaK2rFunc )(void *C4E_RESTRICT ctx, C4E_CONST C4eElement *C4E_RESTRICT k, C4eElement *C4E_RESTRICT r) |
Function which computes signature component r (one-time DSA public key respective the x-coordinate of a public ECDSA key) from the associated one-time private key k . | |
typedef void(* | C4eDlcDsaU2vFunc )(void *C4E_RESTRICT ctx, C4E_CONST void *C4E_RESTRICT y, C4E_CONST C4eElement *C4E_RESTRICT u1, C4E_CONST C4eElement *C4E_RESTRICT u2, C4eElement *C4E_RESTRICT v) |
Function which computes signature verification variable v from intermediate values and . | |
Functions | |
C4eSysStatus | c4e_dlc_dsa_sign (C4eDlcDomain *C4E_RESTRICT dom, C4E_CONST C4eElement *C4E_RESTRICT x, C4eHashId hid, C4E_CONST C4eArchUint8 *C4E_RESTRICT digest, C4eArchDigit tmp[C4E_RESTRICT], C4eArchUint8 *C4E_RESTRICT signature) |
DSA signature of a digest, according to IEEE Std 1363 (DLSP-DSA) and FIPS 186-4, with binary encoded signature. | |
C4eSysStatus | c4e_dlc_dsa_verify (C4eDlcDomain *C4E_RESTRICT dom, C4E_CONST C4eElement *C4E_RESTRICT y, C4eHashId hid, C4E_CONST C4eArchUint8 *C4E_RESTRICT digest, C4E_CONST C4eArchUint8 *C4E_RESTRICT signature, C4eArchSize len, C4eArchDigit tmp[C4E_RESTRICT]) |
DSA signature verification, according to IEEE Std 1363 (DLVP-DSA) and FIPS 186-4, with binary encoded signature. |
Digital Signature Algorithm (DSA) in discrete logarithm (DL) domain.
typedef void(* C4eDlcDsaK2rFunc)(void *C4E_RESTRICT ctx, C4E_CONST C4eElement *C4E_RESTRICT k, C4eElement *C4E_RESTRICT r) |
Function which computes signature component r (one-time DSA public key respective the x-coordinate of a public ECDSA key) from the associated one-time private key k
.
See ANSI X9.62 tables G-3 to G-6 for a general overview.
k
must be assured by the caller.[in] | ctx | Pointer to an context, which was passed as 1st argument to c4e_dlc_dsa_unisig(). |
[in] | k | Pointer to a (one-time) [EC]DSA private key. |
[out] | r | Calculated signature component r and temp. digits space in r->digits . The required digits space depends on the realization of this callback. An error in calculation must be mapped to r = 0. |
Definition at line 70 of file c4e_dlc_dsa.h.
typedef void(* C4eDlcDsaU2vFunc)(void *C4E_RESTRICT ctx, C4E_CONST void *C4E_RESTRICT y, C4E_CONST C4eElement *C4E_RESTRICT u1, C4E_CONST C4eElement *C4E_RESTRICT u2, C4eElement *C4E_RESTRICT v) |
Function which computes signature verification variable v from intermediate values and .
See ANSI X9.62 tables G-3 to G-6 for a general overview.
y
must be assured by the caller.[in] | ctx | Pointer to an context, which was passed as 1st argument to c4e_dlc_dsa_univfy(). |
[in] | y | Pointer to [EC]DSA public key. |
[in] | u1 | Intermediate variable (according to ANSI X9.62 and FIPS 186-4), possibly destroyed. |
[in] | u2 | Intermediate variable (according to ANSI X9.62 and FIPS 186-4), possibly destroyed. |
[out] | v | Calculated signature verification variable v and temp. digits space in v->digits . The required digits space depends on the realization of this callback. An error in calculation must be mapped to v = 0. |
Definition at line 103 of file c4e_dlc_dsa.h.
C4eSysStatus c4e_dlc_dsa_sign | ( | C4eDlcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eElement *C4E_RESTRICT | x, | |||
C4eHashId | hid, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | digest, | |||
C4eArchDigit | tmp[C4E_RESTRICT], | |||
C4eArchUint8 *C4E_RESTRICT | signature | |||
) |
DSA signature of a digest, according to IEEE Std 1363 (DLSP-DSA) and FIPS 186-4, with binary encoded signature.
The Digital Signature Algorithm (DSA) is based on the following formulas for calculating the signature (r,s):
with z the (partial) digest, g the generator, k the (random) one-time private key, x the private key and p the modulus of prime field in dom->m
.
x
and digest
are the same as in the previous one. C4E_ARCH_DIGIT_SIZE
, e.g. resulting in:C4E_ARCH_DIGIT_SIZE
is 4U.dom->m.val
and dom->q.val
are temporary modified - so they must be writable. After function return they hold the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). x
must be assured by the caller, either implicit or by using function c4e_dlc_keychk_prv(). tmp
[], using macro C4E_DLC_TMP_NUM() in conjunction with temp. space qualifier C4E_DLC_DSA_TMPID_SIGN. [in] | dom | Pointer to DSA domain parameters. |
[in] | x | Pointer to DSA private key x < 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_dlc_dsa_verify | ( | C4eDlcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eElement *C4E_RESTRICT | y, | |||
C4eHashId | hid, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | digest, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | signature, | |||
C4eArchSize | len, | |||
C4eArchDigit | tmp[C4E_RESTRICT] | |||
) |
DSA signature verification, according to IEEE Std 1363 (DLVP-DSA) and FIPS 186-4, with binary encoded signature.
The Digital Signature Algorithm (DSA) is based on the following formulas for verification of the signature (r,s):
with z the (partial) digest, g the generator, y the public key and p the modulus of prime field . The condition for a correct signature is: .
dom->m.val
and dom->q.val
are temporary modified - so they must be writable. After function return they hold the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). y
must be assured by the caller, for example by using function c4e_dlc_keychk_pub(). tmp
[], using macro C4E_DLC_TMP_NUM() in conjunction with temp. space qualifier C4E_DLC_DSA_TMPID_VERIFY.[in] | dom | Pointer to DSA domain parameters. |
[in] | y | Pointer to DSA public key. |
[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. |