From: Nikos Mavrogiannopoulos Date: Sat, 4 Oct 2008 17:20:40 +0000 (+0300) Subject: reduced warnings in compilation of certtool. X-Git-Tag: gnutls_2_7_0~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfa274d580cf2364720df2f0407c9d0b1f79e504;p=thirdparty%2Fgnutls.git reduced warnings in compilation of certtool. --- diff --git a/src/certtool-cfg.c b/src/certtool-cfg.c index 5634ce7f5c..ec95ae6915 100644 --- a/src/certtool-cfg.c +++ b/src/certtool-cfg.c @@ -791,7 +791,7 @@ static int string_to_ip( unsigned char *ip, const char * str) void get_ip_addr_set (int type, void* crt) { - int ret, i; + int ret = 0, i; unsigned char ip[16]; int len; @@ -827,7 +827,7 @@ get_ip_addr_set (int type, void* crt) len = string_to_ip( ip, p); if (len <= 0) { - fprintf(stderr, "Error parsing address: %s\n", cfg.ip_addr[i]); + fprintf(stderr, "Error parsing address: %s\n", p); exit(1); } @@ -850,7 +850,7 @@ get_ip_addr_set (int type, void* crt) void get_email_set (int type, void* crt) { - int ret, i; + int ret = 0, i; if (batch) { @@ -894,7 +894,7 @@ get_email_set (int type, void* crt) void get_dns_name_set (int type, void* crt) { - int ret, i; + int ret = 0, i; if (batch) { diff --git a/src/certtool-cfg.h b/src/certtool-cfg.h index 60b4abcbb1..a3039acb9b 100644 --- a/src/certtool-cfg.h +++ b/src/certtool-cfg.h @@ -1,15 +1,6 @@ #include #include -extern char *organization, *unit, *locality, *state; -extern char *cn, *challenge_password, *password, *pkcs9_email, *country; -extern char *dns_name, *email, *crl_dist_points, *pkcs12_key_name; -extern int serial, expiration_days, ca, tls_www_client, tls_www_server, - signing_key; -extern int encryption_key, cert_sign_key, crl_sign_key, code_sign_key, - ocsp_sign_key; -extern int time_stamping_key, crl_next_update; - void cfg_init (void); int template_parse (const char *template); diff --git a/src/certtool-common.h b/src/certtool-common.h index 468e2cdca6..be2145c842 100644 --- a/src/certtool-common.h +++ b/src/certtool-common.h @@ -26,3 +26,5 @@ enum { #define TYPE_CRT 1 #define TYPE_CRQ 2 + +void certtool_version(void); diff --git a/src/certtool-gaa.c b/src/certtool-gaa.c index 5a218f8e72..ffb9d630ec 100644 --- a/src/certtool-gaa.c +++ b/src/certtool-gaa.c @@ -11,8 +11,6 @@ # include #endif -void certtool_version(void); - #include "certtool-common.h" #include @@ -192,49 +190,49 @@ typedef struct _gaainfo gaainfo; struct _gaainfo { -#line 127 "certtool.gaa" +#line 125 "certtool.gaa" int debug; -#line 123 "certtool.gaa" +#line 121 "certtool.gaa" char *template; -#line 120 "certtool.gaa" +#line 118 "certtool.gaa" char *infile; -#line 117 "certtool.gaa" +#line 115 "certtool.gaa" char *outfile; -#line 114 "certtool.gaa" +#line 112 "certtool.gaa" int quick_random; -#line 111 "certtool.gaa" +#line 109 "certtool.gaa" int bits; -#line 107 "certtool.gaa" +#line 105 "certtool.gaa" int outcert_format; -#line 103 "certtool.gaa" +#line 101 "certtool.gaa" int incert_format; -#line 100 "certtool.gaa" +#line 98 "certtool.gaa" int export; -#line 97 "certtool.gaa" +#line 95 "certtool.gaa" char *hash; -#line 94 "certtool.gaa" +#line 92 "certtool.gaa" int dsa; -#line 91 "certtool.gaa" +#line 89 "certtool.gaa" int pkcs8; -#line 84 "certtool.gaa" +#line 82 "certtool.gaa" int v1_cert; -#line 81 "certtool.gaa" +#line 79 "certtool.gaa" int fix_key; -#line 56 "certtool.gaa" +#line 54 "certtool.gaa" char *pass; -#line 53 "certtool.gaa" +#line 51 "certtool.gaa" char *ca; -#line 50 "certtool.gaa" +#line 48 "certtool.gaa" char *ca_privkey; -#line 47 "certtool.gaa" +#line 45 "certtool.gaa" char *cert; -#line 44 "certtool.gaa" +#line 42 "certtool.gaa" char *request; -#line 41 "certtool.gaa" +#line 39 "certtool.gaa" char *privkey; -#line 19 "certtool.gaa" +#line 17 "certtool.gaa" int action; -#line 18 "certtool.gaa" +#line 16 "certtool.gaa" int privkey_op; #line 114 "gaa.skel" @@ -771,14 +769,14 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) { case GAAOPTID_version: OK = 0; -#line 132 "certtool.gaa" +#line 130 "certtool.gaa" { certtool_version(); exit(0); ;}; return GAA_OK; break; case GAAOPTID_help: OK = 0; -#line 130 "certtool.gaa" +#line 128 "certtool.gaa" { gaa_help(); exit(0); ;}; return GAA_OK; @@ -788,7 +786,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_debug.arg1, gaa_getint, GAATMP_debug.size1); gaa_index++; -#line 128 "certtool.gaa" +#line 126 "certtool.gaa" { gaaval->debug = GAATMP_debug.arg1 ;}; return GAA_OK; @@ -798,7 +796,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_template.arg1, gaa_getstr, GAATMP_template.size1); gaa_index++; -#line 124 "certtool.gaa" +#line 122 "certtool.gaa" { gaaval->template = GAATMP_template.arg1 ;}; return GAA_OK; @@ -808,7 +806,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_infile.arg1, gaa_getstr, GAATMP_infile.size1); gaa_index++; -#line 121 "certtool.gaa" +#line 119 "certtool.gaa" { gaaval->infile = GAATMP_infile.arg1 ;}; return GAA_OK; @@ -818,14 +816,14 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_outfile.arg1, gaa_getstr, GAATMP_outfile.size1); gaa_index++; -#line 118 "certtool.gaa" +#line 116 "certtool.gaa" { gaaval->outfile = GAATMP_outfile.arg1 ;}; return GAA_OK; break; case GAAOPTID_disable_quick_random: OK = 0; -#line 115 "certtool.gaa" +#line 113 "certtool.gaa" { gaaval->quick_random = 0; ;}; return GAA_OK; @@ -835,42 +833,42 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_bits.arg1, gaa_getint, GAATMP_bits.size1); gaa_index++; -#line 112 "certtool.gaa" +#line 110 "certtool.gaa" { gaaval->bits = GAATMP_bits.arg1 ;}; return GAA_OK; break; case GAAOPTID_outraw: OK = 0; -#line 109 "certtool.gaa" +#line 107 "certtool.gaa" { gaaval->outcert_format=1 ;}; return GAA_OK; break; case GAAOPTID_outder: OK = 0; -#line 108 "certtool.gaa" +#line 106 "certtool.gaa" { gaaval->outcert_format=1 ;}; return GAA_OK; break; case GAAOPTID_inraw: OK = 0; -#line 105 "certtool.gaa" +#line 103 "certtool.gaa" { gaaval->incert_format=1 ;}; return GAA_OK; break; case GAAOPTID_inder: OK = 0; -#line 104 "certtool.gaa" +#line 102 "certtool.gaa" { gaaval->incert_format=1 ;}; return GAA_OK; break; case GAAOPTID_export_ciphers: OK = 0; -#line 101 "certtool.gaa" +#line 99 "certtool.gaa" { gaaval->export=1 ;}; return GAA_OK; @@ -880,119 +878,119 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_hash.arg1, gaa_getstr, GAATMP_hash.size1); gaa_index++; -#line 98 "certtool.gaa" +#line 96 "certtool.gaa" { gaaval->hash = GAATMP_hash.arg1 ;}; return GAA_OK; break; case GAAOPTID_dsa: OK = 0; -#line 95 "certtool.gaa" +#line 93 "certtool.gaa" { gaaval->dsa=1 ;}; return GAA_OK; break; case GAAOPTID_pkcs8: OK = 0; -#line 92 "certtool.gaa" +#line 90 "certtool.gaa" { gaaval->pkcs8=1 ;}; return GAA_OK; break; case GAAOPTID_to_p8: OK = 0; -#line 89 "certtool.gaa" +#line 87 "certtool.gaa" { gaaval->action = ACTION_GENERATE_PKCS8; ;}; return GAA_OK; break; case GAAOPTID_to_p12: OK = 0; -#line 87 "certtool.gaa" +#line 85 "certtool.gaa" { gaaval->action = ACTION_TO_PKCS12; ;}; return GAA_OK; break; case GAAOPTID_v1: OK = 0; -#line 85 "certtool.gaa" +#line 83 "certtool.gaa" { gaaval->v1_cert = 1; ;}; return GAA_OK; break; case GAAOPTID_fix_key: OK = 0; -#line 82 "certtool.gaa" +#line 80 "certtool.gaa" { gaaval->privkey_op=1; gaaval->fix_key = 1; ;}; return GAA_OK; break; case GAAOPTID_pgp_key_info: OK = 0; -#line 79 "certtool.gaa" +#line 77 "certtool.gaa" { gaaval->privkey_op=1; gaaval->action = ACTION_PGP_PRIVKEY_INFO; ;}; return GAA_OK; break; case GAAOPTID_key_info: OK = 0; -#line 77 "certtool.gaa" +#line 75 "certtool.gaa" { gaaval->privkey_op=1; gaaval->action = ACTION_PRIVKEY_INFO; ;}; return GAA_OK; break; case GAAOPTID_smime_to_p7: OK = 0; -#line 73 "certtool.gaa" +#line 71 "certtool.gaa" { gaaval->action = ACTION_SMIME_TO_P7; ;}; return GAA_OK; break; case GAAOPTID_p7_info: OK = 0; -#line 71 "certtool.gaa" +#line 69 "certtool.gaa" { gaaval->action = ACTION_P7_INFO; ;}; return GAA_OK; break; case GAAOPTID_p12_info: OK = 0; -#line 69 "certtool.gaa" +#line 67 "certtool.gaa" { gaaval->action = ACTION_PKCS12_INFO; ;}; return GAA_OK; break; case GAAOPTID_crq_info: OK = 0; -#line 67 "certtool.gaa" +#line 65 "certtool.gaa" { gaaval->action = ACTION_REQUEST; ;}; return GAA_OK; break; case GAAOPTID_crl_info: OK = 0; -#line 65 "certtool.gaa" +#line 63 "certtool.gaa" { gaaval->action = ACTION_CRL_INFO; ;}; return GAA_OK; break; case GAAOPTID_pgp_ring_info: OK = 0; -#line 63 "certtool.gaa" +#line 61 "certtool.gaa" { gaaval->action = ACTION_RING_INFO; ;}; return GAA_OK; break; case GAAOPTID_pgp_certificate_info: OK = 0; -#line 61 "certtool.gaa" +#line 59 "certtool.gaa" { gaaval->action = ACTION_PGP_INFO; ;}; return GAA_OK; break; case GAAOPTID_certificate_info: OK = 0; -#line 59 "certtool.gaa" +#line 57 "certtool.gaa" { gaaval->action = ACTION_CERT_INFO; ;}; return GAA_OK; @@ -1002,7 +1000,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_password.arg1, gaa_getstr, GAATMP_password.size1); gaa_index++; -#line 57 "certtool.gaa" +#line 55 "certtool.gaa" { gaaval->pass = GAATMP_password.arg1 ;}; return GAA_OK; @@ -1012,7 +1010,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_load_ca_certificate.arg1, gaa_getstr, GAATMP_load_ca_certificate.size1); gaa_index++; -#line 54 "certtool.gaa" +#line 52 "certtool.gaa" { gaaval->ca = GAATMP_load_ca_certificate.arg1 ;}; return GAA_OK; @@ -1022,7 +1020,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_load_ca_privkey.arg1, gaa_getstr, GAATMP_load_ca_privkey.size1); gaa_index++; -#line 51 "certtool.gaa" +#line 49 "certtool.gaa" { gaaval->ca_privkey = GAATMP_load_ca_privkey.arg1 ;}; return GAA_OK; @@ -1032,7 +1030,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_load_certificate.arg1, gaa_getstr, GAATMP_load_certificate.size1); gaa_index++; -#line 48 "certtool.gaa" +#line 46 "certtool.gaa" { gaaval->cert = GAATMP_load_certificate.arg1 ;}; return GAA_OK; @@ -1042,7 +1040,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_load_request.arg1, gaa_getstr, GAATMP_load_request.size1); gaa_index++; -#line 45 "certtool.gaa" +#line 43 "certtool.gaa" { gaaval->request = GAATMP_load_request.arg1 ;}; return GAA_OK; @@ -1052,84 +1050,84 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_load_privkey.arg1, gaa_getstr, GAATMP_load_privkey.size1); gaa_index++; -#line 42 "certtool.gaa" +#line 40 "certtool.gaa" { gaaval->privkey = GAATMP_load_privkey.arg1 ;}; return GAA_OK; break; case GAAOPTID_get_dh_params: OK = 0; -#line 39 "certtool.gaa" +#line 37 "certtool.gaa" { gaaval->action=ACTION_GET_DH; ;}; return GAA_OK; break; case GAAOPTID_generate_dh_params: OK = 0; -#line 38 "certtool.gaa" +#line 36 "certtool.gaa" { gaaval->action=ACTION_GENERATE_DH; ;}; return GAA_OK; break; case GAAOPTID_verify_crl: OK = 0; -#line 36 "certtool.gaa" +#line 34 "certtool.gaa" { gaaval->action=ACTION_VERIFY_CRL; ;}; return GAA_OK; break; case GAAOPTID_verify_chain: OK = 0; -#line 34 "certtool.gaa" +#line 32 "certtool.gaa" { gaaval->action=ACTION_VERIFY_CHAIN; ;}; return GAA_OK; break; case GAAOPTID_generate_request: OK = 0; -#line 32 "certtool.gaa" +#line 30 "certtool.gaa" { gaaval->action=ACTION_GENERATE_REQUEST; ;}; return GAA_OK; break; case GAAOPTID_generate_privkey: OK = 0; -#line 30 "certtool.gaa" +#line 28 "certtool.gaa" { gaaval->privkey_op=1; gaaval->action=ACTION_GENERATE_PRIVKEY; ;}; return GAA_OK; break; case GAAOPTID_update_certificate: OK = 0; -#line 28 "certtool.gaa" +#line 26 "certtool.gaa" { gaaval->action=ACTION_UPDATE_CERTIFICATE; ;}; return GAA_OK; break; case GAAOPTID_generate_crl: OK = 0; -#line 26 "certtool.gaa" +#line 24 "certtool.gaa" { gaaval->action=ACTION_GENERATE_CRL; ;}; return GAA_OK; break; case GAAOPTID_generate_proxy: OK = 0; -#line 24 "certtool.gaa" +#line 22 "certtool.gaa" { gaaval->action=ACTION_GENERATE_PROXY; ;}; return GAA_OK; break; case GAAOPTID_generate_certificate: OK = 0; -#line 22 "certtool.gaa" +#line 20 "certtool.gaa" { gaaval->action=ACTION_GENERATE_CERTIFICATE; ;}; return GAA_OK; break; case GAAOPTID_generate_self_signed: OK = 0; -#line 20 "certtool.gaa" +#line 18 "certtool.gaa" { gaaval->action=ACTION_SELF_SIGNED; ;}; return GAA_OK; @@ -1158,7 +1156,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval) if(inited == 0) { -#line 134 "certtool.gaa" +#line 132 "certtool.gaa" { gaaval->bits = 2048; gaaval->pkcs8 = 0; gaaval->privkey = NULL; gaaval->ca=NULL; gaaval->ca_privkey = NULL; gaaval->debug=1; gaaval->request = NULL; gaaval->infile = NULL; gaaval->outfile = NULL; gaaval->cert = NULL; gaaval->incert_format = 0; gaaval->outcert_format = 0; gaaval->action=-1; gaaval->pass = NULL; gaaval->v1_cert = 0; diff --git a/src/certtool-gaa.h b/src/certtool-gaa.h index a8ae82469e..42181c5d8a 100644 --- a/src/certtool-gaa.h +++ b/src/certtool-gaa.h @@ -8,49 +8,49 @@ typedef struct _gaainfo gaainfo; struct _gaainfo { -#line 127 "certtool.gaa" +#line 125 "certtool.gaa" int debug; -#line 123 "certtool.gaa" +#line 121 "certtool.gaa" char *template; -#line 120 "certtool.gaa" +#line 118 "certtool.gaa" char *infile; -#line 117 "certtool.gaa" +#line 115 "certtool.gaa" char *outfile; -#line 114 "certtool.gaa" +#line 112 "certtool.gaa" int quick_random; -#line 111 "certtool.gaa" +#line 109 "certtool.gaa" int bits; -#line 107 "certtool.gaa" +#line 105 "certtool.gaa" int outcert_format; -#line 103 "certtool.gaa" +#line 101 "certtool.gaa" int incert_format; -#line 100 "certtool.gaa" +#line 98 "certtool.gaa" int export; -#line 97 "certtool.gaa" +#line 95 "certtool.gaa" char *hash; -#line 94 "certtool.gaa" +#line 92 "certtool.gaa" int dsa; -#line 91 "certtool.gaa" +#line 89 "certtool.gaa" int pkcs8; -#line 84 "certtool.gaa" +#line 82 "certtool.gaa" int v1_cert; -#line 81 "certtool.gaa" +#line 79 "certtool.gaa" int fix_key; -#line 56 "certtool.gaa" +#line 54 "certtool.gaa" char *pass; -#line 53 "certtool.gaa" +#line 51 "certtool.gaa" char *ca; -#line 50 "certtool.gaa" +#line 48 "certtool.gaa" char *ca_privkey; -#line 47 "certtool.gaa" +#line 45 "certtool.gaa" char *cert; -#line 44 "certtool.gaa" +#line 42 "certtool.gaa" char *request; -#line 41 "certtool.gaa" +#line 39 "certtool.gaa" char *privkey; -#line 19 "certtool.gaa" +#line 17 "certtool.gaa" int action; -#line 18 "certtool.gaa" +#line 16 "certtool.gaa" int privkey_op; #line 114 "gaa.skel" diff --git a/src/certtool.c b/src/certtool.c index 634c48a190..220b8e7a44 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -565,9 +565,9 @@ generate_crl (gnutls_x509_crt_t ca_crt) gnutls_x509_crl_t crl; gnutls_x509_crt_t *crts; size_t size; - int days, result, i; + int days, result; + unsigned int i; time_t now = time (NULL); - unsigned char buffer[128]; unsigned int number; result = gnutls_x509_crl_init (&crl); @@ -830,19 +830,19 @@ update_signed_certificate (void) static FILE * safe_open_rw (const char *file) { - mode_t oldmask; + mode_t omask = 0; FILE *fh; if (info.privkey_op != 0) { - oldmask = umask (S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + omask = umask (S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); } fh = fopen (file, "wb"); if (info.privkey_op != 0) { - umask (oldmask); + umask (omask); } return fh; @@ -1330,17 +1330,17 @@ print_hex_datum (gnutls_datum_t * dat) static void print_certificate_info (gnutls_x509_crt_t crt, FILE * out, unsigned int all) { - gnutls_datum_t info; + gnutls_datum_t cinfo; int ret; if (all) - ret = gnutls_x509_crt_print (crt, GNUTLS_CRT_PRINT_FULL, &info); + ret = gnutls_x509_crt_print (crt, GNUTLS_CRT_PRINT_FULL, &cinfo); else - ret = gnutls_x509_crt_print (crt, GNUTLS_CRT_PRINT_UNSIGNED_FULL, &info); + ret = gnutls_x509_crt_print (crt, GNUTLS_CRT_PRINT_UNSIGNED_FULL, &cinfo); if (ret == 0) { - fprintf (out, "%s\n", info.data); - gnutls_free (info.data); + fprintf (out, "%s\n", cinfo.data); + gnutls_free (cinfo.data); } if (out == stderr && batch == 0) /* interactive */ @@ -1353,17 +1353,17 @@ print_certificate_info (gnutls_x509_crt_t crt, FILE * out, unsigned int all) static void print_crl_info (gnutls_x509_crl_t crl, FILE * out) { - gnutls_datum_t info; + gnutls_datum_t cinfo; int ret; size_t size; - ret = gnutls_x509_crl_print (crl, GNUTLS_CRT_PRINT_FULL, &info); + ret = gnutls_x509_crl_print (crl, GNUTLS_CRT_PRINT_FULL, &cinfo); if (ret < 0) error (EXIT_FAILURE, 0, "crl_print: %s", gnutls_strerror (ret)); - fprintf (out, "%s\n", info.data); + fprintf (out, "%s\n", cinfo.data); - gnutls_free (info.data); + gnutls_free (cinfo.data); size = sizeof (buffer); ret = gnutls_x509_crl_export (crl, GNUTLS_X509_FMT_PEM, buffer, &size); @@ -1406,17 +1406,17 @@ crl_info (void) static void print_crq_info (gnutls_x509_crq_t crq, FILE * out) { - gnutls_datum_t info; + gnutls_datum_t cinfo; int ret; size_t size; - ret = gnutls_x509_crq_print (crq, GNUTLS_CRT_PRINT_FULL, &info); + ret = gnutls_x509_crq_print (crq, GNUTLS_CRT_PRINT_FULL, &cinfo); if (ret < 0) error (EXIT_FAILURE, 0, "crq_print: %s", gnutls_strerror (ret)); - fprintf (out, "%s\n", info.data); + fprintf (out, "%s\n", cinfo.data); - gnutls_free (info.data); + gnutls_free (cinfo.data); size = sizeof (buffer); ret = gnutls_x509_crq_export (crq, GNUTLS_X509_FMT_PEM, buffer, &size); @@ -1819,7 +1819,7 @@ load_cert_list (int mand, size_t *crt_size) (*crt_size)++; } - fprintf (stderr, "Loaded %d certificates.\n", *crt_size); + fprintf (stderr, "Loaded %d certificates.\n", (int)*crt_size); return crt; } @@ -1834,8 +1834,7 @@ generate_request (void) gnutls_x509_privkey_t key; int ret, ca_status, path_len; const char *pass; - size_t size; - unsigned int usage; + unsigned int usage = 0; fprintf (stderr, "Generating a PKCS #10 certificate request...\n"); @@ -2279,16 +2278,16 @@ print_verification_res (gnutls_x509_crt_t crt, void verify_chain (void) { - char *buffer; + char *buf; size_t size; - buffer = fread_file (infile, &size); - if (buffer == NULL) + buf = fread_file (infile, &size); + if (buf == NULL) error (EXIT_FAILURE, errno, "reading chain"); - buffer[size] = 0; + buf[size] = 0; - _verify_x509_mem (buffer, size); + _verify_x509_mem (buf, size); } @@ -2437,14 +2436,13 @@ generate_pkcs12 (void) int result; size_t size; gnutls_datum_t data; - const char *password; + const char *pass; const char *name; - unsigned int flags; + unsigned int flags, i; gnutls_datum_t key_id; unsigned char _key_id[20]; - int index; + int indx; size_t ncrts; - int i; fprintf (stderr, "Generating a PKCS #12 structure...\n"); @@ -2458,9 +2456,9 @@ generate_pkcs12 (void) error (EXIT_FAILURE, 0, "pkcs12_init: %s", gnutls_strerror (result)); if (info.pass) - password = info.pass; + pass = info.pass; else - password = get_pass (); + pass = get_pass (); for (i = 0; i < ncrts; i++) { @@ -2475,9 +2473,9 @@ generate_pkcs12 (void) error (EXIT_FAILURE, 0, "set_crt[%d]: %s", i, gnutls_strerror (result)); - index = result; + indx = result; - result = gnutls_pkcs12_bag_set_friendly_name (bag, index, name); + result = gnutls_pkcs12_bag_set_friendly_name (bag, indx, name); if (result < 0) error (EXIT_FAILURE, 0, "bag_set_friendly_name: %s", gnutls_strerror (result)); @@ -2491,7 +2489,7 @@ generate_pkcs12 (void) key_id.data = _key_id; key_id.size = size; - result = gnutls_pkcs12_bag_set_key_id (bag, index, &key_id); + result = gnutls_pkcs12_bag_set_key_id (bag, indx, &key_id); if (result < 0) error (EXIT_FAILURE, 0, "bag_set_key_id: %s", gnutls_strerror (result)); @@ -2501,7 +2499,7 @@ generate_pkcs12 (void) else flags = GNUTLS_PKCS8_USE_PKCS12_3DES; - result = gnutls_pkcs12_bag_encrypt (bag, password, flags); + result = gnutls_pkcs12_bag_encrypt (bag, pass, flags); if (result < 0) error (EXIT_FAILURE, 0, "bag_encrypt: %s", gnutls_strerror (result)); @@ -2526,7 +2524,7 @@ generate_pkcs12 (void) size = sizeof (buffer); result = gnutls_x509_privkey_export_pkcs8 (key, GNUTLS_X509_FMT_DER, - password, flags, buffer, &size); + pass, flags, buffer, &size); if (result < 0) error (EXIT_FAILURE, 0, "key_export: %s", gnutls_strerror (result)); @@ -2538,9 +2536,9 @@ generate_pkcs12 (void) if (result < 0) error (EXIT_FAILURE, 0, "bag_set_data: %s", gnutls_strerror (result)); - index = result; + indx = result; - result = gnutls_pkcs12_bag_set_friendly_name (kbag, index, name); + result = gnutls_pkcs12_bag_set_friendly_name (kbag, indx, name); if (result < 0) error (EXIT_FAILURE, 0, "bag_set_friendly_name: %s", gnutls_strerror (result)); @@ -2553,7 +2551,7 @@ generate_pkcs12 (void) key_id.data = _key_id; key_id.size = size; - result = gnutls_pkcs12_bag_set_key_id (kbag, index, &key_id); + result = gnutls_pkcs12_bag_set_key_id (kbag, indx, &key_id); if (result < 0) error (EXIT_FAILURE, 0, "bag_set_key_id: %s", gnutls_strerror (result)); @@ -2563,7 +2561,7 @@ generate_pkcs12 (void) error (EXIT_FAILURE, 0, "set_bag: %s", gnutls_strerror (result)); } - result = gnutls_pkcs12_generate_mac (pkcs12, password); + result = gnutls_pkcs12_generate_mac (pkcs12, pass); if (result < 0) error (EXIT_FAILURE, 0, "generate_mac: %s", gnutls_strerror (result)); @@ -2679,8 +2677,8 @@ pkcs12_info (void) int result; size_t size; gnutls_datum_t data; - const char *password; - int index; + const char *pass; + int indx; result = gnutls_pkcs12_init (&pkcs12); if (result < 0) @@ -2695,23 +2693,23 @@ pkcs12_info (void) error (EXIT_FAILURE, 0, "p12_import: %s", gnutls_strerror (result)); if (info.pass) - password = info.pass; + pass = info.pass; else - password = get_pass (); + pass = get_pass (); - result = gnutls_pkcs12_verify_mac (pkcs12, password); + result = gnutls_pkcs12_verify_mac (pkcs12, pass); if (result < 0) error (EXIT_FAILURE, 0, "verify_mac: %s", gnutls_strerror (result)); - index = 0; + indx = 0; - for (index = 0;; index++) + for (indx = 0;; indx++) { result = gnutls_pkcs12_bag_init (&bag); if (result < 0) error (EXIT_FAILURE, 0, "bag_init: %s", gnutls_strerror (result)); - result = gnutls_pkcs12_get_bag (pkcs12, index, bag); + result = gnutls_pkcs12_get_bag (pkcs12, indx, bag); if (result < 0) break; @@ -2719,7 +2717,7 @@ pkcs12_info (void) if (result < 0) error (EXIT_FAILURE, 0, "bag_count: %s", gnutls_strerror (result)); - fprintf (outfile, "BAG #%d\n", index); + fprintf (outfile, "BAG #%d\n", indx); result = gnutls_pkcs12_bag_get_type (bag, 0); if (result < 0) @@ -2730,7 +2728,7 @@ pkcs12_info (void) fprintf (stderr, "\tType: %s\n", BAGTYPE (result)); fprintf (stderr, "\n\tDecrypting...\n"); - result = gnutls_pkcs12_bag_decrypt (bag, password); + result = gnutls_pkcs12_bag_decrypt (bag, pass); if (result < 0) error (EXIT_FAILURE, 0, "bag_decrypt: %s", @@ -2755,7 +2753,7 @@ pkcs7_info (void) int result; size_t size; gnutls_datum_t data, b64; - int index, count; + int indx, count; result = gnutls_pkcs7_init (&pkcs7); if (result < 0) @@ -2780,12 +2778,12 @@ pkcs7_info (void) if (count > 0) fprintf (outfile, "Number of certificates: %u\n", count); - for (index = 0; index < count; index++) + for (indx = 0; indx < count; indx++) { fputs ("\n", outfile); size = sizeof (buffer); - result = gnutls_pkcs7_get_crt_raw (pkcs7, index, buffer, &size); + result = gnutls_pkcs7_get_crt_raw (pkcs7, indx, buffer, &size); if (result < 0) break; @@ -2811,12 +2809,12 @@ pkcs7_info (void) if (count > 0) fprintf (outfile, "\nNumber of CRLs: %u\n", count); - for (index = 0; index < count; index++) + for (indx = 0; indx < count; indx++) { fputs ("\n", outfile); size = sizeof (buffer); - result = gnutls_pkcs7_get_crl_raw (pkcs7, index, buffer, &size); + result = gnutls_pkcs7_get_crl_raw (pkcs7, indx, buffer, &size); if (result < 0) break; @@ -2875,8 +2873,7 @@ smime_to_pkcs7 (void) free (lineptr); } -void -certtool_version (void) +void certtool_version (void) { const char *p = PACKAGE_NAME; if (strcmp (gnutls_check_version (NULL), PACKAGE_VERSION) != 0) diff --git a/src/certtool.gaa b/src/certtool.gaa index 87def6d75e..786b063ccf 100644 --- a/src/certtool.gaa +++ b/src/certtool.gaa @@ -7,8 +7,6 @@ # include #endif -void certtool_version(void); - #include "certtool-common.h" #}