Esempio n. 1
0
int mcl_ecpbs_verify(mcl_ecpbs_signature *signature, char *info, char *message,
		mcl_ecpbs_parameters *parameters, mcl_ecpbs_pk *pk, mcl_ecpbs_workspace *workspace) {
	add(signature->omega, signature->delta, workspace->result);
	mcl_ecpbs_mod(workspace->result, parameters->q);

	mcl_ecpbs_Fhash(workspace->z, info, parameters);

	ecurve_mult2(signature->rho, parameters->g, signature->omega, pk->key,
			workspace->alpha);
	ecurve_mult2(signature->sigma, parameters->g, signature->delta,
			workspace->z, workspace->beta);

	mcl_ecpbs_hash_epsilon(workspace->check, workspace->alpha, workspace->beta,
			workspace->z, message, parameters);

	return mr_compare(workspace->result, workspace->check);
}
Esempio n. 2
0
double mult_double(int eb,epoint *g)
{
    big e1,e2;
    int iterations=0;
    clock_t start;
    double elapsed;
    char *mem1;
    char *mem2;
    epoint *w;
    epoint *r1;
    epoint *r2;

    mem1=(char *)memalloc(2);
    mem2=(char *)ecp_memalloc(3);

    e1=mirvar_mem(mem1,0);
    e2=mirvar_mem(mem1,1);
    w=epoint_init_mem(mem2,0);
    r1=epoint_init_mem(mem2,1);
    r2=epoint_init_mem(mem2,2);

    bigbits(eb,e1);
    ecurve_mult(e1,g,r1);   /* generate a random point on the curve */
    bigbits(eb,e2);
    ecurve_mult(e2,g,r2);   /* generate a random point on the curve */
    bigbits(eb,e1);
    bigbits(eb,e2);
    start=clock();

    do {
       ecurve_mult2(e1,r1,e2,r2,w);
       iterations++;
       elapsed=(clock()-start)/(double)CLOCKS_PER_SEC;
    } while (elapsed<MIN_TIME || iterations<MIN_ITERS);

    elapsed=1000.0*elapsed/iterations;
    printf("ED - %8d iterations             ",iterations);
    printf(" %8.2lf ms per iteration\n",elapsed);

    ecp_memkill(mem2,3);
    memkill(mem1,2);

    return elapsed;
}
Esempio n. 3
0
ECn mul(const Big& e1,const ECn& p1,const Big& e2,const ECn& p2)
{ 
    ECn t; 
    ecurve_mult2(e1.getbig(),p1.get_point(),e2.getbig(),p2.get_point(),t.get_point());
    return t;
}