Skip to content
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

LwM2M: engine doesn't support offloaded TLS stack #17408

Closed
mike-scott opened this issue Jul 8, 2019 · 4 comments · Fixed by #17409
Closed

LwM2M: engine doesn't support offloaded TLS stack #17408

mike-scott opened this issue Jul 8, 2019 · 4 comments · Fixed by #17409
Assignees
Labels
Enhancement Changes/Updates/Additions to existing features
Milestone

Comments

@mike-scott
Copy link
Contributor

Is your enhancement proposal related to a problem? Please describe.
Right now, enabling LWM2M_DTLS_SUPPORT forces the use of TLS_CREDENTIALS lib which places credentials into RAM and is not really compatible with offloaded TLS stack where credentials will need to be sent to NCP.

Describe the solution you'd like
LwM2M subsys is a bit unique due to it's operation flow of "bootstrap" server loading the security information for next LwM2M servers. This data needs to be pulled from the loaded security object and fed into TLS credentials "on demand" by the engine.

Easiest solution (but probably not the best) would be a function pointer in the client context that could be set for loading credentials (as opposed to using tls_credential_add()).

Describe alternatives you've considered
A more complex solution would be adding hooks into the TLS credential subsystem itself for offloaded solutions. But this could be involved and mappings between credential types would need to be established on a per implementation basis, etc.

@mike-scott mike-scott added the Enhancement Changes/Updates/Additions to existing features label Jul 8, 2019
@mike-scott mike-scott added this to the v2.0.0 milestone Jul 8, 2019
@mike-scott mike-scott self-assigned this Jul 8, 2019
@mike-scott
Copy link
Contributor Author

@rlubos @GAnthony @pfalcon There is some discussion to be had here for enhancing the TLS credential subsystem vs. putting in an LwM2M specific solution where the call to tls_credential_add() could be changed to something else.

@mike-scott
Copy link
Contributor Author

add @jukkar for discussion

mike-scott added a commit to mike-scott/zephyr that referenced this issue Jul 8, 2019
Current implementation of LwM2M engine doesn't allow users a way
of overriding TLS credential load with custom function.  This
would be needed by an offloaded TLS stack where we don't want
to use standard Zephyr functions.

Let's add a load_credential function pointer to the LwM2M client
context which will be called when it's available.

Fixes: zephyrproject-rtos#17408

Signed-off-by: Michael Scott <mike@foundries.io>
@rlubos
Copy link
Contributor

rlubos commented Jul 9, 2019

I had it in the back of my head, that for offloaded solutions we might need to provide an alternative implementation of this API, which instead of keeping the credentials in RAM, would provision it into the offloaded engine.

But I think it's not only about offloaded solutions. Currently, we store the certificates/keys in RAM, which is not a safe approach. I've heard complaints about it, yet I haven't heard of any alternative proposal (I'm not even sure if there is an API for some kind of secure storage in Zephyr). Making it possible to provide alternative implementations at TLS credential subsystem level, would benefit for the native stack as well, allowing to hook up some secure storage in the future (or simply flash in case keys are provisioned run-time like in this case).

So personally, I think we should go in the direction of extending the TLS credential subsystem, especially that the API is pretty simple so it should not be a big effort. A vtable perhaps, defaulting to RAM implementation + API to update it to a custom one?

@GAnthony
Copy link
Collaborator

@vanti, FYI

One way we worked around this, for TI SimpleLink socket offload driver, we added a config option
CONFIG_TLS_CREDENTIAL_FILENAMES
which told the offload API to access credentials stored on secure flash by filename: eg:
https://github.com/zephyrproject-rtos/zephyr/blob/master/samples/net/sockets/http_get/src/ca_certificate.h
The credentials, in this case, are stored offline by a TI UniFlash tool.

But, ideally, would be good to have a Zephyr API that can store the credentials to Flash (as needed, eg, by OTA updates).

jukkar pushed a commit that referenced this issue Jul 11, 2019
Current implementation of LwM2M engine doesn't allow users a way
of overriding TLS credential load with custom function.  This
would be needed by an offloaded TLS stack where we don't want
to use standard Zephyr functions.

Let's add a load_credential function pointer to the LwM2M client
context which will be called when it's available.

Fixes: #17408

Signed-off-by: Michael Scott <mike@foundries.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants