Skip to content

Update offloaded TLSSocket to TLSSocket design #12089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 24, 2019
Merged

Update offloaded TLSSocket to TLSSocket design #12089

merged 2 commits into from
Dec 24, 2019

Conversation

kivaisan
Copy link
Contributor

@kivaisan kivaisan commented Dec 12, 2019

Summary of changes

Added offloded TLSSocket sections into TLSSocket design document.

Code has already been merged with PR #11357.

Impact of changes

Migration actions required

Documentation


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[X] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@ciarmcom ciarmcom requested review from a team December 12, 2019 10:00
@ciarmcom
Copy link
Member

@kivaisan, thank you for your changes.
@ARMmbed/mbed-os-connectivity @ARMmbed/mbed-os-maintainers please review.

Copy link
Contributor

@michalpasztamobica michalpasztamobica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look really good to me.
I just wanted to ask for one minor update in a part which was already there (regarding DTLSSocketWrapper) and a few typo corrections.
@AnttiKauppila , a side note: should we add some more information about DTLSSocketWrapper here?

* `TLSSocket::connect()` is always blocking
* Can only use server and client certificates through `set_root_ca_cert()` and `set_client_cert_key()` methods. For other use cases, internal Mbed TLS structures are exposed.
* No PSK mode

Offloaded vs. Mbed TLS based TLSSocket:
* For offloaded TLS socket `set_root_ca_cert()` and `set_client_cert_key()` must be called after `TLSSocket::open()` and before `TLSSocket::connect()`.
* Offloaded TLS socket API does not support all Mbed TLS based TLSSocket methods, but commot (i.e. `open()`, `connect()`, `close()` and setting certficates) use the same API.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo? "commot" -> "common"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

# System Architecture and High-Level Design

Secure socket consist of two classes:
Mbed TLS based secure socket consist of two classes:

* `TLSocketWrapper` <br>
Which handles initialization of TLS library and does TLS handsake. Takes any Socket as a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this has been here before, but it is actually not true: We have a DTLSSocketWrapper for datagram sockets. Perhaps we could add an explanation here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also DTLSSocket needs to be added. But I'll create a new internal task add those, so let's leave those out from this PR.

@@ -75,13 +106,13 @@ Aim is to first support only certificate based authentication, so we implement o

## High Level Design Goal 3: Support both blocking and non-blocking operations

As the Mbed TLS is already work with both socket types, we are able to `TLSocketWrapper`
As the Mbed TLS already work with both socket types, we are able to `TLSocketWrapper`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was meant to be "As the Mbed TLS already works with both socket types, we are able to create TLSocketWrapper that can handle both types as well."
I am sorry for this nitpicking, but once we are doing some corrections, let's make them final ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. Fixed.


## Security

Offloaded TLS socket has one major security difference compared to Mbed TLS based secure socket. In Mbed TLS secure socket data is encrypted already by application processor and therefore all user data between MCU and network interface HW is encrypted. But with offloaded TLS socket, encryption happens in network stack, which can be implemented in network HW resultin in data between MCU and network HW being unencrypted (e.g. in cellular case, UART traffic between MCU and cellular modem).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo? "resultin" -> "resulting"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor

@michalpasztamobica michalpasztamobica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kivaisan , you're right. Getting this document right in face of DTLSSocketWrapper needs a separate task.
All fine with me now.

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 17, 2019

@AnotherButler can you pls review

Copy link
Contributor

@adbridge adbridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a documentation change I am going to approve this pending a copy edit by Amanda

@adbridge
Copy link
Contributor

In the interim I will kick the ci off

Edit document, mostly for clarity and missing words.
@adbridge
Copy link
Contributor

CI started

@adbridge adbridge merged commit 6e54736 into ARMmbed:master Dec 24, 2019
@adbridge adbridge added release-version: 6.0.0-alpha-1 First pre-release version of 6.0.0 and removed ready for merge labels Dec 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-version: 6.0.0-alpha-1 First pre-release version of 6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants