diff options
author | Bodo Möller <bodo@openssl.org> | 2002-08-16 11:19:07 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-08-16 11:19:07 +0000 |
commit | 64376cd8ff7ac2db8e4645a365184f782bd7b835 (patch) | |
tree | 3e000be4cbd53b58ccbf482ca20af384a44f4aa0 /apps/req.c | |
parent | cc8aa08b02818bc7aab531dc55d65ff85dc74fd4 (diff) | |
download | openssl-new-64376cd8ff7ac2db8e4645a365184f782bd7b835.tar.gz |
'EC' vs. 'ECDSA'
Submitted by: Nils Larsch
Diffstat (limited to 'apps/req.c')
-rw-r--r-- | apps/req.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/apps/req.c b/apps/req.c index 1f24be79bd..1105e59e67 100644 --- a/apps/req.c +++ b/apps/req.c @@ -152,7 +152,7 @@ int MAIN(int argc, char **argv) #ifndef OPENSSL_NO_DSA DSA *dsa_params=NULL; #endif -#ifndef OPENSSL_NO_EC +#ifndef OPENSSL_NO_ECDSA EC_KEY *ec_params = NULL; #endif unsigned long nmflag = 0; @@ -327,8 +327,8 @@ int MAIN(int argc, char **argv) } else #endif -#ifndef OPENSSL_NO_EC - if (strncmp("ecdsa:",p,4) == 0) +#ifndef OPENSSL_NO_ECDSA + if (strncmp("ec:",p,4) == 0) { X509 *xtmp=NULL; EVP_PKEY *dtmp; @@ -354,7 +354,8 @@ int MAIN(int argc, char **argv) goto end; } - if ((dtmp=X509_get_pubkey(xtmp)) == NULL) goto end; + if ((dtmp=X509_get_pubkey(xtmp))==NULL) + goto end; if (dtmp->type == EVP_PKEY_EC) ec_params = ECParameters_dup(dtmp->pkey.eckey); EVP_PKEY_free(dtmp); @@ -485,7 +486,9 @@ bad: BIO_printf(bio_err," the random number generator\n"); BIO_printf(bio_err," -newkey rsa:bits generate a new RSA key of 'bits' in size\n"); BIO_printf(bio_err," -newkey dsa:file generate a new DSA key, parameters taken from CA in 'file'\n"); - BIO_printf(bio_err," -newkey ecdsa:file generate a new ECDSA key, parameters taken from CA in 'file'\n"); +#ifndef OPENSSL_NO_ECDSA + BIO_printf(bio_err," -newkey ec:file generate a new EC key, parameters taken from CA in 'file'\n"); +#endif BIO_printf(bio_err," -[digest] Digest to sign with (md5, sha1, md2, mdc2, md4)\n"); BIO_printf(bio_err," -config file request template file.\n"); BIO_printf(bio_err," -subj arg set or modify request subject\n"); @@ -708,14 +711,14 @@ bad: } if (newkey < MIN_KEY_LENGTH && (pkey_type == TYPE_RSA || pkey_type == TYPE_DSA)) - /* TODO: appropriate minimal keylength for the different algorithm (esp. ECDSA) */ { BIO_printf(bio_err,"private key length is too short,\n"); BIO_printf(bio_err,"it needs to be at least %d bits, not %d\n",MIN_KEY_LENGTH,newkey); goto end; } BIO_printf(bio_err,"Generating a %d bit %s private key\n", - newkey,(pkey_type == TYPE_RSA)?"RSA":(pkey_type == TYPE_DSA)?"DSA":"ECDSA"); + newkey,(pkey_type == TYPE_RSA)?"RSA": + (pkey_type == TYPE_DSA)?"DSA":"EC"); if ((pkey=EVP_PKEY_new()) == NULL) goto end; @@ -737,7 +740,7 @@ bad: dsa_params=NULL; } #endif -#ifndef OPENSSL_NO_EC +#ifndef OPENSSL_NO_ECDSA if (pkey_type == TYPE_EC) { if (!EC_KEY_generate_key(ec_params)) goto end; @@ -1137,7 +1140,7 @@ end: #ifndef OPENSSL_NO_DSA if (dsa_params != NULL) DSA_free(dsa_params); #endif -#ifndef OPENSSL_NO_EC +#ifndef OPENSSL_NO_ECDSA if (ec_params != NULL) EC_KEY_free(ec_params); #endif apps_shutdown(); |