diff options
Diffstat (limited to 'src/lib/libssl/ssl_txt.c')
-rw-r--r-- | src/lib/libssl/ssl_txt.c | 112 |
1 files changed, 73 insertions, 39 deletions
diff --git a/src/lib/libssl/ssl_txt.c b/src/lib/libssl/ssl_txt.c index ce60e1a6dd..40b76b1b26 100644 --- a/src/lib/libssl/ssl_txt.c +++ b/src/lib/libssl/ssl_txt.c | |||
@@ -57,35 +57,31 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "buffer.h" | 60 | #include <openssl/buffer.h> |
61 | #include "ssl_locl.h" | 61 | #include "ssl_locl.h" |
62 | 62 | ||
63 | #ifndef NO_FP_API | 63 | #ifndef OPENSSL_NO_FP_API |
64 | int SSL_SESSION_print_fp(fp, x) | 64 | int SSL_SESSION_print_fp(FILE *fp, SSL_SESSION *x) |
65 | FILE *fp; | 65 | { |
66 | SSL_SESSION *x; | 66 | BIO *b; |
67 | { | 67 | int ret; |
68 | BIO *b; | ||
69 | int ret; | ||
70 | 68 | ||
71 | if ((b=BIO_new(BIO_s_file_internal())) == NULL) | 69 | if ((b=BIO_new(BIO_s_file_internal())) == NULL) |
72 | { | 70 | { |
73 | SSLerr(SSL_F_SSL_SESSION_PRINT_FP,ERR_R_BUF_LIB); | 71 | SSLerr(SSL_F_SSL_SESSION_PRINT_FP,ERR_R_BUF_LIB); |
74 | return(0); | 72 | return(0); |
75 | } | 73 | } |
76 | BIO_set_fp(b,fp,BIO_NOCLOSE); | 74 | BIO_set_fp(b,fp,BIO_NOCLOSE); |
77 | ret=SSL_SESSION_print(b,x); | 75 | ret=SSL_SESSION_print(b,x); |
78 | BIO_free(b); | 76 | BIO_free(b); |
79 | return(ret); | 77 | return(ret); |
80 | } | 78 | } |
81 | #endif | 79 | #endif |
82 | 80 | ||
83 | int SSL_SESSION_print(bp,x) | 81 | int SSL_SESSION_print(BIO *bp, SSL_SESSION *x) |
84 | BIO *bp; | ||
85 | SSL_SESSION *x; | ||
86 | { | 82 | { |
87 | int i; | 83 | unsigned int i; |
88 | char str[128],*s; | 84 | char *s; |
89 | 85 | ||
90 | if (x == NULL) goto err; | 86 | if (x == NULL) goto err; |
91 | if (BIO_puts(bp,"SSL-Session:\n") <= 0) goto err; | 87 | if (BIO_puts(bp,"SSL-Session:\n") <= 0) goto err; |
@@ -97,30 +93,41 @@ SSL_SESSION *x; | |||
97 | s="TLSv1"; | 93 | s="TLSv1"; |
98 | else | 94 | else |
99 | s="unknown"; | 95 | s="unknown"; |
100 | sprintf(str," Protocol : %s\n",s); | 96 | if (BIO_printf(bp," Protocol : %s\n",s) <= 0) goto err; |
101 | if (BIO_puts(bp,str) <= 0) goto err; | ||
102 | 97 | ||
103 | if (x->cipher == NULL) | 98 | if (x->cipher == NULL) |
104 | { | 99 | { |
105 | if (((x->cipher_id) & 0xff000000) == 0x02000000) | 100 | if (((x->cipher_id) & 0xff000000) == 0x02000000) |
106 | 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 | } | ||
107 | else | 105 | else |
108 | 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 | } | ||
109 | } | 110 | } |
110 | else | 111 | else |
111 | sprintf(str," Cipher : %s\n",(x->cipher == NULL)?"unknown":x->cipher->name); | 112 | { |
112 | 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 | } | ||
113 | if (BIO_puts(bp," Session-ID: ") <= 0) goto err; | 116 | if (BIO_puts(bp," Session-ID: ") <= 0) goto err; |
114 | for (i=0; i<(int)x->session_id_length; i++) | 117 | for (i=0; i<x->session_id_length; i++) |
118 | { | ||
119 | if (BIO_printf(bp,"%02X",x->session_id[i]) <= 0) goto err; | ||
120 | } | ||
121 | if (BIO_puts(bp,"\n Session-ID-ctx: ") <= 0) goto err; | ||
122 | for (i=0; i<x->sid_ctx_length; i++) | ||
115 | { | 123 | { |
116 | sprintf(str,"%02X",x->session_id[i]); | 124 | if (BIO_printf(bp,"%02X",x->sid_ctx[i]) <= 0) |
117 | if (BIO_puts(bp,str) <= 0) goto err; | 125 | goto err; |
118 | } | 126 | } |
119 | if (BIO_puts(bp,"\n Master-Key: ") <= 0) goto err; | 127 | if (BIO_puts(bp,"\n Master-Key: ") <= 0) goto err; |
120 | for (i=0; i<(int)x->master_key_length; i++) | 128 | for (i=0; i<(unsigned int)x->master_key_length; i++) |
121 | { | 129 | { |
122 | sprintf(str,"%02X",x->master_key[i]); | 130 | if (BIO_printf(bp,"%02X",x->master_key[i]) <= 0) goto err; |
123 | if (BIO_puts(bp,str) <= 0) goto err; | ||
124 | } | 131 | } |
125 | if (BIO_puts(bp,"\n Key-Arg : ") <= 0) goto err; | 132 | if (BIO_puts(bp,"\n Key-Arg : ") <= 0) goto err; |
126 | if (x->key_arg_length == 0) | 133 | if (x->key_arg_length == 0) |
@@ -128,22 +135,49 @@ SSL_SESSION *x; | |||
128 | if (BIO_puts(bp,"None") <= 0) goto err; | 135 | if (BIO_puts(bp,"None") <= 0) goto err; |
129 | } | 136 | } |
130 | else | 137 | else |
131 | for (i=0; i<(int)x->key_arg_length; i++) | 138 | for (i=0; i<x->key_arg_length; i++) |
132 | { | 139 | { |
133 | sprintf(str,"%02X",x->key_arg[i]); | 140 | if (BIO_printf(bp,"%02X",x->key_arg[i]) <= 0) goto err; |
134 | if (BIO_puts(bp,str) <= 0) goto err; | ||
135 | } | 141 | } |
142 | #ifndef OPENSSL_NO_KRB5 | ||
143 | if (BIO_puts(bp,"\n Krb5 Principal: ") <= 0) goto err; | ||
144 | if (x->krb5_client_princ_len == 0) | ||
145 | { | ||
146 | if (BIO_puts(bp,"None") <= 0) goto err; | ||
147 | } | ||
148 | else | ||
149 | for (i=0; i<x->krb5_client_princ_len; i++) | ||
150 | { | ||
151 | if (BIO_printf(bp,"%02X",x->krb5_client_princ[i]) <= 0) goto err; | ||
152 | } | ||
153 | #endif /* OPENSSL_NO_KRB5 */ | ||
154 | if (x->compress_meth != 0) | ||
155 | { | ||
156 | SSL_COMP *comp; | ||
157 | |||
158 | ssl_cipher_get_evp(x,NULL,NULL,&comp); | ||
159 | if (comp == NULL) | ||
160 | { | ||
161 | if (BIO_printf(bp,"\n Compression: %d",x->compress_meth) <= 0) goto err; | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | if (BIO_printf(bp,"\n Compression: %d (%s)", comp->id,comp->method->name) <= 0) goto err; | ||
166 | } | ||
167 | } | ||
136 | if (x->time != 0L) | 168 | if (x->time != 0L) |
137 | { | 169 | { |
138 | sprintf(str,"\n Start Time: %ld",x->time); | 170 | if (BIO_printf(bp, "\n Start Time: %ld",x->time) <= 0) goto err; |
139 | if (BIO_puts(bp,str) <= 0) goto err; | ||
140 | } | 171 | } |
141 | if (x->timeout != 0L) | 172 | if (x->timeout != 0L) |
142 | { | 173 | { |
143 | sprintf(str,"\n Timeout : %ld (sec)",x->timeout); | 174 | if (BIO_printf(bp, "\n Timeout : %ld (sec)",x->timeout) <= 0) goto err; |
144 | if (BIO_puts(bp,str) <= 0) goto err; | ||
145 | } | 175 | } |
146 | if (BIO_puts(bp,"\n") <= 0) goto err; | 176 | if (BIO_puts(bp,"\n") <= 0) goto err; |
177 | |||
178 | if (BIO_puts(bp, " Verify return code: ") <= 0) goto err; | ||
179 | if (BIO_printf(bp, "%ld (%s)\n", x->verify_result, | ||
180 | X509_verify_cert_error_string(x->verify_result)) <= 0) goto err; | ||
147 | 181 | ||
148 | return(1); | 182 | return(1); |
149 | err: | 183 | err: |