Program cannot determine whether to call client or server routines
The defect occurs when you call one of these functions without explicitly setting the connection method of the TLS/SSL context.
SSL_read
SSL_write
SSL_do_handshake
The communication between server and client entities that use a TLS/SSL connection begins with a handshake. During the handshake, the parties exchange information and establish the encryption algorithm and session keys the parties use during the session. The connection methods for the server and client use different routines for the handshake.
The checker raises no defect if:
You use SSL_connect (client) and SSL_accept
(server) functions. These functions set the correct handshake routines
automatically.
You pass the SSL context as an argument to the function that calls
SSL_new.
You declare the SSL context outside the scope of the function handling the connection.
You cannot begin a handshake if the SSL engine does not know which connection method routines to call.
For client handshake routines, call SSL_set_connect_state before
you begin the handshake.
For server handshake routines, call SSL_set_accept_state before
you begin the handshake.
| Group: Cryptography |
| Language: C | C++ |
| Default: Off |
Command-Line Syntax:
CRYPTO_SSL_NO_ROLE |
| Impact: Medium |
| CWE ID: 304, 322, 573 |