19 #ifndef ECC_PK_CRYPTO_H_
20 #define ECC_PK_CRYPTO_H_
24 #include "../miracl_lib/ecn.h"
25 #include "../miracl_lib/big.h"
26 #include "../miracl_lib/ec2.h"
28 #define fe2ec2(fieldele) (((ecc_fe*) (fieldele))->get_val())
29 #define num2Big(number) (((ecc_num*) (number))->get_val())
32 #define MAXMSGSAMPLE 256
61 num* get_rnd_num(uint32_t bitlen = 0);
63 fe* get_rnd_fe(uint32_t bitlen);
65 fe* get_rnd_generator();
68 uint32_t num_byte_size() {
69 return ceil_divide(secparam.ecckcbits, 8);
71 uint32_t get_field_size() {
72 return secparam.ecckcbits;
83 void init(
seclvl sp, uint8_t* seed);
85 fe* sample_random_point();
96 void set_si(int32_t src);
97 void set_add(
num* a,
num* b);
98 void set_mul(
num* a,
num* b);
102 void export_to_bytes(uint8_t* buf, uint32_t field_size_bytes);
103 void import_from_bytes(uint8_t* buf, uint32_t field_size_bytes);
104 void set_rnd(uint32_t bits);
106 cout << (*val) << endl;
122 void set_mul(
fe* a,
fe* b);
124 void set_pow(
fe* b,
num* e);
125 void set_div(
fe* a,
fe* b);
126 void set_double_pow_mul(
fe* b1,
num* e1,
fe* b2,
num* e2);
127 void export_to_bytes(uint8_t* buf);
128 void import_from_bytes(uint8_t* buf);
129 void sample_fe_from_bytes(uint8_t* buf, uint32_t bytelen);
132 cout << (*val) << endl;
152 void pow(
fe* res,
num* e);
157 void point_to_byte(uint8_t* pBufIdx, uint32_t field_size_bytes, EC2* to_export);
158 void byte_to_point(EC2* to_export, uint32_t field_size_bytes, uint8_t* pBufIdx);
Definition: pk-crypto.h:77
Definition: ecc-pk-crypto.h:145
Definition: pk-crypto.h:99
Definition: pk-crypto.h:59
Definition: pk-crypto.h:30
Definition: ecc-pk-crypto.h:115
Virtual class for public-key operations.
Definition: ecc-pk-crypto.h:34
Definition: ecc-pk-crypto.h:51
Definition: typedefs.h:79
Definition: ecc-pk-crypto.h:89