void test_encryt_decrypt() { printf("ENCRYPT/DECRYPT\n"); int i, j, m0, m1; mpz_t c0, c1; mpz_init(c0); mpz_init(c1); fhe_pk_t pk; fhe_sk_t sk; fhe_pk_init(pk); fhe_sk_init(sk); for (i = 0; i < KEYRUNS; i++) { fhe_keygen(pk, sk); for (j = 0; j < RUNS; j++) { fhe_encrypt(c0, pk, 0); m0 = fhe_decrypt(c0, sk); fhe_encrypt(c1, pk, 1); m1 = fhe_decrypt(c1, sk); assert(m0 == 0); assert(m1 == 1); printf("."); fflush(stdout); } printf("\n"); } fhe_pk_clear(pk); fhe_sk_clear(sk); mpz_clear(c0); mpz_clear(c1); printf("PASSED.\n"); }
void test_fully_homomorphic() { printf("FULLY HOMOMORPHIC (with recrypt)\n"); int i, j, m; mpz_t c0, c1, temp; mpz_init(c0); mpz_init(c1); mpz_init(temp); fhe_pk_t pk; fhe_sk_t sk; fhe_pk_init(pk); fhe_sk_init(sk); for (i = 0; i < KEYRUNS; i++) { mpz_t c0, c1; mpz_init(c0); mpz_init(c1); fhe_pk_t pk; fhe_sk_t sk; fhe_pk_init(pk); fhe_sk_init(sk); fhe_keygen(pk, sk); fhe_encrypt(c0, pk, 0); printf("\nadd-chain: "); for (j = 0; j < RUNS*RUNS; j++) { fhe_add(c0, c0, c0, pk); fhe_recrypt(c0, pk); m = fhe_decrypt(c0, sk); printf("%i", m); fflush(stdout); } fhe_encrypt(c1, pk, 1); printf("\nmul-chain: "); for (j = 0; j < RUNS*RUNS; j++) { fhe_mul(c1, c1, c1, pk); fhe_recrypt(c1, pk); m = fhe_decrypt(c1, sk); printf("%i", m); fflush(stdout); } printf("\n"); } fhe_pk_clear(pk); fhe_sk_clear(sk); mpz_clear(c0); mpz_clear(c1); mpz_clear(temp); printf("PASSED.\n"); }
void test_xor_bits(){ unsigned m, aux; mpz_t c0, c1; fmpz_poly_t poly_c; mpz_init(c0); mpz_init(c1); fmpz_poly_init(poly_c); fhe_pk_t pk; fhe_sk_t sk; fhe_pk_init(pk); fhe_sk_init(sk); fhe_keygen(pk, sk); int j, nbits; struct timeval start, end; long mtime, seconds, useconds; //clock_t START_eval; //double T_Elapsed4; m= 2147483648 ; for(int i=0; i< 250; i++){ m= m + 2; j=0; //printf("--------->%i\n", m % 2); fhe_encrypt(c0, pk, m % 2); fmpz_poly_set_coeff_mpz ( poly_c , 0 , c0 ); aux = m; aux = aux >> 1; do { // printf("--------->%i\n", aux % 2); fhe_encrypt(c0, pk, aux % 2); aux = aux >> 1; j++; fmpz_poly_set_coeff_mpz ( poly_c , j , c0 ); //fhe_add(c0, c0, c1, pk); }while(aux != 0); nbits= j+1; //START_eval = clock(); gettimeofday(&start, NULL); mpz_set(c1, c0); while(j>0){ j--; fmpz_poly_get_coeff_mpz ( c0 , poly_c , j ); fhe_add(c1, c0, c1, pk); } gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; //printf("Elapsed time in KeyGen : %ld ms \n", mtime ); aux = fhe_decrypt(c1, sk); printf("xor de %u: %d bits, runtime: %ld ms\n", m, nbits, mtime); } mpz_clear(c0); mpz_clear(c1); fmpz_poly_clear(poly_c); fhe_pk_clear(pk); fhe_sk_clear(sk); }
void test_sum_integers(unsigned a , unsigned b, fhe_pk_t pk, fhe_sk_t sk){ unsigned res; fmpz_poly_t s; // mpz_t c; fmpz_poly_init(s); mpz_init(c); // Integers to be added printf("a: %u , b: %u ", a,b); // sum32_ui(s, a, b, pk, sk); //decrypt res=0; for(int i=fmpz_poly_degree(s); i >= 0; i--){ fmpz_poly_get_coeff_mpz(c,s,i); res = res * 2 + fhe_decrypt(c, sk); } printf("sum: %u ", res); assert(res == a + b); // fmpz_poly_clear(s); mpz_clear(c); }
void test_recrypt() { printf("RECRYPT\n"); mpz_t c0, c1; mpz_init(c0); mpz_init(c1); fhe_pk_t pk; fhe_sk_t sk; fhe_pk_init(pk); fhe_sk_init(sk); for (int i = 0; i < KEYRUNS; i++) { fhe_keygen(pk, sk); for (int j = 0; j < RUNS; j++) { fhe_encrypt(c0, pk, 0); fhe_encrypt(c1, pk, 1); fhe_recrypt(c0, pk); assert(fhe_decrypt(c0, sk) == 0); fhe_recrypt(c1, pk); assert(fhe_decrypt(c1, sk) == 1); printf("."); fflush(stdout); } printf("\n"); } fhe_pk_clear(pk); fhe_sk_clear(sk); mpz_clear(c0); mpz_clear(c1); printf("PASSED.\n"); }
void memdump(int rows,fhe_sk_t sk) { int i,j; int shift,val; puts("___DUMP_START___"); for(i=0;i<rows;i++) { shift=1;val=0; printf("%d\t",i); for(j=0;j<Memory_WORD_SIZE;j++) { if(j<8) if(fhe_decrypt(Memory_cellarray[i][j]->v,sk)==1) val+=shift; shift*=2; printf("%d ",fhe_decrypt(Memory_cellarray[i][j]->v,sk)); } printf(" %d\n",val); } puts("___DUMP_END_____"); }
void essai(){ fhe_pk_t pk; fhe_sk_t sk; fhe_pk_init(pk); fhe_sk_init(sk); fhe_keygen(pk, sk); mpz_t c; mpz_init(c); mpz_set_ui(c, 1); int m= fhe_decrypt(c, sk); printf("m= %d\n",m); mpz_clear(c); fhe_pk_clear(pk); fhe_sk_clear(sk); }
void Memory_access(fhe_int_t *a,fhe_int_t *reg,fhe_int_t rw,fhe_int_t *b1,fhe_pk_t pk,fhe_sk_t sk) { int row; int mask; int m; int i; int i2; int j; if(!inited) { inited=1; for(i=0;i<Memory_ARRAY_ROWS;i++) fhe_int_init(r[i]); fhe_int_init(nam); fhe_int_init(nam2); fhe_int_init(nrw); fhe_int_init(read); fhe_int_init(write); fhe_int_init(nsel); } puts("memory access 1");fflush(stdout); //this loop generates a positive row signal for the *one* selected row if(fhe_decrypt(rw->v,sk)==1) puts(" read request"); else puts(" write request"); for(row=0;row<Memory_ARRAY_ROWS;row++) { mask=4; Function_not(nam,a[0],pk); Function_not(nam2,a[1],pk); Function_and2(r[row],(row&1)>0?a[0]:nam,(row&2)>0?a[1]:nam2,pk); for(m=2;m<Memory_ARRAY_COLS;m++,mask<<=1) { Function_not(nam,a[m],pk); Function_and2(r[row],r[row],(row&mask)>0?a[m]:nam,pk); } if(fhe_decrypt(r[row]->v,sk)==1) printf(" row selected: %d\n",row); } puts("memory access 2");fflush(stdout); //now we generate a for(row=0;row<Memory_ARRAY_ROWS;row++) { for(i2=0;i2<Memory_ARRAY_COLS;i2++) { Function_not(nam,r[row],pk); Function_not(nrw,rw,pk); Function_and2(write,nrw,reg[i2],pk); //write bit Function_and2(read,rw,Memory_cellarray[row][i2],pk); //read bit Function_and2(nsel,nam,Memory_cellarray[row][i2],pk); //row not selected Function_or3(Memory_cellarray[row][i2],read,write,nsel,pk); } } puts("memory access 3");fflush(stdout); //combine row signals and cell bits (or-circuit) //load b1 for(i=0;i<Memory_WORD_SIZE;i++) { Function_and2(nam ,r[0],Memory_cellarray[0][i],pk); Function_and2(nam2,r[1],Memory_cellarray[1][i],pk); Function_or2 (b1[i],nam,nam2,pk); //b1[i]=Function_or2(Function_and2(r[0],Memory_cellarray[0][i]),Function_and2(r[1],Memory_cellarray[1][i])); for(j=2;j<Memory_ARRAY_ROWS;j++) { Function_and2(nam,r[j],Memory_cellarray[j][i],pk); Function_or2(b1[i],b1[i],nam,pk); //b1[i]=Function_or2(b1[i],Function_and2(r[j],Memory_cellarray[j][i])); } } return; }
void trans_print(_fhe_int *data,int len,fhe_sk_t sk) { for(int i=0;i<len;i++) printf("%d ",fhe_decrypt((&data[i])->mpz,sk)); }
void test_bitonic_sort(){ // Sorts a bitonic array of 2^n elements int n = 32;// Nombre d'entiers à trier int nbits = 8 ;// Size in number of bits int *list = malloc(sizeof(int)*n); // List d'entiers à trier fmpz_poly_t * poly_nums; poly_nums = malloc(sizeof(fmpz_poly_t) * n); int aux ; int a ; int i; mpz_t c0; mpz_t tmp; mpz_init(tmp); int d ; fhe_pk_t pk; fhe_sk_t sk; fhe_pk_init(pk); fhe_sk_init(sk); fhe_keygen(pk, sk); mpz_init(c0); struct timeval start, end; long mtime, seconds, useconds; for(int obs=0;obs<3;obs++){ ////////////// Encryption of the bit sequennces ////////// srand(time(NULL)); int mod = (int)pow(2, nbits); printf("The array is \n"); for(int t=0;t<n;t++){ list[t]= rand()%mod; printf("%d ", list[t]); } printf("\n"); nbits = 0; for(int k = 0; k < n ; k++){ i=0; fmpz_poly_init(poly_nums[k]); a= list[k]; aux=a; fhe_encrypt(c0, pk, a % 2); fmpz_poly_set_coeff_mpz( poly_nums[k] , i , c0 ); aux = aux >> 1; do { //printf("--------->%i\n", aux % 2); fhe_encrypt(c0, pk, aux % 2); i++; fmpz_poly_set_coeff_mpz ( poly_nums[k] , i , c0 ); aux = aux >> 1; }while(aux!= 0); if(i+1>nbits) nbits=i+1; } ////////////////// Bitonic Sorting : sort from the index 0 till n ////////////// clock_t START_eval = clock(); gettimeofday(&start, NULL); bitonicSortUp(poly_nums, nbits, n, 0, n, sk, pk); double T_Elapsed4 = (double) (clock () - START_eval); //T_Elapsed4/=CLOCKS_PER_SEC; //printf(" Evaluation took %f clock/sec \n ", T_Elapsed4); gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("%d \t %d \t %f \t %ld \n",n, nbits, T_Elapsed4, mtime); printf("After Bitonic sort \n"); for (i=0;i<n;i++){ aux = 0; d=0; for (int k=nbits-1;k>=0;k--){ fmpz_poly_get_coeff_mpz(tmp, poly_nums[i],k); d = fhe_decrypt(tmp, sk); aux = (aux*2)+d; } printf("%d ", aux); } printf("\n"); } ////////////// Decryption ///////////////////// /* for(i=0;i<n;i++){ printf(" \n The %d'th number is \n", i); for(k=0;k<nbits;k++){ fmpz_poly_get_coeff_mpz(tmp, poly_nums[i],k); printf(" %i ", fhe_decrypt(tmp, sk)); } } printf("\n"); mpz_t tmp; mpz_init(tmp); int d ; printf("\n After Bitonic sort \n"); for (i=0;i<n;i++){ aux = 0; d=0; for (int k=nbits-1;k>=0;k--){ fmpz_poly_get_coeff_mpz(tmp, poly_nums[i],k); d = fhe_decrypt(tmp, sk); aux = (aux*2)+d; } printf(" %d ", aux); } */ printf("\n"); for(int k=0;k<n;k++) fmpz_poly_clear( poly_nums[k]); free(poly_nums); fhe_pk_clear(pk); fhe_sk_clear(sk); mpz_clear(c0); mpz_clear(tmp); free(list); }
void test_min_max(){ clock_t START_init = clock(); struct timeval start, end; long mtime, seconds, useconds; gettimeofday(&start, NULL); //////////////// Initialization //////////////// unsigned a ,b, aux1, aux2; a=2; b=5; printf("a = %d et b = %d\n", a, b); aux1 = a ; aux2=b; int i = 0; // unsigned a =30050183, b= 504195648; // unsigned aux1, aux2; int nbits; // Number of bits in the binary representation of the integers mpz_t c0, c1; fmpz_poly_t poly_c1; fmpz_poly_t poly_c2; mpz_init(c0); mpz_init(c1); fmpz_poly_init(poly_c1); fmpz_poly_init(poly_c2); fhe_pk_t pk; fhe_sk_t sk; fhe_pk_init(pk); fhe_sk_init(sk); double T_Elapsed1 = (double) ( clock () - START_init ); printf(" Initialization of the variables etc took %f clocks / sec \n ", T_Elapsed1); gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("Elapsed time in Init : %ld milliseconds\n", mtime); ////////////////////// Initialization Ends //////////////////// //////////////////////// Key Generation ///////// clock_t START_keygen = clock(); gettimeofday(&start, NULL); fhe_keygen(pk, sk); double T_Elapsed2 = (double) (clock () - START_keygen); printf(" KeyGen took %f clocks/sec \n", T_Elapsed2); gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("Elapsed time in KeyGen : %ld milliseconds\n", mtime); ////////////////////// Key Generation Ends ///////////// ////// Encryption of the bit sequences //////////////// clock_t START_enc = clock(); gettimeofday(&start, NULL); fhe_encrypt(c0, pk, a % 2); fhe_encrypt(c1, pk, b % 2); fmpz_poly_set_coeff_mpz( poly_c1 , i , c0 ); fmpz_poly_set_coeff_mpz( poly_c2, i, c1 ); aux1 = aux1 >> 1; aux2 = aux2 >> 1; do { //printf("--------->%i\n", aux % 2); fhe_encrypt(c0, pk, aux1 % 2); fhe_encrypt(c1, pk, aux2 %2); i++; fmpz_poly_set_coeff_mpz ( poly_c1 , i , c0 ); fmpz_poly_set_coeff_mpz (poly_c2, i, c1); aux1 = aux1 >> 1; aux2 = aux2 >> 1; }while(aux1 != 0 || aux2 !=0); nbits=i+1; printf("Maximum number of bits is %d", nbits); double T_Elapsed3 = (double) (clock () - START_enc); printf(" Encryption took %f clocks/sec \n ", T_Elapsed3); gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("Elapsed time in Encryption : %ld milliseconds\n", mtime); /////////////////// Encryption Ends ///////////// /////////// Evaluation //////////////////// clock_t START_eval = clock(); gettimeofday(&start, NULL); mpz_t * max; mpz_t * min; max = malloc(sizeof(mpz_t) * nbits); min = malloc(sizeof(mpz_t) * nbits); for(i=0;i<nbits;i++){ mpz_init(max[i]); mpz_init(min[i]); } /////////// Evaluation //////////////////// //nbits= i +1; //fmpz_poly_t max; //fmpz_poly_t min; //mpz_t * max; //mpz_t * min; //fmpz_poly_init(max); //fmpz_poly_init(min); //max = malloc(sizeof(mpz_t) * nbits); //min = malloc(sizeof(mpz_t) * nbits); //for(i=0;i<nbits;i++){ // mpz_init(max[i]); // mpz_init(min[i]); //} mpz_t a_k; mpz_t b_k; mpz_t tmp; mpz_init(a_k); mpz_init(b_k); mpz_init(tmp); mpz_t aIsGreater; mpz_init(aIsGreater); min_max(min, max, poly_c1, poly_c2, pk, nbits); double T_Elapsed4 = (double) (clock () - START_eval); printf(" Evaluation took %f clock/sec \n ", T_Elapsed4); gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("Elapsed time in Evaluation : %ld milliseconds\n", mtime); //////////////// Evaluation Ends //////////////// /* fmpz_poly_set_coeff_mpz(max , k , tmp) ; //mpz_set(max[k],tmp); fmpz_poly_get_coeff_mpz(a_k, poly_c1,k); fmpz_poly_get_coeff_mpz(b_k, poly_c2,k); fhe_mul(b_k, b_k, aIsGreater,pk); not(tmp, aIsGreater,pk); fhe_mul(a_k, a_k, tmp,pk); or(tmp, a_k,b_k, pk); fmpz_poly_set_coeff_mpz(min , k , tmp) ; //mpz_set(min[k],tmp); }*/ ///////////////////// Decryption ///////////////// clock_t START_dec = clock(); gettimeofday(&start, NULL); aux1= 0; aux2= 0; unsigned d; int k; for(k=nbits-1; k>=0 ;k--){ d = fhe_decrypt(max[k],sk); aux1= (aux1 * 2) + d; } printf("le max est: %d \n", aux1); for(k=nbits-1;k>=0 ;k--){ d= fhe_decrypt(min[k],sk); aux2= (aux2 * 2) +d; } printf("le min est: %d\n", aux2); double T_Elapsed5 = (double) (clock () - START_dec); printf(" Decryption took %f clocks/sec \n ", T_Elapsed5); gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("Elapsed time in Decryption : %ld milliseconds\n", mtime); //////////////////////// Decryption Ends ///////////// for(k=0;k<nbits;k++){ mpz_clear(max[k]); mpz_clear(min[k]); } free(max); free(min); fmpz_poly_clear( poly_c1 ); fmpz_poly_clear( poly_c2 ); fhe_pk_clear(pk); fhe_sk_clear(sk); mpz_clear(c0); mpz_clear(c1); mpz_clear(a_k); mpz_clear(b_k); mpz_clear(tmp); mpz_clear(aIsGreater); }
void test_matrix_prod(int m, int n, int p, int q,fhe_pk_t pk,fhe_sk_t sk){ int c, d, k ; int first[30][30], second[30][30]; mpz_t first_enc[30][30]; mpz_t second_enc[30][30]; mpz_t multiply_enc[30][30]; mpz_t sum; mpz_init(sum); mpz_t tmp; mpz_init(tmp); /* printf("Enter the number of rows and columns of first matrix\n"); scanf("%d%d", &m, &n); printf("Enter the elements of first matrix\n"); for ( c = 0 ; c < m ; c++ ){ for ( d = 0 ; d < n ; d++ ){ scanf("%d", &first[c][d]); mpz_init(first_enc[c][d]); fhe_encrypt(first_enc[c][d], pk, first[c][d]); } } printf("Enter the number of rows and columns of second matrix\n"); scanf("%d%d", &p, &q); */ if ( n != p ) printf("Matrices with entered orders can't be multiplied with each other.\n"); else{ printf("Enter the elements of second matrix\n"); fhe_encrypt(sum, pk, 0); for ( c = 0 ; c < p ; c++ ){ for ( d = 0 ; d < q ; d++ ){ scanf("%d", &second[c][d]); mpz_init(second_enc[c][d]); fhe_encrypt(second_enc[c][d], pk, second[c][d]); } } for ( c = 0 ; c < m ; c++ ){ for ( d = 0 ; d < q ; d++ ){ for ( k = 0 ; k < p ; k++ ){ fhe_mul(tmp, first_enc[c][k], second_enc[k][d], pk); fhe_add(sum, sum, tmp, pk); } mpz_init(multiply_enc[c][d]); mpz_set(multiply_enc[c][d],sum); fhe_encrypt(sum, pk,0); } } printf("Product of entered matrices:-\n"); for ( c = 0 ; c < m ; c++ ) { for ( d = 0 ; d < q ; d++ ) printf("%d\t", fhe_decrypt(multiply_enc[c][d], sk)); printf("\n"); } } }
void mesure_encrypt_decrypt(){ fhe_pk_t pk; fhe_sk_t sk; mpz_t c, aux1, aux2; int m; mpz_init(c); mpz_init(aux1); mpz_init(aux2); mpz_set_ui(aux2, 0); fhe_pk_init(pk); fhe_sk_init(sk); struct timeval start, end; long mtime, seconds, useconds; gettimeofday(&start, NULL); fhe_keygen(pk, sk); gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; //gmp_printf("p: %Zd \n", pk->p); //gmp_printf("alpha: %Zd \n", pk->alpha); //gmp_printf("B: %Zd \n", sk->B); //printf("N: %d , log(p): %d , Mu: %d , Nu: %d , keygen: %ld ",N,mpz_sizeinbase( pk->p, 2), MU, LOG_NU, mtime ); gettimeofday(&start, NULL); for(int i=0; i < 100; i++){ fhe_encrypt(c, pk, 1); } gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("encrypt: %ld ms ", mtime ); gettimeofday(&start, NULL); /* for(int i=0; i < 100; i++){ fhe_fulladd(c, aux1,c,c,aux2, pk); }*/ gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("add : %ld ms ", mtime ); gettimeofday(&start, NULL); for(int i=0; i < 100; i++){ fhe_mul(c,c, c, pk); printf("\nCheck decryption depth %d \n",fhe_decrypt(c,sk)); } gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("mul : %ld ms ", mtime ); gettimeofday(&start, NULL); for(int i=0; i < 100; i++){ fhe_recrypt(c, pk); } gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("recrypt : %ld ms ", mtime ); gettimeofday(&start, NULL); for(int i=0; i < 100; i++){ fhe_decrypt(c, sk); } //printf("m : %d ",m); gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("decrypt : %ld ms ", mtime ); gettimeofday(&start, NULL); test_sum_integers(2000 , 49, pk, sk); gettimeofday(&end, NULL); seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5; printf("sum: %ld ms \n", mtime ); printf("N: %d , log(p): %d , Mu: %d , Nu: %d , keygen: %ld ",N,mpz_sizeinbase( pk->p, 2), MU, LOG_NU, mtime ); mpz_clear(c); mpz_clear(aux1); mpz_clear(aux2); fhe_pk_clear(pk); fhe_sk_clear(sk); }