Skip to content

Coverity 900513 - dead code in FIPS self-test #3512

@steven-bellock

Description

@steven-bellock

At line 103, the values of ff_key1_length and ff_key2_length are both guaranteed to be 256, and as such the check is redundant.

if (!result || ff_key1_length != 256) {
LIBSPDM_DEBUG((LIBSPDM_DEBUG_INFO, "FFDH compute key failed \n"));
libspdm_dh_free(dh1);
libspdm_dh_free(dh2);
result = false;
goto update;
}
result = libspdm_dh_compute_key(dh2, ff_public_key1, ff_public_key1_length,
ff_key2, &ff_key2_length);
if (!result || ff_key2_length != 256) {
LIBSPDM_DEBUG((LIBSPDM_DEBUG_INFO, "FFDH compute key failed \n"));
libspdm_dh_free(dh1);
libspdm_dh_free(dh2);
result = false;
goto update;
}
/*self_test*/
if (ff_key1_length != ff_key2_length) {
LIBSPDM_DEBUG((LIBSPDM_DEBUG_INFO, "FFDH self_test failed \n"));
libspdm_dh_free(dh1);
libspdm_dh_free(dh2);
result = false;
goto update;
}

Metadata

Metadata

Assignees

Labels

refactorShould not affect functionality

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions