Update test suite so that 'make test' succeeds in 'no-rsa' configuration.
[openssl.git] / crypto / asn1 / t_req.c
index 81dd6355a887368e496fb4b4b2a2e562dcebe801..ea1af092db3fb09c44c44bf6d4e7f54de0a3aa92 100644 (file)
@@ -119,7 +119,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x)
 
        pkey=X509_REQ_get_pubkey(x);
 #ifndef NO_RSA
-       if (pkey->type == EVP_PKEY_RSA)
+       if (pkey != NULL && pkey->type == EVP_PKEY_RSA)
                {
                BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","",
                        BN_num_bits(pkey->pkey.rsa->n));
@@ -128,7 +128,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x)
        else 
 #endif
 #ifndef NO_DSA
-               if (pkey->type == EVP_PKEY_DSA)
+               if (pkey != NULL && pkey->type == EVP_PKEY_DSA)
                {
                BIO_printf(bp,"%12sDSA Public Key:\n","");
                DSA_print(bp,pkey->pkey.dsa,16);
@@ -137,7 +137,8 @@ int X509_REQ_print(BIO *bp, X509_REQ *x)
 #endif
                BIO_printf(bp,"%12sUnknown Public Key:\n","");
 
-       EVP_PKEY_free(pkey);
+       if (pkey != NULL)
+           EVP_PKEY_free(pkey);
 
        /* may not be */
        sprintf(str,"%8sAttributes:\n","");