XilinxProcessorIPLib/drivers/trngpsv/src/CompactAES.c
static void mixColumnsSbox(AES_BLOCK dst, const AES_BLOCK state)
{
    dst[0]  = SBx2[state[0]]  ^ SBx3[state[5]]  ^ SBx1[state[10]] ^ SBx1[state[15]];
    dst[1]  = SBx1[state[0]]  ^ SBx2[state[5]]  ^ SBx3[state[10]] ^ SBx1[state[15]];
    dst[2]  = SBx1[state[0]]  ^ SBx1[state[5]]  ^ SBx2[state[10]] ^ SBx3[state[15]];
    dst[3]  = SBx3[state[0]]  ^ SBx1[state[5]]  ^ SBx1[state[10]] ^ SBx2[state[15]];
    dst[4]  = SBx2[state[4]]  ^ SBx3[state[9]]  ^ SBx1[state[14]] ^ SBx1[state[3]];
    dst[5]  = SBx1[state[4]]  ^ SBx2[state[9]]  ^ SBx3[state[14]] ^ SBx1[state[3]];
    dst[6]  = SBx1[state[4]]  ^ SBx1[state[9]]  ^ SBx2[state[14]] ^ SBx3[state[3]];
    dst[7]  = SBx3[state[4]]  ^ SBx1[state[9]]  ^ SBx1[state[14]] ^ SBx2[state[3]];
    dst[8]  = SBx2[state[8]]  ^ SBx3[state[13]] ^ SBx1[state[2]]  ^ SBx1[state[7]];
    dst[9]  = SBx1[state[8]]  ^ SBx2[state[13]] ^ SBx3[state[2]]  ^ SBx1[state[7]];
    dst[10] = SBx1[state[8]]  ^ SBx1[state[13]] ^ SBx2[state[2]]  ^ SBx3[state[7]];
    dst[11] = SBx3[state[8]]  ^ SBx1[state[13]] ^ SBx1[state[2]]  ^ SBx2[state[7]];
    dst[12] = SBx2[state[12]] ^ SBx3[state[1]]  ^ SBx1[state[6]]  ^ SBx1[state[11]];
    dst[13] = SBx1[state[12]] ^ SBx2[state[1]]  ^ SBx3[state[6]]  ^ SBx1[state[11]];
    dst[14] = SBx1[state[12]] ^ SBx1[state[1]]  ^ SBx2[state[6]]  ^ SBx3[state[11]];
    dst[15] = SBx3[state[12]] ^ SBx1[state[1]]  ^ SBx1[state[6]]  ^ SBx2[state[11]];
}
//
// The split between mixColumnsSbox() and shiftRowsSbox() follows the Karl Malbrain's
// public-domain code. No actual public-domain (or other third-party) code is re-used here.
//
The split between mixColumnsSbox() and shiftRowsSbox() follows the Karl Malbrain's
public-domain code. No actual public-domain (or other third-party) code is re-used here.
The split between mixColumnsSbox () and shiftRowsSbox () follows the Karl Malbrain ' s public - domain code . No actual public - domain ( or other third - party ) code is re - used here .
static void mixColumnsSbox(AES_BLOCK dst, const AES_BLOCK state)
{
    dst[0]  = SBx2[state[0]]  ^ SBx3[state[5]]  ^ SBx1[state[10]] ^ SBx1[state[15]];
    dst[1]  = SBx1[state[0]]  ^ SBx2[state[5]]  ^ SBx3[state[10]] ^ SBx1[state[15]];
    dst[2]  = SBx1[state[0]]  ^ SBx1[state[5]]  ^ SBx2[state[10]] ^ SBx3[state[15]];
    dst[3]  = SBx3[state[0]]  ^ SBx1[state[5]]  ^ SBx1[state[10]] ^ SBx2[state[15]];
    dst[4]  = SBx2[state[4]]  ^ SBx3[state[9]]  ^ SBx1[state[14]] ^ SBx1[state[3]];
    dst[5]  = SBx1[state[4]]  ^ SBx2[state[9]]  ^ SBx3[state[14]] ^ SBx1[state[3]];
    dst[6]  = SBx1[state[4]]  ^ SBx1[state[9]]  ^ SBx2[state[14]] ^ SBx3[state[3]];
    dst[7]  = SBx3[state[4]]  ^ SBx1[state[9]]  ^ SBx1[state[14]] ^ SBx2[state[3]];
    dst[8]  = SBx2[state[8]]  ^ SBx3[state[13]] ^ SBx1[state[2]]  ^ SBx1[state[7]];
    dst[9]  = SBx1[state[8]]  ^ SBx2[state[13]] ^ SBx3[state[2]]  ^ SBx1[state[7]];
    dst[10] = SBx1[state[8]]  ^ SBx1[state[13]] ^ SBx2[state[2]]  ^ SBx3[state[7]];
    dst[11] = SBx3[state[8]]  ^ SBx1[state[13]] ^ SBx1[state[2]]  ^ SBx2[state[7]];
    dst[12] = SBx2[state[12]] ^ SBx3[state[1]]  ^ SBx1[state[6]]  ^ SBx1[state[11]];
    dst[13] = SBx1[state[12]] ^ SBx2[state[1]]  ^ SBx3[state[6]]  ^ SBx1[state[11]];
    dst[14] = SBx1[state[12]] ^ SBx1[state[1]]  ^ SBx2[state[6]]  ^ SBx3[state[11]];
    dst[15] = SBx3[state[12]] ^ SBx1[state[1]]  ^ SBx1[state[6]]  ^ SBx2[state[11]];
}
static void mixColumnsSbox ( AES_BLOCK dst , const AES_BLOCK state ) { dst [ 0 ] = SBx2 [ state [ 0 ] ] ^ SBx3 [ state [ 5 ] ] ^ SBx1 [ state [ 10 ] ] ^ SBx1 [ state [ 15 ] ] ; dst [ 1 ] = SBx1 [ state [ 0 ] ] ^ SBx2 [ state [ 5 ] ] ^ SBx3 [ state [ 10 ] ] ^ SBx1 [ state [ 15 ] ] ; dst [ 2 ] = SBx1 [ state [ 0 ] ] ^ SBx1 [ state [ 5 ] ] ^ SBx2 [ state [ 10 ] ] ^ SBx3 [ state [ 15 ] ] ; dst [ 3 ] = SBx3 [ state [ 0 ] ] ^ SBx1 [ state [ 5 ] ] ^ SBx1 [ state [ 10 ] ] ^ SBx2 [ state [ 15 ] ] ; dst [ 4 ] = SBx2 [ state [ 4 ] ] ^ SBx3 [ state [ 9 ] ] ^ SBx1 [ state [ 14 ] ] ^ SBx1 [ state [ 3 ] ] ; dst [ 5 ] = SBx1 [ state [ 4 ] ] ^ SBx2 [ state [ 9 ] ] ^ SBx3 [ state [ 14 ] ] ^ SBx1 [ state [ 3 ] ] ; dst [ 6 ] = SBx1 [ state [ 4 ] ] ^ SBx1 [ state [ 9 ] ] ^ SBx2 [ state [ 14 ] ] ^ SBx3 [ state [ 3 ] ] ; dst [ 7 ] = SBx3 [ state [ 4 ] ] ^ SBx1 [ state [ 9 ] ] ^ SBx1 [ state [ 14 ] ] ^ SBx2 [ state [ 3 ] ] ; dst [ 8 ] = SBx2 [ state [ 8 ] ] ^ SBx3 [ state [ 13 ] ] ^ SBx1 [ state [ 2 ] ] ^ SBx1 [ state [ 7 ] ] ; dst [ 9 ] = SBx1 [ state [ 8 ] ] ^ SBx2 [ state [ 13 ] ] ^ SBx3 [ state [ 2 ] ] ^ SBx1 [ state [ 7 ] ] ; dst [ 10 ] = SBx1 [ state [ 8 ] ] ^ SBx1 [ state [ 13 ] ] ^ SBx2 [ state [ 2 ] ] ^ SBx3 [ state [ 7 ] ] ; dst [ 11 ] = SBx3 [ state [ 8 ] ] ^ SBx1 [ state [ 13 ] ] ^ SBx1 [ state [ 2 ] ] ^ SBx2 [ state [ 7 ] ] ; dst [ 12 ] = SBx2 [ state [ 12 ] ] ^ SBx3 [ state [ 1 ] ] ^ SBx1 [ state [ 6 ] ] ^ SBx1 [ state [ 11 ] ] ; dst [ 13 ] = SBx1 [ state [ 12 ] ] ^ SBx2 [ state [ 1 ] ] ^ SBx3 [ state [ 6 ] ] ^ SBx1 [ state [ 11 ] ] ; dst [ 14 ] = SBx1 [ state [ 12 ] ] ^ SBx1 [ state [ 1 ] ] ^ SBx2 [ state [ 6 ] ] ^ SBx3 [ state [ 11 ] ] ; dst [ 15 ] = SBx3 [ state [ 12 ] ] ^ SBx1 [ state [ 1 ] ] ^ SBx1 [ state [ 6 ] ] ^ SBx2 [ state [ 11 ] ] ; }
The split between mixColumnsSbox() and shiftRowsSbox() follows the Karl Malbrain's
public-domain code.
The split between mixColumnsSbox () and shiftRowsSbox () follows the Karl Malbrain ' s public - domain code .