Skip to content

Optimize Connection Memory Usage once Handshake is complete #158

@wbudd

Description

@wbudd

s2n -- finally a well-designed TLS library! As far as I'm concerned there is still some noise among the signal though: TLS renegotiation support is a feature that doesn't solve any real world problem of significance, while having a history of being repeatedly exploited directly and indirectly in various TLS attacks (e.g., the "renegotiation attack" and "the triple handshake attack").

Besides the numerous security benefits of eliminating this attack vector, scrapping this non-feature would also have the benefit of being able to do away with much of the data bloat that currently exists in the s2n_connection struct: the presence of two full sized 4088 byte s2n_crypto_parameters structs ("active" and "pending"). Without renegotiation support, only one s2n_crypto_parameters struct is needed (given that no negotiation would ever occur while the parameters are in use), reducing the size of the s2n_connection struct by 36% from 11488 bytes to 7400 bytes (on X86_64).

BTW: Even if TLS renegotiation support is deemed indispensable, a large volume of memory savings should still be possible in the connection struct. One idea relatively easily implemented would be to put all mutually/temporally exclusive state in unions (e.g, union { struct s2n_handshake, struct s2n_data_that_is_only_relevant_after_the_handshake}), but let's call that a separate issue.

I know performance considerations are at the bottom of the list of priorities for s2n, but for servers routinely handling 1000s of simultaneous TLS connections, shaving of multiple KB per connection is not insignificant, I think.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions