Skip Menu |

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

Report information
The Basics
Id: 1756
Status: resolved
Priority: 0/
Queue: Crypt-IDEA

People
Owner: DPARIS [...] cpan.org
Requestors: landman [...] scalableinformatics.com
Cc:
AdminCc:

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



Subject: Bug and fix for Crypt::IDEA
Line 66 of the IDEA.xs has a pointer to the value sv_undef. This should be a pointer to PL_sv_undef (see attached file). Basically change line 66 from if (output == &sv_undef) to if (output == &PL_sv_undef) and you should have a working Crypt::IDEA. This is needed under Perl 5.8.0.
/* * Copyright (C) 1995, 1996 Systemics Ltd (http://www.systemics.com/) * All rights reserved. */ #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "idea.h" MODULE = Crypt::IDEA PACKAGE = Crypt::IDEA PREFIX = idea_ char * idea_expand_key(key) char * key = NO_INIT STRLEN key_len = NO_INIT CODE: { idea_ks ks; key = (char *) SvPV(ST(0), key_len); if (key_len != sizeof(idea_user_key)) croak("Invalid key"); idea_expand_key((u_int16_t *)key, ks); ST(0) = sv_2mortal(newSVpv((char *)ks, sizeof(ks))); } char * idea_invert_key(ks) char * ks = NO_INIT STRLEN ks_len = NO_INIT CODE: { u_int16_t iks[52]; ks = (char *) SvPV(ST(0), ks_len); if (ks_len != sizeof(idea_ks)) croak("Invalid key schedule"); idea_invert_key((u_int16_t *)ks, iks); ST(0) = sv_2mortal(newSVpv((char *)iks, sizeof(iks))); } void idea_crypt(input, output, ks) char * input = NO_INIT SV * output char * ks = NO_INIT STRLEN input_len = NO_INIT STRLEN output_len = NO_INIT STRLEN ks_len = NO_INIT CODE: { input = (char *) SvPV(ST(0), input_len); if (input_len != 8) croak("input must be 8 bytes long"); ks = (char *) SvPV(ST(2), ks_len); if (ks_len != sizeof(idea_ks)) croak("Invalid key schedule"); if (output == &PL_sv_undef) output = sv_newmortal(); output_len = 8; if (!SvUPGRADE(output, SVt_PV)) croak("cannot use output argument as lvalue"); idea_crypt((u_int16_t *)input, (u_int16_t *)SvGROW(output, output_len), (u_int16_t *)ks); SvCUR_set(output, output_len); *SvEND(output) = '\0'; (void) SvPOK_only(output); SvTAINT(output); ST(0) = output; }