1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-05 23:07:49 +02:00

gpgsm: Remove restriction of key generation (only RSA).

* sm/certreqgen.c (proc_parameters): Remove checking GCRY_PK_RSA.

--

This is an initial change to support ECC key generation.

GnuPG-bug-id: 4888
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2020-03-26 11:30:58 +09:00
parent c1844ca752
commit 238707db8b

View File

@ -433,6 +433,7 @@ proc_parameters (ctrl_t ctrl, struct para_data_s *para,
struct para_data_s *r; struct para_data_s *r;
const char *s, *string; const char *s, *string;
int i; int i;
int algo;
unsigned int nbits; unsigned int nbits;
char numbuf[20]; char numbuf[20];
unsigned char keyparms[100]; unsigned char keyparms[100];
@ -446,22 +447,22 @@ proc_parameters (ctrl_t ctrl, struct para_data_s *para,
/* Check that we have all required parameters; */ /* Check that we have all required parameters; */
assert (get_parameter (para, pKEYTYPE, 0)); assert (get_parameter (para, pKEYTYPE, 0));
/* We can only use RSA for now. There is a problem with pkcs-10 on /* There is a problem with pkcs-10 on how to use ElGamal because it
how to use ElGamal because it is expected that a PK algorithm can is expected that a PK algorithm can always be used for
always be used for signing. Another problem is that on-card signing. Another problem is that on-card generated encryption
generated encryption keys may not be used for signing. */ keys may not be used for signing. */
i = get_parameter_algo (para, pKEYTYPE); algo = get_parameter_algo (para, pKEYTYPE);
if (!i && (s = get_parameter_value (para, pKEYTYPE, 0)) && *s) if (!algo && (s = get_parameter_value (para, pKEYTYPE, 0)) && *s)
{ {
/* Hack to allow creation of certificates directly from a smart /* Hack to allow creation of certificates directly from a smart
card. For example: "Key-Type: card:OPENPGP.3". */ card. For example: "Key-Type: card:OPENPGP.3". */
if (!strncmp (s, "card:", 5) && s[5]) if (!strncmp (s, "card:", 5) && s[5])
cardkeyid = xtrystrdup (s+5); cardkeyid = xtrystrdup (s+5);
} }
if ( (i < 1 || i != GCRY_PK_RSA) && !cardkeyid ) if (algo < 1 && !cardkeyid)
{ {
r = get_parameter (para, pKEYTYPE, 0); r = get_parameter (para, pKEYTYPE, 0);
log_error (_("line %d: invalid algorithm\n"), r->lnr); log_error (_("line %d: invalid algorithm\n"), r ? r->lnr: -1);
return gpg_error (GPG_ERR_INV_PARAMETER); return gpg_error (GPG_ERR_INV_PARAMETER);
} }