[openssl-commits] [openssl] OpenSSL_1_1_1-stable update

Paul I. Dale pauli at openssl.org
Thu Oct 18 22:33:12 UTC 2018


The branch OpenSSL_1_1_1-stable has been updated
       via  aa519853be79ae92e6aa8ec34de5d1803d721b00 (commit)
      from  a190ea8ad7f2405d1a6245e59481fb6e3d0f60d2 (commit)


- Log -----------------------------------------------------------------
commit aa519853be79ae92e6aa8ec34de5d1803d721b00
Author: armfazh <armfazh at gmail.com>
Date:   Fri Oct 19 08:26:58 2018 +1000

    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 at openssl.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/7342)
    
    (cherry picked from commit cb8164b05e3bad5586c2a109bbdbab1ad65a1a6f)

-----------------------------------------------------------------------

Summary of changes:
 ssl/s3_cbc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ssl/s3_cbc.c b/ssl/s3_cbc.c
index 7d9c377..8e11864 100644
--- a/ssl/s3_cbc.c
+++ b/ssl/s3_cbc.c
@@ -256,12 +256,13 @@ int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
      * of hash termination (0x80 + 64-bit length) don't fit in the final
      * block, we say that the final two blocks can vary based on the padding.
      * TLSv1 has MACs up to 48 bytes long (SHA-384) and the padding is not
-     * required to be minimal. Therefore we say that the final six blocks can
+     * required to be minimal. Therefore we say that the final |variance_blocks|
+     * blocks can
      * vary based on the padding. Later in the function, if the message is
      * short and there obviously cannot be this many blocks then
      * variance_blocks can be reduced.
      */
-    variance_blocks = is_sslv3 ? 2 : 6;
+    variance_blocks = is_sslv3 ? 2 : ( ((255 + 1 + md_size + md_block_size - 1) / md_block_size) + 1);
     /*
      * From now on we're dealing with the MAC, which conceptually has 13
      * bytes of `header' before the start of the data (TLS) or 71/75 bytes


More information about the openssl-commits mailing list