comparison curve25519-donna.c @ 1038:d3925ed45a85

Fix for old compilers, variable declarations at beginning of functions and /**/ comments
author Thorsten Horstmann <thorsten.horstmann@web.de>
date Tue, 24 Feb 2015 20:51:18 +0800
parents 6c69e7df3621
children 27b9ddb06b09
comparison
equal deleted inserted replaced
1037:7c899f24a85b 1038:d3925ed45a85
525 limb origx[10], origxprime[10], zzz[19], xx[19], zz[19], xxprime[19], 525 limb origx[10], origxprime[10], zzz[19], xx[19], zz[19], xxprime[19],
526 zzprime[19], zzzprime[19], xxxprime[19]; 526 zzprime[19], zzzprime[19], xxxprime[19];
527 527
528 memcpy(origx, x, 10 * sizeof(limb)); 528 memcpy(origx, x, 10 * sizeof(limb));
529 fsum(x, z); 529 fsum(x, z);
530 fdifference(z, origx); // does x - z 530 fdifference(z, origx); /* does x - z */
531 531
532 memcpy(origxprime, xprime, sizeof(limb) * 10); 532 memcpy(origxprime, xprime, sizeof(limb) * 10);
533 fsum(xprime, zprime); 533 fsum(xprime, zprime);
534 fdifference(zprime, origxprime); 534 fdifference(zprime, origxprime);
535 fproduct(xxprime, xprime, z); 535 fproduct(xxprime, xprime, z);
552 fsquare(xx, x); 552 fsquare(xx, x);
553 fsquare(zz, z); 553 fsquare(zz, z);
554 fproduct(x2, xx, zz); 554 fproduct(x2, xx, zz);
555 freduce_degree(x2); 555 freduce_degree(x2);
556 freduce_coefficients(x2); 556 freduce_coefficients(x2);
557 fdifference(zz, xx); // does zz = xx - zz 557 fdifference(zz, xx); /* does zz = xx - zz */
558 memset(zzz + 10, 0, sizeof(limb) * 9); 558 memset(zzz + 10, 0, sizeof(limb) * 9);
559 fscalar_product(zzz, zz, 121665); 559 fscalar_product(zzz, zz, 121665);
560 /* No need to call freduce_degree here: 560 /* No need to call freduce_degree here:
561 fscalar_product doesn't increase the degree of its input. */ 561 fscalar_product doesn't increase the degree of its input. */
562 freduce_coefficients(zzz); 562 freduce_coefficients(zzz);
639 639
640 memcpy(resultx, nqx, sizeof(limb) * 10); 640 memcpy(resultx, nqx, sizeof(limb) * 10);
641 memcpy(resultz, nqz, sizeof(limb) * 10); 641 memcpy(resultz, nqz, sizeof(limb) * 10);
642 } 642 }
643 643
644 // ----------------------------------------------------------------------------- 644 /* -----------------------------------------------------------------------------
645 // Shamelessly copied from djb's code 645 * Shamelessly copied from djb's code
646 // ----------------------------------------------------------------------------- 646 * ----------------------------------------------------------------------------- */
647 static void 647 static void
648 crecip(limb *out, const limb *z) { 648 crecip(limb *out, const limb *z) {
649 limb z2[10]; 649 limb z2[10];
650 limb z9[10]; 650 limb z9[10];
651 limb z11[10]; 651 limb z11[10];