hardware crypto acceleration firmware with 350% gain :)

308 views
Skip to first unread message

rstac...@gmail.com

unread,
Aug 17, 2020, 4:59:38 AM8/17/20
to GnuBee
Hey,

I managed to built gnubee firmware (based on openwrt) with hardware crypto acceleration.
It helps substantially (300%..400%) in disk operations (if configured properly), resulting in up to 40MB/s reading from encrypted disk (9MB/s normal).

It also helps with network transfer, but to the less extent, and also needs specific configuration.

Is anyone interested?


Results: #########################################################
root@BEFORE:~# cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
#     Algorithm |       Key |      Encryption |      Decryption
        aes-cbc        128b        11.3 MiB/s        11.6 MiB/s
    serpent-cbc        128b         9.2 MiB/s         9.5 MiB/s
    twofish-cbc        128b        12.3 MiB/s        12.6 MiB/s
        aes-cbc        256b         9.0 MiB/s         9.1 MiB/s
    serpent-cbc        256b         9.2 MiB/s         9.5 MiB/s
    twofish-cbc        256b        12.4 MiB/s        12.7 MiB/s
        aes-xts        256b        11.7 MiB/s        11.6 MiB/s
    serpent-xts        256b         8.1 MiB/s         9.5 MiB/s
    twofish-xts        256b        12.9 MiB/s        12.9 MiB/s
        aes-xts        512b         9.1 MiB/s         9.1 MiB/s
    serpent-xts        512b         9.6 MiB/s         9.2 MiB/s
    twofish-xts        512b        12.9 MiB/s        12.9 MiB/s

#AFTER #################################
#     Algorithm |       Key |      Encryption |      Decryption
        aes-cbc        128b        39.3 MiB/s        39.6 MiB/s
    serpent-cbc        128b         8.4 MiB/s         9.5 MiB/s
    twofish-cbc        128b        11.0 MiB/s        12.7 MiB/s
        aes-cbc        256b        32.3 MiB/s        32.3 MiB/s
    serpent-cbc        256b         9.4 MiB/s         9.5 MiB/s
    twofish-cbc        256b        12.4 MiB/s        12.7 MiB/s
        aes-xts        256b        20.4 MiB/s        26.6 MiB/s
    serpent-xts        256b         6.5 MiB/s         9.5 MiB/s
    twofish-xts        256b         8.6 MiB/s        12.7 MiB/s
        aes-xts        512b        23.3 MiB/s        23.2 MiB/s
    serpent-xts        512b         9.6 MiB/s         9.5 MiB/s
    twofish-xts        512b        12.8 MiB/s        12.7 MiB/s

Brett Neumeier

unread,
Aug 17, 2020, 6:31:39 AM8/17/20
to rstac...@gmail.com, GnuBee
I am very interested -- do you have documentation or scripts or something else that can be used to reproduce your results?

--
You received this message because you are subscribed to the Google Groups "GnuBee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gnubee+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gnubee/cd5380c0-8a2f-49bf-a9aa-f5aaae32dc43n%40googlegroups.com.

rstac...@gmail.com

unread,
Aug 18, 2020, 9:10:12 AM8/18/20
to GnuBee
It was just my preliminary work over last few days. There is no ready to follow script or procedure, as it involed using tip of the git repo for openwrt (master branch), patching manually kernel with mtk-eip93 engine, and putting it all together. This also need a proper configuration of cryptsetup to be able to not "lose" the the speed gains, meaning: luks 2.0 is a must, with bigger underlaying sector (4k, not 512), and proper crypto methods: read you must create properly crypto volume from scratch.

anyway 'cat /proc/crypto' shows a few ciphers using mt7621 hw accel on my build, which is a good sign for other apps also (BUT ONLY if you can process data in bigger blocks (therefore luks sector change to 4k is a must)).

I was planning to create a polished openwrt firmware with all the above for my gnubees as I'm using openwrt (although stable one) exclusively due to multiple advantages in use on constrained embedded devices (gnubee like ;).

If you're interested in using such openwrt firmware, I may put some effort to polish it a little bit more and share it for you to flash. it may take some time.



Brett Neumeier

unread,
Aug 18, 2020, 9:16:59 AM8/18/20
to rstac...@gmail.com, GnuBee
Ok, so the kernel part of this is stock OpenWRT (head of git master) with the addition of mtk-eip93? Can I ask where you obtained the mtk-eip93 driver?

rstac...@gmail.com

unread,
Aug 18, 2020, 10:45:25 AM8/18/20
to GnuBee
There is a repo with some work here: https://github.com/vschagen/mtk-eip93
Reply all
Reply to author
Forward
0 new messages