26 #include "mphell/mphell.h"
45 number_set_str(p,
"6703903964971298549787012499102923063739682910296196688861780721860882015036773488400937149083451713845015929093243025426876941405973284973216824503042159", 10);
46 #if MPHELL_USE_AMNS == 1
48 #if MPHELL_USE_AMNS_32 == 0
49 amns_alloc_init_str(&AMNS,
"[1, 10, [-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], 56, 1949715550477596391050085143019979962187489833398677588465030396092261681514158064546239921492428732105309264987401712740590694494340370264447759306218043, [-845528290199225, 1497961916346049, 90585915898951, 820213644784137, -418821346875421, 109771977934600, 1417978576852651, -962942853221725, 143096186561835, -1324914973060058], [15983654131394969033, 16968083590411639579, 11782429094846756482, 11205845458815222214, 17093288067982085116, 9998295128409825969, 11270860305329337426, 2425357736791511401, 8703551856315982458, 8445990296066650717], [-127069546631968, -166989335710652, -2445954811583878, 49017698439948, 227449256453923, 141269326656102, 1701918410502233, -1073389722232402, 563013565593825, -217007402518282], [1899551367165673, -804402297003831, -99557494915669, 1068669298035161, -1015237632853644, 1181005277717623, -1774109424859449, -574005976420006, 529912473712413, -494747968884078]]", p);
51 amns_alloc_init_str(&AMNS,
"[0, 25, [-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], 25, 5272013709936016948593560360247807441965478824314811527282560785564390252940232029521554688907682841600720826163445829871273796278697033507587796526749811, [403175, 106687, -564204, -559311, 227005, -201089, 159568, -207716, 189216, 473331, -643646, 268885, -114862, 458206, 253944, 451925, 136939, -161289, -616347, 169765, 41552, 534117, -226111, -574653, -172568], [1143524063, 3060431233, 1471859933, 2062471496, 365278526, 1627772417, 1441512363, 4213903656, 1884167813, 1257312250, 696377799, 2267257753, 4181862705, 3615529898, 2596401023, 148574974, 2138936575, 2937846772, 3262652758, 3270552461, 2820818494, 1359648921, 546172945, 1534080154, 2030909667], [717930, 1018381, 497620, -1177464, 506923, 1417195, 1126168, -20875, -1566829, -22859, -397311, 634966, -193429, -575208, -1608771, -807302, -955671, 973637, -809281, -1397935, -794421, 349799, -101423, 22396, -643027], [-675578, -1661259, 959538, 1399909, 444505, -1696167, -427423, 2030238, -196183, 81582, -1615037, -304743, 248531, -205239, 264770, -188737, -1490392, -1705651, -1043280, 1956742, 44353, -1233696, -1377288, 62848, 1193153]]", p);
53 field_set_amns(k, AMNS);
63 char bad_seed[41]=
"ffffffffffffffffffffffffffffffffffffffff";
73 printf(
"Weietrass: E was generated from seed:%s\n", seed);
77 printf(
"Problem of creation of the random weierstrass curve \n");
83 #if MPHELL_USE_AMNS == 1
void amns_free(amns_ptr *AMNS)
Free the amns system.
void amns_alloc_init_str(amns_ptr *AMNS, char *str, number p)
Allocate and initialise the amns system from the string generated by the Sage AMNS generator from htt...
void ec_curve_print(ec_curve_srcptr E, const uint8_t base, uint8_t stack)
Print a description of E.
void ec_random(ec_curve_ptr E, const char *id_curve, char *seed_res, field_srcptr k, const ec_type type, const ec_formula f, uint8_t stack)
Create a random elliptic curve E, not cryptographically secure (not tested to be)....
void ec_free(ec_curve_ptr E)
Free the elliptic curve E.
void ec_init(ec_curve_ptr E, field_srcptr k)
Initialise a curve.
void ec_alloc(ec_curve_ptr E, field_srcptr k)
Allocate a curve.
bool ec_verify_random_generation(ec_curve_ptr E, const char *seed, uint8_t stack)
Test if E if generated from the seed "seed", using algorithm A.3.4.2 from ANS X9.62-1998....
void field_alloc(field_ptr k, const field_type type, const uint8_t size, field_ptr base)
Allocates space for the different fields of the structure pointed by k.
void field_free(field_ptr k)
Free the space of the field informations structure.
void field_create(field_ptr k, const char *id, uint8_t stack, const uint32_t n,...)
Initialize the different fields of the structure pointed by k.
field_t field[1]
Address of a field structure.
void free_mphell()
Free MPHELL memory, especially the big amount of temporary memory.
void init_mphell(const uint16_t security_strength, const random_type type, const entropy_type entropy)
Initialise MPHELL with security_strength bits of security (for random number only).
void number_free(number *dst)
Free a number_ptr allocated on the RAM memory (malloc)
void number_set_str(number_ptr dst, const char *str, const uint8_t base)
Set dst to str.
void number_init(number *dst, const uint8_t n)
Allocate a number_ptr on the RAM memory (malloc)
uint8_t bits_to_nblock(const uint16_t nbits)
Return the number of blocks required to store a nbits number.
Define an elliptic curve.