/*----- Main code ---------------------------------------------------------*/
+/* --- @gaead_szokcommon@ --- *
+ *
+ * Arguments: @const gcaead *aec@ = pointer to AEAD class
+ * @size_t nsz@, @size_t hsz@, @size_t msz@, @size_t tsz@ =
+ * nonce, header, message, and tag sizes
+ *
+ * Returns: Nonzero if the sizes are acceptable to the AEAD scheme in
+ * combination.
+ *
+ * Use: Generic implementation for sensible AEAD schemes.
+ */
+
+int gaead_szokcommon(const gcaead *aec,
+ size_t nsz, size_t hsz, size_t msz, size_t tsz)
+{
+ if (keysz(nsz, aec->noncesz) != nsz) return (0);
+ if (keysz(tsz, aec->tagsz) != tsz) return (0);
+ if (hsz && (aec->f&AEADF_NOAAD)) return (0);
+ return (1);
+}
+
/* --- @gaead_encrypt@ --- *
*
* Arguments: @const gaead_key *k@ = the AEAD key, already prepared