diff options
Diffstat (limited to 'src/lib/libssl/ssl_txt.c')
-rw-r--r-- | src/lib/libssl/ssl_txt.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/src/lib/libssl/ssl_txt.c b/src/lib/libssl/ssl_txt.c index c07d957576..6e33eec3e4 100644 --- a/src/lib/libssl/ssl_txt.c +++ b/src/lib/libssl/ssl_txt.c | |||
@@ -81,7 +81,7 @@ int SSL_SESSION_print_fp(FILE *fp, SSL_SESSION *x) | |||
81 | int SSL_SESSION_print(BIO *bp, SSL_SESSION *x) | 81 | int SSL_SESSION_print(BIO *bp, SSL_SESSION *x) |
82 | { | 82 | { |
83 | unsigned int i; | 83 | unsigned int i; |
84 | char str[128],*s; | 84 | char *s; |
85 | 85 | ||
86 | if (x == NULL) goto err; | 86 | if (x == NULL) goto err; |
87 | if (BIO_puts(bp,"SSL-Session:\n") <= 0) goto err; | 87 | if (BIO_puts(bp,"SSL-Session:\n") <= 0) goto err; |
@@ -93,36 +93,41 @@ int SSL_SESSION_print(BIO *bp, SSL_SESSION *x) | |||
93 | s="TLSv1"; | 93 | s="TLSv1"; |
94 | else | 94 | else |
95 | s="unknown"; | 95 | s="unknown"; |
96 | sprintf(str," Protocol : %s\n",s); | 96 | if (BIO_printf(bp," Protocol : %s\n",s) <= 0) goto err; |
97 | if (BIO_puts(bp,str) <= 0) goto err; | ||
98 | 97 | ||
99 | if (x->cipher == NULL) | 98 | if (x->cipher == NULL) |
100 | { | 99 | { |
101 | if (((x->cipher_id) & 0xff000000) == 0x02000000) | 100 | if (((x->cipher_id) & 0xff000000) == 0x02000000) |
102 | sprintf(str," Cipher : %06lX\n",x->cipher_id&0xffffff); | 101 | { |
102 | if (BIO_printf(bp," Cipher : %06lX\n",x->cipher_id&0xffffff) <= 0) | ||
103 | goto err; | ||
104 | } | ||
103 | else | 105 | else |
104 | sprintf(str," Cipher : %04lX\n",x->cipher_id&0xffff); | 106 | { |
107 | if (BIO_printf(bp," Cipher : %04lX\n",x->cipher_id&0xffff) <= 0) | ||
108 | goto err; | ||
109 | } | ||
105 | } | 110 | } |
106 | else | 111 | else |
107 | sprintf(str," Cipher : %s\n",(x->cipher == NULL)?"unknown":x->cipher->name); | 112 | { |
108 | if (BIO_puts(bp,str) <= 0) goto err; | 113 | if (BIO_printf(bp," Cipher : %s\n",((x->cipher == NULL)?"unknown":x->cipher->name)) <= 0) |
114 | goto err; | ||
115 | } | ||
109 | if (BIO_puts(bp," Session-ID: ") <= 0) goto err; | 116 | if (BIO_puts(bp," Session-ID: ") <= 0) goto err; |
110 | for (i=0; i<x->session_id_length; i++) | 117 | for (i=0; i<x->session_id_length; i++) |
111 | { | 118 | { |
112 | sprintf(str,"%02X",x->session_id[i]); | 119 | if (BIO_printf(bp,"%02X",x->session_id[i]) <= 0) goto err; |
113 | if (BIO_puts(bp,str) <= 0) goto err; | ||
114 | } | 120 | } |
115 | if (BIO_puts(bp,"\n Session-ID-ctx: ") <= 0) goto err; | 121 | if (BIO_puts(bp,"\n Session-ID-ctx: ") <= 0) goto err; |
116 | for (i=0; i<x->sid_ctx_length; i++) | 122 | for (i=0; i<x->sid_ctx_length; i++) |
117 | { | 123 | { |
118 | sprintf(str,"%02X",x->sid_ctx[i]); | 124 | if (BIO_printf(bp,"%02X",x->sid_ctx[i]) <= 0) |
119 | if (BIO_puts(bp,str) <= 0) goto err; | 125 | goto err; |
120 | } | 126 | } |
121 | if (BIO_puts(bp,"\n Master-Key: ") <= 0) goto err; | 127 | if (BIO_puts(bp,"\n Master-Key: ") <= 0) goto err; |
122 | for (i=0; i<(unsigned int)x->master_key_length; i++) | 128 | for (i=0; i<(unsigned int)x->master_key_length; i++) |
123 | { | 129 | { |
124 | sprintf(str,"%02X",x->master_key[i]); | 130 | if (BIO_printf(bp,"%02X",x->master_key[i]) <= 0) goto err; |
125 | if (BIO_puts(bp,str) <= 0) goto err; | ||
126 | } | 131 | } |
127 | if (BIO_puts(bp,"\n Key-Arg : ") <= 0) goto err; | 132 | if (BIO_puts(bp,"\n Key-Arg : ") <= 0) goto err; |
128 | if (x->key_arg_length == 0) | 133 | if (x->key_arg_length == 0) |
@@ -132,8 +137,7 @@ int SSL_SESSION_print(BIO *bp, SSL_SESSION *x) | |||
132 | else | 137 | else |
133 | for (i=0; i<x->key_arg_length; i++) | 138 | for (i=0; i<x->key_arg_length; i++) |
134 | { | 139 | { |
135 | sprintf(str,"%02X",x->key_arg[i]); | 140 | if (BIO_printf(bp,"%02X",x->key_arg[i]) <= 0) goto err; |
136 | if (BIO_puts(bp,str) <= 0) goto err; | ||
137 | } | 141 | } |
138 | if (x->compress_meth != 0) | 142 | if (x->compress_meth != 0) |
139 | { | 143 | { |
@@ -142,32 +146,26 @@ int SSL_SESSION_print(BIO *bp, SSL_SESSION *x) | |||
142 | ssl_cipher_get_evp(x,NULL,NULL,&comp); | 146 | ssl_cipher_get_evp(x,NULL,NULL,&comp); |
143 | if (comp == NULL) | 147 | if (comp == NULL) |
144 | { | 148 | { |
145 | sprintf(str,"\n Compression: %d",x->compress_meth); | 149 | if (BIO_printf(bp,"\n Compression: %d",x->compress_meth) <= 0) goto err; |
146 | if (BIO_puts(bp,str) <= 0) goto err; | ||
147 | } | 150 | } |
148 | else | 151 | else |
149 | { | 152 | { |
150 | sprintf(str,"\n Compression: %d (%s)", | 153 | if (BIO_printf(bp,"\n Compression: %d (%s)", comp->id,comp->method->name) <= 0) goto err; |
151 | comp->id,comp->method->name); | ||
152 | if (BIO_puts(bp,str) <= 0) goto err; | ||
153 | } | 154 | } |
154 | } | 155 | } |
155 | if (x->time != 0L) | 156 | if (x->time != 0L) |
156 | { | 157 | { |
157 | sprintf(str,"\n Start Time: %ld",x->time); | 158 | if (BIO_printf(bp, "\n Start Time: %ld",x->time) <= 0) goto err; |
158 | if (BIO_puts(bp,str) <= 0) goto err; | ||
159 | } | 159 | } |
160 | if (x->timeout != 0L) | 160 | if (x->timeout != 0L) |
161 | { | 161 | { |
162 | sprintf(str,"\n Timeout : %ld (sec)",x->timeout); | 162 | if (BIO_printf(bp, "\n Timeout : %ld (sec)",x->timeout) <= 0) goto err; |
163 | if (BIO_puts(bp,str) <= 0) goto err; | ||
164 | } | 163 | } |
165 | if (BIO_puts(bp,"\n") <= 0) goto err; | 164 | if (BIO_puts(bp,"\n") <= 0) goto err; |
166 | 165 | ||
167 | if (BIO_puts(bp, " Verify return code: ") <= 0) goto err; | 166 | if (BIO_puts(bp, " Verify return code: ") <= 0) goto err; |
168 | sprintf(str, "%ld (%s)\n", x->verify_result, | 167 | if (BIO_printf(bp, "%ld (%s)\n", x->verify_result, |
169 | X509_verify_cert_error_string(x->verify_result)); | 168 | X509_verify_cert_error_string(x->verify_result)) <= 0) goto err; |
170 | if (BIO_puts(bp,str) <= 0) goto err; | ||
171 | 169 | ||
172 | return(1); | 170 | return(1); |
173 | err: | 171 | err: |