Thanks for the reply. However I got more questions after seeing the response: 

1. Does SSL_CTX keeps the session object for future reuse (or session
resumption)? 

2. How many of session objects does SSL_CTX try to keep (max bound of unfreed
session objects)?

2. What (harm) will happen if I do explicit SSL_SESSION_free() after I call
SSL_free() to get rid of the session object?

Thanks.

Aslam wrote:
> 
> one reference is hold by SSL_CTX's lhash, if I'm not wrong, so when u call
> SSL_CTX_free, session object get freed. Its required for session lookup on
> SSL_CTX basis..
> 
> Aslam
> 
> -----Original Message-----
> From: Haihong Wang [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 10, 2002 2:43 PM
> To: [EMAIL PROTECTED]
> Subject: reference count of SSL session
> 
> Hi, all, I am writing some programs using openssl 0.9.6 and get some
> puzzling
> questions about reference count in the SSL session. Basically, I am looking
> into
> the internal data structure of SSL_SESSION:
> 
> ...
>        int references;
> } SSL_SESSION;
> 
> as defined in openssl/ssl.h
> 
> And from my understanding of ssl source code, the field is indeed used for
> reference counting purpose (if it drops to zero, the whole structure is
> freed).
> What is puzzling is that when a fresh SSL_connect() succeeds, I use
> SSL_get_session() to retrieve the SSL_SESSION point, and prints the
> references
> field, it is 2. After I call SSL_free(), it is 1. There is no sharing of
> session
> whatsoever (one connection in my program).
> 
> Does this mean there is memory leak for the session object? Or there is some
> magic somewhere else? Or my understanding is not correct?
> 
> Any suggestion/help is welcomed. Thanks.
> 
> --
> ~~~~~~~~~~~~~~~~~~~~
> Haihong Wang                    Software Engineer
> Voice: 408-853-6974             Email: [EMAIL PROTECTED]
> Cisco Systems, Inc.
> ~~~~~~~~~~~~~~~~~~~~
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]

-- 
~~~~~~~~~~~~~~~~~~~~
Haihong Wang                    Software Engineer
Voice: 408-853-6974             Email: [EMAIL PROTECTED]
Cisco Systems, Inc.
~~~~~~~~~~~~~~~~~~~~
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to