示例#1
0
文件: Dlog.c 项目: AvishayYanay/scapi
/* function invertF2mPoint : This function return the inverse of ec point
 * param m				  : miracl pointer
 * param p1				  : ellitic curve point
 * return			      : the inverse point 
 */
JNIEXPORT jlong JNICALL Java_edu_biu_scapi_primitives_dlog_miracl_MiraclDlogECF2m_invertF2mPoint
  (JNIEnv *env, jobject obj, jlong m, jlong p1){
	  /* convert the accepted parameters to MIRACL parameters*/
	  miracl* mip = (miracl*)m;
	  big x, y;
	  epoint* p2;
	  x= mirvar(mip, 0);
	  y= mirvar(mip, 0);

	  //init the result point and copy p1 values to it
	  p2 = epoint_init(mip);
	  epoint2_get(mip, (epoint*)p1, x, y);
	  epoint2_set(mip, x,y,0, p2);

	  mirkill(x);
	  mirkill(y);
	  //inverse the point
	  epoint2_negate(mip, p2);

	  return (jlong)p2; // return the inverse 
}
示例#2
0
EC2 operator-(const EC2& e)
{ EC2 t=e; epoint2_negate(t.p); return t;}