OpenSSL: Avoid never-used analyzer warning

Use #ifdef blocks more cleanly to avoid unnecessary never-used
assignment of a variable.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-03-02 15:32:27 +02:00
parent 7b6e81575f
commit a5802c0620

View File

@ -785,12 +785,13 @@ void * tls_init(const struct tls_config *conf)
PKCS12_PBE_add();
#endif /* PKCS12_FUNCS */
} else {
context = tls_global;
#ifdef OPENSSL_SUPPORTS_CTX_APP_DATA
/* Newer OpenSSL can store app-data per-SSL */
context = tls_context_new(conf);
if (context == NULL)
return NULL;
#else /* OPENSSL_SUPPORTS_CTX_APP_DATA */
context = tls_global;
#endif /* OPENSSL_SUPPORTS_CTX_APP_DATA */
}
tls_openssl_ref_count++;
@ -988,9 +989,10 @@ struct tls_connection * tls_connection_init(void *ssl_ctx)
SSL_CTX *ssl = ssl_ctx;
struct tls_connection *conn;
long options;
struct tls_context *context = tls_global;
#ifdef OPENSSL_SUPPORTS_CTX_APP_DATA
context = SSL_CTX_get_app_data(ssl);
struct tls_context *context = SSL_CTX_get_app_data(ssl);
#else /* OPENSSL_SUPPORTS_CTX_APP_DATA */
struct tls_context *context = tls_global;
#endif /* OPENSSL_SUPPORTS_CTX_APP_DATA */
conn = os_zalloc(sizeof(*conn));