Remove curve parameter from public functions
This commit is contained in:
parent
be5f833c9c
commit
1a5337179f
14 changed files with 55 additions and 110 deletions
|
@ -120,12 +120,6 @@ typedef uint64_t uECC_dword_t;
|
|||
#define NUM_ECC_BYTES (uECC_WORD_SIZE*NUM_ECC_WORDS)
|
||||
#define NUM_ECC_BITS 256
|
||||
|
||||
/* curve identifier (for API compatility - only P-256 is supported) */
|
||||
typedef enum {
|
||||
curve_invalid = 0,
|
||||
curve_secp256r1 = 0xff
|
||||
} uECC_Curve;
|
||||
|
||||
/*
|
||||
* @brief computes doubling of point ion jacobian coordinates, in place.
|
||||
* @param X1 IN/OUT -- x coordinate
|
||||
|
@ -156,8 +150,6 @@ extern const uECC_word_t curve_n[NUM_ECC_WORDS];
|
|||
extern const uECC_word_t curve_G[2 * NUM_ECC_WORDS];
|
||||
extern const uECC_word_t curve_b[NUM_ECC_WORDS];
|
||||
|
||||
uECC_Curve uECC_secp256r1(void);
|
||||
|
||||
/*
|
||||
* @brief Generates a random integer in the range 0 < random < top.
|
||||
* Both random and top have num_words words.
|
||||
|
@ -211,14 +203,14 @@ uECC_RNG_Function uECC_get_rng(void);
|
|||
* @param curve IN -- elliptic curve
|
||||
* @return size of a private key for the curve in bytes.
|
||||
*/
|
||||
int uECC_curve_private_key_size(uECC_Curve curve);
|
||||
int uECC_curve_private_key_size(void);
|
||||
|
||||
/*
|
||||
* @brief computes the size of a public key for the curve in bytes.
|
||||
* @param curve IN -- elliptic curve
|
||||
* @return the size of a public key for the curve in bytes.
|
||||
*/
|
||||
int uECC_curve_public_key_size(uECC_Curve curve);
|
||||
int uECC_curve_public_key_size(void);
|
||||
|
||||
/*
|
||||
* @brief Compute the corresponding public key for a private key.
|
||||
|
@ -228,7 +220,7 @@ int uECC_curve_public_key_size(uECC_Curve curve);
|
|||
* @return Returns 1 if key was computed successfully, 0 if an error occurred.
|
||||
*/
|
||||
int uECC_compute_public_key(const uint8_t *private_key,
|
||||
uint8_t *public_key, uECC_Curve curve);
|
||||
uint8_t *public_key);
|
||||
|
||||
/*
|
||||
* @brief Compute public-key.
|
||||
|
@ -238,7 +230,7 @@ int uECC_compute_public_key(const uint8_t *private_key,
|
|||
* @param curve IN -- elliptic curve
|
||||
*/
|
||||
uECC_word_t EccPoint_compute_public_key(uECC_word_t *result,
|
||||
uECC_word_t *private_key, uECC_Curve curve);
|
||||
uECC_word_t *private_key);
|
||||
|
||||
/*
|
||||
* @brief Point multiplication algorithm using Montgomery's ladder with co-Z
|
||||
|
@ -249,10 +241,9 @@ uECC_word_t EccPoint_compute_public_key(uECC_word_t *result,
|
|||
* @param result OUT -- returns scalar*point
|
||||
* @param point IN -- elliptic curve point
|
||||
* @param scalar IN -- scalar
|
||||
* @param curve IN -- elliptic curve
|
||||
*/
|
||||
int EccPoint_mult_safer(uECC_word_t * result, const uECC_word_t * point,
|
||||
const uECC_word_t * scalar, uECC_Curve curve);
|
||||
const uECC_word_t * scalar);
|
||||
|
||||
/*
|
||||
* @brief Constant-time comparison to zero - secure way to compare long integers
|
||||
|
|
|
@ -97,7 +97,7 @@ extern "C" {
|
|||
* @warning A cryptographically-secure PRNG function must be set (using
|
||||
* uECC_set_rng()) before calling uECC_make_key().
|
||||
*/
|
||||
int uECC_make_key(uint8_t *p_public_key, uint8_t *p_private_key, uECC_Curve curve);
|
||||
int uECC_make_key(uint8_t *p_public_key, uint8_t *p_private_key);
|
||||
|
||||
#ifdef ENABLE_TESTS
|
||||
|
||||
|
@ -108,7 +108,7 @@ int uECC_make_key(uint8_t *p_public_key, uint8_t *p_private_key, uECC_Curve curv
|
|||
* uECC_make_key() function for real applications.
|
||||
*/
|
||||
int uECC_make_key_with_d(uint8_t *p_public_key, uint8_t *p_private_key,
|
||||
unsigned int *d, uECC_Curve curve);
|
||||
unsigned int *d);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -128,7 +128,7 @@ int uECC_make_key_with_d(uint8_t *p_public_key, uint8_t *p_private_key,
|
|||
* order to produce a cryptographically secure symmetric key.
|
||||
*/
|
||||
int uECC_shared_secret(const uint8_t *p_public_key, const uint8_t *p_private_key,
|
||||
uint8_t *p_secret, uECC_Curve curve);
|
||||
uint8_t *p_secret);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ extern "C" {
|
|||
* attack.
|
||||
*/
|
||||
int uECC_sign(const uint8_t *p_private_key, const uint8_t *p_message_hash,
|
||||
unsigned p_hash_size, uint8_t *p_signature, uECC_Curve curve);
|
||||
unsigned p_hash_size, uint8_t *p_signature);
|
||||
|
||||
#ifdef ENABLE_TESTS
|
||||
/*
|
||||
|
@ -117,8 +117,7 @@ int uECC_sign(const uint8_t *p_private_key, const uint8_t *p_message_hash,
|
|||
* Refer to uECC_sign() function for real applications.
|
||||
*/
|
||||
int uECC_sign_with_k(const uint8_t *private_key, const uint8_t *message_hash,
|
||||
unsigned int hash_size, uECC_word_t *k, uint8_t *signature,
|
||||
uECC_Curve curve);
|
||||
unsigned int hash_size, uECC_word_t *k, uint8_t *signature)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -136,7 +135,7 @@ int uECC_sign_with_k(const uint8_t *private_key, const uint8_t *message_hash,
|
|||
* the signature values (hash_size and signature).
|
||||
*/
|
||||
int uECC_verify(const uint8_t *p_public_key, const uint8_t *p_message_hash,
|
||||
unsigned int p_hash_size, const uint8_t *p_signature, uECC_Curve curve);
|
||||
unsigned int p_hash_size, const uint8_t *p_signature);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue