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(int64_t* a, const int64_t* b, int c)
{
    int64_t m = -(int64_t)c;
    int64_t t0 = m & (a[0] ^ b[0]);
    int64_t t1 = m & (a[1] ^ b[1]);
    int64_t t2 = m & (a[2] ^ b[2]);
    int64_t t3 = m & (a[3] ^ b[3]);
    int64_t t4 = m & (a[4] ^ b[4]);
    int64_t t5 = m & (a[5] ^ b[5]);
    int64_t t6 = m & (a[6] ^ b[6]);
    int64_t t7 = m & (a[7] ^ b[7]);
    a[0] ^= t0;
    a[1] ^= t1;
    a[2] ^= t2;
    a[3] ^= t3;
    a[4] ^= t4;
    a[5] ^= t5;
    a[6] ^= t6;
    a[7] ^= t7;
}
void fe448_cmov ( int64_t * a , const int64_t * b , int c ) { int64_t m = - ( int64_t ) c ; int64_t t0 = m & ( a [ 0 ] ^ b [ 0 ] ) ; int64_t t1 = m & ( a [ 1 ] ^ b [ 1 ] ) ; int64_t t2 = m & ( a [ 2 ] ^ b [ 2 ] ) ; int64_t t3 = m & ( a [ 3 ] ^ b [ 3 ] ) ; int64_t t4 = m & ( a [ 4 ] ^ b [ 4 ] ) ; int64_t t5 = m & ( a [ 5 ] ^ b [ 5 ] ) ; int64_t t6 = m & ( a [ 6 ] ^ b [ 6 ] ) ; int64_t t7 = m & ( a [ 7 ] ^ b [ 7 ] ) ; a [ 0 ] ^= t0 ; a [ 1 ] ^= t1 ; a [ 2 ] ^= t2 ; a [ 3 ] ^= t3 ; a [ 4 ] ^= t4 ; a [ 5 ] ^= t5 ; a [ 6 ] ^= t6 ; a [ 7 ] ^= t7 ; }
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 .