예제 #1
0
파일: Dlog.c 프로젝트: AvishayYanay/scapi
/* function invertFpPoint : 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_MiraclDlogECFp_invertFpPoint
  (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 the values to it
	  p2 = epoint_init(mip);
	  epoint_get(mip, (epoint*)p1, x, y);
	  epoint_set(mip, x,y,0, p2);

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

	  return (jlong)p2; // return the inverse
}
예제 #2
0
ECn operator-(const ECn& e)
{ ECn t=e; epoint_negate(t.p); return t;}