Digital Signature Algorithm (DSA) in discrete logarithm (DL) domain. More...
#include "c4e_sha.h"
#include "c4e_dlc.h"
#include "c4e_gfp.h"
Go to the source code of this file.
Defines | |
#define | C4E_DLC_DSA_TMPID_SIGN |
Temp. space qualifier associated with c4e_dlc_dsa_sign(). | |
#define | C4E_DLC_DSA_TMPID_VERIFY |
Temp. space qualifier associated with c4e_dlc_dsa_verify(). | |
#define | C4E_DLC_DSA_TMPID_MAX |
Temp. space qualifier applicable to all DSA functions. | |
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. | |
C4eSysStatus | c4e_dlc_dsa_unisig (void *ctx, C4E_CONST C4eElement *C4E_RESTRICT x, C4eElemOsp *C4E_RESTRICT q, C4eDlcDsaK2rFunc fn_k2r, C4eHashId hid, C4E_CONST C4eArchUint8 *C4E_RESTRICT digest, C4eArchDigit tmp[C4E_RESTRICT], C4eArchUint8 *C4E_RESTRICT signature) |
Universal [EC]DSA signing routine. | |
C4eSysStatus | c4e_dlc_dsa_univfy (void *ctx, C4E_CONST void *C4E_RESTRICT y, C4eElemOsp *C4E_RESTRICT q, C4eDlcDsaU2vFunc fn_u2v, C4eHashId hid, C4E_CONST C4eArchUint8 *C4E_RESTRICT digest, C4E_CONST C4eArchUint8 *C4E_RESTRICT signature, C4eArchSize len, C4eArchDigit tmp[C4E_RESTRICT]) |
Universal [EC]DSA verification routine. |
Digital Signature Algorithm (DSA) in discrete logarithm (DL) domain.
Definition in file c4e_dlc_dsa.h.
C4eSysStatus c4e_dlc_dsa_unisig | ( | void * | ctx, | |
C4E_CONST C4eElement *C4E_RESTRICT | x, | |||
C4eElemOsp *C4E_RESTRICT | q, | |||
C4eDlcDsaK2rFunc | fn_k2r, | |||
C4eHashId | hid, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | digest, | |||
C4eArchDigit | tmp[C4E_RESTRICT], | |||
C4eArchUint8 *C4E_RESTRICT | signature | |||
) |
Universal [EC]DSA signing routine.
This function performs a DSA signature in any domain, using the following formulas for calculating (r,s):
with z the (partial) digest, k the (random) one-time private key, x the private key and and f a domain dependent (callback) function which computes signature component r from a private key.
q
is temporary modified - so it must be writable. After function return it holds the same values as at function entry.q
must be assured by the caller, either implicit or by using a domain parameter validity test function, e.g. c4e_dlc_domchk(). x
must be assured by the caller, either implicit or by using a private key test function, e.g. c4e_dlc_keychk_prv() in DL domain. tmp
is (whichever is greater):q->val.size
), orq->val.size
) plus the size required by parameter y
of callback function fn_k2r
. [in] | ctx | Pointer to a context, which typically points to associated domain parameters (passed to callback function fn_k2r ). |
[in] | x | Pointer to private key x < q . |
[in] | q | A prime divisor of group order (or group order itself) and it's length (which is also the length of one signature part). |
[in] | fn_k2r | Function pointer (see C4eDlcDsaK2rFunc). |
[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 * 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_univfy | ( | void * | ctx, | |
C4E_CONST void *C4E_RESTRICT | y, | |||
C4eElemOsp *C4E_RESTRICT | q, | |||
C4eDlcDsaU2vFunc | fn_u2v, | |||
C4eHashId | hid, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | digest, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | signature, | |||
C4eArchSize | len, | |||
C4eArchDigit | tmp[C4E_RESTRICT] | |||
) |
Universal [EC]DSA verification routine.
This function performs a DSA verification in any domain, using the following formulas for verifying (r,s):
with z the (partial) digest, (r, s) the received signature components, y the public key and f a domain dependent (callback) function which computes from domain parameters, the public key y and from and . Finally is compared with signature component .
q
is temporary modified - so it must be writable. After function return it holds the same values as at function entry.q
must be assured by the caller, either implicit or by using a domain parameter validity test function, e.g. c4e_dlc_domchk(). x
must be assured by the caller, either implicit or by using a private key test function, e.g. c4e_dlc_keychk_prv() in DL domain. tmp
is (whichever is greater):q->val.size
), orq->val.size
) plus the size required by parameter v
of callback function fn_u2v
.[in] | ctx | Pointer to a context, which typically points to associated domain parameters (passed to callback function fn_u2v ). |
[in] | y | Pointer to [EC]DSA public key, then passed to fn_u2v . |
[in] | q | A prime divisor of group order (or group order itself) and it's length (which is also the length of one signature part). |
[in] | fn_u2v | Function pointer (see C4eDlcDsaU2vFunc). |
[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 | Received signature of length len . It must be binary encoded according to IEEE Std 1363, annex E.3.1. |
[in] | len | Length of received signature , in bytes. |
tmp | Array of temporary space elements (see preconditions for details on size). |
C4E_STATUS_OK | If the signature verification was successful. | |
other | If the signature verification has failed. |