On Fri, Apr 21, 2017 at 2:06 PM, Anton Gorev <[email protected]> wrote:
> Workaround in the same way. Changed definition of the INNER_LOOP_ITERATION
> (https://github.com/weidai11/cryptopp/blob/master/vmac.cpp#L549):
>
> #define INNER_LOOP_ITERATION(j) {\
> word64 d0 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+0]);\
> word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+1]);\
> AccumulateNH(nhA, d0+nhK[i+2*j+0], d1+nhK[i+2*j+1]);\
> if (T_128BitTag)\
> AccumulateNH(nhB, d0+nhK[i+2*j+2], d1+nhK[i+2*j+3]);\
> }
>
> To:
>
> #if defined(__SUNPRO_CC)
>         #define PREPARE_D0_D1(j) \
>                 word64 d0_original = 0;\
>                 memcpy(&d0_original, data + i + 2*j + 0,
> sizeof(d0_original));\
>                 word64 d1_original = 0;\
>                 memcpy(&d1_original, data + i + 2*j + 1,
> sizeof(d1_original));\
>                 \
>                 word64 d0 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER,
> d0_original);\
>                 word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER,
> d1_original)
> #else
>         #define PREPARE_D0_D1(j) \
>                 word64 d0 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER,
> data[i+2*j+0]);\
>                 word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER,
> data[i+2*j+1])
> #endif

Yeah, I'm kind of torn between feeling bad you have to do the extra
work and laughing at the compiler. We've seen some bizarre things,
like these unexplained compiler crashes [1] and function parameters
losing their const-ness and causing link errors [2,3].

Peter Gutmann once remarked when discussing his Cryptlib [4]:

<QUOTE>There's a historic reason for cryptlib's attempt to use gcc if at all
possible, which was that commercial vendors have traditionally shipped truly
ghastly C compilers (or, in Sun's case, a non-C compiler that pretended to be
a compiler ...).</QUOTE>

I guess we should probably incorporate the changes. If I open a bug
report, would you make a pull request?

Jeff

[1] https://www.cryptopp.com/wiki/Solaris_(Command_Line)#C.2B.2B03_and_C.2B.2B11
[2] https://github.com/weidai11/cryptopp/blob/master/integer.cpp#L81
[3] https://github.com/weidai11/cryptopp/blob/master/rijndael.cpp#L84
[4] http://cryptlib.mbsks.franken.narkive.com/PCehp90Q/use-cc-instead-of-gcc

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to