diff options
author | David von Oheimb <David.von.Oheimb@siemens.com> | 2018-05-11 14:52:51 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2019-03-18 18:20:23 +0100 |
commit | 5743d1268d455859ed94be8749c4aaac6333c01b (patch) | |
tree | eb6da612021731e9c26e28b017a2b670587ad8e6 /crypto | |
parent | update reference output of test_x509 in test/certs/cyrillic.* (diff) | |
download | openssl-5743d1268d455859ed94be8749c4aaac6333c01b.tar.xz openssl-5743d1268d455859ed94be8749c4aaac6333c01b.zip |
add 'Signature Value:' line and correct indentation when printing X.509 signature value
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6226)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/x509/t_x509.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/x509/t_x509.c b/crypto/x509/t_x509.c index fb367baa1e..3367228829 100644 --- a/crypto/x509/t_x509.c +++ b/crypto/x509/t_x509.c @@ -302,11 +302,14 @@ int X509_signature_print(BIO *bp, const X509_ALGOR *sigalg, const ASN1_STRING *sig) { int sig_nid; - if (BIO_puts(bp, " Signature Algorithm: ") <= 0) + int indent = 4; + if (BIO_printf(bp, "%*sSignature Algorithm: ", indent, "") <= 0) return 0; if (i2a_ASN1_OBJECT(bp, sigalg->algorithm) <= 0) return 0; + if (sig && BIO_printf(bp, "\n%*sSignature Value:", indent, "") <= 0) + return 0; sig_nid = OBJ_obj2nid(sigalg->algorithm); if (sig_nid != NID_undef) { int pkey_nid, dig_nid; @@ -314,13 +317,13 @@ int X509_signature_print(BIO *bp, const X509_ALGOR *sigalg, if (OBJ_find_sigid_algs(sig_nid, &dig_nid, &pkey_nid)) { ameth = EVP_PKEY_asn1_find(NULL, pkey_nid); if (ameth && ameth->sig_print) - return ameth->sig_print(bp, sigalg, sig, 9, 0); + return ameth->sig_print(bp, sigalg, sig, indent + 4, 0); } } if (BIO_write(bp, "\n", 1) != 1) return 0; if (sig) - return X509_signature_dump(bp, sig, 9); + return X509_signature_dump(bp, sig, indent + 4); return 1; } |