Access SSL cipher info with a const reference.
authorZonr Chang <zonr.net@gmail.com>
Wed, 12 Oct 2016 20:16:27 +0000 (13:16 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Wed, 12 Oct 2016 20:23:53 +0000 (13:23 -0700)
Summary:
BoringSSL returns `const SSL_CIPHER*` from sk_SSL_CIPHER_value().
Closes https://github.com/facebook/folly/pull/492

Reviewed By: yfeldblum

Differential Revision: D4009712

Pulled By: Orvid

fbshipit-source-id: cca2e8cb6aab0a459dca55b8f23ef57fa5c8251f

folly/io/async/ssl/OpenSSLUtils.cpp

index 309327ed2de7f08da544f4e15d69d0dc6d1016f6..7d38cc3af591ee441fc29aaacecea3f029bf7bc9 100644 (file)
@@ -170,9 +170,7 @@ static std::unordered_map<uint16_t, std::string> getOpenSSLCipherNames() {
 
   STACK_OF(SSL_CIPHER)* sk = SSL_get_ciphers(ssl);
   for (size_t i = 0; i < (size_t)sk_SSL_CIPHER_num(sk); i++) {
-    SSL_CIPHER* c;
-
-    c = sk_SSL_CIPHER_value(sk, i);
+    const SSL_CIPHER* c = sk_SSL_CIPHER_value(sk, i);
     unsigned long id = SSL_CIPHER_get_id(c);
     // OpenSSL 1.0.2 and prior does weird things such as stuff the SSL/TLS
     // version into the top 16 bits. Let's ignore those for now. This is