ssl->ctx cannot be NULL.

Most code already dereferences it directly.

Change-Id: I227fa91ecbf25a19077f7cfba21b0abd2bc2bd1d
Reviewed-on: https://boringssl-review.googlesource.com/7422
Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
David Benjamin 2016-03-10 16:33:58 -05:00
parent c087c332f8
commit 78f8aabe44
4 changed files with 14 additions and 20 deletions

View File

@ -211,7 +211,7 @@ STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl) {
return ssl->srtp_profiles; return ssl->srtp_profiles;
} }
if (ssl->ctx != NULL && ssl->ctx->srtp_profiles != NULL) { if (ssl->ctx->srtp_profiles != NULL) {
return ssl->ctx->srtp_profiles; return ssl->ctx->srtp_profiles;
} }

View File

@ -447,17 +447,15 @@ struct ssl_cipher_preference_list_st *ssl_get_cipher_preferences(SSL *ssl) {
return ssl->cipher_list; return ssl->cipher_list;
} }
if (ssl->version >= TLS1_1_VERSION && ssl->ctx != NULL && if (ssl->version >= TLS1_1_VERSION && ssl->ctx->cipher_list_tls11 != NULL) {
ssl->ctx->cipher_list_tls11 != NULL) {
return ssl->ctx->cipher_list_tls11; return ssl->ctx->cipher_list_tls11;
} }
if (ssl->version >= TLS1_VERSION && ssl->ctx != NULL && if (ssl->version >= TLS1_VERSION && ssl->ctx->cipher_list_tls10 != NULL) {
ssl->ctx->cipher_list_tls10 != NULL) {
return ssl->ctx->cipher_list_tls10; return ssl->ctx->cipher_list_tls10;
} }
if (ssl->ctx != NULL && ssl->ctx->cipher_list != NULL) { if (ssl->ctx->cipher_list != NULL) {
return ssl->ctx->cipher_list; return ssl->ctx->cipher_list;
} }

View File

@ -1259,17 +1259,15 @@ STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl) {
return ssl->cipher_list->ciphers; return ssl->cipher_list->ciphers;
} }
if (ssl->version >= TLS1_1_VERSION && ssl->ctx != NULL && if (ssl->version >= TLS1_1_VERSION && ssl->ctx->cipher_list_tls11 != NULL) {
ssl->ctx->cipher_list_tls11 != NULL) {
return ssl->ctx->cipher_list_tls11->ciphers; return ssl->ctx->cipher_list_tls11->ciphers;
} }
if (ssl->version >= TLS1_VERSION && ssl->ctx != NULL && if (ssl->version >= TLS1_VERSION && ssl->ctx->cipher_list_tls10 != NULL) {
ssl->ctx->cipher_list_tls10 != NULL) {
return ssl->ctx->cipher_list_tls10->ciphers; return ssl->ctx->cipher_list_tls10->ciphers;
} }
if (ssl->ctx != NULL && ssl->ctx->cipher_list != NULL) { if (ssl->ctx->cipher_list != NULL) {
return ssl->ctx->cipher_list->ciphers; return ssl->ctx->cipher_list->ciphers;
} }
@ -1287,7 +1285,7 @@ STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *ssl) {
return ssl->cipher_list_by_id; return ssl->cipher_list_by_id;
} }
if (ssl->ctx != NULL && ssl->ctx->cipher_list_by_id != NULL) { if (ssl->ctx->cipher_list_by_id != NULL) {
return ssl->ctx->cipher_list_by_id; return ssl->ctx->cipher_list_by_id;
} }

View File

@ -2367,11 +2367,10 @@ static int ssl_check_clienthello_tlsext(SSL *ssl) {
int ret = SSL_TLSEXT_ERR_NOACK; int ret = SSL_TLSEXT_ERR_NOACK;
int al = SSL_AD_UNRECOGNIZED_NAME; int al = SSL_AD_UNRECOGNIZED_NAME;
if (ssl->ctx != NULL && ssl->ctx->tlsext_servername_callback != 0) { if (ssl->ctx->tlsext_servername_callback != 0) {
ret = ssl->ctx->tlsext_servername_callback(ssl, &al, ret = ssl->ctx->tlsext_servername_callback(ssl, &al,
ssl->ctx->tlsext_servername_arg); ssl->ctx->tlsext_servername_arg);
} else if (ssl->initial_ctx != NULL && } else if (ssl->initial_ctx->tlsext_servername_callback != 0) {
ssl->initial_ctx->tlsext_servername_callback != 0) {
ret = ssl->initial_ctx->tlsext_servername_callback( ret = ssl->initial_ctx->tlsext_servername_callback(
ssl, &al, ssl->initial_ctx->tlsext_servername_arg); ssl, &al, ssl->initial_ctx->tlsext_servername_arg);
} }
@ -2398,11 +2397,10 @@ static int ssl_check_serverhello_tlsext(SSL *ssl) {
int ret = SSL_TLSEXT_ERR_OK; int ret = SSL_TLSEXT_ERR_OK;
int al = SSL_AD_UNRECOGNIZED_NAME; int al = SSL_AD_UNRECOGNIZED_NAME;
if (ssl->ctx != NULL && ssl->ctx->tlsext_servername_callback != 0) { if (ssl->ctx->tlsext_servername_callback != 0) {
ret = ssl->ctx->tlsext_servername_callback(ssl, &al, ret = ssl->ctx->tlsext_servername_callback(ssl, &al,
ssl->ctx->tlsext_servername_arg); ssl->ctx->tlsext_servername_arg);
} else if (ssl->initial_ctx != NULL && } else if (ssl->initial_ctx->tlsext_servername_callback != 0) {
ssl->initial_ctx->tlsext_servername_callback != 0) {
ret = ssl->initial_ctx->tlsext_servername_callback( ret = ssl->initial_ctx->tlsext_servername_callback(
ssl, &al, ssl->initial_ctx->tlsext_servername_arg); ssl, &al, ssl->initial_ctx->tlsext_servername_arg);
} }