1.25 CRYPT_ECC_DSA_HashVerify Function

C

int CRYPT_ECC_DSA_HashVerify(
    CRYPT_ECC_CTX* ecc, 
    const unsigned char* sig, 
    unsigned int sigSz, 
    unsigned char* hash, 
    unsigned int hashSz, 
    int* status
);

Description

This function verifies that an ECC signature is valid.

Preconditions

The ECC context must have been initialized with a call to CRYPT_ECC_Initialize. The key used for the signature must have been imported or created prior to calling this function.

Parameters

ParametersDescription
eccPointer to context which saves state between calls.
sigThe signature to verify.
sigSzThe length of the signature (octets).
hashThe hash (message digest) that was signed.
hashSzThe length of the hash (octets).
statusResult of signature (1 == valid, 0 == invalid).

Returns

  • BAD_FUNC_ARG - An invalid pointer was passed to the function.

  • MEMORY_E - Memory could not be allocated for the operation.

  • 0 - An invalid pointer was not passed to the function.

Remarks

None.

Example

CRYPT_ECC_CTX userA; 
int           ret;
byte          sig[100];
unsigned int  sigSz = (unsigned int)sizeof(sig);
unsigned int  usedA = 0;
int verifyStatus = 0;

ret = CRYPT_ECC_Initialize(&userA);
...
// Import or generate private key
...
ret = CRYPT_ECC_DSA_HashVerify(&userA, sig, sigSz, ourData, CRYPT_SHA_DIGEST_SIZE, &verifyStatus);