Ciao, ogni volta che devi usare un intero, devi inizializzarlo. Non puoi dargli un valore se non è stato prima inizializzato:

Codice PHP:
#include<stdio.h> 
#include<stdlib.h> 
#include<gmp.h> 
#include <iostream>

using namespace std;

main (int argcchar **argv

  
mpz_t G
  
mpz_t y
  
//mpz_init (y); 
  
mpz_t p
  
mpz_t temp
  
mpz_t temp1
  
mpz_t v1
  
mpz_t k
  
mpz_t k_inv
  
mpz_t a
  
mpz_t yrs
  
mpz_t r
  
mpz_t s
  
mpz_t m
  
mpz_t ar
  
mpz_t mar
  
mpz_t v2
  
mpz_t yr
  
mpz_t rs
  
mpz_t gcd
   
  
int compk
  
int compgcd
  
int verifica
  
int forprimep
   
   
  
gmp_randstate_t stato
  
gmp_randinit_default(stato); 
    
   
  
/*determinazione di p*/ 

  
mpz_init2(p,128); 
  
mpz_urandomb(pstato128); 
  
/*mpz_setbit (p, 127); 
  mpz_setbit (p, 0);*/      
  
forprimep mpz_probab_prime_p (p1); 
  
//while (forprimep == 0) { 
    //    mpz_add_ui (p, p, 2); 
      //  forprimep = mpz_probab_prime_p (p, 1); 
        //  }; 
    
   /* generazione di g  */ 
   
mpz_init2(G64); 
   
mpz_urandomb(Gstato64); 
   
/* G */ 


   /* generazione di a */ 
   
mpz_init2(a64);    
   
mpz_urandomb(astato64);    
   
/* a */ 
    

   /* calcolo di y */ 
   //mp_size_t new_alloc 
   //_mpz_realloc(y,1024); 
   
mpz_init(y); //<- 1
   
mpz_powm(y,G,a,p); 

   
/* y */     

   /* numero random k  */ 
   
mpz_init2(k64); 
   
mpz_urandomb(kstato64);    
   
mpz_init(temp); //<- 2
   
mpz_sub_ui(tempp2);    
   
compk mpz_cmp(ktemp); 
   while (
compk 0){ 
      
mpz_urandomb(kstato64); 
          }; 
         
          
   
mpz_init(temp1);
   
mpz_sub_ui(temp1p1);    
   
mpz_gcd(gcdktemp1); 
   
compgcd mpz_cmp_ui(gcd1); 
        
   while(
compgcd != 0) { 
         
mpz_urandomb(kstato64); 
         }; 
   
/* k  */    
      
   
mpz_init(r);
   
mpz_powm(rGkp);  
   
mpz_init(k_inv);
   
mpz_invert(k_invktemp1);    
   
mpz_mul(arar);    
   
mpz_init(m);   
   
mpz_urandomb(mstato64);    
   
mpz_init(mar);
   
mpz_sub(marmar);       
   
mpz_init(s);
   
mpz_mul(sk_invmar);     
   
mpz_mod (sstemp1);    
   
mpz_init(yr);
   
mpz_powm(yryrp); 
   
mpz_init(rs);
   
mpz_powm(rsrsp); 
   
mpz_init(yrs);
   
mpz_mul(yrsyrrs); 
   
mpz_init(v1);
   
mpz_mod(v1yrsp); 
   
mpz_init(v2);
   
mpz_powm(v2Gmp); 

   
verifica mpz_cmp(v1v2); 

printf("\n"); 
puts("ALGORITMO ELGAMAL"); 
printf(" \n"); 

printf("\n"); 
puts("CHIAVE PRIVATA"); 
printf(" \n"); 
puts("p ="); 
mpz_out_str(stdout10p); 
printf("\n"); 
puts("G = "); 
mpz_out_str(stdout10G); 
printf("\n"); 
puts ("y= "); 
mpz_out_str (stdout10y); 
printf("\n"); 


printf("\n"); 
puts ("a (CHIAVE SEGRETA) "); 
mpz_out_str (stdout10a); 
printf("\n"); 

printf("\n"); 
puts ("m = (MESSAGGIO)"); 
mpz_out_str (stdout10m); 
printf("\n"); 


printf("\n"); 
puts ("NUMERO RANDOM = "); 
mpz_out_str (stdout10k); 
printf("\n"); 

printf("\n"); 
puts ("FIRMA"); 
printf("\n"); 
puts ("r= "); 
mpz_out_str (stdout10r); 
printf("\n"); 
puts ("s= "); 
mpz_out_str (stdout10s); 
printf("\n"); 

printf("\n"); 
puts ("VERIFICA"); 
printf("\n"); 
puts("v1 = "); 
mpz_out_str (stdout10v1); 
printf("\n"); 
puts("v2 = "); 
mpz_out_str (stdout10v2); 
printf("\n"); 

printf("\n"); 
if(
verifica == 0
  { 
    
puts("v1 = v2 OK!"); 
    
printf("\n"); 
  } 


exit(
0); 

Man mano che trovavo una variabile non inizializzata, lo facevo. Ora compila ma non ho toccato nulla oltre alle inizializzazioni, qundi non so dirti perchè il risultato non sia valido.