fail state change if SM2 overlaps SM3

Add a check to verify that SM2 does not overlap SM3.
pull/51/head
Hans-Erik Floryd 2019-01-31 16:27:56 +01:00
parent c66a5efb32
commit 8abbbb1fb8
1 changed files with 6 additions and 0 deletions

View File

@ -685,6 +685,12 @@ uint8_t ESC_checkSM23 (uint8_t state)
/* fail state change */
return (ESCpreop | ESCerror);
}
if ((ESC_SM2_sma + (etohs (SM->Length) * 3)) > ESC_SM3_sma)
{
ESCvar.SMtestresult = SMRESULT_ERRSM2;
/* SM2 overlaps SM3, fail state change */
return (ESCpreop | ESCerror);
}
ESC_read (ESCREG_SM3, (void *) &ESCvar.SM[3], sizeof (ESCvar.SM[3]));
SM = (_ESCsm2 *) & ESCvar.SM[3];
if ((etohs (SM->PSA) != ESC_SM3_sma) || (etohs (SM->Length) != ESCvar.ESC_SM3_sml)