net: lwm2m: add custom TLS credential load function pointer
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: https://github.com/zephyrproject-rtos/zephyr/issues/17408 Signed-off-by: Michael Scott <mike@foundries.io>
This commit is contained in:
parent
d7e49ee3e7
commit
e7155622a2
2 changed files with 19 additions and 7 deletions
|
@ -3992,14 +3992,21 @@ int lwm2m_socket_start(struct lwm2m_ctx *client_ctx)
|
|||
#if defined(CONFIG_LWM2M_DTLS_SUPPORT)
|
||||
int ret;
|
||||
|
||||
ret = load_tls_credential(client_ctx, 3, TLS_CREDENTIAL_PSK_ID);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
if (client_ctx->load_credentials) {
|
||||
ret = client_ctx->load_credentials(client_ctx);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
ret = load_tls_credential(client_ctx, 3, TLS_CREDENTIAL_PSK_ID);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = load_tls_credential(client_ctx, 5, TLS_CREDENTIAL_PSK);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
ret = load_tls_credential(client_ctx, 5, TLS_CREDENTIAL_PSK);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (client_ctx->use_dtls) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue