[svn] GnuPG - r3915 - trunk/g10
svn author dshaw
cvs at cvs.gnupg.org
Wed Oct 26 18:09:26 CEST 2005
Author: dshaw
Date: 2005-10-26 18:09:23 +0200 (Wed, 26 Oct 2005)
New Revision: 3915
Modified:
trunk/g10/ChangeLog
trunk/g10/keygen.c
Log:
* keygen.c (proc_parameter_file): Default key and subkey usage flags to
algo capabilities if parameter file doesn't specify them. Noted by Timo
Schulz.
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2005-10-21 15:03:18 UTC (rev 3914)
+++ trunk/g10/ChangeLog 2005-10-26 16:09:23 UTC (rev 3915)
@@ -1,3 +1,9 @@
+2005-10-26 David Shaw <dshaw at jabberwocky.com>
+
+ * keygen.c (proc_parameter_file): Default key and subkey usage
+ flags to algo capabilities if parameter file doesn't specify them.
+ Noted by Timo Schulz.
+
2005-10-18 Werner Koch <wk at g10code.com>
* cardglue.c (pin_cb): Fixed prompt for repeated PIN. Return
Modified: trunk/g10/keygen.c
===================================================================
--- trunk/g10/keygen.c 2005-10-21 15:03:18 UTC (rev 3914)
+++ trunk/g10/keygen.c 2005-10-26 16:09:23 UTC (rev 3915)
@@ -1955,7 +1955,7 @@
}
}
r->u.usage = use;
- return 0;
+ return 1;
}
static int
@@ -2062,14 +2062,14 @@
const char *s1, *s2, *s3;
size_t n;
char *p;
- int have_user_id=0;
+ int have_user_id=0,err,algo;
/* Check that we have all required parameters. */
r = get_parameter( para, pKEYTYPE );
if(r)
{
- if(check_pubkey_algo2(get_parameter_algo(para,pKEYTYPE),
- PUBKEY_USAGE_SIG))
+ algo=get_parameter_algo(para,pKEYTYPE);
+ if(check_pubkey_algo2(algo,PUBKEY_USAGE_SIG))
{
log_error("%s:%d: invalid algorithm\n", fname, r->lnr );
return -1;
@@ -2081,19 +2081,41 @@
return -1;
}
- if (parse_parameter_usage (fname, para, pKEYUSAGE))
+ err=parse_parameter_usage (fname, para, pKEYUSAGE);
+ if(err==0)
+ {
+ /* Default to algo capabilities if key-usage is not provided */
+ r=xmalloc_clear(sizeof(*r));
+ r->key=pKEYUSAGE;
+ r->u.usage=openpgp_pk_algo_usage(algo);
+ r->next=para;
+ para=r;
+ }
+ else if(err==-1)
return -1;
r = get_parameter( para, pSUBKEYTYPE );
if(r)
{
- if(check_pubkey_algo( get_parameter_algo( para, pSUBKEYTYPE)))
+ algo=get_parameter_algo( para, pSUBKEYTYPE);
+ if(check_pubkey_algo(algo))
{
log_error("%s:%d: invalid algorithm\n", fname, r->lnr );
return -1;
}
- if(parse_parameter_usage (fname, para, pSUBKEYUSAGE))
+ err=parse_parameter_usage (fname, para, pSUBKEYUSAGE);
+ if(err==0)
+ {
+ /* Default to algo capabilities if subkey-usage is not
+ provided */
+ r=xmalloc_clear(sizeof(*r));
+ r->key=pSUBKEYUSAGE;
+ r->u.usage=openpgp_pk_algo_usage(algo);
+ r->next=para;
+ para=r;
+ }
+ else if(err==-1)
return -1;
}
More information about the Gnupg-commits
mailing list