FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/fe_448.c
/* Subtract a field element from another. r = (a - b) mod (2^448 - 2^224 - 1)
 *
 * r  [in]  Field element to hold difference.
 * a  [in]  Field element to subtract from.
 * b  [in]  Field element to subtract.
 */
Subtract a field element from another.
Subtract a field element from another .
void fe448_sub(uint8_t* r, const uint8_t* a, const uint8_t* b)
{
    int i;
    int16_t c = 0;
    int16_t o = 0;
    for (i = 0; i < 56; i++) {
        if (i == 28)
            c += 0x1fc;
        else
            c += 0x1fe;
        c += a[i];
        c -= b[i];
        r[i] = (uint8_t)c;
        c >>= 8;
    }
    for (i = 0; i < 56; i++) {
        if ((i == 0) || (i == 28)) o += c;
        o += r[i];
        r[i] = (uint8_t)o;
        o >>= 8;
    }
}
void fe448_sub ( uint8_t * r , const uint8_t * a , const uint8_t * b ) { int i ; int16_t c = 0 ; int16_t o = 0 ; for ( i = 0 ; i < 56 ; i ++ ) { if ( i == 28 ) c += 0x1fc ; else c += 0x1fe ; c += a [ i ] ; c -= b [ i ] ; r [ i ] = ( uint8_t ) c ; c >>= 8 ; } for ( i = 0 ; i < 56 ; i ++ ) { if ( ( i == 0 ) || ( i == 28 ) ) o += c ; o += r [ i ] ; r [ i ] = ( uint8_t ) o ; o >>= 8 ; } }
Subtract a field element from another.
Subtract a field element from another .