summaryrefslogtreecommitdiff
path: root/src/usr.bin
diff options
context:
space:
mode:
authorinoguchi <>2022-03-24 13:47:55 +0000
committerinoguchi <>2022-03-24 13:47:55 +0000
commitc9b79a5bc7c53d8e5942c7ef4ae52606299d3410 (patch)
tree239d2f7c3f87078b947b8915e7ec548d5c16555a /src/usr.bin
parentfc7571a8dd4185d61f94a126fa60b851c3a65ba4 (diff)
downloadopenbsd-c9b79a5bc7c53d8e5942c7ef4ae52606299d3410.tar.gz
openbsd-c9b79a5bc7c53d8e5942c7ef4ae52606299d3410.tar.bz2
openbsd-c9b79a5bc7c53d8e5942c7ef4ae52606299d3410.zip
Compare pointer value with NULL
Diffstat (limited to 'src/usr.bin')
-rw-r--r--src/usr.bin/openssl/ts.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/src/usr.bin/openssl/ts.c b/src/usr.bin/openssl/ts.c
index 1af2645fd1..dfd5c3a464 100644
--- a/src/usr.bin/openssl/ts.c
+++ b/src/usr.bin/openssl/ts.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts.c,v 1.20 2022/03/24 12:00:17 inoguchi Exp $ */ 1/* $OpenBSD: ts.c,v 1.21 2022/03/24 13:47:55 inoguchi Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -391,7 +391,7 @@ ts_main(int argc, char **argv)
391 goto usage; 391 goto usage;
392 392
393 /* Get the password if required. */ 393 /* Get the password if required. */
394 if (ts_config.mode == CMD_REPLY && ts_config.passin && 394 if (ts_config.mode == CMD_REPLY && ts_config.passin != NULL &&
395 !app_passwd(bio_err, ts_config.passin, NULL, &password, NULL)) { 395 !app_passwd(bio_err, ts_config.passin, NULL, &password, NULL)) {
396 BIO_printf(bio_err, "Error getting password.\n"); 396 BIO_printf(bio_err, "Error getting password.\n");
397 goto cleanup; 397 goto cleanup;
@@ -439,12 +439,12 @@ ts_main(int argc, char **argv)
439 ts_config.token_out, ts_config.text); 439 ts_config.token_out, ts_config.text);
440 break; 440 break;
441 case CMD_VERIFY: 441 case CMD_VERIFY:
442 ret = !(((ts_config.queryfile && !ts_config.data && 442 ret = !(((ts_config.queryfile != NULL && ts_config.data == NULL &&
443 !ts_config.digest) || 443 ts_config.digest == NULL) ||
444 (!ts_config.queryfile && ts_config.data && 444 (ts_config.queryfile == NULL && ts_config.data != NULL &&
445 !ts_config.digest) || 445 ts_config.digest == NULL) ||
446 (!ts_config.queryfile && !ts_config.data && 446 (ts_config.queryfile == NULL && ts_config.data == NULL &&
447 ts_config.digest)) && 447 ts_config.digest != NULL)) &&
448 ts_config.in != NULL); 448 ts_config.in != NULL);
449 if (ret) 449 if (ret)
450 goto usage; 450 goto usage;
@@ -477,7 +477,7 @@ txt2obj(const char *oid)
477{ 477{
478 ASN1_OBJECT *oid_obj = NULL; 478 ASN1_OBJECT *oid_obj = NULL;
479 479
480 if (!(oid_obj = OBJ_txt2obj(oid, 0))) 480 if ((oid_obj = OBJ_txt2obj(oid, 0)) == NULL)
481 BIO_printf(bio_err, "cannot convert %s to OID\n", oid); 481 BIO_printf(bio_err, "cannot convert %s to OID\n", oid);
482 482
483 return oid_obj; 483 return oid_obj;
@@ -489,11 +489,11 @@ load_config_file(const char *configfile)
489 CONF *conf = NULL; 489 CONF *conf = NULL;
490 long errorline = -1; 490 long errorline = -1;
491 491
492 if (!configfile) 492 if (configfile == NULL)
493 configfile = getenv("OPENSSL_CONF"); 493 configfile = getenv("OPENSSL_CONF");
494 494
495 if (configfile && 495 if (configfile != NULL &&
496 (!(conf = NCONF_new(NULL)) || 496 ((conf = NCONF_new(NULL)) == NULL ||
497 NCONF_load(conf, configfile, &errorline) <= 0)) { 497 NCONF_load(conf, configfile, &errorline) <= 0)) {
498 if (errorline <= 0) 498 if (errorline <= 0)
499 BIO_printf(bio_err, "error loading the config file " 499 BIO_printf(bio_err, "error loading the config file "
@@ -510,7 +510,7 @@ load_config_file(const char *configfile)
510 p = NCONF_get_string(conf, NULL, ENV_OID_FILE); 510 p = NCONF_get_string(conf, NULL, ENV_OID_FILE);
511 if (p != NULL) { 511 if (p != NULL) {
512 BIO *oid_bio = BIO_new_file(p, "r"); 512 BIO *oid_bio = BIO_new_file(p, "r");
513 if (!oid_bio) 513 if (oid_bio == NULL)
514 ERR_print_errors(bio_err); 514 ERR_print_errors(bio_err);
515 else { 515 else {
516 OBJ_create_objects(oid_bio); 516 OBJ_create_objects(oid_bio);
@@ -546,8 +546,8 @@ query_command(const char *data, char *digest, const EVP_MD *md,
546 query = d2i_TS_REQ_bio(in_bio, NULL); 546 query = d2i_TS_REQ_bio(in_bio, NULL);
547 } else { 547 } else {
548 /* Open the file if no explicit digest bytes were specified. */ 548 /* Open the file if no explicit digest bytes were specified. */
549 if (!digest && 549 if (digest == NULL &&
550 !(data_bio = BIO_open_with_default(data, "rb", stdin))) 550 (data_bio = BIO_open_with_default(data, "rb", stdin)) == NULL)
551 goto end; 551 goto end;
552 /* Creating the query object. */ 552 /* Creating the query object. */
553 query = create_query(data_bio, digest, md, 553 query = create_query(data_bio, digest, md,
@@ -605,11 +605,11 @@ create_query(BIO *data_bio, char *digest, const EVP_MD *md, const char *policy,
605 ASN1_INTEGER *nonce_asn1 = NULL; 605 ASN1_INTEGER *nonce_asn1 = NULL;
606 606
607 /* Setting default message digest. */ 607 /* Setting default message digest. */
608 if (!md && !(md = EVP_get_digestbyname("sha1"))) 608 if (md == NULL && (md = EVP_get_digestbyname("sha1")) == NULL)
609 goto err; 609 goto err;
610 610
611 /* Creating request object. */ 611 /* Creating request object. */
612 if (!(ts_req = TS_REQ_new())) 612 if ((ts_req = TS_REQ_new()) == NULL)
613 goto err; 613 goto err;
614 614
615 /* Setting version. */ 615 /* Setting version. */
@@ -617,15 +617,15 @@ create_query(BIO *data_bio, char *digest, const EVP_MD *md, const char *policy,
617 goto err; 617 goto err;
618 618
619 /* Creating and adding MSG_IMPRINT object. */ 619 /* Creating and adding MSG_IMPRINT object. */
620 if (!(msg_imprint = TS_MSG_IMPRINT_new())) 620 if ((msg_imprint = TS_MSG_IMPRINT_new()) == NULL)
621 goto err; 621 goto err;
622 622
623 /* Adding algorithm. */ 623 /* Adding algorithm. */
624 if (!(algo = X509_ALGOR_new())) 624 if ((algo = X509_ALGOR_new()) == NULL)
625 goto err; 625 goto err;
626 if (!(algo->algorithm = OBJ_nid2obj(EVP_MD_type(md)))) 626 if ((algo->algorithm = OBJ_nid2obj(EVP_MD_type(md))) == NULL)
627 goto err; 627 goto err;
628 if (!(algo->parameter = ASN1_TYPE_new())) 628 if ((algo->parameter = ASN1_TYPE_new()) == NULL)
629 goto err; 629 goto err;
630 algo->parameter->type = V_ASN1_NULL; 630 algo->parameter->type = V_ASN1_NULL;
631 if (!TS_MSG_IMPRINT_set_algo(msg_imprint, algo)) 631 if (!TS_MSG_IMPRINT_set_algo(msg_imprint, algo))
@@ -641,15 +641,15 @@ create_query(BIO *data_bio, char *digest, const EVP_MD *md, const char *policy,
641 goto err; 641 goto err;
642 642
643 /* Setting policy if requested. */ 643 /* Setting policy if requested. */
644 if (policy && !(policy_obj = txt2obj(policy))) 644 if (policy != NULL && (policy_obj = txt2obj(policy)) == NULL)
645 goto err; 645 goto err;
646 if (policy_obj && !TS_REQ_set_policy_id(ts_req, policy_obj)) 646 if (policy_obj != NULL && !TS_REQ_set_policy_id(ts_req, policy_obj))
647 goto err; 647 goto err;
648 648
649 /* Setting nonce if requested. */ 649 /* Setting nonce if requested. */
650 if (!no_nonce && !(nonce_asn1 = create_nonce(NONCE_LENGTH))) 650 if (!no_nonce && (nonce_asn1 = create_nonce(NONCE_LENGTH)) == NULL)
651 goto err; 651 goto err;
652 if (nonce_asn1 && !TS_REQ_set_nonce(ts_req, nonce_asn1)) 652 if (nonce_asn1 != NULL && !TS_REQ_set_nonce(ts_req, nonce_asn1))
653 goto err; 653 goto err;
654 654
655 /* Setting certificate request flag if requested. */ 655 /* Setting certificate request flag if requested. */
@@ -682,7 +682,7 @@ create_digest(BIO *input, char *digest, const EVP_MD *md,
682 md_value_len = EVP_MD_size(md); 682 md_value_len = EVP_MD_size(md);
683 if (md_value_len < 0) 683 if (md_value_len < 0)
684 goto err; 684 goto err;
685 if (input) { 685 if (input != NULL) {
686 /* Digest must be computed from an input file. */ 686 /* Digest must be computed from an input file. */
687 EVP_MD_CTX *md_ctx; 687 EVP_MD_CTX *md_ctx;
688 unsigned char buffer[4096]; 688 unsigned char buffer[4096];
@@ -706,7 +706,7 @@ create_digest(BIO *input, char *digest, const EVP_MD *md,
706 /* Digest bytes are specified with digest. */ 706 /* Digest bytes are specified with digest. */
707 long digest_len; 707 long digest_len;
708 *md_value = string_to_hex(digest, &digest_len); 708 *md_value = string_to_hex(digest, &digest_len);
709 if (!*md_value || md_value_len != digest_len) { 709 if (*md_value == NULL || md_value_len != digest_len) {
710 free(*md_value); 710 free(*md_value);
711 *md_value = NULL; 711 *md_value = NULL;
712 BIO_printf(bio_err, "bad digest, %d bytes " 712 BIO_printf(bio_err, "bad digest, %d bytes "
@@ -736,12 +736,12 @@ create_nonce(int bits)
736 /* Find the first non-zero byte and creating ASN1_INTEGER object. */ 736 /* Find the first non-zero byte and creating ASN1_INTEGER object. */
737 for (i = 0; i < len && !buf[i]; ++i) 737 for (i = 0; i < len && !buf[i]; ++i)
738 ; 738 ;
739 if (!(nonce = ASN1_INTEGER_new())) 739 if ((nonce = ASN1_INTEGER_new()) == NULL)
740 goto err; 740 goto err;
741 free(nonce->data); 741 free(nonce->data);
742 /* Allocate at least one byte. */ 742 /* Allocate at least one byte. */
743 nonce->length = len - i; 743 nonce->length = len - i;
744 if (!(nonce->data = malloc(nonce->length + 1))) 744 if ((nonce->data = malloc(nonce->length + 1)) == NULL)
745 goto err; 745 goto err;
746 memcpy(nonce->data, buf + i, nonce->length); 746 memcpy(nonce->data, buf + i, nonce->length);
747 747
@@ -785,10 +785,9 @@ reply_command(CONF *conf, char *section, char *queryfile, char *passin,
785 response = d2i_TS_RESP_bio(in_bio, NULL); 785 response = d2i_TS_RESP_bio(in_bio, NULL);
786 } 786 }
787 } else { 787 } else {
788 response = create_response(conf, section, queryfile, 788 response = create_response(conf, section, queryfile, passin,
789 passin, inkey, signer, chain, 789 inkey, signer, chain, policy);
790 policy); 790 if (response != NULL)
791 if (response)
792 BIO_printf(bio_err, "Response has been generated.\n"); 791 BIO_printf(bio_err, "Response has been generated.\n");
793 else 792 else
794 BIO_printf(bio_err, "Response is not generated.\n"); 793 BIO_printf(bio_err, "Response is not generated.\n");
@@ -848,17 +847,17 @@ read_PKCS7(BIO *in_bio)
848 TS_STATUS_INFO *si = NULL; 847 TS_STATUS_INFO *si = NULL;
849 848
850 /* Read PKCS7 object and extract the signed time stamp info. */ 849 /* Read PKCS7 object and extract the signed time stamp info. */
851 if (!(token = d2i_PKCS7_bio(in_bio, NULL))) 850 if ((token = d2i_PKCS7_bio(in_bio, NULL)) == NULL)
852 goto end; 851 goto end;
853 if (!(tst_info = PKCS7_to_TS_TST_INFO(token))) 852 if ((tst_info = PKCS7_to_TS_TST_INFO(token)) == NULL)
854 goto end; 853 goto end;
855 854
856 /* Creating response object. */ 855 /* Creating response object. */
857 if (!(resp = TS_RESP_new())) 856 if ((resp = TS_RESP_new()) == NULL)
858 goto end; 857 goto end;
859 858
860 /* Create granted status info. */ 859 /* Create granted status info. */
861 if (!(si = TS_STATUS_INFO_new())) 860 if ((si = TS_STATUS_INFO_new()) == NULL)
862 goto end; 861 goto end;
863 if (!(ASN1_INTEGER_set(si->status, TS_STATUS_GRANTED))) 862 if (!(ASN1_INTEGER_set(si->status, TS_STATUS_GRANTED)))
864 goto end; 863 goto end;
@@ -891,15 +890,15 @@ create_response(CONF *conf, const char *section, char *queryfile, char *passin,
891 BIO *query_bio = NULL; 890 BIO *query_bio = NULL;
892 TS_RESP_CTX *resp_ctx = NULL; 891 TS_RESP_CTX *resp_ctx = NULL;
893 892
894 if (!(query_bio = BIO_new_file(queryfile, "rb"))) 893 if ((query_bio = BIO_new_file(queryfile, "rb")) == NULL)
895 goto end; 894 goto end;
896 895
897 /* Getting TSA configuration section. */ 896 /* Getting TSA configuration section. */
898 if (!(section = TS_CONF_get_tsa_section(conf, section))) 897 if ((section = TS_CONF_get_tsa_section(conf, section)) == NULL)
899 goto end; 898 goto end;
900 899
901 /* Setting up response generation context. */ 900 /* Setting up response generation context. */
902 if (!(resp_ctx = TS_RESP_CTX_new())) 901 if ((resp_ctx = TS_RESP_CTX_new()) == NULL)
903 goto end; 902 goto end;
904 903
905 /* Setting serial number provider callback. */ 904 /* Setting serial number provider callback. */
@@ -951,7 +950,7 @@ create_response(CONF *conf, const char *section, char *queryfile, char *passin,
951 goto end; 950 goto end;
952 951
953 /* Creating the response. */ 952 /* Creating the response. */
954 if (!(response = TS_RESP_create_response(resp_ctx, query_bio))) 953 if ((response = TS_RESP_create_response(resp_ctx, query_bio)) == NULL)
955 goto end; 954 goto end;
956 955
957 ret = 1; 956 ret = 1;
@@ -972,7 +971,7 @@ serial_cb(TS_RESP_CTX *ctx, void *data)
972 const char *serial_file = (const char *) data; 971 const char *serial_file = (const char *) data;
973 ASN1_INTEGER *serial = next_serial(serial_file); 972 ASN1_INTEGER *serial = next_serial(serial_file);
974 973
975 if (!serial) { 974 if (serial == NULL) {
976 TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION, 975 TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
977 "Error during serial number " 976 "Error during serial number "
978 "generation."); 977 "generation.");
@@ -992,10 +991,10 @@ next_serial(const char *serialfile)
992 ASN1_INTEGER *serial = NULL; 991 ASN1_INTEGER *serial = NULL;
993 BIGNUM *bn = NULL; 992 BIGNUM *bn = NULL;
994 993
995 if (!(serial = ASN1_INTEGER_new())) 994 if ((serial = ASN1_INTEGER_new()) == NULL)
996 goto err; 995 goto err;
997 996
998 if (!(in = BIO_new_file(serialfile, "r"))) { 997 if ((in = BIO_new_file(serialfile, "r")) == NULL) {
999 ERR_clear_error(); 998 ERR_clear_error();
1000 BIO_printf(bio_err, "Warning: could not open file %s for " 999 BIO_printf(bio_err, "Warning: could not open file %s for "
1001 "reading, using serial number: 1\n", serialfile); 1000 "reading, using serial number: 1\n", serialfile);
@@ -1008,13 +1007,13 @@ next_serial(const char *serialfile)
1008 serialfile); 1007 serialfile);
1009 goto err; 1008 goto err;
1010 } 1009 }
1011 if (!(bn = ASN1_INTEGER_to_BN(serial, NULL))) 1010 if ((bn = ASN1_INTEGER_to_BN(serial, NULL)) == NULL)
1012 goto err; 1011 goto err;
1013 ASN1_INTEGER_free(serial); 1012 ASN1_INTEGER_free(serial);
1014 serial = NULL; 1013 serial = NULL;
1015 if (!BN_add_word(bn, 1)) 1014 if (!BN_add_word(bn, 1))
1016 goto err; 1015 goto err;
1017 if (!(serial = BN_to_ASN1_INTEGER(bn, NULL))) 1016 if ((serial = BN_to_ASN1_INTEGER(bn, NULL)) == NULL)
1018 goto err; 1017 goto err;
1019 } 1018 }
1020 ret = 1; 1019 ret = 1;
@@ -1034,7 +1033,7 @@ save_ts_serial(const char *serialfile, ASN1_INTEGER *serial)
1034 int ret = 0; 1033 int ret = 0;
1035 BIO *out = NULL; 1034 BIO *out = NULL;
1036 1035
1037 if (!(out = BIO_new_file(serialfile, "w"))) 1036 if ((out = BIO_new_file(serialfile, "w")) == NULL)
1038 goto err; 1037 goto err;
1039 if (i2a_ASN1_INTEGER(out, serial) <= 0) 1038 if (i2a_ASN1_INTEGER(out, serial) <= 0)
1040 goto err; 1039 goto err;
@@ -1064,18 +1063,18 @@ verify_command(char *data, char *digest, char *queryfile, char *in,
1064 int ret = 0; 1063 int ret = 0;
1065 1064
1066 /* Decode the token (PKCS7) or response (TS_RESP) files. */ 1065 /* Decode the token (PKCS7) or response (TS_RESP) files. */
1067 if (!(in_bio = BIO_new_file(in, "rb"))) 1066 if ((in_bio = BIO_new_file(in, "rb")) == NULL)
1068 goto end; 1067 goto end;
1069 if (token_in) { 1068 if (token_in) {
1070 if (!(token = d2i_PKCS7_bio(in_bio, NULL))) 1069 if ((token = d2i_PKCS7_bio(in_bio, NULL)) == NULL)
1071 goto end; 1070 goto end;
1072 } else { 1071 } else {
1073 if (!(response = d2i_TS_RESP_bio(in_bio, NULL))) 1072 if ((response = d2i_TS_RESP_bio(in_bio, NULL)) == NULL)
1074 goto end; 1073 goto end;
1075 } 1074 }
1076 1075
1077 if (!(verify_ctx = create_verify_ctx(data, digest, queryfile, 1076 if ((verify_ctx = create_verify_ctx(data, digest, queryfile,
1078 ca_path, ca_file, untrusted))) 1077 ca_path, ca_file, untrusted)) == NULL)
1079 goto end; 1078 goto end;
1080 1079
1081 /* Checking the token or response against the request. */ 1080 /* Checking the token or response against the request. */
@@ -1111,18 +1110,18 @@ create_verify_ctx(char *data, char *digest, char *queryfile, char *ca_path,
1111 int ret = 0; 1110 int ret = 0;
1112 1111
1113 if (data != NULL || digest != NULL) { 1112 if (data != NULL || digest != NULL) {
1114 if (!(ctx = TS_VERIFY_CTX_new())) 1113 if ((ctx = TS_VERIFY_CTX_new()) == NULL)
1115 goto err; 1114 goto err;
1116 ctx->flags = TS_VFY_VERSION | TS_VFY_SIGNER; 1115 ctx->flags = TS_VFY_VERSION | TS_VFY_SIGNER;
1117 if (data != NULL) { 1116 if (data != NULL) {
1118 ctx->flags |= TS_VFY_DATA; 1117 ctx->flags |= TS_VFY_DATA;
1119 if (!(ctx->data = BIO_new_file(data, "rb"))) 1118 if ((ctx->data = BIO_new_file(data, "rb")) == NULL)
1120 goto err; 1119 goto err;
1121 } else if (digest != NULL) { 1120 } else if (digest != NULL) {
1122 long imprint_len; 1121 long imprint_len;
1123 ctx->flags |= TS_VFY_IMPRINT; 1122 ctx->flags |= TS_VFY_IMPRINT;
1124 if (!(ctx->imprint = string_to_hex(digest, 1123 if ((ctx->imprint = string_to_hex(digest,
1125 &imprint_len))) { 1124 &imprint_len)) == NULL) {
1126 BIO_printf(bio_err, "invalid digest string\n"); 1125 BIO_printf(bio_err, "invalid digest string\n");
1127 goto err; 1126 goto err;
1128 } 1127 }
@@ -1133,11 +1132,11 @@ create_verify_ctx(char *data, char *digest, char *queryfile, char *ca_path,
1133 * The request has just to be read, decoded and converted to 1132 * The request has just to be read, decoded and converted to
1134 * a verify context object. 1133 * a verify context object.
1135 */ 1134 */
1136 if (!(input = BIO_new_file(queryfile, "rb"))) 1135 if ((input = BIO_new_file(queryfile, "rb")) == NULL)
1137 goto err; 1136 goto err;
1138 if (!(request = d2i_TS_REQ_bio(input, NULL))) 1137 if ((request = d2i_TS_REQ_bio(input, NULL)) == NULL)
1139 goto err; 1138 goto err;
1140 if (!(ctx = TS_REQ_to_TS_VERIFY_CTX(request, NULL))) 1139 if ((ctx = TS_REQ_to_TS_VERIFY_CTX(request, NULL)) == NULL)
1141 goto err; 1140 goto err;
1142 } else 1141 } else
1143 return NULL; 1142 return NULL;
@@ -1146,11 +1145,12 @@ create_verify_ctx(char *data, char *digest, char *queryfile, char *ca_path,
1146 ctx->flags |= TS_VFY_SIGNATURE; 1145 ctx->flags |= TS_VFY_SIGNATURE;
1147 1146
1148 /* Initialising the X509_STORE object. */ 1147 /* Initialising the X509_STORE object. */
1149 if (!(ctx->store = create_cert_store(ca_path, ca_file))) 1148 if ((ctx->store = create_cert_store(ca_path, ca_file)) == NULL)
1150 goto err; 1149 goto err;
1151 1150
1152 /* Loading untrusted certificates. */ 1151 /* Loading untrusted certificates. */
1153 if (untrusted && !(ctx->certs = TS_CONF_load_certs(untrusted))) 1152 if (untrusted != NULL &&
1153 (ctx->certs = TS_CONF_load_certs(untrusted)) == NULL)
1154 goto err; 1154 goto err;
1155 1155
1156 ret = 1; 1156 ret = 1;
@@ -1178,7 +1178,7 @@ create_cert_store(char *ca_path, char *ca_file)
1178 X509_STORE_set_verify_cb(cert_ctx, verify_cb); 1178 X509_STORE_set_verify_cb(cert_ctx, verify_cb);
1179 1179
1180 /* Adding a trusted certificate directory source. */ 1180 /* Adding a trusted certificate directory source. */
1181 if (ca_path) { 1181 if (ca_path != NULL) {
1182 lookup = X509_STORE_add_lookup(cert_ctx, 1182 lookup = X509_STORE_add_lookup(cert_ctx,
1183 X509_LOOKUP_hash_dir()); 1183 X509_LOOKUP_hash_dir());
1184 if (lookup == NULL) { 1184 if (lookup == NULL) {
@@ -1193,7 +1193,7 @@ create_cert_store(char *ca_path, char *ca_file)
1193 } 1193 }
1194 } 1194 }
1195 /* Adding a trusted certificate file source. */ 1195 /* Adding a trusted certificate file source. */
1196 if (ca_file) { 1196 if (ca_file != NULL) {
1197 lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file()); 1197 lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
1198 if (lookup == NULL) { 1198 if (lookup == NULL) {
1199 BIO_printf(bio_err, "memory allocation failure\n"); 1199 BIO_printf(bio_err, "memory allocation failure\n");