[openssl] master update

beldmit at gmail.com beldmit at gmail.com
Wed Dec 30 08:33:47 UTC 2020


The branch master has been updated
       via  30af356df487b2dad571be15574b454daf70743c (commit)
      from  ae031148fde2b55238d56dcbe4ac05625382d970 (commit)


- Log -----------------------------------------------------------------
commit 30af356df487b2dad571be15574b454daf70743c
Author: Matt Caswell <matt at openssl.org>
Date:   Wed Dec 23 16:30:36 2020 +0000

    Don't call EVP_CIPHER_CTX_block_size() to find the block size
    
    The EVP lib was calling EVP_CIPHER_CTX_block_size(), which in turn calls
    EVP_CIPHER_block_size() in order to find the block_size in every
    EVP_EncryptUpdate() call. This adds a surprising amount of overhead when
    using speed to test aes-128-cbc. Since we're in the EVP lib itself, we can
    just directly access this value.
    
    To test performance I ran the command:
    openssl speed -evp aes-128-cbc -bytes 16 -seconds 30
    
    For the before and after, I ran this twice and discarded the first result
    to "warm up" my machine.
    
    Before:
    aes-128-cbc     716949.71k
    
    After:
    aes-128-cbc     742807.11k
    
    This represents a performance improvement of about 4%
    
    Partially fixes #13407
    
    Reviewed-by: Kurt Roeckx <kurt at roeckx.be>
    Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
    (Merged from https://github.com/openssl/openssl/pull/13734)

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

Summary of changes:
 crypto/evp/evp_enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c
index c1c8f1cf28..eb8c0faf14 100644
--- a/crypto/evp/evp_enc.c
+++ b/crypto/evp/evp_enc.c
@@ -556,7 +556,7 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
     if (ctx->cipher->prov == NULL)
         goto legacy;
 
-    blocksize = EVP_CIPHER_CTX_block_size(ctx);
+    blocksize = ctx->cipher->block_size;
 
     if (ctx->cipher->cupdate == NULL  || blocksize < 1) {
         ERR_raise(ERR_LIB_EVP, EVP_R_UPDATE_ERROR);


More information about the openssl-commits mailing list