Skip Menu |

This queue is for tickets about the Crypt-GCrypt CPAN distribution.

Report information
The Basics
Id: 97201
Status: open
Priority: 0/
Queue: Crypt-GCrypt

People
Owner: Nobody in particular
Requestors: ryandesign [...] macports.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Crypt::GCrypt 1.26 incompatibility with libgcrypt 1.6.1
Date: Mon, 14 Jul 2014 04:56:55 -0500
To: bug-Crypt-GCrypt [...] rt.cpan.org
From: Ryan Schmidt <ryandesign [...] macports.org>
Hello, I'm a developer with the MacPorts package management system, trying to update our libgcrypt package from 1.5.3 to 1.6.1. After doing so, Crypt::GCrypt 1.26 fails to build, as shown at the end of this email. The perl version is: $ perl5.16 -v This is perl 5, version 16, subversion 3 (v5.16.3) built for darwin-thread-multi-2level Copyright 1987-2012, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. The OS X version is: $ sw_vers ProductName: Mac OS X ProductVersion: 10.9.4 BuildVersion: 13E28 The errors in the log are: /opt/local/bin/perl5.16 /opt/local/lib/perl5/5.16.3/ExtUtils/xsubpp -typemap /opt/local/lib/perl5/5.16.3/ExtUtils/typemap -typemap typemap GCrypt.xs > GCrypt.xsc && mv GCrypt.xsc GCrypt.c /usr/bin/clang -c -I/opt/local/include -funsigned-char -pipe -Os -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -fno-common -DPERL_DARWIN -I/opt/local/include -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -fno-strict-aliasing -fstack-protector -I/opt/local/include -arch x86_64 -arch i386 -O3 -DVERSION=\"1.26\" -DXS_VERSION=\"1.26\" "-I/opt/local/lib/perl5/5.16.3/darwin-thread-multi-2level/CORE" GCrypt.c In file included from GCrypt.xs:17: ./ppport.h:227:11: warning: 'PERL_UNUSED_DECL' macro redefined # define PERL_UNUSED_DECL ^ /opt/local/lib/perl5/5.16.3/darwin-thread-multi-2level/CORE/perl.h:328:13: note: previous definition is here # define PERL_UNUSED_DECL __attribute__unused__ ^ GCrypt.xs:59:5: error: unknown type name 'gcry_ac_handle_t'; did you mean 'gcry_mac_hd_t'? gcry_ac_handle_t h_ac; ^~~~~~~~~~~~~~~~ gcry_mac_hd_t /opt/local/include/gcrypt.h:1304:33: note: 'gcry_mac_hd_t' declared here typedef struct gcry_mac_handle *gcry_mac_hd_t; ^ GCrypt.xs:61:5: error: unknown type name 'gcry_ac_key_t'; did you mean 'gcry_mac_hd_t'? gcry_ac_key_t key_ac; ^~~~~~~~~~~~~ gcry_mac_hd_t /opt/local/include/gcrypt.h:1304:33: note: 'gcry_mac_hd_t' declared here typedef struct gcry_mac_handle *gcry_mac_hd_t; ^ GCrypt.xs:121:5: warning: 'gcry_thread_cbs' is deprecated [-Wdeprecated-declarations] GCRY_THREAD_OPTION_PTHREAD_IMPL; ^ /opt/local/include/gcrypt.h:227:17: note: expanded from macro 'GCRY_THREAD_OPTION_PTHREAD_IMPL' static struct gcry_thread_cbs gcry_threads_pthread = { \ ^ /opt/local/include/gcrypt.h:213:8: note: 'gcry_thread_cbs' declared here struct gcry_thread_cbs ^ GCrypt.xs:206:9: error: unknown type name 'gcry_ac_id_t'; did you mean 'gcry_mac_hd_t'? gcry_ac_id_t ac_algo; ^~~~~~~~~~~~ gcry_mac_hd_t /opt/local/include/gcrypt.h:1304:33: note: 'gcry_mac_hd_t' declared here typedef struct gcry_mac_handle *gcry_mac_hd_t; ^ GCrypt.xs:337:27: warning: implicit declaration of function 'gcry_ac_name_to_id' is invalid in C99 [-Wimplicit-function-declaration] RETVAL->err = gcry_ac_name_to_id(algo_s, &ac_algo); ^ GCrypt.xs:342:27: warning: implicit declaration of function 'gcry_ac_open' is invalid in C99 [-Wimplicit-function-declaration] RETVAL->err = gcry_ac_open(&RETVAL->h_ac, ac_algo, ac_flags); ^ GCrypt.xs:541:9: error: use of undeclared identifier 'gcry_ac_data_t' gcry_ac_data_t outdata; ^ GCrypt.xs:597:9: error: use of undeclared identifier 'gcry_ac_key_type_t' gcry_ac_key_type_t keytype; ^ GCrypt.xs:598:9: error: use of undeclared identifier 'gcry_ac_data_t' gcry_ac_data_t keydata; ^ GCrypt.xs:623:13: error: use of undeclared identifier 'keytype' keytype = -1; ^ GCrypt.xs:625:44: error: use of undeclared identifier 'keytype' if (strcmp(s, "private") == 0) keytype = GCRY_AC_KEY_SECRET; ^ GCrypt.xs:625:54: error: use of undeclared identifier 'GCRY_AC_KEY_SECRET' if (strcmp(s, "private") == 0) keytype = GCRY_AC_KEY_SECRET; ^ GCrypt.xs:626:43: error: use of undeclared identifier 'keytype' if (strcmp(s, "public") == 0) keytype = GCRY_AC_KEY_PUBLIC; ^ GCrypt.xs:626:53: error: use of undeclared identifier 'GCRY_AC_KEY_PUBLIC' if (strcmp(s, "public") == 0) keytype = GCRY_AC_KEY_PUBLIC; ^ GCrypt.xs:627:17: error: use of undeclared identifier 'keytype' if (keytype == -1) ^ GCrypt.xs:633:24: warning: implicit declaration of function 'gcry_ac_data_new' is invalid in C99 [-Wimplicit-function-declaration] gcr->err = gcry_ac_data_new(&keydata); ^ GCrypt.xs:633:42: error: use of undeclared identifier 'keydata' gcr->err = gcry_ac_data_new(&keydata); ^ GCrypt.xs:634:24: warning: implicit declaration of function 'gcry_ac_data_set' is invalid in C99 [-Wimplicit-function-declaration] gcr->err = gcry_ac_data_set(keydata, GCRY_AC_FLAG_COPY, "s", mpi); ^ GCrypt.xs:634:41: error: use of undeclared identifier 'keydata' gcr->err = gcry_ac_data_set(keydata, GCRY_AC_FLAG_COPY, "s", mpi); ^ GCrypt.xs:635:24: warning: implicit declaration of function 'gcry_ac_key_init' is invalid in C99 [-Wimplicit-function-declaration] gcr->err = gcry_ac_key_init(&gcr->key_ac, gcr->h_ac, keytype, keydata); ^ GCrypt.xs:635:66: error: use of undeclared identifier 'keytype' gcr->err = gcry_ac_key_init(&gcr->key_ac, gcr->h_ac, keytype, keydata); ^ GCrypt.xs:799:42: warning: implicit declaration of function 'gcry_ac_close' is invalid in C99 [-Wimplicit-function-declaration] if (gcr->type == CG_TYPE_ASYMM) gcry_ac_close(gcr->h_ac); ^ 8 warnings and 15 errors generated. make: *** [GCrypt.o] Error 1
Hi! I'm one of the FreeBSD ports people, we have the same problem. Show quoted text
> trying to update our libgcrypt package from 1.5.3 to 1.6.1. After > doing so, Crypt::GCrypt 1.26 fails to build, as shown at the end of > this email.
Apply this patch and it should build. 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.
Subject: Crypt-GCrypt.diff
--- 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)