Up until now, when generating TLS messages, we have ignored the overflow of length fields. When they overflow, we have been sending length fields that contains the modulo of the actual length.
This does not happen in practice (as the endpoints control what they send in the handshake messages, which tend to be much smaller than the limits), and even if they fail the behavior is not harmful in sense that they end up in TLS handshake failures, but it is better to report them as errors.
Therefore, this PR adds such logic. A new error code is defined that would be reported to the application. The error code sent on wire will be Internal Error, which is the same error code that we send when running out of memory.
Up until now, when generating TLS messages, we have ignored the overflow of length fields. When they overflow, we have been sending length fields that contains the modulo of the actual length.
This does not happen in practice (as the endpoints control what they send in the handshake messages, which tend to be much smaller than the limits), and even if they fail the behavior is not harmful in sense that they end up in TLS handshake failures, but it is better to report them as errors.
Therefore, this PR adds such logic. A new error code is defined that would be reported to the application. The error code sent on wire will be Internal Error, which is the same error code that we send when running out of memory.