Cleanup OPENSSL_NO_xxx, part 1
[openssl.git] / crypto / asn1 / t_req.c
index 0d169c9acc0f9ce8e820b18232ffa70980e44db2..741158d8caf390e81e597f268edb457cb87574db 100644 (file)
@@ -70,7 +70,7 @@
 #include <openssl/dsa.h>
 #endif
 
-#ifndef OPENSSL_NO_FP_API
+#ifndef OPENSSL_NO_STDIO
 int X509_REQ_print_fp(FILE *fp, X509_REQ *x)
         {
         BIO *b;
@@ -90,9 +90,8 @@ int X509_REQ_print_fp(FILE *fp, X509_REQ *x)
 
 int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long cflag)
        {
-       unsigned long l;
+       long l;
        int i;
-       const char *neg;
        X509_REQ_INFO *ri;
        EVP_PKEY *pkey;
        STACK_OF(X509_ATTRIBUTE) *sk;
@@ -117,12 +116,8 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long
                }
        if(!(cflag & X509_FLAG_NO_VERSION))
                {
-               neg=(ri->version->type == V_ASN1_NEG_INTEGER)?"-":"";
-               l=0;
-               for (i=0; i<ri->version->length; i++)
-                       { l<<=8; l+=ri->version->data[i]; }
-               if(BIO_printf(bp,"%8sVersion: %s%lu (%s0x%lx)\n","",neg,l,neg,
-                             l) <= 0)
+               l = X509_REQ_get_version(x);
+               if(BIO_printf(bp,"%8sVersion: %ld (0x%lx)\n","",l+1, l) <= 0)
                    goto err;
                }
         if(!(cflag & X509_FLAG_NO_SUBJECT))
@@ -220,7 +215,7 @@ get_next:
                                }
                        }
                }
-       if(!(cflag & X509_FLAG_NO_ATTRIBUTES))
+       if(!(cflag & X509_FLAG_NO_EXTENSIONS))
                {
                exts = X509_REQ_get_extensions(x);
                if(exts)
@@ -238,7 +233,7 @@ get_next:
                                j=X509_EXTENSION_get_critical(ex);
                                if (BIO_printf(bp,": %s\n",j?"critical":"") <= 0)
                                        goto err;
-                               if(!X509V3_EXT_print(bp, ex, 0, 16))
+                               if(!X509V3_EXT_print(bp, ex, cflag, 16))
                                        {
                                        BIO_printf(bp, "%16s", "");
                                        M_ASN1_OCTET_STRING_print(bp,ex->value);