diff options
author | jsing <> | 2014-07-12 19:45:53 +0000 |
---|---|---|
committer | jsing <> | 2014-07-12 19:45:53 +0000 |
commit | 7e58d56f7a655feae6127c5fb15e4042012d02f5 (patch) | |
tree | 9a0b39938bd33545c973591ba4438760ac1fb329 /src/lib/libssl/ssl_txt.c | |
parent | 975f72772307c423ba03a669c53eb1aea6f39fc1 (diff) | |
download | openbsd-7e58d56f7a655feae6127c5fb15e4042012d02f5.tar.gz openbsd-7e58d56f7a655feae6127c5fb15e4042012d02f5.tar.bz2 openbsd-7e58d56f7a655feae6127c5fb15e4042012d02f5.zip |
Provide ssl_version_string() function, which uses one of those modern C
constructs (a switch statement) and returns the appropriate string defined
by SSL_TXT_* for the given version, including support for DTLSv1 and
DTLSv1-bad. Use this function in SSL_get_version() and SSL_SESSION_print().
ok beck@
Diffstat (limited to '')
-rw-r--r-- | src/lib/libssl/ssl_txt.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/lib/libssl/ssl_txt.c b/src/lib/libssl/ssl_txt.c index 950620d300..3540bab313 100644 --- a/src/lib/libssl/ssl_txt.c +++ b/src/lib/libssl/ssl_txt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_txt.c,v 1.23 2014/07/11 09:24:44 beck Exp $ */ | 1 | /* $OpenBSD: ssl_txt.c,v 1.24 2014/07/12 19:45:53 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -112,20 +112,8 @@ SSL_SESSION_print(BIO *bp, const SSL_SESSION *x) | |||
112 | goto err; | 112 | goto err; |
113 | if (BIO_puts(bp, "SSL-Session:\n") <= 0) | 113 | if (BIO_puts(bp, "SSL-Session:\n") <= 0) |
114 | goto err; | 114 | goto err; |
115 | if (x->ssl_version == SSL3_VERSION) | 115 | |
116 | s = "SSLv3"; | 116 | s = ssl_version_string(x->ssl_version); |
117 | else if (x->ssl_version == TLS1_2_VERSION) | ||
118 | s = "TLSv1.2"; | ||
119 | else if (x->ssl_version == TLS1_1_VERSION) | ||
120 | s = "TLSv1.1"; | ||
121 | else if (x->ssl_version == TLS1_VERSION) | ||
122 | s = "TLSv1"; | ||
123 | else if (x->ssl_version == DTLS1_VERSION) | ||
124 | s = "DTLSv1"; | ||
125 | else if (x->ssl_version == DTLS1_BAD_VER) | ||
126 | s = "DTLSv1-bad"; | ||
127 | else | ||
128 | s = "unknown"; | ||
129 | if (BIO_printf(bp, " Protocol : %s\n", s) <= 0) | 117 | if (BIO_printf(bp, " Protocol : %s\n", s) <= 0) |
130 | goto err; | 118 | goto err; |
131 | 119 | ||