crypto: add sanity checking of plaintext/ciphertext length