This CHECK dates to https://codereview.chromium.org/8418034 and, rather
than being anything about cryptography, was some quirk about
base::WriteInto which no longer applies.
Encrypting the empty string with CTR is perfectly valid. You just get
the empty string back out. Decrypting the empty string with CBC, under
this file's padding construction, will always fail, but that shouldn't
be a CHECK failure, just a clean decryption failure like any other bad
ciphertext.
(EVP_CIPHER does have some weird edge cases around NULL pointers, but
none apply to CBC. To be safe, I've added tests for all these.)
Bug: none
Change-Id: Ia33e0cf2d81f7ab0f3dc7ded61496d6fa06404dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3689714
Commit-Queue: David Benjamin <davidben@chromium.org>
Reviewed-by: Matt Mueller <mattm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1011474}