Fix some dead code in tortls.c

If SSL_CIPHER_find exists, then we won't use either of the two
kludges that would replace it.

Found by Coverity; fixes CID 1340256.
This commit is contained in:
Nick Mathewson 2015-12-18 10:04:01 -05:00
parent 4604b3ab19
commit 9e2c4ee557

View File

@ -1322,7 +1322,8 @@ find_cipher_by_id(const SSL *ssl, const SSL_METHOD *m, uint16_t cipher)
tor_assert((SSL_CIPHER_get_id(c) & 0xffff) == cipher); tor_assert((SSL_CIPHER_get_id(c) & 0xffff) == cipher);
return c != NULL; return c != NULL;
} }
#elif defined(HAVE_STRUCT_SSL_METHOD_ST_GET_CIPHER_BY_CHAR) #else
#if defined(HAVE_STRUCT_SSL_METHOD_ST_GET_CIPHER_BY_CHAR)
if (m && m->get_cipher_by_char) { if (m && m->get_cipher_by_char) {
unsigned char cipherid[3]; unsigned char cipherid[3];
set_uint16(cipherid, htons(cipher)); set_uint16(cipherid, htons(cipher));
@ -1333,7 +1334,7 @@ find_cipher_by_id(const SSL *ssl, const SSL_METHOD *m, uint16_t cipher)
if (c) if (c)
tor_assert((c->id & 0xffff) == cipher); tor_assert((c->id & 0xffff) == cipher);
return c != NULL; return c != NULL;
} else }
#endif #endif
#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0) #if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
if (m && m->get_cipher && m->num_ciphers) { if (m && m->get_cipher && m->num_ciphers) {
@ -1350,6 +1351,7 @@ find_cipher_by_id(const SSL *ssl, const SSL_METHOD *m, uint16_t cipher)
} }
return 0; return 0;
} }
#endif
#endif #endif
(void) ssl; (void) ssl;
(void) m; (void) m;