Fix tls_cbc_digest_record is slow using SHA-384 and short messages
authorarmfazh <armfazh@gmail.com>
Thu, 18 Oct 2018 22:26:58 +0000 (08:26 +1000)
committerPauli <paul.dale@oracle.com>
Thu, 18 Oct 2018 22:32:44 +0000 (08:32 +1000)
commitaa519853be79ae92e6aa8ec34de5d1803d721b00
treeac0dcdecc91c511a98152b8bd9c167f9122bb470
parenta190ea8ad7f2405d1a6245e59481fb6e3d0f60d2
Fix tls_cbc_digest_record is slow using SHA-384 and short messages

The formula used for this is now

kVarianceBlocks = ((255 + 1 + md_size + md_block_size - 1) / md_block_size) + 1

Notice that md_block_size=64 for SHA256, which results on the
magic constant kVarianceBlocks = 6.
However, md_block_size=128 for SHA384 leading to kVarianceBlocks = 4.

CLA:trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7342)

(cherry picked from commit cb8164b05e3bad5586c2a109bbdbab1ad65a1a6f)
ssl/s3_cbc.c