ECC LibraryComponents > Security > ECDSA

Description

Elliptic Curve Cryptography Library.

The ECC (Elliptic Curve Cryptography) API includes ECDSA verification on one of the elliptic curves recommended by NIST in csrc.nist.gov/groups/ST/toolkit/documents/dss/NISTReCur.pdf :

  • secp256r1: NIST/SECG X9.62 curve over a 256 bit prime field

Data Structures

struct  ECC_Point_t
 
struct  ECC_EcdsaSignature_t
 

Macros

#define ECC_BIGINT_SIZE_IN_BITS   (256)
 
#define ECC_BIGINT_SIZE_IN_BYTES   (ECC_BIGINT_SIZE_IN_BITS / 8)
 
#define ECC_BIGINT_SIZE_IN_32BIT_WORDS
 

Typedefs

typedef uint32_t ECC_BigInt_t[ECC_BIGINT_SIZE_IN_32BIT_WORDS]
 

Functions

int32_t ECC_ECDSA_VerifySignatureP256 (CRYPTO_TypeDef *crypto, const uint8_t *msgDigest, int msgDigestLen, const ECC_Point_t *publicKey, ECC_EcdsaSignature_t *signature)
 Verify an ECDSA signature.
 
void ECC_HexToBigInt (ECC_BigInt_t bigint, const char *hex)
 Convert a large integer from a hexadecimal string to the ECC_BigInt_t format.
 
void ECC_BigIntToHex (char *hex, ECC_BigInt_t bigint)
 Convert a large integer from the ECC_BigInt_t to a hexadecimal string format.
 
void ECC_ByteArrayToBigInt (ECC_BigInt_t bigint, const uint8_t *bytearray)
 Convert a big integer from a byte array to the ECC_BigInt_t format.
 
void ECC_BigIntToByteArray (uint8_t *bytearray, ECC_BigInt_t bigint)
 Convert a large integer from the ECC_BigInt_t to the byte array format.
 
void ECC_UnsignedIntToBigInt (ECC_BigInt_t bigint, const uint32_t value)
 Convert an integer from uint32_t to ECC_BigInt_t format.
 

Macro Definition Documentation

#define ECC_BIGINT_SIZE_IN_BITS   (256)

ECC big integer size in bits.

Definition at line 49 of file ecc.h.

#define ECC_BIGINT_SIZE_IN_BYTES   (ECC_BIGINT_SIZE_IN_BITS / 8)

ECC big integer size in bytes.

Definition at line 52 of file ecc.h.

#define ECC_BIGINT_SIZE_IN_32BIT_WORDS
Value:
/ sizeof(uint32_t))
#define ECC_BIGINT_SIZE_IN_BYTES
Definition: ecc.h:52

ECC big integer size in words.

Definition at line 55 of file ecc.h.

Typedef Documentation

typedef uint32_t ECC_BigInt_t[ECC_BIGINT_SIZE_IN_32BIT_WORDS]

ECC big integer type

Definition at line 59 of file ecc.h.

Function Documentation

int32_t ECC_ECDSA_VerifySignatureP256 ( CRYPTO_TypeDef *  crypto,
const uint8_t *  msgDigest,
int  msgDigestLen,
const ECC_Point_t publicKey,
ECC_EcdsaSignature_t signature 
)

Verify an ECDSA signature.

TBW

Parameters
[in]cryptoPointer to CRYPTO peripheral instance
[in]msgDigestThe message digest associated with the signature.
[in]msgDigestLenThe length of the message digest.
[in]publicKeyPublic key of entity that generated signature.
[out]signatureThe signature to verify.
Returns
Error code.
void ECC_HexToBigInt ( ECC_BigInt_t  bigint,
const char *  hex 
)

Convert a large integer from a hexadecimal string to the ECC_BigInt_t format.

Convert a large integer from a hexadecimal string representation to a ECC_BigInt_t representation.

Parameters
[out]bigintPointer to the location where to store the result.
[in]hexThe hex representation of the large integer to convert.
void ECC_BigIntToHex ( char *  hex,
ECC_BigInt_t  bigint 
)

Convert a large integer from the ECC_BigInt_t to a hexadecimal string format.

Convert a large integer from a ECC_BigInt_t representation to a hexadecimal string representation.

Parameters
[out]hexBuffer where to store the hexadecimal result.
[in]bigintThe ECC_BigInt_t representation of the large integer to convert.
void ECC_ByteArrayToBigInt ( ECC_BigInt_t  bigint,
const uint8_t *  bytearray 
)

Convert a big integer from a byte array to the ECC_BigInt_t format.

Convert a large integer from a byte array representation to a ECC_BigInt_t representation.

Parameters
[out]bigintPointer to the location where to store the result.
[in]bytearrayThe byte array representation of the large integer to convert.
void ECC_BigIntToByteArray ( uint8_t *  bytearray,
ECC_BigInt_t  bigint 
)

Convert a large integer from the ECC_BigInt_t to the byte array format.

Convert a large integer from a ECC_BigInt_t representation to a byte array representation. Caution: byte array must be big enough to contain the result.

Parameters
[out]bytearrayBuffer to store the resulting byte array.
[in]bigintThe ECC_BigInt_t representation of the large integer to convert.
void ECC_UnsignedIntToBigInt ( ECC_BigInt_t  bigint,
const uint32_t  value 
)

Convert an integer from uint32_t to ECC_BigInt_t format.

Convert a integer from an uint32_t representation to a ECC_BigInt_t representation.

Parameters
[out]bigintPointer to the location to store the result.
[in]valueThe value to convert.