+uint8_t ecc_chudnovsky_point_alloc(ecc_chudnovsky_point_t *p, size_t length_B){
+ if(!(p->x.wordv = malloc(length_B))){
+ printf_P(PSTR("DBG: XXX <%S %s %d>\n"), PSTR(__FILE__), __func__, __LINE__);
+ return 1;
+ }
+ if(!(p->y.wordv = malloc(length_B))){
+ printf_P(PSTR("DBG: XXX <%S %s %d>\n"), PSTR(__FILE__), __func__, __LINE__);
+ free(p->x.wordv);
+ return 1;
+ }
+ if(!(p->z1.wordv = malloc(length_B))){
+ printf_P(PSTR("DBG: XXX <%S %s %d>\n"), PSTR(__FILE__), __func__, __LINE__);
+ free(p->x.wordv);
+ free(p->y.wordv);
+ return 1;
+ }
+ if(!(p->z2.wordv = malloc(length_B))){
+ printf_P(PSTR("DBG: XXX <%S %s %d>\n"), PSTR(__FILE__), __func__, __LINE__);
+ free(p->x.wordv);
+ free(p->y.wordv);
+ free(p->z1.wordv);
+ return 1;
+ }
+ if(!(p->z3.wordv = malloc(length_B))){
+ printf_P(PSTR("DBG: XXX <%S %s %d>\n"), PSTR(__FILE__), __func__, __LINE__);
+ free(p->x.wordv);
+ free(p->y.wordv);
+ free(p->z1.wordv);
+ free(p->z2.wordv);
+ return 1;
+ }
+ bigint_set_zero(&p->x);
+ bigint_set_zero(&p->y);
+ bigint_set_zero(&p->z1);
+ bigint_set_zero(&p->z2);
+ bigint_set_zero(&p->z3);
+ return 0;
+}
+
+void ecc_chudnovsky_point_free(ecc_chudnovsky_point_t *p){
+ free(p->x.wordv);
+ free(p->y.wordv);
+ free(p->z1.wordv);
+ free(p->z2.wordv);
+ free(p->z3.wordv);
+}
+