X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/blobdiff_plain/53a941d3f97a50964587c6e9533b1e43e74a57a8..a62f8e8a94bf56194539f7140a1215bc74309b36:/server/keymgmt.c diff --git a/server/keymgmt.c b/server/keymgmt.c index 601f42ed..ce0d4561 100644 --- a/server/keymgmt.c +++ b/server/keymgmt.c @@ -247,7 +247,8 @@ static const char *algs_check(algswitch *a, const group *g) /* --- 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; @@ -256,6 +257,11 @@ static const char *algs_check(algswitch *a, const group *g) 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");