Home GnuPG

Add OCB bulk crypt/auth functions for AES/AES-NI
305cc878d395Unpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

Add OCB bulk crypt/auth functions for AES/AES-NI

* cipher/cipher-internal.h (gcry_cipher_handle): Add bulk.ocb_crypt
and bulk.ocb_auth.
(_gcry_cipher_ocb_get_l): New prototype.
* cipher/cipher-ocb.c (get_l): Rename to ...
(_gcry_cipher_ocb_get_l): ... this.
(_gcry_cipher_ocb_authenticate, ocb_crypt): Use bulk function when
available.
* cipher/cipher.c (_gcry_cipher_open_internal): Setup OCB bulk
functions for AES.
* cipher/rijndael-aesni.c (get_l, aesni_ocb_enc, aes_ocb_dec)
(_gcry_aes_aesni_ocb_crypt, _gcry_aes_aesni_ocb_auth): New.
* cipher/rijndael.c [USE_AESNI] (_gcry_aes_aesni_ocb_crypt)
(_gcry_aes_aesni_ocb_auth): New prototypes.
(_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth): New.
* src/cipher.h (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth): New
prototypes.
* tests/basic.c (check_ocb_cipher_largebuf): New.
(check_ocb_cipher): Add large buffer encryption/decryption test.

Patch adds bulk encryption/decryption/authentication code for AES-NI
accelerated AES.

Benchmark on Intel i5-4570 (3200 Mhz, turbo off):

Before:
AES | nanosecs/byte mebibytes/sec cycles/byte

 OCB enc |      2.12 ns/B     449.7 MiB/s      6.79 c/B
 OCB dec |      2.12 ns/B     449.6 MiB/s      6.79 c/B
OCB auth |      2.07 ns/B     459.9 MiB/s      6.64 c/B

After:
AES | nanosecs/byte mebibytes/sec cycles/byte

 OCB enc |     0.292 ns/B    3262.5 MiB/s     0.935 c/B
 OCB dec |     0.297 ns/B    3212.2 MiB/s     0.950 c/B
OCB auth |     0.260 ns/B    3666.1 MiB/s     0.832 c/B
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Apr 18 2015, 4:41 PM
Parents
rCfe38d3815b4c: tests: Add option to time the S2K function.
Branches
Unknown
Tags
Unknown

Event Timeline

Jussi Kivilinna <jussi.kivilinna@iki.fi> committed rC305cc878d395: Add OCB bulk crypt/auth functions for AES/AES-NI (authored by Jussi Kivilinna <jussi.kivilinna@iki.fi>).Apr 18 2015, 4:41 PM