On 03/21/18 07:20 AM, Boris Pismenny wrote: > > > On 3/20/2018 7:54 PM, Dave Watson wrote: > > + ctx->control = header[0]; > > + > > + data_len = ((header[4] & 0xFF) | (header[3] << 8)); > > + > > + cipher_overhead = tls_ctx->rx.tag_size + tls_ctx->rx.iv_size; > > + > > + if (data_len > TLS_MAX_PAYLOAD_SIZE + cipher_overhead) { > > + ret = -EMSGSIZE; > > + goto read_failure; > > + } > > + if (data_len < cipher_overhead) { > > + ret = -EMSGSIZE; > > I think this should be considered EBADMSG, because this error is cipher > dependent. At least, that's what happens within OpenSSL. Also, EMSGSIZE is > usually used only for too long messages. Ah, indeed. Thanks, will send v2.