void BroadcastKEM_using_bitvec(global_broadcast_params_t gbp, broadcast_system_t sys, char *recip, ct_t myct, element_t key) { Gen_encr_prod_from_bitvec(gbp, sys, recip); if(DEBUG && 0) { printf("bitvec product = "); element_out_str(stdout, 0, sys->encr_prod); printf("\n"); } BroadcastKEM_using_product(gbp, sys, myct, key); }
int BCESetup(byte *curve_file_name, int num_user, byte *sys_params_path, byte * global_params_path, byte *sys_priv_key_out) { global_broadcast_params_t gbs; broadcast_system_t sys; //char recip[num_user / NUM_USER_DIVISOR]; char *recip; element_t sys_priv_key; if (curve_file_name == NULL) return 1; if (num_user % NUM_USER_DIVISOR != 0) return 2; if (sys_params_path == NULL) return 3; if (global_params_path == NULL) return 4; if (sys_priv_key_out == NULL) return 5; Setup_global_broadcast_params(&gbs, num_user, (char *) curve_file_name); Gen_broadcast_system(gbs, &sys); recip = (char *) malloc(num_user / NUM_USER_DIVISOR); memset(recip, BIT_VECTOR_UNIT_VALUE, num_user / NUM_USER_DIVISOR); Gen_encr_prod_from_bitvec(gbs, sys, recip); StoreParams((char *) sys_params_path, gbs, sys); StoreGlobalParams((char *) global_params_path, gbs); element_init_Zr(sys_priv_key, gbs->pairing); element_set(sys_priv_key, sys->priv_key); element_to_bytes(sys_priv_key_out, sys_priv_key); memset(recip, BIT_VECTOR_CLEAR_UNIT_VALUE, num_user / NUM_USER_DIVISOR); free(recip); element_random(sys_priv_key); element_clear(sys_priv_key); FreeBCS(sys); pbc_free(sys); FreeGBP(gbs); pbc_free(gbs); return 0; }