[gnutls-devel] GnuTLS | nettle: utilize nettle_cbc_aes*_encrypt for performance (!1836)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Wed May 15 04:45:22 CEST 2024



Daiki Ueno created a merge request: https://gitlab.com/gnutls/gnutls/-/merge_requests/1836

Project:Branches: dueno/gnutls:wip/dueno/nettle-aes-cbc to gnutls/gnutls:master
Author:   Daiki Ueno




<!-- Add a description of the new feature/bug fix. Reference any relevant bugs. -->

* nettle: utilize nettle_cbc_aes*_encrypt for performance

While CBC encryption is inherently slow for lack of parallelisim,
Nettle >= 3.8 provides specialized AES-CBC encryption functions to
improve performance by avoiding multiple calls to block cipher
initialization. This patch makes GnuTLS use those functions if
available.

Here are the results of benchmark:

* GNUTLS_CPUID_OVERRIDE=0x1, without nettle_cbc_aes*_encrypt:
```
  Checking cipher-MAC combinations, payload size: 16384
          AES-128-CBC-SHA1 0.90 GB/sec
          AES-128-CBC-SHA256 0.88 GB/sec

  Checking ciphers, payload size: 16384
               AES-128-CBC 1.56 GB/sec
```
* GNUTLS_CPUID_OVERRIDE=0x1, with nettle_cbc_aes*_encrypt:
```
  Checking cipher-MAC combinations, payload size: 16384
          AES-128-CBC-SHA1 1.08 GB/sec
          AES-128-CBC-SHA256 1.05 GB/sec

  Checking ciphers, payload size: 16384
               AES-128-CBC 2.16 GB/sec
```
* GNUTLS_CPUID_OVERRIDE unset:
```
  Checking cipher-MAC combinations, payload size: 16384
          AES-128-CBC-SHA1 1.13 GB/sec
          AES-128-CBC-SHA256 1.05 GB/sec

  Checking ciphers, payload size: 16384
               AES-128-CBC 2.24 GB/sec
```

## Checklist
 * [x] Commits have `Signed-off-by:` with name/author being identical to the commit author
 * [ ] Code modified for feature
 * [ ] Test suite updated with functionality tests
 * [ ] Test suite updated with negative tests
 * [ ] Documentation updated / NEWS entry present (for non-trivial changes)
 * [ ] CI timeout is 2h or higher (see Settings/CICD/General pipelines/Timeout)

## Reviewer's checklist:
 * [ ] Any issues marked for closing are addressed
 * [ ] There is a test suite reasonably covering new functionality or modifications
 * [ ] Function naming, parameters, return values, types, etc., are consistent and according to `CONTRIBUTION.md`
 * [ ] This feature/change has adequate documentation added
 * [ ] No obvious mistakes in the code

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1836
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20240515/96e66959/attachment-0001.html>


More information about the Gnutls-devel mailing list