+#ifndef OPENSSL_NO_ECDSA
+ if (strncmp("ecdsa:",p,4) == 0)
+ {
+ X509 *xtmp=NULL;
+ EVP_PKEY *dtmp;
+
+ pkey_type=TYPE_ECDSA;
+ p+=6;
+ if ((in=BIO_new_file(p,"r")) == NULL)
+ {
+ perror(p);
+ goto end;
+ }
+ if ((ecdsa_params = PEM_read_bio_ECDSAParameters(in, NULL, NULL, NULL)) == NULL)
+ {
+ ERR_clear_error();
+ (void)BIO_reset(in);
+ if ((xtmp=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL)
+ {
+ BIO_printf(bio_err,"unable to load ECDSA parameters from file\n");
+ goto end;
+ }
+
+ if ((dtmp=X509_get_pubkey(xtmp)) == NULL) goto end;
+ if (dtmp->type == EVP_PKEY_ECDSA)
+ ecdsa_params = ECDSAParameters_dup(dtmp->pkey.ecdsa);
+ EVP_PKEY_free(dtmp);
+ X509_free(xtmp);
+ if (ecdsa_params == NULL)
+ {
+ BIO_printf(bio_err,"Certificate does not contain ECDSA parameters\n");
+ goto end;
+ }
+ }
+
+ BIO_free(in);
+ in=NULL;
+
+ {
+ BIGNUM *order = BN_new();
+
+ if (!order)
+ goto end;
+ if (!EC_GROUP_get_order(ecdsa_params->group, order, NULL))
+ goto end;
+ newkey = BN_num_bits(order);
+ BN_free(order);
+ }
+
+ }
+ else
+#endif