Functions | |
void | ECC_initialize (ECC_State *state, uint32_t *workzone) |
Initialize elliptic curve parameters to default values and specify workzone. More... | |
void | ECC_init (ECC_State *state, uint32_t *workzone, uint8_t windowSize, const uint32_t *prime, const uint32_t *order, const uint32_t *a, const uint32_t *b, const uint32_t *generatorX, const uint32_t *generatorY) |
Initialize elliptic curve parameters to specified values and specify workzone. More... | |
uint8_t | ECC_generateKey (ECC_State *state, uint32_t *randEntropy, uint32_t *privateKey, uint32_t *publicKey_x, uint32_t *publicKey_y) |
Generate a public key. More... | |
uint8_t | ECC_ECDSA_sign (ECC_State *state, uint32_t *privateKey, uint32_t *hash, uint32_t *pmsn, uint32_t *r, uint32_t *s) |
Sign message digest. More... | |
uint8_t | ECC_ECDSA_verify (ECC_State *state, uint32_t *publicKey_x, uint32_t *publicKey_y, uint32_t *hash, uint32_t *r, uint32_t *s) |
Verify signature. More... | |
uint8_t | ECC_ECDH_computeSharedSecret (ECC_State *state, uint32_t *privateKey, uint32_t *publicKey_x, uint32_t *publicKey_y, uint32_t *sharedSecret_x, uint32_t *sharedSecret_y) |
Compute the shared secret. More... | |
uint8_t | ECC_validatePublicKey (ECC_State *state, uint32_t *publicKey_x, uint32_t *publicKey_y) |
Validate a public key against the currently set elliptic curve. More... | |
uint8_t | ECC_validatePrivateKey (ECC_State *state, uint32_t *privateKey) |
Validate a private key against the currently set elliptic curve. More... | |
Variables | |
const ECC_NISTP256_Param | ECC_NISTP256_generatorX |
X coordinate of the generator point of the ECC_NISTP256 curve. More... | |
const ECC_NISTP256_Param | ECC_NISTP256_generatorY |
Y coordinate of the generator point of the ECC_NISTP256 curve. More... | |
const ECC_NISTP256_Param | ECC_NISTP256_prime |
prime of the ECC_NISTP256 curve. More... | |
const ECC_NISTP256_Param | ECC_NISTP256_a |
a constant of the ECC_NISTP256 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const ECC_NISTP256_Param | ECC_NISTP256_b |
b constant of the ECC_NISTP256 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b). More... | |
const ECC_NISTP256_Param | ECC_NISTP256_order |
order of the ECC_NISTP256 curve. More... | |
const ECC_NISTP256_Param | ECC_NISTP256_k_mont |
k in Montgomery domain of the ECC_NISTP256 curve. More... | |
const ECC_NISTP256_Param | ECC_NISTP256_a_mont |
a in Montgomery domain of the ECC_NISTP256 curve. More... | |
const ECC_NISTP256_Param | ECC_NISTP256_b_mont |
b in Montgomery domain of the ECC_NISTP256 curve. More... | |
uint8_t ECC_ECDH_computeSharedSecret | ( | ECC_State * | state, |
uint32_t * | privateKey, | ||
uint32_t * | publicKey_x, | ||
uint32_t * | publicKey_y, | ||
uint32_t * | sharedSecret_x, | ||
uint32_t * | sharedSecret_y | ||
) |
Compute the shared secret.
[in,out] | state | Struct to keep track of the state of the operation |
[in] | privateKey | Pointer to private key |
[in] | publicKey_x | Pointer to public key X-coordinate |
[in] | publicKey_y | Pointer to public key Y-coordinate |
[out] | sharedSecret_x | Pointer to shared secret X-coordinate |
[out] | sharedSecret_y | Pointer to shared secret Y-coordinate |
uint8_t ECC_ECDSA_sign | ( | ECC_State * | state, |
uint32_t * | privateKey, | ||
uint32_t * | hash, | ||
uint32_t * | pmsn, | ||
uint32_t * | r, | ||
uint32_t * | s | ||
) |
Sign message digest.
[in,out] | state | Struct to keep track of the state of the operation |
[in] | privateKey | Pointer to the secret key |
[in] | hash | Pointer to the message |
[in] | pmsn | Pointer to random string |
[out] | r | Pointer to r component of signature |
[out] | s | Pointer to s component of signature |
uint8_t ECC_ECDSA_verify | ( | ECC_State * | state, |
uint32_t * | publicKey_x, | ||
uint32_t * | publicKey_y, | ||
uint32_t * | hash, | ||
uint32_t * | r, | ||
uint32_t * | s | ||
) |
Verify signature.
[in,out] | state | Struct to keep track of the state of the operation |
[in] | publicKey_x | Pointer to public key X-coordinate |
[in] | publicKey_y | Pointer to public key Y-coordinate |
[in] | hash | Pointer to hash of message digest |
[in] | r | Pointer to r component of signature |
[in] | s | Pointer to s component of signature |
uint8_t ECC_generateKey | ( | ECC_State * | state, |
uint32_t * | randEntropy, | ||
uint32_t * | privateKey, | ||
uint32_t * | publicKey_x, | ||
uint32_t * | publicKey_y | ||
) |
Generate a public key.
This is used for both ECDH and ECDSA.
[in,out] | state | Struct to keep track of the state of the operation |
[in] | randEntropy | Pointer to random string |
[out] | privateKey | Pointer to the private key. May be the same location as randEntropy . |
[out] | publicKey_x | Pointer to public key X-coordinate |
[out] | publicKey_y | Pointer to public key Y-coordinate |
void ECC_init | ( | ECC_State * | state, |
uint32_t * | workzone, | ||
uint8_t | windowSize, | ||
const uint32_t * | prime, | ||
const uint32_t * | order, | ||
const uint32_t * | a, | ||
const uint32_t * | b, | ||
const uint32_t * | generatorX, | ||
const uint32_t * | generatorY | ||
) |
Initialize elliptic curve parameters to specified values and specify workzone.
This function may be used to explicitly specify the curve parameters used by the ECC in ROM implementation.
All curve parameters must be prepended with a length word specifying the length of the parameter in 32-bit words excluding the length word itself. For NIST-P256, the length word is 8.
state | Struct to keep track of the state of the operation. |
workzone | Pointer to memory allocated for computations, input. See description at beginning of ECC section for memory requirements. |
windowSize | Window size of workzone . Default value is 3. |
prime | Curve prime |
order | Curve order |
a | Curve a value |
b | Curve b value |
generatorX | X coordinate of generator point |
generatorY | Y coordinate of generator point |
void ECC_initialize | ( | ECC_State * | state, |
uint32_t * | workzone | ||
) |
Initialize elliptic curve parameters to default values and specify workzone.
This function initializes the elliptic curve parameters to default values. The default elliptic curve used is NIST-P256.
The workzone defaults to an expected window size of 3.
This function can be called again to point the ECC workzone at a different memory buffer.
state | Struct to keep track of the state of the operation. |
workzone | Pointer to memory allocated for computations, input. See description at beginning of ECC section for memory requirements. |
uint8_t ECC_validatePrivateKey | ( | ECC_State * | state, |
uint32_t * | privateKey | ||
) |
Validate a private key against the currently set elliptic curve.
Validates that private
key is within [1, n-1] where n is the order of the elliptic curve.
[in,out] | state | Struct to keep track of the state of the operation |
privateKey | Pointer to public key X-coordinate, input. |
uint8_t ECC_validatePublicKey | ( | ECC_State * | state, |
uint32_t * | publicKey_x, | ||
uint32_t * | publicKey_y | ||
) |
Validate a public key against the currently set elliptic curve.
[in,out] | state | Struct to keep track of the state of the operation |
publicKey_x | Pointer to public key X-coordinate, input. | |
publicKey_y | Pointer to public key Y-coordinate, input. |
const ECC_NISTP256_Param ECC_NISTP256_a |
a constant of the ECC_NISTP256 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).
const ECC_NISTP256_Param ECC_NISTP256_a_mont |
a in Montgomery domain of the ECC_NISTP256 curve.
const ECC_NISTP256_Param ECC_NISTP256_b |
b constant of the ECC_NISTP256 curve when expressed in short Weierstrass form (y^3 = x^2 + a*x + b).
const ECC_NISTP256_Param ECC_NISTP256_b_mont |
b in Montgomery domain of the ECC_NISTP256 curve.
const ECC_NISTP256_Param ECC_NISTP256_generatorX |
X coordinate of the generator point of the ECC_NISTP256 curve.
const ECC_NISTP256_Param ECC_NISTP256_generatorY |
Y coordinate of the generator point of the ECC_NISTP256 curve.
const ECC_NISTP256_Param ECC_NISTP256_k_mont |
k in Montgomery domain of the ECC_NISTP256 curve.
const ECC_NISTP256_Param ECC_NISTP256_order |
order of the ECC_NISTP256 curve.
const ECC_NISTP256_Param ECC_NISTP256_prime |
prime of the ECC_NISTP256 curve.