mirror of
https://github.com/kmackay/micro-ecc.git
synced 2026-08-04 09:27:46 +00:00
Some formatting changes.
This commit is contained in:
@@ -89,7 +89,7 @@ static uint vli_numDigits(uint32_t *p_vli)
|
||||
int i;
|
||||
/* Search from the end until we find a non-zero digit.
|
||||
We do it in reverse because we expect that most digits will be nonzero. */
|
||||
for (i = NUM_ECC_DIGITS - 1; i >= 0 && p_vli[i] == 0; --i)
|
||||
for(i = NUM_ECC_DIGITS - 1; i >= 0 && p_vli[i] == 0; --i)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ static void vli_mmod_fast(uint32_t *p_result, uint32_t *p_product)
|
||||
{
|
||||
uint32_t l_tmp[2*NUM_ECC_DIGITS];
|
||||
|
||||
while (!vli_isZero(p_product + NUM_ECC_DIGITS)) /* While c1 != 0 */
|
||||
while(!vli_isZero(p_product + NUM_ECC_DIGITS)) /* While c1 != 0 */
|
||||
{
|
||||
uint32_t l_carry = 0;
|
||||
uint i;
|
||||
@@ -511,7 +511,7 @@ static void vli_mmod_fast(uint32_t *p_result, uint32_t *p_product)
|
||||
}
|
||||
}
|
||||
|
||||
while (vli_cmp(p_product, curve_p) > 0)
|
||||
while(vli_cmp(p_product, curve_p) > 0)
|
||||
{
|
||||
vli_sub(p_product, p_product, curve_p);
|
||||
}
|
||||
@@ -599,7 +599,7 @@ static void vli_modInv(uint32_t *p_result, uint32_t *p_input, uint32_t *p_mod)
|
||||
vli_clear(v);
|
||||
|
||||
int l_cmpResult;
|
||||
while ((l_cmpResult = vli_cmp(a, b)) != 0)
|
||||
while((l_cmpResult = vli_cmp(a, b)) != 0)
|
||||
{
|
||||
l_carry = 0;
|
||||
if(EVEN(a))
|
||||
@@ -1063,8 +1063,8 @@ static uint max(uint a, uint b)
|
||||
return (a > b ? a : b);
|
||||
}
|
||||
|
||||
int ecdsa_sign(uint32_t p_privateKey[NUM_ECC_DIGITS], uint32_t p_random[NUM_ECC_DIGITS], uint32_t p_hash[NUM_ECC_DIGITS],
|
||||
uint32_t r[NUM_ECC_DIGITS], uint32_t s[NUM_ECC_DIGITS])
|
||||
int ecdsa_sign(uint32_t r[NUM_ECC_DIGITS], uint32_t s[NUM_ECC_DIGITS], uint32_t p_privateKey[NUM_ECC_DIGITS],
|
||||
uint32_t p_random[NUM_ECC_DIGITS], uint32_t p_hash[NUM_ECC_DIGITS])
|
||||
{
|
||||
uint32_t k[NUM_ECC_DIGITS];
|
||||
EccPoint p;
|
||||
|
||||
@@ -12,11 +12,11 @@ ECC_SOFT_MULT64 - For platforms that do not have instructions to allow a fast 64
|
||||
enables code to do 64x64 bit multiplies faster than libgcc does. Improves speed by about 6% on Cortex-M0
|
||||
(with 32-cycle multiply instruction). Do not enable on platforms that have a fast 64x64 bit multiply.
|
||||
*/
|
||||
#define ECC_SQUARE_FUNC 0
|
||||
#define ECC_USE_NAF 0
|
||||
#define ECC_SQUARE_FUNC 1
|
||||
#define ECC_USE_NAF 1
|
||||
#define ECC_SOFT_MULT64 1
|
||||
|
||||
#define ECC_CURVE secp384r1
|
||||
#define ECC_CURVE secp192r1
|
||||
|
||||
#define secp128r1 4
|
||||
#define secp192r1 6
|
||||
@@ -43,10 +43,8 @@ int ecdh_shared_secret(uint32_t p_secret[NUM_ECC_DIGITS], EccPoint *p_publicKey,
|
||||
int ecdh_make_key(EccPoint *p_publicKey, uint32_t p_privateKey[NUM_ECC_DIGITS], uint32_t p_random[NUM_ECC_DIGITS]);
|
||||
int ecc_valid_public_key(EccPoint *p_publicKey);
|
||||
|
||||
|
||||
|
||||
int ecdsa_sign(uint32_t r[NUM_ECC_DIGITS], uint32_t s[NUM_ECC_DIGITS],
|
||||
uint32_t p_privateKey[NUM_ECC_DIGITS], uint32_t p_random[NUM_ECC_DIGITS], uint32_t p_hash[NUM_ECC_DIGITS]);
|
||||
int ecdsa_sign(uint32_t r[NUM_ECC_DIGITS], uint32_t s[NUM_ECC_DIGITS], uint32_t p_privateKey[NUM_ECC_DIGITS],
|
||||
uint32_t p_random[NUM_ECC_DIGITS], uint32_t p_hash[NUM_ECC_DIGITS]);
|
||||
int ecdsa_verify(EccPoint *p_publicKey, uint32_t p_hash[NUM_ECC_DIGITS], uint32_t r[NUM_ECC_DIGITS], uint32_t s[NUM_ECC_DIGITS]);
|
||||
|
||||
#endif /* _MICRO_ECDH_H_ */
|
||||
|
||||
Reference in New Issue
Block a user