Skip to content

Commit

Permalink
changed null check convention and fixed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
smittals2 committed Mar 12, 2024
1 parent 8631d05 commit 1d19ab7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion include/openssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,6 @@ OPENSSL_EXPORT STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *ssl);
// SSL_client_hello_get0_ciphers provides access to the client ciphers field from the
// Client Hello, optionally writing the result to an out pointer. It returns the field
// length if successful, or 0 if |ssl| is a client or the handshake hasn't occurred yet.
// Free |*out| after use if provided to the function.
OPENSSL_EXPORT size_t SSL_client_hello_get0_ciphers(SSL *ssl, const unsigned char **out);

// SSL_session_reused returns one if |ssl| performed an abbreviated handshake
Expand Down
2 changes: 1 addition & 1 deletion ssl/ssl_cipher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ const SSL_CIPHER *SSL_get_cipher_by_value(uint16_t value) {
}

const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr) {
if (ptr) {
if (ptr != nullptr) {
// Taking first element and left shit by 8 bits to set upper 8 bits.
// Bitwise OR with second element to set lower 8 bits of 16 bit integer.
uint16_t cipher_id = static_cast<uint16_t>((ptr[0] << 8) | ptr[1]);;
Expand Down
4 changes: 2 additions & 2 deletions ssl/ssl_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3318,11 +3318,11 @@ int SSL_set1_curves_list(SSL *ssl, const char *curves) {

size_t SSL_client_hello_get0_ciphers(SSL *ssl, const unsigned char **out) {
STACK_OF(SSL_CIPHER) *client_cipher_suites = SSL_get_client_ciphers(ssl);
if (!client_cipher_suites) {
if (client_cipher_suites == nullptr) {
return 0;
}

if (out) {
if (out != nullptr) {
// Called before
if(!ssl->client_cipher_suites_arr.empty()) {
*out = reinterpret_cast<unsigned char*>(ssl->client_cipher_suites_arr.data());
Expand Down

0 comments on commit 1d19ab7

Please sign in to comment.