/* Make an list empty, is frees the memory allocated*/ void make_list_attribute_empty(list_attribute_type *list) { attribute_type aux; while (!is_empty_attribute_list(list)) { aux=remove_first_of_list_attribute(list); free_attribute(aux); } }
// just in user_add_attribute useable void add_attribute( user_secret_key * out, public_key pk, public_key att) { //trick it s just a fake public_key public_key par_pk; par_pk.ID_tuple = att.ID_tuple; par_pk.level = att.level - 1; public_key_copy(&(out->pk), &par_pk); domain_manager* par = dm_from_publickey(par_pk); Q_tuple SK_u; generate_SK_u(&SK_u,par, pk); // free_Q_tuple(out->Q_tuple); element_t SK_a; generate_SK_ua(&SK_a, par, pk, att); out-> SK_a = (element_t* ) malloc( sizeof(element_t)); out->number_of_attributes = 1; element_init_G1(out->SK_a[0], pairing); element_set(out->SK_a[0], SK_a); element_clear(SK_a); out->Q_tuple = SK_u; attribute temp; attribute_from_pk(&temp, att); out->attribute = (attribute*) malloc(sizeof(attribute)); attribute_copy(out->attribute, &temp); free_attribute(temp); }