Mentions légales du service

Skip to content
Snippets Groups Projects
Commit abc73751 authored by Francois Morain's avatar Francois Morain
Browse files

cleaning.

git-svn-id: svn://scm.gforge.inria.fr/svnroot/ecm/trunk@3007 404564d9-a503-0410-82bf-e18ce2cf3989
parent f19d4f9e
Branches
Tags
No related merge requests found
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
#include "addlaws.h" #include "addlaws.h"
#define DEBUG_ADD_LAWS 0
#if DEBUG_ADD_LAWS >= 1 #if DEBUG_ADD_LAWS >= 1
void void
print_mpz_from_mpres(mpres_t x, mpmod_t n) print_mpz_from_mpres(mpres_t x, mpmod_t n)
...@@ -799,63 +797,6 @@ twisted_hessian_sub(ell_point_t R, ell_point_t P, ell_point_t Q, ell_curve_t E, ...@@ -799,63 +797,6 @@ twisted_hessian_sub(ell_point_t R, ell_point_t P, ell_point_t Q, ell_curve_t E,
return ret; return ret;
} }
/* 8M+6S+M_a +M_{1/d} or 2*M_d */
int
twisted_hessian_triplicate(ell_point_t R, ell_point_t P,
ATTRIBUTE_UNUSED ell_curve_t E, mpmod_t n)
{
// R = buf[0], V = [1], S = [2], A = [3], B = [4], C = [5], D = [6]
// E = [7], tmp = [8]
/* R:=(a*X1^3) mod N;*/
mpres_sqr(E->buf[0], P->x, n);
mpres_mul(E->buf[0], E->buf[0], P->x, n);
mpres_mul(E->buf[0], E->buf[0], E->a4, n);
/* V:=Y1^3 mod N;*/
mpres_sqr(E->buf[1], P->y, n);
mpres_mul(E->buf[1], E->buf[1], P->y, n);
/* S:=Z1^3 mod N;*/
mpres_sqr(E->buf[2], P->z, n);
mpres_mul(E->buf[2], E->buf[2], P->z, n);
/* A:=(R-V)^2 mod N;*/
mpres_sub(E->buf[3], E->buf[0], E->buf[1], n);
mpres_sqr(E->buf[3], E->buf[3], n);
/* B:=(R-S)^2 mod N;*/
mpres_sub(E->buf[4], E->buf[0], E->buf[2], n);
mpres_sqr(E->buf[4], E->buf[4], n);
/* C:=(V-S)^2 mod N;*/
mpres_sub(E->buf[5], E->buf[1], E->buf[2], n);
mpres_sqr(E->buf[5], E->buf[5], n);
/* D:=(A+C) mod N;*/
mpres_add(E->buf[6], E->buf[3], E->buf[5], n);
/* E:=(A+B) mod N;*/
mpres_add(E->buf[7], E->buf[3], E->buf[4], n);
// ok if 1/d small
// X3:=(1/d)*(R+V+S)*(B+D) mod N;
// d small => scaling Y3 and Z3*/
/* X3:=(R+V+S)*(B+D) mod N; */
mpres_add(R->x, E->buf[0], E->buf[1], n);
mpres_add(R->x, R->x, E->buf[2], n);
mpres_add(E->buf[8], E->buf[4], E->buf[6], n);
mpres_mul(R->x, R->x, E->buf[8], n);
/* Y3:=(2*R*C-V*(C-E)) mod N;*/
mpres_mul(R->y, E->buf[0], E->buf[5], n);
mpres_add(R->y, R->y, R->y, n);
mpres_sub(E->buf[8], E->buf[5], E->buf[7], n);
mpres_mul(E->buf[8], E->buf[8], E->buf[1], n);
mpres_sub(R->y, R->y, E->buf[8], n);
/* Z3:=(2*V*B-R*(B-D)) mod N;*/
mpres_mul(R->z, E->buf[1], E->buf[4], n);
mpres_add(R->z, R->z, R->z, n);
mpres_sub(E->buf[8], E->buf[4], E->buf[6], n);
mpres_mul(E->buf[8], E->buf[8], E->buf[0], n);
mpres_sub(R->z, R->z, E->buf[8], n);
/* Y3:=(d*Y3) mod N; scaling when d small*/
mpres_mul(R->y, R->y, E->a6, n);
/* Z3:=(d*Z3) mod N; scaling when d small*/
mpres_mul(R->z, R->z, E->a6, n);
return 1;
}
/* INPUT: a*x^3+y^3+1 = d*x*y /* INPUT: a*x^3+y^3+1 = d*x*y
OUTPUT: Y^2 = X^3+A*X+B OUTPUT: Y^2 = X^3+A*X+B
If a=c^3, then curve isom to Hessian (c*x)^3+y^3+1=3*(d/(3*c))*(c*x)*y If a=c^3, then curve isom to Hessian (c*x)^3+y^3+1=3*(d/(3*c))*(c*x)*y
......
#define DEBUG_ADD_LAWS 0
#define USE_ADD_SUB_CHAINS 0 #define USE_ADD_SUB_CHAINS 0
#define pt_is_equal(P, Q) (mpz_cmp((P)->x, (Q)->x) == 0 \ #define pt_is_equal(P, Q) (mpz_cmp((P)->x, (Q)->x) == 0 \
...@@ -9,13 +10,6 @@ int pt_is_zero(ell_point_t P, ATTRIBUTE_UNUSED mpmod_t n); ...@@ -9,13 +10,6 @@ int pt_is_zero(ell_point_t P, ATTRIBUTE_UNUSED mpmod_t n);
void pt_set_to_zero(ell_point_t P, mpmod_t n); void pt_set_to_zero(ell_point_t P, mpmod_t n);
void pt_assign(ell_point_t Q, ell_point_t P, ATTRIBUTE_UNUSED mpmod_t n); void pt_assign(ell_point_t Q, ell_point_t P, ATTRIBUTE_UNUSED mpmod_t n);
void pt_neg(ell_point_t P, mpmod_t n); void pt_neg(ell_point_t P, mpmod_t n);
void pt_many_set_to_zero(ell_point_t *tP, int nE, mpmod_t n);
void pt_many_neg(ell_point_t *tP, int nE, mpmod_t n);
void pt_many_assign(ell_point_t *tQ, ell_point_t *tP, int nE, mpmod_t n);
void pt_many_print(ell_curve_t *tE, ell_point_t *tP, int nE, mpmod_t n);
void print_mpz_from_mpres(mpres_t x, mpmod_t n);
int pt_many_duplicate(mpz_t f, ell_point_t *tQ, ell_point_t *tP, ell_curve_t *tE, int nE, mpmod_t n, mpres_t *num, mpres_t *den, mpres_t *inv, char *ok);
int pt_many_mul(mpz_t f, ell_point_t *tQ, ell_point_t *tP, ell_curve_t *tE, int nE, mpz_t e, mpmod_t n, mpres_t *num, mpres_t *den, mpres_t *inv, char *ok);
int hessian_to_weierstrass(mpz_t f, mpres_t x, mpres_t y, mpres_t D, mpmod_t n); int hessian_to_weierstrass(mpz_t f, mpres_t x, mpres_t y, mpres_t D, mpmod_t n);
int int
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment