Detect symmetric crypto errors in PKCS7_decrypt.
[oweals/openssl.git] / crypto / dsa / dsa_ameth.c
index 539b51f95162f7e22b26107ea82ada548a07f2d4..376156ec5ef3a6ad23539296601180f7b4fa1472 100644 (file)
@@ -209,7 +209,7 @@ static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
        if (*p == (V_ASN1_SEQUENCE|V_ASN1_CONSTRUCTED))
                {
                ASN1_TYPE *t1, *t2;
-               if(!(ndsa = d2i_ASN1_SEQUENCE_ANY(NULL, &p, pklen)));
+               if(!(ndsa = d2i_ASN1_SEQUENCE_ANY(NULL, &p, pklen)))
                        goto decerr;
                if (sk_ASN1_TYPE_num(ndsa) != 2)
                        goto decerr;
@@ -547,7 +547,15 @@ static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg,
                                        int indent, ASN1_PCTX *pctx)
        {
        DSA_SIG *dsa_sig;
-       const unsigned char *p = sig->data;
+       const unsigned char *p;
+       if (!sig)
+               {
+               if (BIO_puts(bp, "\n") <= 0)
+                       return 0;
+               else
+                       return 1;
+               }
+       p = sig->data;
        dsa_sig = d2i_DSA_SIG(NULL, &p, sig->length);
        if (dsa_sig)
                {
@@ -559,7 +567,7 @@ static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg,
                m = OPENSSL_malloc(buf_len+10);
                if (m == NULL)
                        {
-                       DSAerr(DSA_F_DO_DSA_PRINT,ERR_R_MALLOC_FAILURE);
+                       DSAerr(DSA_F_DSA_SIG_PRINT,ERR_R_MALLOC_FAILURE);
                        goto err;
                        }