Robin Seggelmann via RT wrote:
The latest patch was modified to maintain the previous values of new_session
for legacy applications. We can either break compatibility of a few
applications, if any, by adding a new field or by adding new values. I don't
see any possibility to avoid this at all.
What legacy applications require the previous values of new_session to
be preserved ? How are those applications able to access new_session
without indirecting usage, access and interpretation of new_session via
the libssl.so library itself ?
The only user of these field(s) is libssl.so itself. The exact meaning,
usage and interpretation of the field(s) is a matter of "implementation
detail" which is encapsulated and presented to the application via the
document OpenSSL APIs.
Doing:
struct ssl_st *ssl;
ssl = SSL_new();
printf("ssl.foobar=%d\n", ssl->foobar); /* Read access is illegal */
ssl->foobar = 1; /* Write access is illegal */
Illegal on the basis that it is not a documented approach to use the
library.
There would be no compatibility issue if you change the meaning of the
ssl_st.new_session (if this is a tri-state, then use bit-0 and bit-1 to
mean the value it needs).
Move the variable "renegotiate" into bit-2 and bit-3 of
ssl_st.new_session to get the tri-state you need.
Then fixup all the code that uses ssl_st.new_session as well as your new
code that want a tri-state variable (ssl_st.renegotiate).
#define SSL_B_NEW_SESSION_0 0x00
#define SSL_B_NEW_SESSION_1 0x01
#define SSL_B_NEW_SESSION_2 0x02
#define SSL_M_NEW_SESSION 0x03
#define SSL_SET_NEW_SESSION(s) (((s)->new_session) =
(((s)->new_session) & (~SSL_M_NEW_SESSION)) | ((v) & SSL_M_NEW_SESSION))
#define SSL_TEST_EQUAL_NEW_SESSION(s, v) (((s)->new_session) &
SSL_M_NEW_SESSION) == (v))
#define SSL_TEST_NOTEQUAL_NEW_SESSION(s, v) (((s)->new_session) &
SSL_M_NEW_SESSION) != (v))
ssl->new_session = 0; /* SSL_SET_NEW_SESSION(ssl, SSL_B_NEW_SESSION_0); */
if(ssl->new_session) {} /* if(SSL_TEST_NOTEQUAL_NEW_SESSION(ssl,
SSL_B_NEW_SESSION_0)) { } */
if(!ssl->new_session) {} /* if(SSL_TEST_EQUAL_NEW_SESSION(ssl,
SSL_B_NEW_SESSION_0)) { } */
if(ssl->new_session == 2) {} /* if(SSL_TEST_EQUAL_NEW_SESSION(ssl,
SSL_B_NEW_SESSION_2)) { } */
#define SSL_B_RENEGOTIATE_0 0x00
#define SSL_B_RENEGOTIATE_1 0x04
#define SSL_B_RENEGOTIATE_2 0x08
#define SSL_M_RENEGOTIATE 0x0c
/* The rest is the same as the NEW_SESSION example
s/NEW_SESSION/RENEGOTIATE/ */
Obviously triple check the logic, make it look prettier, there are a few
extra paranoid parentesis thrown in for good measure (and to
clarify/document precedence intent), also you'd hope the "((v) &
SSL_M_NEW_SESSION))" would be optimized out by the compiler due to 2
constants being involved.
Darryl
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List openssl-dev@openssl.org
Automated List Manager majord...@openssl.org