FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/fe_448.c
/* Constant time, conditional move of b into a.
 * a is not changed if the condition is 0.
 *
 * a  A field element.
 * b  A field element.
 * c  If 1 then copy and if 0 then don't copy.
 */
Constant time, conditional move of b into a.
a is not changed if the condition is 0.

a  A field element.
b  A field element.
c  If 1 then copy and if 0 then don't copy.
Constant time conditional move of b into a . a is not changed if the condition is 0 . a A field element . b A field element . c If 1 then copy and if 0 then don ' t copy .
void fe448_cmov(int32_t* a, const int32_t* b, int c)
{
    int32_t m = -(int32_t)c;
    int32_t t0 = m & (a[0] ^ b[0]);
    int32_t t1 = m & (a[1] ^ b[1]);
    int32_t t2 = m & (a[2] ^ b[2]);
    int32_t t3 = m & (a[3] ^ b[3]);
    int32_t t4 = m & (a[4] ^ b[4]);
    int32_t t5 = m & (a[5] ^ b[5]);
    int32_t t6 = m & (a[6] ^ b[6]);
    int32_t t7 = m & (a[7] ^ b[7]);
    int32_t t8 = m & (a[8] ^ b[8]);
    int32_t t9 = m & (a[9] ^ b[9]);
    int32_t t10 = m & (a[10] ^ b[10]);
    int32_t t11 = m & (a[11] ^ b[11]);
    int32_t t12 = m & (a[12] ^ b[12]);
    int32_t t13 = m & (a[13] ^ b[13]);
    int32_t t14 = m & (a[14] ^ b[14]);
    int32_t t15 = m & (a[15] ^ b[15]);
    a[0] ^= t0;
    a[1] ^= t1;
    a[2] ^= t2;
    a[3] ^= t3;
    a[4] ^= t4;
    a[5] ^= t5;
    a[6] ^= t6;
    a[7] ^= t7;
    a[8] ^= t8;
    a[9] ^= t9;
    a[10] ^= t10;
    a[11] ^= t11;
    a[12] ^= t12;
    a[13] ^= t13;
    a[14] ^= t14;
    a[15] ^= t15;
}
void fe448_cmov ( int32_t * a , const int32_t * b , int c ) { int32_t m = - ( int32_t ) c ; int32_t t0 = m & ( a [ 0 ] ^ b [ 0 ] ) ; int32_t t1 = m & ( a [ 1 ] ^ b [ 1 ] ) ; int32_t t2 = m & ( a [ 2 ] ^ b [ 2 ] ) ; int32_t t3 = m & ( a [ 3 ] ^ b [ 3 ] ) ; int32_t t4 = m & ( a [ 4 ] ^ b [ 4 ] ) ; int32_t t5 = m & ( a [ 5 ] ^ b [ 5 ] ) ; int32_t t6 = m & ( a [ 6 ] ^ b [ 6 ] ) ; int32_t t7 = m & ( a [ 7 ] ^ b [ 7 ] ) ; int32_t t8 = m & ( a [ 8 ] ^ b [ 8 ] ) ; int32_t t9 = m & ( a [ 9 ] ^ b [ 9 ] ) ; int32_t t10 = m & ( a [ 10 ] ^ b [ 10 ] ) ; int32_t t11 = m & ( a [ 11 ] ^ b [ 11 ] ) ; int32_t t12 = m & ( a [ 12 ] ^ b [ 12 ] ) ; int32_t t13 = m & ( a [ 13 ] ^ b [ 13 ] ) ; int32_t t14 = m & ( a [ 14 ] ^ b [ 14 ] ) ; int32_t t15 = m & ( a [ 15 ] ^ b [ 15 ] ) ; a [ 0 ] ^= t0 ; a [ 1 ] ^= t1 ; a [ 2 ] ^= t2 ; a [ 3 ] ^= t3 ; a [ 4 ] ^= t4 ; a [ 5 ] ^= t5 ; a [ 6 ] ^= t6 ; a [ 7 ] ^= t7 ; a [ 8 ] ^= t8 ; a [ 9 ] ^= t9 ; a [ 10 ] ^= t10 ; a [ 11 ] ^= t11 ; a [ 12 ] ^= t12 ; a [ 13 ] ^= t13 ; a [ 14 ] ^= t14 ; a [ 15 ] ^= t15 ; }
Constant time, conditional move of b into a.
 a is not changed if the condition is 0.
Constant time conditional move of b into a . a is not changed if the condition is 0 .