From 8ec3fa0597224abf3bdcb59da0f02f3100f75459 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 4 Oct 2010 13:58:41 +0000 Subject: [PATCH] fix signature printing routines --- crypto/asn1/t_x509.c | 2 ++ crypto/dsa/dsa_ameth.c | 10 +++++++++- crypto/rsa/rsa_ameth.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/crypto/asn1/t_x509.c b/crypto/asn1/t_x509.c index bd22a8dd4f..db88f3a3e1 100644 --- a/crypto/asn1/t_x509.c +++ b/crypto/asn1/t_x509.c @@ -333,6 +333,8 @@ int X509_signature_print(BIO *bp, X509_ALGOR *sigalg, ASN1_STRING *sig) } if (sig) return X509_signature_dump(bp, sig, 9); + else if (BIO_puts(bp, "\n") <= 0) + return 0; return 1; } diff --git a/crypto/dsa/dsa_ameth.c b/crypto/dsa/dsa_ameth.c index b38e1a4ee9..376156ec5e 100644 --- a/crypto/dsa/dsa_ameth.c +++ b/crypto/dsa/dsa_ameth.c @@ -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) { diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c index cefac171a5..2460910ab2 100644 --- a/crypto/rsa/rsa_ameth.c +++ b/crypto/rsa/rsa_ameth.c @@ -400,6 +400,8 @@ static int rsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, if (!rv) return 0; } + else if (!sig && BIO_puts(bp, "\n") <= 0) + return 0; if (sig) return X509_signature_dump(bp, sig, indent); return 1; -- 2.25.1