[FL-1490] FuriHal: crypto api. Crypto cli tool. (#702)
* FuriHal: crypto layer * Furi: add crash routine. * FuriHal: crypto api. Crypto: cli command to manipulate secure enclave and encrypt/decrypt plain text. * DeviceInfo: secure enclave verification. * Rename original to enclave_valid * Update expected enclave signature to match production keys * F7: remove unused files
This commit is contained in:
@@ -14,6 +14,22 @@ size_t args_length(string_t args) {
|
||||
return string_size(args);
|
||||
}
|
||||
|
||||
bool args_read_int_and_trim(string_t args, int* value) {
|
||||
size_t cmd_length = args_get_first_word_length(args);
|
||||
|
||||
if(cmd_length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sscanf(string_get_cstr(args), "%d", value) == 1) {
|
||||
string_right(args, cmd_length);
|
||||
string_strim(args);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool args_read_string_and_trim(string_t args, string_t word) {
|
||||
size_t cmd_length = args_get_first_word_length(args);
|
||||
|
||||
|
@@ -8,6 +8,15 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Extract int value and trim arguments string
|
||||
*
|
||||
* @param args - arguments string
|
||||
* @param word first argument, output
|
||||
* @return true - success
|
||||
* @return false - arguments string does not contain int
|
||||
*/
|
||||
bool args_read_int_and_trim(string_t args, int* value);
|
||||
|
||||
/**
|
||||
* @brief Extract first argument from arguments string and trim arguments string
|
||||
*
|
||||
|
Reference in New Issue
Block a user