test: psa_pake: fix error inject macro in ecjpake_do_round()

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
This commit is contained in:
Valerio Setti 2022-11-22 11:31:18 +01:00
parent b697745d14
commit b9ef1c2f03

View File

@ -52,12 +52,15 @@ typedef enum
PAKE_ROUND_TWO PAKE_ROUND_TWO
} pake_round_t; } pake_round_t;
/* Inject an error on the specified buffer ONLY it this is the correct stage */ /*
* Inject an error on the specified buffer ONLY it this is the correct stage.
* Offset 7 is arbitrary, but chosen because it's "in the middle" of the part
* we're corrupting.
*/
#define DO_ROUND_CONDITIONAL_INJECT( this_stage, buf ) \ #define DO_ROUND_CONDITIONAL_INJECT( this_stage, buf ) \
if ( this_stage == err_stage ) \ if ( this_stage == err_stage ) \
{ \ { \
*( buf + 7) ^= 1; \ *( buf + 7) ^= 1; \
*( buf + 8 ) ^= 1; \
} }
#define DO_ROUND_UPDATE_OFFSETS( main_buf_offset, step_offset, step_size ) \ #define DO_ROUND_UPDATE_OFFSETS( main_buf_offset, step_offset, step_size ) \