ECCPSignSM2
ECCPSignSM2
Computes a digital signature over a message digest using the SM2 scheme.
Syntax
IppStatus ippsECCPSignSM2(const IppsBigNumState*
pMsgDigest
, const IppsBigNumState*
pRegPrivate
, IppsBigNumState*
pEphPrivate
, IppsBigNumState*
pSignR
, IppsBigNumState*
pSignS
, IppsECCPState*
pECC
);
Include Files
ippcp.h
Parameters
- pMsgDigest
- Pointer to the message digestmsg.
- pRegPrivate
- Pointer to the regular private keyregPrivKey.
- pEphPrivate
- Pointer to the ephmeral private keyephPrivKey.
- pSignR
- Pointer to the integerrof the digital signature.
- pSignS
- Pointer to the integersof the digital signature.
- pECC
- Pointer to the context of the elliptic cryptosystem.
Description
The function computes two big numbers
r
and s
that form the digital signature over a message digest msg
.The digital signature is computed using the SM2 scheme [SM2]. The scheme requires that the following cryptosystem keys are set up by the message sender:
- regPrivKey
- Regular private key.
- ephPrivKey
- Ephemeral private key.
- ephPubKey
- Ephemeral public key.
For security reasons, each signature must be generated with the unique ephemeral private key. Because of this, the function clears (sets to zero) the input ephemeral key before return. To generate and set up the keys, call the
ECCPGenKeyPair
function.Before calling
ECCPSignSM2
, set up the domain parameters of the elliptic curve in the *pECC
context by calling one of the functions: ECCPSet
or ECCPSetStdSM2
.Return Values
- ippStsNoErr
- Indicates no error. Any other value indicates an error or warning.
- ippStsNullPtrErr
- Indicates an error condition if any of the specified pointers isNULL.
- ippStsContextMatchErr
- Indicates an error condition if one of the specified contexts is not valid.
- ippStsMessageErr
- Indicates an error condition if the value ofmsgpointed bypMsgDigestis negative, or its size (in bits) is more than the ordernof the elliptic curve base pointG.
- ippStsRangeErr
- Indicates an error condition if one of the parameters pointed bypSignRorpSignShas memory size smaller than the ordernof the elliptic curve base pointG.
- ippStsEphemeralKeyErr
- Indicates an error condition if:
- The value of the ephemeral key does not belong to the [0,n-1] range, wherenis the order of the elliptic curve base pointG.
- The value ofrorscomponent of signature to be computed is equal to zero.
- ippStsInvalidPrivateKey
- Indicates an error condition if the value of the private key does not belong to the [0,n-1] range, wherenis the order of the elliptic curve base pointG.