[123213] trunk/dports/perl/p5-crypt-gcrypt

ryandesign at macports.org ryandesign at macports.org
Wed Aug 6 19:29:04 PDT 2014


Revision: 123213
          https://trac.macports.org/changeset/123213
Author:   ryandesign at macports.org
Date:     2014-08-06 19:29:04 -0700 (Wed, 06 Aug 2014)
Log Message:
-----------
p5-crypt-gcrypt: fix build with libgcrypt 1.6

Modified Paths:
--------------
    trunk/dports/perl/p5-crypt-gcrypt/Portfile

Added Paths:
-----------
    trunk/dports/perl/p5-crypt-gcrypt/files/
    trunk/dports/perl/p5-crypt-gcrypt/files/patch-GCrypt.xs.diff

Modified: trunk/dports/perl/p5-crypt-gcrypt/Portfile
===================================================================
--- trunk/dports/perl/p5-crypt-gcrypt/Portfile	2014-08-07 02:11:52 UTC (rev 123212)
+++ trunk/dports/perl/p5-crypt-gcrypt/Portfile	2014-08-07 02:29:04 UTC (rev 123213)
@@ -24,6 +24,8 @@
 checksums           rmd160  79412d9c5046da54d13df5c9086b22d95394b6b1 \
                     sha256  67b588e81d5f37301ff0f6c57d21fb6429cb2f826cc54e0fe897d360961b0fab
 
+patchfiles          patch-GCrypt.xs.diff
+
 configure.pre_args-append	GCRYPTLIBPATH=${prefix}/lib GCRYPTINCPATH=${prefix}/include
 
     livecheck.type      none

Added: trunk/dports/perl/p5-crypt-gcrypt/files/patch-GCrypt.xs.diff
===================================================================
--- trunk/dports/perl/p5-crypt-gcrypt/files/patch-GCrypt.xs.diff	                        (rev 0)
+++ trunk/dports/perl/p5-crypt-gcrypt/files/patch-GCrypt.xs.diff	2014-08-07 02:29:04 UTC (rev 123213)
@@ -0,0 +1,145 @@
+Fix build failure with libgcrypt 1.6
+https://rt.cpan.org/Public/Bug/Display.html?id=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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140806/849c2632/attachment.html>


More information about the macports-changes mailing list