More pissing about to get pem.h to behave properly.
[openssl.git] / crypto / x509 / x509_r2x.c
index 7e79959c8a0bd24bd2d667f495a163c608bfe0a8..880e9f669e78de7612efe4d3f750a6bec22bc757 100644 (file)
@@ -1,5 +1,5 @@
 /* crypto/x509/x509_r2x.c */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
  * This package is an SSL implementation written
@@ -64,7 +64,6 @@
 #include "x509.h"
 #include "objects.h"
 #include "buffer.h"
-#include "pem.h"
 
 X509 *X509_REQ_to_X509(r,days,pkey)
 X509_REQ *r;
@@ -72,8 +71,6 @@ int days;
 EVP_PKEY *pkey;
        {
        X509 *ret=NULL;
-       int er=1;
-       X509_REQ_INFO *ri=NULL;
        X509_CINF *xi=NULL;
        X509_NAME *xn;
 
@@ -84,13 +81,9 @@ EVP_PKEY *pkey;
                }
 
        /* duplicate the request */
-       ri=(X509_REQ_INFO *)ASN1_dup(i2d_X509_REQ_INFO,
-               (char *(*)())d2i_X509_REQ_INFO,(char *)r->req_info);
-       if (ri == NULL) goto err;
-
        xi=ret->cert_info;
 
-       if (sk_num(ri->attributes) != 0)
+       if (sk_num(r->req_info->attributes) != 0)
                {
                if ((xi->version=ASN1_INTEGER_new()) == NULL) goto err;
                if (!ASN1_INTEGER_set(xi->version,2)) goto err;
@@ -109,13 +102,11 @@ EVP_PKEY *pkey;
 
        if (!X509_sign(ret,pkey,EVP_md5()))
                goto err;
-       er=0;
-err:
-       if (er)
+       if (0)
                {
+err:
                X509_free(ret);
-               X509_REQ_INFO_free(ri);
-               return(NULL);
+               ret=NULL;
                }
        return(ret);
        }