src/bls.c.in [233:289]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BIG_XXX r; BIG_XXX_rcopy(r,CURVE_Order_ZZZ); // Generate polynomial: f(x) = a_0 + a_1x + a_2x^2 ... a_{k-1}x^{k-1} BIG_XXX poly[k]; for(int i=0; ival); } /* Calculate f(x) = a_0 + a_1x + a_2x^2 ... a_{k-1}x^{k-1} a0 is the secret */ BIG_XXX x; BIG_XXX_zero(x); BIG_XXX y; for(int j=0; j=0; i--) { BIG_XXX_modmul(y,y,x,r); BIG_XXX_add(y,y,poly[i]); } // Normalise input for comp BIG_XXX_norm(y); if(BIG_XXX_comp(y,r) == 1) { BIG_XXX_sub(y,y,r); } // Output Y shares BIG_XXX_toBytes(Y[j].val,y); Y[j].len = MODBYTES_XXX; } // Output secret BIG_XXX_toBytes(SKO->val,poly[0]); SKO->len = MODBYTES_XXX; return BLS_OK; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - src/bls256.c.in [232:288]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BIG_XXX r; BIG_XXX_rcopy(r,CURVE_Order_ZZZ); // Generate polynomial: f(x) = a_0 + a_1x + a_2x^2 ... a_{k-1}x^{k-1} BIG_XXX poly[k]; for(int i=0; ival); } /* Calculate f(x) = a_0 + a_1x + a_2x^2 ... a_{k-1}x^{k-1} a0 is the secret */ BIG_XXX x; BIG_XXX_zero(x); BIG_XXX y; for(int j=0; j=0; i--) { BIG_XXX_modmul(y,y,x,r); BIG_XXX_add(y,y,poly[i]); } // Normalise input for comp BIG_XXX_norm(y); if(BIG_XXX_comp(y,r) == 1) { BIG_XXX_sub(y,y,r); } // Output Y shares BIG_XXX_toBytes(Y[j].val,y); Y[j].len = MODBYTES_XXX; } // Output secret BIG_XXX_toBytes(SKO->val,poly[0]); SKO->len = MODBYTES_XXX; return BLS_OK; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -