crypto: Don't assert for empty output buffers.

It is always valid for crp_payload_output_start to be 0.  However, if
an output buffer is empty (e.g. a decryption request with a tag but an
empty payload), the existing assertion failed since 0 is not less than
0.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33193
This commit is contained in:
John Baldwin 2021-12-09 11:52:41 -08:00
parent 357ba2cf17
commit ec498562b7

View File

@ -1352,7 +1352,8 @@ crp_sanity(struct cryptop *crp)
KASSERT(crp->crp_payload_output_start == 0,
("payload output start non-zero without output buffer"));
} else {
KASSERT(crp->crp_payload_output_start < olen,
KASSERT(crp->crp_payload_output_start == 0 ||
crp->crp_payload_output_start < olen,
("invalid payload output start"));
KASSERT(crp->crp_payload_output_start +
crp->crp_payload_length <= olen,