forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove message lowercasing on rpc * Remove redundant code * Move the csg additions to above the main method, cannot forward declare the methods * Remove message lowercasing on rpc * Add debug prints and extra getpase command * Add get pase session * Initial PASE data fetch skeleton * Add separate csg folder to hold constants and utils * Add macros * GetPaseData should return a yaml str. * Add #defines, refactor into csg utilities, deserialize yaml * Fix linter, comments, add copyright * added get_pase_data RPC * refactor methods and variables * Add PASE Response parameters * Debuggin additions * Remove debugging additions * Fix RPC to allow none values * Remove pase from BLE call * Added response, pake 1,2,3 parameters * Remove merge artifact * Remove unnecessary edits * Add debug messages * Remove debug messages * Add todo Co-authored-by: Mikael H. Moeller <[email protected]>
- Loading branch information
1 parent
6b50e56
commit 7123b1d
Showing
14 changed files
with
285 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import("//build_overrides/chip.gni") | ||
|
||
static_library("csg_test_harness") { | ||
|
||
sources = [ | ||
"utilities.cpp", | ||
"constants.h", | ||
] | ||
|
||
cflags = [ "-Wconversion" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* | ||
* Copyright (c) 2021 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
#define CHIP_CSG_TEST_HARNESS 1 | ||
|
||
#define CHARS_PER_BYTE (uint16_t)2 | ||
#include <map> | ||
#include <string> | ||
#include <stdlib.h> | ||
|
||
const char * yaml_string_for_map(std::map<std::string, std::map<std::string, std::string>> *trace_map); | ||
std::string stringForDataBuffer(const uint8_t *start, uint16_t data_length); | ||
|
||
// Message Keys | ||
extern std::string messageFromInitiator_key; | ||
extern std::string messageFromResponder_key; | ||
|
||
// Request parameter keys | ||
extern std::string PBKDFParamRequest_key; | ||
|
||
// Response parameter keys | ||
extern std::string PBKDFParamResponse_key; | ||
extern std::string PBKDFParamResponse_salt_length_key; | ||
extern std::string PBKDFParamResponse_iter_count_key; | ||
|
||
// PAKE Contribution (PAKE 1) | ||
extern std::string PAKE_1_key; | ||
extern std::string PAKE_1_Pa_key; | ||
extern std::string PAKE_1_key_id_key; | ||
|
||
// PAKE Contrib. Verification (PAKE 2) | ||
extern std::string PAKE_2_key; | ||
extern std::string PAKE_2_encryption_id_key; | ||
|
||
// PAKE Verification (PAKE 3) | ||
extern std::string PAKE_3_key; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* | ||
* Copyright (c) 2021 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "constants.h" | ||
#include <string.h> | ||
#include <iostream> | ||
|
||
// Message Payload (Initiator/Responder) keys | ||
std::string messageFromResponder_key ("MessageFromResponder"); | ||
std::string messageFromInitiator_key ("MessageFromInitiator"); | ||
|
||
// Request Parameter Keys | ||
std::string PBKDFParamRequest_key ("PBKDFParamRequest"); | ||
|
||
// Response Parameter Keys | ||
std::string PBKDFParamResponse_key ("PBKDFParamResponse"); | ||
std::string PBKDFParamResponse_salt_length_key ("SaltLength"); | ||
std::string PBKDFParamResponse_iter_count_key ("IterCount"); | ||
|
||
// PAKE Contribution (PAKE 1) | ||
std::string PAKE_1_key ("PAKE1"); | ||
std::string PAKE_1_Pa_key ("PAKEPa"); | ||
std::string PAKE_1_key_id_key ("PAKEKeyID"); | ||
|
||
std::string PAKE_2_key ("PAKE2"); | ||
std::string PAKE_2_encryption_id_key ("EncryptionID"); | ||
|
||
std::string PAKE_3_key ("PAKE3"); | ||
|
||
const char * yaml_string_for_map(std::map<std::string, std::map<std::string, std::string>> *trace_map) | ||
{ | ||
std::string result_yaml_str = ""; | ||
for (auto& x: *trace_map) { | ||
// for each message | ||
result_yaml_str += x.first; | ||
result_yaml_str += ":\n"; | ||
for (auto& y: x.second) { | ||
// for each message item | ||
result_yaml_str += " "; // indent 2 spaces for nested hash | ||
result_yaml_str += y.first; | ||
result_yaml_str += ": "; | ||
result_yaml_str += y.second; | ||
result_yaml_str += "\n"; | ||
} | ||
} | ||
|
||
char * response = new char [result_yaml_str.length()+1]; | ||
strcpy(response, result_yaml_str.c_str()); | ||
return response; | ||
} | ||
|
||
std::string stringForDataBuffer(const uint8_t *start, uint16_t data_length) | ||
{ | ||
uint16_t total_length = (uint16_t)((data_length * CHARS_PER_BYTE) + 1); | ||
char * data_string_ptr = (char *)malloc(total_length * sizeof(char)); | ||
std::string data_string; | ||
for (uint16_t i=0; i < data_length; i++) { | ||
sprintf(data_string_ptr+i*2, "%02x", start[i]); | ||
} | ||
data_string_ptr[data_length*2] = '\0'; | ||
data_string = std::string(data_string_ptr); | ||
return data_string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.