Added support for security1 in local control

1. Added config options to chose from protocom security.
    It can be chosen 0/1 or custom.
    Possible to set POP as well

2. Added support in `esp_local_ctrl.py` test script for sec_ver selection

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
This commit is contained in:
Vikram Dattu
2021-05-31 11:05:21 +05:30
committed by bot
parent 375145ecdb
commit 5691c9a8e8
8 changed files with 240 additions and 36 deletions

View File

@@ -19,6 +19,7 @@
#include <protocomm.h>
#include <protocomm_security0.h>
#include <protocomm_security1.h>
#include <esp_local_ctrl.h>
#include "esp_local_ctrl_priv.h"
@@ -149,8 +150,21 @@ esp_err_t esp_local_ctrl_start(const esp_local_ctrl_config_t *config)
return ret;
}
protocomm_security_t *proto_sec_handle;
switch (local_ctrl_inst_ctx->config.proto_sec.version) {
case PROTOCOM_SEC_CUSTOM:
proto_sec_handle = local_ctrl_inst_ctx->config.proto_sec.custom_handle;
break;
case PROTOCOM_SEC1:
proto_sec_handle = (protocomm_security_t *) &protocomm_security1;
break;
case PROTOCOM_SEC0:
default:
proto_sec_handle = (protocomm_security_t *) &protocomm_security0;
break;
}
ret = protocomm_set_security(local_ctrl_inst_ctx->pc, "esp_local_ctrl/session",
&protocomm_security0, NULL);
proto_sec_handle, local_ctrl_inst_ctx->config.proto_sec.pop);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "Failed to set session endpoint");
esp_local_ctrl_stop();