From 5b5a030fa4efdc2832d3ed4e8647c2fab6e989e9 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Sun, 14 Aug 2005 14:13:07 +0000 Subject: [PATCH] When keys were configured without passphrase, number of iterations in metadata is equal to -1. if we then wanted to attach provider (or change keys) and forget about '-p' flag it failed on assertion (quite ok, without assertion it could call PKCS#5v2 with 4294967295 iterations). Instead of failing on assertion, remind about '-p' flag. MFC after: 3 days --- sbin/geom/class/eli/geom_eli.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sbin/geom/class/eli/geom_eli.c b/sbin/geom/class/eli/geom_eli.c index f01f55719c83..8d900f103097 100644 --- a/sbin/geom/class/eli/geom_eli.c +++ b/sbin/geom/class/eli/geom_eli.c @@ -344,6 +344,10 @@ eli_genkey(struct gctl_req *req, struct g_eli_metadata *md, unsigned char *key, if (!*nopassphrase) { char buf1[BUFSIZ], buf2[BUFSIZ], *p; + if (!new && md->md_iterations == -1) { + gctl_error(req, "Missing -p flag."); + return (NULL); + } for (;;) { p = readpassphrase( new ? "Enter new passphrase:" : "Enter passphrase:",