ppisar pushed to perl-Crypt-GCrypt (master). "Import"

notifications at fedoraproject.org notifications at fedoraproject.org
Fri Sep 25 12:02:11 UTC 2015


From 5c79b65658cdc5bb35c61156f5edcc1cfb3ca28c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
Date: Fri, 25 Sep 2015 12:19:29 +0200
Subject: Import


diff --git a/.gitignore b/.gitignore
index e69de29..cbf45e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/Crypt-GCrypt-1.26.tar.gz
diff --git a/Crypt-GCrypt-1.26-Correct-some-warnings.patch b/Crypt-GCrypt-1.26-Correct-some-warnings.patch
new file mode 100644
index 0000000..e2b79e2
--- /dev/null
+++ b/Crypt-GCrypt-1.26-Correct-some-warnings.patch
@@ -0,0 +1,50 @@
+From 1d4c44e18950dc44805328df285ae91dea575761 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Thu, 24 Sep 2015 17:01:50 +0200
+Subject: [PATCH] Correct some warnings
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+GCC 5 warns about casting pointer to integer and about possible
+undefined variable. This patch corrects it.
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ GCrypt.xs | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/GCrypt.xs b/GCrypt.xs
+index 51f30f2..3646e89 100644
+--- a/GCrypt.xs
++++ b/GCrypt.xs
+@@ -94,7 +94,7 @@ int find_padding (Crypt_GCrypt gcr, unsigned char *string, size_t string_len) {
+             p = memchr((char *) string, '\0', string_len);
+             if (p == NULL) return -1;
+             
+-            offset = (int) p - (int) string;
++            offset = p - (void *)string;
+             for (i = offset; i < string_len; ++i) {
+                 if (string[string_len-i] != '\0') return -1;
+             }
+@@ -104,7 +104,7 @@ int find_padding (Crypt_GCrypt gcr, unsigned char *string, size_t string_len) {
+             p = memchr((char *) string, '\32', string_len);
+             if (p == NULL) return -1;
+             
+-            offset = (int) p - (int) string;
++            offset = p - (void *)string;
+             for (i = offset; i < string_len; ++i) {
+                 if (string[string_len-i] != '\32') return -1;
+             }
+@@ -204,7 +204,7 @@ Crypt_GCrypt
+ cg_new(...)
+     PROTOTYPE: @
+     INIT:
+-        char *s, *algo_s, *mode_s, *key_s;
++        char *s, *algo_s = NULL, *mode_s, *key_s;
+         int i, algo, mode;
+         unsigned int c_flags, ac_flags, md_flags;
+ /*
+-- 
+2.4.3
+
diff --git a/Crypt-GCrypt-1.26-libgcrypt_1_6_support.diff b/Crypt-GCrypt-1.26-libgcrypt_1_6_support.diff
new file mode 100644
index 0000000..c605a8d
--- /dev/null
+++ b/Crypt-GCrypt-1.26-libgcrypt_1_6_support.diff
@@ -0,0 +1,151 @@
+Author: complx-on-cpan [...] opsec.eu
+
+libgcrypt 1.6.x reworked the assymmetric crypto API, but this wasn't
+implemented in the perl module, anyway. So this just removes those stub parts
+in the module.
+
+CPAN RT#97201
+
+--- GCrypt.xs.orig	2011-05-27 22:04:03.000000000 +0200
++++ GCrypt.xs	2014-07-27 16:14:05.000000000 +0200
+@@ -56,9 +56,13 @@
+     int type;
+     int action;
+     gcry_cipher_hd_t h;
++/*
+     gcry_ac_handle_t h_ac;
++*/
+     gcry_md_hd_t h_md;
++/*
+     gcry_ac_key_t key_ac;
++*/
+     gcry_error_t err;
+     int mode;
+     int padding;
+@@ -203,7 +207,9 @@
+         char *s, *algo_s, *mode_s, *key_s;
+         int i, algo, mode;
+         unsigned int c_flags, ac_flags, md_flags;
++/*
+         gcry_ac_id_t ac_algo;
++*/
+         bool have_mode;
+     CODE:
+         New(0, RETVAL, 1, struct Crypt_GCrypt_s);
+@@ -322,25 +328,19 @@
+             if (!(algo = gcry_md_map_name(algo_s)))
+                 croak("Unknown digest algorithm %s", algo_s);
+ 
+-        RETVAL->err = gcry_md_open(&RETVAL->h_md, algo, md_flags);
++            RETVAL->err = gcry_md_open(&RETVAL->h_md, algo, md_flags);
+             if (RETVAL->h_md == NULL) XSRETURN_UNDEF;
+ 
+-        if (md_flags & GCRY_MD_FLAG_HMAC) {
+-            /* what if this overwrites the earlier error value? */
+-            RETVAL->err = gcry_md_setkey(RETVAL->h_md, key_s, RETVAL->keylen);
++            if (md_flags & GCRY_MD_FLAG_HMAC) {
++                /* what if this overwrites the earlier error value? */
++                RETVAL->err = gcry_md_setkey(RETVAL->h_md, key_s, RETVAL->keylen);
++            }
+         }
+-    }
+         if (RETVAL->type == CG_TYPE_ASYMM) {
+         
+             croak("Asymmetric cryptography is not yet supported by Crypt::GCrypt");
++	    XSRETURN_UNDEF;
+             
+-            RETVAL->err = gcry_ac_name_to_id(algo_s, &ac_algo);
+-            if (RETVAL->err)
+-                croak("Unknown algorithm %s", algo_s);
+-            
+-            /* Init ac */
+-            RETVAL->err = gcry_ac_open(&RETVAL->h_ac, ac_algo, ac_flags);
+-            if (RETVAL->h_ac == NULL) XSRETURN_UNDEF;
+         }
+         
+ 
+@@ -532,39 +532,6 @@
+     OUTPUT:
+         RETVAL
+ 
+-SV *
+-cg_sign(gcr, in)
+-    Crypt_GCrypt gcr;
+-    SV *in;
+-    PREINIT:
+-        gcry_mpi_t in_mpi, out_mpi;
+-        gcry_ac_data_t outdata;
+-        size_t len;
+-        const void *inbuf;
+-        const char *label;
+-        char* outbuf;
+-    CODE:
+-        /*
+-        in_mpi = gcry_mpi_new(0);
+-        out_mpi = gcry_mpi_new(0);
+-        inbuf = SvPV(in, len);
+-        printf("inbuf: %s\n", inbuf);
+-        gcry_mpi_scan( &in_mpi, GCRYMPI_FMT_STD, inbuf, strlen(inbuf), NULL );
+-        printf("Key: %s\n", gcr->key_ac);
+-        gcr->err = gcry_ac_data_sign(gcr->h_ac, gcr->key_ac, in_mpi, &outdata);
+-        if (gcr->err) {
+-            croak( gcry_strerror(gcr->err) );
+-        }
+-        printf("Here\n");
+-        gcr->err = gcry_ac_data_get_index (outdata, 0, 0, &label, &out_mpi);
+-        printf("Before (%s)\n", label);
+-        gcry_mpi_print(GCRYMPI_FMT_STD, outbuf, 1024, NULL, out_mpi);
+-        printf("After\n");
+-        RETVAL = newSVpv(outbuf, 0);
+-        */
+-    OUTPUT:
+-        RETVAL
+-
+ void
+ cg_start(gcr, act)
+     Crypt_GCrypt gcr;
+@@ -594,8 +561,10 @@
+     PREINIT:
+         char *k, *s;
+         char *mykey, *buf;
++/*
+         gcry_ac_key_type_t keytype;
+         gcry_ac_data_t keydata;
++*/
+         gcry_mpi_t mpi;
+         size_t len;
+     CODE:
+@@ -617,22 +586,7 @@
+         
+         /* Set key for asymmetric criptography */
+         if (gcr->type == CG_TYPE_ASYMM) {
+-            k = SvPV(ST(2), len);
+-            
+-            /* Key type */
+-            keytype = -1;
+-            s = SvPV(ST(1), len);
+-            if (strcmp(s, "private") == 0) keytype = GCRY_AC_KEY_SECRET;
+-            if (strcmp(s, "public") == 0) keytype = GCRY_AC_KEY_PUBLIC;
+-            if (keytype == -1)
+-                croak("Key must be private or public");
+-            
+-            gcry_control(GCRYCTL_INIT_SECMEM, strlen(k));
+-            mpi = gcry_mpi_snew(0);
+-            /* gcry_mpi_scan( &mpi, GCRYMPI_FMT_STD, k, NULL, NULL ); */
+-            gcr->err = gcry_ac_data_new(&keydata);
+-            gcr->err = gcry_ac_data_set(keydata, GCRY_AC_FLAG_COPY, "s", mpi);
+-            gcr->err = gcry_ac_key_init(&gcr->key_ac, gcr->h_ac, keytype, keydata);
++            croak("Asymmetric cryptography is not yet supported by Crypt::GCrypt");
+         }
+ 
+ void
+@@ -796,7 +750,9 @@
+     Crypt_GCrypt gcr;
+     CODE:
+         if (gcr->type == CG_TYPE_CIPHER) gcry_cipher_close(gcr->h);
++/*
+         if (gcr->type == CG_TYPE_ASYMM)  gcry_ac_close(gcr->h_ac);
++*/
+         if (gcr->type == CG_TYPE_DIGEST) gcry_md_close(gcr->h_md);
+         
+         if (gcr->need_to_call_finish == 1)
diff --git a/perl-Crypt-GCrypt.spec b/perl-Crypt-GCrypt.spec
new file mode 100644
index 0000000..f4e1968
--- /dev/null
+++ b/perl-Crypt-GCrypt.spec
@@ -0,0 +1,71 @@
+Name:           perl-Crypt-GCrypt
+Version:        1.26
+Release:        1%{?dist}
+Summary:        Perl interface to libgcrypt library
+License:        GPL+ or Artistic
+Group:          Development/Libraries
+URL:            http://search.cpan.org/dist/Crypt-GCrypt/
+Source0:        http://www.cpan.org/authors/id/A/AA/AAR/Crypt-GCrypt-%{version}.tar.gz
+# For libgcrypt >= 1.6, CPAN RT#97201
+Patch0:         Crypt-GCrypt-1.26-libgcrypt_1_6_support.diff
+# Correct some warnings, CPAN RT#107300
+Patch1:         Crypt-GCrypt-1.26-Correct-some-warnings.patch
+BuildRequires:  coreutils
+BuildRequires:  findutils
+BuildRequires:  libgcrypt-devel >= 1.3.0
+BuildRequires:  make
+BuildRequires:  perl
+BuildRequires:  perl(Config)
+BuildRequires:  perl(Devel::CheckLib)
+BuildRequires:  perl(ExtUtils::Liblist)
+BuildRequires:  perl(ExtUtils::MakeMaker)
+BuildRequires:  perl(lib)
+BuildRequires:  perl(strict)
+BuildRequires:  perl(warnings)
+BuildRequires:  sed
+# Run-time:
+BuildRequires:  perl(XSLoader)
+# Tests:
+BuildRequires:  perl(ExtUtils::testlib)
+BuildRequires:  perl(Test)
+BuildRequires:  perl(Test::More)
+# Optional tests:
+BuildRequires:  perl(threads)
+BuildRequires:  perl(Thread::Queue)
+Requires:       perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
+
+%description
+Crypt::GCrypt provides a Perl interface to the libgcrypt cryptographic
+functions. It currently supports symmetric ciphers such as AES/Rijndael,
+Twofish, Triple DES, Arcfour etc.
+
+%prep
+%setup -q -n Crypt-GCrypt-%{version}
+%patch0 -p0
+%patch1 -p1
+# Remove bundled modules
+rm -r inc
+sed -i -e '/^inc\//d' MANIFEST
+
+%build
+perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS"
+make %{?_smp_mflags}
+
+%install
+make pure_install DESTDIR=$RPM_BUILD_ROOT
+find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
+find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -exec rm -f {} \;
+%{_fixperms} $RPM_BUILD_ROOT/*
+
+%check
+make test
+
+%files
+%doc Changelog README
+%{perl_vendorarch}/auto/*
+%{perl_vendorarch}/Crypt*
+%{_mandir}/man3/*
+
+%changelog
+* Thu Sep 24 2015 Petr Pisar <ppisar at redhat.com> 1.26-1
+- Specfile autogenerated by cpanspec 1.78.
diff --git a/sources b/sources
index e69de29..484ecf3 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+d23084ed878e5d12d4956c39e6f2b813  Crypt-GCrypt-1.26.tar.gz
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/perl-Crypt-GCrypt.git/commit/?h=master&id=5c79b65658cdc5bb35c61156f5edcc1cfb3ca28c


More information about the perl-devel mailing list