hercules-390 / hyperion

Hercules 390
Other
246 stars 69 forks source link

crypto/dyncrypt.c fails to compile on VS2008 #249

Closed srorso closed 6 years ago

srorso commented 6 years ago

The following diagnostics are generated by Visual Studio 2008 when compiling crypto/dyncrypt.c:

crypto\dyncrypt.c(73) : error C2059: syntax error : '['
crypto\dyncrypt.c(78) : error C2059: syntax error : '['
crypto\dyncrypt.c(85) : error C2059: syntax error : '['

C99 (?)-style initialization of the kmctr_wrap[32], kmctr_keylengths[32], and kmctr_pblens[32] arrays appears to be the issue; VS2008 does not support C99. VS2015 and VS2017 compile crypto/dyncrypt.c without messages.

Full-array initialization would not be unreasonable given array sizes, but....

Perhaps this is time to consider dropping VS2008, WinXP, and Vista from the list of supported platforms for Hyperion.

wably commented 6 years ago

Hi Steve,

I too experience this issue, but with VS2012 on Windows 7. I get around it by using an older version of dyncrypt.c that does not have the newer style of initialization for those arrays.

One could suggest that I upgrade my compiler to a later release, but I paid for my VS2012, so I am not anxious to buy another.

Regards, Bob

srorso commented 6 years ago

Hi Bob,

Thanks for noting that this issue also affects VS2012, and therefore likely affects VS2010 as well. That means "dropping VS2008", while maybe an OK idea, does not address this issue.

but I paid for my VS2012, so I am not anxious to buy another.

There is also the matter of making a newer VS fit on an older machine. And learning it.

I normally use VS2017 Community Edition, which is no-cost for open-source development, for development of free or paid applications by individuals, or use by up to five people in small enterprises. If interested, see Microsoft's Visual Studio Licensing Whitepaper, page 8. The examples have some interesting carve-outs for individuals/small enterprises working as contractors for large enterprises. IANAL; these are my observations, not legal advice.

So VS2017 may be available to you depending on your other activities with VS2012. VS2017 is Win-7 and newer.

Best Regards, Steve Orso

wably commented 6 years ago

Hi Steve,

Another idea would be to simply change dyncrypt.c so it is compatible with the older compilers. I had thought about doing just that when I first encountered this problem, but I shied away from it fearing a potential storm.

But we're trying to support so many platforms and therefore many different compiler versions as well, so it seems that it would be best to try to stay compatible with the vast majority of them and not necessarily use some new-fangled syntax just because it becomes available.

Regards, Bob

Fish-Git commented 6 years ago
static const int kmctr_wrap[32] =
{
//  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15
    0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  0,  0,  0,  0,

// 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  0,  0,  0
};
static const int kmctr_keylengths[32] =
{
//  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15
    0,  8, 16, 24,  0,  0,  0,  0,  0,  8, 16, 24,  0,  0,  0,  0,

// 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
    0,  0, 16, 24, 32,  0,  0,  0,  0,  0, 16, 24, 32,  0,  0,  0
};
static const int kmctr_pblens[32] =
{
//  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15
    0,  8, 16, 24,  0,  0,  0,  0,  0, 32, 40, 48,  0,  0,  0,  0,

// 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
    0,  0, 16, 24, 32,  0,  0,  0,  0,  0, 48, 56, 64,  0,  0,  0
};
srorso commented 6 years ago

Committed in b570ad1

srorso commented 6 years ago

Commits verified on Windows VS2008, VS2017, Debian 9.3