Rebuild ASN1 error codes to remove unused function and reason codes.
[openssl.git] / crypto / asn1 / t_x509.c
index beba47c6651f46b90c1646ce06724691e7649f53..f142f65900670998679aaf22e4912be491a1c7ff 100644 (file)
 #include "cryptlib.h"
 #include <openssl/buffer.h>
 #include <openssl/bn.h>
-#ifndef NO_RSA
+#ifndef OPENSSL_NO_RSA
 #include <openssl/rsa.h>
 #endif
-#ifndef NO_DSA
+#ifndef OPENSSL_NO_DSA
 #include <openssl/dsa.h>
 #endif
 #include <openssl/objects.h>
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
 
-#ifndef NO_FP_API
+#ifndef OPENSSL_NO_FP_API
 int X509_print_fp(FILE *fp, X509 *x)
        {
        return X509_print_ex_fp(fp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
@@ -101,14 +101,13 @@ int X509_print(BIO *bp, X509 *x)
 int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
        {
        long l;
-       int ret=0,i,j,n;
+       int ret=0,i;
        char *m=NULL,mlch = ' ';
        int nmindent = 0;
        X509_CINF *ci;
        ASN1_INTEGER *bs;
        EVP_PKEY *pkey=NULL;
        const char *neg;
-       X509_EXTENSION *ex;
        ASN1_STRING *str=NULL;
 
        if((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
@@ -206,7 +205,7 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
                        ERR_print_errors(bp);
                        }
                else
-#ifndef NO_RSA
+#ifndef OPENSSL_NO_RSA
                if (pkey->type == EVP_PKEY_RSA)
                        {
                        BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","",
@@ -215,7 +214,7 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
                        }
                else
 #endif
-#ifndef NO_DSA
+#ifndef OPENSSL_NO_DSA
                if (pkey->type == EVP_PKEY_DSA)
                        {
                        BIO_printf(bp,"%12sDSA Public Key:\n","");
@@ -228,31 +227,9 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
                EVP_PKEY_free(pkey);
                }
 
-       if (cflag & X509_FLAG_NO_EXTENSIONS)
-               n = 0;
-       else
-               n=X509_get_ext_count(x);
-       if (n > 0)
-               {
-               BIO_printf(bp,"%8sX509v3 extensions:\n","");
-               for (i=0; i<n; i++)
-                       {
-                       ASN1_OBJECT *obj;
-                       ex=X509_get_ext(x,i);
-                       if (BIO_printf(bp,"%12s","") <= 0) goto err;
-                       obj=X509_EXTENSION_get_object(ex);
-                       i2a_ASN1_OBJECT(bp,obj);
-                       j=X509_EXTENSION_get_critical(ex);
-                       if (BIO_printf(bp,": %s\n",j?"critical":"","") <= 0)
-                               goto err;
-                       if(!X509V3_EXT_print(bp, ex, cflag, 16))
-                               {
-                               BIO_printf(bp, "%16s", "");
-                               M_ASN1_OCTET_STRING_print(bp,ex->value);
-                               }
-                       if (BIO_write(bp,"\n",1) <= 0) goto err;
-                       }
-               }
+       if (!(cflag & X509_FLAG_NO_EXTENSIONS))
+               X509V3_extensions_print(bp, "X509v3 extensions",
+                                       ci->extensions, cflag, 8);
 
        if(!(cflag & X509_FLAG_NO_SIGDUMP))
                {