git: crypto: Refactor the chacha20poly1305 code to be more flexible

Aaron LI aly at crater.dragonflybsd.org
Sat Jan 13 06:01:36 PST 2024


commit 59e2d68495e0600e5561f8911c5dbe3fa1db1e3d
Author: Aaron LI <aly at aaronly.me>
Date:   Thu Nov 23 17:56:45 2023 +0800

    crypto: Refactor the chacha20poly1305 code to be more flexible
    
    Introduce the 'chacha20poly1305_ctx' struct to hold the context, and
    implement the _init()/_update()/_final() functions as the building
    blocks to perform encryption/decryption in a more generic way.
    
    The main intention is to help implement the in-place encryption and
    decryption of data in an mbuf chain.  That would reduce the unnecessary
    memory allocations and data copies in packet manipulations, as needed by
    the in-kernel WireGuard.  This API will be done in a later commit.
    
    Rewrite the original chacha20poly1305_{encrypt,decrypt}() functions
    using the new blocks.

Summary of changes:
 sys/crypto/chachapoly.c | 231 ++++++++++++++++++++++++++++++++++--------------
 sys/crypto/chachapoly.h |  12 +++
 2 files changed, 177 insertions(+), 66 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/59e2d68495e0600e5561f8911c5dbe3fa1db1e3d


-- 
DragonFly BSD source repository


More information about the Commits mailing list