diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/t_x509.c')
-rw-r--r-- | src/lib/libcrypto/asn1/t_x509.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c index 30f68561b7..26d3361722 100644 --- a/src/lib/libcrypto/asn1/t_x509.c +++ b/src/lib/libcrypto/asn1/t_x509.c | |||
@@ -66,6 +66,9 @@ | |||
66 | #ifndef OPENSSL_NO_DSA | 66 | #ifndef OPENSSL_NO_DSA |
67 | #include <openssl/dsa.h> | 67 | #include <openssl/dsa.h> |
68 | #endif | 68 | #endif |
69 | #ifndef OPENSSL_NO_EC | ||
70 | #include <openssl/ec.h> | ||
71 | #endif | ||
69 | #include <openssl/objects.h> | 72 | #include <openssl/objects.h> |
70 | #include <openssl/x509.h> | 73 | #include <openssl/x509.h> |
71 | #include <openssl/x509v3.h> | 74 | #include <openssl/x509v3.h> |
@@ -83,7 +86,7 @@ int X509_print_ex_fp(FILE *fp, X509 *x, unsigned long nmflag, unsigned long cfla | |||
83 | 86 | ||
84 | if ((b=BIO_new(BIO_s_file())) == NULL) | 87 | if ((b=BIO_new(BIO_s_file())) == NULL) |
85 | { | 88 | { |
86 | X509err(X509_F_X509_PRINT_FP,ERR_R_BUF_LIB); | 89 | X509err(X509_F_X509_PRINT_EX_FP,ERR_R_BUF_LIB); |
87 | return(0); | 90 | return(0); |
88 | } | 91 | } |
89 | BIO_set_fp(b,fp,BIO_NOCLOSE); | 92 | BIO_set_fp(b,fp,BIO_NOCLOSE); |
@@ -229,6 +232,14 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
229 | } | 232 | } |
230 | else | 233 | else |
231 | #endif | 234 | #endif |
235 | #ifndef OPENSSL_NO_EC | ||
236 | if (pkey->type == EVP_PKEY_EC) | ||
237 | { | ||
238 | BIO_printf(bp, "%12sEC Public Key:\n",""); | ||
239 | EC_KEY_print(bp, pkey->pkey.ec, 16); | ||
240 | } | ||
241 | else | ||
242 | #endif | ||
232 | BIO_printf(bp,"%12sUnknown Public Key:\n",""); | 243 | BIO_printf(bp,"%12sUnknown Public Key:\n",""); |
233 | 244 | ||
234 | EVP_PKEY_free(pkey); | 245 | EVP_PKEY_free(pkey); |
@@ -434,19 +445,18 @@ err: | |||
434 | int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) | 445 | int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) |
435 | { | 446 | { |
436 | char *s,*c,*b; | 447 | char *s,*c,*b; |
437 | int ret=0,l,ll,i,first=1; | 448 | int ret=0,l,i; |
438 | 449 | ||
439 | ll=80-2-obase; | 450 | l=80-2-obase; |
440 | 451 | ||
441 | b=s=X509_NAME_oneline(name,NULL,0); | 452 | b=X509_NAME_oneline(name,NULL,0); |
442 | if (!*s) | 453 | if (!*b) |
443 | { | 454 | { |
444 | OPENSSL_free(b); | 455 | OPENSSL_free(b); |
445 | return 1; | 456 | return 1; |
446 | } | 457 | } |
447 | s++; /* skip the first slash */ | 458 | s=b+1; /* skip the first slash */ |
448 | 459 | ||
449 | l=ll; | ||
450 | c=s; | 460 | c=s; |
451 | for (;;) | 461 | for (;;) |
452 | { | 462 | { |
@@ -468,20 +478,9 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) | |||
468 | (*s == '\0')) | 478 | (*s == '\0')) |
469 | #endif | 479 | #endif |
470 | { | 480 | { |
471 | if ((l <= 0) && !first) | ||
472 | { | ||
473 | first=0; | ||
474 | if (BIO_write(bp,"\n",1) != 1) goto err; | ||
475 | for (i=0; i<obase; i++) | ||
476 | { | ||
477 | if (BIO_write(bp," ",1) != 1) goto err; | ||
478 | } | ||
479 | l=ll; | ||
480 | } | ||
481 | i=s-c; | 481 | i=s-c; |
482 | if (BIO_write(bp,c,i) != i) goto err; | 482 | if (BIO_write(bp,c,i) != i) goto err; |
483 | c+=i; | 483 | c=s+1; /* skip following slash */ |
484 | c++; | ||
485 | if (*s != '\0') | 484 | if (*s != '\0') |
486 | { | 485 | { |
487 | if (BIO_write(bp,", ",2) != 2) goto err; | 486 | if (BIO_write(bp,", ",2) != 2) goto err; |