Lines Matching refs:result
84 EpidStatus result = kEpidErr; in NewEpid11PairingState() local
107 result = kEpidBadArgErr; in NewEpid11PairingState()
111 result = kEpidBadArgErr; in NewEpid11PairingState()
119 result = kEpidBadArgErr; in NewEpid11PairingState()
125 result = kEpidMemAllocErr; in NewEpid11PairingState()
137 result = kEpidBadArgErr; in NewEpid11PairingState()
144 result = kEpidBadArgErr; in NewEpid11PairingState()
150 result = NewFfElement(pairing_state_ctx->Fq3, in NewEpid11PairingState()
152 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
153 result = NewFfElement(pairing_state_ctx->Fq, &neg_qnr); in NewEpid11PairingState()
154 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
155 result = NewFfElement(pairing_state_ctx->Fq, &qnr); in NewEpid11PairingState()
156 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
157 result = NewFfElement(pairing_state_ctx->Fq, &inv_qnr); in NewEpid11PairingState()
158 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
159 result = WriteBigNum(ff->modulus_0, sizeof(ff_modulus), &ff_modulus); in NewEpid11PairingState()
160 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
161 result = SetFfElementOctString((ConstOctStr)ff_modulus.x[0].x, in NewEpid11PairingState()
164 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
165 result = FfNeg(pairing_state_ctx->Fq, neg_qnr, qnr); in NewEpid11PairingState()
166 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
167 result = FfInv(pairing_state_ctx->Fq, qnr, inv_qnr); in NewEpid11PairingState()
168 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
169 result = WriteFfElement(pairing_state_ctx->Fq, inv_qnr, &fq3_str.a[0], in NewEpid11PairingState()
171 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
172 result = ReadFfElement(pairing_state_ctx->Fq3, &fq3_str, sizeof(fq3_str), in NewEpid11PairingState()
174 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
178 result = NewFfElement(pairing_state_ctx->Fq3, in NewEpid11PairingState()
180 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
181 result = FfMul(pairing_state_ctx->Fq, inv_qnr, inv_qnr, inv_qnr); in NewEpid11PairingState()
182 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
183 result = WriteFfElement(pairing_state_ctx->Fq, inv_qnr, &fq3_str.a[0], in NewEpid11PairingState()
185 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
186 result = ReadFfElement(pairing_state_ctx->Fq3, &fq3_str, sizeof(fq3_str), in NewEpid11PairingState()
188 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
191 result = NewFfElement(pairing_state_ctx->Fq, &pairing_state_ctx->a); in NewEpid11PairingState()
192 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
193 result = NewBigNum(sizeof(BigNumStr), &p); in NewEpid11PairingState()
194 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
197 BREAK_ON_IPP_ERROR(sts, result); in NewEpid11PairingState()
199 BREAK_ON_IPP_ERROR(sts, result); in NewEpid11PairingState()
203 BREAK_ON_IPP_ERROR(sts, result); in NewEpid11PairingState()
208 result = NewBigNum(2 * sizeof(BigNumStr), in NewEpid11PairingState()
210 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
211 result = NewBigNum(sizeof(BigNumStr), &tmp); in NewEpid11PairingState()
212 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
213 result = ReadBigNum(one_str, sizeof(one_str), tmp); in NewEpid11PairingState()
214 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
216 result = BigNumMul(Ffq->modulus_0, Ffq->modulus_0, in NewEpid11PairingState()
218 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
219 result = BigNumSub(pairing_state_ctx->final_exp_constant, Ffq->modulus_0, in NewEpid11PairingState()
221 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
222 result = BigNumAdd(pairing_state_ctx->final_exp_constant, tmp, in NewEpid11PairingState()
224 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
225 result = BigNumDiv(pairing_state_ctx->final_exp_constant, p, in NewEpid11PairingState()
227 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
228 result = WriteBigNum(tmp, sizeof(remainder_str), &remainder_str); in NewEpid11PairingState()
229 if (kEpidNoErr != result || 0 != remainder_str) { in NewEpid11PairingState()
230 result = kEpidBadArgErr; // p does not divide (q^2 - q + 1) in NewEpid11PairingState()
235 result = NewFfElement(pairing_state_ctx->Fq3, in NewEpid11PairingState()
237 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
239 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
242 result = ReadFfElement(pairing_state_ctx->Fq3, &trans_100, in NewEpid11PairingState()
244 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
247 result = ReadFfElement(pairing_state_ctx->Fq3, &trans_010, in NewEpid11PairingState()
249 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
250 result = FfExp(pairing_state_ctx->Fq3, pairing_state_ctx->alpha_q[1], in NewEpid11PairingState()
252 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
254 result = in NewEpid11PairingState()
257 BREAK_ON_EPID_ERROR(result); in NewEpid11PairingState()
260 result = kEpidNoErr; in NewEpid11PairingState()
269 if (kEpidNoErr != result) { in NewEpid11PairingState()
281 return result; in NewEpid11PairingState()
300 EpidStatus result = kEpidErr; in Epid11Pairing() local
347 result = EcIsIdentity(ps->ga, a, &is_identity); in Epid11Pairing()
348 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
350 result = ReadFfElement(ps->ff, &one_fq6, sizeof(one_fq6), d); in Epid11Pairing()
351 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
352 result = kEpidNoErr; in Epid11Pairing()
357 result = NewFfElement(ps->Fq3, &b0); in Epid11Pairing()
358 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
359 result = NewFfElement(ps->Fq3, &b1); in Epid11Pairing()
360 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
361 result = WriteEcPoint(ps->gb, b, &b_str, sizeof(b_str)); in Epid11Pairing()
362 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
363 result = ReadFfElement(ps->Fq3, &b_str.x, sizeof(b_str.x), b0); in Epid11Pairing()
364 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
365 result = ReadFfElement(ps->Fq3, &b_str.y, sizeof(b_str.y), b1); in Epid11Pairing()
366 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
369 result = NewFfElement(ps->ff, &pQx); in Epid11Pairing()
370 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
371 result = NewFfElement(ps->ff, &pQy); in Epid11Pairing()
372 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
375 result = FfMul(ps->Fq3, ps->fq3_inv_constant, b0, b0); in Epid11Pairing()
376 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
377 result = WriteFfElement(ps->Fq3, b0, &bx_str.a[0], sizeof(bx_str.a[0])); in Epid11Pairing()
378 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
379 result = ReadFfElement(ps->ff, &bx_str, sizeof(bx_str), pQx); in Epid11Pairing()
380 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
383 result = FfMul(ps->Fq3, ps->fq3_inv2_constant, b1, b1); in Epid11Pairing()
384 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
385 result = WriteFfElement(ps->Fq3, b1, &by_str.a[1], sizeof(by_str.a[1])); in Epid11Pairing()
386 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
387 result = ReadFfElement(ps->ff, &by_str, sizeof(by_str), pQy); in Epid11Pairing()
388 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
391 result = NewFfElement(ps->Fq, &px); in Epid11Pairing()
392 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
393 result = NewFfElement(ps->Fq, &py); in Epid11Pairing()
394 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
395 result = WriteEcPoint(ps->ga, a, &a_str, sizeof(a_str)); in Epid11Pairing()
396 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
397 result = ReadFfElement(ps->Fq, &a_str.x, sizeof(a_str.x), px); in Epid11Pairing()
398 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
399 result = ReadFfElement(ps->Fq, &a_str.y, sizeof(a_str.y), py); in Epid11Pairing()
400 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
403 result = NewFfElement(ps->Fq, &X); in Epid11Pairing()
404 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
405 result = NewFfElement(ps->Fq, &Y); in Epid11Pairing()
406 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
407 result = NewFfElement(ps->Fq, &Z); in Epid11Pairing()
408 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
409 result = NewFfElement(ps->Fq, &X2); in Epid11Pairing()
410 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
411 result = NewFfElement(ps->Fq, &Y2); in Epid11Pairing()
412 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
413 result = NewFfElement(ps->Fq, &Z2); in Epid11Pairing()
414 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
415 result = NewFfElement(ps->Fq, &w); in Epid11Pairing()
416 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
417 result = NewFfElement(ps->Fq, &v); in Epid11Pairing()
418 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
419 result = NewFfElement(ps->Fq, &ty); in Epid11Pairing()
420 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
421 result = NewFfElement(ps->Fq, &ry); in Epid11Pairing()
422 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
423 result = NewFfElement(ps->Fq, &t1); in Epid11Pairing()
424 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
425 result = NewFfElement(ps->Fq, &t2); in Epid11Pairing()
426 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
427 result = NewFfElement(ps->Fq, &t3); in Epid11Pairing()
428 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
431 result = NewFfElement(ps->ff, &tx); in Epid11Pairing()
432 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
433 result = NewFfElement(ps->ff, &rx); in Epid11Pairing()
434 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
435 result = NewFfElement(ps->ff, &tt1); in Epid11Pairing()
436 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
437 result = NewFfElement(ps->ff, &tt2); in Epid11Pairing()
438 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
439 result = NewFfElement(ps->ff, &r); in Epid11Pairing()
440 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
443 result = ReadFfElement(ps->Fq, &a_str.x, sizeof(a_str.x), X); in Epid11Pairing()
444 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
447 result = ReadFfElement(ps->Fq, &a_str.y, sizeof(a_str.y), Y); in Epid11Pairing()
448 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
451 result = ReadFfElement(ps->Fq, &one_fq, sizeof(one_fq), Z); in Epid11Pairing()
452 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
455 result = ReadFfElement(ps->Fq, &one_fq, sizeof(one_fq), ry); in Epid11Pairing()
456 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
459 result = ReadFfElement(ps->ff, &one_fq6, sizeof(one_fq6), rx); in Epid11Pairing()
460 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
467 result = FfMul(ps->Fq, Z, Z, ty); // ty = Z^2 in Epid11Pairing()
468 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
469 result = FfMul(ps->Fq, ty, ty, t1); // t1 = Z^4 in Epid11Pairing()
470 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
471 result = FfMul(ps->Fq, t1, ps->a, t1); // t1 = a*Z^4 in Epid11Pairing()
472 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
473 result = FfMul(ps->Fq, X, X, w); // w = X^2 in Epid11Pairing()
474 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
475 result = FfAdd(ps->Fq, w, w, t2); // t2 = 2 * X^2 in Epid11Pairing()
476 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
477 result = FfAdd(ps->Fq, w, t2, w); // w = 3 * X^2 in Epid11Pairing()
478 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
479 result = FfAdd(ps->Fq, w, t1, w); // w = 3 * X^2 + a * Z^4 in Epid11Pairing()
480 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
482 result = FfMul(ps->Fq, Y, Y, t1); // t1 = Y^2 in Epid11Pairing()
483 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
484 result = FfAdd(ps->Fq, t1, t1, t3); // t3 = 2* Y^2 in Epid11Pairing()
485 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
486 result = FfMul(ps->Fq, t3, X, v); // v = 2 * X * Y^2 in Epid11Pairing()
487 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
488 result = FfAdd(ps->Fq, v, v, v); // v = 4 * X * Y^2 in Epid11Pairing()
489 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
491 result = FfMul(ps->Fq, w, w, X2); // X2 = w^2 in Epid11Pairing()
492 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
493 result = FfSub(ps->Fq, X2, v, X2); // X2 = w^2 - v in Epid11Pairing()
494 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
495 result = FfSub(ps->Fq, X2, v, X2); // X2 = w^2 - 2 * w in Epid11Pairing()
496 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
498 result = FfMul(ps->Fq, t3, t3, t3); // t3 = 4 * Y^4 in Epid11Pairing()
499 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
500 result = FfAdd(ps->Fq, t3, t3, t3); // t3 = 8 * Y^4 in Epid11Pairing()
501 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
502 result = FfSub(ps->Fq, v, X2, Y2); // Y2 = v - X2 in Epid11Pairing()
503 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
504 result = FfMul(ps->Fq, Y2, w, Y2); // Y2 = w * (v - X2) in Epid11Pairing()
505 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
506 result = FfSub(ps->Fq, Y2, t3, Y2); // Y2 = w * (v - X2) - 8 * Y^4 in Epid11Pairing()
507 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
509 result = FfMul(ps->Fq, Y, Z, Z2); // Z2 = Y * Z in Epid11Pairing()
510 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
511 result = FfAdd(ps->Fq, Z2, Z2, Z2); // Z2 = 2 * Y * Z in Epid11Pairing()
512 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
515 result = FfMul(ps->Fq, ty, w, t2); // t2 = w * Z^2 in Epid11Pairing()
516 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
517 result = Fq6FromFq(ps->ff, ps->Fq, t2, tt2); in Epid11Pairing()
518 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
519 result = FfMul(ps->ff, pQx, tt2, tt1); // tt1 = w * Z^2 * Qx in Epid11Pairing()
520 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
521 result = FfMul(ps->Fq, w, X, t2); // t2 = w * X in Epid11Pairing()
522 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
523 result = FfSub(ps->Fq, t2, t1, t2); // t2 = w * X - Y^2 in Epid11Pairing()
524 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
525 result = FfSub(ps->Fq, t2, t1, t2); // t2 = w * X - 2 * Y^2 in Epid11Pairing()
526 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
527 result = FfMul(ps->Fq, ty, Z2, ty); // ty = Z2 * Z^2 in Epid11Pairing()
528 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
529 result = Fq6FromFq(ps->ff, ps->Fq, ty, tt2); in Epid11Pairing()
530 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
531 result = FfMul(ps->ff, pQy, tt2, tx); // tx = ty * Qy in Epid11Pairing()
532 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
533 result = FfSub(ps->ff, tx, tt1, tx); // tx = ty * Qy - w * Z^2 * Qx in Epid11Pairing()
534 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
535 result = Fq6FromFq(ps->ff, ps->Fq, t2, tt2); in Epid11Pairing()
536 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
537 result = FfAdd(ps->ff, tx, tt2, in Epid11Pairing()
539 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
543 BREAK_ON_IPP_ERROR(sts, result); in Epid11Pairing()
546 BREAK_ON_IPP_ERROR(sts, result); in Epid11Pairing()
549 BREAK_ON_IPP_ERROR(sts, result); in Epid11Pairing()
552 result = FfMul(ps->ff, rx, rx, tt1); // tt1 = rx * rx in Epid11Pairing()
553 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
554 result = FfMul(ps->ff, tx, tt1, rx); // rx = tx * rx * rx in Epid11Pairing()
555 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
556 result = FfMul(ps->Fq, ry, ry, t1); // t1 = ry * ry in Epid11Pairing()
557 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
558 result = FfMul(ps->Fq, ty, t1, ry); // ry = ty * ry * ry in Epid11Pairing()
559 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
562 result = FfMul(ps->Fq, Z, Z, t1); // t1 = Z^2 in Epid11Pairing()
563 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
564 result = FfMul(ps->Fq, px, t1, w); // w = px * Z^2 in Epid11Pairing()
565 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
566 result = FfSub(ps->Fq, w, X, w); // w = px * Z^2 - X in Epid11Pairing()
567 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
568 result = FfMul(ps->Fq, t1, Z, t1); // t1 = Z^3 in Epid11Pairing()
569 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
570 result = FfMul(ps->Fq, py, t1, v); // v = py * Z^3 in Epid11Pairing()
571 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
572 result = FfSub(ps->Fq, v, Y, v); // v = py * Z^3 - Y in Epid11Pairing()
573 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
575 result = FfMul(ps->Fq, w, w, t1); // t1 = w^2 in Epid11Pairing()
576 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
577 result = FfMul(ps->Fq, w, t1, t2); // t2 = w^3 in Epid11Pairing()
578 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
579 result = FfMul(ps->Fq, X, t1, t3); // t3 = X * w^2 in Epid11Pairing()
580 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
581 result = FfMul(ps->Fq, v, v, X2); // X2 = v^2 in Epid11Pairing()
582 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
583 result = FfSub(ps->Fq, X2, t2, X2); // X2 = v^2 - w^3 in Epid11Pairing()
584 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
585 result = FfSub(ps->Fq, X2, t3, X2); // X2 = v^2 - w^3 - X * w^2 in Epid11Pairing()
586 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
587 result = FfSub(ps->Fq, X2, t3, X2); // X2 = v^2 - w^3 - 2 * X * w^2 in Epid11Pairing()
588 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
589 result = FfSub(ps->Fq, t3, X2, Y2); // Y2 = X * w^2 - X2 in Epid11Pairing()
590 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
591 result = FfMul(ps->Fq, Y2, v, Y2); // Y2 = v * (X * w^2 - X2) in Epid11Pairing()
592 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
593 result = FfMul(ps->Fq, t2, Y, t2); // t2 = Y * w^3 in Epid11Pairing()
594 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
595 result = in Epid11Pairing()
597 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
598 result = FfMul(ps->Fq, w, Z, Z2); // Z2 = w * Z in Epid11Pairing()
599 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
604 BREAK_ON_IPP_ERROR(sts, result); in Epid11Pairing()
605 result = Fq6FromFq(ps->ff, ps->Fq, py, tt2); in Epid11Pairing()
606 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
607 result = FfSub(ps->ff, pQy, tt2, tx); // tx = Qy - py in Epid11Pairing()
608 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
609 result = Fq6FromFq(ps->ff, ps->Fq, Z2, tt2); in Epid11Pairing()
610 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
611 result = FfMul(ps->ff, tx, tt2, tx); // tx = Z2 * (Qy - py) in Epid11Pairing()
612 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
613 result = Fq6FromFq(ps->ff, ps->Fq, px, tt2); in Epid11Pairing()
614 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
615 result = FfSub(ps->ff, pQx, tt2, tt1); // tt1 = Qx - px in Epid11Pairing()
616 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
617 result = Fq6FromFq(ps->ff, ps->Fq, v, tt2); in Epid11Pairing()
618 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
619 result = FfMul(ps->ff, tt1, tt2, tt1); // tt1 = v * (Qx - px) in Epid11Pairing()
620 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
621 result = in Epid11Pairing()
623 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
627 BREAK_ON_IPP_ERROR(sts, result); in Epid11Pairing()
630 BREAK_ON_IPP_ERROR(sts, result); in Epid11Pairing()
633 BREAK_ON_IPP_ERROR(sts, result); in Epid11Pairing()
636 result = FfMul(ps->ff, rx, tx, rx); // rx = rx * tx in Epid11Pairing()
637 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
638 result = FfMul(ps->Fq, ry, ty, ry); // ry = ry * ty in Epid11Pairing()
639 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
642 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
644 result = FfInv(ps->Fq, ry, ry); // ry = ry^-1 in Epid11Pairing()
645 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
646 result = Fq6FromFq(ps->ff, ps->Fq, ry, tt2); in Epid11Pairing()
647 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
648 result = FfMul(ps->ff, rx, tt2, r); // r = rx * ry in Epid11Pairing()
649 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
651 result = FinalExp(ps, r, d); in Epid11Pairing()
652 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
654 result = kEpidNoErr; in Epid11Pairing()
655 BREAK_ON_EPID_ERROR(result); in Epid11Pairing()
686 return result; in Epid11Pairing()
691 EpidStatus result = kEpidErr; in Fq6FromFq() local
699 result = WriteFfElement(fq, a, &r_str.a[0].a[0], sizeof(r_str.a[0].a[0])); in Fq6FromFq()
700 BREAK_ON_EPID_ERROR(result); in Fq6FromFq()
701 result = ReadFfElement(fq6, &r_str, sizeof(r_str), r); in Fq6FromFq()
702 BREAK_ON_EPID_ERROR(result); in Fq6FromFq()
703 result = kEpidNoErr; in Fq6FromFq()
706 return result; in Fq6FromFq()
712 EpidStatus result = kEpidErr; in JoinFq3() local
718 result = kEpidBadArgErr; in JoinFq3()
721 result = WriteFfElement(ps->Fq3, a, &r_str.a[0], sizeof(r_str.a[0])); in JoinFq3()
722 BREAK_ON_EPID_ERROR(result); in JoinFq3()
723 result = WriteFfElement(ps->Fq3, b, &r_str.a[1], sizeof(r_str.a[1])); in JoinFq3()
724 BREAK_ON_EPID_ERROR(result); in JoinFq3()
725 result = ReadFfElement(ps->ff, &r_str, sizeof(r_str), r); in JoinFq3()
726 BREAK_ON_EPID_ERROR(result); in JoinFq3()
727 result = kEpidNoErr; in JoinFq3()
731 return result; in JoinFq3()
737 EpidStatus result = kEpidErr; in SplitFq6() local
743 result = kEpidBadArgErr; in SplitFq6()
746 result = WriteFfElement(ps->ff, a, &a_str, sizeof(a_str)); in SplitFq6()
747 BREAK_ON_EPID_ERROR(result); in SplitFq6()
748 result = ReadFfElement(ps->Fq3, &a_str.a[0], sizeof(a_str.a[0]), a0); in SplitFq6()
749 BREAK_ON_EPID_ERROR(result); in SplitFq6()
750 result = ReadFfElement(ps->Fq3, &a_str.a[1], sizeof(a_str.a[1]), a1); in SplitFq6()
751 BREAK_ON_EPID_ERROR(result); in SplitFq6()
752 result = kEpidNoErr; in SplitFq6()
756 return result; in SplitFq6()
761 EpidStatus result = kEpidErr; in FinalExp() local
778 result = kEpidBadArgErr; in FinalExp()
783 result = NewFfElement(ps->Fq3, &r0); in FinalExp()
784 BREAK_ON_EPID_ERROR(result); in FinalExp()
785 result = NewFfElement(ps->Fq3, &r1); in FinalExp()
786 BREAK_ON_EPID_ERROR(result); in FinalExp()
787 result = SplitFq6(ps, r, r0, r1); in FinalExp()
788 BREAK_ON_EPID_ERROR(result); in FinalExp()
791 result = NewFfElement(ps->Fq3, &x); in FinalExp()
792 BREAK_ON_EPID_ERROR(result); in FinalExp()
793 result = Transform(ps, r0, x); in FinalExp()
794 BREAK_ON_EPID_ERROR(result); in FinalExp()
797 result = NewFfElement(ps->Fq3, &y); in FinalExp()
798 BREAK_ON_EPID_ERROR(result); in FinalExp()
799 result = Transform(ps, r1, y); in FinalExp()
800 BREAK_ON_EPID_ERROR(result); in FinalExp()
803 result = NewFfElement(ps->ff, &t1); in FinalExp()
804 BREAK_ON_EPID_ERROR(result); in FinalExp()
805 result = NewFfElement(ps->ff, &t2); in FinalExp()
806 BREAK_ON_EPID_ERROR(result); in FinalExp()
807 result = NewFfElement(ps->ff, &t3); in FinalExp()
808 BREAK_ON_EPID_ERROR(result); in FinalExp()
809 result = NewFfElement(ps->ff, &t4); in FinalExp()
816 result = JoinFq3(ps, x, y, t1); in FinalExp()
817 BREAK_ON_EPID_ERROR(result); in FinalExp()
820 result = NewFfElement(ps->Fq3, &neg_r1); in FinalExp()
821 BREAK_ON_EPID_ERROR(result); in FinalExp()
822 result = FfNeg(ps->Fq3, r1, neg_r1); in FinalExp()
823 BREAK_ON_EPID_ERROR(result); in FinalExp()
824 result = JoinFq3(ps, r0, neg_r1, t2); in FinalExp()
825 BREAK_ON_EPID_ERROR(result); in FinalExp()
828 result = NewFfElement(ps->Fq3, &neg_y); in FinalExp()
829 BREAK_ON_EPID_ERROR(result); in FinalExp()
830 result = FfNeg(ps->Fq3, y, neg_y); in FinalExp()
831 BREAK_ON_EPID_ERROR(result); in FinalExp()
832 result = JoinFq3(ps, x, neg_y, t3); in FinalExp()
833 BREAK_ON_EPID_ERROR(result); in FinalExp()
836 result = JoinFq3(ps, r0, r1, t4); in FinalExp()
837 BREAK_ON_EPID_ERROR(result); in FinalExp()
844 result = NewFfElement(ps->ff, &d1); in FinalExp()
845 BREAK_ON_EPID_ERROR(result); in FinalExp()
846 result = FfMul(ps->ff, t1, t2, d1); in FinalExp()
847 BREAK_ON_EPID_ERROR(result); in FinalExp()
850 result = NewFfElement(ps->ff, &d2); in FinalExp()
851 BREAK_ON_EPID_ERROR(result); in FinalExp()
852 result = FfMul(ps->ff, t3, t4, d2); in FinalExp()
853 BREAK_ON_EPID_ERROR(result); in FinalExp()
856 result = NewFfElement(ps->ff, &inv_d2); in FinalExp()
857 BREAK_ON_EPID_ERROR(result); in FinalExp()
858 result = FfInv(ps->ff, d2, inv_d2); in FinalExp()
859 BREAK_ON_EPID_ERROR(result); in FinalExp()
860 result = FfMul(ps->ff, d1, inv_d2, d); in FinalExp()
861 BREAK_ON_EPID_ERROR(result); in FinalExp()
864 result = FfExp(ps->ff, d, ps->final_exp_constant, d); in FinalExp()
865 BREAK_ON_EPID_ERROR(result); in FinalExp()
867 result = kEpidNoErr; in FinalExp()
883 return result; in FinalExp()
888 EpidStatus result = kEpidErr; in Transform() local
898 result = WriteFfElement(ps->Fq3, a, &a_str, sizeof(a_str)); in Transform()
899 BREAK_ON_EPID_ERROR(result); in Transform()
900 result = NewFfElement(ps->Fq3, &tmp); in Transform()
901 BREAK_ON_EPID_ERROR(result); in Transform()
903 result = ReadFfElement(ps->Fq3, &zero, sizeof(zero), b); in Transform()
904 BREAK_ON_EPID_ERROR(result); in Transform()
908 result = ReadFfElement(ps->Fq3, &tmp_str, sizeof(tmp_str), tmp); in Transform()
909 BREAK_ON_EPID_ERROR(result); in Transform()
911 result = FfMul(ps->Fq3, ps->alpha_q[i], tmp, tmp); in Transform()
912 BREAK_ON_EPID_ERROR(result); in Transform()
914 result = FfAdd(ps->Fq3, tmp, b, b); in Transform()
915 BREAK_ON_EPID_ERROR(result); in Transform()
917 BREAK_ON_EPID_ERROR(result); in Transform()
918 result = kEpidNoErr; in Transform()
924 return result; in Transform()