diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2004-05-12 18:20:37 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2004-05-12 18:20:37 +0000 |
commit | df368ecce4e2d2ab8aedb4fa5eadb08992b52b4f (patch) | |
tree | 2f1482b14e4f1555dbfa9d1ea1671b8038c2ba4f /apps | |
parent | 1e6bccc24052f233d70787191f98355c282bff73 (diff) | |
download | openssl-df368ecce4e2d2ab8aedb4fa5eadb08992b52b4f.tar.gz |
Make self signing option of 'x509' use random serial numbers too.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/x509.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/x509.c b/apps/x509.c index 6e652177d8..d00511c78a 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -601,12 +601,16 @@ bad: if ((x=X509_new()) == NULL) goto end; ci=x->cert_info; - if (sno) + if (sno == NULL) { - if (!X509_set_serialNumber(x, sno)) + sno = ASN1_INTEGER_new(); + if (!sno || !rand_serial(NULL, sno)) goto end; } - else if (!ASN1_INTEGER_set(X509_get_serialNumber(x),0)) goto end; + + if (!X509_set_serialNumber(x, sno)) + goto end; + if (!X509_set_issuer_name(x,req->req_info->subject)) goto end; if (!X509_set_subject_name(x,req->req_info->subject)) goto end; |