/* -*-c-*-
- *
- * $Id$
*
* Key loading and storing
*
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Trivial IP Encryption (TrIPE).
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* TrIPE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with TrIPE; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* --- Derive the key sizes --- *
*
* Must ensure that we have non-empty keys. This isn't ideal, but it
- * provides a handy sanity check.
+ * provides a handy sanity check. Also must be based on a 64- or 128-bit
+ * block cipher or we can't do the data expiry properly.
*/
a->hashsz = a->h->hashsz;
if ((a->mksz = keysz(a->hashsz, a->m->keysz)) == 0)
return ("no key size found for MAC");
+ /* --- Derive the data limit --- */
+
+ if (a->c->blksz < 16) a->expsz = MEG(64);
+ else a->expsz = MEG(2048);
+
/* --- Ensure that the tag size is sane --- */
if (a->tagsz > a->m->hashsz) return ("tag length too large");
/* --- @keymoan@ --- *
*
* Arguments: @const char *file@ = name of the file
- * @int line@ = line number in file
- * @const char *msg@ = error message
- * @void *p@ = argument pointer
+ * @int line@ = line number in file
+ * @const char *msg@ = error message
+ * @void *p@ = argument pointer
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Reports an error message about loading a key file.
+ * Use: Reports an error message about loading a key file.
*/
static void keymoan(const char *file, int line, const char *msg, void *p)
/* --- Good, we're happy --- *
*
- * Dodginess! We change the group over here, but don't free any old group
+ * Dodginess! We change the group over here, but don't free any old group
* elements. This assumes that the new group is basically the same as the
* old one, and will happily adopt the existing elements. If it isn't,
* then we lose badly. Check this, then.
/* --- Ensure that the group is correct --- *
*
- * Dodginess! We assume that if this works, our global group is willing to
+ * Dodginess! We assume that if this works, our global group is willing to
* adopt this public element. Probably reasonable.
*/