| 2120 | } |
| 2121 | |
| 2122 | void *thread_bPload_2blooms(void *vargp) { |
| 2123 | char rawvalue[32]; |
| 2124 | struct bPload *tt; |
| 2125 | uint64_t i_counter,j,nbStep; |
| 2126 | IntGroup *grp = new IntGroup(CPU_GRP_SIZE / 2 + 1); |
| 2127 | Point startP; |
| 2128 | Int dx[CPU_GRP_SIZE / 2 + 1]; |
| 2129 | Point pts[CPU_GRP_SIZE]; |
| 2130 | Int dy,dyn,_s,_p; |
| 2131 | Point pp,pn; |
| 2132 | int i,bloom_bP_index,hLength = (CPU_GRP_SIZE / 2 - 1) ,threadid; |
| 2133 | tt = (struct bPload *)vargp; |
| 2134 | Int km((uint64_t)(tt->from +1 )); |
| 2135 | threadid = tt->threadid; |
| 2136 | |
| 2137 | i_counter = tt->from; |
| 2138 | |
| 2139 | nbStep = (tt->to - (tt->from)) / CPU_GRP_SIZE; |
| 2140 | |
| 2141 | if( ((tt->to - (tt->from)) % CPU_GRP_SIZE ) != 0) { |
| 2142 | nbStep++; |
| 2143 | } |
| 2144 | |
| 2145 | km.Add((uint64_t)(CPU_GRP_SIZE / 2)); |
| 2146 | startP = secp->ComputePublicKey(&km); |
| 2147 | grp->Set(dx); |
| 2148 | for(uint64_t s=0;s<nbStep;s++) { |
| 2149 | for(i = 0; i < hLength; i++) { |
| 2150 | dx[i].ModSub(&Gn[i].x,&startP.x); |
| 2151 | } |
| 2152 | dx[i].ModSub(&Gn[i].x,&startP.x); // For the first point |
| 2153 | dx[i + 1].ModSub(&_2Gn.x,&startP.x);// For the next center point |
| 2154 | // Grouped ModInv |
| 2155 | grp->ModInv(); |
| 2156 | |
| 2157 | // We use the fact that P + i*G and P - i*G has the same deltax, so the same inverse |
| 2158 | // We compute key in the positive and negative way from the center of the group |
| 2159 | // center point |
| 2160 | |
| 2161 | pts[CPU_GRP_SIZE / 2] = startP; //Center point |
| 2162 | |
| 2163 | for(i = 0; i<hLength; i++) { |
| 2164 | pp = startP; |
| 2165 | pn = startP; |
| 2166 | |
| 2167 | // P = startP + i*G |
| 2168 | dy.ModSub(&Gn[i].y,&pp.y); |
| 2169 | |
| 2170 | _s.ModMulK1(&dy,&dx[i]); // s = (p2.y-p1.y)*inverse(p2.x-p1.x); |
| 2171 | _p.ModSquareK1(&_s); // _p = pow2(s) |
| 2172 | |
| 2173 | pp.x.ModNeg(); |
| 2174 | pp.x.ModAdd(&_p); |
| 2175 | pp.x.ModSub(&Gn[i].x); // rx = pow2(s) - p1.x - p2.x; |
| 2176 | |
| 2177 | #if 0 |
| 2178 | pp.y.ModSub(&Gn[i].x,&pp.x); |
| 2179 | pp.y.ModMulK1(&_s); |
nothing calls this directly
no test coverage detected