Commit Graph

4 Commits

Author SHA1 Message Date
Hanno Becker
b769db8c66 Populate TLS <= 1.2 handshake source files
This commit moves generic/client/server handshake handling
code from ssl_tls.c, ssl_cli.c and ssl_srv.c to the newly
created files ssl_12_gen.c, ssl_12_cli.c and ssl_12_srv.c.

No functional changes have been made. Changes are confined to
moving, reordering, and commenting the code for ease of reading.
2020-02-03 14:24:01 +00:00
Hanno Becker
bef2d91478 Declare newly shared ssl functions in a header file
This commit makes some SSL functions public-internal -- moving them to
to the mbedtls_ namespace but declaring them within ssl_internal.h --
which a currently shared between the SSL logic layer implementation in
ssl_tls.c and the SSL messaging layer implementation in ssl_msg.c
2020-02-03 14:16:46 +00:00
Hanno Becker
2259887543 Move messaging layer functionality to ssl_msg.c
Broadly, the file `ssl_tls.c` functionality from two categories:

1) An implementation of the TLS and DTLS messaging layer, that is,
   the record layer as well as the DTLS retransmission state machine.

2) Handshake parsing and writing functions shared between client and
   server (functions specific to either client or server are implemented
   in ssl_cli.c and ssl_srv.c, respectively).

This commit is a first step towards separating those functionalities
by moving a number of messaging layer related functions from ssl_tls.c
to the newly created ssl_msg.c.

Because of implementation-specific dependencies between handshake logic
and messaging layer, a number of internal SSL functions are currently
used from both the handshake and the messaging layer. Those functions
will need to made public internal (i.e. declared in the mbedtls_ name-
space in ssl_internal.h), but this is left for the next commit in order
to ease review through `git diff --color-moved`. Also, the analysis of
whether their use can/should be restricted to either ssl_tls.c or ssl_msg.c
is left for future commits.
2020-02-03 14:15:11 +00:00
Hanno Becker
ee8e523768 Create copies ssl_msg.c and ssl_tls_old.c of ssl_tls.c
This commit is the first step in implementing the TLS handshake logic
and the low-level (D)TLS messaging functionality (record layer and
retransmission state machine) in separate source files. So far, they're
both implemented in ssl_tls.c.

To begin, this commit creates unmodified copies ssl_tls_old.c and ssl_msg.c
of ssl_tls.c, which in turn is deleted. Subsequent commits will then rename
ssl_tls_old.c back into ssl_tls.c and remove code so that each piece of
functionality is contained in precisely one of ssl_tls.c or ssl_msg.c.

This approach allows to maintain the git line history.
2020-02-03 09:30:59 +00:00