Commit 41b6e728 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Niels Möller

Expand documentation to cover CMAC-64

parent e381cfeb
...@@ -3815,14 +3815,21 @@ as described above, the new value is used unless you call the ...@@ -3815,14 +3815,21 @@ as described above, the new value is used unless you call the
@node CMAC,, UMAC, Keyed hash functions @node CMAC,, UMAC, Keyed hash functions
@subsection @acronym{CMAC} @subsection @acronym{CMAC}
@cindex CMAC @cindex CMAC
@cindex CMAC-128
@cindex CMAC-64
@acronym{CMAC} is a message authentication code based on CBC encryption @acronym{CMAC} is a message authentication code based on CBC encryption
mode. It is suitable for systems where block ciphers are preferrable mode. It is suitable for systems where block ciphers are preferrable
and perform better than hash functions. @acronym{CMAC} is specified in and perform better than hash functions. @acronym{CMAC-128} is specified in
@cite{RFC4493}. The block size is always 128 bits (16 octets). @cite{RFC4493}. The block size is always 128 bits (16 octets).
@acronym{CMAC-64} is specified by
@uref{https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38B.pdf,
NIST Special Publication 800-38B}. The block size is always 64 bits
(8 octets).
Nettle provides helper functions for @acronym{CMAC } with Nettle provides helper functions for @acronym{CMAC-128} with
the @acronym{AES} block cipher. the @acronym{AES} block cipher and for @acronym{CMAC-64} with
the @acronym{Tripple-DES} block cipher.
Nettle defines @acronym{CMAC} in @file{<nettle/cmac.h>}. Nettle defines @acronym{CMAC} in @file{<nettle/cmac.h>}.
...@@ -3831,7 +3838,7 @@ Nettle defines @acronym{CMAC} in @file{<nettle/cmac.h>}. ...@@ -3831,7 +3838,7 @@ Nettle defines @acronym{CMAC} in @file{<nettle/cmac.h>}.
@end deftp @end deftp
@defvr Constant CMAC128_DIGEST_SIZE @defvr Constant CMAC128_DIGEST_SIZE
The size of an CMAC digest, 16. The size of an CMAC-128 digest, 16.
@end defvr @end defvr
@deftypefun void cmac_aes128_set_key (struct cmac_aes128_ctx *@var{ctx}, const uint8_t *@var{key}) @deftypefun void cmac_aes128_set_key (struct cmac_aes128_ctx *@var{ctx}, const uint8_t *@var{key})
...@@ -3866,6 +3873,29 @@ provide a smaller value, only the first @var{length} octets of the ...@@ -3866,6 +3873,29 @@ provide a smaller value, only the first @var{length} octets of the
processing of a new message with the same key. processing of a new message with the same key.
@end deftypefun @end deftypefun
@deftp {Context struct} {struct cmac_des3_ctx}
@end deftp
@defvr Constant CMAC64_DIGEST_SIZE
The size of an CMAC-64 digest, 8.
@end defvr
@deftypefun void cmac_des3_set_key (struct cmac_des3_ctx *@var{ctx}, const uint8_t *@var{key})
This function initializes the @acronym{CMAC} context struct for @acronym{Tripple-DES}.
@end deftypefun
@deftypefun void cmac_des3_update (struct cmac_des3_ctx *@var{ctx},size_t @var{length}, const uint8_t *@var{data})
This function is called zero or more times to process the message.
@end deftypefun
@deftypefun void cmac_des3_digest (struct cmac_des3_ctx *@var{ctx}, size_t @var{length}, uint8_t *@var{digest})
Extracts the @acronym{MAC} of the message, writing it to @var{digest}.
@var{length} is usually equal to the specified output size, but if you
provide a smaller value, only the first @var{length} octets of the
@acronym{MAC} are written. This function resets the context for
processing of a new message with the same key.
@end deftypefun
@node Poly1305,, CMAC, Keyed hash functions @node Poly1305,, CMAC, Keyed hash functions
@comment node-name, next, previous, up @comment node-name, next, previous, up
@subsection Poly1305 @subsection Poly1305
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment