Defines functions for parameter set lifecycle management, including initializing a parameter set, adding parameters, building a parameter set, and freeing a parameter set, as well as parameter set operations such as obtaining parameters, copying a parameter set, querying a parameter set, and checking the validity of a parameter set.
System capability: SystemCapability.Security.Huks
Since: 9
| Name | Description |
|---|---|
| native_huks_param.h | Defines the functions for constructing, using, and destroying a parameter set. |
| Name | Description |
|---|---|
| struct OH_Huks_Result OH_Huks_InitParamSet (struct OH_Huks_ParamSet **paramSet) | Initializes a parameter set and pre-allocates memory to paramSet. |
| struct OH_Huks_Result OH_Huks_AddParams (struct OH_Huks_ParamSet *paramSet, const struct OH_Huks_Param *params, uint32_t paramCnt) | Adds parameters to a parameter set. Before calling this API, call OH_Huks_InitParamSet to initialize paramSet. |
| struct OH_Huks_Result OH_Huks_BuildParamSet (struct OH_Huks_ParamSet **paramSet) | Builds a parameter set. After adding parameters to paramSet, call OH_Huks_BuildParamSet to integrate the parameter set. |
| void OH_Huks_FreeParamSet (struct OH_Huks_ParamSet **paramSet) | Frees a parameter set. |
| struct OH_Huks_Result OH_Huks_CopyParamSet (const struct OH_Huks_ParamSet *fromParamSet, uint32_t fromParamSetSize, struct OH_Huks_ParamSet **paramSet) | Copies a parameter set (deep copy). |
| struct OH_Huks_Result OH_Huks_GetParam (const struct OH_Huks_ParamSet *paramSet, uint32_t tag, struct OH_Huks_Param **param) | Obtains a parameter from a parameter set. |
| struct OH_Huks_Result OH_Huks_FreshParamSet (struct OH_Huks_ParamSet *paramSet, bool isCopy) | Updates the data of the OH_Huks_Blob type in a parameter set. |
| struct OH_Huks_Result OH_Huks_IsParamSetTagValid (const struct OH_Huks_ParamSet *paramSet) | Checks whether the parameters in a parameter set are valid. |
| struct OH_Huks_Result OH_Huks_IsParamSetValid (const struct OH_Huks_ParamSet *paramSet, uint32_t size) | Checks whether a parameter set is of the valid size. |
| struct OH_Huks_Result OH_Huks_CheckParamMatch (const struct OH_Huks_Param *baseParam, const struct OH_Huks_Param *param) | Checks whether two parameters are the same. |
| void OH_Huks_FreeKeyAliasSet (struct OH_Huks_KeyAliasSet *keyAliasSet) | Frees a key alias set. |
struct OH_Huks_Result OH_Huks_AddParams (struct OH_Huks_ParamSet * paramSet, const struct OH_Huks_Param * params, uint32_t paramCnt )
Description
Adds parameters to a parameter set.
Since: 9
Parameters
| Name | Description |
|---|---|
| paramSet | Pointer to the parameter set to which parameters are to be added. |
| params | Pointer to an array of parameters to add. |
| paramCnt | Number of parameters to add. |
Returns
Returns OH_HUKS_SUCCESS if the operation is successful; returns an error code otherwise.
struct OH_Huks_Result OH_Huks_BuildParamSet (struct OH_Huks_ParamSet ** paramSet)
Description
Builds a parameter set.
Since: 9
Parameters
| Name | Description |
|---|---|
| paramSet | Double pointer to the parameter set to build. |
Returns
Returns OH_HUKS_SUCCESS if the operation is successful; returns an error code otherwise.
struct OH_Huks_Result OH_Huks_CheckParamMatch (const struct OH_Huks_Param * baseParam, const struct OH_Huks_Param * param )
Description
Checks whether two parameters are the same.
Since: 9
Parameters
| Name | Description |
|---|---|
| baseParam | Pointer to the first parameter to compare. |
| param | Pointer to the second parameter to compare. |
Returns
Returns OH_HUKS_SUCCESS if the two parameters are the same; returns an error code otherwise.
struct OH_Huks_Result OH_Huks_CopyParamSet (const struct OH_Huks_ParamSet * fromParamSet, uint32_t fromParamSetSize, struct OH_Huks_ParamSet ** paramSet )
Description
Copies a parameter set (deep copy).
Since: 9
Parameters
| Name | Description |
|---|---|
| fromParamSet | Pointer to the parameter set to copy. |
| fromParamSetSize | Size of the memory occupied by the copied parameter set. |
| paramSet | Double pointer to the new parameter set generated. |
Returns
Returns OH_HUKS_SUCCESS if the operation is successful; returns an error code otherwise.
void OH_Huks_FreeKeyAliasSet (struct OH_Huks_KeyAliasSet * keyAliasSet)
Description
Frees a key alias set.
Since: 12
Parameters
| Name | Description |
|---|---|
| keyAliasSet | Pointer to the key alias set to free. |
void OH_Huks_FreeParamSet (struct OH_Huks_ParamSet ** paramSet)
Description
Frees a parameter set.
Since: 9
Parameters
| Name | Description |
|---|---|
| paramSet | Pointer to the parameter set to free. |
struct OH_Huks_Result OH_Huks_FreshParamSet (struct OH_Huks_ParamSet * paramSet, bool isCopy )
Description
Updates the data of the OH_Huks_Blob type in a parameter set.
Since: 9
Parameters
| Name | Description |
|---|---|
| paramSet | Pointer to the parameter set to check. |
| isCopy | Whether to copy the data. The value true means to update the address of the data of the OH_Huks_Blob type and copy the data to the parameter set. The value false means only update the address of the data of the OH_Huks_Blob type. |
Returns
Returns OH_HUKS_SUCCESS if the operation is successful; returns an error code otherwise.
struct OH_Huks_Result OH_Huks_GetParam (const struct OH_Huks_ParamSet * paramSet, uint32_t tag, struct OH_Huks_Param ** param )
Description
Obtains a parameter from a parameter set.
Since: 9
Parameters
| Name | Description |
|---|---|
| paramSet | Pointer to the parameter set to check. |
| tag | Name of the parameter to obtain. |
| param | Double pointer to the obtained parameter. |
Returns
Returns OH_HUKS_SUCCESS if the operation is successful; returns an error code otherwise.
struct OH_Huks_Result OH_Huks_InitParamSet (struct OH_Huks_ParamSet ** paramSet)
Description
Initializes a parameter set.
Since: 9
Parameters
| Name | Description |
|---|---|
| paramSet | Pointer to the parameter set to initialize. |
Returns
Returns OH_HUKS_SUCCESS if the operation is successful; returns an error code otherwise.
struct OH_Huks_Result OH_Huks_IsParamSetTagValid (const struct OH_Huks_ParamSet * paramSet)
Description
Checks whether the parameters in a parameter set are valid.
Since: 9
Parameters
| Name | Description |
|---|---|
| paramSet | Pointer to the parameter set to check. |
Returns
Returns OH_HUKS_SUCCESS if the parameters are valid. Otherwise, invalid or duplicate parameters are found.
struct OH_Huks_Result OH_Huks_IsParamSetValid (const struct OH_Huks_ParamSet * paramSet, uint32_t size )
Description
Checks whether a parameter set is of the valid size.
Since: 9
Parameters
| Name | Description |
|---|---|
| paramSet | Pointer to the parameter set to check. |
| size | Memory size occupied by the parameter set. |
Returns
Returns OH_HUKS_SUCCESS if the size of the parameter set is valid; returns an error code otherwise.