version 1.1, 2018/09/19 05:45:07 |
version 1.2, 2018/09/28 08:20:28 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM$ |
* $OpenXM: OpenXM_contrib2/asir2018/engine/gfs.c,v 1.1 2018/09/19 05:45:07 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "inline.h" |
#include "inline.h" |
Line 667 void gfs_galois_action(GFS a,Q e,GFS *c) |
|
Line 667 void gfs_galois_action(GFS a,Q e,GFS *c) |
|
GFS t,s; |
GFS t,s; |
|
|
t = a; |
t = a; |
k = QTOS(e); |
k = ZTOS(e); |
STOQ(current_gfs_p,p); |
STOZ(current_gfs_p,p); |
for ( i = 0; i < k; i++ ) { |
for ( i = 0; i < k; i++ ) { |
pwrgfs(t,p,&s); t = s; |
pwrgfs(t,p,&s); t = s; |
} |
} |
Line 730 void qtogfs(Q a,GFS *c) |
|
Line 730 void qtogfs(Q a,GFS *c) |
|
|
|
if ( a && (sgnq(a) < 1) ) |
if ( a && (sgnq(a) < 1) ) |
error("qtogfs : invalid argument"); |
error("qtogfs : invalid argument"); |
s = QTOS(a)%current_gfs_q; |
s = ZTOS(a)%current_gfs_q; |
itogfs(s,c); |
itogfs(s,c); |
} |
} |
|
|
Line 762 void gfstopgfs(GFS a,V v,P *c) |
|
Line 762 void gfstopgfs(GFS a,V v,P *c) |
|
*c = 0; |
*c = 0; |
else if ( !current_gfs_ntoi ) { |
else if ( !current_gfs_ntoi ) { |
UTOMQ(CONT(a),t); |
UTOMQ(CONT(a),t); |
STOQ(CONT(t),q); |
STOZ(CONT(t),q); |
*c = (P)q; |
*c = (P)q; |
} else |
} else |
enc_to_p(current_gfs_p,current_gfs_iton[CONT(a)],v,c); |
enc_to_p(current_gfs_p,current_gfs_iton[CONT(a)],v,c); |
Line 925 void pwrgfs(GFS a,Z b,GFS *c) |
|
Line 925 void pwrgfs(GFS a,Z b,GFS *c) |
|
else if ( !a ) |
else if ( !a ) |
*c = 0; |
*c = 0; |
else if ( !current_gfs_ntoi) { |
else if ( !current_gfs_ntoi) { |
ai = pwrm(current_gfs_q,CONT(a),QTOS(b)); |
ai = pwrm(current_gfs_q,CONT(a),ZTOS(b)); |
MKGFS(ai,*c); |
MKGFS(ai,*c); |
} else { |
} else { |
STOQ(CONT(a),an); mulz(an,b,&tn); |
STOZ(CONT(a),an); mulz(an,b,&tn); |
STOQ(current_gfs_q1,an); remz(tn,an,&rn); |
STOZ(current_gfs_q1,an); remz(tn,an,&rn); |
if ( !rn ) |
if ( !rn ) |
itogfs(1,c); |
itogfs(1,c); |
else { |
else { |
ai = QTOS(rn); |
ai = ZTOS(rn); |
MKGFS(ai,*c); |
MKGFS(ai,*c); |
} |
} |
} |
} |
Line 965 void pthrootgfs(GFS a,GFS *b) |
|
Line 965 void pthrootgfs(GFS a,GFS *b) |
|
int e,i; |
int e,i; |
GFS t,s; |
GFS t,s; |
|
|
STOQ(characteristic_sf(),p); |
STOZ(characteristic_sf(),p); |
e = extdeg_sf()-1; |
e = extdeg_sf()-1; |
t = a; |
t = a; |
for ( i = 0; i < e; i++ ) { |
for ( i = 0; i < e; i++ ) { |
Line 1131 int _pwrsf(int a,int b) |
|
Line 1131 int _pwrsf(int a,int b) |
|
return FTOIF(a); |
return FTOIF(a); |
} else { |
} else { |
iftogfs(a,&at); |
iftogfs(a,&at); |
STOQ(b,bt); |
STOZ(b,bt); |
pwrgfs(at,bt,&ct); |
pwrgfs(at,bt,&ct); |
c = CONT(ct); |
c = CONT(ct); |
return FTOIF(c); |
return FTOIF(c); |