X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=ecdsa%2Fecc.h;h=652b50ad0d97df1bc1f96f89d427ee9284e3b7c1;hb=e542ff92d053ecf40b42364a44bc887431cecae2;hp=ac7d98c4f03e1343bfdc953739b78df3ecd18cbc;hpb=45d15fcc098c9eece5c39b5e421a1706f187a0d3;p=avr-crypto-lib.git diff --git a/ecdsa/ecc.h b/ecdsa/ecc.h index ac7d98c..652b50a 100644 --- a/ecdsa/ecc.h +++ b/ecdsa/ecc.h @@ -20,6 +20,8 @@ #ifndef ECC_H_ #define ECC_H_ +#include + typedef struct { bigint_t x; bigint_t y; @@ -33,17 +35,23 @@ typedef struct { bigint_t y; } ecc_affine_point_t; -typedef struct __attribute__((packed)){ +typedef union __attribute__((packed)){ ecc_affine_point_t affine; ecc_chudnovsky_point_t chudnovsky; } ecc_combi_point_t; typedef struct { - bigint_t* p; - bigint_t* b; + bigint_t *p; + bigint_t *n; + bigint_t *b; int (*reduce_p)(bigint_t*); } ecc_curve_sp_t; + +uint8_t ecc_chudnovsky_point_alloc(ecc_chudnovsky_point_t *p, size_t length_B); + +void ecc_chudnovsky_point_free(ecc_chudnovsky_point_t *p); + void ecc_chudnovsky_point_print(const ecc_chudnovsky_point_t *p); @@ -64,15 +72,15 @@ uint8_t ecc_chudnovsky_point_add_sp(ecc_chudnovsky_point_t *dest, uint8_t ecc_chudnovsky_double_and_add(ecc_chudnovsky_point_t *dest, const bigint_t *k, const ecc_chudnovsky_point_t *p, - const ecc_curve_sp_t* curve); -uint8_t bigint_to_naf(uint8_t* dest, uint16_t *length, const bigint_t *src); + const ecc_curve_sp_t *curve); +uint8_t bigint_to_naf(uint8_t *dest, uint16_t *length, const bigint_t *src); uint8_t ecc_chudnovsky_naf_multiplication(ecc_chudnovsky_point_t *dest, const bigint_t *k, const ecc_chudnovsky_point_t *p, - const ecc_curve_sp_t* curve); + const ecc_curve_sp_t *curve); uint8_t ecc_chudnovsky_multiplication(ecc_chudnovsky_point_t *dest, const bigint_t *k, const ecc_chudnovsky_point_t *p, - const ecc_curve_sp_t* curve); + const ecc_curve_sp_t *curve); #endif /* ECC_H_ */