Skip Menu |

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

Report information
The Basics
Id: 20495
Status: rejected
Priority: 0/
Queue: Crypt-IDEA

People
Owner: DPARIS [...] cpan.org
Requestors: alexchorny [...] gmail.com
Cc:
AdminCc:

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



Subject: Patch: inttypes.h is missing for Visual Studio 6.0; include <windows.h> required
MSVS 6.0 is not C99-compliant and is missing <inttypes.h> and <stdint.h>. patch for idea.h: #if defined(__osf__) || defined(__sun) || defined(__hpux) || defined(WIN32) #if _MSC_VER==1200 typedef unsigned short uint16_t; //sizeof(unsigned short)=2 typedef long int32_t; //sizeof(long)=4 #else #include <inttypes.h> #endif typedef uint16_t u_int16_t; #endif MSVS reqires inclusion of <windows.h> before <wininet.h> patch for _idea.c: #ifdef WIN32 #ifdef _MSC_VER #include <windows.h> #endif #include <wininet.h> # else #include <netinet/in.h> # endif Win32 version of this module for Perl 5.8 is available at http://chorny.net/perlmod/ P.S. Attempt to make portable <stdint.h>: http://www.azillionmonkeys.com/qed/pstdint.h ------- Alexandr Ciornii, http://chorny.net
Subject: idea.h
#include <sys/types.h> #define IDEA_KS_SIZE 104 #if defined(__osf__) || defined(__sun) || defined(__hpux) || defined(WIN32) #if _MSC_VER==1200 typedef unsigned short uint16_t; //sizeof(unsigned short)=2 typedef long int32_t; //sizeof(long)=4 #else #include <inttypes.h> #endif typedef uint16_t u_int16_t; #endif typedef u_int16_t idea_cblock[4]; typedef u_int16_t idea_user_key[8]; typedef u_int16_t idea_ks[52]; void idea_crypt(idea_cblock in, idea_cblock out, idea_ks key); void idea_invert_key(idea_ks key, idea_ks inv_key); void idea_expand_key(idea_user_key userKey, idea_ks key);
Subject: _idea.c
/* * Copyright (C) 1995, 1996 Systemics Ltd (http://www.systemics.com/) * All rights reserved. * * Modifications are Copyright (C) 2000-2006 W3Works, LLC * All rights reserved - and much gratitude to patch contributors! */ #include "idea.h" #ifdef WIN32 #ifdef _MSC_VER #include <windows.h> #endif #include <wininet.h> # else #include <netinet/in.h> # endif #define KEYS_PER_ROUND 6 #define ROUNDS 8 #define KEYLEN (KEYS_PER_ROUND*ROUNDS+4) /* * Multiplication modulo (2**16)+1 */ static u_int16_t mul(u_int16_t a, u_int16_t b) { int32_t p; if (a) { if (b) { p = a * b; b = p & 0xFFFF; a = p >> 16; return b - a + (b < a); } else return (1 - a); } return (1 - b); } /* * Compute inverse of x, modulo (2**16)+1, using Euclidean gcd algorithm */ static u_int16_t inv(u_int16_t x) { u_int16_t t0, t1, q, y; if (x <= 1) /* Since zero and one are self inverse */ return x; t1 = 0x10001L / x; /* Since x >= 2, the result is 16bit */ y = 0x10001L % x; if (y == 1) return ((1 - t1) & 0xFFFF); t0 = 1; do { q = x / y; x %= y; t0 += q * t1; if (x == 1) return t0; q = y / x; y = y % x; t1 += q * t0; } while (y != 1); return (1-t1); } /* * Encryption and decryption */ #define stfy(x) #x void idea_crypt(u_int16_t * in, u_int16_t * out, u_int16_t * key) { int i = ROUNDS; u_int16_t x0, x1, x2, x3, t0, t1; x0 = htons(*(in++)); x1 = htons(*(in++)); x2 = htons(*(in++)); x3 = htons(*(in)); do { x0 = mul(x0, *(key++)); x1 += *(key++); x2 += *(key++); x3 = mul(x3, *(key++)); t0 = x2; x2 = mul(x0^x2, *(key++)); t1 = x1; x1 = mul((x1^x3)+x2, *(key++)); x2 += x1; x0 ^= x1; x3 ^= x2; x1 ^= t0; x2 ^= t1; } while (--i); x0 = mul(x0, *(key++)); t0 = x1; x1 = x2 + *(key++); x2 = t0 + *(key++); x3 = mul(x3, *key); *(out++) = htons(x0); *(out++) = htons(x1); *(out++) = htons(x2); *(out) = htons(x3); } /* * Create decryption key */ void idea_invert_key(u_int16_t * key, u_int16_t * invKey) { int i; invKey[KEYS_PER_ROUND * ROUNDS + 0] = inv(*(key++)); invKey[KEYS_PER_ROUND * ROUNDS + 1] = -*(key++); invKey[KEYS_PER_ROUND * ROUNDS + 2] = -*(key++); invKey[KEYS_PER_ROUND * ROUNDS + 3] = inv(*(key++)); for (i = KEYS_PER_ROUND * (ROUNDS-1); i >= 0; i -= KEYS_PER_ROUND) { invKey[i+4] = *(key++); invKey[i+5] = *(key++); invKey[i+0] = inv(*(key++)); if (i > 0) { invKey[i+2] = -*(key++); invKey[i+1] = -*(key++); } else { invKey[i+1] = -*(key++); invKey[i+2] = -*(key++); } invKey[i+3]=inv(*(key++)); } } /* * Expand user key of 128 bits to full of 832 bits */ void idea_expand_key(u_int16_t * userKey, u_int16_t * key) { int i, j; for(i = 0; i < 8; i++) key[i] = htons(userKey[i]); j = 0; for(; i < KEYLEN; i++) { j++; key[j+7] = (key[j & 7] << 9 | key[(j+1) & 7] >> 7); key += j & 8; j &= 7; } }
From: DPARIS [...] cpan.org
On Sun Jul 16 17:00:23 2006, alexchorny@gmail.com wrote: Show quoted text
> MSVS 6.0 is not C99-compliant and is missing <inttypes.h> and <stdint.h>.
Patch rejected due to the use of a non-C99-compliant compiler. Please use a compliant compiler. This ticket is being rejected for the above cited reason(s). If the problem can be reproduced with a C99-compliant compiler, please add another bug ticket and the issue will be looked into. Thank you. -dsp
Subject: Which compilers are C99 compliant?
From: Alexandr Ciornii <alexchorny [...] gmail.com>
On Jul 16 19:53:56 2006, DPARIS wrote: Show quoted text
> Patch rejected due to the use of a non-C99-compliant compiler. Please > use a compliant compiler.
gcc is also not a C99-compliant compiler. Look at http://gcc.gnu.org/c99status.html Perl itself should not require an C99-compatible compiler. Patch was added recently to disable any C99 feature for gcc. Look at http://groups.google.com/group/perl.perl5.porters/browse_thread/thread/2d7ebb5bab4bcb6f/7763b6effbd6b023?lnk=gst&q=c89&rnum=2#7763b6effbd6b023 ActiveState Perl is compiled with Visual C++ 6. It is important Perl distribution, many people use ActiveState version for Perl development. P.S. This is a small patch, not something big that will be complicate to support. ------- Alexandr Ciornii, http://chorny.net
Rejecting this ticket AGAIN. This is the first instance of this problem that's been reported. All other reports have been of success with building. You have a COMMERCIAL complier on a COMMERCIAL OS. Use your COMMERCIAL support to fix the problem yourself. I will not spend the money on Visual Studio or any other Microsoft products when there are plenty of free alternatives. To properly test the fix, I need the compiler, which isn't going to happen, so neither is this patch. End of story. Cygwin runs fine and builds this module without problems. Ergo, the problem is in your compiler - compliant or not. This ticket will continue to be rejected if re-opened - or deleted alltogether. -dsp