X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fcrypto_sw_scheduler%2Fmain.c;h=fa2611f065c4248177a0ca98ae6991cf21a1730d;hb=5c481ff732caef6cbd4e3c095e802f095a920d82;hp=29f91b36345bd8a8170db15dd0384e05b530859e;hpb=edda5926e0b755368aef017a278272b796d22467;p=vpp.git diff --git a/src/plugins/crypto_sw_scheduler/main.c b/src/plugins/crypto_sw_scheduler/main.c index 29f91b36345..fa2611f065c 100644 --- a/src/plugins/crypto_sw_scheduler/main.c +++ b/src/plugins/crypto_sw_scheduler/main.c @@ -170,7 +170,21 @@ cryptodev_sw_scheduler_sgl (vlib_main_t * vm, break; } - ASSERT (offset == 0 && len == 0); + ASSERT (offset == 0); + if (n_chunks && len) + { + /* Some async crypto users can use buffers in creative ways, let's allow + * some flexibility here... + * Current example is ESP decrypt with ESN in async mode: it will stash + * ESN at the end of the last buffer (if it can) because it must be part + * of the integrity check but it will not update the buffer length. + * Fixup the last operation chunk length if we have room. + */ + ASSERT (vlib_buffer_space_left_at_end (vm, nb) >= len); + if (vlib_buffer_space_left_at_end (vm, nb) >= len) + ch->len += len; + } + op->chunk_index = chunk_index; op->n_chunks = n_chunks; }