ta/wallet_ta.c
/**
  * Subtract (r = (op1 - op2) modulo #n) two 32 byte multi-precision numbers
  * under the current prime finite field. It is to be used
  * internally (only by the functions of the TA itself).
  * \param session_data A data pointer to a session context.
  * \param r The 32 byte result will be written into here.
  * \param op1 The 32 byte operand to subtract from. This may alias r.
  * \param op2 The 32 byte operand to sutract off op1. This may alias r or
  *            op1.
  * \warning op1 and op2 must both be < #n.
  */
Subtract (r = (op1 - op2) modulo #n) two 32 byte multi-precision numbers
under the current prime finite field. It is to be used
internally (only by the functions of the TA itself).
\param session_data A data pointer to a session context.
\param r The 32 byte result will be written into here.
\param op1 The 32 byte operand to subtract from. This may alias r.
\param op2 The 32 byte operand to sutract off op1. This may alias r or
op1.
\warning op1 and op2 must both be < #n.
Subtract ( r = ( op1 - op2 ) modulo #n ) two 32 byte multi - precision numbers under the current prime finite field . It is to be used internally ( only by the functions of the TA itself ) . \ param session_data A data pointer to a session context . \ param r The 32 byte result will be written into here . \ param op1 The 32 byte operand to subtract from . This may alias r . \ param op2 The 32 byte operand to sutract off op1 . This may alias r or op1 . \ warning op1 and op2 must both be < #n .
static void big_subtract_internal(Session_data * session_data, BigNum256 r, BigNum256 op1, BigNum256 op2)
{
	uint8_t *lookup[2];
	uint8_t too_small;
	uint8_t zero[32];
	big_set_zero_internal(zero);
	too_small = big_subtract_no_modulo_internal(r, op1, op2);
	lookup[0] = zero;
	lookup[1] = session_data->n;
	big_add_variable_size_no_modulo_internal(r, r, lookup[too_small], 32);
}
static void big_subtract_internal ( Session_data * session_data , BigNum256 r , BigNum256 op1 , BigNum256 op2 ) { uint8_t * lookup [ 2 ] ; uint8_t too_small ; uint8_t zero [ 32 ] ; big_set_zero_internal ( zero ) ; too_small = big_subtract_no_modulo_internal ( r , op1 , op2 ) ; lookup [ 0 ] = zero ; lookup [ 1 ] = session_data -> n ; big_add_variable_size_no_modulo_internal ( r , r , lookup [ too_small ] , 32 ) ; }
Subtract (r = (op1 - op2) modulo #n) two 32 byte multi-precision numbers
 under the current prime finite field.
Subtract ( r = ( op1 - op2 ) modulo #n ) two 32 byte multi - precision numbers under the current prime finite field .
/*
	assert(bigCompare(op1, n) == BIGCMP_LESS);
	assert(bigCompare(op2, n) == BIGCMP_LESS);
	*/