Saving the SessionID/Ticket and rebooting. What is needed?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Saving the SessionID/Ticket and rebooting. What is needed?

Peter Sand
Hello,
My current solution is a cut down version of OpenSSL adapted for an embedded solution.
So there is no filesystem etc.
A lot of underlying functions are stubbed.
 
I currently can save the SSL_SESSION in RAM and reuse it as SSL Session ID when reconnecting.
The idea is to save it in Flash and reuse after power on again.
 
I've looked at saving the Session like it is done in
 s_client -sess_out arg / -sess_in arg
but a lot of functions to serialize SSL_SESSION
 ssl.h : PEM_read_bio_SSL_SESSION()
 ssl.h : PEM_write_bio_SSL_SESSION()
are unfortuneately stubbed way below.
And I have no filesystem...

I have started looking at options.
Questions
1. Am I correct to observe that I have to save the whole SSL_SESSION to be able to use the SSL Session ID?
 
2. Is my assumption correct: Would it be enough to save the TLS Ticket IDs length & data?
 
3. I tried to just save the TLS Ticket ID but I cannot get it to work.
a. SSL_CTX_get_tlsext_ticket_keys()  -> FLASH
b. REBOOT
c. Init stuff
d. FLASH -> SSL_CTX_set_tlsext_ticket_keys()
e. Connect (does not work)
Can somebody please verify that this should work or not?
 
4. Any way to avoid saving the whole SSL_SESSION?
 
5. Any other way to do it? :)
 
Thanks in advance!
Peter
Reply | Threaded
Open this post in threaded view
|

Re: Saving the SessionID/Ticket and rebooting. What is needed?

Viktor Dukhovni
On Wed, Mar 06, 2013 at 08:37:06PM +0100, Peter Sand wrote:

> I currently can save the SSL_SESSION in RAM and reuse it as SSL Session ID
> when reconnecting.
> The idea is to save it in Flash and reuse after power on again.
>
> I've looked at saving the Session like it is done in
>  s_client -sess_out arg / -sess_in arg
> but a lot of functions to serialize SSL_SESSION
>  ssl.h : PEM_read_bio_SSL_SESSION()
>  ssl.h : PEM_write_bio_SSL_SESSION()
> are unfortuneately stubbed way below.
> And I have no filesystem...

All you need is i2d_SSL_SESSION and d2i_SSL_SESSION, so no PEM
routines required. Just store the result of i2d in RAM and after
reboot run d2i and re-use the resulting session.

The session object stores the peer certificate so be prepared for
up to 16K of data (though in practice 1K is closer).

This said, what's wrong with not saving the session across reboot?
Just negotiate a new one. Saving session keys in non-volatile memory
poses a greater risk of compromise.

> 1. Am I correct to observe that I have to save the whole SSL_SESSION to be
> able to use the SSL Session ID?

Yes.

> 2. Is my assumption correct: Would it be enough to save the TLS Ticket IDs
> length & data?

IIRC you don't need to explicitly manage session tickets they're
part of the serialized session.

> 4. Any way to avoid saving the whole SSL_SESSION?

Save the whole session.

--
        Viktor.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
T J
Reply | Threaded
Open this post in threaded view
|

Re: Saving the SessionID/Ticket and rebooting. What is needed?

T J
In reply to this post by Peter Sand
Have you looked at http://www.matrixssl.org/ ?

On 07/03/13 08:37, Peter Sand wrote:

> Hello,
> My current solution is a cut down version of OpenSSL adapted for an
> embedded solution.
> So there is no filesystem etc.
> A lot of underlying functions are stubbed.
> I currently can save the SSL_SESSION in RAM and reuse it as SSL
> Session ID when reconnecting.
> The idea is to save it in Flash and reuse after power on again.
> I've looked at saving the Session like it is done in
>  s_client -sess_out arg / -sess_in arg
> but a lot of functions to serialize SSL_SESSION
>  ssl.h : PEM_read_bio_SSL_SESSION()
>  ssl.h : PEM_write_bio_SSL_SESSION()
> are unfortuneately stubbed way below.
> And I have no filesystem...
>
> I have started looking at options.
> Questions
> 1. Am I correct to observe that I have to save the whole SSL_SESSION
> to be able to use the SSL Session ID?
> 2. Is my assumption correct: Would it be enough to save the TLS Ticket
> IDs length & data?
> 3. I tried to just save the TLS Ticket ID but I cannot get it to work.
> a. SSL_CTX_get_tlsext_ticket_keys()  -> FLASH
> b. REBOOT
> c. Init stuff
> d. FLASH -> SSL_CTX_set_tlsext_ticket_keys()
> e. Connect (does not work)
> Can somebody please verify that this should work or not?
> 4. Any way to avoid saving the whole SSL_SESSION?
> 5. Any other way to do it? :)
> Thanks in advance!
> Peter

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]