diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/certtool-gaa.c | 91 | ||||
-rw-r--r-- | src/certtool-gaa.h | 30 | ||||
-rw-r--r-- | src/certtool.gaa | 3 | ||||
-rw-r--r-- | src/cli.c | 29 | ||||
-rw-r--r-- | src/common.c | 13 | ||||
-rw-r--r-- | src/common.h | 16 | ||||
-rw-r--r-- | src/crypt-gaa.c | 35 | ||||
-rw-r--r-- | src/crypt-gaa.h | 14 | ||||
-rw-r--r-- | src/crypt.gaa | 3 | ||||
-rw-r--r-- | src/prime.c | 4 | ||||
-rw-r--r-- | src/serv.c | 26 | ||||
-rw-r--r-- | src/tests.c | 1 | ||||
-rw-r--r-- | src/tls_test-gaa.c | 23 | ||||
-rw-r--r-- | src/tls_test-gaa.h | 8 | ||||
-rw-r--r-- | src/tls_test.c | 30 | ||||
-rw-r--r-- | src/tls_test.gaa | 3 |
16 files changed, 149 insertions, 180 deletions
diff --git a/src/certtool-gaa.c b/src/certtool-gaa.c index 0bff82bdbc..2f8f6b32b3 100644 --- a/src/certtool-gaa.c +++ b/src/certtool-gaa.c @@ -8,7 +8,8 @@ #include <config.h> #ifdef _WIN32 -# include <windows.h> +# include <io.h> +# include <winbase.h> #endif #include <stdio.h> @@ -169,35 +170,35 @@ typedef struct _gaainfo gaainfo; struct _gaainfo { -#line 76 "certtool.gaa" +#line 77 "certtool.gaa" int debug; -#line 73 "certtool.gaa" +#line 74 "certtool.gaa" char *infile; -#line 70 "certtool.gaa" +#line 71 "certtool.gaa" char *outfile; -#line 67 "certtool.gaa" +#line 68 "certtool.gaa" int bits; -#line 64 "certtool.gaa" +#line 65 "certtool.gaa" int outcert_format; -#line 61 "certtool.gaa" +#line 62 "certtool.gaa" int incert_format; -#line 58 "certtool.gaa" +#line 59 "certtool.gaa" int export; -#line 55 "certtool.gaa" +#line 56 "certtool.gaa" int pkcs8; -#line 44 "certtool.gaa" +#line 45 "certtool.gaa" char *pass; -#line 41 "certtool.gaa" +#line 42 "certtool.gaa" char *ca; -#line 38 "certtool.gaa" +#line 39 "certtool.gaa" char *ca_privkey; -#line 35 "certtool.gaa" +#line 36 "certtool.gaa" char *cert; -#line 32 "certtool.gaa" +#line 33 "certtool.gaa" char *request; -#line 29 "certtool.gaa" +#line 30 "certtool.gaa" char *privkey; -#line 14 "certtool.gaa" +#line 15 "certtool.gaa" int action; #line 114 "gaa.skel" @@ -663,21 +664,21 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) { case GAAOPTID_copyright: OK = 0; -#line 82 "certtool.gaa" +#line 83 "certtool.gaa" { print_license(); exit(0); ;}; return GAA_OK; break; case GAAOPTID_version: OK = 0; -#line 81 "certtool.gaa" +#line 82 "certtool.gaa" { certtool_version(); exit(0); ;}; return GAA_OK; break; case GAAOPTID_help: OK = 0; -#line 79 "certtool.gaa" +#line 80 "certtool.gaa" { gaa_help(); exit(0); ;}; return GAA_OK; @@ -687,7 +688,7 @@ 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 77 "certtool.gaa" +#line 78 "certtool.gaa" { gaaval->debug = GAATMP_debug.arg1 ;}; return GAA_OK; @@ -697,7 +698,7 @@ 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 74 "certtool.gaa" +#line 75 "certtool.gaa" { gaaval->infile = GAATMP_infile.arg1 ;}; return GAA_OK; @@ -707,7 +708,7 @@ 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 71 "certtool.gaa" +#line 72 "certtool.gaa" { gaaval->outfile = GAATMP_outfile.arg1 ;}; return GAA_OK; @@ -717,63 +718,63 @@ 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 68 "certtool.gaa" +#line 69 "certtool.gaa" { gaaval->bits = GAATMP_bits.arg1 ;}; return GAA_OK; break; case GAAOPTID_outder: OK = 0; -#line 65 "certtool.gaa" +#line 66 "certtool.gaa" { gaaval->outcert_format=1 ;}; return GAA_OK; break; case GAAOPTID_inder: OK = 0; -#line 62 "certtool.gaa" +#line 63 "certtool.gaa" { gaaval->incert_format=1 ;}; return GAA_OK; break; case GAAOPTID_export_ciphers: OK = 0; -#line 59 "certtool.gaa" +#line 60 "certtool.gaa" { gaaval->export=1 ;}; return GAA_OK; break; case GAAOPTID_pkcs8: OK = 0; -#line 56 "certtool.gaa" +#line 57 "certtool.gaa" { gaaval->pkcs8=1 ;}; return GAA_OK; break; case GAAOPTID_to_p12: OK = 0; -#line 53 "certtool.gaa" +#line 54 "certtool.gaa" { gaaval->action = 8; ;}; return GAA_OK; break; case GAAOPTID_key_info: OK = 0; -#line 51 "certtool.gaa" +#line 52 "certtool.gaa" { gaaval->action = 6; ;}; return GAA_OK; break; case GAAOPTID_p12_info: OK = 0; -#line 49 "certtool.gaa" +#line 50 "certtool.gaa" { gaaval->action = 9; ;}; return GAA_OK; break; case GAAOPTID_certificate_info: OK = 0; -#line 47 "certtool.gaa" +#line 48 "certtool.gaa" { gaaval->action = 2; ;}; return GAA_OK; @@ -783,7 +784,7 @@ 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 45 "certtool.gaa" +#line 46 "certtool.gaa" { gaaval->pass = GAATMP_password.arg1 ;}; return GAA_OK; @@ -793,7 +794,7 @@ 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 42 "certtool.gaa" +#line 43 "certtool.gaa" { gaaval->ca = GAATMP_load_ca_certificate.arg1 ;}; return GAA_OK; @@ -803,7 +804,7 @@ 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 39 "certtool.gaa" +#line 40 "certtool.gaa" { gaaval->ca_privkey = GAATMP_load_ca_privkey.arg1 ;}; return GAA_OK; @@ -813,7 +814,7 @@ 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 36 "certtool.gaa" +#line 37 "certtool.gaa" { gaaval->cert = GAATMP_load_certificate.arg1 ;}; return GAA_OK; @@ -823,7 +824,7 @@ 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 33 "certtool.gaa" +#line 34 "certtool.gaa" { gaaval->request = GAATMP_load_request.arg1 ;}; return GAA_OK; @@ -833,56 +834,56 @@ 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 30 "certtool.gaa" +#line 31 "certtool.gaa" { gaaval->privkey = GAATMP_load_privkey.arg1 ;}; return GAA_OK; break; case GAAOPTID_generate_dh_params: OK = 0; -#line 27 "certtool.gaa" +#line 28 "certtool.gaa" { gaaval->action=10; ;}; return GAA_OK; break; case GAAOPTID_verify_chain: OK = 0; -#line 25 "certtool.gaa" +#line 26 "certtool.gaa" { gaaval->action=5; ;}; return GAA_OK; break; case GAAOPTID_generate_request: OK = 0; -#line 23 "certtool.gaa" +#line 24 "certtool.gaa" { gaaval->action=3; ;}; return GAA_OK; break; case GAAOPTID_generate_privkey: OK = 0; -#line 21 "certtool.gaa" +#line 22 "certtool.gaa" { gaaval->action=1; ;}; return GAA_OK; break; case GAAOPTID_update_certificate: OK = 0; -#line 19 "certtool.gaa" +#line 20 "certtool.gaa" { gaaval->action=7; ;}; return GAA_OK; break; case GAAOPTID_generate_certificate: OK = 0; -#line 17 "certtool.gaa" +#line 18 "certtool.gaa" { gaaval->action=4; ;}; return GAA_OK; break; case GAAOPTID_generate_self_signed: OK = 0; -#line 15 "certtool.gaa" +#line 16 "certtool.gaa" { gaaval->action=0; ;}; return GAA_OK; @@ -911,7 +912,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval) if(inited == 0) { -#line 84 "certtool.gaa" +#line 85 "certtool.gaa" { gaaval->bits = 1024; 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; diff --git a/src/certtool-gaa.h b/src/certtool-gaa.h index 14261b1b58..2a36dd7d55 100644 --- a/src/certtool-gaa.h +++ b/src/certtool-gaa.h @@ -8,35 +8,35 @@ typedef struct _gaainfo gaainfo; struct _gaainfo { -#line 76 "certtool.gaa" +#line 77 "certtool.gaa" int debug; -#line 73 "certtool.gaa" +#line 74 "certtool.gaa" char *infile; -#line 70 "certtool.gaa" +#line 71 "certtool.gaa" char *outfile; -#line 67 "certtool.gaa" +#line 68 "certtool.gaa" int bits; -#line 64 "certtool.gaa" +#line 65 "certtool.gaa" int outcert_format; -#line 61 "certtool.gaa" +#line 62 "certtool.gaa" int incert_format; -#line 58 "certtool.gaa" +#line 59 "certtool.gaa" int export; -#line 55 "certtool.gaa" +#line 56 "certtool.gaa" int pkcs8; -#line 44 "certtool.gaa" +#line 45 "certtool.gaa" char *pass; -#line 41 "certtool.gaa" +#line 42 "certtool.gaa" char *ca; -#line 38 "certtool.gaa" +#line 39 "certtool.gaa" char *ca_privkey; -#line 35 "certtool.gaa" +#line 36 "certtool.gaa" char *cert; -#line 32 "certtool.gaa" +#line 33 "certtool.gaa" char *request; -#line 29 "certtool.gaa" +#line 30 "certtool.gaa" char *privkey; -#line 14 "certtool.gaa" +#line 15 "certtool.gaa" int action; #line 114 "gaa.skel" diff --git a/src/certtool.gaa b/src/certtool.gaa index 9272d75b3e..9298d2234a 100644 --- a/src/certtool.gaa +++ b/src/certtool.gaa @@ -4,7 +4,8 @@ #include <config.h> #ifdef _WIN32 -# include <windows.h> +# include <io.h> +# include <winbase.h> #endif #} @@ -24,22 +24,6 @@ #include <errno.h> #include <stdlib.h> #include <sys/types.h> - -#ifdef _WIN32 -# include <winsock.h> -# include <io.h> -# include <winbase.h> -# define socklen_t int -# define close closesocket -#else -# include <sys/socket.h> -# include <netinet/in.h> -# include <arpa/inet.h> -# include <unistd.h> -# include <netdb.h> -# include <signal.h> -#endif - #include <string.h> #include <gnutls/gnutls.h> #include <gnutls/extra.h> @@ -274,23 +258,14 @@ int main(int argc, char **argv) int user_term = 0; struct hostent *server_host; socket_st hd; -#ifdef _WIN32 - WORD wVersionRequested; - WSADATA wsaData; -#endif gaa_parser(argc, argv); if (hostname == NULL) { fprintf(stderr, "No hostname given\n"); exit(1); } - -#ifdef _WIN32 - wVersionRequested = MAKEWORD(1, 1); - if (WSAStartup(wVersionRequested, &wsaData) != 0) { - perror("WSA_STARTUP_ERROR"); - } -#endif + + sockets_init(); #ifndef _WIN32 signal(SIGPIPE, SIG_IGN); diff --git a/src/common.c b/src/common.c index 8eab7f8bca..9bf983d795 100644 --- a/src/common.c +++ b/src/common.c @@ -661,3 +661,16 @@ char* ret; return dst; } #endif + +void sockets_init( void) +{ +#ifdef _WIN32 + WORD wVersionRequested; + WSADATA wsaData; + + wVersionRequested = MAKEWORD(1, 1); + if (WSAStartup(wVersionRequested, &wsaData) != 0) { + perror("WSA_STARTUP_ERROR"); + } +#endif +} diff --git a/src/common.h b/src/common.h index 2adaf8a8f3..4b6ce0122b 100644 --- a/src/common.h +++ b/src/common.h @@ -4,6 +4,21 @@ #include <config.h> #include <gnutls/gnutls.h> +#ifdef _WIN32 +# include <winsock.h> +# include <io.h> +# include <winbase.h> +# define socklen_t int +# define close closesocket +#else +# include <sys/socket.h> +# include <netinet/in.h> +# include <arpa/inet.h> +# include <unistd.h> +# include <netdb.h> +# include <signal.h> +#endif + /* the number of elements in the priority structures. */ #define PRI_MAX 16 @@ -21,6 +36,7 @@ void parse_macs( char** macs, int nmacs, int *mac_priority); void parse_ciphers( char** ciphers, int nciphers, int* cipher_priority); void parse_protocols( char** protocols, int protocols_size, int* protocol_priority); +void socket_init( void); #ifndef HAVE_INET_NTOP const char *inet_ntop(int af, const void *src, char *dst, size_t cnt); diff --git a/src/crypt-gaa.c b/src/crypt-gaa.c index f434c3248c..44ef9d5555 100644 --- a/src/crypt-gaa.c +++ b/src/crypt-gaa.c @@ -8,7 +8,8 @@ #include <config.h> #ifdef _WIN32 -# include <windows.h> +# include <io.h> +# include <winbase.h> #endif #include <stdio.h> @@ -149,19 +150,19 @@ typedef struct _gaainfo gaainfo; struct _gaainfo { -#line 32 "crypt.gaa" +#line 33 "crypt.gaa" char *create_conf; -#line 29 "crypt.gaa" +#line 30 "crypt.gaa" char *passwd_conf; -#line 26 "crypt.gaa" +#line 27 "crypt.gaa" int verify; -#line 23 "crypt.gaa" +#line 24 "crypt.gaa" int salt; -#line 20 "crypt.gaa" +#line 21 "crypt.gaa" int index; -#line 17 "crypt.gaa" +#line 18 "crypt.gaa" char *passwd; -#line 14 "crypt.gaa" +#line 15 "crypt.gaa" char *username; #line 114 "gaa.skel" @@ -539,7 +540,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) { case GAAOPTID_help: OK = 0; -#line 35 "crypt.gaa" +#line 36 "crypt.gaa" { gaa_help(); exit(0); ;}; return GAA_OK; @@ -549,7 +550,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_create_conf.arg1, gaa_getstr, GAATMP_create_conf.size1); gaa_index++; -#line 33 "crypt.gaa" +#line 34 "crypt.gaa" { gaaval->create_conf = GAATMP_create_conf.arg1 ;}; return GAA_OK; @@ -559,14 +560,14 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_passwd_conf.arg1, gaa_getstr, GAATMP_passwd_conf.size1); gaa_index++; -#line 30 "crypt.gaa" +#line 31 "crypt.gaa" { gaaval->passwd_conf = GAATMP_passwd_conf.arg1 ;}; return GAA_OK; break; case GAAOPTID_verify: OK = 0; -#line 27 "crypt.gaa" +#line 28 "crypt.gaa" { gaaval->verify = 1 ;}; return GAA_OK; @@ -576,7 +577,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_salt.arg1, gaa_getint, GAATMP_salt.size1); gaa_index++; -#line 24 "crypt.gaa" +#line 25 "crypt.gaa" { gaaval->salt = GAATMP_salt.arg1 ;}; return GAA_OK; @@ -586,7 +587,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_index.arg1, gaa_getint, GAATMP_index.size1); gaa_index++; -#line 21 "crypt.gaa" +#line 22 "crypt.gaa" { gaaval->index = GAATMP_index.arg1 ;}; return GAA_OK; @@ -596,7 +597,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_passwd.arg1, gaa_getstr, GAATMP_passwd.size1); gaa_index++; -#line 18 "crypt.gaa" +#line 19 "crypt.gaa" { gaaval->passwd = GAATMP_passwd.arg1 ;}; return GAA_OK; @@ -606,7 +607,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_username.arg1, gaa_getstr, GAATMP_username.size1); gaa_index++; -#line 15 "crypt.gaa" +#line 16 "crypt.gaa" { gaaval->username = GAATMP_username.arg1 ;}; return GAA_OK; @@ -635,7 +636,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval) if(inited == 0) { -#line 37 "crypt.gaa" +#line 38 "crypt.gaa" { gaaval->username=NULL; gaaval->passwd=NULL; gaaval->salt=0; gaaval->create_conf=NULL; gaaval->passwd_conf=NULL; gaaval->verify = 0; gaaval->index = 1; ;}; diff --git a/src/crypt-gaa.h b/src/crypt-gaa.h index f904827a54..07546d564f 100644 --- a/src/crypt-gaa.h +++ b/src/crypt-gaa.h @@ -8,19 +8,19 @@ typedef struct _gaainfo gaainfo; struct _gaainfo { -#line 32 "crypt.gaa" +#line 33 "crypt.gaa" char *create_conf; -#line 29 "crypt.gaa" +#line 30 "crypt.gaa" char *passwd_conf; -#line 26 "crypt.gaa" +#line 27 "crypt.gaa" int verify; -#line 23 "crypt.gaa" +#line 24 "crypt.gaa" int salt; -#line 20 "crypt.gaa" +#line 21 "crypt.gaa" int index; -#line 17 "crypt.gaa" +#line 18 "crypt.gaa" char *passwd; -#line 14 "crypt.gaa" +#line 15 "crypt.gaa" char *username; #line 114 "gaa.skel" diff --git a/src/crypt.gaa b/src/crypt.gaa index b3d639bef9..57369510c9 100644 --- a/src/crypt.gaa +++ b/src/crypt.gaa @@ -4,7 +4,8 @@ #include <config.h> #ifdef _WIN32 -# include <windows.h> +# include <io.h> +# include <winbase.h> #endif #} diff --git a/src/prime.c b/src/prime.c index 3349a3efae..bc1dcc7220 100644 --- a/src/prime.c +++ b/src/prime.c @@ -25,6 +25,10 @@ #include <gnutls/gnutls.h> #include "../lib/defines.h" +/* Generates Diffie Hellman parameters (a prime and a generator + * of the group). Exports them in PKCS #3 format. Used by certtool. + */ + extern FILE* outfile; extern FILE* infile; extern unsigned char buffer[]; diff --git a/src/serv.c b/src/serv.c index 70babdb425..ec879e8e64 100644 --- a/src/serv.c +++ b/src/serv.c @@ -27,21 +27,6 @@ #include <stdlib.h> #include <errno.h> #include <sys/types.h> - -#ifdef _WIN32 -# include <winsock.h> -# include <io.h> -# include <winbase.h> -# define socklen_t int -# define close closesocket -#else -# include <sys/socket.h> -# include <netinet/in.h> -# include <arpa/inet.h> -# include <unistd.h> -# include <signal.h> -#endif - #include <string.h> #include <gnutls/gnutls.h> #include <gnutls/extra.h> @@ -556,10 +541,6 @@ int main(int argc, char **argv) char name[256]; int accept_fd; struct sockaddr_in client_address; -#ifdef _WIN32 - WORD wVersionRequested; - WSADATA wsaData; -#endif #ifndef _WIN32 signal(SIGPIPE, SIG_IGN); @@ -567,13 +548,10 @@ int main(int argc, char **argv) signal(SIGTERM, terminate); if (signal(SIGINT, terminate) == SIG_IGN) signal(SIGINT, SIG_IGN); /* e.g. background process */ -#else - wVersionRequested = MAKEWORD(1, 1); - if (WSAStartup(wVersionRequested, &wsaData) != 0) { - perror("WSA_STARTUP_ERROR"); - } #endif + sockets_init(); + gaa_parser(argc, argv); if (nodb == 0) diff --git a/src/tests.c b/src/tests.c index c70c7a5eb1..7fb9d41fd7 100644 --- a/src/tests.c +++ b/src/tests.c @@ -27,7 +27,6 @@ # include <unistd.h> # include <signal.h> #else -# include <winsock.h> # include <errno.h> #endif diff --git a/src/tls_test-gaa.c b/src/tls_test-gaa.c index 0235aeddf6..18f338a58d 100644 --- a/src/tls_test-gaa.c +++ b/src/tls_test-gaa.c @@ -8,7 +8,8 @@ #include <config.h> #ifdef _WIN32 -# include <windows.h> +# include <io.h> +# include <winbase.h> #endif #include <stdio.h> @@ -145,13 +146,13 @@ typedef struct _gaainfo gaainfo; struct _gaainfo { -#line 26 "tls_test.gaa" +#line 27 "tls_test.gaa" char *rest_args; -#line 20 "tls_test.gaa" +#line 21 "tls_test.gaa" int more_info; -#line 17 "tls_test.gaa" +#line 18 "tls_test.gaa" int debug; -#line 14 "tls_test.gaa" +#line 15 "tls_test.gaa" int pp; #line 114 "gaa.skel" @@ -496,14 +497,14 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) { case GAAOPTID_help: OK = 0; -#line 23 "tls_test.gaa" +#line 24 "tls_test.gaa" { gaa_help(); exit(0); ;}; return GAA_OK; break; case GAAOPTID_verbose: OK = 0; -#line 21 "tls_test.gaa" +#line 22 "tls_test.gaa" { gaaval->more_info = 1 ;}; return GAA_OK; @@ -513,7 +514,7 @@ 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 18 "tls_test.gaa" +#line 19 "tls_test.gaa" { gaaval->debug = GAATMP_debug.arg1 ;}; return GAA_OK; @@ -523,7 +524,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAATMP_port.arg1, gaa_getint, GAATMP_port.size1); gaa_index++; -#line 15 "tls_test.gaa" +#line 16 "tls_test.gaa" { gaaval->pp = GAATMP_port.arg1 ;}; return GAA_OK; @@ -532,7 +533,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) GAA_TESTMOREARGS; GAA_FILL(GAAREST_tmp.arg1, gaa_getstr, GAAREST_tmp.size1); gaa_index++; -#line 27 "tls_test.gaa" +#line 28 "tls_test.gaa" { gaaval->rest_args = GAAREST_tmp.arg1; ;}; return GAA_OK; @@ -561,7 +562,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval) if(inited == 0) { -#line 29 "tls_test.gaa" +#line 30 "tls_test.gaa" { gaaval->rest_args=NULL; gaaval->pp = 443; gaaval->more_info = 0; ;}; } diff --git a/src/tls_test-gaa.h b/src/tls_test-gaa.h index 1bdfc00f56..39f2967f9a 100644 --- a/src/tls_test-gaa.h +++ b/src/tls_test-gaa.h @@ -8,13 +8,13 @@ typedef struct _gaainfo gaainfo; struct _gaainfo { -#line 26 "tls_test.gaa" +#line 27 "tls_test.gaa" char *rest_args; -#line 20 "tls_test.gaa" +#line 21 "tls_test.gaa" int more_info; -#line 17 "tls_test.gaa" +#line 18 "tls_test.gaa" int debug; -#line 14 "tls_test.gaa" +#line 15 "tls_test.gaa" int pp; #line 114 "gaa.skel" diff --git a/src/tls_test.c b/src/tls_test.c index 39a2a000f6..4f5df19c12 100644 --- a/src/tls_test.c +++ b/src/tls_test.c @@ -23,27 +23,12 @@ #include <errno.h> #include <stdlib.h> #include <sys/types.h> - -#ifdef _WIN32 -# include <winsock.h> -# include <io.h> -# include <winbase.h> -# define socklen_t int -# define close closesocket -#else -# include <sys/socket.h> -# include <netinet/in.h> -# include <arpa/inet.h> -# include <unistd.h> -# include <signal.h> -# include <netdb.h> -#endif - #include <string.h> #include <gnutls/gnutls.h> #include <gnutls/extra.h> #include <sys/time.h> #include <tests.h> +#include <common.h> #include <tls_test-gaa.h> #ifndef SHUT_WR @@ -134,7 +119,7 @@ static const TLS_TEST tls_tests[] = { }; static int tt = 0; -char* ip; +const char* ip; #define CONNECT() \ sd = socket(AF_INET, SOCK_STREAM, 0); \ @@ -160,22 +145,15 @@ int main(int argc, char **argv) struct hostent *server_host; int ssl3_ok = 0; int tls1_ok = 0; -#ifdef _WIN32 - WORD wVersionRequested; - WSADATA wsaData; -#endif gaa_parser(argc, argv); #ifndef _WIN32 signal(SIGPIPE, SIG_IGN); -#else - wVersionRequested = MAKEWORD(1, 1); - if (WSAStartup(wVersionRequested, &wsaData) != 0) { - perror("WSA_STARTUP_ERROR"); - } #endif + sockets_init(); + if (gnutls_global_init() < 0) { fprintf(stderr, "global state initialization error\n"); exit(1); diff --git a/src/tls_test.gaa b/src/tls_test.gaa index f640bfb2bb..0913335b3b 100644 --- a/src/tls_test.gaa +++ b/src/tls_test.gaa @@ -4,7 +4,8 @@ #include <config.h> #ifdef _WIN32 -# include <windows.h> +# include <io.h> +# include <winbase.h> #endif #} |