mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-23 08:49:59 +00:00
!8071 bug fix: add get AesCtrCipherKey iv func
Merge pull request !8071 from ym/master
This commit is contained in:
commit
1d4a12cbe0
@ -70,6 +70,8 @@ bool JSON_AddBytesToObject(JsonObj *obj, const char *key, uint8_t *value, uint32
|
||||
|
||||
bool JSON_GetBytesFromObject(const JsonObj *obj, const char *key, uint8_t *value, uint32_t bufLen, uint32_t *size);
|
||||
|
||||
bool JSON_IsArrayExist(const JsonObj *obj, const char *key);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
@ -371,3 +371,22 @@ bool JSON_GetBytesFromObject(const JsonObj *obj, const char *key, uint8_t *value
|
||||
*size = bytes.size();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JSON_IsArrayExist(const JsonObj *obj, const char *key)
|
||||
{
|
||||
if (obj == nullptr || key == nullptr) {
|
||||
COMM_LOGE(COMM_ADAPTER, "input invalid");
|
||||
return false;
|
||||
}
|
||||
nlohmann::json *json = reinterpret_cast<nlohmann::json *>(obj->context);
|
||||
if (json == nullptr) {
|
||||
COMM_LOGE(COMM_ADAPTER, "invaild json param");
|
||||
return false;
|
||||
}
|
||||
if (!json->contains(key)) {
|
||||
COMM_LOGW(COMM_ADAPTER, "key does not exist");
|
||||
return false;
|
||||
}
|
||||
nlohmann::json item = (*json)[key];
|
||||
return item.is_array();
|
||||
}
|
@ -35,9 +35,9 @@ typedef struct {
|
||||
|
||||
int32_t LnnInitCipherKeyManager(void);
|
||||
void LnnDeinitCipherKeyManager(void);
|
||||
bool GetCipherKeyByNetworkId(const char *networkId, int32_t seq, uint32_t tableIndex, unsigned char *key,
|
||||
bool GetCipherKeyByNetworkId(const char *networkId, int32_t seq, uint32_t tableIndex, AesCtrCipherKey *cipherkey,
|
||||
int32_t keyLen);
|
||||
bool GetLocalCipherKey(int32_t seq, uint32_t *tableIndex, unsigned char *key, int32_t keyLen);
|
||||
bool GetLocalCipherKey(int32_t seq, uint32_t *tableIndex, AesCtrCipherKey *cipherkey, int32_t keyLen);
|
||||
void LoadBleBroadcastKey(void);
|
||||
bool IsCipherManagerFindKey(const char *udid);
|
||||
bool PackCipherKeySyncMsg(void *json);
|
||||
|
@ -29,14 +29,23 @@ void LnnDeinitCipherKeyManager(void)
|
||||
LNN_LOGI(LNN_INIT, "Deinit virtual lnn cipherkey manager");
|
||||
}
|
||||
|
||||
bool GetCipherKeyByNetworkId(const char *networkId, int32_t seq, uint32_t tableIndex, unsigned char *key,
|
||||
bool GetCipherKeyByNetworkId(const char *networkId, int32_t seq, uint32_t tableIndex, AesCtrCipherKey *cipherkey,
|
||||
int32_t keyLen)
|
||||
{
|
||||
(void)networkId;
|
||||
(void)seq;
|
||||
(void)tableIndex;
|
||||
(void)cipherkey;
|
||||
(void)keyLen;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetLocalCipherKey(int32_t seq, uint32_t *tableIndex, unsigned char *key, int32_t keyLen)
|
||||
bool GetLocalCipherKey(int32_t seq, uint32_t *tableIndex, AesCtrCipherKey *cipherkey, int32_t keyLen)
|
||||
{
|
||||
(void)seq;
|
||||
(void)tableIndex;
|
||||
(void)cipherkey;
|
||||
(void)keyLen;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user