• Ondrej Mosnacek's avatar
    crypto: lrw - Optimize tweak computation · c778f96b
    Ondrej Mosnacek authored
    This patch rewrites the tweak computation to a slightly simpler method
    that performs less bswaps. Based on performance measurements the new
    code seems to provide slightly better performance than the old one.
    
    PERFORMANCE MEASUREMENTS (x86_64)
    Performed using: https://gitlab.com/omos/linux-crypto-bench
    Crypto driver used: lrw(ecb-aes-aesni)
    
    Before:
           ALGORITHM KEY (b)        DATA (B)   TIME ENC (ns)   TIME DEC (ns)
            lrw(aes)     256              64             204             286
            lrw(aes)     320              64             227             203
            lrw(aes)     384              64             208             204
            lrw(aes)     256             512             441             439
            lrw(aes)     320             512             456             455
            lrw(aes)     384             512             469             483
            lrw(aes)     256            4096            2136            2190
            lrw(aes)     320            4096            2161            2213
            lrw(aes)     384            4096            2295            2369
            lrw(aes)     256           16384            7692            7868
            lrw(aes)     320           16384            8230            8691
            lrw(aes)     384           16384            8971            8813
            lrw(aes)     256           32768           15336           15560
            lrw(aes)     320           32768           16410           16346
            lrw(aes)     384           32768           18023           17465
    
    After:
           ALGORITHM KEY (b)        DATA (B)   TIME ENC (ns)   TIME DEC (ns)
            lrw(aes)     256              64             200             203
            lrw(aes)     320              64             202             204
            lrw(aes)     384              64             204             205
            lrw(aes)     256             512             415             415
            lrw(aes)     320             512             432             440
            lrw(aes)     384             512             449             451
            lrw(aes)     256            4096            1838            1995
            lrw(aes)     320            4096            2123            1980
            lrw(aes)     384            4096            2100            2119
            lrw(aes)     256           16384            7183            6954
            lrw(aes)     320           16384            7844            7631
            lrw(aes)     384           16384            8256            8126
            lrw(aes)     256           32768           14772           14484
            lrw(aes)     320           32768           15281           15431
            lrw(aes)     384           32768           16469           16293
    Signed-off-by: default avatarOndrej Mosnacek <omosnace@redhat.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    c778f96b
lrw.c 13.8 KB