cipher: Buffer data from gcry_cipher_authenticate in OCB mode.
authorWerner Koch <wk@gnupg.org>
Tue, 12 Apr 2016 09:11:35 +0000 (11:11 +0200)
committerWerner Koch <wk@gnupg.org>
Tue, 12 Apr 2016 09:12:16 +0000 (11:12 +0200)
commitb6d2a25a275a35ec4dbd53ecaa9ea0ed7aa99c7b
treea3ec573e3ae177bafb97f7f37e35c8b3176df18b
parentee7e1a0e835f8ffcfbcba2a44abab8632db8fed5
cipher: Buffer data from gcry_cipher_authenticate in OCB mode.

* cipher/cipher-internal.h (gcry_cipher_handle): Add fields
aad_leftover and aad_nleftover to u_mode.ocb.
* cipher/cipher-ocb.c (_gcry_cipher_ocb_set_nonce): Clear
aad_nleftover.
(_gcry_cipher_ocb_authenticate): Add buffering and facor some code out
to ...
(ocb_aad_finalize): new.
(compute_tag_if_needed): Call new function.
* tests/basic.c (check_ocb_cipher_splitaad): New.
(check_ocb_cipher): Call new function.
(main): Also call check_cipher_modes with --ciper-modes.
--

It is more convenient to not require full blocks for
gcry_cipher_authenticate.  Other modes than OCB do this as well.

Note that the size of the context structure is not increased because
other modes require more context data.

Signed-off-by: Werner Koch <wk@gnupg.org>
cipher/cipher-internal.h
cipher/cipher-ocb.c
doc/gcrypt.texi
src/gcrypt.h.in
tests/basic.c