Skip to content

Commit

Permalink
Removing compiler warnings when passing an uninitialized dummy object…
Browse files Browse the repository at this point in the history
… into SEVCert constructor

Signed-off-by: Brian Lilienthal <[email protected]>
  • Loading branch information
lilienbm-zz committed Aug 16, 2019
1 parent a3647d5 commit 3109b4a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions deps-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ check_dependencies()
[ "$(rpm -q 'zip' 2>&1 | grep 'not installed')" != "" ] ||
[ "$(rpm -q 'wget' 2>&1 | grep 'not installed')" != "" ] ||
[ "$(rpm -q ${LIBVIRT_NAME} 2>&1 | grep 'not installed')" != "" ] ||
[ "$(rpm -q ${UUID_NAME} 2>&1 | grep 'not installed')" != "" ] ||
[ "$(rpm -q ${UUID_NAME} 2>&1 | grep 'not installed')" != "" ] ||
[ "$(rpm -q ${AUTO_CONF} 2>&1 | grep 'not installed')" != "" ] ||
[ "$(rpm -q ${SSL_DEV} 2>&1 | grep 'not installed')" != "" ] ||
[ "$(rpm -q ${GCC_CPP} 2>&1 | grep 'not installed')" != "" ]
Expand All @@ -153,7 +153,7 @@ check_dependencies()
[ "$(dpkg -l 'zip' 2>&1 | grep 'no packages')" != "" ] ||
[ "$(dpkg -l 'wget' 2>&1 | grep 'no packages')" != "" ] ||
[ "$(dpkg -l ${LIBVIRT_NAME} 2>&1 | grep 'no packages')" != "" ] ||
[ "$(dpkg -l ${UUID_NAME} 2>&1 | grep 'no packages')" != "" ] ||
[ "$(dpkg -l ${UUID_NAME} 2>&1 | grep 'no packages')" != "" ] ||
[ "$(dpkg -l ${AUTO_CONF} 2>&1 | grep 'no packages')" != "" ] ||
[ "$(dpkg -l ${SSL_DEV} 2>&1 | grep 'no packages')" != "" ] ||
[ "$(dpkg -l ${GCC_CPP} 2>&1 | grep 'no packages')" != "" ]
Expand Down
5 changes: 3 additions & 2 deletions src/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,9 +995,10 @@ bool Command::derive_master_secret(aes_128_key master_secret,
return false;

sev_cert dummy;
SEVCert tempObj(dummy); // TODO. Hack b/c just want to call function later
memset(&dummy, 0, sizeof(sev_cert)); // To remove compile warnings
SEVCert tempObj(dummy); // TODO. Hack b/c just want to call function later
bool ret = false;
EVP_PKEY *plat_owner_pub_key = NULL; // Platform owner public key
EVP_PKEY *plat_owner_pub_key = NULL; // Platform owner public key
size_t shared_key_len = 0;

do {
Expand Down
12 changes: 8 additions & 4 deletions src/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ bool Tests::test_factory_reset()
bool ret = false;
Command cmd(m_output_folder, m_verbose_flag);
sev_cert dummy;
SEVCert cert(dummy);
memset(&dummy, 0, sizeof(sev_cert)); // To remove compile warnings
SEVCert cert(dummy); // TODO. Hack b/c just want to call function later

do {
printf("*Starting factory_reset tests\n");
Expand Down Expand Up @@ -337,7 +338,8 @@ bool Tests::test_pek_cert_import()
sev_cert pdh_orig;
sev_cert pdh_new;
sev_cert dummy;
SEVCert cert(dummy);
memset(&dummy, 0, sizeof(sev_cert)); // To remove compile warnings
SEVCert cert(dummy); // TODO. Hack b/c just want to call function later

do {
printf("*Starting pek_cert_import tests\n");
Expand Down Expand Up @@ -434,7 +436,8 @@ bool Tests::test_set_self_owned()
bool ret = false;
Command cmd(m_output_folder, m_verbose_flag);
sev_cert dummy;
SEVCert cert(dummy);
memset(&dummy, 0, sizeof(sev_cert)); // To remove compile warnings
SEVCert cert(dummy); // TODO. Hack b/c just want to call function later

do {
printf("*Starting factory_reset tests\n");
Expand Down Expand Up @@ -487,7 +490,8 @@ bool Tests::test_set_externally_owned()
bool ret = false;
Command cmd(m_output_folder, m_verbose_flag);
sev_cert dummy;
SEVCert cert(dummy);
memset(&dummy, 0, sizeof(sev_cert)); // To remove compile warnings
SEVCert cert(dummy); // TODO. Hack b/c just want to call function later

do {
printf("*Starting set_externally_owned tests\n");
Expand Down

0 comments on commit 3109b4a

Please sign in to comment.