From 35bf6e05371de3aebd83dc630125a108ec4a5e70 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 5 Oct 2015 10:18:06 +0100 Subject: [PATCH] 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 Reviewed-by: Richard Levitte --- CHANGES | 8 ++++---- doc/ssl/ssl.pod | 2 +- include/openssl/ssl.h | 8 ++++---- ssl/statem/statem.c | 4 ++-- ssl/statem/statem.h | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index 2be8ecccbe..34ad35595c 100644 --- a/CHANGES +++ b/CHANGES @@ -8,11 +8,11 @@ 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 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 - equivalent HANDSHAKE_STATE value. Not all states have an equivalent value, - (e.g. SSL_ST_CW_FLUSH). New application code should not use the old - handshake state values, but should instead use HANDSHAKE_STATE. + equivalent OSS_HANDSHAKE_STATE value. Not all states have an equivalent + value, (e.g. SSL_ST_CW_FLUSH). New application code should not use the old + handshake state values, but should instead use OSSL_HANDSHAKE_STATE. [Matt Caswell] *) The demo files in crypto/threads were moved to demo/threads. diff --git a/doc/ssl/ssl.pod b/doc/ssl/ssl.pod index 03e5e0a814..c8c577d83e 100644 --- a/doc/ssl/ssl.pod +++ b/doc/ssl/ssl.pod @@ -624,7 +624,7 @@ success or 0 on failure. =item int B(SSL *ssl); -=item enum HANDSHAKE_STATE B(const SSL *ssl); +=item OSSL_HANDSHAKE_STATE B(const SSL *ssl); Returns the current handshake state. diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h index de858f6006..8570f33653 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -933,7 +933,7 @@ extern "C" { * TLS_ST_BEFORE = No handshake has been initiated yet * TLS_ST_OK = A handshake has been successfully completed */ -enum HANDSHAKE_STATE { +typedef enum { TLS_ST_BEFORE, TLS_ST_OK, DTLS_ST_CR_HELLO_VERIFY_REQUEST, @@ -971,7 +971,7 @@ enum HANDSHAKE_STATE { TLS_ST_SW_CERT_STATUS, TLS_ST_SW_CHANGE, TLS_ST_SW_FINISHED -}; +} OSSL_HANDSHAKE_STATE; /* * 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 (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, int val); -__owur enum HANDSHAKE_STATE SSL_state(const SSL *ssl); -void SSL_set_state(SSL *ssl, enum HANDSHAKE_STATE state); +__owur OSSL_HANDSHAKE_STATE SSL_state(const SSL *ssl); +void SSL_set_state(SSL *ssl, OSSL_HANDSHAKE_STATE state); void SSL_set_verify_result(SSL *ssl, long v); __owur long SSL_get_verify_result(const SSL *ssl); diff --git a/ssl/statem/statem.c b/ssl/statem/statem.c index 5032c3b267..1df669bc33 100644 --- a/ssl/statem/statem.c +++ b/ssl/statem/statem.c @@ -110,12 +110,12 @@ static enum SUB_STATE_RETURN read_state_machine(SSL *s); static void init_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; } -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 diff --git a/ssl/statem/statem.h b/ssl/statem/statem.h index 873ed0e7bf..44c1dd45bc 100644 --- a/ssl/statem/statem.h +++ b/ssl/statem/statem.h @@ -132,7 +132,7 @@ struct statem_st { enum WORK_STATE write_state_work; enum READ_STATE read_state; enum WORK_STATE read_state_work; - enum HANDSHAKE_STATE hand_state; + OSSL_HANDSHAKE_STATE hand_state; int in_init; int read_state_first_init; int use_timer; -- 2.40.0