symm/gaead.h: Specify a flag for `AEAD' schemes which don't do AAD.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 16 Aug 2019 11:33:22 +0000 (12:33 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 8 Sep 2019 17:36:04 +0000 (18:36 +0100)
This is a useful shape, and, in particular, it covers the NaCl
`crypto_secretbox' transform.

symm/gaead.h

index cad250c..33feb36 100644 (file)
@@ -124,7 +124,8 @@ typedef struct gaead_aadops {
 
   void (*hash)(gaead_aad */*a*/, const void */*h*/, size_t /*hsz*/);
        /* Feed header (additional authenticated) data into the AAD-hashing
-        * object.
+        * object.  If the @AEADF_NOAAD@ class flag is set then @hsz@ must be
+        * zero.
         */
 
   void (*destroy)(gaead_aad */*a*/);
@@ -262,6 +263,7 @@ typedef struct gcaead {
 #define AEADF_PCTSZ 4u                 /*   Precommit to tag size */
 #define AEADF_AADNDEP 8u               /*   AAD hash is nonce-dependent */
 #define AEADF_AADFIRST 16u             /*   AAD must precede msg/ct */
+#define AEADF_NOAAD 32u                        /*   AAD is not permitted */
 
   gaead_key *(*key)(const void */*k*/, size_t /*ksz*/);
        /* Return a key object (above) with the given key material. */