summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2014-08-26 22:31:11 -0400
committerRich Salz <rsalz@akamai.com>2014-08-28 19:17:05 -0400
commitb09eb246e2385ff629e365043290bbb485e99588 (patch)
tree76bad52549573bd624ecac8f36fe4af602fa3a56
parentc7497f34fbf3824dd4a0881d598e598980f2edb1 (diff)
RT3246: req command prints version number wrong
Make X509_REQ_print_ex do the same thing that X509_REQ_print does. Reviewed-by: Matt Caswell <matt@openssl.org>
-rw-r--r--crypto/asn1/t_req.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/crypto/asn1/t_req.c b/crypto/asn1/t_req.c
index ea1794e3e0..45348a7381 100644
--- a/crypto/asn1/t_req.c
+++ b/crypto/asn1/t_req.c
@@ -90,7 +90,7 @@ int X509_REQ_print_fp(FILE *fp, X509_REQ *x)
int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long cflag)
{
- unsigned long l;
+ long l;
int i;
const char *neg;
X509_REQ_INFO *ri;
@@ -117,12 +117,8 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long
}
if(!(cflag & X509_FLAG_NO_VERSION))
{
- neg=(ri->version->type == V_ASN1_NEG_INTEGER)?"-":"";
- l=0;
- for (i=0; i<ri->version->length; i++)
- { l<<=8; l+=ri->version->data[i]; }
- if(BIO_printf(bp,"%8sVersion: %s%lu (%s0x%lx)\n","",neg,l,neg,
- l) <= 0)
+ l = X509_REQ_get_version(x);
+ if(BIO_printf(bp,"%8sVersion: %ld (0x%lx)\n","",l+1, l) <= 0)
goto err;
}
if(!(cflag & X509_FLAG_NO_SUBJECT))