• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# HuksParamSetApi
2
3
4## Overview
5
6Defines HUKS parameter set management capabilities, including HUKS parameter set lifecycle management such as initializing a parameter set, adding parameters, building a parameter set, and freeing a parameter set, as well as functions such as obtaining parameters, copying a parameter set, querying a parameter set, and checking the validity of a parameter set.
7
8\@syscap SystemCapability.Security.Huks
9
10 **Since**:
119
12
13
14## Summary
15
16
17### Files
18
19| Name| Description|
20| -------- | -------- |
21| [native_huks_param.h](native__huks__param_8h.md) | Provides APIs for constructing, using, and destroying parameter sets.<br>**File to include**: <huks/native_huks/native_huks_param.h><br>**Library**: libhuks_ndk.z.so|
22
23
24### Functions
25
26| Name| Description|
27| -------- | -------- |
28| [OH_Huks_InitParamSet](#oh_huks_initparamset) (struct [OH_Huks_ParamSet](_o_h___huks___param_set.md) \*\*paramSet) | Initializes a parameter set. |
29| [OH_Huks_AddParams](#oh_huks_addparams) (struct [OH_Huks_ParamSet](_o_h___huks___param_set.md) \*paramSet, const struct [OH_Huks_Param](_o_h___huks___param.md) \*params, uint32_t paramCnt) | Adds parameters to a parameter set. |
30| [OH_Huks_BuildParamSet](#oh_huks_buildparamset) (struct [OH_Huks_ParamSet](_o_h___huks___param_set.md) \*\*paramSet) | Builds a parameter set. |
31| [OH_Huks_FreeParamSet](#oh_huks_freeparamset) (struct [OH_Huks_ParamSet](_o_h___huks___param_set.md) \*\*paramSet) | Frees a parameter set. |
32| [OH_Huks_CopyParamSet](#oh_huks_copyparamset) (const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md) \*fromParamSet, uint32_t fromParamSetSize, struct [OH_Huks_ParamSet](_o_h___huks___param_set.md) \*\*paramSet) | Copies a parameter set (deep copy). |
33| [OH_Huks_GetParam](#oh_huks_getparam) (const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md) \*paramSet, uint32_t tag, struct [OH_Huks_Param](_o_h___huks___param.md) \*\*param) | Obtains a parameter from a parameter set. |
34| [OH_Huks_FreshParamSet](#oh_huks_freshparamset) (struct [OH_Huks_ParamSet](_o_h___huks___param_set.md) \*paramSet, bool isCopy) | Refreshes data of the Blob type in a parameter set. |
35| [OH_Huks_isParamSetTagValid](#oh_huks_isparamsettagvalid) (const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md) \*paramSet) | Checks whether the parameters in a parameter set are valid. |
36| [OH_Huks_isParamSetValid](#oh_huks_isparamsetvalid) (const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md) \*paramSet, uint32_t size) | Checks whether a parameter set is of the valid size. |
37| [OH_Huks_CheckParamMatch](#oh_huks_checkparammatch) (const struct [OH_Huks_Param](_o_h___huks___param.md) \*baseParam, const struct [OH_Huks_Param](_o_h___huks___param.md) \*param) | Checks whether two parameters are the same. |
38
39
40## Function Description
41
42
43### OH_Huks_AddParams()
44
45
46```
47int32_t OH_Huks_AddParams (struct OH_Huks_ParamSet * paramSet, const struct OH_Huks_Param * params, uint32_t paramCnt )
48```
49**Description**
50
51Adds parameters to a parameter set.
52
53**Parameters**
54
55| Name| Description|
56| -------- | -------- |
57| paramSet | Indicates the pointer to the parameter set to which parameters are to be added. |
58| params | Indicates the pointer to an array of parameters to add. |
59| paramCnt | Indicates the number of parameters to add. |
60
61**Returns**
62
63Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is successful; returns an error code otherwise.
64
65
66### OH_Huks_BuildParamSet()
67
68
69```
70int32_t OH_Huks_BuildParamSet (struct OH_Huks_ParamSet ** paramSet)
71```
72**Description**
73
74Builds a parameter set.
75
76**Parameters**
77
78| Name| Description|
79| -------- | -------- |
80| paramSet | Indicates the double pointer to the parameter set to build. |
81
82**Returns**
83
84Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is successful; returns an error code otherwise.
85
86
87### OH_Huks_CheckParamMatch()
88
89
90```
91int32_t OH_Huks_CheckParamMatch (const struct OH_Huks_Param * baseParam, const struct OH_Huks_Param * param )
92```
93**Description**
94
95Checks whether two parameters are the same.
96
97**Parameters**
98
99| Name| Description|
100| -------- | -------- |
101| baseParam | Indicates the pointer to the first parameter to compare. |
102| param | Indicates the pointer to the second parameter to compare. |
103
104**Returns**
105
106Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the two parameters are the same; returns an error code otherwise.
107
108
109### OH_Huks_CopyParamSet()
110
111
112```
113int32_t OH_Huks_CopyParamSet (const struct OH_Huks_ParamSet * fromParamSet, uint32_t fromParamSetSize, struct OH_Huks_ParamSet ** paramSet )
114```
115**Description**
116
117Copies a parameter set (deep copy).
118
119**Parameters**
120
121| Name| Description|
122| -------- | -------- |
123| fromParamSet | Indicates the pointer to the parameter set to copy. |
124| fromParamSetSize | Indicates the size of the memory occupied by the copied parameter set. |
125| paramSet | Indicates the double pointer to the new parameter set generated. |
126
127**Returns**
128
129Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is successful; returns an error code otherwise.
130
131
132### OH_Huks_FreeParamSet()
133
134
135```
136void OH_Huks_FreeParamSet (struct OH_Huks_ParamSet ** paramSet)
137```
138**Description**
139
140Frees a parameter set.
141
142**Parameters**
143
144| Name| Description|
145| -------- | -------- |
146| paramSet | Indicates the pointer to the parameter set to free. |
147
148
149### OH_Huks_FreshParamSet()
150
151
152```
153int32_t OH_Huks_FreshParamSet (struct OH_Huks_ParamSet * paramSet, bool isCopy )
154```
155**Description**
156
157Refreshes data of the Blob type in a parameter set.
158
159**Parameters**
160
161| Name| Description|
162| -------- | -------- |
163| paramSet | Indicates the pointer to the target parameter set. |
164| isCopy | Specifies whether to copy the data of the HksBlob type to the parameter set. |
165
166**Returns**
167
168Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is successful; returns an error code otherwise.
169
170
171### OH_Huks_GetParam()
172
173
174```
175int32_t OH_Huks_GetParam (const struct OH_Huks_ParamSet * paramSet, uint32_t tag, struct OH_Huks_Param ** param )
176```
177**Description**
178
179Obtains a parameter from a parameter set.
180
181**Parameters**
182
183| Name| Description|
184| -------- | -------- |
185| paramSet | Indicates the pointer to the target parameter set. |
186| tag | Indicates the name of the parameter to obtain. |
187| param | Indicates the double pointer to the obtained parameter. |
188
189**Returns**
190
191Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is successful; returns an error code otherwise.
192
193
194### OH_Huks_InitParamSet()
195
196
197```
198int32_t OH_Huks_InitParamSet (struct OH_Huks_ParamSet ** paramSet)
199```
200**Description**
201
202Initializes a parameter set.
203
204**Parameters**
205
206| Name| Description|
207| -------- | -------- |
208| paramSet | Indicates the pointer to the parameter set to initialize. |
209
210**Returns**
211
212Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is successful; returns an error code otherwise.
213
214
215### OH_Huks_isParamSetTagValid()
216
217
218```
219int32_t OH_Huks_isParamSetTagValid (const struct OH_Huks_ParamSet * paramSet)
220```
221**Description**
222
223Checks whether the parameters in a parameter set are valid.
224
225**Parameters**
226
227| Name| Description|
228| -------- | -------- |
229| paramSet | Indicates the pointer to the parameter set to check. |
230
231**Returns**
232
233Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the parameters in the parameter set are valid; returns an error code otherwise.
234
235
236### OH_Huks_isParamSetValid()
237
238
239```
240int32_t OH_Huks_isParamSetValid (const struct OH_Huks_ParamSet * paramSet, uint32_t size )
241```
242**Description**
243
244Checks whether a parameter set is of the valid size.
245
246**Parameters**
247
248| Name| Description|
249| -------- | -------- |
250| paramSet | Indicates the pointer to the parameter set to check. |
251| size | Indicates the memory size occupied by the parameter set. |
252
253**Returns**
254
255Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the size of the parameter set is valid; returns an error code otherwise.
256