FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/ge_448.c
/* Select one of the entries from the precomputed table and negate if required.
 * Constant time implementation.
 *
 * r    [in]  Point to hold chosen point.
 * pos  [in]  Position of array of entries to choose from.
 * b    [in]  Index of point to select. -ve value means negate the point.
 */
Select one of the entries from the precomputed table and negate if required.
Constant time implementation.

r    [in]  Point to hold chosen point.
pos  [in]  Position of array of entries to choose from.
b    [in]  Index of point to select. -ve value means negate the point.
Select one of the entries from the precomputed table and negate if required . Constant time implementation . r [ in ] Point to hold chosen point . pos [ in ] Position of array of entries to choose from . b [ in ] Index of point to select . - ve value means negate the point .
static void ge448_select(ge448_precomp* r, int pos, int8_t b)
{
    ge448 minusx[16];
    uint8_t bnegative = negative(b);
    uint8_t babs = b - (((-bnegative) & b) << 1);
    ge448_precomp_0(r);
    cmov(r, &base[pos][0], babs, 1);
    cmov(r, &base[pos][1], babs, 2);
    cmov(r, &base[pos][2], babs, 3);
    cmov(r, &base[pos][3], babs, 4);
    cmov(r, &base[pos][4], babs, 5);
    cmov(r, &base[pos][5], babs, 6);
    cmov(r, &base[pos][6], babs, 7);
    cmov(r, &base[pos][7], babs, 8);
    fe448_neg(minusx, r->x);
    fe448_cmov(r->x, minusx, bnegative);
}
static void ge448_select ( ge448_precomp * r , int pos , int8_t b ) { ge448 minusx [ 16 ] ; uint8_t bnegative = negative ( b ) ; uint8_t babs = b - ( ( ( - bnegative ) & b ) << 1 ) ; ge448_precomp_0 ( r ) ; cmov ( r , & base [ pos ] [ 0 ] , babs , 1 ) ; cmov ( r , & base [ pos ] [ 1 ] , babs , 2 ) ; cmov ( r , & base [ pos ] [ 2 ] , babs , 3 ) ; cmov ( r , & base [ pos ] [ 3 ] , babs , 4 ) ; cmov ( r , & base [ pos ] [ 4 ] , babs , 5 ) ; cmov ( r , & base [ pos ] [ 5 ] , babs , 6 ) ; cmov ( r , & base [ pos ] [ 6 ] , babs , 7 ) ; cmov ( r , & base [ pos ] [ 7 ] , babs , 8 ) ; fe448_neg ( minusx , r -> x ) ; fe448_cmov ( r -> x , minusx , bnegative ) ; }
Select one of the entries from the precomputed table and negate if required.
Select one of the entries from the precomputed table and negate if required .