tech-crypto archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Re: [patch] cgd



On Thu, Dec 02, 2010 at 04:23:57AM +0000, Taylor R Campbell wrote:
>

>    Date: Wed, 1 Dec 2010 23:57:45 +0000
>    From: "Roland C. Dowdeswell" <elric%imrryr.org@localhost>
> 
>    I'm reviewing the patch and it looks mostly good.  I've checked in
>    a couple of the bits already and will check the rest in with only
>    cosmetic modifications (such as breaking the patch into separate
>    commits implementing single changes) over the course of the next
>    few hours.
> 
> Great, thanks!

So, the part of your patch:

-       (void)params_filldefaults(p);
-       (void)keygen_filldefaults(p->keygen, p->keylen);
-       p->key = getkey("new file", p->keygen, p->keylen);
 
-       kg = keygen_generate(KEYGEN_STOREDKEY);
-       kg->kg_key = bits_xor(p->key, oldp->key);
-       keygen_addlist(&p->keygen, kg);
+       (void)params_filldefaults(p);
+       if (p->keygen && !p->keygen->next &&
+           p->keygen->kg_method == KEYGEN_STOREDKEY)
+               p->keygen->kg_key = bits_dup(oldp->key);
+       else
+               (void)keygen_filldefaults(p->keygen, p->keylen);
 
        if (!params_verify(p)) {
                warnx("can't generate new parameters file");
                return -1;
        }
 
+       p->key = getkey("new file", p->keygen, p->keylen);
+
+       /* put in a stored key only if necessary to preserve the key */
+       if (!bits_match(p->key, oldp->key)) {
+               kg = keygen_generate(KEYGEN_STOREDKEY);
+               kg->kg_key = bits_xor(p->key, oldp->key);
+               keygen_addlist(&p->keygen, kg);
+       }

Your use case here is to generate a new params file which has in it
only a stored key?

--
    Roland Dowdeswell                      http://Imrryr.ORG/~elric/


Home | Main Index | Thread Index | Old Index