X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=apps%2Fx509.c;h=add74d556d68c2a1230d84337d7ded9e2c6e38e0;hb=477e40b48c5a2d5f9ba597cea2f2e2eb77e9347a;hp=7c215bced00106b45ecdea077fab221a8952ceb8;hpb=e254d12c439c3e50dfccc98e3414c3e1849792f5;p=oweals%2Fopenssl.git diff --git a/apps/x509.c b/apps/x509.c index 7c215bced0..add74d556d 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -218,9 +218,7 @@ int MAIN(int argc, char **argv) char *checkhost = NULL; char *checkemail = NULL; char *checkip = NULL; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif reqfile = 0; @@ -501,9 +499,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "%s", *pp); goto end; } -#ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -#endif if (need_rand) app_RAND_load_file(NULL, bio_err, 0); @@ -821,10 +817,10 @@ int MAIN(int argc, char **argv) char *m; int y, z; - X509_NAME_oneline(X509_get_subject_name(x), buf, sizeof buf); + X509_NAME_oneline(X509_get_subject_name(x), buf, sizeof(buf)); BIO_printf(STDout, "/* subject:%s */\n", buf); m = X509_NAME_oneline(X509_get_issuer_name(x), buf, - sizeof buf); + sizeof(buf)); BIO_printf(STDout, "/* issuer :%s */\n", buf); z = i2d_X509(x, NULL); @@ -1040,6 +1036,7 @@ int MAIN(int argc, char **argv) ASN1_INTEGER_free(sno); sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free); sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free); + release_engine(e); if (passin) OPENSSL_free(passin); apps_shutdown(); @@ -1105,6 +1102,10 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest, EVP_PKEY *upkey; upkey = X509_get_pubkey(xca); + if (upkey == NULL) { + BIO_printf(bio_err, "Error obtaining CA X509 public key\n"); + goto end; + } EVP_PKEY_copy_parameters(upkey, pkey); EVP_PKEY_free(upkey); @@ -1217,6 +1218,8 @@ static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, EVP_PKEY *pktmp; pktmp = X509_get_pubkey(x); + if (pktmp == NULL) + goto err; EVP_PKEY_copy_parameters(pktmp, pkey); EVP_PKEY_save_parameters(pktmp, 1); EVP_PKEY_free(pktmp);