Add support for shared libraries with OS/2.
[oweals/openssl.git] / crypto / asn1 / t_x509.c
index ff4a991b66df6cb4ea511fa5dab7c3ea0f82e8df..ae6d5ce041863ba3cf8e0b93de1db6869d7bac9b 100644 (file)
@@ -66,6 +66,9 @@
 #ifndef OPENSSL_NO_DSA
 #include <openssl/dsa.h>
 #endif
+#ifndef OPENSSL_NO_ECDSA
+#include <openssl/ecdsa.h>
+#endif
 #include <openssl/objects.h>
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
@@ -228,6 +231,14 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
                        DSA_print(bp,pkey->pkey.dsa,16);
                        }
                else
+#endif
+#ifndef OPENSSL_NO_ECDSA
+               if (pkey->type == EVP_PKEY_ECDSA)
+                       {
+                       BIO_printf(bp, "%12sECDSA Public Key:\n","");
+                       ECDSA_print(bp, pkey->pkey.ecdsa, 16);
+                       }
+               else
 #endif
                        BIO_printf(bp,"%12sUnknown Public Key:\n","");
 
@@ -270,7 +281,7 @@ int X509_ocspid_print (BIO *bp, X509 *x)
                goto err;
        i2d_X509_NAME(x->cert_info->subject, &dertmp);
 
-       EVP_Digest(der, derlen, SHA1md, NULL, EVP_sha1());
+       EVP_Digest(der, derlen, SHA1md, NULL, EVP_sha1(), NULL);
        for (i=0; i < SHA_DIGEST_LENGTH; i++)
                {
                if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0) goto err;
@@ -284,7 +295,7 @@ int X509_ocspid_print (BIO *bp, X509 *x)
                goto err;
 
        EVP_Digest(x->cert_info->key->public_key->data,
-               x->cert_info->key->public_key->length, SHA1md, NULL, EVP_sha1());
+               x->cert_info->key->public_key->length, SHA1md, NULL, EVP_sha1(), NULL);
        for (i=0; i < SHA_DIGEST_LENGTH; i++)
                {
                if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0)
@@ -440,6 +451,8 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
        ll=80-2-obase;
 
        s=X509_NAME_oneline(name,buf,256);
+       if (!*s)
+               return 1;
        s++; /* skip the first slash */
 
        l=ll;