ECC Library#

Elliptic Curve Cryptography Library.

The Elliptic Curve Cryptography (ECC) 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

Modules#

ECC_Point_t

ECC_EcdsaSignature_t

Typedefs#

typedef uint32_t
ECC_BigInt_t[ECC_BIGINT_SIZE_IN_32BIT_WORDS]

ECC big integer type.

Functions#

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

Functions **********************************.

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.

Macros#

#define

TYPEDEFS **********************************.

#define
ECC_BIGINT_SIZE_IN_BYTES (ECC_BIGINT_SIZE_IN_BITS / 8)

ECC big integer size in bytes.

#define

ECC big integer size in words.

Typedef Documentation#

ECC_BigInt_t#

typedef uint32_t ECC_BigInt_t[ECC_BIGINT_SIZE_IN_32BIT_WORDS] [ECC_BIGINT_SIZE_IN_32BIT_WORDS]

ECC big integer type.


Definition at line 59 of file platform/bootloader/security/ecc/ecc.h

Function Documentation#

ECC_ECDSA_VerifySignatureP256#

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

Functions **********************************.

Parameters
[in]crypto

Pointer to CRYPTO peripheral instance

[in]msgDigest

The message digest associated with the signature.

[in]msgDigestLen

The length of the message digest.

[in]publicKey

Public key of entity that generated signature.

[out]signature

The signature to verify.

Verify an ECDSA signature.

TBW

Returns

  • Error code.


Definition at line 102 of file platform/bootloader/security/ecc/ecc.h

ECC_HexToBigInt#

void ECC_HexToBigInt (ECC_BigInt_t bigint, const char *hex)

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

Parameters
[out]bigint

Pointer to the location where to store the result.

[in]hex

The hex representation of the large integer to convert.

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


Definition at line 120 of file platform/bootloader/security/ecc/ecc.h

ECC_BigIntToHex#

void ECC_BigIntToHex (char *hex, ECC_BigInt_t bigint)

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

Parameters
[out]hex

Buffer where to store the hexadecimal result.

[in]bigint

The ECC_BigInt_t representation of the large integer to convert.

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


Definition at line 134 of file platform/bootloader/security/ecc/ecc.h

ECC_ByteArrayToBigInt#

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.

Parameters
[out]bigint

Pointer to the location where to store the result.

[in]bytearray

The byte array representation of the large integer to convert.

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


Definition at line 148 of file platform/bootloader/security/ecc/ecc.h

ECC_BigIntToByteArray#

void ECC_BigIntToByteArray (uint8_t *bytearray, ECC_BigInt_t bigint)

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

Parameters
[out]bytearray

Buffer to store the resulting byte array.

[in]bigint

The ECC_BigInt_t representation of the large integer to convert.

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.


Definition at line 163 of file platform/bootloader/security/ecc/ecc.h

ECC_UnsignedIntToBigInt#

void ECC_UnsignedIntToBigInt (ECC_BigInt_t bigint, const uint32_t value)

Convert an integer from uint32_t to ECC_BigInt_t format.

Parameters
[out]bigint

Pointer to the location to store the result.

[in]value

The value to convert.

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


Definition at line 176 of file platform/bootloader/security/ecc/ecc.h

Macro Definition Documentation#

ECC_BIGINT_SIZE_IN_BITS#

#define ECC_BIGINT_SIZE_IN_BITS
Value:
(256)

TYPEDEFS **********************************.

ECC big integer size in bits.


Definition at line 49 of file platform/bootloader/security/ecc/ecc.h

ECC_BIGINT_SIZE_IN_BYTES#

#define ECC_BIGINT_SIZE_IN_BYTES
Value:
(ECC_BIGINT_SIZE_IN_BITS / 8)

ECC big integer size in bytes.


Definition at line 52 of file platform/bootloader/security/ecc/ecc.h

ECC_BIGINT_SIZE_IN_32BIT_WORDS#

#define ECC_BIGINT_SIZE_IN_32BIT_WORDS
Value:
(ECC_BIGINT_SIZE_IN_BYTES \
/ sizeof(uint32_t))

ECC big integer size in words.


Definition at line 55 of file platform/bootloader/security/ecc/ecc.h