Crypto-safexcel H/W accelerator

With specific reference to the crypto-safexcel hardware which is present in some SoC, how does software take advantage of this?

I don't see any /dev/crypto available when the module is loaded. And the documentation that refers to this device seems to imply software that is specifically compiled or enabled to utilise it.

The crypto-safexcel seems exclusively for AES, so basically IPsec and perhaps some TLS usage.

# cat /proc/crypto

...

name         : rfc4309(ccm(aes))
driver       : safexcel-rfc4309-ccm-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 1
ivsize       : 8
maxauthsize  : 16
geniv        : <none>

name         : rfc4543(gcm(aes))
driver       : safexcel-rfc4543-gcm-aes
module       : kernel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 1
ivsize       : 8
maxauthsize  : 16
geniv        : <none>

name         : rfc4106(gcm(aes))
driver       : safexcel-rfc4106-gcm-aes
module       : kernel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 1
ivsize       : 8
maxauthsize  : 16
geniv        : <none>

name         : authenc(hmac(sha384),cbc(des))
driver       : safexcel-authenc-hmac-sha384-cbc-des
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 8
ivsize       : 8
maxauthsize  : 48
geniv        : <none>

name         : authenc(hmac(sha512),cbc(des))
driver       : safexcel-authenc-hmac-sha512-cbc-des
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 8
ivsize       : 8
maxauthsize  : 64
geniv        : <none>

name         : authenc(hmac(sha224),cbc(des))
driver       : safexcel-authenc-hmac-sha224-cbc-des
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 8
ivsize       : 8
maxauthsize  : 28
geniv        : <none>

name         : authenc(hmac(sha256),cbc(des))
driver       : safexcel-authenc-hmac-sha256-cbc-des
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 8
ivsize       : 8
maxauthsize  : 32
geniv        : <none>

name         : authenc(hmac(sha384),cbc(des3_ede))
driver       : safexcel-authenc-hmac-sha384-cbc-des3_ede
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 8
ivsize       : 8
maxauthsize  : 48
geniv        : <none>

name         : authenc(hmac(sha512),cbc(des3_ede))
driver       : safexcel-authenc-hmac-sha512-cbc-des3_ede
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 8
ivsize       : 8
maxauthsize  : 64
geniv        : <none>

name         : authenc(hmac(sha224),cbc(des3_ede))
driver       : safexcel-authenc-hmac-sha224-cbc-des3_ede
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 8
ivsize       : 8
maxauthsize  : 28
geniv        : <none>

name         : authenc(hmac(sha256),cbc(des3_ede))
driver       : safexcel-authenc-hmac-sha256-cbc-des3_ede
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 8
ivsize       : 8
maxauthsize  : 32
geniv        : <none>

name         : authenc(hmac(sha1),cbc(des))
driver       : safexcel-authenc-hmac-sha1-cbc-des
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 8
ivsize       : 8
maxauthsize  : 20
geniv        : <none>

name         : cmac(aes)
driver       : safexcel-cmac-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 16
digestsize   : 16

name         : xcbc(aes)
driver       : safexcel-xcbc-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 16
digestsize   : 16

name         : cbcmac(aes)
driver       : safexcel-cbcmac-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 1
digestsize   : 16

name         : crc32
driver       : safexcel-crc32
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 1
digestsize   : 4

name         : ccm(aes)
driver       : safexcel-ccm-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 1
ivsize       : 16
maxauthsize  : 16
geniv        : <none>

name         : gcm(aes)
driver       : safexcel-gcm-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 1
ivsize       : 12
maxauthsize  : 16
geniv        : <none>

name         : authenc(hmac(sha512),rfc3686(ctr(aes)))
driver       : safexcel-authenc-hmac-sha512-ctr-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 1
ivsize       : 8
maxauthsize  : 64
geniv        : <none>

name         : authenc(hmac(sha384),rfc3686(ctr(aes)))
driver       : safexcel-authenc-hmac-sha384-ctr-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 1
ivsize       : 8
maxauthsize  : 48
geniv        : <none>

name         : authenc(hmac(sha256),rfc3686(ctr(aes)))
driver       : safexcel-authenc-hmac-sha256-ctr-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 1
ivsize       : 8
maxauthsize  : 32
geniv        : <none>

name         : authenc(hmac(sha224),rfc3686(ctr(aes)))
driver       : safexcel-authenc-hmac-sha224-ctr-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 1
ivsize       : 8
maxauthsize  : 28
geniv        : <none>

name         : authenc(hmac(sha1),rfc3686(ctr(aes)))
driver       : safexcel-authenc-hmac-sha1-ctr-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 1
ivsize       : 8
maxauthsize  : 20
geniv        : <none>

name         : authenc(hmac(sha1),cbc(des3_ede))
driver       : safexcel-authenc-hmac-sha1-cbc-des3_ede
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 8
ivsize       : 8
maxauthsize  : 20
geniv        : <none>

name         : authenc(hmac(sha512),cbc(aes))
driver       : safexcel-authenc-hmac-sha512-cbc-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 16
ivsize       : 16
maxauthsize  : 64
geniv        : <none>

name         : authenc(hmac(sha384),cbc(aes))
driver       : safexcel-authenc-hmac-sha384-cbc-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 16
ivsize       : 16
maxauthsize  : 48
geniv        : <none>

name         : authenc(hmac(sha256),cbc(aes))
driver       : safexcel-authenc-hmac-sha256-cbc-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 16
ivsize       : 16
maxauthsize  : 32
geniv        : <none>

name         : authenc(hmac(sha224),cbc(aes))
driver       : safexcel-authenc-hmac-sha224-cbc-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 16
ivsize       : 16
maxauthsize  : 28
geniv        : <none>

name         : authenc(hmac(sha1),cbc(aes))
driver       : safexcel-authenc-hmac-sha1-cbc-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : aead
async        : yes
blocksize    : 16
ivsize       : 16
maxauthsize  : 20
geniv        : <none>

name         : hmac(sha512)
driver       : safexcel-hmac-sha512
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 128
digestsize   : 64

name         : hmac(sha384)
driver       : safexcel-hmac-sha384
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 128
digestsize   : 48

name         : hmac(sha256)
driver       : safexcel-hmac-sha256
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 32

name         : hmac(sha224)
driver       : safexcel-hmac-sha224
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 28

name         : hmac(sha1)
driver       : safexcel-hmac-sha1
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 20

name         : hmac(md5)
driver       : safexcel-hmac-md5
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 16

name         : sha512
driver       : safexcel-sha512
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 128
digestsize   : 64

name         : sha384
driver       : safexcel-sha384
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 128
digestsize   : 48

name         : sha256
driver       : safexcel-sha256
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 32

name         : sha224
driver       : safexcel-sha224
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 28

name         : sha1
driver       : safexcel-sha1
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 20

name         : md5
driver       : safexcel-md5
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 16

name         : rfc3686(ctr(aes))
driver       : safexcel-ctr-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 1
min keysize  : 20
max keysize  : 36
ivsize       : 8
chunksize    : 1
walksize     : 1

name         : ofb(aes)
driver       : safexcel-ofb-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 1
min keysize  : 16
max keysize  : 32
ivsize       : 16
chunksize    : 1
walksize     : 1

name         : cfb(aes)
driver       : safexcel-cfb-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 1
min keysize  : 16
max keysize  : 32
ivsize       : 16
chunksize    : 1
walksize     : 1

name         : cbc(aes)
driver       : safexcel-cbc-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 16
min keysize  : 16
max keysize  : 32
ivsize       : 16
chunksize    : 16
walksize     : 16

name         : ecb(aes)
driver       : safexcel-ecb-aes
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 16
min keysize  : 16
max keysize  : 32
ivsize       : 0
chunksize    : 16
walksize     : 16

name         : cbc(des3_ede)
driver       : safexcel-cbc-des3_ede
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 8
min keysize  : 24
max keysize  : 24
ivsize       : 8
chunksize    : 8
walksize     : 8

name         : ecb(des3_ede)
driver       : safexcel-ecb-des3_ede
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 8
min keysize  : 24
max keysize  : 24
ivsize       : 0
chunksize    : 8
walksize     : 8

name         : cbc(des)
driver       : safexcel-cbc-des
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 8
min keysize  : 8
max keysize  : 8
ivsize       : 8
chunksize    : 8
walksize     : 8

name         : ecb(des)
driver       : safexcel-ecb-des
module       : crypto_safexcel
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 8
min keysize  : 8
max keysize  : 8
ivsize       : 0
chunksize    : 8
walksize     : 8

Are the standard crypto libraries built to utilise these engines automatically?

Found this discussion but could not infer an answer from it.

Only openssl and you need to install dev/crypto engine. Otherwise algos are for kernel like openvpn only.

I followed @cotequeiroz efforts, but those went quiet here, and we don't yet know for certain whether apk will resolve lib choice problems, until maybe tomorrow :slight_smile:

Question (since safexcel doesn't do this): are there e.g. consumer usb(3) pluggable accelerator modules for the WireGuard cryptos ( Chacha20-poly1305 ) ? I am thinking about older devices which could do with a speed bump up. Given that a whole new router probably wouldn't cost that much more, I hadn't thought about such upgrades before now.

[1] https://forum.netgate.com/topic/177909/chacha20-poly1305-hardware-assist-offload
[2] https://cerberus-laboratories.com/products/oceanus_chacha20poly1305/

Can't see anything concrete.

Something like libopenssl-afalg, then openssl engine and so on.