[packages/perl-Crypt-Curve25519] - initial, version 0.06

adwol adwol at pld-linux.org
Sun Jun 16 18:50:50 CEST 2019


commit 8fe2f7255fd92f3618ad6ed2c11df912aafb59ee
Author: Adam Osuchowski <adwol at pld-linux.org>
Date:   Sun Jun 16 18:50:24 2019 +0200

    - initial, version 0.06

 perl-Crypt-Curve25519-fmul.patch | 174 +++++++++++++++++++++++++++++++++++++++
 perl-Crypt-Curve25519.spec       |  54 ++++++++++++
 2 files changed, 228 insertions(+)
---
diff --git a/perl-Crypt-Curve25519.spec b/perl-Crypt-Curve25519.spec
new file mode 100644
index 0000000..90c28ca
--- /dev/null
+++ b/perl-Crypt-Curve25519.spec
@@ -0,0 +1,54 @@
+%define		pdir	Crypt
+%define		pnam	Curve25519
+%include	/usr/lib/rpm/macros.perl
+Summary:	Crypt::Curve25519 Perl module - Generate shared secret using elliptic-curve Diffie-Hellman function
+Name:		perl-Crypt-Curve25519
+Version:	0.06
+Release:	1
+# same as perl
+License:	GPL v1+ or Artistic
+Group:		Development/Languages/Perl
+Source0:	http://www.cpan.org/modules/by-module/%{pdir}/%{pdir}-%{pnam}-%{version}.tar.gz
+# Source0-md5:	631c7a0e799994712e3d802317615a4c
+Patch0:		%{name}-fmul.patch
+URL:		http://search.cpan.org/dist/Crypt-Curve25519/
+BuildRequires:	perl-ExtUtils-MakeMaker >= 6.56
+BuildRequires:	perl-devel >= 1:5.8.0
+BuildRequires:	rpm-perlprov >= 4.1-13
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Curve25519 is a state-of-the-art Diffie-Hellman function suitable for
+a wide variety of applications.
+
+Given a user's 32-byte secret key, Curve25519 computes the user's
+32-byte public key. Given the user's 32-byte secret key and another
+user's 32-byte public key, Curve25519 computes a 32-byte secret shared
+by the two users. This secret can then be used to authenticate and
+encrypt messages between the two users.
+
+%prep
+%setup -q -n %{pdir}-%{pnam}-%{version}
+%patch0 -p1
+
+%build
+%{__perl} Makefile.PL \
+	INSTALLDIRS=vendor
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc Changes README
+%dir %{perl_vendorarch}/auto/Crypt/Curve25519
+%attr(755,root,root) %{perl_vendorarch}/auto/Crypt/Curve25519/Curve25519.so
+%{perl_vendorarch}/Crypt/Curve25519.pm
+%{_mandir}/man3/*
diff --git a/perl-Crypt-Curve25519-fmul.patch b/perl-Crypt-Curve25519-fmul.patch
new file mode 100644
index 0000000..28f6ef2
--- /dev/null
+++ b/perl-Crypt-Curve25519-fmul.patch
@@ -0,0 +1,174 @@
+diff -ruN Crypt-Curve25519-0.06.orig/curve25519-donna-c64.c Crypt-Curve25519-0.06/curve25519-donna-c64.c
+--- Crypt-Curve25519-0.06.orig/curve25519-donna-c64.c	2017-04-06 01:25:50.000000000 +0200
++++ Crypt-Curve25519-0.06/curve25519-donna-c64.c	2019-06-16 18:42:17.826992462 +0200
+@@ -96,7 +96,7 @@
+  * On return, output[i] < 2**52
+  */
+ static inline void force_inline
+-fmul(felem output, const felem in2, const felem in) {
++_fmul(felem output, const felem in2, const felem in) {
+   uint128_t t[5];
+   limb r0,r1,r2,r3,r4,s0,s1,s2,s3,s4,c;
+ 
+@@ -305,22 +305,22 @@
+   memcpy(origxprime, xprime, sizeof(limb) * 5);
+   fsum(xprime, zprime);
+   fdifference_backwards(zprime, origxprime);
+-  fmul(xxprime, xprime, z);
+-  fmul(zzprime, x, zprime);
++  _fmul(xxprime, xprime, z);
++  _fmul(zzprime, x, zprime);
+   memcpy(origxprime, xxprime, sizeof(limb) * 5);
+   fsum(xxprime, zzprime);
+   fdifference_backwards(zzprime, origxprime);
+   fsquare_times(x3, xxprime, 1);
+   fsquare_times(zzzprime, zzprime, 1);
+-  fmul(z3, zzzprime, qmqp);
++  _fmul(z3, zzzprime, qmqp);
+ 
+   fsquare_times(xx, x, 1);
+   fsquare_times(zz, z, 1);
+-  fmul(x2, xx, zz);
++  _fmul(x2, xx, zz);
+   fdifference_backwards(zz, xx);  // does zz = xx - zz
+   fscalar_product(zzz, zz, 121665);
+   fsum(zzz, xx);
+-  fmul(z2, zz, zzz);
++  _fmul(z2, zz, zzz);
+ }
+ 
+ // -----------------------------------------------------------------------------
+@@ -405,26 +405,26 @@
+ 
+   /* 2 */ fsquare_times(a, z, 1); // a = 2
+   /* 8 */ fsquare_times(t0, a, 2);
+-  /* 9 */ fmul(b, t0, z); // b = 9
+-  /* 11 */ fmul(a, b, a); // a = 11
++  /* 9 */ _fmul(b, t0, z); // b = 9
++  /* 11 */ _fmul(a, b, a); // a = 11
+   /* 22 */ fsquare_times(t0, a, 1);
+-  /* 2^5 - 2^0 = 31 */ fmul(b, t0, b);
++  /* 2^5 - 2^0 = 31 */ _fmul(b, t0, b);
+   /* 2^10 - 2^5 */ fsquare_times(t0, b, 5);
+-  /* 2^10 - 2^0 */ fmul(b, t0, b);
++  /* 2^10 - 2^0 */ _fmul(b, t0, b);
+   /* 2^20 - 2^10 */ fsquare_times(t0, b, 10);
+-  /* 2^20 - 2^0 */ fmul(c, t0, b);
++  /* 2^20 - 2^0 */ _fmul(c, t0, b);
+   /* 2^40 - 2^20 */ fsquare_times(t0, c, 20);
+-  /* 2^40 - 2^0 */ fmul(t0, t0, c);
++  /* 2^40 - 2^0 */ _fmul(t0, t0, c);
+   /* 2^50 - 2^10 */ fsquare_times(t0, t0, 10);
+-  /* 2^50 - 2^0 */ fmul(b, t0, b);
++  /* 2^50 - 2^0 */ _fmul(b, t0, b);
+   /* 2^100 - 2^50 */ fsquare_times(t0, b, 50);
+-  /* 2^100 - 2^0 */ fmul(c, t0, b);
++  /* 2^100 - 2^0 */ _fmul(c, t0, b);
+   /* 2^200 - 2^100 */ fsquare_times(t0, c, 100);
+-  /* 2^200 - 2^0 */ fmul(t0, t0, c);
++  /* 2^200 - 2^0 */ _fmul(t0, t0, c);
+   /* 2^250 - 2^50 */ fsquare_times(t0, t0, 50);
+-  /* 2^250 - 2^0 */ fmul(t0, t0, b);
++  /* 2^250 - 2^0 */ _fmul(t0, t0, b);
+   /* 2^255 - 2^5 */ fsquare_times(t0, t0, 5);
+-  /* 2^255 - 21 */ fmul(out, t0, a);
++  /* 2^255 - 21 */ _fmul(out, t0, a);
+ }
+ 
+ int curve25519_donna(u8 *, const u8 *, const u8 *);
+@@ -443,7 +443,7 @@
+   fexpand(bp, basepoint);
+   cmult(x, z, e, bp);
+   crecip(zmone, z);
+-  fmul(z, x, zmone);
++  _fmul(z, x, zmone);
+   fcontract(mypublic, z);
+   return 0;
+ }
+diff -ruN Crypt-Curve25519-0.06.orig/curve25519-donna.c Crypt-Curve25519-0.06/curve25519-donna.c
+--- Crypt-Curve25519-0.06.orig/curve25519-donna.c	2017-04-06 01:25:50.000000000 +0200
++++ Crypt-Curve25519-0.06/curve25519-donna.c	2019-06-16 18:42:29.279950391 +0200
+@@ -325,7 +325,7 @@
+  * reduced coefficient.
+  */
+ static void
+-fmul(limb *output, const limb *in, const limb *in2) {
++_fmul(limb *output, const limb *in, const limb *in2) {
+   limb t[19];
+   fproduct(t, in, in2);
+   freduce_degree(t);
+@@ -661,54 +661,54 @@
+   /* 2 */ fsquare(z2,z);
+   /* 4 */ fsquare(t1,z2);
+   /* 8 */ fsquare(t0,t1);
+-  /* 9 */ fmul(z9,t0,z);
+-  /* 11 */ fmul(z11,z9,z2);
++  /* 9 */ _fmul(z9,t0,z);
++  /* 11 */ _fmul(z11,z9,z2);
+   /* 22 */ fsquare(t0,z11);
+-  /* 2^5 - 2^0 = 31 */ fmul(z2_5_0,t0,z9);
++  /* 2^5 - 2^0 = 31 */ _fmul(z2_5_0,t0,z9);
+ 
+   /* 2^6 - 2^1 */ fsquare(t0,z2_5_0);
+   /* 2^7 - 2^2 */ fsquare(t1,t0);
+   /* 2^8 - 2^3 */ fsquare(t0,t1);
+   /* 2^9 - 2^4 */ fsquare(t1,t0);
+   /* 2^10 - 2^5 */ fsquare(t0,t1);
+-  /* 2^10 - 2^0 */ fmul(z2_10_0,t0,z2_5_0);
++  /* 2^10 - 2^0 */ _fmul(z2_10_0,t0,z2_5_0);
+ 
+   /* 2^11 - 2^1 */ fsquare(t0,z2_10_0);
+   /* 2^12 - 2^2 */ fsquare(t1,t0);
+   /* 2^20 - 2^10 */ for (i = 2;i < 10;i += 2) { fsquare(t0,t1); fsquare(t1,t0); }
+-  /* 2^20 - 2^0 */ fmul(z2_20_0,t1,z2_10_0);
++  /* 2^20 - 2^0 */ _fmul(z2_20_0,t1,z2_10_0);
+ 
+   /* 2^21 - 2^1 */ fsquare(t0,z2_20_0);
+   /* 2^22 - 2^2 */ fsquare(t1,t0);
+   /* 2^40 - 2^20 */ for (i = 2;i < 20;i += 2) { fsquare(t0,t1); fsquare(t1,t0); }
+-  /* 2^40 - 2^0 */ fmul(t0,t1,z2_20_0);
++  /* 2^40 - 2^0 */ _fmul(t0,t1,z2_20_0);
+ 
+   /* 2^41 - 2^1 */ fsquare(t1,t0);
+   /* 2^42 - 2^2 */ fsquare(t0,t1);
+   /* 2^50 - 2^10 */ for (i = 2;i < 10;i += 2) { fsquare(t1,t0); fsquare(t0,t1); }
+-  /* 2^50 - 2^0 */ fmul(z2_50_0,t0,z2_10_0);
++  /* 2^50 - 2^0 */ _fmul(z2_50_0,t0,z2_10_0);
+ 
+   /* 2^51 - 2^1 */ fsquare(t0,z2_50_0);
+   /* 2^52 - 2^2 */ fsquare(t1,t0);
+   /* 2^100 - 2^50 */ for (i = 2;i < 50;i += 2) { fsquare(t0,t1); fsquare(t1,t0); }
+-  /* 2^100 - 2^0 */ fmul(z2_100_0,t1,z2_50_0);
++  /* 2^100 - 2^0 */ _fmul(z2_100_0,t1,z2_50_0);
+ 
+   /* 2^101 - 2^1 */ fsquare(t1,z2_100_0);
+   /* 2^102 - 2^2 */ fsquare(t0,t1);
+   /* 2^200 - 2^100 */ for (i = 2;i < 100;i += 2) { fsquare(t1,t0); fsquare(t0,t1); }
+-  /* 2^200 - 2^0 */ fmul(t1,t0,z2_100_0);
++  /* 2^200 - 2^0 */ _fmul(t1,t0,z2_100_0);
+ 
+   /* 2^201 - 2^1 */ fsquare(t0,t1);
+   /* 2^202 - 2^2 */ fsquare(t1,t0);
+   /* 2^250 - 2^50 */ for (i = 2;i < 50;i += 2) { fsquare(t0,t1); fsquare(t1,t0); }
+-  /* 2^250 - 2^0 */ fmul(t0,t1,z2_50_0);
++  /* 2^250 - 2^0 */ _fmul(t0,t1,z2_50_0);
+ 
+   /* 2^251 - 2^1 */ fsquare(t1,t0);
+   /* 2^252 - 2^2 */ fsquare(t0,t1);
+   /* 2^253 - 2^3 */ fsquare(t1,t0);
+   /* 2^254 - 2^4 */ fsquare(t0,t1);
+   /* 2^255 - 2^5 */ fsquare(t1,t0);
+-  /* 2^255 - 21 */ fmul(out,t1,z11);
++  /* 2^255 - 21 */ _fmul(out,t1,z11);
+ }
+ 
+ int curve25519_donna(u8 *, const u8 *, const u8 *);
+@@ -727,7 +727,7 @@
+   fexpand(bp, basepoint);
+   cmult(x, z, e, bp);
+   crecip(zmone, z);
+-  fmul(z, x, zmone);
++  _fmul(z, x, zmone);
+   freduce_coefficients(z);
+   fcontract(mypublic, z);
+   return 0;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/perl-Crypt-Curve25519.git/commitdiff/8fe2f7255fd92f3618ad6ed2c11df912aafb59ee



More information about the pld-cvs-commit mailing list