apdu: Do not insert delay while fuzzing

This was timeout after 60 seconds. After skipping this call, we
get down to 1 s for the same input

Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27423
This commit is contained in:
Jakub Jelen 2021-02-03 21:30:01 +01:00 committed by Frank Morgner
parent 251c4f6b76
commit 7ba89daae6
1 changed files with 2 additions and 0 deletions

View File

@ -401,11 +401,13 @@ sc_set_le_and_transmit(struct sc_card *card, struct sc_apdu *apdu, size_t olen)
/* set the new expected length */
apdu->resplen = olen;
apdu->le = nlen;
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
/* Belpic V1 applets have a problem: if the card sends a 6C XX (only XX bytes available),
* and we resend the command too soon (i.e. the reader is too fast), the card doesn't respond.
* So we build in a delay. */
if (card->type == SC_CARD_TYPE_BELPIC_EID)
msleep(40);
#endif
/* re-transmit the APDU with new Le length */
rv = sc_single_transmit(card, apdu);