Change HANDSHAKE_STATE to OSSL_HANDSHAKE_STATE

Rename the enum HANDSHAKE_STATE to OSSL_HANDSHAKE_STATE to ensure there are
no namespace clashes, and convert it into a typedef.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Matt Caswell 2015-10-05 10:18:06 +01:00
parent a455d0f6ff
commit 35bf6e0537
5 changed files with 12 additions and 12 deletions

View File

@ -8,11 +8,11 @@
refactored in order to remove much duplication of code and solve issues refactored in order to remove much duplication of code and solve issues
with the old code (see ssl/statem/README for further details). This change with the old code (see ssl/statem/README for further details). This change
does have some associated API changes. Notably SSL_get_state/SSL_state now does have some associated API changes. Notably SSL_get_state/SSL_state now
returns an "enum HANDSHAKE_STATE" instead of an int. The previous handshake returns an "OSSL_HANDSHAKE_STATE" instead of an int. The previous handshake
states defined in ssl.h and ssl3.h have been redefined to be the nearest states defined in ssl.h and ssl3.h have been redefined to be the nearest
equivalent HANDSHAKE_STATE value. Not all states have an equivalent value, equivalent OSS_HANDSHAKE_STATE value. Not all states have an equivalent
(e.g. SSL_ST_CW_FLUSH). New application code should not use the old value, (e.g. SSL_ST_CW_FLUSH). New application code should not use the old
handshake state values, but should instead use HANDSHAKE_STATE. handshake state values, but should instead use OSSL_HANDSHAKE_STATE.
[Matt Caswell] [Matt Caswell]
*) The demo files in crypto/threads were moved to demo/threads. *) The demo files in crypto/threads were moved to demo/threads.

View File

@ -624,7 +624,7 @@ success or 0 on failure.
=item int B<SSL_shutdown>(SSL *ssl); =item int B<SSL_shutdown>(SSL *ssl);
=item enum HANDSHAKE_STATE B<SSL_state>(const SSL *ssl); =item OSSL_HANDSHAKE_STATE B<SSL_state>(const SSL *ssl);
Returns the current handshake state. Returns the current handshake state.

View File

@ -933,7 +933,7 @@ extern "C" {
* TLS_ST_BEFORE = No handshake has been initiated yet * TLS_ST_BEFORE = No handshake has been initiated yet
* TLS_ST_OK = A handshake has been successfully completed * TLS_ST_OK = A handshake has been successfully completed
*/ */
enum HANDSHAKE_STATE { typedef enum {
TLS_ST_BEFORE, TLS_ST_BEFORE,
TLS_ST_OK, TLS_ST_OK,
DTLS_ST_CR_HELLO_VERIFY_REQUEST, DTLS_ST_CR_HELLO_VERIFY_REQUEST,
@ -971,7 +971,7 @@ enum HANDSHAKE_STATE {
TLS_ST_SW_CERT_STATUS, TLS_ST_SW_CERT_STATUS,
TLS_ST_SW_CHANGE, TLS_ST_SW_CHANGE,
TLS_ST_SW_FINISHED TLS_ST_SW_FINISHED
}; } OSSL_HANDSHAKE_STATE;
/* /*
* Most of the following state values are no longer used and are defined to be * Most of the following state values are no longer used and are defined to be
@ -1700,8 +1700,8 @@ void SSL_set_info_callback(SSL *ssl,
void (*cb) (const SSL *ssl, int type, int val)); void (*cb) (const SSL *ssl, int type, int val));
void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type,
int val); int val);
__owur enum HANDSHAKE_STATE SSL_state(const SSL *ssl); __owur OSSL_HANDSHAKE_STATE SSL_state(const SSL *ssl);
void SSL_set_state(SSL *ssl, enum HANDSHAKE_STATE state); void SSL_set_state(SSL *ssl, OSSL_HANDSHAKE_STATE state);
void SSL_set_verify_result(SSL *ssl, long v); void SSL_set_verify_result(SSL *ssl, long v);
__owur long SSL_get_verify_result(const SSL *ssl); __owur long SSL_get_verify_result(const SSL *ssl);

View File

@ -110,12 +110,12 @@ static enum SUB_STATE_RETURN read_state_machine(SSL *s);
static void init_write_state_machine(SSL *s); static void init_write_state_machine(SSL *s);
static enum SUB_STATE_RETURN write_state_machine(SSL *s); static enum SUB_STATE_RETURN write_state_machine(SSL *s);
enum HANDSHAKE_STATE SSL_state(const SSL *ssl) OSSL_HANDSHAKE_STATE SSL_state(const SSL *ssl)
{ {
return ssl->statem.hand_state; return ssl->statem.hand_state;
} }
void SSL_set_state(SSL *ssl, enum HANDSHAKE_STATE state) void SSL_set_state(SSL *ssl, OSSL_HANDSHAKE_STATE state)
{ {
/* /*
* This function seems like a really bad idea. Should we remove it * This function seems like a really bad idea. Should we remove it

View File

@ -132,7 +132,7 @@ struct statem_st {
enum WORK_STATE write_state_work; enum WORK_STATE write_state_work;
enum READ_STATE read_state; enum READ_STATE read_state;
enum WORK_STATE read_state_work; enum WORK_STATE read_state_work;
enum HANDSHAKE_STATE hand_state; OSSL_HANDSHAKE_STATE hand_state;
int in_init; int in_init;
int read_state_first_init; int read_state_first_init;
int use_timer; int use_timer;