Please do not use C++ comments in C code.
[oweals/openssl.git] / crypto / asn1 / t_pkey.c
index 964fd914f7ed3f4e6439ca7563d8bd1ab50439d3..0112f7cced53ef10d3ee63db3854652d87119e45 100644 (file)
@@ -412,13 +412,31 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
                        if (BIO_write(bp, str, off) <= 0)
                                goto err;
                        }
-
+               /* print the 'short name' of the field type */
                if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_nid))
                        <= 0)
                        goto err;  
 
                if (is_char_two)
                        {
+                       /* print the 'short name' of the base type OID */
+                       int basis_type = EC_GROUP_get_basis_type(x);
+                       if (basis_type == 0)
+                               goto err;
+
+                       if (off)
+                               {
+                               if (off > 128) off=128;
+                               memset(str,' ',off);
+                               if (BIO_write(bp, str, off) <= 0)
+                                       goto err;
+                               }
+
+                       if (BIO_printf(bp, "Basis Type: %s\n", 
+                               OBJ_nid2sn(basis_type)) <= 0)
+                               goto err;
+
+                       /* print the polynomial */
                        if ((p != NULL) && !print(bp, "Polynomial:", p, buffer,
                                off))
                                goto err;
@@ -565,6 +583,13 @@ static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
                if (BIO_write(bp,str,off) <= 0) return(0);
                }
 
+       if (BN_is_zero(num))
+               {
+               if (BIO_printf(bp, "%s 0\n", number) <= 0)
+                       return 0;
+               return 1;
+               }
+
        if (BN_num_bytes(num) <= BN_BYTES)
                {
                if (BIO_printf(bp,"%s %s%lu (%s0x%lx)\n",number,neg,