• Martin Willi's avatar
    crypto: chacha20 - Add a four block SSSE3 variant for x86_64 · 274f938e
    Martin Willi authored
    Extends the x86_64 SSSE3 ChaCha20 implementation by a function processing
    four ChaCha20 blocks in parallel. This avoids the word shuffling needed
    in the single block variant, further increasing throughput.
    
    For large messages, throughput increases by ~110% compared to single block
    SSSE3:
    
    testing speed of chacha20 (chacha20-simd) encryption
    test 0 (256 bit key, 16 byte blocks): 43141886 operations in 10 seconds (690270176 bytes)
    test 1 (256 bit key, 64 byte blocks): 46845874 operations in 10 seconds (2998135936 bytes)
    test 2 (256 bit key, 256 byte blocks): 18458512 operations in 10 seconds (4725379072 bytes)
    test 3 (256 bit key, 1024 byte blocks): 5360533 operations in 10 seconds (5489185792 bytes)
    test 4 (256 bit key, 8192 byte blocks): 692846 operations in 10 seconds (5675794432 bytes)
    
    testing speed of chacha20 (chacha20-simd) encryption
    test 0 (256 bit key, 16 byte blocks): 42249230 operations in 10 seconds (675987680 bytes)
    test 1 (256 bit key, 64 byte blocks): 46441641 operations in 10 seconds (2972265024 bytes)
    test 2 (256 bit key, 256 byte blocks): 33028112 operations in 10 seconds (8455196672 bytes)
    test 3 (256 bit key, 1024 byte blocks): 11568759 operations in 10 seconds (11846409216 bytes)
    test 4 (256 bit key, 8192 byte blocks): 1448761 operations in 10 seconds (11868250112 bytes)
    
    Benchmark results from a Core i5-4670T.
    Signed-off-by: default avatarMartin Willi <martin@strongswan.org>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    274f938e
chacha20-ssse3-x86_64.S 14.3 KB