Typo.
[openssl.git] / crypto / ec / ec_ameth.c
index e21221868fa5ea949f783212526eee96a14f8c6e..aead4db841767e48e0376e0012fb29d96c30a451 100644 (file)
@@ -119,7 +119,7 @@ static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
        penclen = i2o_ECPublicKey(ec_key, &p);
        if (penclen <= 0)
                goto err;
-       if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_DSA),
+       if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_EC),
                                ptype, pval, penc, penclen))
                return 1;
        err:
@@ -445,7 +445,6 @@ static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype)
                goto err;
                }
 
-
        if (ktype > 0)
                {
                public_key = EC_KEY_get0_public_key(x);
@@ -455,15 +454,15 @@ static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype)
                        reason = ERR_R_EC_LIB;
                        goto err;
                        }
-               buf_len = (size_t)BN_num_bytes(pub_key);
+               if (pub_key)
+                       buf_len = (size_t)BN_num_bytes(pub_key);
                }
-       else
 
        if (ktype == 2)
                {
-               if ((i = (size_t)BN_num_bytes(priv_key)) > buf_len)
-                       buf_len = i;
                priv_key = EC_KEY_get0_private_key(x);
+               if (priv_key && (i = (size_t)BN_num_bytes(priv_key)) > buf_len)
+                       buf_len = i;
                }
        else
                priv_key = NULL;
@@ -538,8 +537,10 @@ static int eckey_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
 EVP_PKEY_ASN1_METHOD eckey_asn1_meth = 
        {
        EVP_PKEY_EC,
+       EVP_PKEY_EC,
        0,
-       0,
+       "ec",
+       "OpenSSL EC algorithm",
 
        eckey_pub_decode,
        eckey_pub_encode,