On Sun, Jul 12, 2015 at 11:41 PM, Mobile Mouse <[email protected]> wrote:
> Your patch works. Compiled with GCC-5.1 (macports version, in turn built by
> Xcode-6.4 on Yosemite), "cryptest.exe v” now succeeds.
>

Yeah, at -O3, GCC uses SSE instructions and vectorizes the XOR. The
vectoriztion includes vmovdqu, vinsertf128, vmovdqa, and vxorps.

The problem appears to be, vmovdqa has a 128-bit alignment
requirement, but the code only provides a 64-bit alignment guarantee.

I'm researching how we can make it play well with GCC now and moving forward.

*****

void xorbuf(byte *buf, const byte *mask, size_t count)
{
    size_t i;

    if (IsAligned<word32>(buf) && IsAligned<word32>(mask))
    {
        if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned<word64>(buf) &&
IsAligned<word64>(mask))
        {
            for (i=0; i<count/8; i++)
                ((word64*)buf)[i] ^= ((word64*)mask)[i];
            count -= 8*i;
            if (!count)
                return;
            buf += 8*i;
            mask += 8*i;
        }

        for (i=0; i<count/4; i++)
            ((word32*)buf)[i] ^= ((word32*)mask)[i];
        count -= 4*i;
        if (!count)
            return;
        buf += 4*i;
        mask += 4*i;
    }

    for (i=0; i<count; i++)
        buf[i] ^= mask[i];
}

-- 
-- 
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