diff options
author | Matt Caswell <matt@openssl.org> | 2016-10-31 11:00:45 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-11-02 14:08:21 +0100 |
commit | 2abacef13ab19b842a9217d6c464b4001980c0f6 (patch) | |
tree | 23606897ad6b9b8a4e69da0c4d48f2aaabe50ac5 /ssl | |
parent | Update Configure to know about tls1_3 (diff) | |
download | openssl-2abacef13ab19b842a9217d6c464b4001980c0f6.tar.xz openssl-2abacef13ab19b842a9217d6c464b4001980c0f6.zip |
Convert a big "if" into a "switch"
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/ssl_lib.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 84dd39371a..67eee74bf5 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -3072,24 +3072,35 @@ const SSL_METHOD *ssl_bad_method(int ver) const char *ssl_protocol_to_string(int version) { - if (version == TLS1_3_VERSION) + switch(version) + { + case TLS1_3_VERSION: return "TLSv1.3"; - else if (version == TLS1_2_VERSION) + + case TLS1_2_VERSION: return "TLSv1.2"; - else if (version == TLS1_1_VERSION) + + case TLS1_1_VERSION: return "TLSv1.1"; - else if (version == TLS1_VERSION) + + case TLS1_VERSION: return "TLSv1"; - else if (version == SSL3_VERSION) + + case SSL3_VERSION: return "SSLv3"; - else if (version == DTLS1_BAD_VER) + + case DTLS1_BAD_VER: return "DTLSv0.9"; - else if (version == DTLS1_VERSION) + + case DTLS1_VERSION: return "DTLSv1"; - else if (version == DTLS1_2_VERSION) + + case DTLS1_2_VERSION: return "DTLSv1.2"; - else - return ("unknown"); + + default: + return "unknown"; + } } const char *SSL_get_version(const SSL *s) |