@@ -139,16 +139,15 @@ void derive_ecdh_session_keys(uint8_t derived_key_count,
139
139
CK_OBJECT_HANDLE ecdh = {0 };
140
140
141
141
CK_ECDH1_DERIVE_PARAMS params = {0 };
142
- memset (¶ms, 0 , sizeof (params));
143
142
params.kdf = CKD_NULL;
144
143
params.pSharedData = NULL ;
145
144
params.ulSharedDataLen = 0 ;
146
145
// TODO populate pPublicData and ulPublicDataLen from fuzzer generated data?
147
146
params.pPublicData = new uint8_t [50 ];
147
+ memset (params.pPublicData , 0 , 50 );
148
148
params.ulPublicDataLen = 50 ;
149
149
150
150
CK_MECHANISM mechanism = {0 };
151
- memset (&mechanism, 0 , sizeof (mechanism));
152
151
mechanism.mechanism = CKM_ECDH1_DERIVE;
153
152
mechanism.pParameter = (void *) ¶ms;
154
153
mechanism.ulParameterLen = sizeof (params);
@@ -185,8 +184,7 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
185
184
186
185
FuzzedDataProvider *fdp = new FuzzedDataProvider (data, size);
187
186
188
- test_case_t test_case;
189
- memset (&test_case, 0 , sizeof (test_case_t ));
187
+ test_case_t test_case = {0 };
190
188
test_case.attribute_count = fdp->ConsumeIntegral <CK_ULONG>();
191
189
test_case.obj_handle = fdp->ConsumeIntegral <CK_OBJECT_HANDLE>();
192
190
test_case.derived_ecdh_key_count = fdp->ConsumeIntegral <uint8_t >();
@@ -198,8 +196,8 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
198
196
test_case.attribute_count = 10 ;
199
197
}
200
198
201
- CK_ATTRIBUTE_PTR attribute_array;
202
- CK_ATTRIBUTE_PTR ecdh_attribute_array;
199
+ CK_ATTRIBUTE_PTR attribute_array = NULL ;
200
+ CK_ATTRIBUTE_PTR ecdh_attribute_array = NULL ;
203
201
populate_attribute_template (&attribute_array, test_case.attribute_count , fdp);
204
202
populate_derived_ecdh_key_template (&ecdh_attribute_array, fdp);
205
203
0 commit comments