Developer Reference for Intel® Integrated Performance Primitives Cryptography 2019

ECCPSignSM2

Computes a digital signature over a message digest using the SM2 scheme.

Syntax

IppStatus ippsECCPSignSM2(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, const IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsECCPState* pECC);

Include Files

ippcp.h

Parameters

pMsgDigest

Pointer to the message digest msg.

pRegPrivate

Pointer to the regular private key regPrivKey.

pEphPrivate

Pointer to the ephmeral private key ephPrivKey.

pSignR

Pointer to the integer r of the digital signature.

pSignS

Pointer to the integer s of 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.

You can generate and set up the keys by calling the ECCPGenKeyPair and ECCPSetKeyPair functions with the only requirement that the key regPrivKey is different from the key ephPrivKey.

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 is NULL.

ippStsContextMatchErr

Indicates an error condition if one of the specified contexts is not valid.

ippStsMessageErr

Indicates an error condition if the value of msg pointed by pMsgDigest falls outside the range of [1, n-1] where n is the order of the elliptic curve base point G.

ippStsRangeErr

Indicates an error condition if one of the parameters pointed by pSignR or pSignS has memory size smaller than the order n of the elliptic curve base point G.

ippStsEphemeralKeyErr

Indicates an error condition if the values of the ephemeral keys ephPrivKey and ephPubKey are not valid. (Either r = 0 or s = 0 is received as a result of the digital signature calculation).

ippStsInvalidPrivateKey

Indicates an error condition in the following cases:
  • Any of the parameters pointed by pRegPrivate or pEphPrivate has memory size smaller than the order n of the elliptic curve base point G.

  • Value of any of the private keys is greater than or equal to the order n of the elliptic curve base point G.