code: drawterm

Download patch

ref: 42924ab37b6c00e9e6d437bddfe12633e43de634
parent: 47d5080818787c8614404ee0241a5858a69b8e2e
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Feb 19 04:09:24 EST 2016

libsec/libmp: convert anonymous structs (thanks fish)

--- a/include/libsec.h
+++ b/include/libsec.h
@@ -475,7 +475,7 @@
 
 typedef ECpoint ECpub;
 typedef struct ECpriv{
-	ECpoint;
+	ECpoint a;
 	mpint *d;
 } ECpriv;
 
--- a/include/mp.h
+++ b/include/mp.h
@@ -165,7 +165,7 @@
 
 struct Mfield
 {
-	mpint;
+	mpint	m;
 	int	(*reduce)(Mfield*, mpint*, mpint*);
 };
 
--- a/libmp/cnfield.c
+++ b/libmp/cnfield.c
@@ -13,7 +13,7 @@
 typedef struct CNfield CNfield;
 struct CNfield
 {
-	Mfield;	
+	Mfield f;	
 
 	mpint	m[1];
 
@@ -28,7 +28,7 @@
 	CNfield *f = (CNfield*)m;
 	int qn, tn, k;
 
-	k = f->top;
+	k = f->f.m.top;
 	if((a->top - k) >= MAXDIG)
 		return -1;
 
@@ -104,8 +104,8 @@
 	f->m->p = (mpdigit*)&f[1];
 	mpassign(M, f->m);
 	mpassign(N, (mpint*)f);
-	f->reduce = cnreduce;
-	f->flags |= MPfield;
+	f->f.reduce = cnreduce;
+	f->f.m.flags |= MPfield;
 out:
 	mpfree(M);
 	mpfree(C);
--- a/libmp/gmfield.c
+++ b/libmp/gmfield.c
@@ -14,7 +14,7 @@
 typedef struct GMfield GMfield;
 struct GMfield
 {
-	Mfield;	
+	Mfield f;	
 
 	mpint	m2[1];
 
@@ -36,7 +36,7 @@
 	if(a != r)
 		mpassign(a, r);
 
-	d = g->top;
+	d = g->f.m.top;
 	mpbits(r, (d+1)*Dbits*2);
 	memmove(t+d, r->p+d, d*Dbytes);
 
@@ -45,7 +45,7 @@
 	r->p[d] = 0;
 
 	if(g->nsub > 0)
-		mpvecdigmuladd(g->p, d, g->nsub, r->p);
+		mpvecdigmuladd(g->f.m.p, d, g->nsub, r->p);
 
 	x = g->indx;
 	for(i=0; i<g->nadd; i++){
@@ -68,10 +68,10 @@
 		mpvecsub(r->p, d+1, t, d, r->p);
 	}
 
-	mpvecdigmulsub(g->p, d, r->p[d], r->p);
+	mpvecdigmulsub(g->f.m.p, d, r->p[d], r->p);
 	r->p[d] = 0;
 
-	mpvecsub(r->p, d+1, g->p, d, r->p+d+1);
+	mpvecsub(r->p, d+1, g->f.m.p, d, r->p+d+1);
 	d0 = r->p[2*d+1];
 	for(j=0; j<d; j++)
 		r->p[j] = (r->p[j] & d0) | (r->p[j+d+1] & ~d0);
@@ -123,8 +123,8 @@
 	g->m2->size = d*2+1;
 	mpmul(N, N, g->m2);
 	mpassign(N, (mpint*)g);
-	g->reduce = gmreduce;
-	g->flags |= MPfield;
+	g->f.reduce = gmreduce;
+	g->f.m.flags |= MPfield;
 
 	s = 0;
 	x = g->indx;
--- a/libsec/ecc.c
+++ b/libsec/ecc.c
@@ -399,8 +399,8 @@
 		p = mallocz(sizeof(*p), 1);
 		if(p == nil)
 			return nil;
-		p->x = mpnew(0);
-		p->y = mpnew(0);
+		p->a.x = mpnew(0);
+		p->a.y = mpnew(0);
 		p->d = mpnew(0);
 	}
 	for(;;){
@@ -418,8 +418,8 @@
 	ECpriv tmp;
 	mpint *E, *t;
 
-	tmp.x = mpnew(0);
-	tmp.y = mpnew(0);
+	tmp.a.x = mpnew(0);
+	tmp.a.y = mpnew(0);
 	tmp.d = mpnew(0);
 	E = betomp(dig, len, nil);
 	t = mpnew(0);
@@ -427,7 +427,7 @@
 		mpright(E, 8*len - mpsignif(dom->n), E);
 	for(;;){
 		ecgen(dom, &tmp);
-		mpmod(tmp.x, dom->n, r);
+		mpmod(tmp.a.x, dom->n, r);
 		if(mpcmp(r, mpzero) == 0)
 			continue;
 		mpmul(r, priv->d, s);
@@ -440,8 +440,8 @@
 	}
 	mpfree(t);
 	mpfree(E);
-	mpfree(tmp.x);
-	mpfree(tmp.y);
+	mpfree(tmp.a.x);
+	mpfree(tmp.a.y);
 	mpfree(tmp.d);
 }
 
--- a/libsec/tlshand.c
+++ b/libsec/tlshand.c
@@ -976,8 +976,8 @@
 	}
 
 	memset(&Q, 0, sizeof(Q));
-	Q.x = mpnew(0);
-	Q.y = mpnew(0);
+	Q.a.x = mpnew(0);
+	Q.a.y = mpnew(0);
 	Q.d = mpnew(0);
 
 	memset(&K, 0, sizeof(K));
@@ -994,8 +994,8 @@
 
 	mpfree(K.x);
 	mpfree(K.y);
-	mpfree(Q.x);
-	mpfree(Q.y);
+	mpfree(Q.a.x);
+	mpfree(Q.a.y);
 	mpfree(Q.d);
 
 	ecpubfree(pub);